Hi @Former-Member, sorry to hear you are in hospital and struggling with physical pain. It absolutely correlates for me the worse my physical pain impacting on my mental health. (and vice versa).
I am very aware, like @Appleblossom, that my emotional/mental states, particualalry stress and anxiety increases my physical pain so I try to do things that help bring my anxiety levels down. being in hospital is an out-of-control feeling in itself. Calming exercises, concentrating on diaphramatic breathing and trying to turn down the alarm bells helps me a bit.
I learned in 2013 from a specialist pain physician that "all pain is in the brain" (being clear the brain as an organ - not the 'mind' although the mind has interactions with the pain as well) the Central Nervous System is a remarkable thing and we are finely tuned to have pain feedback from the spinal cord to the brain, if pain becomes chronic (following an injury or some other disease mechanism) we get these gateways of telling the brain "there is something terribly wrong - pay attention" gets stuck wide open.
There are some good books about on managing (chronic) pain - but first you have to know that is what it is, it might be some physical reason that needs to be diagnosed, or eliminated as a cause first, so hopefully the staff at the hospital will be able to assist in finding the cause.
I have lived with Chronic sensitised pain syndrome since an actual back injury that occured in 2011. Before that, like @Appleblossom - my main problem area for stress/pain was my neck. I so relate to the pain itself triggering (unwanted and intrusive) memories, that too is where the focussing on one's breathing can help, giving the mind something else to do.
Hope this helps a bit and know you are 'not alone' with it. In the end one can .'manage' pain and even get a reasonable quality of life living with it.
I also wrote about a technique for turning off flashbacks a few days ago that might be a tool you can pop in your toolkit to use if pain triggers memories and flashbacks. it is a method for controlling the memories I learned from a Doctor who was teaching me some techniques in self-hypnosis.
The Remote Control
As the thought/image starts to run, imagine it is on an old TV with a DVD attached.
Pick up a (mental) remote control that has FWD, RWD, PLAY and STOP/OFF on it.
Let the thought/image run for a few seconds then deliberately pick up the remote control and in your mind's eye FWD the 'tape', then, rewind it, press play again and let it start to run at normal speed.
Keep doing this, FWD, RWD and Play, concentrating on the remote and controlling the image/story.
Once you feel you have a good control via the remote, press STOP/OFF.
Practice this every time the same thought/story starts to run.
After a bit of practice - just pick up the mental 'remote" and press OFF.
Then: In the moment after the OFF button has stopped the story...
Come into the room/place you are and for a few moments really concentrate on things in front or around you in the room or whever you are - that picture in a frame, that bookshelf, that rug, that chair, naming them in your mind.
"Chair", "Bookshelf", "Pot Plant"
and concentrate on the sounds outside... "Bird", "car" , "Siren".
That tends to break the nexus of the intrusive thought pretty thoroughly for me and allows me to go on to do something else.