Exemplo n.º 1
0
function Patient($doc, $r, $pid)
{
    global $msg;
    $patient_data = sqlQuery("select *, DATE_FORMAT(DOB,'%Y%m%d') AS date_of_birth from patient_data where pid=?", array($pid));
    $b = $doc->createElement("Patient");
    $b->setAttribute('ID', $patient_data['pid']);
    $PatientName = $doc->createElement("PatientName");
    $patient_data['lname'] = stripSpecialCharacter($patient_data['lname']);
    $patient_data['lname'] = trimData($patient_data['lname'], 35);
    $msg = validation(xl('Patient Last name'), $patient_data['lname'], $msg);
    $last = $doc->createElement("last");
    $last->appendChild($doc->createTextNode($patient_data['lname']));
    $PatientName->appendChild($last);
    $patient_data['fname'] = stripSpecialCharacter($patient_data['fname']);
    $patient_data['fname'] = trimData($patient_data['fname'], 35);
    $msg = validation(xl('Patient First name'), $patient_data['fname'], $msg);
    $first = $doc->createElement("first");
    $first->appendChild($doc->createTextNode($patient_data['fname']));
    $PatientName->appendChild($first);
    $patient_data['mname'] = stripSpecialCharacter($patient_data['mname']);
    $patient_data['mname'] = trimData($patient_data['mname'], 35);
    $middle = $doc->createElement("middle");
    $middle->appendChild($doc->createTextNode($patient_data['mname']));
    $PatientName->appendChild($middle);
    $b->appendChild($PatientName);
    $PatientAddress = $doc->createElement("PatientAddress");
    $patient_data['street'] = stripSpecialCharacter($patient_data['street']);
    $patient_data['street'] = trimData($patient_data['street'], 35);
    $address1 = $doc->createElement("address1");
    $address1->appendChild($doc->createTextNode($patient_data['street']));
    $PatientAddress->appendChild($address1);
    $msg = validation(xl('Patient City'), $patient_data['city'], $msg);
    $city = $doc->createElement("city");
    $city->appendChild($doc->createTextNode($patient_data['city']));
    $PatientAddress->appendChild($city);
    $msg = validation(xl('Patient State'), $patient_data['state'], $msg);
    $state = $doc->createElement("state");
    $state->appendChild($doc->createTextNode($patient_data['state']));
    $PatientAddress->appendChild($state);
    $msg = validation(xl('Patient Zip'), $patient_data['postal_code'], $msg);
    $zip = $doc->createElement("zip");
    $zip->appendChild($doc->createTextNode($patient_data['postal_code']));
    $PatientAddress->appendChild($zip);
    $msg = validation(xl('Patient Country'), $patient_data['country_code'], $msg);
    $county_code = substr($patient_data['country_code'], 0, 2);
    $country = $doc->createElement("country");
    $country->appendChild($doc->createTextNode($county_code));
    $PatientAddress->appendChild($country);
    $b->appendChild($PatientAddress);
    $PatientContact = $doc->createElement("PatientContact");
    $patient_data['phone_home'] = stripPhoneSlashes($patient_data['phone_home']);
    $msg = validation(xl('Patient Home phone'), $patient_data['phone_home'], $msg);
    $homeTelephone = $doc->createElement("homeTelephone");
    $homeTelephone->appendChild($doc->createTextNode($patient_data['phone_home']));
    $PatientContact->appendChild($homeTelephone);
    $b->appendChild($PatientContact);
    $PatientCharacteristics = $doc->createElement("PatientCharacteristics");
    $msg = validation(xl('Patient DOB'), $patient_data['date_of_birth'], $msg);
    $dob = $doc->createElement("dob");
    $dob->appendChild($doc->createTextNode($patient_data['date_of_birth']));
    $PatientCharacteristics->appendChild($dob);
    $msg = validation(xl('Patient Gender'), $patient_data['sex'], $msg);
    $gender_val = substr($patient_data['sex'], 0, 1);
    $gender = $doc->createElement("gender");
    $gender->appendChild($doc->createTextNode($gender_val));
    $PatientCharacteristics->appendChild($gender);
    $b->appendChild($PatientCharacteristics);
    PatientFreeformHealthplans($doc, $b, $pid);
    PatientFreeformAllergy($doc, $b, $pid);
    $r->appendChild($b);
}
Exemplo n.º 2
0
function PatientFreeformHealthplans($doc, $r, $pid)
{
    $resource = sqlStatement('SELECT
            `ins`.`name`
        FROM (
            SELECT
                `id`.`type`,
                `ic`.`name`
            FROM `insurance_data` AS `id`
                LEFT JOIN `insurance_companies` AS `ic` ON `ic`.`id` = `id`.`provider`
            WHERE `id`.`pid` = ?
                AND `id`.`subscriber_relationship` = \'self\'
                AND `id`.`provider` > 0
            ORDER BY `id`.`date` DESC
        ) AS `ins`
        GROUP BY `ins`.`type`;', array($pid));
    while ($row = sqlFetchArray($resource)) {
        $healthplanName = $doc->createElement('healthplanName');
        $healthplanName->appendChild($doc->createTextNode(stripSpecialCharacter(trimData($row['name'], 35))));
        $patientFreeformHealthplans = $doc->createElement('PatientFreeformHealthplans');
        $patientFreeformHealthplans->appendChild($healthplanName);
        $r->appendChild($patientFreeformHealthplans);
    }
}
Exemplo n.º 3
0
function PatientFreeformHealthplans($doc, $r, $pid)
{
    $res = sqlStatement("SELECT `name`,`type` FROM insurance_companies AS ic, insurance_data AS id\n    WHERE ic.id=id.provider AND id.pid=?", array($pid));
    while ($row = sqlFetchArray($res)) {
        $b = $doc->createElement("PatientFreeformHealthplans");
        $allergyName = $doc->createElement("healthplanName");
        $allergyName->appendChild($doc->createTextNode(stripSpecialCharacter(trimData($row['name'], 35))));
        $b->appendChild($allergyName);
        $r->appendChild($b);
    }
}