/** * @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.7.2']], 'code' => ['@attributes' => ['code' => '47519-4', 'displayName' => 'Procedures', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC']], 'title' => 'Procedures', 'text' => self::Narrative($PortionData)]]]; // MAY contain zero or more [0..*] entry // SHALL contain exactly one [1..1] Patient Referral Act (NEW) if (count($PortionData['PatientReferralAct']) > 0) { foreach ($PortionData['PatientReferralAct'] as $PatientReferralAct) { $Section['component']['section']['entry'][] = LevelEntry\patientReferralAct::Insert($PatientReferralAct, $CompleteData); } } return $Section; } catch (Exception $Error) { return $Error; } }
/** * @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' => '1.3.6.1.4.1.19376.1.5.3.1.3.1.2']], 'code' => ['@attributes' => ['code' => '42349-1', 'displayName' => 'Reason for Referral', 'codeSystem' => '2.16.840.1.113883.6.1', 'codeSystemName' => 'LOINC']], 'title' => 'Reason for Referral', 'text' => self::Narrative($PortionData)]]]; // MAY contain zero or more [0..*] entry // SHALL contain exactly one [1..1] Patient Referral Act (NEW) if (count($PortionData['ReasonForReferral']['Observations']) > 1) { foreach ($PortionData['ReasonForReferral']['Observations'] as $Observation) { $Section['component']['section']['entry'][] = LevelEntry\patientReferralAct::Insert($Observation, $CompleteData); } } return $Section; } catch (Exception $Error) { return $Error; } }