示例#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' => Component::templateId('2.16.840.1.113883.10.20.22.2.29.2'), 'code' => ['@attributes' => ['code' => '59768-2', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC', 'displayName' => 'Procedure Indications']], 'title' => 'Procedure Indications', 'text' => self::Narrative($PortionData)]]];
         // MAY contain zero or more [0..*] entry
         // SHALL contain exactly one [1..1] Indication (V2)
         if (count($PortionData['Indication']) > 0) {
             foreach ($PortionData['Indication'] as $Indication) {
                 $Section['component']['section']['entry'][] = LevelEntry\indication::Insert($Indication, $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 = ['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;
     }
 }
示例#3
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;
     }
 }
示例#4
0
 /**
  * @return array
  */
 public static function Structure()
 {
     return ['PlannedEncounter' => ['moodCode' => 'SHALL be selected from ValueSet Plan of Care moodCode (Act/Encounter/Procedure)', 'code' => 'SHALL contain exactly one [1..1] code', 'codeSystemName' => 'SHALL contain exactly one [1..1] code', 'displayName' => 'SHALL contain exactly one [1..1] code', 'effectiveTime' => 'SHALL contain exactly one [1..1] effectiveTime', LevelDocument\performer::Structure(), LevelDocument\participant::Structure(), patientPriorityPreference::Structure(), providerPriorityPreference::Structure(), indication::Structure()]];
 }
 /**
  * @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;
     }
 }
示例#6
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;
     }
 }