示例#1
0
 public function checkAge($pid, $immu_id)
 {
     $DOB = $this->patient->getPatientDOBByPid($pid);
     $age = $this->patient->getPatientAgeByDOB($DOB);
     $range = $this->getPreventiveCareAgeRangeById($immu_id);
     if ($age['DMY']['years'] >= $range['age_start'] && $age['DMY']['years'] <= $range['age_end']) {
         return true;
     } else {
         return false;
     }
 }
示例#2
0
 public function get_PatientTokensData($pid, $allNeededInfo, $tokens)
 {
     $patientData = $this->getAllPatientData($pid);
     $age = $this->patient->getPatientAgeByDOB($patientData['DOB']);
     $patienInformation = array('[PATIENT_NAME]' => $patientData['fname'], '[PATIENT_ID]' => $pid, '[PATIENT_FULL_NAME]' => $this->patient->getPatientFullNameByPid($patientData['pid']), '[PATIENT_LAST_NAME]' => $patientData['lname'], '[PATIENT_SEX]' => $patientData['sex'], '[PATIENT_BIRTHDATE]' => $patientData['DOB'], '[PATIENT_MARITAL_STATUS]' => $patientData['marital_status'], '[PATIENT_SOCIAL_SECURITY]' => $patientData['SS'], '[PATIENT_EXTERNAL_ID]' => $patientData['pubpid'], '[PATIENT_DRIVERS_LICENSE]' => $patientData['drivers_license'], '[PATIENT_ADDRESS]' => $patientData['address'], '[PATIENT_CITY]' => $patientData['city'], '[PATIENT_STATE]' => $patientData['state'], '[PATIENT_COUNTRY]' => $patientData['country'], '[PATIENT_ZIPCODE]' => $patientData['zipcode'], '[PATIENT_HOME_PHONE]' => $patientData['home_phone'], '[PATIENT_MOBILE_PHONE]' => $patientData['mobile_phone'], '[PATIENT_WORK_PHONE]' => $patientData['work_phone'], '[PATIENT_EMAIL]' => $patientData['email'], '[PATIENT_MOTHERS_NAME]' => $patientData['mothers_name'], '[PATIENT_GUARDIANS_NAME]' => $patientData['guardians_name'], '[PATIENT_EMERGENCY_CONTACT]' => $patientData['emer_contact'], '[PATIENT_EMERGENCY_PHONE]' => $patientData['emer_phone'], '[PATIENT_PROVIDER]' => $this->user->getUserFullNameById($patientData['provider']), '[PATIENT_PHARMACY]' => $patientData['pharmacy'], '[PATIENT_AGE]' => $age['DMY']['years'], '[PATIENT_OCCUPATION]' => $patientData['occupation'], '[PATIENT_EMPLOYEER]' => $patientData['employer_name'], '[PATIENT_RACE]' => $patientData['race'], '[PATIENT_ETHNICITY]' => $patientData['ethnicity'], '[PATIENT_LENGUAGE]' => $patientData['lenguage'], '[PATIENT_REFERRAL]' => $patientData['referral'], '[PATIENT_REFERRAL_DATE]' => $patientData['referral_date'], '[PATIENT_TABACCO]' => 'tabaco', '[PATIENT_ALCOHOL]' => 'alcohol', '[PATIENT_BALANCE]' => '$' . $this->fees->getPatientBalanceByPid($pid), '[PATIENT_PRIMARY_PLAN]' => $patientData['primary_plan_name'], '[PATIENT_PRIMARY_EFFECTIVE_DATE]' => $patientData['primary_effective_date'], '[PATIENT_PRIMARY_SUBSCRIBER]' => $patientData['primary_subscriber_title'] . $patientData['primary_subscriber_fname'] . ' ' . $patientData['primary_subscriber_mname'] . ' ' . $patientData['primary_subscriber_lname'], '[PATIENT_PRIMARY_POLICY_NUMBER]' => $patientData['primary_policy_number'], '[PATIENT_PRIMARY_GROUP_NUMBER]' => $patientData['primary_group_number'], '[PATIENT_PRIMARY_SUBSCRIBER_STREET]' => $patientData['primary_subscriber_street'], '[PATIENT_PRIMARY_SUBSCRIBER_CITY]' => $patientData['primary_subscriber_city'], '[PATIENT_PRIMARY_SUBSCRIBER_STATE]' => $patientData['primary_subscriber_state'], '[PATIENT_PRIMARY_SUBSCRIBER_COUNTRY]' => $patientData['primary_subscriber_country'], '[PATIENT_PRIMARY_SUBSCRIBER_ZIPCODE]' => $patientData['primary_subscriber_zip_code'], '[PATIENT_PRIMARY_SUBSCRIBER_RELATIONSHIP]' => $patientData['primary_subscriber_relationship'], '[PATIENT_PRIMARY_SUBSCRIBER_PHONE]' => $patientData['primary_subscriber_phone'], '[PATIENT_PRIMARY_SUBSCRIBER_EMPLOYER]' => $patientData['primary_subscriber_employer'], '[PATIENT_PRIMARY_SUBSCRIBER_EMPLOYER_CITY]' => $patientData['primary_subscriber_employer_city'], '[PATIENT_PRIMARY_SUBSCRIBER_EMPLOYER_STATE]' => $patientData['primary_subscriber_employer_state'], '[PATIENT_PRIMARY_SUBSCRIBER_EMPLOYER_COUNTRY]' => $patientData['primary_subscriber_employer_country'], '[PATIENT_PRIMARY_SUBSCRIBER_EMPLOYER_ZIPCODE]' => $patientData['primary_subscriber_zip_code'], '[PATIENT_SECONDARY_PLAN]' => $patientData['secondary_plan_name'], '[PATIENT_SECONDARY_EFFECTIVE_DATE]' => $patientData['secondary_effective_date'], '[PATIENT_SECONDARY_SUBSCRIBER]' => $patientData['secondary_subscriber_title'] . $patientData['primary_subscriber_fname'] . ' ' . $patientData['primary_subscriber_mname'] . ' ' . $patientData['primary_subscriber_lname'], '[PATIENT_SECONDARY_POLICY_NUMBER]' => $patientData['secondary_policy_number'], '[PATIENT_SECONDARY_GROUP_NUMBER]' => $patientData['secondary_group_number'], '[PATIENT_SECONDARY_SUBSCRIBER_STREET]' => $patientData['secondary_subscriber_street'], '[PATIENT_SECONDARY_SUBSCRIBER_CITY]' => $patientData['secondary_subscriber_city'], '[PATIENT_SECONDARY_SUBSCRIBER_STATE]' => $patientData['secondary_subscriber_state'], '[PATIENT_SECONDARY_SUBSCRIBER_COUNTRY]' => $patientData['secondary_subscriber_country'], '[PATIENT_SECONDARY_SUBSCRIBER_ZIPCODE]' => $patientData['secondary_subscriber_zip_code'], '[PATIENT_SECONDARY_SUBSCRIBER_RELATIONSHIP]' => $patientData['secondary_subscriber_relationship'], '[PATIENT_SECONDARY_SUBSCRIBER_PHONE]' => $patientData['secondary_subscriber_phone'], '[PATIENT_SECONDARY_SUBSCRIBER_EMPLOYER]' => $patientData['secondary_subscriber_employer'], '[PATIENT_SECONDARY_SUBSCRIBER_EMPLOYER_CITY]' => $patientData['secondary_subscriber_employer_city'], '[PATIENT_SECONDARY_SUBSCRIBER_EMPLOYER_STATE]' => $patientData['secondary_subscriber_employer_state'], '[PATIENT_SECONDARY_SUBSCRIBER_EMPLOYER_COUNTRY]' => $patientData['secondary_subscriber_employer_country'], '[PATIENT_SECONDARY_SUBSCRIBER_EMPLOYER_ZIPCODE]' => $patientData['secondary_subscriber_zip_code'], '[PATIENT_TERTIARY_PLAN]' => $patientData['tertiary_plan_name'], '[PATIENT_TERTIARY_EFFECTIVE_DATE]' => $patientData['tertiary_effective_date'], '[PATIENT_TERTIARY_SUBSCRIBER]' => $patientData['tertiary_subscriber_title'] . $patientData['primary_subscriber_fname'] . ' ' . $patientData['primary_subscriber_mname'] . ' ' . $patientData['primary_subscriber_lname'], '[PATIENT_TERTIARY_POLICY_NUMBER]' => $patientData['tertiary_policy_number'], '[PATIENT_TERTIARY_GROUP_NUMBER]' => $patientData['tertiary_group_number'], '[PATIENT_TERTIARY_SUBSCRIBER_STREET]' => $patientData['tertiary_subscriber_street'], '[PATIENT_TERTIARY_SUBSCRIBER_CITY]' => $patientData['tertiary_subscriber_city'], '[PATIENT_TERTIARY_SUBSCRIBER_STATE]' => $patientData['tertiary_subscriber_state'], '[PATIENT_TERTIARY_SUBSCRIBER_COUNTRY]' => $patientData['tertiary_subscriber_country'], '[PATIENT_TERTIARY_SUBSCRIBER_ZIPCODE]' => $patientData['tertiary_subscriber_zip_code'], '[PATIENT_TERTIARY_SUBSCRIBER_RELATIONSHIP]' => $patientData['tertiary_subscriber_relationship'], '[PATIENT_TERTIARY_SUBSCRIBER_PHONE]' => $patientData['tertiary_subscriber_phone'], '[PATIENT_TERTIARY_SUBSCRIBER_EMPLOYER]' => $patientData['tertiary_subscriber_employer'], '[PATIENT_TERTIARY_SUBSCRIBER_EMPLOYER_CITY]' => $patientData['tertiary_subscriber_employer_city'], '[PATIENT_TERTIARY_SUBSCRIBER_EMPLOYER_STATE]' => $patientData['tertiary_subscriber_employer_state'], '[PATIENT_TERTIARY_SUBSCRIBER_EMPLOYER_COUNTRY]' => $patientData['tertiary_subscriber_employer_country'], '[PATIENT_TERTIARY_SUBSCRIBER_EMPLOYER_ZIPCODE]' => $patientData['tertiary_subscriber_zip_code']);
     $pos = 0;
     foreach ($tokens as $tok) {
         if ($allNeededInfo[$pos] == '' || $allNeededInfo[$pos] == null) {
             $allNeededInfo[$pos] = $patienInformation[$tok];
         }
         $pos = $pos + 1;
     }
     return $allNeededInfo;
 }
示例#3
0
 public function get_PatientTokensData($pid, $allNeededInfo, $tokens)
 {
     $patientData = $this->getAllPatientData($pid);
     $age = $this->patient->getPatientAgeByDOB($patientData['DOB']);
     $user = new User();
     $patienInformation = ['[PATIENT_NAME]' => $patientData['fname'], '[PATIENT_ID]' => $patientData['pid'], '[PATIENT_FULL_NAME]' => $this->patient->getPatientFullNameByPid($patientData['pid']), '[PATIENT_LAST_NAME]' => $patientData['lname'], '[PATIENT_SEX]' => $patientData['sex'], '[PATIENT_BIRTHDATE]' => $patientData['DOB'], '[PATIENT_MARITAL_STATUS]' => $patientData['marital_status'], '[PATIENT_SOCIAL_SECURITY]' => $patientData['SS'], '[PATIENT_EXTERNAL_ID]' => $patientData['pubpid'], '[PATIENT_DRIVERS_LICENSE]' => $patientData['drivers_license'], '[PATIENT_ADDRESS]' => $patientData['address'], '[PATIENT_CITY]' => $patientData['city'], '[PATIENT_STATE]' => $patientData['state'], '[PATIENT_COUNTRY]' => $patientData['country'], '[PATIENT_ZIPCODE]' => $patientData['zipcode'], '[PATIENT_HOME_PHONE]' => $patientData['home_phone'], '[PATIENT_MOBILE_PHONE]' => $patientData['mobile_phone'], '[PATIENT_WORK_PHONE]' => $patientData['work_phone'], '[PATIENT_EMAIL]' => $patientData['email'], '[PATIENT_MOTHERS_NAME]' => $patientData['mothers_name'], '[PATIENT_GUARDIANS_NAME]' => $patientData['guardians_name'], '[PATIENT_EMERGENCY_CONTACT]' => $patientData['emer_contact'], '[PATIENT_EMERGENCY_PHONE]' => $patientData['emer_phone'], '[PATIENT_PROVIDER]' => is_numeric($patientData['provider']) ? $user->getUserFullNameById($patientData['provider']) : '', '[PATIENT_PHARMACY]' => $patientData['pharmacy'], '[PATIENT_AGE]' => $age['DMY']['years'], '[PATIENT_OCCUPATION]' => $patientData['occupation'], '[PATIENT_EMPLOYEER]' => $patientData['employer_name'], '[PATIENT_RACE]' => $patientData['race'], '[PATIENT_ETHNICITY]' => $patientData['ethnicity'], '[PATIENT_LENGUAGE]' => $patientData['language'], '[PATIENT_PICTURE]' => '<img src="' . $patientData['image'] . '" style="width:100px;height:100px">', '[PATIENT_QRCODE]' => '<img src="' . $patientData['qrcode'] . '" style="width:100px;height:100px">', '[PATIENT_TABACCO]' => 'tabaco', '[PATIENT_ALCOHOL]' => 'alcohol'];
     unset($user);
     foreach ($tokens as $i => $tok) {
         if (isset($patienInformation[$tok]) && ($allNeededInfo[$i] == '' || $allNeededInfo[$i] == null)) {
             $allNeededInfo[$i] = $patienInformation[$tok];
         }
     }
     return $allNeededInfo;
 }
示例#4
0
 public function getEncounterSummary(stdClass $params)
 {
     $this->setEid($params->eid);
     $this->db->setSQL("SELECT e.*,\n\t\t\t\t\t\t\t\t  p.fname,\n\t\t\t\t\t\t\t\t  p.mname,\n\t\t\t\t\t\t\t\t  p.lname,\n\t\t\t\t\t\t\t\t  p.DOB,\n\t\t\t\t\t\t\t\t  p.sex\n\t\t\t\t\t\t\t FROM encounters AS e\n\t\t\t\t\t    LEFT JOIN patient_demographics AS p ON e.pid = p.pid\n\t\t\t\t\t\t\tWHERE e.eid = '{$params->eid}'");
     $e = $this->db->fetchRecord(PDO::FETCH_ASSOC);
     $e['name'] = Person::fullname($e['fname'], $e['mname'], $e['lname']);
     $e['pic'] = $this->patient->getPatientPhotoSrcIdByPid($e['pid']);
     $e['age'] = $this->patient->getPatientAgeByDOB($e['DOB']);
     $this->addEncounterHistoryEvent('Encounter viewed');
     if (!empty($e)) {
         return array('success' => true, 'encounter' => $e);
     } else {
         return array('success' => false, 'error' => "Encounter ID {$params->eid} not found");
     }
 }
示例#5
0
 public function get_PatientTokensData($pid, $allNeededInfo, $tokens)
 {
     // Code reference: Relationship codes as specified by HL7. v2: Added 'Household' concept
     // https://phinvads.cdc.gov/vads/ViewValueSet.action?id=6FD34BBC-617F-DD11-B38D-00188B398520#
     $patientContact = new PatientContacts();
     $contactSelf = $patientContact->getContactByType($pid, 'SEL');
     $contactGuardian = $patientContact->getContactByType($pid, 'GRD');
     $contactMother = $patientContact->getContactByType($pid, 'MTH');
     $contactEmergency = $patientContact->getContactByType($pid, 'EMC');
     $contactEmployer = $patientContact->getContactByType($pid, 'EMR');
     $patientData = $this->getAllPatientData($pid);
     $age = $this->patient->getPatientAgeByDOB($patientData['DOB']);
     $user = new User();
     $patienInformation = ['[PATIENT_NAME]' => $patientData['fname'], '[PATIENT_ID]' => $patientData['pid'], '[PATIENT_FULL_NAME]' => $this->patient->getPatientFullNameByPid($patientData['pid']), '[PATIENT_LAST_NAME]' => $patientData['lname'], '[PATIENT_SEX]' => $patientData['sex'], '[PATIENT_BIRTHDATE]' => $patientData['DOB'], '[PATIENT_MARITAL_STATUS]' => $patientData['marital_status'], '[PATIENT_SOCIAL_SECURITY]' => $patientData['SS'], '[PATIENT_EXTERNAL_ID]' => $patientData['pubpid'], '[PATIENT_DRIVERS_LICENSE]' => $patientData['drivers_license'], '[PATIENT_ADDRESS]' => isset($contactSelf['street_mailing_address']) ? $contactSelf['street_mailing_address'] : '', '[PATIENT_CITY]' => isset($contactSelf['city']) ? $contactSelf['city'] : '', '[PATIENT_STATE]' => isset($contactSelf['state']) ? $contactSelf['state'] : '', '[PATIENT_COUNTRY]' => isset($contactSelf['country']) ? $contactSelf['country'] : '', '[PATIENT_ZIPCODE]' => isset($contactSelf['zip']) ? $contactSelf['zip'] : '', '[PATIENT_HOME_PHONE]' => isset($contactSelf['phone_local_number']) ? $contactSelf['phone_use_code'] . '-' . $contactSelf['phone_area_code'] . '-' . $contactSelf['phone_local_number'] : '', '[PATIENT_MOBILE_PHONE]' => isset($contactSelf['phone_local_number']) ? $contactSelf['phone_use_code'] . '-' . $contactSelf['phone_area_code'] . '-' . $contactSelf['phone_local_number'] : '', '[PATIENT_WORK_PHONE]' => isset($contactSelf['phone_local_number']) ? $contactSelf['phone_use_code'] . '-' . $contactSelf['phone_area_code'] . '-' . $contactSelf['phone_local_number'] : '', '[PATIENT_EMAIL]' => '', '[PATIENT_MOTHERS_NAME]' => isset($contactMother['first_name']) ? Person::fullname($contactMother['first_name'], $contactMother['middle_name'], $contactMother['last_name']) : '', '[PATIENT_GUARDIANS_NAME]' => isset($contactGuardian['first_name']) ? Person::fullname($contactGuardian['first_name'], $contactGuardian['middle_name'], $contactGuardian['last_name']) : '', '[PATIENT_EMERGENCY_CONTACT]' => isset($contactEmergency['first_name']) ? Person::fullname($contactEmergency['first_name'], $contactEmergency['middle_name'], $contactEmergency['last_name']) : '', '[PATIENT_EMERGENCY_PHONE]' => isset($contactEmergency['phone_local_number']) ? $contactEmergency['phone_use_code'] . '-' . $contactEmergency['phone_area_code'] . '-' . $contactEmergency['phone_local_number'] : '', '[PATIENT_PROVIDER]' => is_numeric($patientData['provider']) ? $user->getUserFullNameById($patientData['provider']) : '', '[PATIENT_PHARMACY]' => $patientData['pharmacy'], '[PATIENT_AGE]' => $age['DMY']['years'], '[PATIENT_OCCUPATION]' => $patientData['occupation'], '[PATIENT_EMPLOYEER]' => isset($contactEmployer['first_name']) ? Person::fullname($contactEmployer['first_name'], $contactEmployer['middle_name'], $contactEmployer['last_name']) : '', '[PATIENT_RACE]' => $patientData['race'], '[PATIENT_ETHNICITY]' => $patientData['ethnicity'], '[PATIENT_LENGUAGE]' => $patientData['language'], '[PATIENT_PICTURE]' => '<img src="' . $patientData['image'] . '" style="width:100px;height:100px">', '[PATIENT_QRCODE]' => '<img src="' . $patientData['qrcode'] . '" style="width:100px;height:100px">', '[PATIENT_TABACCO]' => 'tabaco', '[PATIENT_ALCOHOL]' => 'alcohol'];
     unset($user);
     foreach ($tokens as $i => $tok) {
         if (isset($patienInformation[$tok]) && ($allNeededInfo[$i] == '' || $allNeededInfo[$i] == null)) {
             $allNeededInfo[$i] = $patienInformation[$tok];
         }
     }
     return $allNeededInfo;
 }
示例#6
0
 /**
  * @return Segments
  * @throws Exception
  */
 private function setPID()
 {
     $this->patient = $this->p->load($this->patient)->one();
     if ($this->patient == false) {
         throw new \Exception('Error: Patient not found during setPID, Record # ' . $this->patient);
     }
     $this->patient = (object) $this->patient;
     $this->patient->age = Patient::getPatientAgeByDOB($this->patient->DOB);
     $pid = $this->hl7->addSegment('PID');
     $pid->setValue('1', 1);
     //		if($this->notEmpty($this->patient->pubpid)){
     //			$pid->setValue('2.3', $this->patient->pubpid);
     //		}else if($this->notEmpty($this->patient->pid)){
     //			$pid->setValue('2.3', $this->patient->pid);
     //		}
     //		if($this->notEmpty($this->patient->pubpid)){
     //			$pid->setValue('3.1', $this->patient->pubpid);
     if ($this->notEmpty($this->patient->pid)) {
         $pid->setValue('3.1', $this->patient->pid);
     }
     $pid->setValue('3.4', 'GaiaEHR');
     $pid->setValue('3.5', 'MR');
     // IDNumber Type (HL70203) MR = Medical Record
     if ($this->patient->age['DMY']['years'] == 0) {
         //			$pid->setValue('5.1.1', '', 0);
         $pid->setValue('5.7', 'S', 1);
     } else {
         if ($this->notEmpty($this->patient->lname)) {
             $pid->setValue('5.1.1', $this->patient->lname);
         }
         if ($this->notEmpty($this->patient->fname)) {
             $pid->setValue('5.2', $this->patient->fname);
         }
         if ($this->notEmpty($this->patient->mname)) {
             $pid->setValue('5.3', $this->patient->mname);
         }
         $pid->setValue('5.7', 'L');
     }
     // This has to be taken on Patient Contacts
     $filters = new stdClass();
     $filters->filter[0] = new stdClass();
     $filters->filter[1] = new stdClass();
     $filters->filter[0]->property = 'pid';
     $filters->filter[0]->value = $this->patient->pid;
     $filters->filter[1]->property = 'relationship';
     $filters->filter[1]->value = 'MTH';
     $ContactRecord = $this->PatientContacts->load($filters)->one();
     if ($this->notEmpty($ContactRecord)) {
         $pid->setValue('6.1', $ContactRecord['first_name'] . ' ' . $ContactRecord['middle_name'] . ' ' . $ContactRecord['last_name']);
         $pid->setValue('6.2', $ContactRecord['first_name'] . ' ' . $ContactRecord['middle_name'] . ' ' . $ContactRecord['last_name']);
     }
     if ($this->notEmpty($this->patient->DOB)) {
         $pid->setValue('7.1', $this->date($this->patient->DOB));
     }
     if ($this->notEmpty($this->patient->sex)) {
         $pid->setValue('8', $this->patient->sex);
     }
     if ($this->notEmpty($this->patient->alias)) {
         $pid->setValue('9.2', $this->patient->alias);
     }
     if ($this->notEmpty($this->patient->race)) {
         $pid->setValue('10.1', $this->patient->race);
         $pid->setValue('10.2', $this->hl7->race($this->patient->race));
         //Race Text
         $pid->setValue('10.3', 'CDCREC');
         // Race Name of Coding System
     }
     // Patient Address taken Patient Contact (SELF)
     $filters = new stdClass();
     $filters->filter[0] = new stdClass();
     $filters->filter[1] = new stdClass();
     $filters->filter[0]->property = 'pid';
     $filters->filter[0]->value = $this->patient->pid;
     $filters->filter[1]->property = 'relationship';
     $filters->filter[1]->value = 'SEL';
     $ContactRecord = $this->PatientContacts->load($filters)->one();
     if ($this->notEmpty($ContactRecord['street_mailing_address'])) {
         if ($this->notEmpty($ContactRecord['street_mailing_address'])) {
             $pid->setValue('11.1.1', $ContactRecord['street_mailing_address']);
         }
         if ($this->notEmpty($ContactRecord['city'])) {
             $pid->setValue('11.3', $ContactRecord['city']);
         }
         if ($this->notEmpty($ContactRecord['state'])) {
             $pid->setValue('11.4', $ContactRecord['state']);
         }
         if ($this->notEmpty($ContactRecord['zip'])) {
             $pid->setValue('11.5', $ContactRecord['zip']);
         }
         if ($this->notEmpty($ContactRecord['country'])) {
             $pid->setValue('11.6', $ContactRecord['country']);
         }
         if ($this->notEmpty($ContactRecord['street_mailing_address'])) {
             $pid->setValue('11.7', 'L');
             // Address Type L = Legal Address
         }
         $pid->setValue('11.9', '25025');
     }
     // Patient Phone Number taken from Patient Contact (SELF)
     if ($this->notEmpty($ContactRecord['phone_use_code']) && $this->notEmpty($ContactRecord['phone_area_code']) && $this->notEmpty($ContactRecord['phone_local_number'])) {
         $phone = $this->phone($ContactRecord['phone_use_code'] . $ContactRecord['phone_area_code'] . $ContactRecord['phone_local_number']);
         $pid->setValue('13.2', 'PRN');
         // PhoneNumber‐Home
         $pid->setValue('13.6', $ContactRecord['zip']);
         // Area/City Code
         $pid->setValue('13.7', $phone);
         // LocalNumber
     }
     //		if($this->notEmpty($this->patient->work_phone)){
     //		    $phone = $this->phone($this->patient->work_phone);
     //			$PID->setValue('13.2', 'PRN'); // PhoneNumber‐Home
     //			$PID->setValue('13.6', $phone['zip']); // Area/City Code
     //			$PID->setValue('13.7', $phone['number']); // LocalNumber
     //		}
     if ($this->notEmpty($this->patient->language)) {
         $pid->setValue('15.1', $this->patient->language);
     }
     if ($this->notEmpty($this->patient->marital_status)) {
         $pid->setValue('16.1', $this->patient->marital_status);
         // EthnicGroup Identifier
         $pid->setValue('16.2', $this->hl7->marital($this->patient->marital_status));
         // EthnicGroup Text
         $pid->setValue('16.3', 'CDCREC');
         // Name of Coding System
     }
     if ($this->notEmpty($this->patient->pubaccount)) {
         $pid->setValue('18.1', $this->patient->pubaccount);
     }
     if ($this->notEmpty($this->patient->SS)) {
         $pid->setValue('19', $this->patient->SS);
     }
     // Patient Drivers License Information
     if ($this->notEmpty($this->patient->drivers_license)) {
         $pid->setValue('20.1', $this->patient->drivers_license);
         if ($this->notEmpty($this->patient->drivers_license_state)) {
             $pid->setValue('20.2', $this->patient->drivers_license_state);
         }
         if ($this->notEmpty($this->patient->drivers_license_exp)) {
             $pid->setValue('20.3', $this->date($this->patient->drivers_license_exp));
         }
     }
     if ($this->notEmpty($this->patient->ethnicity)) {
         if ($this->patient->ethnicity == 'H') {
             $pid->setValue('22.1', '2135-2');
             $pid->setValue('22.3', 'CDCREC');
         } elseif ($this->patient->ethnicity == 'N') {
             $pid->setValue('22.1', '2186-5');
             $pid->setValue('22.3', 'CDCREC');
         } else {
             $pid->setValue('22.1', '$this->patient->ethnicity');
         }
     }
     if ($this->notEmpty($this->patient->birth_place)) {
         $pid->setValue('23', $this->patient->birth_place);
     }
     if ($this->notEmpty($this->patient->birth_multiple)) {
         $pid->setValue('24', $this->patient->birth_multiple);
     }
     if ($this->notEmpty($this->patient->birth_order)) {
         $pid->setValue('25', $this->patient->birth_order);
     }
     if ($this->notEmpty($this->patient->citizenship)) {
         $pid->setValue('26.1', $this->patient->citizenship);
     }
     if ($this->notEmpty($this->patient->is_veteran)) {
         $pid->setValue('27.1', $this->patient->is_veteran);
     }
     if ($this->notEmpty($this->patient->death_date) && $this->notEmpty($this->patient->deceased)) {
         $pid->setValue('29.1', $this->date($this->patient->death_date));
         $pid->setValue('30', 'Y');
     }
     if ($this->notEmpty($this->patient->update_date)) {
         $pid->setValue('33.1', $this->date($this->patient->update_date));
     }
     return $pid;
 }
示例#7
0
 /**
  * @return Segments
  * @throws Exception
  */
 private function setPID()
 {
     $this->patient = $this->p->load($this->patient)->one();
     if ($this->patient == false) {
         throw new \Exception('Error: Patient not found during setPID, Record # ' . $this->patient);
     }
     $this->patient = (object) $this->patient;
     $this->patient->age = Patient::getPatientAgeByDOB($this->patient->DOB);
     $pid = $this->hl7->addSegment('PID');
     $pid->setValue('1', 1);
     if ($this->notEmpty($this->patient->pubpid)) {
         $pid->setValue('2.3', $this->patient->pubpid);
     }
     if ($this->notEmpty($this->patient->pid)) {
         $pid->setValue('3.1', $this->patient->pid);
     }
     $pid->setValue('3.5', 'MR');
     // IDNumber Type (HL70203) MR = Medical Record
     if ($this->patient->age['DMY']['years'] == 0) {
         //			$pid->setValue('5.1.1', '', 0);
         $pid->setValue('5.7', 'S', 1);
     } else {
         if ($this->notEmpty($this->patient->lname)) {
             $pid->setValue('5.1.1', $this->patient->lname);
         }
         if ($this->notEmpty($this->patient->fname)) {
             $pid->setValue('5.2', $this->patient->fname);
         }
         if ($this->notEmpty($this->patient->mname)) {
             $pid->setValue('5.3', $this->patient->mname);
         }
         $pid->setValue('5.7', 'L');
     }
     if ($this->notEmpty($this->patient->mothers_name)) {
         $pid->setValue('6.2', $this->patient->mothers_name);
     }
     if ($this->notEmpty($this->patient->DOB)) {
         $pid->setValue('7.1', $this->date($this->patient->DOB));
     }
     if ($this->notEmpty($this->patient->sex)) {
         $pid->setValue('8', $this->patient->sex);
     }
     if ($this->notEmpty($this->patient->alias)) {
         $pid->setValue('9.2', $this->patient->alias);
     }
     if ($this->notEmpty($this->patient->race)) {
         $pid->setValue('10.1', $this->patient->race);
         $pid->setValue('10.2', $this->hl7->race($this->patient->race));
         //Race Text
         $pid->setValue('10.3', 'CDCREC');
         // Race Name of Coding System
     }
     if ($this->notEmpty($this->patient->address)) {
         $pid->setValue('11.1.1', $this->patient->address);
     }
     if ($this->notEmpty($this->patient->city)) {
         $pid->setValue('11.3', $this->patient->city);
     }
     if ($this->notEmpty($this->patient->state)) {
         $pid->setValue('11.4', $this->patient->state);
     }
     if ($this->notEmpty($this->patient->zipcode)) {
         $pid->setValue('11.5', $this->patient->zipcode);
     }
     if ($this->notEmpty($this->patient->country)) {
         $pid->setValue('11.6', $this->patient->country);
     }
     if ($this->notEmpty($this->patient->address)) {
         $pid->setValue('11.7', 'P');
         // Address Type P = Permanent
     }
     $pid->setValue('11.9', '25025');
     if ($this->notEmpty($this->patient->home_phone)) {
         $phone = $this->phone($this->patient->home_phone);
         $pid->setValue('13.2', 'PRN');
         // PhoneNumber‐Home
         $pid->setValue('13.6', $phone['zip']);
         // Area/City Code
         $pid->setValue('13.7', $phone['number']);
         // LocalNumber
     }
     //		if($this->notEmpty($this->patient->work_phone)){
     //		    $phone = $this->phone($this->patient->work_phone);
     //			$PID->setValue('13.2', 'PRN'); // PhoneNumber‐Home
     //			$PID->setValue('13.6', $phone['zip']); // Area/City Code
     //			$PID->setValue('13.7', $phone['number']); // LocalNumber
     //		}
     if ($this->notEmpty($this->patient->language)) {
         $pid->setValue('15.1', $this->patient->language);
     }
     if ($this->notEmpty($this->patient->marital_status)) {
         $pid->setValue('16.1', $this->patient->marital_status);
         // EthnicGroup Identifier
         $pid->setValue('16.2', $this->hl7->marital($this->patient->marital_status));
         // EthnicGroup Text
         $pid->setValue('16.3', 'CDCREC');
         // Name of Coding System
     }
     if ($this->notEmpty($this->patient->pubaccount)) {
         $pid->setValue('18.1', $this->patient->pubaccount);
     }
     if ($this->notEmpty($this->patient->SS)) {
         $pid->setValue('19', $this->patient->SS);
     }
     if ($this->notEmpty($this->patient->drivers_license)) {
         $pid->setValue('20.1', $this->patient->drivers_license);
     }
     if ($this->notEmpty($this->patient->drivers_license_state)) {
         $pid->setValue('20.2', $this->patient->drivers_license_state);
     }
     if ($this->notEmpty($this->patient->drivers_license_exp)) {
         $pid->setValue('20.3', $this->date($this->patient->drivers_license_exp));
     }
     if ($this->notEmpty($this->patient->ethnicity)) {
         if ($this->patient->ethnicity == 'H') {
             $pid->setValue('22.1', '2135-2');
             $pid->setValue('22.3', 'CDCREC');
         } elseif ($this->patient->ethnicity == 'N') {
             $pid->setValue('22.1', '2186-5');
             $pid->setValue('22.3', 'CDCREC');
         } else {
             $pid->setValue('22.1', '$this->patient->ethnicity');
         }
     }
     if ($this->notEmpty($this->patient->birth_place)) {
         $pid->setValue('23', $this->patient->birth_place);
     }
     if ($this->notEmpty($this->patient->birth_multiple)) {
         $pid->setValue('24', $this->patient->birth_multiple);
     }
     if ($this->notEmpty($this->patient->birth_order)) {
         $pid->setValue('25', $this->patient->birth_order);
     }
     if ($this->notEmpty($this->patient->citizenship)) {
         $pid->setValue('26.1', $this->patient->citizenship);
     }
     if ($this->notEmpty($this->patient->is_veteran)) {
         $pid->setValue('27.1', $this->patient->is_veteran);
     }
     if ($this->notEmpty($this->patient->death_date)) {
         $pid->setValue('29.1', $this->date($this->patient->death_date));
     }
     //		if($this->notEmpty($this->patient->deceased)){
     //			$pid->setValue('30', $this->patient->deceased);
     //		}
     if ($this->notEmpty($this->patient->update_date)) {
         $pid->setValue('33.1', $this->date($this->patient->update_date));
     }
     return $pid;
 }