示例#1
0
 /**
  * @param $rule
  * @return bool
  */
 private function ckVitals($rule)
 {
     if (isset($rule['concepts']['VITA']) && !empty($rule['concepts']['VITA'])) {
         $count = 0;
         foreach ($rule['concepts']['VITA'] as $concept) {
             $vitals = $this->Vitals->getVitalsByPid($this->Patient->getPatientPid());
             $codes = $this->Vitals->getCodes();
             $frequency = 0;
             foreach ($vitals as $vital) {
                 $mapping = $codes[$concept['concept_code']]['mapping'];
                 if ($concept['value_operator'] == '' || $this->compare($vital[$mapping], $concept['value_operator'], $concept['value'])) {
                     if ($this->isWithInterval($vital['date'], $concept['frequency_interval'], $concept['frequency_operator'], 'Y-m-d H:i:s')) {
                         $frequency++;
                         //if($concept['frequency'] == $frequency) break;
                     }
                 }
             }
             if ($concept['frequency_operator'] == '' || $this->compare($frequency, $concept['frequency_operator'], $concept['frequency'])) {
                 $count++;
             }
         }
         return $count == count($rule['concepts']['VITA']);
     }
     return true;
 }
示例#2
0
 private function getEncounterRelations($encounter, $allVitals = true)
 {
     $filters = new stdClass();
     $filters->filter[0] = new stdClass();
     $filters->filter[0]->property = 'eid';
     $filters->filter[0]->value = $encounter['eid'];
     $Vitals = new Vitals();
     if ($_SESSION['globals']['enable_encounter_vitals']) {
         $encounter['vitals'] = $allVitals ? $Vitals->getVitalsByPid($encounter['pid']) : $Vitals->getVitalsByEid($encounter['eid']);
     }
     unset($Vitals);
     if ($_SESSION['globals']['enable_encounter_review_of_systems']) {
         $encounter['reviewofsystems'][] = $this->getReviewOfSystems($filters);
     }
     if ($_SESSION['globals']['enable_encounter_family_history']) {
         $encounter['familyhistory'] = $this->FamilyHistory->getFamilyHistoryByPid($encounter['pid']);
     }
     //		//TODO: Matcha Model
     //		if($_SESSION['globals']['enable_encounter_review_of_systems_cks']){
     //
     //		}
     if ($_SESSION['globals']['enable_encounter_soap']) {
         $encounter['soap'][] = $this->getSoapByEid($encounter['eid']);
     }
     if ($_SESSION['globals']['enable_encounter_dictation']) {
         $encounter['speechdictation'][] = $this->getDictation($filters);
     }
     if ($_SESSION['globals']['enable_encounter_hcfa']) {
         $encounter['hcfaoptions'][] = $this->getHCFA($filters);
     }
     $encounter['services'] = $this->getEncounterServiceCodesByEid($encounter['eid']);
     unset($filters);
     return $encounter;
 }
示例#3
0
 /**
  * Method setVitalsSection()
  *
  * The Vital Signs section contains relevant vital signs for the context and use case of the document type,
  * such as blood pressure, heart rate, respiratory rate, height, weight, body mass index, head circumference,
  * pulse oximetry, temperature and body surface area. The section should include notable vital signs such
  * as the most recent, maximum and/or minimum, baseline, or relevant trends.
  *
  * Vital signs are represented in the same way as other results, but are aggregated into their own section
  * to follow clinical conventions.
  */
 private function setVitalsSection()
 {
     $Vitals = new Vitals();
     $vitalsData = $Vitals->getVitalsByPid($this->pid);
     if (empty($vitalsData) || $this->isExcluded('vitals')) {
         $vitals['@attributes'] = ['nullFlavor' => 'NI'];
     }
     $vitals['templateId'] = ['@attributes' => ['root' => $this->requiredVitals ? '2.16.840.1.113883.10.20.22.2.4.1' : '2.16.840.1.113883.10.20.22.2.4']];
     $vitals['code'] = ['@attributes' => ['code' => '8716-3', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1']];
     $vitals['title'] = 'Vital Signs';
     $vitals['text'] = '';
     if ($this->isExcluded('vitals')) {
         $this->addSection(['section' => $vitals]);
         return;
     }
     if (!empty($vitalsData)) {
         $vitals['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@attributes' => ['align' => 'right'], '@value' => 'Date / Time:']]]]], 'tbody' => ['tr' => [['th' => [['@attributes' => ['align' => 'left'], '@value' => 'Height']]], ['th' => [['@attributes' => ['align' => 'left'], '@value' => 'Weight']]], ['th' => [['@attributes' => ['align' => 'left'], '@value' => 'Blood Pressure']]], ['th' => [['@attributes' => ['align' => 'left'], '@value' => 'BMI (Body Mass Index)']]]]]]];
         $vitals['entry'] = [];
         foreach ($vitalsData as $item) {
             // strip date (yyyy-mm-dd hh:mm:ss => yyyymmdd)
             $date = $this->parseDate($item['date']);
             // Date
             $vitals['text']['table']['thead']['tr'][0]['th'][] = ['@value' => date('F j, Y', strtotime($item['date']))];
             // Height
             $vitals['text']['table']['tbody']['tr'][0]['td'][] = ['@value' => $item['height_cm'] . ' cm'];
             // Weight
             $vitals['text']['table']['tbody']['tr'][1]['td'][] = ['@value' => $item['weight_kg'] . ' kg'];
             // Blood Pressure
             $vitals['text']['table']['tbody']['tr'][2]['td'][] = ['@value' => $item['bp_systolic'] . '/' . $item['bp_diastolic'] . ' mmHg'];
             // BMI (Body Mass Index)
             $vitals['text']['table']['tbody']['tr'][3]['td'][] = ['@value' => $item['bmi'] . ' kg/m2'];
             // Code Entry
             $entry = ['@attributes' => ['typeCode' => 'DRIV'], 'organizer' => ['@attributes' => ['classCode' => 'CLUSTER', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.26']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '46680005', 'codeSystemName' => 'SNOMED CT', 'codeSystem' => '2.16.840.1.113883.6.96', 'displayName' => 'Vital signs']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'component' => [['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.27']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '8302-2', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'Height']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'value' => ['@attributes' => ['xsi:type' => 'PQ', 'value' => $item['height_cm'], 'unit' => 'cm']]]], ['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.2']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '3141-9', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'Weight Measured']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'value' => ['@attributes' => ['xsi:type' => 'PQ', 'value' => $item['weight_kg'], 'unit' => 'kg']]]], ['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.2']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '8480-6', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'BP Systolic']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'value' => ['@attributes' => ['xsi:type' => 'PQ', 'value' => $item['bp_systolic'], 'unit' => 'mm[Hg]']]]], ['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.2']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '8462-4', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'BP Diastolic']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'value' => ['@attributes' => ['xsi:type' => 'PQ', 'value' => $item['bp_diastolic'], 'unit' => 'mm[Hg]']]]], ['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.2']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '39156-5', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1', 'displayName' => 'Body mass index (BMI) [Ratio]']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]], 'value' => ['@attributes' => ['xsi:type' => 'PQ', 'value' => $item['bmi'], 'unit' => 'kg/m2']]]]]]];
             $vitals['entry'][] = $entry;
         }
     }
     if ($this->requiredVitals || isset($vitals['entry'])) {
         $this->addSection(['section' => $vitals]);
     }
     unset($vitalsData, $vitals);
 }