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) 섭취' )