China has been gripped by the fate of a 14-year-old girl who tried to kill herself so she could donate her liver to her dying father.

The story of Chen Jin, who lay in critical condition for almost two weeks after attempting to sacrifice herself for her parent, has touched hearts across the country. Donations have flooded in to pay the family's huge medical bills and well-wishers have even offered to give the father their own livers.

Today the hospital in Nanjing, eastern Jiangsu province, announced that her life was out of danger. But it added that a transplant could not save her terminally ill father.

"She loves her dad more than herself," said the teenager's mother, who said her husband had been diagnosed with liver cancer in December and told that he had only three months to live.

The couple decided to keep the news from their daughter for as long as possible. But after Jin came across a medical letter last month explaining the extent of her father's condition she waited until her mother was at the hospital and then attempted to kill herself.

It was only around 10 hours later, when her mother returned home and found the house locked and bolted, that she realised something was wrong. She then forced her way in through a window.

"I saw my daughter lying quite still, as if she were dead, with two empty bottles of pills beside her bed and a suicide note," Cui Lan, 43, told Nanjing's Modern Express newspaper.

The note read: "Mum, I am sorry that I could not be with you any more. Please give my liver to my father after I die."

Jin was rushed to hospital where doctors pumped her stomach twice and gave her a blood transfusion.

For days her distraught mother tried to hide the truth from her husband, telling him that their daughter could not visit him because she was slightly unwell, or busy visiting relatives. In fact, she was lying metres away in the intensive care unit of the same hospital.

Five days after admission, Jin finally emerged from her coma and was even able to write a brief note to her parents, telling her father she would come to visit him.

But only two days later she stopped breathing – and did so again a day later. Doctors became increasingly anxious as she remained in a critical condition. It was only today, 11 days after her suicide attempt, that they declared her out of danger.

Shen Nanping, director of the children's emergency department in Wuxi People's Hospital, said it was a miracle her life had been saved.

He added: "Her vital signs are stable, all organs are working comparatively normally and she can communicate with us. However, her thinking and memory have not fully recovered." He warned it would take several weeks before the full effects of her suicide attempt could be determined.

She is likely to need further surgery because she fell asleep on an electric blanket and the prolonged heat damaged her legs.

The family have had to pay hundreds of thousands of yuan to treat father and daughter, on an income of only around 1,000 yuan (£100) a month. But Cui said today that well-wishers had given so much that all their bills had been covered and she would donate any excess to other needy families. Modern Express said many people had also rung the paper to offer to donate their organs.

They included Zhai Shuyou, a 77-year-old retired worker from Nanjing, who told the paper: "I am in good health. I would like to donate liver to that child's father – my wife and children all agree with it."

But Wang Weidong, the doctor treating the father, said a liver transplant could not save him because the cancer had already spread.