You may be aware of this project which aimed to extract information from medical records and pair it with prescribing and hospital data. This would then be anonymised and then used for research, NHS planning and other purposes, as governed by the NHS authorities.
For various reasons this project has been ceased nationally.