I would like to add a Patient Age field to the encounter form. We need this field because we are required to produce reports that require the patient’s age during each encounter. I realize OpenEMR is displaying the age in the bar at the top of the page. Is there a way I can save that information to the form_encounter table? I have created a field in the form_encounter table called patient_age but I’m not sure where to find the code or how to grab the age information already being generated by OpenEMR.
I appreciate your help.
richard
OpenEMR will calculate Age using "getPatientAge " function which is in the file “library/patient.inc” .
Now you can use this function and pass the DOB to this.
For more info, see library/ajax/left_nav_encounter_ajax.php. Here the age calculated and displayed in the main frame.
Hello Ranjith. I see where getPatientAge*($prow) is happening in top.left_nav.setPatient is being called. The real question is how do I get the system to write the results of that call to the table form_enounter table (patient_age field)? I want to capture the age only if a new visit is created for the patient.
I am still learning PHP and MySQL so I’m not sure what code to add to the top.left_nave.setPatient code to get the system to add the patient age to the table when the visit is created. I suspect it will be an INSERT of some sort.
Thanks for your help.
richard
Hello Ranjith. Just a follow-up comment. If I can get the system to save patient age when a new encounter (visit) is created then I can write a query to pull a report like the Encounter Report but with a patient age range. I need to produce a report that shows the number of patients seen by age ranges.
Thanks for your help.
richard