|
|
|
-- 일상기록 삭제 - 전체
|
|
|
|
delete from tbl_bf_daily_nutrition;
|
|
|
|
delete from tbl_bf_daily_nutrition_1;
|
|
|
|
delete from tbl_bf_daily_nutrition_2;
|
|
|
|
delete from tbl_bf_daily_nutrition_3;
|
|
|
|
delete from tbl_bf_daily_nutrition_4;
|
|
|
|
delete from tbl_bf_daily_nutrition_5;
|
|
|
|
delete from tbl_bf_daily_nutrition_6;
|
|
|
|
delete from tbl_bf_daily_nutrition_7;
|
|
|
|
delete from tbl_bf_daily_nutrition_8;
|
|
|
|
delete from tbl_bf_daily_nutrition_9;
|
|
|
|
delete from tbl_bf_daily_nutrition_10;
|
|
|
|
|
|
|
|
|
|
|
|
-- 동기화 관련
|
|
|
|
select * from tbl_bf_family where member_id = 'renamaestro';
|
|
|
|
select smc_no, member_id from tbl_bf_family_baby where member_id = 'renamaestro';
|
|
|
|
select * from tbl_bf_family_baby_disease where smc_no in(2,3);
|
|
|
|
select * from tbl_bf_family_baby_order where smc_no in(2,3);
|
|
|
|
|
|
|
|
|
|
|
|
-- 회원정보 삭제
|
|
|
|
truncate table tbl_bf_family_baby_disease;
|
|
|
|
truncate table tbl_bf_family_disease;
|
|
|
|
truncate table tbl_member_confirm;
|
|
|
|
truncate tbl_bf_family_match;
|
|
|
|
delete from tbl_bf_family_baby;
|
|
|
|
delete from tbl_bf_family;
|
|
|
|
delete from tbl_member;
|
|
|
|
|
|
|
|
-- 특정회원 삭제
|
|
|
|
delete from tbl_bf_family_baby_disease where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_family_baby where smc_no in
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_family_baby_order where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_1 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_2 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_3 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_4 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_5 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_6 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_7 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_8 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_9 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_10 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_11 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_12 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_13 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_14 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_bf_daily_nutrition_15 where smc_no IN
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_member_confirm where member_id = '1644201833616';
|
|
|
|
delete from tbl_music where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_family_match where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_growth_body where smc_no in
|
|
|
|
(select smc_no from tbl_bf_family_match where member_id = '1644201833616');
|
|
|
|
|
|
|
|
delete from tbl_buy where member_id = '1644201833616';
|
|
|
|
delete from tbl_cart where member_id = '1644201833616';
|
|
|
|
delete from tbl_member_confirm where member_id = '1644201833616';
|
|
|
|
delete from tbl_member_category where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_alarm where to_member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_board where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_board_comment where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_board_like where member_id = '1644201833616';
|
|
|
|
delete from tbl_member_issued_pwd where member_id = '1644201833616';
|
|
|
|
delete from tbl_growth_review_comment where member_id = '1644201833616';
|
|
|
|
delete from tbl_growth_review_comment_like where member_id = '1644201833616';
|
|
|
|
delete from tbl_log_bf_ingre where member_id = '1644201833616';
|
|
|
|
delete from tbl_log_db_bf_commerce where member_id = '1644201833616';
|
|
|
|
delete from tbl_log_db_nutrient where member_id = '1644201833616';
|
|
|
|
delete from tbl_log_home_bf where member_id = '1644201833616';
|
|
|
|
delete from tbl_nutrition_review_comment where member_id = '1644201833616';
|
|
|
|
delete from tbl_nutrition_review_comment_like where member_id = '1644201833616';
|
|
|
|
delete from tbl_nutrition_review_like where member_id = '1644201833616';
|
|
|
|
delete from tbl_sync_log where member_id = '1644201833616';
|
|
|
|
delete from tbl_bf_family_disease where bf_no in (select bf_no from tbl_bf_family where member_id = '1644201833616');
|
|
|
|
delete from tbl_bf_family where member_id = '1644201833616';
|
|
|
|
delete from tbl_member where member_id = '1644201833616';
|
|
|
|
|
|
|
|
|
|
|
|
-- 메모리 - 일간분석
|
|
|
|
SELECT
|
|
|
|
DATE_FORMAT(a.reg_dt, '%H') as hour,
|
|
|
|
count(*) as cnt
|
|
|
|
FROM tbl_bf_family_match a
|
|
|
|
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
|
|
|
|
INNER JOIN tbl_bf_family_match c on a.smc_no = c.smc_no
|
|
|
|
WHERE
|
|
|
|
a.member_id = '1642861413918'
|
|
|
|
and DATE_FORMAT(b.reg_dt, '%Y-%m-%d') = DATE_FORMAT(now(), '%Y-%m-%d')
|
|
|
|
GROUP BY DATE_FORMAT(b.reg_dt, '%H');
|
|
|
|
|
|
|
|
|
|
|
|
-- 메모리 - 주간분석
|
|
|
|
SELECT
|
|
|
|
DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H') as day,
|
|
|
|
count(*) as cnt
|
|
|
|
FROM tbl_bf_family_match a
|
|
|
|
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
|
|
|
|
INNER JOIN tbl_bf_family_match c on a.smc_no = c.smc_no
|
|
|
|
WHERE
|
|
|
|
a.member_id = '1642861413918'
|
|
|
|
and b.reg_dt between STR_TO_DATE('2022-02-15 00:00:00','%Y-%m-%d %H:%i:%s') and STR_TO_DATE('2022-02-15 23:59:59','%Y-%m-%d %H:%i:%s')
|
|
|
|
group by DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H')
|
|
|
|
order by DATE_FORMAT(b.reg_dt, '%Y-%m-%d %H') asc;
|
|
|
|
|
|
|
|
|
|
|
|
-- 메모리 - 타임라인(모유, 각 카테고리별 수치 및 시간간격 계산해야됨.)
|
|
|
|
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)),'') as day_diff,
|
|
|
|
ifnull(DATE_FORMAT(TIMEDIFF(b.reg_dt, LAG(b.reg_dt) OVER (ORDER BY b.reg_dt) ), '%H:%i'), '00:00'),
|
|
|
|
d.title,
|
|
|
|
b.dn_no,
|
|
|
|
d.cd_no,
|
|
|
|
CASE
|
|
|
|
when d.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
|
|
|
|
) -- 모유
|
|
|
|
when d.cd_no = 'BF_NU_TP_2' THEN
|
|
|
|
(select concat(eat_qty, 'ml')
|
|
|
|
from tbl_bf_daily_nutrition_2 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 분유(젖병)
|
|
|
|
when d.cd_no = 'BF_NU_TP_3' THEN
|
|
|
|
(select
|
|
|
|
concat(ifnull(tn.prd_nm, ''),' ', tn1.eat_qty, 'ml 섭취')
|
|
|
|
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 d.cd_no = 'BF_NU_TP_5' THEN
|
|
|
|
(select 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 = b.dn_no
|
|
|
|
) -- 수면시간
|
|
|
|
when d.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
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 대소변
|
|
|
|
when d.cd_no = 'BF_NU_TP_7' THEN
|
|
|
|
(select
|
|
|
|
tv.dv_disease
|
|
|
|
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 d.cd_no = 'BF_NU_TP_9' THEN
|
|
|
|
(select
|
|
|
|
concat(ifnull(tb.name, ''),' ', tn1.eat_qty, 'ml 섭취')
|
|
|
|
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 d.cd_no = 'BF_NU_TP_10' THEN
|
|
|
|
(select
|
|
|
|
concat(ifnull(tc.prd_nm, ''),' ', tn1.eat_qty, 'ml 섭취')
|
|
|
|
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 d.cd_no = 'BF_NU_TP_11' THEN
|
|
|
|
(select
|
|
|
|
concat(ifnull(hosp_nm,''), ' 의사:', doctor_nm, ', 증상: ', checkup)
|
|
|
|
from tbl_bf_daily_nutrition_11 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 병원
|
|
|
|
when d.cd_no = 'BF_NU_TP_12' THEN
|
|
|
|
(select
|
|
|
|
daily_life
|
|
|
|
from tbl_bf_daily_nutrition_12 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 일상생활
|
|
|
|
when d.cd_no = 'BF_NU_TP_13' THEN
|
|
|
|
(select
|
|
|
|
achievement
|
|
|
|
from tbl_bf_daily_nutrition_13 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 발달과정 성취
|
|
|
|
when d.cd_no = 'BF_NU_TP_14' THEN
|
|
|
|
(select
|
|
|
|
concat(ifnull(blq + brq,0), 'ml')
|
|
|
|
from tbl_bf_daily_nutrition_14 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 유축
|
|
|
|
when d.cd_no = 'BF_NU_TP_15' THEN
|
|
|
|
(select
|
|
|
|
temperature
|
|
|
|
from tbl_bf_daily_nutrition_15 tn1
|
|
|
|
where tn1.dn_no = b.dn_no
|
|
|
|
) -- 체온
|
|
|
|
END AS time_val
|
|
|
|
FROM tbl_bf_family_match a
|
|
|
|
INNER JOIN tbl_bf_daily_nutrition b on a.smc_no = b.smc_no
|
|
|
|
INNER JOIN tbl_bf_family_match c on a.smc_no = c.smc_no
|
|
|
|
INNER JOIN tbl_code_item_str d on b.nutirition_cd_no = d.cd_no
|
|
|
|
WHERE
|
|
|
|
a.smc_no = '87'
|
|
|
|
and DATE_FORMAT(b.reg_dt,'%Y-%m-%d') = STR_TO_DATE('2022-02-28','%Y-%m-%d')
|
|
|
|
ORDER BY b.reg_dt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# DB작업
|
|
|
|
- 이유식 식재료 : tbl_db_bf_ingre
|
|
|
|
- 홈메이드 이유식 정보 : tbl_db_home_bf
|
|
|
|
- 홈메이드 이유식 식재료 정보 데이터 작업 : tbl_db_home_bf_ingre
|
|
|
|
|