Merge remote-tracking branch 'origin/devs' into devs

dev_bert
isol2011 3 years ago
commit 65d38340fd

@ -240,10 +240,165 @@
time_val
FROM (
SELECT DATE_FORMAT(b.reg_dt, '%H:%i') as hour_min,
(DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25 as start_degree,
CASE
WHEN (b.reg_dt between DATE_SUB(STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day) and STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s')) THEN 0
ELSE (DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25
END
as start_degree,
(select color_cd from tbl_code_item ts where ts.val_1 = c.cd_no) as category,
c.title,
ifnull(
CASE
WHEN (b.reg_dt between DATE_SUB(STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day) and DATE_SUB(STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 day)) THEN
ifnull(
CASE
when c.cd_no = 'BF_NU_TP_1' THEN
(select blm + brm
from tbl_bf_daily_nutrition_1 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_2' THEN
(select bm + bs
from tbl_bf_daily_nutrition_2 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_3' THEN
(select bm + bs
from tbl_bf_daily_nutrition_3 tn1
left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_5' THEN
(select sleep_h * 60 + sleep_m
from tbl_bf_daily_nutrition_5 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_6' THEN
(select 4
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 = b.dn_no
)
when c.cd_no = 'BF_NU_TP_7' THEN
(select 4
from tbl_bf_daily_nutrition_7 tn1
inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_9' THEN
(select bm + bs
from tbl_bf_daily_nutrition_9 tn1
left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_10' THEN
(select bm + bs
from tbl_bf_daily_nutrition_10 tn1
left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_11' THEN
(select 4
from tbl_bf_daily_nutrition_11 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_12' THEN
(select disturb_min + disturb_sec
from tbl_bf_daily_nutrition_12 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_13' THEN
(select 4
from tbl_bf_daily_nutrition_13 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_14' THEN
(select 4
from tbl_bf_daily_nutrition_14 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_15' THEN
(select 4
from tbl_bf_daily_nutrition_15 tn1
where tn1.dn_no = b.dn_no
)
END, 4) * 0.25 - (360 - ((DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25))
WHEN (DATE_ADD(b.reg_dt, INTERVAL (ifnull(
CASE
when c.cd_no = 'BF_NU_TP_1' THEN
(select blm + brm
from tbl_bf_daily_nutrition_1 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_2' THEN
(select bm + bs
from tbl_bf_daily_nutrition_2 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_3' THEN
(select bm + bs
from tbl_bf_daily_nutrition_3 tn1
left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_5' THEN
(select sleep_h * 60 + sleep_m
from tbl_bf_daily_nutrition_5 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_6' THEN
(select 1
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 = b.dn_no
)
when c.cd_no = 'BF_NU_TP_7' THEN
(select 1
from tbl_bf_daily_nutrition_7 tn1
inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_9' THEN
(select bm + bs
from tbl_bf_daily_nutrition_9 tn1
left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_10' THEN
(select bm + bs
from tbl_bf_daily_nutrition_10 tn1
left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_11' THEN
(select 1
from tbl_bf_daily_nutrition_11 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_12' THEN
(select disturb_min + disturb_sec
from tbl_bf_daily_nutrition_12 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_13' THEN
(select 1
from tbl_bf_daily_nutrition_13 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_14' THEN
(select 1
from tbl_bf_daily_nutrition_14 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_15' THEN
(select 1
from tbl_bf_daily_nutrition_15 tn1
where tn1.dn_no = b.dn_no
)
END, 1)) MINUTE) between STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s') and DATE_ADD(STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s'),INTERVAL 1 DAY)) THEN
(360 - ((DATE_FORMAT(b.reg_dt, '%H') * 60 + DATE_FORMAT(b.reg_dt, '%i')) * 0.25))
ELSE ifnull(
CASE
when c.cd_no = 'BF_NU_TP_1' THEN
(select blm + brm
@ -316,7 +471,9 @@
from tbl_bf_daily_nutrition_15 tn1
where tn1.dn_no = b.dn_no
)
END, 4) * 0.25 AS add_degree,
END, 4) * 0.25
END
AS add_degree,
CASE
WHEN c.cd_no = 'BF_NU_TP_1' THEN
(
@ -440,7 +597,86 @@
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
INNER JOIN tbl_bf_family_baby d on a.smc_no = d.smc_no
WHERE a.smc_no = #smc_no#
and b.reg_dt between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s')
and (
b.reg_dt between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s')
OR
DATE_ADD(b.reg_dt, INTERVAL (
ifnull(
CASE
when c.cd_no = 'BF_NU_TP_1' THEN
(select blm + brm
from tbl_bf_daily_nutrition_1 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_2' THEN
(select bm + bs
from tbl_bf_daily_nutrition_2 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_3' THEN
(select bm + bs
from tbl_bf_daily_nutrition_3 tn1
left outer join tbl_db_nutrient tn on tn1.db_dn_no = tn.dn_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_5' THEN
(select sleep_h * 60 + sleep_m
from tbl_bf_daily_nutrition_5 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_6' THEN
(select 1
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 = b.dn_no
)
when c.cd_no = 'BF_NU_TP_7' THEN
(select 1
from tbl_bf_daily_nutrition_7 tn1
inner join tbl_db_vac tv on tn1.db_dvs_no = tv.dv_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_9' THEN
(select bm + bs
from tbl_bf_daily_nutrition_9 tn1
left outer join tbl_db_home_bf tb on tn1.db_dhb_no = tb.dhb_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_10' THEN
(select bm + bs
from tbl_bf_daily_nutrition_10 tn1
left outer join tbl_db_bf_commerce tc on tc.dbc_no = tn1.db_dbc_no
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_11' THEN
(select 1
from tbl_bf_daily_nutrition_11 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_12' THEN
(select disturb_min + disturb_sec
from tbl_bf_daily_nutrition_12 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_13' THEN
(select 1
from tbl_bf_daily_nutrition_13 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_14' THEN
(select 1
from tbl_bf_daily_nutrition_14 tn1
where tn1.dn_no = b.dn_no
)
when c.cd_no = 'BF_NU_TP_15' THEN
(select 1
from tbl_bf_daily_nutrition_15 tn1
where tn1.dn_no = b.dn_no
)
END, 1)
) MINUTE) between STR_TO_DATE(#startDate#, '%Y-%m-%d %H:%i:%s') and STR_TO_DATE(#endDate#, '%Y-%m-%d %H:%i:%s')
)
and b.nutirition_cd_no != ''
GROUP BY dn_no
ORDER BY add_degree desc

Loading…
Cancel
Save