Answer: The Shulchan Aruch (OC 370:4) writes that neighbours whose houses back onto a shared courtyard where they eat together do not require an eruv as they are considered to be like one family.
In the previous seif, the Shulchan Aruch writes that a boarder does not need to make an eruv with their host even if they sleep on a separate floor. As they use the house for functions other than sleeping, it is all considered to be one house for purposes of eruvin.
R’ Nosson Gestetner (Lehoros Nosson 5:29) compares this to a hospital where patients receive their food, bedding and medication from the hospital. Unlike a hotel where guests rent a specific room, the hospital reserves the right to move patients around from one ward to another as they deem fit (See Biur Halacha 370). Thus, R’ Avraham Borenstein (Avnei Nezer 3:380) writes that patients are not considered to be renting their own space, thus obviating the need for an eruv. Likewise, they would not be obligated to affix a mezuza even if they were there for over thirty days.
The Shulchan Aruch (OC 370:2) writes that if a landlord rents out various rooms that contain valuable furniture, then the residents are considered to be the landlord’s guests and so would not need an eruv to carry to a shared courtyard. As hospitals keep valuable equipment in each room which only their madical staff can use R’ Gestetner writes that this, too, means that this space does not belong to the patient.
In conclusion, one may carry indoors within a hospital’s building on Shabbos.