How to customize the referral form?

(D Amy Martin) #1

Has anyone figured out how to include patient insurance information in the referral form?

(Stephen Waite) #2

hi @D_Amy_Martin, do you mean after you create a new transaction under Transactions from the person’s summary screen?

(D Amy Martin) #3

I’ll do screenshots tomorrow and upload them but no it’s from patient demographics page and then clicking transaction to add the referral form I want to include their insurance information on that referral form that we print out when we’re referring a patient to another provider.

(Stephen Waite) #4

hi, think we’re talking about the same method, this is an example from the demo farm,

(D Amy Martin) #5

When I get to the office tomorrow I will look at all this and see but I really hope so…

(Stephen Waite) #6

should be pretty doable, was also thinking about the standardized electronic transactions for people who have to do this every day,

(D Amy Martin) #7

Yup. You are right. I’ll let you know…

(D Amy Martin) #8


(D Amy Martin) #9

When I add the referral form under the transactions and it populates, I would like for it to include the patient’s insurance information. If it can automatically populate with the patients address and phone number and basic demographics, I would think there would be a way to include the patient’s insurance information as well.

(ViSolve) #10

Including patient’s insurance information in referral form requires some code customisation.
We have described some simple steps to make it happen.

  1. Include below lines in the file “interface/patient_file/transaction/print_referral.php”

Below code creates a label tag for insurance details. (Approximately line no: 55 in OpenEMR 5.0.2)

‘label_subhead_referred’ => xlt(‘For Referred Organization/Practitioner’),
‘label_insurance_name’ => xlt(‘Insurance Name’),
‘label_insurance_date’ => xlt(‘Insurance Date’)

Next step is to fetch the insurance data using existing function

if ($patient_id) {
$patdata = getPatientData($patient_id);
$insurancedata=getInsuranceData($patient_id); //New line included to fetch data
$patient_age = getPatientAge(str_replace(’-’, ‘’, $patdata[‘DOB’]));
} else {
$patdata = array(‘DOB’ => ‘’);
$patient_age = ‘’;

Also include below line, (Approximate line no: 198/ After $patdata for loop)

foreach ($insurancedata as $key => $value) {
$s = str_replace("{insurance_$key}", text($value), $s);

  1. Include the lines to display the insurance information in file “sites/default/referral_template.html”

Finally the output will be,

Try out and let us know if you have any clarifications.


(D Amy Martin) #11

Thank you. I’m going to go into the office and try this out tomorrow and hopefully, everything will work out good. Really excited.

(Stephen Waite) #12

will get this into the codebase and hopefully the next patch

will give visolve credit for the code tips :slight_smile:

(D Amy Martin) #13

I haven’t upgraded to 5.0.2 yet. We are still using 5.0.1. When I added the extra lines of code, I ended up with a blank screen when I click the view button. I’ll work on it some more later. I do also want to include the insurance policy number on the referral form. I might wait to make these changes after I do the upgrade.

(Stephen Waite) #14

Sure, will hopefully have the 2nd patch of 5.0.2 out next weekend and will have this working by then and included

(D Amy Martin) #15

Do you know if the second patch is ready to come out? Were you able to figure out how to include the patients insurance subscriber ID along with the insurance name???

(Stephen Waite) #16

hi @D_Amy_Martin, won’t be much longer for patch 2 or you could use these file changes, Referral (#2729) · openemr/openemr@4c62698 · GitHub