public function import($xml, $document_id) { $audit_master_approval_status = $this->ccd_data_array['approval_status'] = 1; $this->ccd_data_array['ip_address'] = $_SERVER['REMOTE_ADDR']; $this->ccd_data_array['type'] = '13'; //Patient Details $this->ccd_data_array['field_name_value_array']['patient_data'][1]['fname'] = $xml['recordTarget']['patientRole']['patient']['name']['given'][0]; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['mname'] = $xml['recordTarget']['patientRole']['patient']['name']['given'][1]; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['lname'] = $xml['recordTarget']['patientRole']['patient']['name']['family']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['DOB'] = $xml['recordTarget']['patientRole']['patient']['birthTime']['value']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['sex'] = $xml['recordTarget']['patientRole']['patient']['administrativeGenderCode']['displayName']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['street'] = $xml['recordTarget']['patientRole']['addr']['streetAddressLine']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['city'] = $xml['recordTarget']['patientRole']['addr']['city']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['state'] = $xml['recordTarget']['patientRole']['addr']['state']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['postal_code'] = $xml['recordTarget']['patientRole']['addr']['postalCode']; $this->ccd_data_array['field_name_value_array']['patient_data'][1]['phone_home'] = preg_replace('/[^0-9]+/i', '', $xml['recordTarget']['patientRole']['telecom']['value']); $this->ccd_data_array['field_name_value_array']['patient_data'][1]['extension'] = $xml['recordTarget']['patientRole']['id']['extension']; $audit_master_id = \Application\Plugin\CommonPlugin::insert_ccr_into_audit_data($this->ccd_data_array); $this->update_document_table($document_id, $audit_master_id, $audit_master_approval_status); }
public function import($xml, $document_id) { $components = $xml['component']['structuredBody']['component']; $components_oids = array('2.16.840.1.113883.10.20.22.4.7' => 'allergy', '2.16.840.1.113883.10.20.22.2.6.1' => 'allergy', '2.16.840.1.113883.10.20.22.2.1' => 'medication', '2.16.840.1.113883.10.20.22.2.1.1' => 'medication', '2.16.840.1.113883.10.20.22.2.5.1' => 'medical_problem', '2.16.840.1.113883.10.20.22.2.5' => 'medical_problem', '2.16.840.1.113883.10.20.22.2.2' => 'immunization', '2.16.840.1.113883.10.20.22.2.2.1' => 'immunization', '2.16.840.1.113883.3.88.11.83.145' => 'procedure', '2.16.840.1.113883.10.20.22.2.7.1' => 'procedure', '2.16.840.1.113883.10.20.22.2.3.1' => 'lab_result', '2.16.840.1.113883.10.20.22.2.3' => 'lab_result', '2.16.840.1.113883.10.20.22.2.4.1' => 'vital_sign', '2.16.840.1.113883.10.20.22.2.17' => 'social_history', '2.16.840.1.113883.3.88.11.83.127' => 'encounter', '2.16.840.1.113883.10.20.22.2.22.1' => 'encounter', '2.16.840.1.113883.10.20.22.2.10' => 'care_plan', '2.16.840.1.113883.10.20.22.2.14' => 'functional_cognitive_status', '1.3.6.1.4.1.19376.1.5.3.1.3.1' => 'referral', '2.16.840.1.113883.10.20.22.2.11.1' => 'discharge_medications', '2.16.840.1.113883.10.20.22.2.41' => 'discharge_summary'); for ($i = 0; $i <= count($components); $i++) { if (count($components[$i]['section']['templateId']) > 1) { foreach ($components[$i]['section']['templateId'] as $key_1 => $value_1) { if ($components_oids[$components[$i]['section']['templateId'][$key_1]['root']] != '') { $func_name = $components_oids[$components[$i]['section']['templateId'][$key_1]['root']]; $this->{$func_name}($components[$i]); break; } } } else { if ($components_oids[$components[$i]['section']['templateId']['root']] != '') { $func_name = $components_oids[$components[$i]['section']['templateId']['root']]; $this->{$func_name}($components[$i]); } } } $audit_master_approval_status = $this->ccda_data_array['approval_status'] = 1; $this->ccda_data_array['ip_address'] = $_SERVER['REMOTE_ADDR']; $this->ccda_data_array['type'] = '12'; //Patient Details $this->ccda_data_array['field_name_value_array']['patient_data'][1]['fname'] = is_array($xml['recordTarget']['patientRole']['patient']['name']['given']) ? $xml['recordTarget']['patientRole']['patient']['name']['given'][0] : $xml['recordTarget']['patientRole']['patient']['name']['given']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['lname'] = $xml['recordTarget']['patientRole']['patient']['name']['family']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['DOB'] = $xml['recordTarget']['patientRole']['patient']['birthTime']['value']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['sex'] = $xml['recordTarget']['patientRole']['patient']['administrativeGenderCode']['displayName']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['pubpid'] = $xml['recordTarget']['patientRole']['id'][0]['extension']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['ss'] = $xml['recordTarget']['patientRole']['id'][1]['extension']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['street'] = $xml['recordTarget']['patientRole']['addr']['streetAddressLine']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['city'] = $xml['recordTarget']['patientRole']['addr']['city']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['state'] = $xml['recordTarget']['patientRole']['addr']['state']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['postal_code'] = $xml['recordTarget']['patientRole']['addr']['postalCode']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['country_code'] = $xml['recordTarget']['patientRole']['addr']['country']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['phone_home'] = preg_replace('/[^0-9]+/i', '', $xml['recordTarget']['patientRole']['telecom']['value']); $this->ccda_data_array['field_name_value_array']['patient_data'][1]['status'] = $xml['recordTarget']['patientRole']['patient']['maritalStatusCode']['displayName']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['religion'] = $xml['recordTarget']['patientRole']['patient']['religiousAffiliationCode']['displayName']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['race'] = $xml['recordTarget']['patientRole']['patient']['raceCode']['displayName']; $this->ccda_data_array['field_name_value_array']['patient_data'][1]['ethnicity'] = $xml['recordTarget']['patientRole']['patient']['ethnicGroupCode']['displayName']; //Author details $this->ccda_data_array['field_name_value_array']['author'][1]['extension'] = $xml['author']['assignedAuthor']['id']['extension']; $this->ccda_data_array['field_name_value_array']['author'][1]['address'] = $xml['author']['assignedAuthor']['addr']['streetAddressLine']; $this->ccda_data_array['field_name_value_array']['author'][1]['city'] = $xml['author']['assignedAuthor']['addr']['city']; $this->ccda_data_array['field_name_value_array']['author'][1]['state'] = $xml['author']['assignedAuthor']['addr']['state']; $this->ccda_data_array['field_name_value_array']['author'][1]['zip'] = $xml['author']['assignedAuthor']['addr']['postalCode']; $this->ccda_data_array['field_name_value_array']['author'][1]['country'] = $xml['author']['assignedAuthor']['addr']['country']; $this->ccda_data_array['field_name_value_array']['author'][1]['phone'] = $xml['author']['assignedAuthor']['telecom']['value']; $this->ccda_data_array['field_name_value_array']['author'][1]['name'] = $xml['author']['assignedAuthor']['assignedPerson']['name']['given']; //Data Enterer $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['extension'] = $xml['dataEnterer']['assignedEntity']['id']['extension']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['address'] = $xml['dataEnterer']['assignedEntity']['addr']['streetAddressLine']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['city'] = $xml['dataEnterer']['assignedEntity']['addr']['city']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['state'] = $xml['dataEnterer']['assignedEntity']['addr']['state']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['zip'] = $xml['dataEnterer']['assignedEntity']['addr']['postalCode']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['country'] = $xml['dataEnterer']['assignedEntity']['addr']['country']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['phone'] = $xml['dataEnterer']['assignedEntity']['telecom']['value']; $this->ccda_data_array['field_name_value_array']['dataEnterer'][1]['name'] = $xml['dataEnterer']['assignedEntity']['assignedPerson']['name']['given']; //Informant $this->ccda_data_array['field_name_value_array']['informant'][1]['extension'] = $xml['informant'][0]['assignedEntity']['id']['extension']; $this->ccda_data_array['field_name_value_array']['informant'][1]['street'] = $xml['informant'][0]['assignedEntity']['addr']['streetAddressLine']; $this->ccda_data_array['field_name_value_array']['informant'][1]['city'] = $xml['informant'][0]['assignedEntity']['addr']['city']; $this->ccda_data_array['field_name_value_array']['informant'][1]['state'] = $xml['informant'][0]['assignedEntity']['addr']['state']; $this->ccda_data_array['field_name_value_array']['informant'][1]['postalCode'] = $xml['informant'][0]['assignedEntity']['addr']['postalCode']; $this->ccda_data_array['field_name_value_array']['informant'][1]['country'] = $xml['informant'][0]['assignedEntity']['addr']['country']; $this->ccda_data_array['field_name_value_array']['informant'][1]['phone'] = $xml['informant'][0]['assignedEntity']['telecom']['value']; $this->ccda_data_array['field_name_value_array']['informant'][1]['name'] = $xml['informant'][0]['assignedEntity']['assignedPerson']['name']['given']; //Personal Informant $this->ccda_data_array['field_name_value_array']['custodian'][1]['extension'] = $xml['custodian']['assignedCustodian']['representedCustodianOrganization']['id']['extension']; $this->ccda_data_array['field_name_value_array']['custodian'][1]['organisation'] = $xml['custodian']['assignedCustodian']['representedCustodianOrganization']['name']; //documentationOf $doc_of_str = ''; if (!is_array($xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['prefix'])) { $doc_of_str .= $xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['prefix'] . " "; } if (!is_array($xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['given'])) { $doc_of_str .= $xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['given'] . " "; } if (!is_array($xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['family'])) { $doc_of_str .= $xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['assignedPerson']['name']['family'] . " "; } if (!is_array($xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['representedOrganization']['name'])) { $doc_of_str .= $xml['documentationOf']['serviceEvent']['performer'][0]['assignedEntity']['representedOrganization']['name'] . " "; } $this->ccda_data_array['field_name_value_array']['documentationOf'][1]['assignedPerson'] = $doc_of_str; $documentationOf = $this->ccda_data_array['field_name_value_array']['documentationOf'][1]['assignedPerson']; $audit_master_id = \Application\Plugin\CommonPlugin::insert_ccr_into_audit_data($this->ccda_data_array); $this->update_document_table($document_id, $audit_master_id, $audit_master_approval_status, $documentationOf); }