Example #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.30.2', 'extension' => $PortionData['PlannedProcedure']['date']]], 'code' => ['@attributes' => ['code' => '59772-4', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC', 'displayName' => 'Planned Procedure']], 'title' => 'Planned Procedure', 'text' => self::Narrative($PortionData['PlannedProcedure'])]]];
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Procedure (V2)
         if (count($PortionData['PlannedProcedure']) > 0) {
             foreach ($PortionData['PlannedProcedure'] as $PlannedProcedure) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedProcedure::Insert($PlannedProcedure, $CompleteData);
             }
         }
         return $Section;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Example #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;
     }
 }
Example #3
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Section = ['component' => ['section' => Component::templateId('2.16.840.1.113883.10.20.22.2.10.1.2'), 'code' => ['@attributes' => ['code' => '18776-5', 'displayName' => 'Treatment Plan', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC']], 'title' => 'Treatment Plan', 'text' => self::Narrative($PortionData)]];
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Observation (V2)
         if (count($PortionData['PlannedObservation']) > 0) {
             foreach ($PortionData['PlannedObservation'] as $PlannedObservation) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedObservation::Insert($PlannedObservation, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Encounter (V2)
         if (count($PortionData['PlannedEncounter']) > 0) {
             foreach ($PortionData['PlannedEncounter'] as $PlannedEncounter) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedEncounter::Insert($PlannedEncounter, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Act (V2)
         if (count($PortionData['PlannedAct']) > 0) {
             foreach ($PortionData['PlannedAct'] as $PlannedAct) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedAct::Insert($PlannedAct, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Procedure (V2)
         if (count($PortionData['PlannedProcedure']) > 0) {
             foreach ($PortionData['PlannedProcedure'] as $PlannedProcedure) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedProcedure::Insert($PlannedProcedure, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Substance Administration (V2)
         if (count($PortionData['PlannedSubstanceAdministration']) > 0) {
             foreach ($PortionData['PlannedSubstanceAdministration'] as $PlannedSubstanceAdministration) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedSubstanceAdministration::Insert($PlannedSubstanceAdministration, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Planned Supply (V2)
         if (count($PortionData['PlannedSupply']) > 0) {
             foreach ($PortionData['PlannedSupply'] as $PlannedSupply) {
                 $Section['component']['section']['entry'][] = LevelEntry\plannedSupply::Insert($PlannedSupply, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['Instruction']) > 0) {
             foreach ($PortionData['Instruction'] as $Instruction) {
                 $Section['component']['section']['entry'][] = LevelEntry\instruction::Insert($Instruction, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Handoff Communication (NEW)
         if (count($PortionData['HandoffCommunication']) > 0) {
             foreach ($PortionData['HandoffCommunication'] as $HandoffCommunication) {
                 $Section['component']['section']['entry'][] = LevelEntry\handoffCommunication::Insert($HandoffCommunication, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Nutrition Recommendations (NEW)
         if (count($PortionData['NutritionRecommendations']) > 0) {
             foreach ($PortionData['NutritionRecommendations'] as $NutritionRecommendations) {
                 $Section['component']['section']['entry'][] = LevelEntry\nutritionRecommendations::Insert($NutritionRecommendations, $CompleteData);
             }
         }
         return $Section;
     } catch (Exception $Error) {
         return $Error;
     }
 }
Example #4
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' => $PortionData['moodCode']], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.131'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['@attributes' => ['code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']]], 'statusCode' => Component::statusCode('active')]];
         // 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] Advance Directive Observation (V2)
         if (count($PortionData['AdvanceDirectiveObservation']) > 0) {
             foreach ($PortionData['AdvanceDirectiveObservation'] as $AdvanceDirectiveObservation) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], advanceDirectiveObservation::Insert($AdvanceDirectiveObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Medication Activity (V2)
         if (count($PortionData['MedicationActivity']) > 0) {
             foreach ($PortionData['MedicationActivity'] as $MedicationActivity) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], medicationActivity::Insert($MedicationActivity, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Medication Activity (V2)
         if (count($PortionData['ProcedureActivityAct']) > 0) {
             foreach ($PortionData['ProcedureActivityAct'] as $ProcedureActivityAct) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], procedureActivityAct::Insert($ProcedureActivityAct, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Goal Observation (NEW)
         if (count($PortionData['GoalObservation']) > 0) {
             foreach ($PortionData['GoalObservationAct'] as $GoalObservation) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'RSON'], goalObservation::Insert($GoalObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Procedure Activity Observation (V2)
         if (count($PortionData['ProcedureActivityObservation']) > 0) {
             foreach ($PortionData['ProcedureActivityObservation'] as $ProcedureActivityObservation) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], procedureActivityObservation::Insert($ProcedureActivityObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Procedure Activity Procedure (V2)
         if (count($PortionData['ProcedureActivityProcedure']) > 0) {
             foreach ($PortionData['ProcedureActivityProcedure'] as $ProcedureActivityProcedure) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], procedureActivityProcedure::Insert($ProcedureActivityProcedure, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Encounter Activity (V2)
         if (count($PortionData['EncounterActivity']) > 0) {
             foreach ($PortionData['EncounterActivity'] as $EncounterActivity) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], encounterActivity::Insert($EncounterActivity, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['Instruction']) > 0) {
             foreach ($PortionData['Instruction'] as $Instruction) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], instruction::Insert($Instruction, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['NonMedicinalSupplyActivity']) > 0) {
             foreach ($PortionData['NonMedicinalSupplyActivity'] as $NonMedicinalSupplyActivity) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], nonMedicinalSupplyActivity::Insert($NonMedicinalSupplyActivity, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Act (V2)
         if (count($PortionData['PlannedAct']) > 0) {
             foreach ($PortionData['PlannedAct'] as $PlannedAct) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedAct::Insert($PlannedAct, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Encounter (V2)
         if (count($PortionData['PlannedEncounter']) > 0) {
             foreach ($PortionData['PlannedEncounter'] as $PlannedEncounter) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedEncounter::Insert($PlannedEncounter, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Encounter (V2)
         if (count($PortionData['PlannedObservation']) > 0) {
             foreach ($PortionData['PlannedObservation'] as $PlannedObservation) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedObservation::Insert($PlannedObservation, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Procedure (V2)
         if (count($PortionData['PlannedProcedure']) > 0) {
             foreach ($PortionData['PlannedProcedure'] as $PlannedProcedure) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedProcedure::Insert($PlannedProcedure, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Procedure (V2)
         if (count($PortionData['PlannedSubstanceAdministration']) > 0) {
             foreach ($PortionData['PlannedSubstanceAdministration'] as $PlannedSubstanceAdministration) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedSubstanceAdministration::Insert($PlannedSubstanceAdministration, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Planned Supply (V2)
         if (count($PortionData['PlannedSupply']) > 0) {
             foreach ($PortionData['PlannedSupply'] as $PlannedSupply) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], plannedSupply::Insert($PlannedSupply, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Nutrition Recommendations (NEW)
         if (count($PortionData['NutritionRecommendations']) > 0) {
             foreach ($PortionData['NutritionRecommendations'] as $NutritionRecommendations) {
                 $Entry['act']['entryRelationship']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], nutritionRecommendations::Insert($NutritionRecommendations, $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']['entry'][] = ['@attributes' => ['typeCode' => 'REFR'], actReference::Insert($ActReference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }