diff --git a/application/controllers/klinik/Ttv.php b/application/controllers/klinik/Ttv.php index c0430979..a9cff802 100644 --- a/application/controllers/klinik/Ttv.php +++ b/application/controllers/klinik/Ttv.php @@ -62,30 +62,31 @@ class Ttv extends MY_Controller $where_sql = implode(' AND ', $where); $sql = "SELECT - o.orderID, - o.orderIsTTV, - o.orderDate, - DATE_FORMAT(o.orderDate, '%d-%m-%Y') AS order_date, - o.orderAge AS patient_age, - o.orderM_ClinicUnitID, - p.M_PatientID, - p.M_PatientNoReg, + 'N' AS divider, + p.M_PatientName, p.M_PatientName_enc, + p.M_PatientHP, p.M_PatientHP_enc, + p.M_PatientDOB, p.M_PatientDOB_enc, + p.M_PatientEmail, p.M_PatientEmail_enc, + p.M_PatientPhone, p.M_PatientPhone_enc, + p.M_PatientPOB, p.M_PatientPOB_enc, + p.M_PatientIDNumber, p.M_PatientIDNumber_enc, + p.M_PatientNIK, p.M_PatientNIK_enc, p.M_PatientPhoto, p.M_PatientPhotoThumb, + p.M_PatientNoReg, p.M_PatientJob, p.M_PatientM_SexID, p.M_PatientM_TitleID, p.M_PatientM_IdTypeID, - p.M_PatientName, p.M_PatientName_enc, - p.M_PatientDOB, p.M_PatientDOB_enc, - p.M_PatientHP, p.M_PatientHP_enc, - p.M_PatientIDNumber, p.M_PatientIDNumber_enc, + o.*, + DATE_FORMAT(o.orderDate, '%d-%m-%Y') AS date_order, + '' AS kode_status, s.M_SexName, t.M_TitleName FROM one_klinik.`order` o - JOIN m_patient p ON p.M_PatientID = o.orderM_PatientID AND p.M_PatientIsActive = 'Y' - JOIN m_sex s ON s.M_SexID = p.M_PatientM_SexID - JOIN m_title t ON t.M_TitleID = p.M_PatientM_TitleID + JOIN m_patient p ON p.M_PatientID = o.orderM_PatientID AND p.M_PatientIsActive = 'Y' + JOIN m_sex s ON s.M_SexID = p.M_PatientM_SexID + JOIN m_title t ON t.M_TitleID = p.M_PatientM_TitleID WHERE $where_sql ORDER BY o.orderDate ASC LIMIT $limit OFFSET $offset"; @@ -101,9 +102,14 @@ class Ttv extends MY_Controller foreach ($rows as $k => $v) { $rows[$k]['M_PatientName'] = $enc->decrypt($v['M_PatientName_enc'] ?? '') ?: $v['M_PatientName']; - $rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc'] ?? '') ?: $v['M_PatientDOB']; $rows[$k]['M_PatientHP'] = $enc->decrypt($v['M_PatientHP_enc'] ?? '') ?: $v['M_PatientHP']; + $rows[$k]['M_PatientDOB'] = $enc->decrypt($v['M_PatientDOB_enc'] ?? '') ?: $v['M_PatientDOB']; + $rows[$k]['M_PatientEmail'] = $enc->decrypt($v['M_PatientEmail_enc'] ?? '') ?: $v['M_PatientEmail']; + $rows[$k]['M_PatientPhone'] = $enc->decrypt($v['M_PatientPhone_enc'] ?? '') ?: $v['M_PatientPhone']; + $rows[$k]['M_PatientPOB'] = $enc->decrypt($v['M_PatientPOB_enc'] ?? '') ?: $v['M_PatientPOB']; $rows[$k]['M_PatientIDNumber'] = $enc->decrypt($v['M_PatientIDNumber_enc'] ?? '') ?: $v['M_PatientIDNumber']; + $rows[$k]['M_PatientNIK'] = $enc->decrypt($v['M_PatientNIK_enc'] ?? '') ?: $v['M_PatientNIK']; + $rows[$k]['patient_name'] = trim(($v['M_TitleName'] ?? '') . ' ' . $rows[$k]['M_PatientName']); foreach (array_keys($rows[$k]) as $col) { if (substr($col, -4) === '_enc') unset($rows[$k][$col]);