/** * Method setProblemsSection() * * This section lists and describes all relevant clinical problems at the time the document is generated. * At a minimum, all pertinent current and historical problems should be listed. Overall health status may * be represented in this section. */ private function setProblemsSection() { $ActiveProblems = new ActiveProblems(); $problemsData = $ActiveProblems->getPatientAllProblemsByPid($this->pid); unset($ActiveProblems); if ($this->isExcluded('problems') || empty($problemsData)) { $problems['@attributes'] = ['nullFlavor' => 'NI']; } $problems['templateId'][] = ['@attributes' => ['root' => $this->requiredProblems ? '2.16.840.1.113883.10.20.22.2.5.1' : '2.16.840.1.113883.10.20.22.2.5']]; $problems['templateId'][] = ['@attributes' => ['root' => '2.16.840.1.113883.3.88.11.83.103']]; $problems['code'] = ['@attributes' => ['code' => '11450-4', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1']]; $problems['title'] = 'Problems'; $problems['text'] = ''; if ($this->isExcluded('problems')) { $this->addSection(['section' => $problems]); return; } if (!empty($problemsData)) { $problems['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@value' => 'Condition'], ['@value' => 'Effective Dates'], ['@value' => 'Condition Status']]]]], 'tbody' => ['tr' => []]]]; $problems['entry'] = []; foreach ($problemsData as $item) { $dateText = $this->parseDate($item['begin_date']) . ' - '; if ($item['end_date'] != '0000-00-00') { $dateText .= $this->parseDate($item['end_date']); } $problems['text']['table']['tbody']['tr'][] = ['td' => [['@value' => $item['code_text']], ['@value' => $dateText], ['@value' => $item['status']]]]; $entry = ['act' => ['@attributes' => ['classCode' => 'ACT', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.3']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => 'CONC', 'codeSystemName' => 'ActClass', 'codeSystem' => '2.16.840.1.113883.5.6', 'displayName' => 'Concern']], 'statusCode' => ['@attributes' => ['code' => 'active']]]]; $entry['act']['effectiveTime'] = ['@attributes' => ['xsi:type' => 'IVL_TS']]; $entry['act']['effectiveTime']['low'] = ['@attributes' => ['value' => $this->parseDate($item['begin_date'])]]; if ($item['end_date'] != '0000-00-00') { $entry['act']['effectiveTime']['high'] = ['@attributes' => ['value' => $this->parseDate($item['end_date'])]]; } else { $entry['act']['effectiveTime']['high'] = ['@attributes' => ['nullFlavor' => 'NI']]; } $entry['act']['entryRelationship'] = ['@attributes' => ['typeCode' => 'SUBJ'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.4']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['code' => '55607006', 'displayName' => 'Problem', 'codeSystemName' => 'SNOMED CT', 'codeSystem' => '2.16.840.1.113883.6.96']], 'statusCode' => ['@attributes' => ['code' => 'completed']]]]; $entry['act']['entryRelationship']['observation']['effectiveTime'] = ['@attributes' => ['xsi:type' => 'IVL_TS']]; $entry['act']['entryRelationship']['observation']['effectiveTime']['low'] = ['@attributes' => ['value' => $this->parseDate($item['begin_date'])]]; if ($item['end_date'] != '0000-00-00') { $entry['act']['entryRelationship']['observation']['effectiveTime']['high'] = ['@attributes' => ['value' => $this->parseDate($item['end_date'])]]; } else { $entry['act']['entryRelationship']['observation']['effectiveTime']['high'] = ['@attributes' => ['nullFlavor' => 'NI']]; } $entry['act']['entryRelationship']['observation']['value'] = ['@attributes' => ['xsi:type' => 'CD', 'code' => $item['code'], 'codeSystemName' => $item['code_type'], 'codeSystem' => $this->codes($item['code_type'])]]; $entry['act']['entryRelationship']['observation']['entryRelationship'] = ['@attributes' => ['typeCode' => 'REFR'], 'observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'EVN'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.6']], 'code' => ['@attributes' => ['code' => '33999-4', 'displayName' => 'Status', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'code' => $this->CombosData->getCodeValueByListIdAndOptionValue(112, $item['status']), 'displayName' => $item['status'], 'codeSystemName' => 'SNOMED CT', 'codeSystem' => '2.16.840.1.113883.6.96']]]]; $problems['entry'][] = $entry; unset($entry); } } if ($this->requiredProblems || !empty($problems['entry'])) { $this->addSection(['section' => $problems]); } unset($problemsData, $problems); }
/** * The return of this function is use for testing only * * @param $list_id * @return string */ function getStore($list_id) { $params = new stdClass(); $params->list_id = $list_id; $options = $this->cb->getOptionsByListId($params); $fields = [['name' => 'option_name'], ['name' => 'option_value', 'type' => 'auto'], ['name' => 'option_data']]; $data = []; foreach ($options as $i => $option) { $data[] = ['option_name' => $option['option_name'], 'option_value' => $option['option_value']]; } $store = 'Ext.create(\'Ext.data.Store\',{fields:' . json_encode($fields) . ',data:' . json_encode($data) . '})'; return str_replace('"', '\'', $store); }