
BIG Spoiler
Based on what I read in the web novel, it seems like both him and Mao's mother both wanted to marry. Prostitutes knew how to prevent/get rid of a child, but Mao's mother did nothing. They both loved each other but were too awkward to properly express it or communicate well. If I remember correctly, he didn't even know she was pregnant before he left to war (to prove himself so he could marry Mao's mother). He only realized he had a child when he came back from war and saw Mao's small pinky finger in a letter.

So I checked and it's not really shown, in ch.29 mao mao has a dream of the moment her finger is cut off but it looks like she had five fingers in the hand her mother (I think) was going to cut, but in the future she has all her fingers so I guess that's going to be clarified later.
http://www.mangago.zone/read-manga/kusuriya_no_hitorigoto/nbt/mpn_chapter-2129791/pg-1/
Really don’t like Rakan and the implication that he’s Mao’s father whom practically forced a pregnancy on Mao’s mother, but goddamn is his timing on point.
Pretty sure he knew what’s going to happen, but this was a setup for Mao to either show her intelligence and save Jinshi or not and leave Jinshi for dead leaving her out of employment and easier for Rakan to get custody of her.