Ejemplo n.º 1
0
 public function get_EncounterTokensData($eid, $allNeededInfo, $tokens)
 {
     $params = new stdClass();
     $params->eid = $eid;
     $encounter = $this->encounter->getEncounter($params);
     if (!isset($encounter['encounter'])) {
         return $allNeededInfo;
     }
     $encounterCodes = $this->encounter->getEncounterCodes($params);
     $vitals = end($encounter['encounter']['vitals']);
     $soap = $encounter['encounter']['soap'];
     if (isset($encounter['encounter']['reviewofsystemschecks'])) {
         $rosCks = $encounter['encounter']['reviewofsystemschecks'];
         unset($rosCks['id'], $rosCks['pid'], $rosCks['eid'], $rosCks['uid'], $rosCks['date']);
         foreach ($rosCks as $rosc => $num) {
             if ($num == '' || $num == null || $num == 0) {
                 unset($rosCks[$rosc]);
             }
         }
     }
     if (isset($encounter['encounter']['reviewofsystems'])) {
         $reviewofsystems = $encounter['encounter']['reviewofsystems'];
         unset($reviewofsystems['pid'], $reviewofsystems['eid'], $reviewofsystems['uid'], $reviewofsystems['id'], $reviewofsystems['date']);
         foreach ($reviewofsystems as $ros => $num) {
             if ($num == '' || $num == null || $num == 'null') {
                 unset($reviewofsystems[$ros]);
             }
         }
     }
     $cpt = [];
     $dx = [];
     $hcpc = [];
     $cvx = [];
     if (isset($encounterCodes['rows'])) {
         foreach ($encounterCodes['rows'] as $code) {
             if ($code['code_type'] == 'CPT') {
                 $cpt[] = $code;
             } elseif ($code['code_type'] == 'ICD' || $code['code_type'] == 'ICD9' || $code['code_type'] == 'ICD10') {
                 $dx[] = $code;
             } elseif ($code['code_type'] == 'HCPC') {
                 $hcpc[] = $code;
             } elseif ($code['code_type'] == 'CVX') {
                 $cvx[] = $code;
             }
         }
     }
     $Medications = new Medications();
     $medications = $Medications->getPatientMedicationsByEid($eid);
     unset($Medications);
     $Immunizations = new Immunizations();
     $immunizations = $Immunizations->getImmunizationsByEid($eid);
     unset($Immunizations);
     $Allergies = new Allergies();
     $allergies = $Allergies->getPatientAllergiesByEid($eid);
     unset($Allergies);
     $ActiveProblems = new ActiveProblems();
     $activeProblems = $ActiveProblems->getPatientActiveProblemByEid($eid);
     unset($ActiveProblems);
     $encounter = $encounter['encounter'];
     $encounterInformation = ['[ENCOUNTER_START_DATE]' => $encounter['service_date'], '[ENCOUNTER_END_DATE]' => $encounter['close_date'], '[ENCOUNTER_BRIEF_DESCRIPTION]' => $encounter['brief_description'], '[ENCOUNTER_SENSITIVITY]' => $encounter['priority'], '[ENCOUNTER_WEIGHT_LBS]' => $vitals['weight_lbs'], '[ENCOUNTER_WEIGHT_KG]' => $vitals['weight_kg'], '[ENCOUNTER_HEIGHT_IN]' => $vitals['height_in'], '[ENCOUNTER_HEIGHT_CM]' => $vitals['height_cm'], '[ENCOUNTER_BP_SYSTOLIC]' => $vitals['bp_systolic'], '[ENCOUNTER_BP_DIASTOLIC]' => $vitals['bp_diastolic'], '[ENCOUNTER_PULSE]' => $vitals['pulse'], '[ENCOUNTER_RESPIRATION]' => $vitals['respiration'], '[ENCOUNTER_TEMP_FAHRENHEIT]' => $vitals['temp_f'], '[ENCOUNTER_TEMP_CELSIUS]' => $vitals['temp_c'], '[ENCOUNTER_TEMP_LOCATION]' => $vitals['temp_location'], '[ENCOUNTER_OXYGEN_SATURATION]' => $vitals['oxygen_saturation'], '[ENCOUNTER_HEAD_CIRCUMFERENCE_IN]' => $vitals['head_circumference_in'], '[ENCOUNTER_HEAD_CIRCUMFERENCE_CM]' => $vitals['head_circumference_cm'], '[ENCOUNTER_WAIST_CIRCUMFERENCE_IN]' => $vitals['waist_circumference_in'], '[ENCOUNTER_WAIST_CIRCUMFERENCE_CM]' => $vitals['waist_circumference_cm'], '[ENCOUNTER_BMI]' => $vitals['bmi'], '[ENCOUNTER_BMI_STATUS]' => $vitals['bmi_status'], '[ENCOUNTER_SUBJECTIVE]' => isset($soap['subjective']) ? $soap['subjective'] : '', '[ENCOUNTER_OBJECTIVE]' => isset($soap['objective']) ? $soap['objective'] : '', '[ENCOUNTER_ASSESSMENT]' => isset($soap['assessment']) ? $soap['assessment'] : '', '[ENCOUNTER_PLAN]' => isset($soap['plan']) ? $soap['plan'] : '', '[ENCOUNTER_CPT_CODES]' => $this->tokensForEncountersList($cpt, 1), '[ENCOUNTER_ICD_CODES]' => $this->tokensForEncountersList($dx, 2), '[ENCOUNTER_HCPC_CODES]' => $this->tokensForEncountersList($hcpc, 3), '[ENCOUNTER_ALLERGIES_LIST]' => $this->tokensForEncountersList($allergies, 4), '[ENCOUNTER_MEDICATIONS_LIST]' => $this->tokensForEncountersList($medications, 5), '[ENCOUNTER_ACTIVE_PROBLEMS_LIST]' => $this->tokensForEncountersList($activeProblems, 6), '[ENCOUNTER_IMMUNIZATIONS_LIST]' => $this->tokensForEncountersList($immunizations, 7), '[ENCOUNTER_REVIEWOFSYSTEMSCHECKS]' => isset($rosCks) ? $this->tokensForEncountersList($rosCks, 11) : '', '[ENCOUNTER_REVIEWOFSYSTEMS]' => isset($reviewofsystems) ? $this->tokensForEncountersList($reviewofsystems, 12) : ''];
     foreach ($tokens as $i => $tok) {
         if (isset($encounterInformation[$tok]) && ($allNeededInfo[$i] == '' || $allNeededInfo[$i] == null)) {
             $allNeededInfo[$i] = $encounterInformation[$tok];
         }
     }
     return $allNeededInfo;
 }