|
|
|
@ -218,25 +218,31 @@
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="select_timeline" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
|
SELECT
|
|
|
|
|
DATE_FORMAT(b.reg_dt, '%Y-%m-%d') as reg_date,
|
|
|
|
|
SELECT ifnull(DATEDIFF(XA.reg_dt, LAG(XA.reg_dt) OVER (ORDER BY b.reg_dt)), '0') as day_diff,
|
|
|
|
|
ifnull(DATE_FORMAT(TIMEDIFF(XA.reg_dt, LAG(XA.reg_dt) OVER (ORDER BY XA.reg_dt)), '%H:%i'),'00:00') as time_diff,
|
|
|
|
|
XA.reg_date,
|
|
|
|
|
XA.hour_min,
|
|
|
|
|
XA.title,
|
|
|
|
|
XA.dn_no,
|
|
|
|
|
XA.cd_no,
|
|
|
|
|
XA.val_1,
|
|
|
|
|
XA.color_cd,
|
|
|
|
|
XA.time_val
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT DATE_FORMAT(b.reg_dt, '%Y-%m-%d') as reg_date,
|
|
|
|
|
DATE_FORMAT(b.reg_dt, '%H:%i %p') as hour_min,
|
|
|
|
|
ifnull(DATEDIFF(b.reg_dt, LAG(b.reg_dt) OVER (ORDER BY b.reg_dt)),'0') as day_diff,
|
|
|
|
|
ifnull(DATE_FORMAT(TIMEDIFF(b.reg_dt, LAG(b.reg_dt) OVER (ORDER BY b.reg_dt) ), '%H:%i'), '00:00') as time_diff,
|
|
|
|
|
c.title,
|
|
|
|
|
b.dn_no,
|
|
|
|
|
c.cd_no,
|
|
|
|
|
b.reg_dt,
|
|
|
|
|
LPAD(c.val_1, 2, '0') as val_1,
|
|
|
|
|
(select color_cd from tbl_code_item ts where ts.val_1 = c.cd_no) as color_cd,
|
|
|
|
|
CASE
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_1' THEN
|
|
|
|
|
(select concat(ifnull(eat_qty,0), 'ml')
|
|
|
|
|
from tbl_bf_daily_nutrition_1 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
(select concat(ifnull(eat_qty, 0), 'ml') from tbl_bf_daily_nutrition_1 tn1 where tn1.dn_no = b.dn_no)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_2' THEN
|
|
|
|
|
(select
|
|
|
|
|
case when tn1.milk_tp = 87 then ifnull(concat(ifnull(tn.prd_nm,''), ' ', eat_qty, 'ml'),'')
|
|
|
|
|
(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
|
|
|
|
@ -244,8 +250,7 @@
|
|
|
|
|
WHERE tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_3' THEN
|
|
|
|
|
(select
|
|
|
|
|
concat(
|
|
|
|
|
(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, '')
|
|
|
|
@ -266,7 +271,8 @@
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_6' THEN
|
|
|
|
|
(select 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
|
|
|
|
|
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
|
|
|
|
@ -278,8 +284,7 @@
|
|
|
|
|
WHERE tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_9' THEN
|
|
|
|
|
(select
|
|
|
|
|
concat(
|
|
|
|
|
(select concat(
|
|
|
|
|
case
|
|
|
|
|
when tn1.db_dhb_tp = 'sf' then ifnull(tb.name, '')
|
|
|
|
|
when tn1.db_dhb_tp = 'bf' then ifnull(tc.name, '')
|
|
|
|
@ -294,8 +299,7 @@
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_10' THEN
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
concat(
|
|
|
|
|
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, '')
|
|
|
|
@ -306,32 +310,27 @@
|
|
|
|
|
WHERE tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_11' THEN
|
|
|
|
|
(select
|
|
|
|
|
concat(ifnull(hosp_nm,''), ' 의사:', doctor_nm, ', 증상: ', checkup)
|
|
|
|
|
(select concat(ifnull(hosp_nm, ''), ' 의사:', doctor_nm, ', 증상: ', checkup)
|
|
|
|
|
from tbl_bf_daily_nutrition_11 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_12' THEN
|
|
|
|
|
(select
|
|
|
|
|
daily_life
|
|
|
|
|
(select daily_life
|
|
|
|
|
from tbl_bf_daily_nutrition_12 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_13' THEN
|
|
|
|
|
(select
|
|
|
|
|
achievement
|
|
|
|
|
(select achievement
|
|
|
|
|
from tbl_bf_daily_nutrition_13 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_14' THEN
|
|
|
|
|
(select
|
|
|
|
|
concat(ifnull(blq + brq,0), 'ml')
|
|
|
|
|
(select concat(ifnull(blq + brq, 0), 'ml')
|
|
|
|
|
from tbl_bf_daily_nutrition_14 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
|
when c.cd_no = 'BF_NU_TP_15' THEN
|
|
|
|
|
(select
|
|
|
|
|
concat(ifnull(etc_symptom,''), ' ', ifnull(temperature,''))
|
|
|
|
|
(select concat(ifnull(etc_symptom, ''), ' ', ifnull(temperature, ''))
|
|
|
|
|
from tbl_bf_daily_nutrition_15 tn1
|
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
|
)
|
|
|
|
@ -339,12 +338,13 @@
|
|
|
|
|
FROM tbl_bf_family_match a
|
|
|
|
|
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
|
|
|
|
|
INNER JOIN tbl_code_item_str c on b.nutirition_cd_no = c.cd_no
|
|
|
|
|
WHERE
|
|
|
|
|
a.member_id = #member_id#
|
|
|
|
|
WHERE a.member_id = #member_id#
|
|
|
|
|
and a.smc_no = #smc_no#
|
|
|
|
|
and b.reg_dt between date_add(now(), interval -1 month ) and now()
|
|
|
|
|
and b.nutirition_cd_no != ''
|
|
|
|
|
ORDER BY b.reg_dt
|
|
|
|
|
) XA
|
|
|
|
|
WHERE XA.time_val is not NULL
|
|
|
|
|
ORDER BY XA.reg_dt
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="select_timeline_color_cd" resultClass="dataMap" parameterClass="dataMap">
|
|
|
|
|