I’m not sure there are local laws requiring hospitals to treat emergency cases. Maybe there are.
Doctors have independent ethical duties.
Certainly seems like a fertile ground for lawsuits when hospitals let corpses start to pile up at the emergency room door while the doctors are inside busily doing nose jobs.