예제 #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.21.2.3.2', 'extension' => $PortionData['Interventions']['date']]], 'code' => ['@attributes' => ['code' => '62387-6', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC', 'displayName' => 'Interventions Provided']], 'title' => 'Interventions Provided', 'text' => self::Narrative($PortionData)]]];
         // SHOULD contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Intervention Act (NEW)
         if (count($PortionData['InterventionAct']) > 0) {
             foreach ($PortionData['InterventionAct'] as $InterventionAct) {
                 $Section['component']['section']['entry'][] = LevelEntry\interventionAct::Insert($InterventionAct, $CompleteData);
             }
         }
         return $Section;
     } catch (Exception $Error) {
         return $Error;
     }
 }
예제 #2
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;
     }
 }