Existing store procedure untuk get graph, body, data table
This commit is contained in:
48
sp_exe_sum_graph.txt
Normal file
48
sp_exe_sum_graph.txt
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
BEGIN
|
||||||
|
|
||||||
|
IF CODE = 'A06' THEN
|
||||||
|
-- PESERTA
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu001/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A09' THEN
|
||||||
|
-- KELOMPOK UMUR
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu002/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A26' THEN
|
||||||
|
-- KELUHAN PESERTA
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu003/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A27' THEN
|
||||||
|
-- RIWAYAT PENYAKIT
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu004/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A28' THEN
|
||||||
|
-- POLA KEBIASAAN (ON FIXING)
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu005/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A30A' THEN
|
||||||
|
-- BMI
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu006/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A30B' THEN
|
||||||
|
-- BMI SITE
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu007/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A34' THEN
|
||||||
|
-- POLA KELAINAN
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu008/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A36A' THEN
|
||||||
|
-- METABOLISME SITE
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu009/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A36B' THEN
|
||||||
|
-- METABOLISME GENDER
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu010/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A37A' THEN
|
||||||
|
-- HIPERTENSI SITE
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu011/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A37B' THEN
|
||||||
|
-- HIPERTENSI GENDER
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu012/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A38A' THEN
|
||||||
|
-- REFRAKSI SITE
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu013/',PID ) as Graph;
|
||||||
|
ELSEIF CODE = 'A38B' THEN
|
||||||
|
-- REFRAKSI GENDER
|
||||||
|
SELECT CONCAT ('http://localhost/one-api/tools/mcu_chart_v2/mcu014/',PID ) as Graph;
|
||||||
|
SELECT '' as Graph;
|
||||||
|
end IF;
|
||||||
|
|
||||||
|
END
|
||||||
10
sp_exe_sum_tpl_01_V1.txt
Normal file
10
sp_exe_sum_tpl_01_V1.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
BEGIN
|
||||||
|
|
||||||
|
|
||||||
|
SELECT exeSumTplTitle as judul, exeSumTplSubTitleTitle as subjudul, exeSumTplSubBody as body
|
||||||
|
FROM exe_sum_tpl
|
||||||
|
WHERE exeSumTplCode= CODE
|
||||||
|
AND exeSumTplMgm_McuID = MMID;
|
||||||
|
|
||||||
|
|
||||||
|
END
|
||||||
18
sp_exe_sum_tpl_01_V2(ONPROGRESS).txt
Normal file
18
sp_exe_sum_tpl_01_V2(ONPROGRESS).txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
BEGIN
|
||||||
|
|
||||||
|
SELECT exeSumTplTitle , exeSumTplSubTitleTitle , exeSumTplSubBody into @judul, @subjudul, @body
|
||||||
|
FROM exe_sum_tpl
|
||||||
|
WHERE exeSumTplCode= CODE
|
||||||
|
AND exeSumTplMgm_McuID = MMID
|
||||||
|
AND exeSumTplIsActive = 'Y'
|
||||||
|
limit 0,1;
|
||||||
|
|
||||||
|
IF (CODE = 'A01') THEN
|
||||||
|
SET @body = REPLACE(@body, '{PERCENTAGE_MEMBER}', 'New');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT @judul as judul, @subjudul as subjudul, @body as body;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
END
|
||||||
19
sp_rpt_exe_sum_table_antropometri.txt
Normal file
19
sp_rpt_exe_sum_table_antropometri.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
begin
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
CASE
|
||||||
|
WHEN AntropometriType = 'MIN' THEN 'Nilai Minimal'
|
||||||
|
WHEN AntropometriType = 'MAX' THEN 'Nilai Maksimal'
|
||||||
|
WHEN AntropometriType = 'AVG' THEN 'Rata - rata'
|
||||||
|
WHEN AntropometriType = 'MED' THEN 'Median'
|
||||||
|
ELSE AntropometriType
|
||||||
|
END AS AntropometriType ,
|
||||||
|
AntropometriTB,
|
||||||
|
AntropometriBB,
|
||||||
|
AntropometriLP,
|
||||||
|
AntropometriBMI,
|
||||||
|
AntropometriMgm_McuID
|
||||||
|
FROM one_etl.antropometri
|
||||||
|
WHERE AntropometriMgm_McuID = PID;
|
||||||
|
|
||||||
|
end
|
||||||
73
sp_rpt_exe_sum_table_pola_kebiasaan.txt
Normal file
73
sp_rpt_exe_sum_table_pola_kebiasaan.txt
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
BEGIN
|
||||||
|
|
||||||
|
WITH order_riwayat AS (
|
||||||
|
SELECT
|
||||||
|
Mgm_RiwayatMcu_RiwayatID,
|
||||||
|
Mgm_RiwayatMgm_HeaderID,
|
||||||
|
Mgm_HeaderIsNormal
|
||||||
|
FROM
|
||||||
|
one_etl.mgm_riwayat
|
||||||
|
JOIN one_etl.mgm_header
|
||||||
|
ON Mgm_RiwayatMgm_HeaderID = Mgm_HeaderID
|
||||||
|
WHERE
|
||||||
|
Mgm_HeaderMgm_McuID = PID
|
||||||
|
AND Mgm_RiwayatMcu_RiwayatGroupID = 6
|
||||||
|
),
|
||||||
|
order_location AS (
|
||||||
|
SELECT DISTINCT
|
||||||
|
COALESCE(NULLIF(Mgm_HeaderM_PatientLocation, ''), '-') AS location,
|
||||||
|
Mgm_HeaderID
|
||||||
|
FROM
|
||||||
|
one_etl.mgm_header
|
||||||
|
WHERE
|
||||||
|
Mgm_HeaderMgm_McuID = PID
|
||||||
|
),
|
||||||
|
total_peserta AS (
|
||||||
|
SELECT
|
||||||
|
COALESCE(NULLIF(Mgm_HeaderM_PatientLocation, ''), '-') AS location,
|
||||||
|
COUNT(DISTINCT Mgm_HeaderT_OrderHeaderID) AS total_peserta
|
||||||
|
FROM
|
||||||
|
one_etl.mgm_header
|
||||||
|
WHERE
|
||||||
|
Mgm_HeaderMgm_McuID = PID
|
||||||
|
AND Mgm_HeaderIsActive = 'Y'
|
||||||
|
GROUP BY
|
||||||
|
COALESCE(NULLIF(Mgm_HeaderM_PatientLocation, ''), '-')
|
||||||
|
),
|
||||||
|
Counts AS (
|
||||||
|
SELECT
|
||||||
|
ol.location AS site_perusahaan,
|
||||||
|
-- Hitung ketika Mgm_HeaderIsNormal = 'Y'
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID = 149 AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Tidak_Merokok_Y,
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID IN (150, 151, 152, 153) AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Merokok_Y,
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID = 141 AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Tidak_Minum_Alkohol_Y,
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID IN (142, 143, 144) AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Minum_Alkohol_Y,
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID = 145 AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Tidak_Rutin_Olahraga_Y,
|
||||||
|
COUNT(CASE WHEN orw.Mgm_RiwayatMcu_RiwayatID IN (146, 147, 148) AND (orw.Mgm_HeaderIsNormal = 'Y' OR orw.Mgm_HeaderIsNormal = 'N') THEN 1 END) AS Olahraga_Y,
|
||||||
|
-- Hitung Total pasien
|
||||||
|
tp.total_peserta AS total_peserta
|
||||||
|
FROM
|
||||||
|
order_location ol
|
||||||
|
LEFT JOIN order_riwayat orw ON ol.Mgm_HeaderID = orw.Mgm_RiwayatMgm_HeaderID
|
||||||
|
LEFT JOIN total_peserta tp ON ol.location = tp.location
|
||||||
|
GROUP BY
|
||||||
|
ol.location, tp.total_peserta
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
site_perusahaan,
|
||||||
|
Tidak_Merokok_Y,
|
||||||
|
Merokok_Y,
|
||||||
|
(total_peserta - (Tidak_Merokok_Y+Merokok_Y)) AS Merokok_NA,
|
||||||
|
Tidak_Minum_Alkohol_Y,
|
||||||
|
Minum_Alkohol_Y,
|
||||||
|
(total_peserta - (Tidak_Minum_Alkohol_Y+Minum_Alkohol_Y)) AS Alkohol_NA,
|
||||||
|
Tidak_Rutin_Olahraga_Y,
|
||||||
|
Olahraga_Y,
|
||||||
|
(total_peserta - (Tidak_Rutin_Olahraga_Y+Olahraga_Y)) AS Olahraga_NA,
|
||||||
|
total_peserta AS Peserta
|
||||||
|
FROM
|
||||||
|
Counts
|
||||||
|
ORDER BY
|
||||||
|
site_perusahaan;
|
||||||
|
|
||||||
|
END
|
||||||
23
sp_rpt_executive_summary_tabel_gender_v2.txt
Normal file
23
sp_rpt_executive_summary_tabel_gender_v2.txt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
begin
|
||||||
|
SELECT count(Mcu_OrderT_OrderHeaderID) into @peserta
|
||||||
|
FROM one_etl.mgm_mcu
|
||||||
|
join one_etl.mcu_order on Mcu_OrderMgm_McuID = Mgm_McuID
|
||||||
|
where Mgm_McuID = PID ;
|
||||||
|
|
||||||
|
select
|
||||||
|
"A" as Kode,
|
||||||
|
"Gender" as Groups ,
|
||||||
|
M_SexName as Nama ,
|
||||||
|
count(Mcu_OrderT_OrderHeaderID) as total ,
|
||||||
|
Round((count(Mcu_OrderT_OrderHeaderID) / @peserta * 100 ),2) as Persen
|
||||||
|
|
||||||
|
|
||||||
|
from one_etl.mcu_order
|
||||||
|
join t_orderheader on Mcu_OrderT_OrderHeaderID = T_OrderHeaderID and T_OrderHeaderIsActive = 'Y'
|
||||||
|
left join m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
||||||
|
left join m_sex ON M_PatientM_SexID = M_SexID AND M_SexIsActive = 'Y'
|
||||||
|
|
||||||
|
where Mcu_OrderMgm_McuID = PID
|
||||||
|
group by M_SexID ;
|
||||||
|
|
||||||
|
end
|
||||||
14
sp_rpt_executive_summary_tabel_jenis_test_v2.txt
Normal file
14
sp_rpt_executive_summary_tabel_jenis_test_v2.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
begin
|
||||||
|
select distinct
|
||||||
|
Nat_TestName,
|
||||||
|
Nat_TestCode
|
||||||
|
|
||||||
|
from one_etl.mgm_header
|
||||||
|
join nat_test on Nat_TestCode = Mgm_HeaderNat_TestCode
|
||||||
|
and Nat_TestIsActive = 'Y'
|
||||||
|
and Nat_TestIsPrice = 'Y'
|
||||||
|
|
||||||
|
where Mgm_HeaderIsActive = 'Y' and Mgm_HeaderMgm_McuID = PID
|
||||||
|
order by Nat_TestCode;
|
||||||
|
|
||||||
|
end
|
||||||
26
sp_rpt_executive_summary_table_kel_umur_v2.txt
Normal file
26
sp_rpt_executive_summary_table_kel_umur_v2.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
begin
|
||||||
|
|
||||||
|
select
|
||||||
|
IFNULL(M_PatientLocation, '-') as M_PatientLocation,
|
||||||
|
case
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) < '30' then "< 30 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '30' and left(T_OrderHeaderM_PatientAge,2) < '40' then "30 -< 40 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '40' and left(T_OrderHeaderM_PatientAge,2) < '50' then "40 - < 50 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '50' then "> 50 th" else ""
|
||||||
|
end as umur,
|
||||||
|
count(Mcu_OrderT_OrderHeaderID) as total,
|
||||||
|
concat('http://localhost/one-api/tools/mcu_chart/mcu003/',Mcu_OrderMgm_McuID) as Graph
|
||||||
|
|
||||||
|
from one_etl.mcu_order
|
||||||
|
join t_orderheader on Mcu_OrderT_OrderHeaderID = T_OrderHeaderID and T_OrderHeaderIsActive = 'Y'
|
||||||
|
left join m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
||||||
|
where Mcu_OrderMgm_McuID = PID
|
||||||
|
group by M_PatientLocation,
|
||||||
|
case
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) < '30' then "< 30 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '30' and left(T_OrderHeaderM_PatientAge,2) < '40' then "30 -< 40 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '40' and left(T_OrderHeaderM_PatientAge,2) < '50' then "40 - < 50 th"
|
||||||
|
when left(T_OrderHeaderM_PatientAge,2) >= '50' then "> 50 th" else ""
|
||||||
|
end;
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user