Thousands of patients are lying on trolleys in corridors for hours on end.