Lying in a hospital bed last month, Madhvi Aya understood what was happening to her.

She had been a doctor in India, then trained to become a physician assistant after she immigrated to the United States. She had worked for a dozen years at Woodhull Medical Center, a public hospital in Brooklyn, where she could see the coronavirus tearing a merciless path through the city.

Within days of her last shift as a caregiver, Ms. Aya became a patient. She had worked in Woodhull’s understaffed emergency room, taking medical histories, ordering tests and asking about symptoms. Now she had become infected.

Ms. Aya, 61, was alone in a hospital, less than two miles from her husband and 18-year-old daughter on Long Island, who could not visit her. She did not have the solace of familiar colleagues; she had been admitted to a different facility nearer her home. In a text with her family, she described horrible chest pain from trying to get out of bed.

“I have not improved the way should have been,” she wrote her husband, Raj, on March 23.

As she grew sicker, her texts came less frequently and in short, sporadic bursts.