示例#1
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['observation' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'OBS'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.44.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'), '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['observation']['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['observation']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Performer) {
                 $Entry['observation']['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['observation']['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['observation']['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['observation']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         return $Entry;
     } 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 = ['encounter' => ['@attributes' => ['moodCode' => $PortionData['moodCode'], 'classCode' => 'ENC'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.40.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'), 'effectiveTime' => Component::time($PortionData['effectiveTime'])]];
         // MAY contain zero or more [0..*] performer
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['encounter']['performer'][] = LevelDocument\performer::Insert($Performer, $CompleteData);
             }
         }
         // MAY contain zero or more [0..*] participant
         if (count($PortionData['Participant']) > 0) {
             foreach ($PortionData['Participant'] as $Performer) {
                 $Entry['encounter']['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['encounter']['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['encounter']['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['encounter']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], providerPriorityPreference::Insert($ProviderPriorityPreference, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Entry['encounter']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], providerPriorityPreference::Insert($Indication, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
示例#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' => '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;
     }
 }
示例#4
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['encounter' => ['@attributes' => ['classCode' => 'ENC', 'moodCode' => 'EVN'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.49.2'), 'id' => Component::id(Utilities::UUIDv4()), 'translation' => ['code' => 'AMB', 'codeSystem' => '2.16.840.1.113883.5.4', 'displayName' => 'Ambulatory', 'codeSystemName' => 'HL7 ActEncounterCode'], 'effectiveTime' => Component::time($PortionData['effectiveTime'])]];
         // SHOULD contain zero or one [0..1] code, which SHOULD be selected from
         // ValueSet EncounterTypeCode 2.16.840.1.113883.3.88.12.80.32 DYNAMIC (CONF:8714)
         if (isset($PortionData['code']) && isset($PortionData['displayName']) && isset($PortionData['systemCodeName'])) {
             $Entry['encounter']['code'] = ['@attributes' => ['code' => $PortionData['code'], 'displayName' => $PortionData['displayName'], 'codeSystem' => Utilities::CodingSystemId($PortionData['systemCodeName']), 'codeSystem' => $PortionData['systemCodeName']]];
         }
         // The code, if present, SHOULD contain zero or one [0..1] originalText (CONF:8719)
         if (isset($PortionData['Narrated'])) {
             $Entry['encounter']['originalText'] = $PortionData['Narrated'];
         }
         // MAY contain zero or more [0..*] performer (CONF:8725)
         // SHALL contain exactly one [1..1] Service Delivery Location
         if (count($PortionData['Performer']) > 0) {
             foreach ($PortionData['Performer'] as $Performer) {
                 $Entry['encounter']['performer'][] = LevelDocument\performer::Insert($Performer);
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:8722)
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Entry['encounter']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], 'entry' => ['@attributes' => ['typeCode' => 'DRIV'], indication::Insert($Indication)]];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship (CONF:15492)
         // SHALL contain exactly one [1..1] Encounter Diagnosis (V2)
         if (count($PortionData['EncounterDiagnosis']) > 0) {
             foreach ($PortionData['EncounterDiagnosis'] as $EncounterDiagnosis) {
                 $Entry['encounter']['entryRelationship'][] = encounterDiagnosis::Insert($EncounterDiagnosis, $CompleteData);
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
示例#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' => '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;
     }
 }
示例#6
0
 /**
  * @param $PortionData
  * @param $CompleteData
  * @return array|Exception
  */
 public static function Insert($PortionData, $CompleteData)
 {
     try {
         // Validate first
         self::Validate($PortionData);
         $Entry = ['substanceAdministration' => ['@attributes' => ['classCode' => 'SBADM', 'moodCode' => 'EVN'], 'templateId' => Component::templateId('2.16.840.1.113883.10.20.22.4.52.2'), 'id' => Component::id(Utilities::UUIDv4()), 'statusCode' => Component::statusCode('completed'), 'effectiveTime' => Component::time($PortionData['effectiveTime']), 'routeCode' => ['@attributes' => ['code' => $PortionData['routeCode'], 'codeSystem' => Utilities::CodingSystemId($PortionData['routeCodeSystemName']), 'codeSystemName' => $PortionData['routeCodeSystemName'], 'displayName' => $PortionData['routeDisplayName']]], 'doseQuantity' => ['@attributes' => ['value' => $PortionData['doseQuantityValue'], 'unit' => $PortionData['doseQuantityUnit']]], 'consumable' => ['manufacturedProduct' => immunizationMedicationInformation::Insert($PortionData, $CompleteData)], 'performer' => LevelDocument\performer::Insert($PortionData)]];
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Entry['substanceAdministration']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'RSON'], indication::Insert($Indication, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Instruction (V2)
         if (count($PortionData['Instruction']) > 0) {
             $Entry['substanceAdministration']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'SUBJ'], instruction::Insert($PortionData['Instruction'][0], $CompleteData)];
         }
         // MAY contain zero or more [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Medication Supply Order (V2)
         if (count($PortionData['MedicationSupplyOrder']) > 0) {
             $Entry['substanceAdministration']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'REFR'], medicationSupplyOrder::Insert($PortionData['MedicationSupplyOrder'][0], $CompleteData)];
         }
         // MAY contain zero or more [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Medication Dispense (V2)
         if (count($PortionData['MedicationDispense']) > 0) {
             $Entry['substanceAdministration']['supply'][] = ['@attributes' => ['typeCode' => 'REFR'], medicationDispense::Insert($PortionData['MedicationDispense'][0], $CompleteData)];
         }
         // MAY contain zero or more [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Reaction Observation (V2)
         if (count($PortionData['ReactionObservation']) > 0) {
             $Entry['substanceAdministration']['supply'][] = ['@attributes' => ['typeCode' => 'CAUS'], reactionObservation::Insert($PortionData['ReactionObservation'][0], $CompleteData)];
         }
         // MAY contain zero or more [0..1] entryRelationship
         // SHALL contain exactly one [1..1] Immunization Refusal Reason
         if (count($PortionData['ImmunizationRefusalReason']) > 0) {
             $Entry['substanceAdministration']['supply'][] = ['@attributes' => ['typeCode' => 'RSON'], immunizationRefusalReason::Insert($PortionData['ImmunizationRefusalReason'][0], $CompleteData)];
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Substance Administered Act (NEW)
         if (count($PortionData['SubstanceAdministeredAct']) > 0) {
             foreach ($PortionData['SubstanceAdministeredAct'] as $SubstanceAdministeredAct) {
                 $Entry['substanceAdministration']['entryRelationship'][] = ['@attributes' => ['typeCode' => 'COMP', 'inversionInd' => 'true'], substanceAdministeredAct::Insert($SubstanceAdministeredAct, $CompleteData)];
             }
         }
         // MAY contain zero or more [0..*] entryRelationship
         // SHALL contain exactly one [1..1] Substance Administered Act (NEW)
         if (count($PortionData['PreconditionForSubstanceAdministration']) > 0) {
             foreach ($PortionData['PreconditionForSubstanceAdministration'] as $PreconditionForSubstanceAdministration) {
                 $Entry['substanceAdministration']['precondition'][] = ['@attributes' => ['typeCode' => 'PRCN'], preconditionForSubstanceAdministration::Insert($PreconditionForSubstanceAdministration, $CompleteData)];
             }
         }
         return $Entry;
     } catch (Exception $Error) {
         return $Error;
     }
 }
 /**
  * @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;
     }
 }