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.60']], 'code' => ['@attributes' => ['code' => '61146-7', 'displayName' => 'Goals', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC']], 'title' => 'Goals', 'text' => self::Narrative($PortionData)]]];
         // SHOULD contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Goal Observation (NEW)
         if (count($PortionData['GoalObservation']) > 0) {
             foreach ($PortionData['GoalObservation'] as $GoalObservation) {
                 $Section['component']['section']['entry'][] = LevelEntry\goalObservation::Insert($GoalObservation, $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 = ['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;
     }
 }
Example #3
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.144'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']], 'statusCode' => Component::statusCode('completed'), '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['observation']['author'][] = LevelOther\authorParticipation::Insert($Author, $CompleteData);
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Goal Observation (NEW)
         if (count($PortionData['GoalObservation']) > 0) {
             foreach ($PortionData['GoalObservation'] as $GoalObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'GEVL'], goalObservation::Insert($GoalObservation, $CompleteData)];
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Progress Toward Goal Observation (NEW)
         if (count($PortionData['ProgressTowardGoalObservation']) > 0) {
             foreach ($PortionData['ProgressTowardGoalObservation'] as $ProgressTowardGoalObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SPRT'], progressTowardGoalObservation::Insert($ProgressTowardGoalObservation, $CompleteData)];
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Progress Toward Goal Observation (NEW)
         if (count($PortionData['ProgressTowardGoalObservation']) > 0) {
             foreach ($PortionData['ProgressTowardGoalObservation'] as $ProgressTowardGoalObservation) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SPRT'], progressTowardGoalObservation::Insert($ProgressTowardGoalObservation, $CompleteData)];
             }
         }
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Intervention Act (NEW)
         if (count($PortionData['InterventionAct']) > 0) {
             foreach ($PortionData['InterventionAct'] as $InterventionAct) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], interventionAct::Insert($InterventionAct, $CompleteData)];
             }
         }
         /**
          * Where an Outcome Observation needs to reference a Goal Observation already described in the CDA
          * document instance, rather than repeating the full content of the Goal Observation,
          * the Act Reference template may be used to reference this entry.
          */
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Intervention Act (NEW)
         if (count($PortionData['GoalObservationEvaluationReference']) > 0) {
             foreach ($PortionData['GoalObservationEvaluationReference'] as $GoalObservationEvaluationReference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'GEVL'], actReference::Insert($GoalObservationEvaluationReference, $CompleteData)];
             }
         }
         /**
          * Where an Outcome Observation needs to reference an Intervention Act already described in the CDA
          * document instance, rather than repeating the full content of the Intervention Act, the Act
          * Reference template may be used to reference this entry.
          */
         // SHOULD contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Intervention Act (NEW)
         if (count($PortionData['GoalObservationReasonReference']) > 0) {
             foreach ($PortionData['GoalObservationReasonReference'] as $GoalObservationReasonReference) {
                 $Entry['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], actReference::Insert($GoalObservationReasonReference, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }