From 01994365d497a0a6d9e73f9b9632b2d9be0c1c51 Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Wed, 10 Jun 2026 09:55:17 +0700 Subject: [PATCH] FHM09062601IBL - samplingcall: tambah UNION klinik order dari one_klinik.order Co-Authored-By: Claude Sonnet 4.6 --- .../mockup/doctorclinicv2/Samplingcall.php | 83 ++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/application/controllers/mockup/doctorclinicv2/Samplingcall.php b/application/controllers/mockup/doctorclinicv2/Samplingcall.php index 78082d80..f11a4a6b 100644 --- a/application/controllers/mockup/doctorclinicv2/Samplingcall.php +++ b/application/controllers/mockup/doctorclinicv2/Samplingcall.php @@ -298,7 +298,88 @@ INSERT INTO `t_samplestation` (`T_SampleStationID`, `T_SampleStationCode`, `T_Sa GROUP BY T_OrderHeaderID HAVING last_status_fo IN (3,5) - + UNION + + SELECT + orderID AS T_OrderHeaderID, + T_OrderHeaderDate, + orderNumber AS T_OrderHeaderLabNumber, + T_OrderHeaderLabNumberExt, + orderQueueNumber AS T_OrderHeaderQueue, + T_OrderHeaderM_PatientID, + T_OrderHeaderM_CompanyID, + T_OrderHeaderM_MouID, + orderAge AS T_OrderHeaderM_PatientAge, + T_OrderHeaderSenderM_DoctorID, + T_OrderHeaderSenderM_DoctorAddressID, + T_OrderHeaderPjM_DoctorID, + T_OrderHeaderM_LangID, + T_OrderHeaderLangIsSI, + 'N' AS T_OrderHeaderIsCito, + T_OrderHeaderNat_CitoID, + T_OrderHeaderDiagnose, + T_OrderHeaderDoctorNote, + T_OrderHeaderVerificationNote, + T_OrderHeaderVerificationNoteM_UserID, + T_OrderHeaderFoNote, + T_OrderHeaderSamplingNote, + T_OrderHeaderResultNote, + T_OrderHeaderFoNoteM_UserID, + T_OrderHeaderSamplingNoteM_UserID, + T_OrderHeaderResultNoteM_UserID, + T_OrderHeaderReceivedSample, + T_OrderHeaderSubTotal, + T_OrderHeaderRounding, + T_OrderHeaderTotal, + T_OrderHeaderCreated, + T_OrderHeaderLastUpdated, + T_OrderHeaderCreatedUserID, + T_OrderHeaderIsActive, + m_patient.*, + M_SexName, + M_TitleName, + CONCAT(M_TitleName,' ',M_PatientName) as patient_fullname, + '' AS M_CompanyName, + fn_sampling_clinic_queue_status_name(orderID, M_LocationT_SampleStationID) as status, + + fn_sampling_clinic_queue_status_id(orderID, M_LocationT_SampleStationID) as statusid, + M_LocationT_SampleStationID AS T_SampleStationID, + '' AS T_SampleTypeID, + M_LocationT_SampleStationID as stationid, + NULL AS T_OrderPromiseDateTime, + 'N' as iscito, + 3 as last_status_fo, + DATE_FORMAT(orderDate,'%d-%m-%Y %H:%i') as order_date, + IFNULL(T_OrderHeaderFoNote,'') as fo_note, + IFNULL(T_OrderHeaderVerificationNote,'') as fo_ver_note, + fn_sampling_reqs(T_OrderHeaderID) as fo_requirements, + '' as htmlforeqs, + IF(fn_fo_ver_have_reqs(T_OrderHeaderID) = 0,'Y','N') as fo_ver_status_req, + fn_fo_reg_have_reqs(T_OrderHeaderID) as fo_reg_status_req, + fn_sampling_reqs_status(T_OrderHeaderID) as fo_requirements_status, + IF(fn_fo_get_verification_status(T_OrderHeaderID) = 0, 'X','Y') as fo_verification_status, + IFNULL(T_OrderHeaderSamplingNote,'') as sampling_note, + 'N' as status_coming, + orderM_LocationID as order_location_id, + IFNULL(AntrianSampleStationTime, orderDate) as antri_time, + IFNULL(AntrianSampleStationTime, orderDate) as skip_time, + 'Y' AS is_clinic, + '' as flag_antrian + FROM one_klinik.order + JOIN m_patient + ON orderM_PatientID = M_PatientID + AND M_PatientIsActive = 'Y' + JOIN m_title ON M_PatientM_TitleID = M_TitleID + JOIN m_sex ON M_PatientM_SexID = M_SexID + JOIN m_location ON orderM_LocationID = M_LocationID AND M_LocationID = {$locationID} + LEFT JOIN t_orderheader + ON orderT_OrderHeaderID = T_OrderHeaderID + AND T_OrderHeaderIsActive = 'Y' + LEFT JOIN antrian_samplestation + ON orderID = AntrianSampleStationOrderID AND AntrianSampleStationIsActive = 'Y' + $sql_where_klinik + HAVING last_status_fo IN (3,5) + ) x ORDER BY T_OrderHeaderIsCito DESC, antri_time ASC ";