Read about OpenEMR's Response to the COVID-19 Pandemic at https://www.open-emr.org/covid19/

Prescription Address tided to Provider default location

I have an item of possible discussion. The situation has arisen where the providers work in multiple locations. In the system, the prescriptions always print with the provider’s default location. This works great if you are a solo practitioner. But not so good in a multi-provider multi-location situation. The prescription needs to have the address of the location where the patient was treated.

I made an edit to the C_Prescriptions.class.php file to make this possible. It needs some refinement. I was hoping to get some input about making this a feature in the codebase.

Starting around lines 333 here is what was done.

function multiprint_header(& $pdf, $p)
{
	$getEncounterFacility = sqlQuery("SELECT facility FROM form_encounter WHERE encounter = " . $_SESSION['encounter'] );
    $this->providerid = $p->provider->id;
    //print header
    $pdf->ezImage($GLOBALS['oer_config']['prescriptions']['logo'], '', '50', '', 'center', '');
    $pdf->ezColumnsStart(array('num'=>2, 'gap'=>10));
    /*$res = sqlQuery("SELECT concat('<b>',f.name,'</b>\n',f.street,'\n',f.city,', ',f.state,' ',f.postal_code,'\nTel:',f.phone,if(f.fax != '',concat('\nFax: ',f.fax),'')) addr FROM users JOIN facility AS f ON f.name = users.facility where users.id ='" .
        add_escape_custom($p->provider->id) . "'");*/
	$res = sqlQuery("SELECT concat('<b>',name,'</b>\n',street,'\n',city,', ',state,' ',postal_code,'\nTel:',phone,if(fax != '',concat('\nFax: ',fax),''))
	addr FROM facility where name ='" . $getEncounterFacility['facility'] . "'");	
    $pdf->ezText($res['addr'], 12);

I added a query to get the encounter facility to replace the provider facility. This works as long as the provider is in an encounter when printing a prescription. Yes, prescriptions still are being printed.

@mdsupport
I was trying to come up with what would be the best way to do this. Should it be automatically decided by the system if there is more than one facility to switch the query or should this become the norm? No global?

@sunsetsystems
What is your thought on this if any?

Thanks for giving me a message board to scribble my thought on.

It makes sense that if prescription is related to encounter, that facility address be used - specially for facilities across state lines. In situation when there is no linked encounter(e.g. patient called for renewal), you could give clinician an option to choose the address. Take a look at bootstrap dropdowns, specifically its ability to offer options as part of button (e.g. Save or Print). They can click on text to use default or click on down arrow and choose specific address.

1 Like

That is a requirement in various countries…one that comes to mind is Greece.

1 Like