US hospitals have been severely affected by a substantial cyberattack, leading to the closure of emergency rooms in multiple states and the redirection of ambulances.