FHM09062601IBL - petugas penyuntik: autocomplete dari m_staff, ganti kolom ke M_StaffID

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-06-11 14:54:06 +07:00
parent 77a595eba4
commit 11860743b8
2 changed files with 32 additions and 21 deletions

View File

@@ -3119,7 +3119,7 @@ function get_data_order_anamnesis($orderID){
// ─── Vaksin ──────────────────────────────────────────────────────────────── // ─── Vaksin ────────────────────────────────────────────────────────────────
// Master statis: injection_sites, routes, petugas (dipanggil sekali saat form dibuka) // Master statis: injection_sites, routes (dipanggil sekali saat form dibuka)
function get_vaccine_masters() function get_vaccine_masters()
{ {
if (!$this->isLogin) { $this->sys_error("Invalid Token"); exit; } if (!$this->isLogin) { $this->sys_error("Invalid Token"); exit; }
@@ -3144,24 +3144,32 @@ function get_data_order_anamnesis($orderID){
if (!$q) { $this->sys_error_db("get m_route_vaccine", $this->db_oneklinik); exit; } if (!$q) { $this->sys_error_db("get m_route_vaccine", $this->db_oneklinik); exit; }
$result['routes'] = $q->result_array(); $result['routes'] = $q->result_array();
// Petugas penyuntik
$q = $this->db_onedev->query(
"SELECT M_DoctorID as id,
CONCAT(IFNULL(M_DoctorPrefix,''), IFNULL(M_DoctorPrefix2,''), ' ',
M_DoctorName, ' ',
IFNULL(M_DoctorSufix,''), IFNULL(M_DoctorSufix2,''), IFNULL(M_DoctorSufix3,'')) as name
FROM m_doctormcu
JOIN m_doctor ON M_DoctorMcuM_DoctorID = M_DoctorID
WHERE M_DoctorMcuIsActive = 'Y'
ORDER BY M_DoctorName"
);
if (!$q) { $this->sys_error_db("get doctors", $this->db_onedev); exit; }
$result['petugas'] = $q->result_array();
$this->sys_ok($result); $this->sys_ok($result);
exit; exit;
} }
// Autocomplete petugas penyuntik dari one_lab.m_staff, param: search
function get_vaccine_petugas()
{
if (!$this->isLogin) { $this->sys_error("Invalid Token"); exit; }
$search = trim($this->sys_input['search'] ?? '');
$search_esc = $this->db_onedev->escape_str($search);
$sql = "SELECT M_StaffID as id, M_StaffName as name, M_StaffCode as code
FROM one_lab.m_staff
WHERE M_StaffIsActive = 'Y'
AND M_StaffName LIKE CONCAT('%', '{$search_esc}', '%')
ORDER BY M_StaffName
LIMIT 30";
$q = $this->db_onedev->query($sql);
if (!$q) { $this->sys_error_db("get m_staff", $this->db_onedev); exit; }
$this->sys_ok(['records' => $q->result_array()]);
exit;
}
// Autocomplete jenis vaksin: filter by MOU order, param: orderid + search // Autocomplete jenis vaksin: filter by MOU order, param: orderid + search
function get_vaccines() function get_vaccines()
{ {
@@ -3220,16 +3228,14 @@ function get_data_order_anamnesis($orderID){
t.T_TestSasCode as jenis_vaksin_code, t.T_TestSasCode as jenis_vaksin_code,
ins.M_InjectionSiteName as injection_site_name, ins.M_InjectionSiteName as injection_site_name,
rv.M_RouteVaccineName as route_name, rv.M_RouteVaccineName as route_name,
CONCAT(IFNULL(d.M_DoctorPrefix,''), IFNULL(d.M_DoctorPrefix2,''), ' ', s.M_StaffName as petugas_name
d.M_DoctorName, ' ',
IFNULL(d.M_DoctorSufix,''), IFNULL(d.M_DoctorSufix2,''), IFNULL(d.M_DoctorSufix3,'')) as petugas_name
FROM one_klinik.order_vaccine ov FROM one_klinik.order_vaccine ov
LEFT JOIN one_lab.t_test t ON ov.orderVaccineT_TestID = t.T_TestID LEFT JOIN one_lab.t_test t ON ov.orderVaccineT_TestID = t.T_TestID
LEFT JOIN one_klinik.m_injection_site ins LEFT JOIN one_klinik.m_injection_site ins
ON ov.orderVaccineInjectionSiteCode = ins.M_InjectionSiteCode ON ov.orderVaccineInjectionSiteCode = ins.M_InjectionSiteCode
LEFT JOIN one_klinik.m_route_vaccine rv LEFT JOIN one_klinik.m_route_vaccine rv
ON ov.orderVaccineRouteCode = rv.M_RouteVaccineCode ON ov.orderVaccineRouteCode = rv.M_RouteVaccineCode
LEFT JOIN m_doctor d ON ov.orderVaccinePetugasM_DoctorID = d.M_DoctorID LEFT JOIN one_lab.m_staff s ON ov.orderVaccinePetugasM_StaffID = s.M_StaffID
WHERE ov.orderVaccineOrderID = ? WHERE ov.orderVaccineOrderID = ?
AND ov.orderVaccineIsActive = 'Y' AND ov.orderVaccineIsActive = 'Y'
ORDER BY ov.orderVaccineCreated ASC"; ORDER BY ov.orderVaccineCreated ASC";
@@ -3280,7 +3286,7 @@ function get_data_order_anamnesis($orderID){
orderVaccineDosis = ?, orderVaccineDosis = ?,
orderVaccineInjectionSiteCode = ?, orderVaccineInjectionSiteCode = ?,
orderVaccineRouteCode = ?, orderVaccineRouteCode = ?,
orderVaccinePetugasM_DoctorID = ?, orderVaccinePetugasM_StaffID = ?,
orderVaccineGivenAt = ?, orderVaccineGivenAt = ?,
orderVaccineNextDate = ?, orderVaccineNextDate = ?,
orderVaccineCatatan = ?, orderVaccineCatatan = ?,
@@ -3298,7 +3304,7 @@ function get_data_order_anamnesis($orderID){
"INSERT INTO one_klinik.order_vaccine "INSERT INTO one_klinik.order_vaccine
(orderVaccineOrderID, orderVaccineT_TestID, orderVaccineBatchNumber, (orderVaccineOrderID, orderVaccineT_TestID, orderVaccineBatchNumber,
orderVaccineExpiredDate, orderVaccineDosis, orderVaccineInjectionSiteCode, orderVaccineExpiredDate, orderVaccineDosis, orderVaccineInjectionSiteCode,
orderVaccineRouteCode, orderVaccinePetugasM_DoctorID, orderVaccineGivenAt, orderVaccineRouteCode, orderVaccinePetugasM_StaffID, orderVaccineGivenAt,
orderVaccineNextDate, orderVaccineCatatan, orderVaccineUserID) orderVaccineNextDate, orderVaccineCatatan, orderVaccineUserID)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
[ [

View File

@@ -0,0 +1,5 @@
-- Ganti kolom petugas penyuntik dari M_DoctorID ke M_StaffID (one_lab.m_staff)
ALTER TABLE one_klinik.order_vaccine
CHANGE COLUMN `orderVaccinePetugasM_DoctorID`
`orderVaccinePetugasM_StaffID` int(11) DEFAULT NULL
COMMENT 'petugas penyuntik FK one_lab.m_staff.M_StaffID';