db = new db('p:'.$host,$user,$password,$database); } return $this; } function setVar($param) { if($param['user'] != ''){ $this->user = $param['user']; } if($param['rs_id'] != ''){ $this->rs_id = $param['rs_id']; } } // referensi function getBuild() { if(!empty($this->user)) { $result = $this->db->query("SELECT patch_number from xocp_patch order by patch_id desc limit 1"); return $result->fetchFirst(); } return false; } function getPasien($patient_id) { if(!empty($this->user)) { $result = $this->db->query("SELECT person_id,person_nm,birth_dttm,patient_mrn,nokartu from xocp_his_patient a join xocp_persons b on a.person_id = b.person_id where a.patient_id = {$patient_id}"); return $result->fetchAll(); } return false; } function getPayplan() { if(!empty($this->user)) { $result = $this->db->query("SELECT * from xocp_his_payplan"); return $result->fetchAll(); } return false; } function getCOB() { if(!empty($this->user)) { $result = $this->db->query("SELECT * from xocp_his_cob"); return $result->fetchAll(); } return false; } function getDPJP() { if(!empty($this->user)) { $result = $this->db->query("SELECT * from xocp_his_dpjp"); return $result->fetchAll(); } return false; } function getDiagnosa($query) { if(!empty($this->user)) { $result = $this->db->query("SELECT code,str from mrconso where code like '$query%' OR str like '%$query%'"); return $result->fetchAll(); } return false; } function getProsedur($query) { if(!empty($this->user)) { $result = $this->db->query("SELECT code,str from mrconso where code like '$query%' OR str like '%$query%'"); return $result->fetchAll(); } return false; } function getKlaim($patient_id) { if(!empty($this->user)) { $result = $this->db->query("SELECT hospital_admission_id,admission_dttm,admission_type,discharge_dttm,payplan_nm,no_sep,cbg_code,user_nm,klaim_status_cd from xocp_his_patient_admission a JOIN xocp_his_payplan b on a.payplan_id = b.payplan_id JOIN xocp_users u on a.created_user_id = u.user_id LEFT JOIN xocp_his_cbg_result c on a.patient_id = c.patient_id and a.admission_id = c.admission_id where a.patient_id = {$patient_id} and a.status_cd = 'normal' ORDER BY admission_dttm desc"); $user_data = $result->fetchAll(); return $user_data; } return false; } function editKlaim($patient_id,$hospital_admission_id) { if(!empty($this->user)) { $query['admission'] = $this->db->query("SELECT a.hospital_admission_id, a.patient_id, a.admission_id, a.admission_type, a.admission_dttm, a.org_id, a.rs_tariff, a.discharge, a.discharge_status, a.discharge_dttm, a.payplan_id, a.no_kartu, a.no_sep, a.attending_doctor_id, a.attending_doctor_nm, a.status_cd, a.tariff_class, a.outpatient_class, a.los, a.adl1, a.adl2, a.special_procedure, a.special_prosthesis, a.special_investigation, a.special_drugs, a.birth_weight, a.billing_amount, a.billing_amount_pex, a.icu_ind, a.icu_los, a.vent_hour, a.upgrade_class_ind, a.upgrade_class_class, a.upgrade_class_los, a.grouping_count, a.unugrouper_version, a.klaim_status_cd, a.migrated_patient_id, a.migrated_admission_id, a.grouper_dttm, a.grouper_user_id, a.severity, a.bpjs_status_cd, a.rs_no, a.add_payment_pct, a.add_payment_amt, a.cob_id, b.person_id, b.patient_mrn, b.nokartu, c.person_nm, c.birth_dttm, c.adm_gender_cd FROM xocp_his_patient_admission a JOIN xocp_his_patient b on a.patient_id = b.patient_id JOIN xocp_persons c on b.person_id = c.person_id where a.hospital_admission_id = {$hospital_admission_id}"); $user_data['admission'] = $query['admission']->fetchFirst(); $tgl_lahir_pasien = ($user_data['admission']['birth_dttm'] != null || $user_data['admission']['birth_dttm'] != '0000-00-00 00:00:00') ? new Datetime( datetime_to_date_en($user_data['admission']['birth_dttm']) ) : false; $tgl_sekarang = new Datetime(date('Y-m-d')); $differ_date = ($tgl_lahir_pasien != false) ? $tgl_lahir_pasien->diff($tgl_sekarang) : 0; $user_data['admission']['umur'] = $differ_date->format("%Y tahun"); $admission_id = $user_data['admission']['admission_id']; $tarif_class = preg_replace("/kelas\_/",'',$user_data['admission']['tariff_class']); $upgrade_ind = $user_data['admission']['upgrade_class_ind']; $tarif_upgrade = preg_replace("/kelas\_/",'',$user_data['admission']['upgrade_class_class']); $query['billing'] = $this->db->query("SELECT ".implode(", ", $this->column_bill)." FROM xocp_his_billing_detail where hospital_admission_id = {$hospital_admission_id}"); if($query['billing']->numRows() > 0){ $user_data['billing'] = $query['billing']->fetchFirst(); } else { foreach($this->column_bill as $col) { $user_data['billing'][$col] = 0; } } $query['diag'] = $this->db->query("SELECT * FROM xocp_his_patient_discharge_diag a JOIN mrconso b on a.diag_cd = b.CODE where a.patient_id = {$patient_id} and a.admission_id = {$admission_id} ORDER BY diag_no"); $user_data['diag'] = $query['diag']->fetchAll(); $query['proc'] = $this->db->query("SELECT * FROM xocp_his_patient_discharge_proc a JOIN mrconso b on a.proc_cd = b.CODE where a.patient_id = {$patient_id} and a.admission_id = {$admission_id} ORDER BY proc_no"); $user_data['proc'] = $query['proc']->fetchAll(); $query['result'] = $this->db->query("SELECT *,(select code from ina_grouper4_specialgroups_20230124 s_sp where s_sp.Code_full = xocp_his_cbg_result.sp and s_sp.INACBG = xocp_his_cbg_result.cbg_code)as sp_code,(select code from ina_grouper4_specialgroups_20230124 s_sr where s_sr.Code_full = xocp_his_cbg_result.sr and s_sr.INACBG = xocp_his_cbg_result.cbg_code) as sr_code,(select code from ina_grouper4_specialgroups_20230124 s_si where s_si.Code_full = xocp_his_cbg_result.si and s_si.INACBG = xocp_his_cbg_result.cbg_code)as si_code,(select code from ina_grouper4_specialgroups_20230124 s_sd where s_sd.Code_full = xocp_his_cbg_result.sd and s_sd.INACBG = xocp_his_cbg_result.cbg_code)as sd_code FROM xocp_his_cbg_result JOIN unucbg_2016 on xocp_his_cbg_result.cbg_code = unucbg_2016.code where patient_id = {$patient_id} and admission_id = {$admission_id}"); if($query['result']->numRows() > 0) { $user_data['result'] = $query['result']->fetchFirst(); $cbg_code = $user_data['result']['cbg_code']; // get rs setup $rs = $this->db->query("SELECT rs_tariff, regional FROM rs_setup where rs_no = '".$this->rs_id."'"); $rs_data = $rs->fetchFirst(); if($cbg_code != '') { $query['tariff'] = $this->db->query("SELECT * FROM tariff_20230124 WHERE tariff_20230124.INACBG = '{$cbg_code}' AND tariff_20230124.REGIONAL = '{$rs_data['regional']}' AND tariff_20230124.KODE_TARIFF = '{$rs_data['rs_tariff']}'"); // $query['tariff'] = $this->db->query("SELECT * FROM tariff WHERE tariff.INACBG = '{$cbg_code}' AND tariff.REGIONAL = '{$rs_data['regional']}' AND tariff.KODE_TARIFF = '{$rs_data['rs_tariff']}'"); $arr_tarif=[]; foreach($query['tariff']->fetchAll() as $row_tarif) { $arr_tarif[$row_tarif['KELAS_RAWAT']] = $row_tarif['TARIFF']; } $user_data['tariff'][$tarif_class] = $arr_tarif[$tarif_class]; if($upgrade_ind == 1 && preg_match("/vip/", $tarif_upgrade)) { $user_data['tariff'][$tarif_upgrade] = $arr_tarif[1]; } else{ $user_data['tariff'][$tarif_upgrade] = $arr_tarif[$tarif_upgrade]; } // get special cmg $cmg_query = $this->db->query("SELECT a.*,b.TARIFF,case CMG_type when 'Special Procedure' then 'sp' when 'Special Prosthesis' then 'sr' when 'Special Investigation' then 'si' when 'Special Drug' then 'sd' end as cmg from ina_grouper4_specialgroups_20230124 a join special_cmg_tariff_20230124 b on a.Code_Full = b.CODE_FULL and a.INACBG = b.INACBG where a.INACBG = '$cbg_code' and REGIONAL = 'reg1' and KODE_TARIFF = 'AP' "); if($cmg_query->numRows() > 0) { foreach($cmg_query->fetchAll() as $row){ $user_data['cmg'][$row['cmg']][$row['Code']] = $row['CMG_Description']; } } } } return $user_data; } return false; } function getUserNik($user_id) { if(!empty($this->user)) { $result = $this->db->query("SELECT ext_id from xocp_persons p join xocp_users u on p.person_id = u.person_id where u.user_nm = '$user_id'"); $user_data = $result->fetchFirst(); return $user_data; } return false; } // end referensi function setUserID() { if(!empty($this->user)) { $result = $this->db->query("SELECT * from xocp_users where user_nm = '".$this->user."'"); $user_data = $result->fetchFirst(); $this->user_id = $user_data['user_id']; } return false; } function getCounterKlaim($patient_id) { if(!empty($this->user)) { $result = $this->db->query("SELECT count(admission_id) as jml_admisi from xocp_his_patient_admission where patient_id = ".$patient_id." and status_cd = 'normal'"); $user_data = $result->fetchFirst(); return $user_data['jml_admisi']; } return false; } private function insert($table, $param) { $column = $values = []; $column = array_keys($param); $values = array_values($param); $this->db->debugging = TRUE; $save = $this->db->query("INSERT INTO $table(".implode(",",$column).") VALUES ('".implode("','",$values)."')"); $this->db->debugging = FALSE; return $save; } private function update($table, $data, $where) { $str_value = 'SET '; $arr_set = array(); foreach($data as $key => $value) { if(is_array($value)) { $val = $value['value']; $type = $value['type']; if($type == 'number') { $arr_set[] = $key." = ".$val; } } else { $arr_set[] = $key." ='".$value."'"; } } $str_value .= implode(",".PHP_EOL,$arr_set); $this->db->debugging = TRUE; $save = $this->db->query("UPDATE $table $str_value WHERE $where"); $this->db->debugging = FALSE; return $save; } function insertPatient($param) { if(!empty($this->user)) { // get patient by patient_mrn first, if found return patient_id $get_patient = $this->db->query("SELECT * from xocp_his_patient where patient_mrn = ".$param['norm']); if($get_patient->numRows() > 0) { return $get_patient->fetchFirst()['patient_id']; } else { // insert into xocp_persons $arr_persons = [ 'person_nm' => $param['nama'], 'birth_dttm' => $param['tgl_lahir'], 'adm_gender_cd' => $param['jenis_kelamin'], 'created_user_id' => $this->user_id ]; $save_persons = $this->insert("xocp_persons",$arr_persons); $id_person = $save_persons->insertid; // insert into xocp_his_patient $arr_patient = [ 'person_id' => $id_person, 'patient_mrn' => $param['norm'], 'nokartu' => $param['nokartu'], 'created_user_id' => $this->user_id, 'rs_no' => $this->rs_id ]; $save_patient = $this->insert("xocp_his_patient",$arr_patient); $id_patient = $save_patient->insertid; return $id_patient; } } return false; } function newClaim($param) { if(!empty($this->user)) { // get last admission id for this patient $admisssion = $this->db->query("SELECT admission_id from xocp_his_patient_admission where patient_id = {$param['patient_id']} ORDER BY admission_id desc"); if($admisssion->numRows() > 0) { $admission_id = $admisssion->fetchFirst()['admission_id']+1; } else { $admission_id = 1; } // insert into xocp_his_patient_admission $arr_admission = [ 'patient_id' => $param['patient_id'], 'admission_id' => $admission_id, 'admission_dttm' => (($param['tgl_mrs'] != '') ? $param['tgl_mrs'] : date('Y-m-d H:i:s')), 'discharge' => 'home', // default home 'discharge_dttm' => (($param['tgl_krs'] != '') ? $param['tgl_krs'] : date('Y-m-d H:i:s')), 'payplan_id' => 3, // default JKN 'created_user_id' => $this->user_id, 'tariff_class' => 'kelas_3', // default kelas_3 'rs_no' => $this->rs_id, 'admission_type' => $param['admission_type'] ]; $save_admission = $this->insert("xocp_his_patient_admission",$arr_admission); $hospital_admission_id = $save_admission->insertid; return $hospital_admission_id; } return false; } function updateKlaim($param, $result_grouper = []) { if(!empty($this->user)) { // var_dump($param); $param['diagnosa'] = $param['panelitem_1011_3']; $param['procedure'] = $param['panelitem_1012_1']; $admisssion = $this->db->query("SELECT admission_id from xocp_his_patient_admission where hospital_admission_id = {$param['hospital_admission_id']}"); if($admisssion->numRows() > 0) { $admission_id = $admisssion->fetchFirst()['admission_id']; } list($attending_doctor_id,$attending_doctor_nm) = explode('|',$param['attending_doctor']); // update billing detail $get_billing = $this->db->query("SELECT * from xocp_his_billing_detail where hospital_admission_id = ".$param['hospital_admission_id']); foreach($this->column_bill as $col) { if(array_key_exists($col, $param)){ $arr_billing[$col] = $param[$col]; } else { $arr_billing[$col] = 0; } } if($get_billing->numRows() > 0) { // update billing $this->update('xocp_his_billing_detail',$arr_billing,'hospital_admission_id='.$param['hospital_admission_id']); } else { // insert billing $arr_billing['hospital_admission_id'] = $param['hospital_admission_id']; $this->insert('xocp_his_billing_detail',$arr_billing); } $bill_amount = array_sum(array_values($arr_billing)); // update xocp_his_patient_discharge_diag $val_diag = explode("|", $param['diagnosa']); $diag_no = 1; $del_diag = $this->db->query("DELETE from xocp_his_patient_discharge_diag where patient_id = {$param['patient_id']} and admission_id = $admission_id"); foreach($val_diag as $diag_cd){ // insert diagnosa $arr_diag['patient_id'] = $param['patient_id']; $arr_diag['admission_id'] = $admission_id; $arr_diag['diag_no'] = $diag_no; $arr_diag['diag_cd'] = $diag_cd; $this->insert('xocp_his_patient_discharge_diag',$arr_diag); $diag_no++; } // update xocp_his_patient_discharge_proc $val_proc = explode("|", $param['procedure']); $proc_no = 1; $del_proc = $this->db->query("DELETE from xocp_his_patient_discharge_proc where patient_id = {$param['patient_id']} and admission_id = {$admission_id}"); foreach($val_proc as $proc_cd){ // insert diagnosa $arr_proc['patient_id'] = $param['patient_id']; $arr_proc['admission_id'] = $admission_id; $arr_proc['proc_no'] = $proc_no; $arr_proc['proc_cd'] = $proc_cd; $this->insert('xocp_his_patient_discharge_proc',$arr_proc); $proc_no++; } // update his_cbg_result // inisial value special group $tariff_sp = $tariff_sr = $tariff_si = $tariff_sd = '0'; $vsp = $vsr = $vsi = $vsd = 'None'; $sp = $sr = $si = $sd = 'None'; $grouper_stage = (!empty($result_grouper)) ? 2 : 1; $kelas_rawat = preg_replace("/kelas_/", '', $param['tariff_class']); $st_result = true; if(!array_key_exists(0, $val_diag)){ $st_result = false; $cbg_code = 'X-0-98-X'; $cbg_tariff = 0; } else { $cbg_code = $result_grouper['response']['cbg']['code']; } // get rs setup $rs = $this->db->query("SELECT rs_tariff, regional FROM rs_setup where rs_no = '".$this->rs_id."'"); $rs_data = $rs->fetchFirst(); // tariff $tariff = $this->db->query("SELECT TARIFF from tariff_20230124 where INACBG = '$cbg_code' and REGIONAL = '{$rs_data['regional']}' and KODE_TARIFF = '{$rs_data['rs_tariff']}' and KELAS_RAWAT = '$kelas_rawat'"); $cbg_tariff = ($tariff->numRows() > 0) ? $tariff->fetchFirst()['TARIFF'] : 0; // patch $get_patch = $this->db->query("SELECT patch_number from xocp_patch order by patch_id desc limit 1"); $patch_number = $get_patch->fetchFirst()['patch_number']; $admission_dttm = str_replace("-","/",datetime_to_dateid($param['admission_dttm'])); $discharge_dttm = str_replace("-","/",datetime_to_dateid($param['discharge_dttm'])); $birth_dttm = str_replace("-","/",datetime_to_dateid($param['birth_dttm'])); $diagnosa = str_replace("|", ";", $param['diagnosa']); $procedure = str_replace("|", ";", $param['procedure']); /* if(!empty($result_grouper)){ // var_dump($result_grouper); $resp = $result_grouper['response']; if(!empty($resp['special_cmg'])) { foreach($resp['special_cmg'] as $special_cmg) { $query_cmg = "SELECT a.code,b.code_full,b.tariff,a.CMG_type from ina_grouper4_specialgroups_20230124 a JOIN special_cmg_tariff_20230124 b on a.code = b.CODE where a.INACBG = '$cbg_code' and b.INACBG = '$cbg_code' and b.REGIONAL = '{$rs_data['regional']}' and b.KODE_TARIFF = '{$rs_data['rs_tariff']}' and b.code_full = '{$special_cmg['code']}'"; $get_cmg = $this->db->query($query_cmg); if($get_cmg->numRows() > 0) { foreach($get_cmg->fetchAll() as $cmg){ if($cmg['CMG_Type'] == 'Special Procedure') { $sp = $cmg['code_full']; $vsp = $cmg['code']; $tariff_sp = $cmg['tariff']; } elseif($cmg['CMG_Type'] == 'Special Prosthesis') { $sr = $cmg['code_full']; $vsr = $cmg['code']; $tariff_sr = $cmg['tariff']; } elseif($cmg['CMG_Type'] == 'Special Investigation') { $si = $cmg['code_full']; $vsi = $cmg['code']; $tariff_si = $cmg['tariff']; } elseif($cmg['CMG_Type'] == 'Special Drug') { $sd = $cmg['code_full']; $vsd = $cmg['code']; $tariff_sd = $cmg['tariff']; } } } } } } */ if(array_key_exists('sp',$param) && $param['sp'] != '') { $query_cmg = "SELECT a.code,b.code_full,b.tariff,a.CMG_type from ina_grouper4_specialgroups_20230124 a JOIN special_cmg_tariff_20230124 b on a.code = b.CODE where a.INACBG = '$cbg_code' and b.INACBG = '$cbg_code' and b.REGIONAL = '{$rs_data['regional']}' and b.KODE_TARIFF = '{$rs_data['rs_tariff']}' and b.code = '{$param['sp']}' and a.CMG_Type = 'Special Procedure'"; // log_message('error',$query_cmg); $get_cmg = $this->db->query($query_cmg); if($get_cmg->numRows() > 0) { $cmg = $get_cmg->fetchFirst(); $sp = $cmg['code_full']; $vsp = $cmg['code']; $tariff_sp = $cmg['tariff']; } } if(array_key_exists('sr',$param) && $param['sr'] != '') { $query_cmg = "SELECT a.code,b.code_full,b.tariff,a.CMG_type from ina_grouper4_specialgroups_20230124 a JOIN special_cmg_tariff_20230124 b on a.code = b.CODE where a.INACBG = '$cbg_code' and b.INACBG = '$cbg_code' and b.REGIONAL = '{$rs_data['regional']}' and b.KODE_TARIFF = '{$rs_data['rs_tariff']}' and b.code = '{$param['sr']}' and a.CMG_Type = 'Special Prosthesis'"; // log_message('error',$query_cmg); $get_cmg = $this->db->query($query_cmg); if($get_cmg->numRows() > 0) { $cmg = $get_cmg->fetchFirst(); $sr = $cmg['code_full']; $vsr = $cmg['code']; $tariff_sr = $cmg['tariff']; } } if(array_key_exists('si',$param) && $param['si'] != '') { $query_cmg = "SELECT a.code,b.code_full,b.tariff,a.CMG_type from ina_grouper4_specialgroups_20230124 a JOIN special_cmg_tariff_20230124 b on a.code = b.CODE where a.INACBG = '$cbg_code' and b.INACBG = '$cbg_code' and b.REGIONAL = '{$rs_data['regional']}' and b.KODE_TARIFF = '{$rs_data['rs_tariff']}' and b.code = '{$param['si']}' and a.CMG_Type = 'Special Investigation'"; // log_message('error',$query_cmg); $get_cmg = $this->db->query($query_cmg); if($get_cmg->numRows() > 0) { $cmg = $get_cmg->fetchFirst(); $si = $cmg['code_full']; $vsi = $cmg['code']; $tariff_si = $cmg['tariff']; } } if(array_key_exists('sd',$param) && $param['sd']) { $query_cmg = "SELECT a.code,b.code_full,b.tariff,a.CMG_type from ina_grouper4_specialgroups_20230124 a JOIN special_cmg_tariff_20230124 b on a.code = b.CODE where a.INACBG = '$cbg_code' and b.INACBG = '$cbg_code' and b.REGIONAL = '{$rs_data['regional']}' and b.KODE_TARIFF = '{$rs_data['rs_tariff']}' and b.code = '{$param['sd']}' and a.CMG_Type = 'Special Drug'"; // log_message('error',$query_cmg); $get_cmg = $this->db->query($query_cmg); if($get_cmg->numRows() > 0) { $cmg = $get_cmg->fetchFirst(); $sd = $cmg['code_full']; $vsd = $cmg['code']; $tariff_sd = $cmg['tariff']; } } $arr_input_data = [1,$admission_dttm,$discharge_dttm,$birth_dttm,$param['birth_weight'],$grouper_stage,1,$diagnosa,$procedure,'-','-',$vsp,$vsr,$vsi,$vsd]; $total_tariff = $cbg_tariff + $tariff_sp + $tariff_sr + $tariff_si + $tarif_sd; $arr_response_data = [$cbg_code,'None','None',$sp,$sr,$si,$sd]; $arr_result = [ 'patient_id' => $param['patient_id'], 'admission_id' => $admission_id, 'patient_type' => 1, 'patient_class' => $kelas_rawat, 'input_data' => implode(' ', $arr_input_data), 'response_data' => implode(';', $arr_response_data), 'cbg_code' => $cbg_code, 'cbg_tariff' => $cbg_tariff, 'sub_acute' => 'None', 'tariff_sub_acute' => '0', 'chronic' => 'None', 'tariff_chronic' => '0', 'tariff_sac' => '0', 'sp' => $sp, 'tariff_sp' => $tariff_sp, 'sr' => $sr, 'tariff_sr' => $tariff_sr, 'si' => $si, 'tariff_si' => $tariff_si, 'sd' => $sd, 'tariff_sd' => $tariff_sd, 'rs_class' => 'A', 'rs_tariff' => 'AP', 'total_tariff' => $total_tariff, 'grouper_dttm' => date('Y-m-d H:i:s'), 'grouper_user_id' => $this->user_id, 'patch_number' => $patch_number ]; $get_result = $this->db->query("SELECT * from xocp_his_cbg_result where patient_id = {$param['patient_id']} and admission_id = $admission_id"); // var_dump($arr_result); if($get_result->numRows() > 0) { // update result $this->update('xocp_his_cbg_result',$arr_result,'patient_id='.$param['patient_id'].' and admission_id='.$admission_id); } else { // insert result // $this->insert('xocp_his_cbg_result',$arr_result); } // End xocp_his_cbg_result $tgl_admisi = new Datetime($param['admission_dttm']); $tgl_keluar = new Datetime($param['discharge_dttm']); $lama_rawat = ($tgl_keluar->diff($tgl_admisi)->format('%d')+1); $arr_admission = [ 'admission_type' => $param['admission_type'], 'payplan_id' => $param['payplan_id'], 'admission_dttm' => $param['admission_dttm'], 'discharge_dttm' => $param['discharge_dttm'], 'rs_tariff' => $param['rs_tariff'], 'discharge_status' => 1, 'no_kartu' => $param['no_kartu'], 'no_sep' => $param['no_sep'], 'attending_doctor_id' => $attending_doctor_id, 'attending_doctor_nm' => $attending_doctor_nm, 'tariff_class' => $param['tariff_class'], 'los' => $lama_rawat, 'adl1' => $param['adl1'], 'adl2' => $param['adl2'], 'adl2' => $param['adl2'], 'special_procedure' => (array_key_exists('sp',$param) && $param['sp'] != '') ? $param['sp'] : 'None' , 'special_prosthesis' => (array_key_exists('sr',$param) && $param['sr'] != '') ? $param['sr'] : 'None', 'special_investigation' => (array_key_exists('si',$param) && $param['si'] != '') ? $param['si'] : 'None' , 'special_drugs' => (array_key_exists('sd',$param) && $param['sd'] != '') ? $param['sd'] : 'None' , 'birth_weight' => $param['birth_weight'], 'billing_amount' => $bill_amount, 'icu_ind' => $param['icu_ind'], 'icu_los' => $param['icu_los'], 'vent_hour' => $param['vent_hour'], 'upgrade_class_ind' => $param['upgrade_class_ind'], 'upgrade_class_class' => $param['upgrade_class_class'], 'upgrade_class_los' => $param['upgrade_class_los'], 'add_payment_pct' => $param['add_payment_pct'], 'add_payment_amt' => $param['add_payment_amt'], // 'grouper_dttm' => date('Y-m-d H:i:s'), 'grouper_user_id' => $this->user_id, ]; $update_admission = $this->update('xocp_his_patient_admission',$arr_admission,'hospital_admission_id='.$param['hospital_admission_id']); if($st_result){ return $cbg_code; } else { return 'Invalid Parameters'; } } return false; } function insertBilling($param) { $arr_billingdetil = [ 'hospital_admission_id' => $param['hospital_admission_id'], 'procedure_amt' => (array_key_exists('procedure_amt', $param) ? $param['procedure_amt'] : 0), 'surgical_amt' => (array_key_exists('surgical_amt', $param) ? $param['surgical_amt'] : 0), 'consul_amt' => (array_key_exists('consul_amt', $param) ? $param['consul_amt'] : 0), 'expert_amt' => (array_key_exists('expert_amt', $param) ? $param['expert_amt'] : 0), 'nursing_amt' => (array_key_exists('nursing_amt', $param) ? $param['nursing_amt'] : 0), 'ancillary_amt' => (array_key_exists('ancillary_amt', $param) ? $param['ancillary_amt'] : 0), 'blood_amt' => (array_key_exists('blood_amt', $param) ? $param['blood_amt'] : 0), 'laboratory_amt' => (array_key_exists('laboratory_amt', $param) ? $param['laboratory_amt'] : 0), 'radiology_amt' => (array_key_exists('radiology_amt', $param) ? $param['radiology_amt'] : 0), 'rehab_amt' => (array_key_exists('rehab_amt', $param) ? $param['rehab_amt'] : 0), 'room_amt' => (array_key_exists('room_amt', $param) ? $param['room_amt'] : 0), 'intensive_amt' => (array_key_exists('intensive_amt', $param) ? $param['intensive_amt'] : 0), 'drug_amt' => (array_key_exists('drug_amt', $param) ? $param['drug_amt'] : 0), 'device_amt' => (array_key_exists('device_amt', $param) ? $param['device_amt'] : 0), 'consumable_amt' => (array_key_exists('consumable_amt', $param) ? $param['consumable_amt'] : 0), 'device_rent_amt' => (array_key_exists('device_rent_amt', $param) ? $param['device_rent_amt'] : 0), // 'consumable_capd_amt' => (array_key_exists('consumable_capd_amt', $param) ? $param['consumable_capd_amt'] : 0), // 'transfer_set_amt' => (array_key_exists('transfer_set_amt', $param) ? $param['transfer_set_amt'] : 0), // 'chronic_drug_amt' => (array_key_exists('chronic_drug_amt', $param) ? $param['chronic_drug_amt'] : 0), // 'pet_scan_amt' => (array_key_exists('pet_scan_amt', $param) ? $param['pet_scan_amt'] : 0), // 'chemo_drug_amt' => (array_key_exists('chemo_drug_amt', $param) ? $param['chemo_drug_amt'] : 0), // 'eyeglass_amt' => (array_key_exists('eyeglass_amt', $param) ? $param['eyeglass_amt'] : 0), // 'hearing_aid_amt' => (array_key_exists('hearing_aid_amt', $param) ? $param['hearing_aid_amt'] : 0), // 'prosthetic_arm_amt' => (array_key_exists('prosthetic_arm_amt', $param) ? $param['prosthetic_arm_amt'] : 0), // 'prosthetic_leg_amt' => (array_key_exists('prosthetic_leg_amt', $param) ? $param['prosthetic_leg_amt'] : 0), // 'prosthetic_teeth_amt' => (array_key_exists('prosthetic_teeth_amt', $param) ? $param['prosthetic_teeth_amt'] : 0), // 'corset_spine_amt' => (array_key_exists('corset_spine_amt', $param) ? $param['corset_spine_amt'] : 0), // 'collar_neck_amt' => (array_key_exists('collar_neck_amt', $param) ? $param['collar_neck_amt'] : 0), // 'walker_amt' => (array_key_exists('walker_amt', $param) ? $param['walker_amt'] : 0), 'drug_chronic_amt' => (array_key_exists('drug_chronic_amt', $param) ? $param['drug_chronic_amt'] : 0), 'drug_chemo_amt' => (array_key_exists('drug_chemo_amt', $param) ? $param['drug_chemo_amt'] : 0) ]; $save_billing = $this->insert('xocp_his_billing_detail',$arr_billingdetil); } function getAdmission($id) { if($id != '') { $result = $this->db->query("SELECT * from xocp_his_patient_admission where hospital_admission_id = ".$id); } return $result->fetchAll(); } function hapusKlaim($id) { if(!empty($this->user)) { // update xocp_his_patient_admission $arr_admission = [ 'status_cd' => 'nullified', 'nullified_dttm' => date('Y-m-d H:i:s'), 'nullified_user_id' => $this->user_id ]; $hapus_admission = $this->update("xocp_his_patient_admission",$arr_admission,'hospital_admission_id='.$id); return $hapus_admission; } return false; } } ?>