Beispiel #1
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Section = ['component' => ['section' => ['templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.2.58', 'extension' => $PortionData['AdvanceDirectives']['date']]], 'code' => ['@attributes' => ['code' => '46030-3', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC', 'displayName' => 'Health Concerns Section']], 'title' => 'Health Concerns Section', 'text' => self::Narrative($PortionData)]]];
         // SHOULD contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Health Status Observation (V2)
         if (count($PortionData['HealthStatusObservation']) > 0) {
             foreach ($PortionData['HealthStatusObservation'] as $HealthStatusObservation) {
                 $Section['component']['section']['entry'][] = LevelEntry\healthStatusObservation::Insert($HealthStatusObservation, $CompleteData);
             }
         }
         // SHOULD contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Health Concern Act (NEW)
         if (count($PortionData['HealthConcernAct']) > 0) {
             foreach ($PortionData['HealthConcernAct'] as $HealthConcernAct) {
                 $Section['component']['section']['entry'][] = LevelEntry\healthConcernAct::Insert($HealthConcernAct, $CompleteData);
             }
         }
         return $Section;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Beispiel #2
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['observation' => ['@attributes' => ['classCode' => 'OBS', 'moodCode' => 'GOL'], 'templateId' => [0 => Component::templateId('2.16.840.1.113883.10.20.22.4.44.2'), 1 => Component::templateId('2.16.840.1.113883.10.20.22.4.44.2')], 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['@attributes' => ['code' => $PortionData['goalCode'], 'displayName' => $PortionData['goalDisplayName'], 'codeSystem' => Utilities::CodingSystemId($PortionData['goalCodeSystemName']), 'codeSystemName' => $PortionData['goalCodeSystemName']]], 'statusCode' => Component::statusCode('active'), 'effectiveTime' => Component::time($PortionData['effectiveTime'])]];
         // SHALL contain at least one [1..*] Author Participation (NEW)
         // (templateId:2.16.840.1.113883.10.20.22.4.119) (CONF:30995)
         if (count($PortionData['Authors']) > 0) {
             foreach ($PortionData['Authors'] as $Author) {
                 $Entry['observation']['author'][] = LevelOther\authorParticipation::Insert($Author, $CompleteData);
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship (CONF:30701)
         // SHALL contain exactly one [1..1] Health Concern Act (NEW)
         // (templateId:2.16.840.1.113883.10.20.22.4.132) (CONF:30703)
         if (count($PortionData['HealthConcernAct']) > 0) {
             foreach ($PortionData['HealthConcernAct'] as $HealthConcernAct) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], healthConcernAct::Insert($HealthConcernAct, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30704)
         // SHALL contain exactly one [1..1] Planned Encounter (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.40.2) (CONF:30706)
         if (count($PortionData['PlannedEncounter']) > 0) {
             foreach ($PortionData['PlannedEncounter'] as $PlannedEncounter) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedEncounter::Insert($PlannedEncounter, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30707)
         // SHALL contain exactly one [1..1] Planned Observation (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.44.2) (CONF:30709)
         if (count($PortionData['PlannedObservation']) > 0) {
             foreach ($PortionData['PlannedObservation'] as $PlannedObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedObservation::Insert($PlannedObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30710)
         // SHALL contain exactly one [1..1] Planned Procedure (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.41.2) (CONF:30712)
         if (count($PortionData['PlannedProcedure']) > 0) {
             foreach ($PortionData['PlannedProcedure'] as $PlannedProcedure) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedProcedure::Insert($PlannedObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30713)
         // SHALL contain exactly one [1..1] Planned Substance Administration (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.42.2) (CONF:30715)
         if (count($PortionData['PlannedSubstanceAdministration']) > 0) {
             foreach ($PortionData['PlannedSubstanceAdministration'] as $PlannedSubstanceAdministration) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedSubstanceAdministration::Insert($PlannedSubstanceAdministration, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30716)
         // SHALL contain exactly one [1..1] Planned Supply (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.43.2) (CONF:30718)
         if (count($PortionData['PlannedSupply']) > 0) {
             foreach ($PortionData['PlannedSupply'] as $PlannedSupply) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedSupply::Insert($PlannedSupply, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:30770)
         // SHALL contain exactly one [1..1] Planned Act (V2)
         // (templateId:2.16.840.1.113883.10.20.22.4.39.2) (CONF:30772)
         if (count($PortionData['PlannedAct']) > 0) {
             foreach ($PortionData['PlannedAct'] as $PlannedAct) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], plannedAct::Insert($PlannedAct, $CompleteData)];
             }
         }
         // SHOULD contain zero or one [0..1] entryRelationship (CONF:30785)
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         // (templateId:2.16.840.1.113883.10.20.22.4.142) (CONF:30787)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['PatientPriorityPreference'] as $PatientPriorityPreference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], patientPriorityPreference::Insert($PatientPriorityPreference, $CompleteData)];
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship (CONF:30788)
         // SHALL contain exactly one [1..1] Provider Priority Preference (NEW)
         // (templateId:2.16.840.1.113883.10.20.22.4.143) (CONF:30790)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:31559)
         // SHALL contain exactly one [1..1] Act Reference (NEW)
         // (templateId:2.16.840.1.113883.10.20.22.4.122) (CONF:31588)
         if (count($PortionData['ActReference']) > 0) {
             foreach ($PortionData['ActReference'] as $ActReference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], 'observation' => actReference::Insert($ActReference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }