Beispiel #1
0
 /**
  * @param $rule
  * @return bool
  */
 private function ckActiveMedications($rule)
 {
     if (isset($rule['concepts']['MEDI']) && !empty($rule['concepts']['MEDI'])) {
         $count = 0;
         foreach ($rule['concepts']['MEDI'] as $concept) {
             $medications = $this->Medications->getPatientActiveMedicationsByPidAndCode($this->Patient->getPatientPid(), $concept['concept_code']);
             if (empty($medications)) {
                 continue;
             }
             $count++;
         }
         // meditations found should equal the medication concepts
         return $count == count($rule['concepts']['MEDI']);
     }
     return true;
 }
Beispiel #2
0
 private function getObjectiveExtraDataByEid($eid)
 {
     $ExtraData = '';
     $Medications = new Medications();
     $medications = $Medications->getPatientMedicationsByEid($eid);
     if (!empty($medications)) {
         $lis = '';
         foreach ($medications as $foo) {
             $lis .= '<li>' . $foo['STR'] . '</li>';
         }
         $ExtraData .= '<p>Medications:</p>';
         $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>';
     }
     unset($Medications);
     $Immunizations = new Immunizations();
     $immunizations = $Immunizations->getImmunizationsByEncounterID($eid);
     if (!empty($immunizations)) {
         $lis = '';
         foreach ($immunizations as $foo) {
             $lis .= '<li>Vaccine name: ' . $foo['vaccine_name'] . '<br>';
             $lis .= 'Vaccine ID: (' . $foo['code_type'] . ')' . $foo['code'] . '<br>';
             $lis .= 'Manufacturer: ' . $foo['manufacturer'] . '<br>';
             $lis .= 'Lot Number: ' . $foo['lot_number'] . '<br>';
             $lis .= 'Dose: ' . $foo['administer_amount'] . ' ' . $foo['administer_units'] . '<br>';
             $lis .= 'Administered By: ' . $foo['administered_by'] . ' </li>';
         }
         $ExtraData .= '<p>Immunizations:</p>';
         $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>';
     }
     unset($Immunizations);
     $Allergies = new Allergies();
     $allergies = $Allergies->getPatientAllergiesByEid($eid);
     if (!empty($allergies)) {
         $lis = '';
         foreach ($allergies as $foo) {
             $lis .= '<li>Allergy: ' . $foo['allergy'] . ' (' . $foo['allergy_type'] . ')<br>';
             $lis .= 'Reaction: ' . $foo['reaction'] . '<br>';
             $lis .= 'Severity: ' . $foo['severity'] . '<br>';
             $lis .= 'Location: ' . $foo['location'] . '<br>';
             $lis .= 'Active?: ' . ($foo['end_date'] != null ? 'Yes' : 'No') . '</li>';
         }
         $ExtraData .= '<p>Allergies:</p>';
         $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>';
     }
     unset($Allergies);
     /**
      * Active Problems found in this Encounter
      */
     $ActiveProblems = new ActiveProblems();
     $activeProblems = $ActiveProblems->getPatientActiveProblemByEid($eid);
     if (!empty($activeProblems)) {
         $lis = '';
         foreach ($activeProblems as $foo) {
             $lis .= '<li>[' . $foo['code'] . '] - ' . $foo['code_text'] . ' </li>';
         }
         $ExtraData .= '<p>Active Problems:</p>';
         $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>';
     }
     unset($ActiveProblems);
     return $ExtraData;
 }
Beispiel #3
0
 /**
  * Method setMedicationsAdministeredSection()
  *
  * The Medications Administered Section contains medications and fluids administered during a procedure.
  * The section may also contain the procedure's encounter or other activity, excluding anesthetic medications.
  * This section is not intended for ongoing medications and medication history.
  */
 private function setMedicationsAdministeredSection()
 {
     $Medications = new Medications();
     $medicationsData = $Medications->getPatientAdministeredMedicationsByPidAndEid($this->encounter['pid'], $this->encounter['eid']);
     unset($Medications);
     if (empty($medicationsData) || $this->isExcluded('administered')) {
         $medications['@attributes'] = ['nullFlavor' => 'NI'];
     }
     $medications['templateId'] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.2.38']];
     $medications['code'] = ['@attributes' => ['code' => '29549-3', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'Administered Medications']];
     $medications['title'] = 'Medications Administered';
     $medications['text'] = '';
     if ($this->isExcluded('administered')) {
         $this->addSection(['section' => $medications]);
         return;
     }
     if (!empty($medicationsData)) {
         $medications['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@value' => 'RxNorm'], ['@value' => 'Medication'], ['@value' => 'Instructions'], ['@value' => 'Date']]]]], 'tbody' => ['tr' => []]]];
         // --- 3.51 Medication Activity (V2)
         $medications['entry'] = [];
         foreach ($medicationsData as $item) {
             $medications['text']['table']['tbody']['tr'][] = ['td' => [['@value' => $item['RXCUI']], ['@value' => $item['STR']], ['@value' => $item['directions']], ['@value' => date('F j, Y', strtotime($item['administered_date']))]]];
             $entry['substanceAdministration']['@attributes'] = ['classCode' => 'SBADM', 'moodCode' => 'EVN'];
             $entry['substanceAdministration']['templateId'] = ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.16']];
             $entry['substanceAdministration']['id'] = ['@attributes' => ['root' => UUID::v4()]];
             $entry['substanceAdministration']['text'] = $item['directions'];
             $entry['substanceAdministration']['statusCode'] = ['@attributes' => ['code' => 'Active']];
             $entry['substanceAdministration']['effectiveTime'] = ['@attributes' => ['xsi:type' => 'IVL_TS']];
             $entry['substanceAdministration']['effectiveTime']['low'] = ['@attributes' => ['nullFlavor' => 'UNK']];
             $entry['substanceAdministration']['effectiveTime']['high'] = ['@attributes' => ['nullFlavor' => 'UNK']];
             $entry['substanceAdministration']['consumable'] = ['manufacturedProduct' => ['@attributes' => ['classCode' => 'MANU'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.23']], 'manufacturedMaterial' => ['code' => ['@attributes' => ['code' => $item['RXCUI'], 'codeSystem' => '2.16.840.1.113883.6.88', 'displayName' => ucwords($item['STR']), 'codeSystemName' => 'RxNorm']]]]];
             $performer = ['assignedEntity' => ['id' => ['@attributes' => ['root' => '2.16.840.1.113883.4.6']]]];
             $performer['assignedEntity']['addr'] = $this->addressBuilder('WP', $this->encounterFacility['address'] . ' ' . $this->encounterFacility['address_cont'], $this->encounterFacility['city'], $this->encounterFacility['state'], $this->encounterFacility['postal_code'], $this->encounterFacility['country_code']);
             $performer['assignedEntity']['telecom'] = $this->telecomBuilder($this->encounterFacility['phone'], 'WP');
             $performer['assignedEntity']['representedOrganization'] = ['name' => $this->encounterFacility['name']];
             $performer['assignedEntity']['representedOrganization']['telecom'] = $this->telecomBuilder($this->encounterFacility['phone'], 'WP');
             $performer['assignedEntity']['representedOrganization']['addr'] = $this->addressBuilder('WP', $this->encounterFacility['address'] . ' ' . $this->encounterFacility['address_cont'], $this->encounterFacility['city'], $this->encounterFacility['state'], $this->encounterFacility['postal_code'], $this->encounterFacility['country_code']);
             $entry['substanceAdministration']['performer'] = $performer;
             unset($performer);
             $entry['substanceAdministration']['participant'] = ['@attributes' => ['typeCode' => 'CSM'], 'participantRole' => ['@attributes' => ['classCode' => 'MANU'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.24']], 'code' => ['@attributes' => ['code' => '412307009', 'codeSystem' => '2.16.840.1.113883.6.96', 'codeSystemName' => 'SNOMED', 'displayName' => 'drug vehicle']], 'playingEntity' => ['@attributes' => ['classCode' => 'MMAT'], 'code' => ['@attributes' => ['nullFlavor' => 'UNK']], 'name' => ['@attributes' => ['nullFlavor' => 'UNK']]]]];
             $entry['substanceAdministration']['precondition'] = ['@attributes' => ['typeCode' => 'PRCN'], 'criterion' => ['code' => ['@attributes' => ['nullFlavor' => 'UNK']], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'nullFlavor' => 'UNK']]]];
             $medications['entry'][] = $entry;
             unset($entry);
         }
     }
     if ($this->requiredMedications || isset($medications['entry'])) {
         $this->addSection(['section' => $medications]);
     }
     unset($medicationsData, $medications);
 }
Beispiel #4
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;
 }