We study the production of charmed hadrons $D^{0}$ and $Lambda_c^+$ in relativistic heavy-ion collisions using an improved quark coalescence model. In particular, we extend the usual coalescence model by letting a produced hadron to have the same velocity as the center-of-mass velocity of coalesced constituent quarks during hadronization to take into account the effect of collective flow in produced quark-gluon plasma. This results in a shift of charmed resonances of higher masses to larger transverse momenta ($p_T^{}$). Requiring all charm quarks of very low $p_T^{}$ to be converted to hadrons via coalescence and letting charm quarks not undergoing coalescence to hadronize by independent fragmentation, we obtain a good description of the measured yield ratio $Lambda_c^+/D^0$ as a function of $p_T^{}$ in $text{Au} + text{Au}$ collisions at $sqrt{s_{NN}}^{}=200$~GeV by the STAR Collaboration at the Relativistic Heavy Ion Collider.