Almost everyone that has a bad crash and ends up for a stay in Hospital will go through a period of self doubt. It's like a mourning period and is based mostly on anxiety about the future. It can be excacerbated by opiates (eg. morphine), boredom, lack of sleep, and general gloominess within the hospital confines.
It is helpful if you have visits from friends and relatives to perk you up a bit, and it certainly helps if you are able to get out of the hospital and into the fresh air an sunshine each day. Keep you mind active, and don't dwell on things too much.
Each person recovers differently, both physically and mentally. There may be psychological factors involved if the injuries were the result of a violent accident. These can be quite debilitating, but are most certainly treatable if picked up.
After leaving hospital I had the support and drive from my wife and daughter, as well as my extended family. They provided the motivation to return to a normal life, and within 3 months I was back at work. Over the years my body has been feeling better and better, and now I'm back on the bike pretty much as if I had never been off it.
One of the biggest hurdles was overcoming post-traumatic stress. I had trouble dealing with noise coming from behind me, which is not good for a cyclist. I self-treated by getting into the city where loud noises were the norm, and after a short period I was no longer startled. Nowdays I don't flich if someone yells at me or honks as their car passes by, and I even comfortable with trucks and buses passing at speed within touching distance.
I hope you get better soon and get back the road with your old cycling buddies