Exemple #1
0
function OutsidePrescription($doc, $r, $pid, $prescid)
{
    global $msg;
    if ($prescid) {
        $prec = sqlQuery("SELECT p.note,p.dosage,p.substitute,p.per_refill,p.form,p.route,p.size,p.interval,p.drug,l1.title AS title1,l2.title AS title2,l3.title AS title3,l4.title AS title4,p.id AS prescid,\n            DATE_FORMAT(date_added,'%Y%m%d') AS date_added,CONCAT_WS(fname,' ',mname,' ',lname) AS docname,p.quantity\n            FROM prescriptions AS p\n            LEFT JOIN users AS u ON p.provider_id=u.id\n            LEFT JOIN list_options AS l1 ON l1.list_id='drug_form' AND l1.option_id=p.form\n            LEFT JOIN list_options AS l2 ON l2.list_id='drug_route' AND l2.option_id=p.route\n            LEFT JOIN list_options AS l3 ON l3.list_id='drug_interval' AND l3.option_id=p.interval\n            LEFT JOIN list_options AS l4 ON l4.list_id='drug_units' AND l4.option_id=p.unit\n            WHERE p.drug<>'' and p.id=?", array($prescid));
        $b = $doc->createElement("OutsidePrescription");
        $externalId = $doc->createElement("externalId");
        $externalId->appendChild($doc->createTextNode($prec['prescid']));
        $b->appendChild($externalId);
        $date = $doc->createElement("date");
        $date->appendChild($doc->createTextNode($prec['date_added']));
        $b->appendChild($date);
        $doctorName = $doc->createElement("doctorName");
        $doctorName->appendChild($doc->createTextNode($prec['docname']));
        $b->appendChild($doctorName);
        $s = stripSpecialCharacter($prec['drug']);
        $sig = $doc->createElement("drug");
        $sig->appendChild($doc->createTextNode(trimData($s, 80)));
        $b->appendChild($sig);
        $x = stringToNumeric($prec['quantity']);
        $dispenseNumber = $doc->createElement("dispenseNumber");
        $dispenseNumber->appendChild($doc->createTextNode($x[0]));
        $b->appendChild($dispenseNumber);
        $s = trimData($x[1] . $prec['size'] . " " . $prec['title4'] . " " . $prec['dosage'] . " In " . $prec['title1'] . " " . $prec['title2'] . " " . $prec['title3'], 140);
        $s = stripSpecialCharacter($s);
        $sig = $doc->createElement("sig");
        $sig->appendChild($doc->createTextNode($s));
        $b->appendChild($sig);
        $refillCount = $doc->createElement("refillCount");
        $x = stringToNumeric($prec['per_refill']);
        $refillCount->appendChild($doc->createTextNode($x[0]));
        $b->appendChild($refillCount);
        $prescriptionType = $doc->createElement("prescriptionType");
        $prescriptionType->appendChild($doc->createTextNode('reconcile'));
        $b->appendChild($prescriptionType);
        $r->appendChild($b);
    }
}
Exemple #2
0
 public function getPatientPrescriptions($prescriptionIds)
 {
     $elements = array();
     foreach ($prescriptionIds as $prescriptionId) {
         if ($prescriptionId) {
             $prescription = $this->getStore()->getPrescriptionById($prescriptionId);
             $prescription['quantity'] = stringToNumeric($prescription['quantity']);
             $prescription['per_refill'] = stringToNumeric($prescription['per_refill']);
             $element = $this->getOutsidePrescription(array('externalId' => $prescription['prescid'], 'date' => $prescription['date_added'], 'doctorName' => $prescription['docname'], 'drug' => $this->trimData($this->stripSpecialCharacter($prescription['drug']), 80), 'dispenseNumber' => $prescription['quantity'][0], 'sig' => $this->trimData($this->stripSpecialCharacter($prescription['quantity'][1] . $prescription['size'] . ' ' . $prescription['title4'] . ' ' . $prescription['dosage'] . ' In ' . $prescription['title1'] . ' ' . $prescription['title2'] . ' ' . $prescription['title3'], 140)), 'refillCount' => $prescription['per_refill'][0], 'prescriptionType' => 'reconcile'));
             $this->addSentPrescriptionId($prescriptionId);
             $elements[] = $element;
         }
     }
     return $elements;
 }