Years ago I wrote a story along these lines and it was turned into an episode of Special Victim’s Unit. Sadly, this is what medical ethics has degenerated to.
A movie called “Coma” starring Genevieve Bujold and Michael Douglas was along similar lines.
The brain-dead were kept alive and warehoused until their body parts were needed.