The amount of time spent in the hospital after being wounded depends on the amount of damage you take. This means that healing heavily wounded soldiers with a medkit before they leave the mission will not reduce the amount of sickleave your squaddies get -- what matters is how much they take in, not how much they leave with.
How much damage they can take in without being wounded depends entirely on what armor they're wearing. Armor provides bonus health - if they take more damage than the health bonus provided by the armor, they become wounded.
This means that adding Nano-weave Vests to your soldiers reduces the chance they need hospitalizations, even after being shot, as it gives an additional 2 hitpoints worth of "fleshwounds" they can suffer.
How much "Bonus HP" your units have is shown on the loadout screen - for example, they'll be displayed as HP 10 + 3 (combat armor + nanoweave vest).
In general, there is also an Officer Training School bonus that reduces hospital time.
That said, the simplest answer to your question? Don't get shot. The more damage you take, the longer the time off. Avoid damage as much as possible to minimize hospitalizations.