Use t_orderheader_group_result + qr_printout for getstatuspergroup resultemailv7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(ssh *)"
|
||||
"Bash(ssh *)",
|
||||
"Bash(scp *)",
|
||||
"Bash(open /tmp/test_kkp.pdf)",
|
||||
"Bash(open /tmp/test_kkp_35.pdf)",
|
||||
"Bash(git fetch *)",
|
||||
"Bash(git add *)",
|
||||
"Bash(git commit -m ' *)",
|
||||
"Bash(git push *)",
|
||||
"Bash(./up *)",
|
||||
"Bash(bash --version)",
|
||||
"Bash(bash scripts/upload_ibl_committed_files.sh)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
- Name the SQL record file with the pattern `YYYY-MM-DD-<commit-message-stem>.sql`.
|
||||
- The SQL record file must include the actual SQL change that was applied, not just a note.
|
||||
- Before every `commit` and `push`, always check first whether local branch needs to pull/rebase from remote.
|
||||
- To upload to IBL, run `bash scripts/upload_ibl_committed_files.sh`. Only run this when the user explicitly asks to upload to IBL. Do not run automatically after commit/push.
|
||||
|
||||
## graphify
|
||||
|
||||
|
||||
10
CLAUDE.md
10
CLAUDE.md
@@ -8,6 +8,16 @@
|
||||
- Name the SQL record file with the pattern `YYYY-MM-DD-<commit-message-stem>.sql`.
|
||||
- The SQL record file must include the actual SQL change that was applied, not just a note.
|
||||
- Before every `commit` and `push`, always check first whether local branch needs to pull/rebase from remote.
|
||||
- To upload to IBL, run `bash scripts/upload_ibl_committed_files.sh`. Only run this when the user explicitly asks to upload to IBL. Do not run automatically after commit/push.
|
||||
|
||||
## IBL Server SSH
|
||||
|
||||
- **Host**: `10.9.20.31`
|
||||
- **User**: `one`
|
||||
- **IdentityFile**: `/Users/fajrihardhitamurti/id_rsa`
|
||||
- **Remote path**: `/home/one/project/one/one-api-lab/`
|
||||
- SSH command: `ssh -i /Users/fajrihardhitamurti/id_rsa -o BatchMode=yes -o StrictHostKeyChecking=accept-new one@10.9.20.31`
|
||||
- BIRT reports path: `/home/one/project/birt/onelab/reports/`
|
||||
|
||||
## graphify
|
||||
|
||||
|
||||
@@ -1181,169 +1181,28 @@ function getstatuspergroup()
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Query 2: Ambil info_test dengan 3 UNION
|
||||
//
|
||||
// BAGIAN 1 : Group LAB biasa → FlagNonLab='N', FlagPerTest='N'
|
||||
// Status dari result_processtooffice
|
||||
// Filter T_TestIsResult='Y' tetap berlaku
|
||||
//
|
||||
// BAGIAN 2 : Group LAB per-test → FlagPerTest='Y'
|
||||
// Status dari result_processtooffice per T_TestID
|
||||
// Filter T_TestIsResult='Y' tetap berlaku
|
||||
//
|
||||
// BAGIAN 3 : Group NonLab (FIX!) → FlagNonLab='Y', FlagPerTest='N'
|
||||
// Contoh: Rontgen, Pemeriksaan Fisik
|
||||
// Tidak pakai filter T_TestIsResult='Y' karena hasil
|
||||
// dari sistem eksternal (BIRT/upload manual)
|
||||
// Status dari t_email_nonlab (ada record = 'Y')
|
||||
// Query 2: Ambil info_test dari t_orderheader_group_result
|
||||
// Status = 'ready' jika sudah ada di qr_printout (IsActive='Y')
|
||||
// ============================================================
|
||||
$sql = "
|
||||
-- -------------------------------------------------------
|
||||
-- BAGIAN 1: Group LAB biasa (FlagNonLab='N', FlagPerTest='N')
|
||||
-- -------------------------------------------------------
|
||||
SELECT T_OrderHeaderID,
|
||||
T_OrderPromiseID,
|
||||
T_OrderPromiseDateTime,
|
||||
T_OrderHeaderLabNumber,
|
||||
UPPER(Group_ResultName) as group_name,
|
||||
IF(ISNULL(Result_ProcessToOfficeID),'N','Y') as status,
|
||||
'default-format' as format_email
|
||||
FROM t_orderdetail
|
||||
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
|
||||
JOIN t_orderdelivery ON T_OrderDeliveryT_OrderHeaderID = T_OrderHeaderID
|
||||
AND T_OrderDeliveryM_DeliveryTypeID = 3
|
||||
AND T_OrderDeliveryIsActive = 'Y'
|
||||
JOIN t_orderpromise ON T_OrderDetailT_OrderPromiseID = T_OrderPromiseID
|
||||
AND T_OrderPromiseIsActive = 'Y'
|
||||
JOIN t_test ON T_OrderDetailT_TestID = T_TestID
|
||||
AND T_TestIsResult = 'Y'
|
||||
JOIN group_resultdetail ON Group_ResultDetailT_TestID = T_OrderDetailT_TestID
|
||||
AND Group_ResultDetailIsActive = 'Y'
|
||||
JOIN group_result ON Group_ResultDetailGroup_ResultID = Group_ResultID
|
||||
AND Group_ResultFlagPerTest = 'N'
|
||||
AND Group_ResultFlagNonLab = 'N'
|
||||
LEFT JOIN result_processtooffice ON Result_ProcessToOfficeT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
|
||||
AND Result_ProcessToOfficeT_OrderDeliveryID = T_OrderDeliveryID
|
||||
AND Result_ProcessToOfficeT_OrderPromiseID = T_OrderPromiseID
|
||||
AND Result_ProcessToOfficeGroup_ResultID = Group_ResultID
|
||||
AND Result_ProcessToOfficeStatus = 'S'
|
||||
WHERE
|
||||
T_OrderHeaderID = {$prm['order_id']} AND
|
||||
DATE(T_OrderPromiseDateTime) = '{$prm['order_promise_date']}' AND
|
||||
T_OrderDetailIsActive = 'Y'
|
||||
GROUP BY Group_ResultID
|
||||
|
||||
UNION
|
||||
|
||||
-- -------------------------------------------------------
|
||||
-- BAGIAN 2: Group LAB per-test (FlagPerTest='Y')
|
||||
-- -------------------------------------------------------
|
||||
SELECT T_OrderHeaderID,
|
||||
T_OrderPromiseID,
|
||||
T_OrderPromiseDateTime,
|
||||
T_OrderHeaderLabNumber,
|
||||
UPPER(T_TestName) as group_name,
|
||||
IF(ISNULL(Result_ProcessToOfficeID),'N','Y') as status,
|
||||
'default-format' as format_email
|
||||
FROM t_orderdetail
|
||||
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
|
||||
JOIN t_orderdelivery ON T_OrderDeliveryT_OrderHeaderID = T_OrderHeaderID
|
||||
AND T_OrderDeliveryM_DeliveryTypeID = 3
|
||||
AND T_OrderDeliveryIsActive = 'Y'
|
||||
JOIN t_orderpromise ON T_OrderDetailT_OrderPromiseID = T_OrderPromiseID
|
||||
AND T_OrderPromiseIsActive = 'Y'
|
||||
JOIN t_test ON T_OrderDetailT_TestID = T_TestID
|
||||
AND T_TestIsResult = 'Y'
|
||||
JOIN group_resultdetail ON Group_ResultDetailT_TestID = T_OrderDetailT_TestID
|
||||
AND Group_ResultDetailIsActive = 'Y'
|
||||
LEFT JOIN so_resultentry ON So_ResultEntryT_OrderDetailID = T_OrderDetailID
|
||||
AND So_ResultEntryIsActive = 'Y'
|
||||
JOIN group_result ON Group_ResultDetailGroup_ResultID = Group_ResultID
|
||||
AND Group_ResultFlagPerTest = 'Y'
|
||||
LEFT JOIN result_processtooffice ON Result_ProcessToOfficeT_OrderHeaderID = T_OrderDetailT_OrderHeaderID
|
||||
AND Result_ProcessToOfficeT_OrderDeliveryID = T_OrderDeliveryID
|
||||
AND Result_ProcessToOfficeT_OrderPromiseID = T_OrderPromiseID
|
||||
AND Result_ProcessToOfficeGroup_ResultID = T_TestID
|
||||
AND Result_ProcessToOfficeStatus = 'S'
|
||||
WHERE
|
||||
T_OrderHeaderID = {$prm['order_id']} AND
|
||||
DATE(T_OrderPromiseDateTime) = '{$prm['order_promise_date']}' AND
|
||||
T_OrderDetailIsActive = 'Y'
|
||||
GROUP BY T_TestID
|
||||
|
||||
UNION
|
||||
|
||||
-- -------------------------------------------------------
|
||||
-- BAGIAN 3 (FIX FINAL): Group NonLab (FlagNonLab='Y', FlagPerTest='N')
|
||||
-- Rontgen, Pemeriksaan Fisik, ECG, dll
|
||||
-- So_ResultEntryID > 0 = hasil eksternal (bukan LAB/FNA biasa)
|
||||
-- -------------------------------------------------------
|
||||
SELECT
|
||||
oh.T_OrderHeaderID,
|
||||
op.T_OrderPromiseID,
|
||||
op.T_OrderPromiseDateTime,
|
||||
oh.T_OrderHeaderLabNumber,
|
||||
UPPER(nl.T_EmailNonLabGroup_ResultName) as group_name,
|
||||
IF(ISNULL(nl.T_EmailNonLabID),'N','Y') as status,
|
||||
IFNULL(nl.T_EmailNonLabUrl,'') as format_email
|
||||
FROM group_result gr
|
||||
INNER JOIN t_email_nonlab nl ON nl.T_EmailNonLabType = gr.Group_ResultName
|
||||
AND nl.T_EmailNonLabT_OrderHeaderID = {$prm['order_id']}
|
||||
AND nl.T_EmailNonLabSo_ResultEntryID > 0
|
||||
JOIN t_orderheader oh ON oh.T_OrderHeaderID = {$prm['order_id']}
|
||||
JOIN t_orderpromise op ON op.T_OrderPromiseT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND DATE(op.T_OrderPromiseDateTime) = '{$prm['order_promise_date']}'
|
||||
AND op.T_OrderPromiseIsActive = 'Y'
|
||||
JOIN t_orderdelivery od ON od.T_OrderDeliveryT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND od.T_OrderDeliveryM_DeliveryTypeID = 3
|
||||
AND od.T_OrderDeliveryIsActive = 'Y'
|
||||
WHERE gr.Group_ResultFlagPerTest = 'N'
|
||||
AND gr.Group_ResultFlagNonLab = 'Y'
|
||||
AND gr.Group_ResultIsActive = 'Y'
|
||||
GROUP BY gr.Group_ResultID
|
||||
|
||||
UNION
|
||||
|
||||
-- -------------------------------------------------------
|
||||
-- BAGIAN 4 (FIX): Group NonLab FlagPerTest='Y'
|
||||
-- Contoh: ECG/Elektromedik, BMD, USG, dll
|
||||
-- -------------------------------------------------------
|
||||
SELECT
|
||||
oh.T_OrderHeaderID,
|
||||
op.T_OrderPromiseID,
|
||||
op.T_OrderPromiseDateTime,
|
||||
oh.T_OrderHeaderLabNumber,
|
||||
UPPER(nl.T_EmailNonLabGroup_ResultName) as group_name,
|
||||
IF(ISNULL(nl.T_EmailNonLabID),'N','Y') as status,
|
||||
IFNULL(nl.T_EmailNonLabUrl,'') as format_email
|
||||
FROM group_result gr
|
||||
INNER JOIN t_email_nonlab nl ON nl.T_EmailNonLabType = gr.Group_ResultName
|
||||
AND nl.T_EmailNonLabT_OrderHeaderID = {$prm['order_id']}
|
||||
AND nl.T_EmailNonLabSo_ResultEntryID > 0
|
||||
JOIN t_orderheader oh ON oh.T_OrderHeaderID = {$prm['order_id']}
|
||||
JOIN t_orderpromise op ON op.T_OrderPromiseT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND DATE(op.T_OrderPromiseDateTime) = '{$prm['order_promise_date']}'
|
||||
AND op.T_OrderPromiseIsActive = 'Y'
|
||||
JOIN t_orderdelivery od ON od.T_OrderDeliveryT_OrderHeaderID = oh.T_OrderHeaderID
|
||||
AND od.T_OrderDeliveryM_DeliveryTypeID = 3
|
||||
AND od.T_OrderDeliveryIsActive = 'Y'
|
||||
WHERE gr.Group_ResultFlagPerTest = 'Y'
|
||||
AND gr.Group_ResultFlagNonLab = 'Y'
|
||||
AND gr.Group_ResultIsActive = 'Y'
|
||||
GROUP BY gr.Group_ResultID
|
||||
togr.T_OrderHeaderGroupResultT_OrderHeaderID AS T_OrderHeaderID,
|
||||
togr.T_OrderHeaderGroupResultGroup_ResultID AS Group_ResultID,
|
||||
togr.T_OrderHeaderGroupResultT_TestID AS T_TestID,
|
||||
togr.T_OrderHeaderGroupResultGroup_ResultName AS group_name,
|
||||
IF(ISNULL(qr.QR_PrintOutID), 'not_ready', 'ready') AS status
|
||||
FROM t_orderheader_group_result togr
|
||||
LEFT JOIN qr_printout qr
|
||||
ON qr.QR_PrintOutT_OrderHeaderID = togr.T_OrderHeaderGroupResultT_OrderHeaderID
|
||||
AND qr.QR_PrintOutGroup_ResultID = togr.T_OrderHeaderGroupResultGroup_ResultID
|
||||
AND qr.QR_PrintOutT_TestID = togr.T_OrderHeaderGroupResultT_TestID
|
||||
AND qr.QR_PrintOutIsActive = 'Y'
|
||||
WHERE
|
||||
togr.T_OrderHeaderGroupResultT_OrderHeaderID = {$prm['order_id']}
|
||||
AND togr.T_OrderHeaderGroupResultIsActive = 'Y'
|
||||
";
|
||||
$rows['info_test'] = $this->db_onedev->query($sql)->result_array();
|
||||
|
||||
// Tambahkan pengecekan status URL nonlab per pemeriksaan
|
||||
if (!empty($rows['info_test'])) {
|
||||
foreach ($rows['info_test'] as $k => $v) {
|
||||
$rows['info_test'][$k]['status_url_nonlab'] = $this->_check_email_nonlab_exists(
|
||||
$prm['order_id'],
|
||||
$v['group_name']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$rows['summary_nonlab'] = $this->get_count_url_nonlab(true);
|
||||
|
||||
// ============================================================
|
||||
|
||||
BIN
assets/images/logo-kan.png
Normal file
BIN
assets/images/logo-kan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
Reference in New Issue
Block a user