예제 #1
0
function Patient($doc, $r, $pid)
{
    global $msg, $warning_msg, $dem_check;
    $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);
    if ($patient_data['lname'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient Last name is missing"), ENT_NOQUOTES) . "<br>";
    }
    $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);
    if ($patient_data['fname'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient First name is missing"), ENT_NOQUOTES) . "<br>";
    }
    $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);
    $msg = validation(xl('Patient Address'), $patient_data['street'], $msg);
    if (trim($patient_data['street']) == '') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Address is missing"), ENT_NOQUOTES);
    }
    $address1 = $doc->createElement("address1");
    $address1->appendChild($doc->createTextNode($patient_data['street']));
    $PatientAddress->appendChild($address1);
    //$msg = validation(xl('Patient City'),$patient_data['city'],$msg);
    if ($patient_data['city'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient City is missing"), ENT_NOQUOTES) . "<br>";
    }
    $city = $doc->createElement("city");
    $city->appendChild($doc->createTextNode($patient_data['city']));
    $PatientAddress->appendChild($city);
    if ($patient_data['state']) {
        $state = $doc->createElement("state");
        $state->appendChild($doc->createTextNode($patient_data['state']));
        $PatientAddress->appendChild($state);
    }
    if ($patient_data['postal_code']) {
        $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);
    if (trim($patient_data['country_code']) == '' && $GLOBALS['erx_default_patient_country'] == '') {
        $dem_check .= htmlspecialchars(xl("Patient Country is missing. Also you have not set default Patient Country in Global Settings"), ENT_NOQUOTES) . "<br>";
    } elseif (trim($patient_data['country_code']) == '') {
        $patient_data['country_code'] = $GLOBALS['erx_default_patient_country'];
    }
    $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']);
    if ($patient_data['phone_home']) {
        $homeTelephone = $doc->createElement("homeTelephone");
        $homeTelephone->appendChild($doc->createTextNode($patient_data['phone_home']));
        $PatientContact->appendChild($homeTelephone);
    }
    $b->appendChild($PatientContact);
    $PatientCharacteristics = $doc->createElement("PatientCharacteristics");
    if (trim($patient_data['date_of_birth']) == '' || $patient_data['date_of_birth'] == '00000000') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Date Of Birth is missing"), ENT_NOQUOTES);
    }
    if ($patient_data['date_of_birth'] && $patient_data['date_of_birth'] != '00000000') {
        $dob = $doc->createElement("dob");
        $dob->appendChild($doc->createTextNode($patient_data['date_of_birth']));
        $PatientCharacteristics->appendChild($dob);
    }
    if (trim($patient_data['sex']) == '') {
        $warning_msg .= "<br>" . htmlspecialchars(xl("Patient Gender is missing"), ENT_NOQUOTES);
    }
    if ($patient_data['sex']) {
        $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);
    $allergyId = PatientFreeformAllergy($doc, $b, $pid);
    $r->appendChild($b);
    return $allergyId;
}
예제 #2
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);
}