Exemplo n.º 1
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['supply' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'SPLY'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.41.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']], 'statusCode' => Component::statusCode('active')]];
         // SHOULD contain zero or one [0..1] effectiveTime
         if (isset($PortionData['effectiveTime'])) {
             $Entry['supply']['effectiveTime'] = Component::time($PortionData['effectiveTime']);
         }
         // SHOULD contain zero or more [0..1] Author Participation (NEW)
         if (count($PortionData['Author']) > 0) {
             $Entry['supply']['author'][] = LevelOther\authorParticipation::Insert($PortionData['Author'][0], $CompleteData);
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['supply']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['supply']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 3
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['act' => ['@attributes' => ['moodCode' => 'EVN', 'classCode' => 'ACT'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.3.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => 'CONC', 'codeSystem' => '2.16.840.1.113883.5.6', 'displayName' => 'Concern'], 'statusCode' => ['@attributes' => ['code' => $PortionData['statusCode']]], 'effectiveTime' => ['low' => ['@attributes' => ['value' => $PortionData['start_effectiveTime']]]]]];
         // This effectiveTime MAY contain zero or one [0..1] high (CONF:9033).
         // Note: The effectiveTime/high asserts when the concern was completed
         // (e.g. when the clinician deemed there is no longer any need to track the underlying condition)
         if (isset($PortionData['end_effectiveTime'])) {
             $Entry['act']['effectiveTime']['high'] = ['@attributes' => ['value' => $PortionData['end_effectiveTime']]];
         }
         // SHOULD contain zero or more [0..*] Author Participation (NEW)
         if (count($PortionData['Author']) > 0) {
             foreach ($PortionData['Author'] as $Author) {
                 $Entry['act']['author'][] = LevelOther\authorParticipation::Insert($Author, $CompleteData);
             }
         }
         // SHALL contain at least one [1..*] entryRelationship (CONF:10093)
         // SHALL contain exactly one [1..1] Problem Observation (V2)
         if (count($PortionData['ProblemObservation']) > 0) {
             foreach ($PortionData['ProblemObservation'] as $ProblemObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], problemObservation::Insert($ProblemObservation, $CompleteData)];
             }
         }
         // SHALL contain at least one [1..*] entryRelationship (CONF:10093)
         // b.	SHALL contain exactly one [1..1] Provider Priority Preference (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProblemObservation'] as $ProviderPriorityPreference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Exemplo n.º 4
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['supply' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'OBS'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.43.2'), 'id' => Component::id(Utilities::UUIDv4()), 'statusCode' => Component::statusCode('completed')]];
         // SHOULD contain zero or one [0..1] repeatNumber
         if (isset($PortionData['repeatNumber'])) {
             $Entry['supply']['repeatNumber'] = ['@attributes' => ['value' => $PortionData['repeatNumber']]];
         }
         // SHOULD contain zero or one [0..1] quantity
         if (isset($PortionData['quantity'])) {
             $Entry['supply']['quantity'] = ['@attributes' => ['value' => $PortionData['quantity']]];
         }
         // SHOULD contain zero or one [0..1] effectiveTime
         if (isset($PortionData['effectiveTime'])) {
             $Entry['supply']['effectiveTime'] = Component::time($PortionData['effectiveTime']);
         }
         // MAY contain zero or more [0..*] value
         // Participants represent those in supporting roles such as caregiver,
         // who participate in the patient's care.
         if (count($PortionData['Interval']) > 0) {
             foreach ($PortionData['Interval'] as $Interval) {
                 $Entry['supply']['value'][] = ['@attributes' => ['xsi:type' => 'IVL_PQ'], 'low' => ['@attributes' => ['value' => $Interval['QuantityValue'], 'unit' => $Interval['QuantityUnit']]]];
             }
         }
         // MAY contain zero or more [0..*] performer
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['supply']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Participant) {
                 $Entry['supply']['participant'][] = LevelDocument\participant::Insert($Participant, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Service Delivery Location
         if (count($PortionData['ServiceDeliveryLocation']) > 0) {
             foreach ($PortionData['ServiceDeliveryLocation'] as $ServiceDeliveryLocation) {
                 $Entry['supply']['participant'][] = serviceDeliveryLocation::Insert($ServiceDeliveryLocation, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['supply']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['supply']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Exemplo n.º 5
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['act' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'ACT'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.39.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['xsi:type' => 'CD', 'code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']], 'statusCode' => Component::statusCode('new'), 'effectiveTime' => Component::time($PortionData['effectiveTime'])]];
         // MAY contain zero or more [0..*] performer
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['act']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Performer) {
                 $Entry['act']['participant'][] = LevelDocument\participant::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['PatientPriorityPreference'] as $PatientPriorityPreference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], patientPriorityPreference::Insert($PatientPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Exemplo n.º 6
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['act' => ['@attributes' => ['classCode' => 'ACT', 'moodCode' => 'EVN'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.132'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['@attributes' => ['code' => 'CONC', 'displayName' => 'handoff communication (procedure)', 'codeSystem' => '2.16.840.1.113883.5.6', 'codeSystemName' => 'HL7ActClass', 'displayName' => 'Concern']], 'statusCode' => Component::statusCode('active'), 'effectiveTime' => Component::time($PortionData['effectiveTime'])]];
         // SHOULD contain zero or more [0..*] Author Participation (NEW)
         if (count($PortionData['Author']) > 0) {
             foreach ($PortionData['Author'] as $Author) {
                 $Entry['act']['author'][] = LevelOther\authorParticipation::Insert($Author, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Problem Observation (V2)
         if (count($PortionData['ProblemObservation']) > 0) {
             foreach ($PortionData['ProblemObservation'] as $ProblemObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], problemObservation::Insert($ProblemObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Allergy - Intolerance Observation (V2)
         if (count($PortionData['AllergyIntoleranceObservation']) > 0) {
             foreach ($PortionData['AllergyIntoleranceObservation'] as $AllergyIntoleranceObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], allergyIntoleranceObservation::Insert($AllergyIntoleranceObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Assessment Scale Observation
         if (count($PortionData['AssessmentScaleObservation']) > 0) {
             foreach ($PortionData['AssessmentScaleObservation'] as $AssessmentScaleObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], assessmentScaleObservation::Insert($AssessmentScaleObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Self-Care Activities (ADL and IADL) (NEW)
         if (count($PortionData['SelfCareActivitiesADLAndIADL']) > 0) {
             foreach ($PortionData['SelfCareActivitiesADLAndIADL'] as $SelfCareActivitiesADLAndIADL) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], selfCareActivitiesADLAndIADL::Insert($SelfCareActivitiesADLAndIADL, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Cognitive Abilities Observation (NEW)
         if (count($PortionData['CognitiveAbilitiesObservation']) > 0) {
             foreach ($PortionData['CognitiveAbilitiesObservation'] as $CognitiveAbilitiesObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], cognitiveAbilitiesObservation::Insert($CognitiveAbilitiesObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Cognitive Status Observation (V2)
         if (count($PortionData['CognitiveStatusObservation']) > 0) {
             foreach ($PortionData['CognitiveStatusObservation'] as $CognitiveStatusObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], cognitiveStatusObservation::Insert($CognitiveStatusObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Cognitive Status Observation (V2)
         if (count($PortionData['CurrentSmokingStatus']) > 0) {
             foreach ($PortionData['CurrentSmokingStatus'] as $CurrentSmokingStatus) {
                 $Entry['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], 'observation' => currentSmokingStatus::Insert($CurrentSmokingStatus, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Encounter Diagnosis (V2)
         if (count($PortionData['EncounterDiagnosis']) > 0) {
             foreach ($PortionData['EncounterDiagnosis'] as $EncounterDiagnosis) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], encounterDiagnosis::Insert($EncounterDiagnosis, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Family History Organizer
         if (count($PortionData['FamilyHistoryOrganizer']) > 0) {
             foreach ($PortionData['FamilyHistoryOrganizer'] as $FamilyHistoryOrganizer) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], familyHistoryOrganizer::Insert($FamilyHistoryOrganizer, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Functional Status Observation (V2)
         if (count($PortionData['FunctionalStatusObservation']) > 0) {
             foreach ($PortionData['FunctionalStatusObservation'] as $FunctionalStatusObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], functionalStatusObservation::Insert($FunctionalStatusObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Hospital Admission Diagnosis (V2)
         if (count($PortionData['HospitalAdmissionDiagnosis']) > 0) {
             foreach ($PortionData['HospitalAdmissionDiagnosis'] as $HospitalAdmissionDiagnosis) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], hospitalAdmissionDiagnosis::Insert($HospitalAdmissionDiagnosis, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Mental Status Observation (NEW)
         if (count($PortionData['MentalStatusObservation']) > 0) {
             foreach ($PortionData['MentalStatusObservation'] as $MentalStatusObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], mentalStatusObservation::Insert($MentalStatusObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Nutrition Assessment (NEW)
         if (count($PortionData['NutritionAssessment']) > 0) {
             foreach ($PortionData['NutritionAssessment'] as $NutritionAssessment) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], nutritionAssessment::Insert($NutritionAssessment, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Nutrition Assessment (NEW)
         if (count($PortionData['PostprocedureDiagnosis']) > 0) {
             foreach ($PortionData['PostprocedureDiagnosis'] as $PostprocedureDiagnosis) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], postprocedureDiagnosis::Insert($PostprocedureDiagnosis, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Pregnancy Observation
         if (count($PortionData['PregnancyObservation']) > 0) {
             foreach ($PortionData['PregnancyObservation'] as $PregnancyObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], pregnancyObservation::Insert($PregnancyObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Preoperative Diagnosis (V2)
         if (count($PortionData['PreoperativeDiagnosis']) > 0) {
             foreach ($PortionData['PreoperativeDiagnosis'] as $PreoperativeDiagnosis) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], preoperativeDiagnosis::Insert($PreoperativeDiagnosis, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Reaction Observation (V2)
         if (count($PortionData['ReactionObservation']) > 0) {
             foreach ($PortionData['ReactionObservation'] as $ReactionObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], reactionObservation::Insert($ReactionObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Reaction Observation (V2)
         if (count($PortionData['ResultObservation']) > 0) {
             foreach ($PortionData['ResultObservation'] as $ResultObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], resultObservation::Insert($ResultObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Sensory and Speech Status (NEW)
         if (count($PortionData['SensoryAndSpeechStatus']) > 0) {
             foreach ($PortionData['SensoryAndSpeechStatus'] as $SensoryAndSpeechStatus) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], sensoryAndSpeechStatus::Insert($SensoryAndSpeechStatus, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Social History Observation (V2)
         if (count($PortionData['SocialHistoryObservation']) > 0) {
             foreach ($PortionData['SocialHistoryObservation'] as $SocialHistoryObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], socialHistoryObservation::Insert($SocialHistoryObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Substance or Device Allergy - Intolerance Observation (V2)
         if (count($PortionData['SubstanceOrDeviceAllergyIntoleranceObservation']) > 0) {
             foreach ($PortionData['SubstanceOrDeviceAllergyIntoleranceObservation'] as $SubstanceOrDeviceAllergyIntoleranceObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], substanceOrDeviceAllergyIntoleranceObservation::Insert($SubstanceOrDeviceAllergyIntoleranceObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Tobacco Use (V2)
         if (count($PortionData['TobaccoUse']) > 0) {
             foreach ($PortionData['TobaccoUse'] as $TobaccoUse) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], tobaccoUse::Insert($TobaccoUse, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Vital Sign Observation (V2)
         if (count($PortionData['VitalSignObservation']) > 0) {
             foreach ($PortionData['VitalSignObservation'] as $VitalSignObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], vitalSignObservation::Insert($VitalSignObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Wound Observation (NEW)
         if (count($PortionData['WoundObservation']) > 0) {
             foreach ($PortionData['WoundObservation'] as $WoundObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], woundObservation::Insert($WoundObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Caregiver Characteristics
         if (count($PortionData['CaregiverCharacteristics']) > 0) {
             foreach ($PortionData['CaregiverCharacteristics'] as $CaregiverCharacteristics) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], caregiverCharacteristics::Insert($CaregiverCharacteristics, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Cultural and Religious Observation (NEW)
         if (count($PortionData['CulturalAndReligiousObservation']) > 0) {
             foreach ($PortionData['CulturalAndReligiousObservation'] as $CulturalAndReligiousObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], culturalAndReligiousObservation::Insert($CulturalAndReligiousObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Characteristics of Home Environment (NEW)
         if (count($PortionData['CharacteristicsOfHomeEnvironment']) > 0) {
             foreach ($PortionData['CharacteristicsOfHomeEnvironment'] as $CharacteristicsOfHomeEnvironment) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], characteristicsOfHomeEnvironment::Insert($CharacteristicsOfHomeEnvironment, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Nutritional Status Observation (NEW)
         if (count($PortionData['NutritionalStatusObservation']) > 0) {
             foreach ($PortionData['NutritionalStatusObservation'] as $NutritionalStatusObservation) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], nutritionalStatusObservation::Insert($NutritionalStatusObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Result Organizer (V2)
         if (count($PortionData['ResultOrganizer']) > 0) {
             foreach ($PortionData['ResultOrganizer'] as $ResultOrganizer) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], resultOrganizer::Insert($ResultOrganizer, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['PatientPriorityPreference'] as $PatientPriorityPreference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], patientPriorityPreference::Insert($PatientPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Provider Priority Preference (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Problem Concern Act (Condition) (V2)
         if (count($PortionData['ProblemConcernActCondition']) > 0) {
             foreach ($PortionData['ProblemConcernActCondition'] as $ProblemConcernActCondition) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], problemConcernActCondition::Insert($ProblemConcernActCondition, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Act Reference (NEW)
         if (count($PortionData['ActReference']) > 0) {
             foreach ($PortionData['ActReference'] as $ActReference) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], actReference::Insert($ActReference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Exemplo n.º 7
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['observation' => ['@attributes' => ['moodCode' => 'EVN', 'classCode' => 'OBS'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.4.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => '64572001', 'codeSystem' => '2.16.840.1.113883.6.96', 'displayName' => 'Condition'], 'statusCode' => Component::statusCode('completed'), 'effectiveTime' => ['low' => ['@attributes' => ['value' => $PortionData['onsetDate']]]], 'value' => ['@attributes' => ['xsi:type' => 'CD', 'code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']]]]];
         // SHOULD contain zero or one [0..1] text
         if (isset($PortionData['Narrated'])) {
             $Entry['observation']['text'] = self::Narrative($PortionData['Narrated']);
         }
         // This effectiveTime MAY contain zero or one [0..1] high (CONF:9033).
         // Note: The effectiveTime/high asserts when the concern was completed
         // (e.g. when the clinician deemed there is no longer any need to track the underlying condition)
         if (isset($PortionData['resolvedDate'])) {
             $Entry['observation']['effectiveTime']['high'] = ['@attributes' => ['value' => $PortionData['resolvedDate']]];
         }
         // SHOULD contain zero or more [0..*] Author Participation (NEW)
         if (count($PortionData['Author']) > 0) {
             foreach ($PortionData['Author'] as $Author) {
                 $Entry['observation']['author'][] = LevelOther\authorParticipation::Insert($Author, $CompleteData);
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Age Observation
         if (count($PortionData['AgeObservation']) > 0) {
             foreach ($PortionData['AgeObservation'] as $AgeObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], ageObservation::Insert($AgeObservation, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Prognosis Observation (NEW)
         if (count($PortionData['PrognosisObservation']) > 0) {
             foreach ($PortionData['PrognosisObservation'] as $PrognosisObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], prognosisObservation::Insert($PrognosisObservation, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Patient Priority Preference (NEW)
         if (count($PortionData['PatientPriorityPreference']) > 0) {
             foreach ($PortionData['PatientPriorityPreference'] as $PatientPriorityPreference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], patientPriorityPreference::Insert($PatientPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Prognosis Observation (NEW)
         if (count($PortionData['ProviderPriorityPreference']) > 0) {
             foreach ($PortionData['ProviderPriorityPreference'] as $ProviderPriorityPreference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }