It is forbidden to turn recognized civilian hospitals into a conflict zone. It is a war crime, as is fighting from inside a hospital.
Article 8 of the Rome statute, which established the international criminal court (ICC) in The Hague, defines a long list of war crimes, including intentionally directing attacks against buildings dedicated to hospitals and places where the sick and wounded are collected. But it makes an exception if the targets are 'military objectives.'
If a civilian hospital is used for acts harmful to the enemy, that is the legal term used, the hospital can lose its protected status under international law and be considered a legitimate target. The Israelis have been misusing the latter by fabricating claims that Hamas is using hospitals, like the Al-Shifa Hospital, they "say" it was used as a command post. But the Israelis never provided evidence, only fabrications to present as evidence.
The world has never known that the destruction of all hospitals, clinics; ambulances, medical warehouse, as well as the killings of doctors, nurses, paramedics and even patients were and are still part of the Dahiya doctrine to achieve, that people in Gaza turn against Hamas, and to force the group to surrender. But the Israelis are actually eliminating everything that continues the existence of life of the Palestinians, and that includes medical treatment and health care.
In case you don't see the control bar, you can watch full screen by mouse-over to make the control bar visible, then click the square symbol.