Brian O'Hagan, 22, whose address was given as Maghaberry prison, abused members of the hospital's A&E department as they tried to treat him for head injuries.
The incident happened hours after O'Hagan was caught stealing a bottle of alcohol from a supermarket.
The judge said that his behaviour in the hospital was appalling.
A prosecution solicitor said his behaviour upset other patients in the hospital.
The judge warned that neither he nor other judges would tolerate what he called the loutish behaviour by people in the hospital.

Asthma UK, which questioned more than 4,500 patients, said two-thirds miss out on yearly check-ups, tailored advice and lessons in how to use their asthma inhalers.
It says it is a slight improvement on a year ago but remains a bleak picture.
In 2015 in the UK, 1,468 people died from an asthma attack - the highest level in a decade.
The latest annual asthma care survey suggests:
Asthma UK says this is not good enough.
According to the charity, two in every three asthma deaths could be prevented with good basic care.
In the UK, 5.4 million people are currently receiving treatment for asthma. One million of these are children.
NHS England says every asthma patient should be supported to manage their condition and offered regular reviews.
Asthma UK says it is not just medical staff who need to do more, people with asthma must take responsibility for their own care too.
It says digital health technology, including electronic alerts and reminders to mobile phones, could help patients keep on the right track.
An NHS England spokeswoman said: "Whilst we recognise the important issues in this annual survey, we also expect patients to take shared responsibility for managing aspects of this long term condition.
"It is important that patients consult with their GP where necessary and know how to use their medication properly.
"In future, digital solutions may improve dialogue with health professionals and ensure the widespread development of personal asthma action plans to help avoid unnecessary and costly hospital visits for  treatment."
Dr Penny Woods, the chief executive of the British Lung Foundation, said: "The findings of Asthma UK's survey are typical of all lung diseases.
"Patients aren't receiving the care they need to help them manage their condition and there are still wide variations in care across the UK.
"Due to a lack of prioritisation in health policy, we now have the fourth highest mortality rates from lung disease in Europe."
A man who verbally abused staff at Altnagelvin Hospital in Londonderry has been jailed for 10 months.
[NEXT_CONCEPT]
Millions of asthma patients in the UK are not getting basic care they need to manage their condition, a charity says.