I am in the hospital means that I am a patient in the hospital. I am at the hospital could mean that I am there visiting a patient or for some other reason, such as working there, having a test, etc. Both can be used in all cases except for the university.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.