Officials at the state Department of Public Health have ordered Massachusetts hospitals to stop turning away ambulances when their emergency rooms are overcrowded. While the practice may give hospitals temporary breathing room, Paul Dreyer, director of healthcare safety and quality, said it has done nothing to solve the problem of patients backing up in ER hallways because hospitals have no open beds. Instead, diverting ambulances has caused problems, he said, interfering with patient choice, increasing the time patients spend in ambulances, tying up the vehicles, and shifting crowding to other hospitals.