[수정] 홈화면 마지막 식사 마스터 빈값 무시

dev_bert
isol2011 3 years ago
parent e77729a62d
commit a84d5be4d2

@ -723,7 +723,8 @@
WHEN TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()) <![CDATA[<]]> 24 THEN CONCAT(TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()), '시간 전') WHEN TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()) <![CDATA[<]]> 24 THEN CONCAT(TIMESTAMPDIFF(HOUR, XA.reg_dt, NOW()), '시간 전')
WHEN TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()) <![CDATA[<]]> 30 THEN CONCAT(TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()), '일 전') WHEN TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()) <![CDATA[<]]> 30 THEN CONCAT(TIMESTAMPDIFF(DAY, XA.reg_dt, NOW()), '일 전')
ELSE CONCAT(TIMESTAMPDIFF(MONTH, XA.reg_dt, NOW()), '달 전') ELSE CONCAT(TIMESTAMPDIFF(MONTH, XA.reg_dt, NOW()), '달 전')
END AS ago END AS ago,
XA.val as val
FROM FROM
( (
SELECT SELECT
@ -742,21 +743,133 @@
WHEN XS.cd_no = 'BF_NU_TP_10' then 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) (SELECT b.eat_qty FROM tbl_bf_daily_nutrition_10 b where b.dn_no = XS.dn_no)
END, 0) END, 0)
, ' ml') AS time_val , ' ml') AS time_val,
XS.val
FROM FROM
( (
SELECT SELECT
x.nutirition_cd_no as cd_no, x.nutirition_cd_no as cd_no,
x.dn_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 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 WHERE 1=1
AND x.smc_no = #smc_no# 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') 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 ORDER BY x.reg_dt desc
LIMIT 1
) XS ) XS
) XA ) XA
where XA.val is not null
order by XA.reg_dt desc
limit 1
</select> </select>
<!-- 마지막 수면 현황 --> <!-- 마지막 수면 현황 -->
@ -1596,7 +1709,7 @@
,dv_no ,dv_no
,round ,round
FROM tbl_db_vac_schedule FROM tbl_db_vac_schedule
WHERE start_label<![CDATA[<=]]>#label# AND #label#<![CDATA[<]]>end_label WHERE round = 1
)x )x
LEFT JOIN tbl_db_vac dv ON dv.dv_no = x.dv_no 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 LEFT JOIN tbl_bf_daily_nutrition_7 dn ON dn.db_dvs_no = x.dvs_no

Loading…
Cancel
Save