Hospitals are full of ghosts and very negative entities, way more than graveyards, which counterintuitively actually don’t have that many dead in them, only links to them (graveyards are made by and for the living, unless you summon the dead through their grave, they’re not there, ime, though you will find guardians, fae and parasites).
Hospitals are where most people die in modern society, that and old people’s homes and hospices, so that’s where the ghosts are. The transition from life to afterlife is not manages or assisted at all, and ghosts are abandoned to confusion, without the skills or knowledge to handle their new state. Many of them try to communicate or get back to life.
To do that they need energy to stay in the ghosts state and stay themselves, instead dying the 2nd death to “move on” or reincarnate as a different person.
You also have people in hospitals who died of addiction: it seems the addiction follows as it’s in the energy body as well, so they are desperate to feed it.
In attempts to get energy, relive life experience including addition and generally not be dead, ghosts often posses humans that come into the hospital and live. If they had any kind of weakness, NDE or were under anesthesia, they can be more easily attached to and/or posessed.
So my guess is that’s what’s happened, and whether it’s a non human parasite of a ghost, a good banishing and is needed to get rid of the attached entity.
If it’s an astral parasite you just have to get rid of it and it will take care of itself. If it’s a ghost the best method is to contact him/her and talk them through moving on, as a medium who is a psychopomp would. You can call their relatives and friends who passed before them to come get them and help them, They are often very angry, afraid and upset and need help.
There’s a really good book that explains all this and I believe every word, from the perspective of a therapist who slowly came to realise the people coming to them had attachments called The Unquiet Dead: A Psychologist Treats Spirit Possession by Edith Fiore. It sounds like these people have a similar situation. This book also offers “deposession” techniques, which you could say is a kinder more compassionate form of exorcism, considering it’s probably a person in pain that your friend is dealing with… solve their problem and you solve your friend’s problem too.