Export a full encounter as pdf

Hi,
I am trying to work my way though all the tables and how they are connected and I am getting to some results, but I thought maybe asking somebody who just KNOWS the structure of the database, gets me on the way without missing anything.
What I have to do is output an encounter for a patient as a pdf files which includes all the data in the encounter forms.
So, 1st what table do I use best to get all the encounters for a specific patient ID - the same info that I see when I look at the encounter history in a patients demographics?
Once I have the array of all the encounters, I use each of them (by data) to find all the data for this encounter. For this one, how do I find all the forms (and I have a lot of custom forms there) that were used in that encounter?

Thanks for any help you might be able to give me here.
Merlin

hi @MerlinSilk, have you tried Report from the pt summary screen?57%20AM

Hi Stephen,

thanks, but I guess I was not clear that I am trying to do this programmatically, not from the user interface. I have my customization function already written in php and now want to learn what SQL queries I have to write against the database to get the data I described in my initial message.

Cheers,
Merlin

well this script builds the custom report so it must step through the database to gather all of the relevant data

Excellent Stephen!
that helped me a lot already - digging myself through the code.
I might have a few follow up questions, but for now I am up and running.
Thanks - Merlin

This gets you nuts and bolts. Especially pdf,
openemr/interface/patient_file/report/custom_report.php

1 Like