Most electronic medical records (EMR) systems are really about billing. Yes, there are clinically relevant data fields available but a large amount of what we were after as researchers was only available in free-text. Data abstraction is still mostly a human-expert driven activity. It would be fun if that could be better automated but there is significant ambiguity in clinical notes and pathology reports.
And don't get me started on data-ownership "turf wars." We often got significant pushback and simple refusal to have regular data feeds of IRB-approved data fields for collection with patients who were consented to studies.
Nothing was more annoying to me to get shot-down when trying to get data from our hospital EMR (again, data that was specifically approved for research use by IRB for patients already consented to studies) only to hear later about private enterprise "partnerships" that had full and unlimited access to all EMR data . . .