FHM09062601IBL - list_patient: decrypt patient_name dari _enc untuk tampilan asli

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-06-12 10:15:10 +07:00
parent d57bbaec38
commit 1b8e00b57e

View File

@@ -1806,34 +1806,38 @@ class Anamnesedoctor extends MY_Controller
$status = $prm['status'];
$sql = "SELECT 'N' divider,
CONCAT(M_TitleName,' ',IF(ISNULL(M_PatientPrefix),'',CONCAT(M_PatientPrefix,' ')),M_PatientName,IF(ISNULL(M_PatientSuffix),'',CONCAT(M_PatientSuffix,' '))) as patient_name,
`order`.*,DATE_FORMAT(orderDate,'%d-%m-%Y') as date_order,
'' as kode_status, '' as status
`order`.*,
DATE_FORMAT(orderDate,'%d-%m-%Y') as date_order,
'' as kode_status, '' as status,
M_PatientName as patient_name_masked,
M_PatientName_enc as patient_name_enc,
M_PatientPrefix,
M_PatientSuffix,
M_TitleName
FROM one_klinik.`order`
JOIN m_patient ON orderM_PatientID = M_PatientID
JOIN m_title ON M_PatientM_TitleID = M_TitleID
LEFT JOIN s_menu ON ( S_MenuUrl LIKE CONCAT('%test/vuex/one-klinik-fo-registration-v') OR S_MenuName = 'Periksa dokter')
WHERE
orderIsActive = 'Y' AND DATE(orderDate) = ? AND orderIsScreening = 'D' AND orderIsCheck = ?
WHERE
orderIsActive = 'Y' AND DATE(orderDate) = ? AND orderIsScreening = 'D' AND orderIsCheck = ?
LIMIT $number_limit offset $number_offset";
//echo $sql;
$query = $this->db_oneklinik->query($sql, array($xdate, $status));
//echo $this->db_oneklinik->last_query();
if ($query) {
$rows = $query->result_array();
foreach ($rows as $key => $value) {
$sql = "SELECT
FROM one_klinik.order_status
WHERE
orderStatusOrderID = ?
ORDER BY ";
}
$enc = $this->ibl_encryptor;
$rows = array_map(function($row) use ($enc) {
$name = $enc->decrypt($row['patient_name_enc'] ?? '') ?: $row['patient_name_masked'];
$prefix = $row['M_PatientPrefix'] ? $row['M_PatientPrefix'] . ' ' : '';
$suffix = $row['M_PatientSuffix'] ? ' ' . $row['M_PatientSuffix'] : '';
$title = $row['M_TitleName'] ? $row['M_TitleName'] . ' ' : '';
$row['patient_name'] = trim($title . $prefix . $name . $suffix);
unset($row['patient_name_masked'], $row['patient_name_enc']);
return $row;
}, $query->result_array());
$result = array("total" => $tot_page, "records" => $rows, "sql" => $this->db_onedev->last_query());
$result = array("total" => count($rows), "records" => $rows);
$this->sys_ok($result);
} else {
$this->sys_error_db("m_patient rows", $this->db_onedev);
$this->sys_error_db("list_patient", $this->db_oneklinik);
exit;
}
}