As a general rule, hospital security and controlling access has gotten tighter over the past 20 years or so. In the old days, visiting hours were maybe 1-2 hours, and all visitors had to pass by the nursing station first before they could see a patient. Nowadays, for the general medical/surg/labor and delivery wards, visiting hours are longer and access to the ward may be much more open. This improves patient satisfaction and makes the patients and family happier.
The level of security on a hospital ward depends on what type of care is provided there. The highest security is going to be on a locked forensic psych ward or the correctional healthcare ward, where the mentally-ill criminals or the hospitalized criminals are kept. Next comes the newborn nursery, in which access is controlled through locked doors, every baby gets a baby LoJack and the doors automatically lock and alarms go off if someone tries to remove a baby without deactivating the baby LoJack. Then comes the intensive care units that also often have either locked doors or the entrance goes through the ward front desk, so they can keep an eye out on comings and goings. This is also the usual setup for people in comas or other profound neurological issues. The typical med/surg ward is more open with little access control.
The Joint Commission, which is the primary accreditation agency of hospitals does have security criteria, and harm to a patient from an assault at the hospital is a 'never event'. 'Never events' are bad, and worse things can happen to your accreditation and penalties against the hospital can happen due to 'never events'.
https://psnet.ahrq.gov/primers/primer/3/never-events