input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId= "'0'"; $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, T_OrderHeaderLabNumber as nolab, M_PatientNoReg as noreg, CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, (SELECT M_PatientAddressDescription from m_patientaddress AS p WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_CityName as city, CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName, group_concat(distinct T_TestName) as test , M_SexCode as sexcode, M_CompanyName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID join t_test on T_OrderDetailT_TestID = T_TestID join m_title on M_PatientM_TitleID = M_TitleID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y' left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID where T_OrderHeaderID = $orderId group by T_OrderHeaderID "; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); $data = array(); if (count($rows) > 0 ) $data = $rows[0]; echo json_encode( array( "status" => "OK", "message" => "", "rows" => $data )); } function formulir2() { $orderId = $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId= "'0'"; $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, T_OrderHeaderLabNumberExt as nolab, M_PatientNoReg as noreg, CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, (SELECT M_PatientAddressDescription from m_patientaddress AS p WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_CityName as city, CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName, group_concat(distinct T_TestName) as test , M_SexCode as sexcode, M_CompanyName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID join t_test on T_OrderDetailT_TestID = T_TestID join m_title on M_PatientM_TitleID = M_TitleID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y' left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID where T_OrderHeaderID = $orderId group by T_OrderHeaderID "; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); $data = array(); if (count($rows) > 0 ) $data = $rows[0]; echo json_encode( array( "status" => "OK", "message" => "", "rows" => $data )); } function so_group() { $orderId = $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId= "'0'"; $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, fn_lookup_external(T_OrderHeaderLabNumber,'L') as nolab, M_PatientNoReg as noreg, CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, (SELECT M_PatientAddressDescription from m_patientaddress AS p WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_CityName as city, CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName, group_concat(distinct T_TestName separator ', ') as test , M_SexCode as sexcode, M_CompanyName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID AND T_OrderDetailIsActive = 'Y' join t_test on T_OrderDetailT_TestID = T_TestID join so_resultentry on T_OrderDetailID = So_ResultEntryT_OrderDetailID join m_title on M_PatientM_TitleID = M_TitleID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y' left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID where T_OrderHeaderID = $orderId and T_TestIsResult ='y' and T_TestIsNonLab <> '' group by T_OrderHeaderID "; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); $data = array(); if (count($rows) > 0 ) $data = $rows[0]; echo json_encode( array( "status" => "OK", "message" => "", "rows" => $data )); } /* //+ "^FT5,200^A0N,23,24^FH\^FD"+ data.city+"^FS"+ "\n" //+ "^FT5,175^A0N,23,24^FH\^FD" + data.address + "^FS"+ "\n" //+ "^FT3,150^A0N,28,28^FH\^FD"+ data.title+" "+ data.patientName +"^FS"+ "\n" //+ "^BY3,3,45^FT22,70^BCN,,Y,N"+ "\n" //+ "^FD>;" + xbarcodeId + "^FS"+ "\n" //+ "^FT5,225^A0N,23,24^FH\^FD"+ data.patienttype +"^FS"+ "\n" //+ "^PQ1,0,1,Y^XZ"+ "\n" */ function so() { $orderId= $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId = "'0'"; // orderId = order detail id $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, fn_lookup_external(T_OrderHeaderLabNumber,'L') as nolab, M_PatientNoReg as noreg, CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, (SELECT M_PatientAddressDescription from m_patientaddress AS p WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_PatientAddressCity as city, CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName, T_TestName as test , M_SexCode as sex_code, M_CompanyName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join t_orderdetail on T_OrderHeaderID = T_OrderDetailT_OrderHeaderID and T_OrderHeaderID = '$orderId' AND T_OrderDetailIsActive = 'Y' join t_test on T_OrderDetailT_TestID = T_TestID join group_resultdetail ON Group_ResultDetailT_TestID = T_TestID AND Group_ResultDetailIsActive = 'Y' join group_result ON Group_ResultDetailGroup_ResultID = Group_ResultID AND Group_ResultIsActive = 'Y' AND Group_ResultID IN (4,6,7) left join m_title on M_PatientM_TitleID = M_TitleID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y' left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID AND M_PatientAddressIsActive = 'Y'"; $query = $this->db_onedev->query($sql, array($orderId)); //echo $this->db_onedev->last_query(); //echo $sql; $rows = $query->result_array(); echo json_encode( array( "status" => "OK", "message" => "", "rows" => $rows )); } function so_label() { $orderId = $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId= "'0'"; $sql = "select CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, concat(M_PatientKedudukan ,' / ',M_PatientNIK ) as nrp, M_PatientJob, M_PatientJabatan , concat(DATE_FORMAT(M_PatientDOB, '%d/%m/%Y') , ' (',TIMESTAMPDIFF(YEAR, M_PatientDOB, CURDATE()) ,' th) ', M_SexName , ', ',ifnull(M_ReligionName,'')) as tgllahir, (SELECT concat(M_PatientAddressDescription , ' ' , M_KelurahanName) from m_patientaddress AS p left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_PatientHP, concat(T_OrderHeaderLabNumber,' / ', DATE_FORMAT(T_OrderHeaderDate, '%d/%m/%Y ')) as lab, DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, fn_lookup_external(T_OrderHeaderLabNumber,'L') as nolab, M_PatientNoReg as noreg, M_CompanyName as patienttype, M_PatientPJ , M_PatientLocation , M_PatientIDNumber from t_orderheader left join m_patient on T_OrderHeaderM_PatientID = M_PatientID left join m_title on M_PatientM_TitleID = M_TitleID left join m_religion on M_PatientM_ReligionID = M_ReligionID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' where T_OrderHeaderID = $orderId group by T_OrderHeaderID "; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); $data = array(); if (count($rows) > 0 ) $data = $rows[0]; echo json_encode( array( "status" => "OK", "message" => "", "rows" => $data )); } function formulir_khusus() { $orderId = $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId= "'0'"; $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, T_OrderHeaderLabNumber as nolab, M_PatientNoReg as noreg, CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, concat(M_PatientKedudukan ,' / ',M_PatientNIK ) as nrp, M_PatientJob, M_PatientJabatan , concat( ' (',TIMESTAMPDIFF(YEAR, M_PatientDOB, CURDATE()) ,' th) ', M_SexCode ) as tgllahir, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, (SELECT M_PatientAddressDescription from m_patientaddress AS p WHERE M_PatientAddressM_PatientID = M_PatientID ORDER BY M_PatientAddressM_PatientID LIMIT 1) AS alamat, M_CityName as city, CONCAT(M_DoctorPrefix,' ',M_DoctorName,' ',M_DoctorSufix) AS M_DoctorName, group_concat(distinct T_TestName) as test , M_SexCode as sexcode, M_CompanyName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join t_orderdetail on T_OrderDetailT_OrderHeaderID = T_OrderHeaderID join t_test on T_OrderDetailT_TestID = T_TestID join m_title on M_PatientM_TitleID = M_TitleID left join m_religion on M_PatientM_ReligionID = M_ReligionID left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' left join m_mou ON T_OrderHeaderM_MouID = M_MouID AND M_MouIsActive = 'Y' left join m_doctor ON T_OrderHeaderSenderM_DoctorID = M_DoctorID AND M_DoctorIsActive = 'Y' left join m_patientaddress on M_PatientAddressM_PatientID = M_PatientID left join m_kelurahan on M_PatientAddressM_KelurahanID = M_KelurahanID left join m_district on M_KelurahanM_DistrictID = M_DistrictID left join m_city on M_DistrictM_CityID = M_CityID where T_OrderHeaderID = $orderId group by T_OrderHeaderID "; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); $data = array(); if (count($rows) > 0 ) $data = $rows[0]; echo json_encode( array( "status" => "OK", "message" => "", "rows" => $data )); } function sov1() { $this->db_onedev = $this->load->database("onedev", true); $orderId = $this->input->get("orderId"); $orderdetail_id = 0; if ($orderId == "") $orderId = "'0'"; // orderId = order detail id $a_bcodes = explode(",", $orderId); $s_bcode = ""; foreach ($a_bcodes as $b) { if ($s_bcode != "") $s_bcode .= ","; $s_bcode .= "'$b'"; $orderdetail_id = $b; } $sql = "SELECT * FROM t_orderdetail WHERE T_OrderDetailID = ? "; $query = $this->db_onedev->query($sql,array($orderdetail_id)); $dt_order_detail = $query->result_array(); $header_id = $dt_order_detail[0]['T_OrderDetailT_OrderHeaderID']; $this->fix_double_order($header_id); $sql = "select DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, T_OrderHeaderLabNumber as nolab, M_PatientNoReg as noreg, CONCAT(IF(M_TitleName IS NULL,'',CONCAT(M_TitleName,'. ')),ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, M_PatientAddress AS alamat, M_PatientAddressCity as city, '' AS M_DoctorName, T_TestName as test, M_SexCode as sex_code, M_CompanyName as patienttype,M_PatientNIP from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' join t_orderdetail on T_OrderHeaderID = T_OrderDetailT_OrderHeaderID and T_OrderDetailID IN ($s_bcode) join t_test on T_OrderDetailT_TestID = T_TestID left join m_title on M_PatientM_TitleID = M_TitleID left join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' "; $query = $this->db_onedev->query($sql); //echo $sql; $lstQry = $this->db_onedev->last_query(); $rows = $query->result_array(); foreach ($rows as $key => $value) { $oldage = explode("tahun", $value['age']); $rows[$key]['age'] = $oldage[0] . ' Tahun'; } echo json_encode(array( "status" => "OK", "message" => "", "qry" => $lstQry, "rows" => $rows )); } function fix_double_order($order_id){ $this->db_onedev = $this->load->database("onedev", true); $sql = " SELECT GROUP_CONCAT(T_OrderDetailOrderID) as unik_id, T_OrderDetailOrderT_OrderHeaderID, T_OrderDetailOrderT_TestID, T_OrderDetailOrderT_PacketID, COUNT(*) as jumlah_duplikat FROM t_orderdetailorder WHERE T_OrderDetailOrderT_OrderHeaderID = ? AND T_OrderDetailOrderIsActive = 'Y' GROUP BY T_OrderDetailOrderT_OrderHeaderID, T_OrderDetailOrderT_TestID, T_OrderDetailOrderT_PacketID HAVING COUNT(*) > 1"; $query = $this->db_onedev->query($sql,array($order_id)); //echo $this->db_onedev->last_query(); $rows = $query->result_array(); if(count($rows) == 0) return true; foreach($rows as $row){ $a_id = explode(",",$row['unik_id']); $keep_id = $a_id[0]; $delete_id = implode(",",array_slice($a_id,1)); $sql = "UPDATE t_orderdetailorder SET T_OrderDetailOrderIsActive = 'N', T_OrderDetailOrderDeleted = NOW(), T_OrderDetailOrderDeletedUserID = 51512 WHERE T_OrderDetailOrderID IN ($delete_id) "; $this->db_onedev->query($sql); $sql = "UPDATE t_orderdetail SET T_OrderDetailIsActive = 'N', T_OrderDetailDeleted = NOW(), T_OrderDetailDeletedUserID = 51512 WHERE T_OrderDetailT_OrderDetailOrderID IN ($delete_id) "; $this->db_onedev->query($sql); } return true; } function duplicateDataByOrderId($prm, $data) { // Hitung jumlah kemunculan setiap elemen dalam array prm $orderCounts = array_count_values($prm); // Array baru untuk menyimpan hasil duplikasi $result = []; // Loop melalui setiap objek di data JSON foreach ($data as $item) { $orderId = $item['T_OrderDetailID']; // Jika ada dalam orderCounts, duplikasi data sesuai jumlah kemunculan if (isset($orderCounts[$orderId])) { for ($i = 0; $i < $orderCounts[$orderId]; $i++) { $result[] = $item; // Tambahkan data ke hasil } } else { $result[] = $item; // Jika tidak ada dalam orderCounts, tambahkan satu kali } } return $result; } function sov2() { $orderId = $this->input->get("orderId"); $this->db_onedev = $this->load->database("onedev", true); if ($orderId == "") $orderId = "'0'"; // orderId = order detail id $a_bcodes = explode(",", $orderId); $s_bcode = ""; foreach ($a_bcodes as $b) { if ($s_bcode != "") $s_bcode .= ","; $s_bcode .= "'$b'"; } $sql = "SELECT T_OrderDetailID, DATE_FORMAT(T_OrderHeaderDate, '%d-%m-%Y ')as datereg, T_OrderHeaderLabNumber as nolab, M_PatientNoReg as noreg, CONCAT(IF(M_TitleName IS NULL,'',CONCAT(M_TitleName,'. ')),ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) AS M_PatientName, T_OrderHeaderM_PatientAge as age, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, M_PatientAddress AS alamat, M_PatientAddressCity as city, '' AS M_DoctorName, T_TestName as test, M_SexCode as sex_code, CorporateName as patienttype from t_orderheader join m_patient on T_OrderHeaderM_PatientID = M_PatientID join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y' join t_orderdetail on T_OrderHeaderID = T_OrderDetailT_OrderHeaderID and T_OrderDetailID IN ($s_bcode) join t_test on T_OrderDetailT_TestID = T_TestID left join m_title on M_PatientM_TitleID = M_TitleID left join corporate ON T_OrderHeaderCorporateID = CorporateID AND CorporateIsActive = 'Y' "; $query = $this->db_onedev->query($sql); // echo $sql; $lstQry = $this->db_onedev->last_query(); $rows = $query->result_array(); foreach ($rows as $key => $value) { $oldage = explode("tahun", $value['age']); $rows[$key]['age'] = $oldage[0] . ' Tahun'; } $updatedData = $this->duplicateDataByOrderId($a_bcodes, $rows); echo json_encode(array( "status" => "OK", "message" => "", "a_bcodes" => $a_bcodes, "lstQry" => $lstQry, "coba" => array_count_values($a_bcodes), "rows" => $updatedData )); } function pk() { $barcodeId = $this->input->get("barcodeId"); $this->db_onedev = $this->load->database("onedev", true); if ($barcodeId == "") $barcodeId = "'0'"; $a_bcodes = explode(",", $barcodeId); $s_bcode = ""; foreach($a_bcodes as $b) { if ($s_bcode != "") $s_bcode .= ","; $s_bcode .= "'$b'"; } $sql = "select RIGHT(T_OrderHeaderLabNumber,7 ) T_OrderHeaderLabNumber , T_OrderHeaderLabNumber Full_T_OrderHeaderLabNumber, T_SampleTypeName, left(T_BarcodeLabBarcode ,12) T_BarcodeLabBarcode , CONCAT(M_TitleName,'. ',ifnull(M_PatientPrefix,'') , ' ' ,M_PatientName,' ' , ifnull(M_PatientSuffix,'')) M_PatientName, M_PatientNoReg, T_OrderHeaderM_PatientAge, DATE_FORMAT(M_PatientDOB, '%d-%m-%Y') AS M_PatientDOB, DATE_FORMAT(T_OrderHeaderDate,'%d/%m/%Y') T_OrderHeaderDate, M_SexCode Gender, T_SampleTypeSuffix, M_CompanyName as CorporateName, IFNULL(M_PatientNIP,'-') as M_PatientNIP from t_barcodelab join t_sampletype on T_BarcodeLabT_SampleTypeID = T_SampleTypeID join t_orderheader on T_BarcodeLabT_OrderHeaderID = T_OrderHeaderID join m_patient on T_OrderHeaderM_PatientID = M_PatientID join m_sex on M_PatientM_SexID = M_SexID join m_title on M_PatientM_TitleID = M_TitleID join m_company ON T_OrderHeaderM_CompanyID = M_CompanyID AND M_CompanyIsActive = 'Y' where T_BarcodeLabBarcode in ( $s_bcode ) "; //echo $sql; $query = $this->db_onedev->query($sql); $rows = $query->result_array(); echo json_encode( array( "status" => "OK", "message" => "", "rows" => $rows )); } } ?>