I can speak as someone who works in a hospital in a management position.
Different hospitals have different rules regarding patients moving around the hospital.
It depends on the patient's condition first of all - how stable they are, what devices they have, their care needs, whether it would interfere with their therapy and what precautions they are on. Some don't allow anyone with invasive devices (like IVs) off the unit.
With that met (and approval of the Doctor and nurses caring for the patient), most will allow patients to public areas of the hospital. That includes hallways, lobbies, certain lounges, cafeteria. Outdoors is usually not an issue as long as the patient is cleared to leave their room.
There are areas that are consistently off limits to anyone other than patients on those units/their families/visitors:
ICU - because of the type and instability of patients, how busy it is, invasive procedures and out of respect for the very ill patients and their families.
Emergency - same reasons as ICU
Nursery/Maternity - because of security and infant abduction concerns.
Oncology/cancer care/transplant - because the patients are very immune compromised and vulnerable to infection.
Burn/wound care - patients are very vulnerable to infection.
Lounges for ER, ICU and Surgery are usually only open to family/ friends of patients in those areas.
Pediatrics - because the patients are minors and child abduction concerns (pediatric patients may be able to freely roam their unit, except for other patient rooms).
Some units, like Mental Health and Chemical Dependency encourage patients to be out of their rooms, mingling on the unit. But, patients on those units may not be able to leave the unit without an escort and patients from other units are usually not allowed because of privacy.
Rehab units usually also encourage patients to be out of their rooms, mingling.
Many hospitals don't allow patients to roam on other patient units (hallways might be OK on the same floor) out of concerns for patient privacy. Going to other units to visit staff the patient knows is possibly OK for a short, infrequent visit, but longer visits or frequent visits are discouraged because that can interfere with the staff being able to do their jobs.
Patients visiting another patient in their room is not usually allowed, but might be in special circumstances (family member, close friend).
So, anyway, the point of this post is that if you are a patient, it's best to expect you may not be able to leave your unit or possibly even your room.