Using OpenEMR v5.0.1 (7) with Windows 10
Hello everyone. Now that prescriptions are allowed for telemedicine in India I’m trying to format the OpenEMR prescription to local guidelines. I’m presently stuck at getting drug generic name into the prescription.
I’ve reached this far
Drug generic name is in drug_templates table in ‘selector’ field
Same is captured in C_Prescription.Class.php as ‘t.selector’ on line 49
$res = sqlStatement("SELECT d.name, d.ndc_number, d.form, d.size, " .
"d.unit, d.route, d.substitute, t.drug_id, t.selector, t.dosage, " .
"t.period, t.quantity, t.refills, d.drug_code " .
"FROM drug_templates AS t, drugs AS d WHERE " .
"d.drug_id = t.drug_id ORDER BY t.selector");
It is not assigned to $drug_attributes and then I’m unable to add it without it throwing a blank window when attempting to print to pdf
while ($row = sqlFetchArray($res)) {
$tmp_output = $row['selector'];
if ($row['ndc_number']) {
$tmp_output .= ' [' . $row['ndc_number'] . ']';
}
$drug_array_values[] = $row['drug_id'];
$drug_array_output[] = $tmp_output;
if ($drug_attributes) {
$drug_attributes .= ',';
}
$drug_attributes .= "['" .
attr($row['name']) . "'," . // 0
attr($row['form']) . ",'" . // 1
attr($row['dosage']) . "','" . // 2
attr($row['size']) . "'," . // 3
attr($row['unit']) . "," . // 4
attr($row['route']) . "," . // 5
attr($row['period']) . "," . // 6
attr($row['substitute']) . "," . // 7
attr($row['quantity']) . "," . // 8
attr($row['refills']) . "," . // 9
attr($row['quantity']) . "," . // 10 quantity per_refill
attr($row['drug_code']) . "]"; // 11 rxnorm drug code
}
I have managed to alter the function ‘get_prescription_body_text()’ (line541)
to include the ‘drug_id’ number. But all my efforts to similiarly include ‘selector’ result in a blank window. I’ve reproduced the function as I have altered it below and its generating the prescription pdf. What I need is help to get ‘selector’ to show in the place where I’ve managed to put ‘get_drug_id()’. Substituting it is not working.
function get_prescription_body_text($p)
{
$body = "<b>- " . text($p->form_array[$p->get_form()]) . ' ' . text($p->get_drug()) . ' (' . text($p->get_drug_id()) . ') ' . text($p->get_size()) . text($p->get_unit_display());
/* if ($p->get_form()) {
$body .= ' [' . text($p->form_array[$p->get_form()]) . "]";
}
*/
$body .= '</b>' . // <i>" .
// text($p->substitute_array[$p->get_substitute()]) . "</i>\n" .
// '<b>' . xlt('Sig') . ':</b> ' . text($p->get_dosage()) . ' ' . text($p->form_array[$p->get_form()]) . ' ' .
// text($p->route_array[$p->get_route()]) .
' ' . text($p->interval_array[$p->get_interval()]) .
' x <b>' . text($p->get_quantity()) . '</b>' . xlt('days') ;
if ($p->get_refills() > 0) {
$body .= "\n<b>" . xlt('Refills') . ":</b> <u>" . text($p->get_refills());
if ($p->get_per_refill()) {
$body .= " " . xlt('of quantity') . " " . text($p->get_per_refill());
}
$body .= "</u>\n";
} /* else {
$body .= "\n<b>" . xlt('Refills') . ":</b> <u>0 (" . xlt('Zero') . ")</u>\n";
}
*/
$note = $p->get_note();
if ($note != '') {
$body .= "\n(" . text($note) . ")\n";
}
return $body;
}
Any help would be appreciated. Thanks in advance.