Patients who were physically able also helped out. Krystal Rivera, 23, said she was with her hospital roommate, a visitor and a nurse when they heard gunshots.
"I barricaded the door with an IV machine, two chairs and my whole bed," Rivera said.
For hospital employee Gonzalo Corazo, keeping patients safe was his initial reaction to the emergency, he told CNN affiliate WABC-TV
"That's when I panicked, and then all of sudden my first instinct was the patients, taking care of the patients," Corazo said.
De Blasio said that "doctors and nurses, all the personnel, responded with extraordinary bravery, with cool professionalism. They protected each other, they protected their patients even amidst this horrible situation."
Wearing a white lab coat, the suspected shooter was able to enter the hospital and go to the 16th floor, where he used to work. Once there, he began shooting an AM-15 weapon.
During the shooting, the hospital's fire alarm system went off, apparently because the suspect tried to set himself on fire, said James O'Neill, the New York police commissioner.
Both police and firefighters quickly responded to the scene, and they eventually found the suspect dead of a self-inflicted gunshot wound on the 17th floor, O'Neill said.
"There were many things amidst this pain to be proud of today, and God bless our first responders," de Blasio said. "They put the safety of their fellow New Yorkers first, as they always do."
Sridhar Chilimuri, the hospital's physician in chief, praised the speed and professionalism of the New York police, who came into a scene of "total chaos" and established some order.
"We don't work with them every day, but it just seemed to work like a team," Chilimuri said.
Moving the patients
Once first responders put out the fire and gave the all-clear, hospital staff rushed to treat the gunshot victims on the 16th and 17th floors.
As senior officials in the hospital, Chilimuri, Cahill and others went up to the 17th floor and pulled two patients out of the dangerous scene, "literally over dead bodies and blood and gore all over," the physician in chief said.
Staffers began moving those who were seriously injured from floor to floor, picking up doctors along the way to treat the victims' gunshot wounds.
"We had trauma surgeons already in the building, we have neurosurgeons in the building, we have hand surgeons in the building, so that obviously helped us expedite the process very quickly," Chilimuri said.
"There were physicians actively working with nursing staff on every floor, so as each patient came off we took them directly to the emergency room so we could work on them quite quickly."
The speed of their efforts "absolutely" helped save lives, Chilimuri said.
"This happening in a hospital, which is well-prepared for it, we think will end up with good outcomes at the end," he said.
Ambulance EMT Robert Maldonado, who was sheltered in a locked room, told CNN affiliate WABC-TV that he and a partner heard someone yell for EMTs. They jumped out of the room and immediately helped a doctor with a gunshot wound in his stomach.
"He was in a lot of pain obviously," Maldonado to the station.
"We carried him nine floors. The police department helped carry, I helped put pressure on the wound, the entrance and exit wound, and the police department, they all just grabbed his legs, grabbed his arms."
Staff also removed patients from the 16th and 17th floors to more established safe areas. They moved between 40 to 50 patients in less than 10 minutes, Chilimuri said.
Even security guards helped with patients and assisted nurses and doctors, going "way above and beyond the call of duty," said Schneer, the hospital spokesman.