From a84d5be4d2d37aa62c2bace736a7f3c123134870 Mon Sep 17 00:00:00 2001 From: isol2011 Date: Mon, 18 Jul 2022 16:15:42 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=88=98=EC=A0=95]=20=ED=99=88=ED=99=94?= =?UTF-8?q?=EB=A9=B4=20=EB=A7=88=EC=A7=80=EB=A7=89=20=EC=8B=9D=EC=82=AC=20?= =?UTF-8?q?=EB=A7=88=EC=8A=A4=ED=84=B0=20=EB=B9=88=EA=B0=92=20=EB=AC=B4?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com.backoffice.m.bf_daily_nutrition.xml | 123 +++++++++++++++++- 1 file changed, 118 insertions(+), 5 deletions(-) diff --git a/src/main/resources/sqlmap/m/bf_daily_nutrition/com.backoffice.m.bf_daily_nutrition.xml b/src/main/resources/sqlmap/m/bf_daily_nutrition/com.backoffice.m.bf_daily_nutrition.xml index 0b6881b..80e1c55 100644 --- a/src/main/resources/sqlmap/m/bf_daily_nutrition/com.backoffice.m.bf_daily_nutrition.xml +++ b/src/main/resources/sqlmap/m/bf_daily_nutrition/com.backoffice.m.bf_daily_nutrition.xml @@ -723,7 +723,8 @@ WHEN TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()) 24 THEN CONCAT(TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()), '시간 전') WHEN TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()) 30 THEN CONCAT(TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()), '일 전') ELSE CONCAT(TIMESTAMPDIFF(MONTH, XA.reg_dt, NOW()), '달 전') - END AS ago + END AS ago, + XA.val as val FROM ( SELECT @@ -742,21 +743,133 @@ WHEN XS.cd_no = 'BF_NU_TP_10' then (SELECT b.eat_qty FROM tbl_bf_daily_nutrition_10 b where b.dn_no = XS.dn_no) END, 0) - , ' ml') AS time_val + , ' ml') AS time_val, + XS.val FROM ( SELECT x.nutirition_cd_no as cd_no, x.dn_no, - x.reg_dt + x.reg_dt, + case + when cis_1.cd_no = 'BF_NU_TP_1' then ( + select + ifnull(concat(ifnull(eat_qty, 0), 'ml'), '') + from + tbl_bf_daily_nutrition_1 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_2' then ( + select + case + when tn1.milk_tp = 87 then ifnull(concat(ifnull(tn.prd_nm, ''), ' ', eat_qty, 'ml'), '') + else ifnull(concat('유축수유', ' ', eat_qty, 'ml'), '') + end + from + tbl_bf_daily_nutrition_2 tn1 + left outer join tbl_db_nutrient tn on + tn1.db_dn_no = tn.dn_no + and tn1.milk_tp = 87 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_3' then ( + select + concat( case when tn1.db_dn_tp = 'bf' then ifnull(tb.prd_nm, '') when tn1.db_dn_tp = 'sf' then ifnull(tc.prd_nm, '') end , ' ' , tn1.eat_qty, 'g(ml) 섭취' ) + from + tbl_bf_daily_nutrition_3 tn1 + left outer join tbl_db_nutrient tb on + tn1.db_dn_no = tb.dn_no + left outer join tbl_db_sf_commerce tc on + tn1.db_dn_no = tc.dbc_no + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_5' then ( + select + concat( (case when sleep_tp = 15 then '낮잠' when sleep_tp = 16 then '밤잠' end), ' ', ifnull(concat( (ifnull(sleep_h, 0) - ifnull(sleep_s_h, 0)), '시 ', (ifnull(sleep_m, 0) - ifnull(sleep_s_m, 0)), '분'), '') ) + from + tbl_bf_daily_nutrition_5 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_6' then ( + select + concat( (case when rest_tp = 19 then '대변량' when rest_tp = 20 then '소변량' end), ' ', ifnull(tn2.title, '') ) + from + tbl_bf_daily_nutrition_6 tn1 + inner join tbl_code_item_str tn2 on + tn2.cg_cd = 'BF_FECES_QTY' + and tn1.rest_qty = tn2.val_1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_7' then ( ufn_get_dv_disease(x.dn_no) ) + when cis_1.cd_no = 'BF_NU_TP_9' then ( + select + concat( case when tn1.db_dhb_tp = 'sf' then ifnull(tb.name, '') when tn1.db_dhb_tp = 'bf' then ifnull(tc.name, '') end , tn1.eat_qty, 'g(ml) 섭취' ) + from + tbl_bf_daily_nutrition_9 tn1 + left outer join tbl_db_home_sf tb on + tn1.db_dhb_no = tb.dhb_no + left outer join tbl_db_home_bf tc on + tn1.db_dhb_no = tc.dhb_no + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_10' then ( + select + concat( case when tn1.db_dbc_tp = 'sf' then ifnull(tb.prd_nm, '') when tn1.db_dbc_tp = 'bf' then ifnull(tc.prd_nm, '') end , tn1.eat_qty, 'g(ml) 섭취' ) + from + tbl_bf_daily_nutrition_10 tn1 + left outer join tbl_db_sf_commerce tb on + tn1.db_dbc_no = tb.dbc_no + left outer join tbl_db_bf_commerce tc on + tn1.db_dbc_no = tc.dbc_no + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_11' then ( + select + ifnull(concat(ifnull(hosp_nm, ''), ' 의사: ', doctor_nm, ', 증상: ', checkup), '') + from + tbl_bf_daily_nutrition_11 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_12' then ( + select + ifnull(daily_life, '') + from + tbl_bf_daily_nutrition_12 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_13' then ( + select + achievement + from + tbl_bf_daily_nutrition_13 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_14' then ( + select + ifnull(concat(ifnull(blq + brq, 0), 'ml'), '') + from + tbl_bf_daily_nutrition_14 tn1 + where + tn1.dn_no = x.dn_no ) + when cis_1.cd_no = 'BF_NU_TP_15' then ( + select + concat(ifnull(etc_symptom, ''), ' ', ifnull(temperature, '')) + from + tbl_bf_daily_nutrition_15 tn1 + where + tn1.dn_no = x.dn_no ) + end as val FROM tbl_bf_daily_nutrition x + LEFT JOIN tbl_code_item_str cis_1 ON cis_1.cd_no = x.nutirition_cd_no WHERE 1=1 AND x.smc_no = #smc_no# AND x.nutirition_cd_no in ('BF_NU_TP_1', 'BF_NU_TP_2', 'BF_NU_TP_3', 'BF_NU_TP_9', 'BF_NU_TP_10') ORDER BY x.reg_dt desc - LIMIT 1 ) XS ) XA + where XA.val is not null + order by XA.reg_dt desc + limit 1 @@ -1596,7 +1709,7 @@ ,dv_no ,round FROM tbl_db_vac_schedule - WHERE start_label#label# AND #label#end_label + WHERE round = 1 )x LEFT JOIN tbl_db_vac dv ON dv.dv_no = x.dv_no LEFT JOIN tbl_bf_daily_nutrition_7 dn ON dn.db_dvs_no = x.dvs_no