Doctors fought to revive an unconscious patient - then watched him kick and spit on a police officer.
David Brannan was jailed for 10 months on Friday for the "entirely unacceptable" attack.
Hamilton Sheriff Court heard it happened at Hairmyres Hospital, East Kilbride, on May 6.
Brannan, 47, a prisoner, admitted assaulting PC Marios Ieropoulos while on bail for another matter.
He had been taken there after collapsing in the street at an undisclosed location.
Police attended and Brannan claimed to have two broken fingers and sore kidneys. Officers suspected he had been assaulted.
Mairi-Clare McMillan, prosecuting, told the court: "His condition deteriorated and on arrival at hospital he was unresponsive.
"Doctors checked his pulse and tried chest compressions at which point the accused sat up and said he was in severe pain from his back.
"He became abusive and accused the police of assaulting him.
"He kicked out towards an officer, striking him on the stomach.
"The accused was warned about his conduct, but turned round and spat at the same officer, the spittle landing on his arm."
After being checked over, Brannan was transferred to police custody.
Passing sentence, Sheriff Linda Nicolson told him: "For this conduct to occur during the pandemic, with the danger presented to police officers and other emergency workers, is entirely unacceptable."
However, she reduced the sentence from 15 months to 10 after defence agent Mark Connolly pointed out that Brannan had pleaded guilty at the first opportunity.
*Don't miss the latest headlines from around Lanarkshire. Sign up to our newsletters here.
And did you know Lanarkshire Live is on Facebook? Head on over and give us a like and share!