$param->pid = $pid; $patientMedications = $Medical->getPatientMedications($param); $medications = array(); foreach ($patientMedications as $item) { $medications[] = array('Medication' => array(array('CCRDocumentObjectID' => UUID::v4(), 'DateTime' => array('DateTimeRange' => array('BeginRange' => array('ExactDateTime' => date("Y-m-d", strtotime($item['begin_date']))), 'EndRange' => array('ExactDateTime' => date("Y-m-d", strtotime($item['end_date']))))), 'Status' => array('Text' => 'Active'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)), 'Product' => array('ProductName' => array('Text' => $item['STR'], 'Code' => array('Value' => $item['RXCUI'], 'CodingSystem' => 'RxNorm')), 'Form' => array('Text' => $item['form'])), 'Directions' => array('Direction' => array(array('Dose' => array('Value' => $item['dose']), 'Route' => array('Code' => array('Value' => $item['route'], 'CodingSystem' => 'RouteOfAdministration')), 'Frequency' => array('Value' => $item['prescription_often']))))))); } /** * Alerts section - (SHALL) * -------------- * This section is used to list and describe any allergies, adverse reactions, and alerts that are pertinent to the * patient’s current or past medical history. At a minimum, currently active and any relevant historical * allergies and adverse reactions should be listed. */ $param = new stdClass(); $param->pid = $pid; $patientAllergies = $Medical->getPatientAllergies($param); $alerts = array(); foreach ($patientAllergies as $item) { $alerts[] = array('Alert' => array(array('CCRDocumentObjectID' => UUID::v4(), 'Description' => array('Text' => $item['allergy'], 'Code' => array('Value' => $item['allergy_code'], 'CodingSystem' => 'RXNORM')), 'Status' => array('Text' => $item['end_date'] == '' ? 'Active' : 'Not active'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)), 'Agent' => array('Products' => array('Product' => array(array('CCRDocumentObjectID' => UUID::v4(), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)), 'Product' => array('ProductName' => array('Text' => 'Penicillin', 'Code' => array('Value' => '70618', 'CodingSystem' => 'RxNorm'))))))), 'Reaction' => array('Description' => array('Text' => 'Hives', 'Code' => array('Value' => '247472004', 'CodingSystem' => 'SNOMED CT')))))); } /** * Social History section - (OPTIONAL) * ---------------------- * This section contains data defining the patient’s occupational, personal (e.g. lifestyle), social, and * environmental history and health risk factors, as well as administrative data such as marital status, race, * ethnicity and religious affiliation. Social history can have significant influence on a patient’s physical, * psychological and emotional health and wellbeing so should be considered in the development of a * complete record. */ $socialHistory = array('SocialHistoryElement' => array(array('CCRDocumentObjectID' => UUID::v4(), 'Type' => array('Text' => 'Smoking', 'Code' => array('Value' => '230056004', 'CodingSystem' => 'SNOMED CT')), 'Source' => array('Actor' => array('ActorID' => $softwareGUID)), 'Episodes' => array('Episode' => array(array('CCRDocumentObjectID' => UUID::v4(), 'DateTime' => array('DateTimeRange' => array('BeginRange' => array('ExactDateTime' => '1947'), 'EndRange' => array('ExactDateTime' => '1972'))), 'Description' => array('Text' => '1 pack per day'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID))), array('CCRDocumentObjectID' => UUID::v4(), 'DateTime' => array('DateTimeRange' => array('BeginRange' => array('ExactDateTime' => '1973'))), 'Description' => array('Text' => 'None'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID))), 'Source' => array('Actor' => array('ActorID' => $softwareGUID))))), array('CCRDocumentObjectID' => UUID::v4(), 'DateTime' => array('DateTimeRange' => array('BeginRange' => array('ExactDateTime' => '1973'))), 'Type' => array('Text' => 'ETOH Use', 'Code' => array('Value' => '160573003', 'CodingSystem' => 'SNOMED CT')), 'Description' => array('Text' => 'None'), 'Source' => array('Actor' => array('ActorID' => $softwareGUID))))); /**