Iain Connell, 27, whose address was given as Carmunnock, admitted a total of five charges involving incidents at the hospital and at the Loreburn Street Police Station in Dumfries in August.
He admitted initially behaving in a threatening or abusive manner outside the Granary pub in Loreburn Street, shouting and swearing and challenging police officers to fight.
The next chapter came at the nearby police station when he admitted striking another man on the head with his head and biting him on the body.
He went on to plead guilty to behaving in a threatening or abusive manner at the police station, repeatedly shouting and swearing and making threatening, abusive and homophobic remarks towards officers.
At the hospital he admitted obstructing two nurses, making sexual remarks to one and abusive remarks to the other and throwing a bottle of urine onto the floor and also pleaded guilty to assaulting a policeman at the hospital by attempting to bite him on the body and kicking him on the leg.
Solicitor Vicki McMinn said Connell had been consuming alcohol and had no recollection of the events.
Sheriff Brian Mohan deferred sentence on Friday to October 4.
NEWSDESK: 01461-202417