Here's another take, I do not believe that hospital management had the authority to discharge a soldier. When he was released from a hospital it would be to return him to duty. When reporting back to his command, the surgeon would then certify him unfit for further service and he would be discharged and receive a discharge certificate certifying this fact along with adjustment of his pay accounts and travel monies.
However, if this took place late in the war, this fact would most likely not be in evidence on present records, as many, if not most, late war regimental and company paper work were lost to posterity.