A teenager who had lived with her vital organs outside her body for 19 years has been saved by doctors.