A 21-year-old has appeared in court after it is alleged he assaulted hospital staff and visitors, and later police officers.