function getAllPatientEncounters($xml, $patient_id) { global $encCheckUniqId, $from_date, $to_date; $encArr = allEncPat($patient_id, $from_date, $to_date); foreach ($encArr as $encRow) { $encRow['encounter']; //Entry open $xml->open_entry(); //Encounter Open $xml->open_customTag('encounter', array('classCode' => 'ENC', 'moodCode' => 'EVN')); $tempID = "2.16.840.1.113883.10.20.22.4.49"; $xml->self_templateid($tempID); $tempID = "2.16.840.1.113883.10.20.24.3.23"; $xml->self_templateid($tempID); $refID = getUuid(); $xml->self_customId($refID); $encCheckUniqId[$encRow['encounter']] = $refID; $arr = array('code' => '99201', 'codeSystem' => '2.16.840.1.113883.6.12'); $xml->self_codeCustom($arr); $arr = array('code' => 'completed'); $xml->self_customTag('statusCode', $arr); $timeArr = array('low' => date('Ymdhis', strtotime($encRow['date'])), 'high' => date('Ymdhis', strtotime($encRow['date']))); $xml->add_entryEffectTime($timeArr); //Encounter Close $xml->close_customTag(); //Entry close $xml->close_entry(); } }
function getAllPatientEncounters($xml, $patient_id) { global $encCheckUniqId, $from_date, $to_date, $EncounterCptCodes; $encArr = allEncPat($patient_id, $from_date, $to_date); foreach ($encArr as $encRow) { $encRow['encounter']; $cpt_code = $EncounterCptCodes[str_replace(' ', '_', strtolower($encRow['pc_catname']))]; $cpt_code = empty($cpt_code) ? '99201' : $cpt_code; $vset = sqlStatement("select * from valueset where code = ? and nqf_code = ?", array('99201', $xml->nqf_code)); foreach ($vset as $v) { //Entry open $xml->open_entry(); //Encounter Open $xml->open_customTag('encounter', array('classCode' => 'ENC', 'moodCode' => 'EVN')); $tempID = "2.16.840.1.113883.10.20.22.4.49"; $xml->self_templateid($tempID); $tempID = "2.16.840.1.113883.10.20.24.3.23"; $xml->self_templateid($tempID); $refID = getUuid(); $xml->self_customId($refID); $encCheckUniqId[$encRow['encounter']] = $refID; $arr = array('code' => $cpt_code, 'codeSystem' => $v['code_system'], 'sdtc:valueSet' => $v['valueset']); $xml->self_codeCustom($arr); $arr = array('code' => 'completed'); $xml->self_customTag('statusCode', $arr); $timeArr = array('low' => date('Ymdhis', strtotime($encRow['date'])), 'high' => date('Ymdhis', strtotime($encRow['date']))); $xml->add_entryEffectTime($timeArr); //Encounter Close $xml->close_customTag(); //Entry close $xml->close_entry(); } } $encArr = allProcPat("enc_checkup_procedure", $patient_id, $from_date, $to_date); foreach ($encArr as $encRow) { $encRow['encounter']; $vset = sqlStatement("select * from valueset where code = ? and nqf_code = ?", array($encRow['procedure_code'], $xml->nqf_code)); foreach ($vset as $v) { //Entry open $xml->open_entry(); //Encounter Open $xml->open_customTag('encounter', array('classCode' => 'ENC', 'moodCode' => 'EVN')); $tempID = "2.16.840.1.113883.10.20.22.4.49"; $xml->self_templateid($tempID); $tempID = "2.16.840.1.113883.10.20.24.3.23"; $xml->self_templateid($tempID); $refID = getUuid(); $xml->self_customId($refID); $encCheckUniqId[$encRow['encounter']] = $refID; $arr = array('code' => $v['code'], 'codeSystem' => $v['code_system'], 'sdtc:valueSet' => $v['valueset']); $xml->self_codeCustom($arr); $arr = array('code' => 'completed'); $xml->self_customTag('statusCode', $arr); $timeArr = array('low' => date('Ymdhis', strtotime($encRow['date'])), 'high' => date('Ymdhis', strtotime($encRow['date']))); $xml->add_entryEffectTime($timeArr); //Encounter Close $xml->close_customTag(); //Entry close $xml->close_entry(); } } }