/**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['substanceAdministration' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'SBADM'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.42.2'), 'text' => self::Narrative($PortionData), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['code'], 'codeSystem' => Utilities::CodingSystemId($PortionData['codeSystemName']), 'codeSystemName' => $PortionData['codeSystemName'], 'displayName' => $PortionData['displayName']], 'statusCode' => Component::statusCode('active'), 'effectiveTime' => $PortionData['effectiveTime']]];
         // MAY contain zero or more [0..*] performer
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['procedure']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Performer) {
                 $Entry['procedure']['participant'][] = LevelDocument\participant::Insert($Performer, $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['procedure']['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['procedure']['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['procedure']['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 = ['act' => ['@attributes' => ['moodCode' => 'EVN', 'classCode' => 'ACT'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.61.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['healthInsuranceCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['healthInsuranceCodeSystemName']), 'codeSystemName' => $PortionData['healthInsuranceCodeSystemName']], 'statusCode' => Component::statusCode('completed'), 'participant' => [0 => LevelDocument\participant::Insert($PortionData['Coverage']), 1 => LevelDocument\participant::Insert($PortionData['Holder'])]]];
         // SHOULD contain zero or more [1..1] performer Participation (NEW)
         // This templateId SHALL contain exactly one [1..1] Payer Performer
         if (count($PortionData['Payer']) > 0) {
             $Entry['act']['performer'][] = LevelDocument\performer::Insert($PortionData['Payer'][0], $CompleteData);
         }
         // SHOULD contain zero or more [0..1] performer Participation (NEW)
         // This templateId SHALL contain exactly one [1..1] Guarantor Performer
         if (count($PortionData['Guarantor']) > 0) {
             $Entry['act']['performer'][] = LevelDocument\performer::Insert($PortionData['Guarantor'][0], $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 = ['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.º 4
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['procedure' => ['@attributes' => ['moodCode' => 'EVN', 'classCode' => 'PROC'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.14.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['activityCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['activityCodeSystemName']), 'displayName' => $PortionData['activityDisplayName'], 'codeSystemName' => $PortionData['activityCodeSystemName']], 'statusCode' => Component::statusCode($PortionData['statusCode']), 'effectiveTime' => Component::effectiveTime($PortionData['effectiveTime']), 'priorityCode' => ['@attributes' => ['code' => $PortionData['priorityCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['priorityCodeSystemName']), 'codeSystemName' => $PortionData['priorityCodeSystemName'], 'displayName' => $PortionData['priorityDisplayName']]], 'value' => ['@attributes' => ['xsi:type' => 'CD']]]];
         // SHOULD contain zero or more [0..*] targetSiteCode
         // SHALL be selected from ValueSet Body Site Value Set
         if (count($PortionData['targetSiteCode']) > 0) {
             foreach ($PortionData['targetSiteCode'] as $targetSiteCode) {
                 $Entry['procedure']['targetSiteCode'][] = ['@attributes' => ['code' => $targetSiteCode['targetSiteCode'], 'codeSystem' => Utilities::CodingSystemId($targetSiteCode['targetSiteCodeName']), 'codeSystemName' => $targetSiteCode['targetSiteCodeName'], 'displayName' => $targetSiteCode['targetSiteDisplayName']]];
             }
         }
         // MAY contain zero or more [0..*] specimen
         // This specimen is for representing specimens obtained from a procedure
         if (count($PortionData['Specimen']) > 0) {
             foreach ($PortionData['Specimen'] as $Specimen) {
                 $Entry['procedure']['specimen'][] = ['@attributes' => ['typeCode' => 'SPC'], 'specimenRole' => ['@attributes' => ['classCode' => 'SPEC'], 'id' => Component::id(Utilities::UUIDv4()), 'specimenPlayingEntity' => ['code' => ['@attributes' => ['code' => $Specimen['specimenCode'], 'codeSystem' => Utilities::CodingSystemId($Specimen['specimenCodeSystemName']), 'codeSystemName' => $Specimen['specimenCodeSystemName'], 'displayName' => $Specimen['specimenDisplayName']]]]]];
             }
         }
         // SHOULD contain zero or one [0..1] text
         if (isset($PortionData['Narrated'])) {
             $Entry['procedure']['code']['originalText']['reference'] = ['@attributes' => ['value' => self::Narrative($PortionData['Narrated'])]];
         }
         // SHOULD contain zero or more [0..*] performer
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['procedure']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Participant) {
                 $Entry['procedure']['participant'][] = LevelDocument\participant::Insert($Participant, $CompleteData);
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['Instruction']) > 0) {
             foreach ($PortionData['Instruction'] as $Instruction) {
                 $Entry['procedure']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], instruction::Insert($Instruction, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Entry['procedure']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], indication::Insert($Indication, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Medication Activity (V2)
         if (count($PortionData['MedicationActivity']) > 0) {
             foreach ($PortionData['MedicationActivity'] as $MedicationActivity) {
                 $Entry['procedure']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], medicationActivity::Insert($MedicationActivity, $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' => 'INT', 'classCode' => 'ACT'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.12.2'), 'id' => Component::id(Utilities::UUIDv4()), 'code' => ['code' => $PortionData['activityCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['activityCodeSystemName']), 'displayName' => $PortionData['activityDisplayName'], 'codeSystemName' => $PortionData['activityCodeSystemName']], 'statusCode' => Component::statusCode($PortionData['statusCode']), 'effectiveTime' => Component::effectiveTime($PortionData['effectiveTime']), 'priorityCode' => ['@attributes' => ['code' => $PortionData['priorityCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['priorityCodeSystemName']), 'codeSystemName' => $PortionData['priorityCodeSystemName'], 'displayName' => $PortionData['priorityDisplayName']]]]];
         // SHOULD contain zero or one [0..1] text
         if (isset($PortionData['Narrated'])) {
             $Entry['act']['code']['originalText']['reference'] = ['@attributes' => ['value' => self::Narrative($PortionData['Narrated'])]];
         }
         // SHOULD 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 $Participant) {
                 $Entry['act']['participant'][] = LevelDocument\participant::Insert($Participant, $CompleteData);
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['Instruction']) > 0) {
             foreach ($PortionData['Instruction'] as $Instruction) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], instruction::Insert($Instruction, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], indication::Insert($Indication, $CompleteData)];
             }
         }
         // MAY contain zero or one [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Medication Activity (V2)
         if (count($PortionData['MedicationActivity']) > 0) {
             foreach ($PortionData['MedicationActivity'] as $MedicationActivity) {
                 $Entry['act']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP'], medicationActivity::Insert($MedicationActivity, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }