diff --git a/admin/src/main/resources/mappers/dashboard/ChartMapper.xml b/admin/src/main/resources/mappers/dashboard/ChartMapper.xml index 83b7e1da..4abfbd25 100644 --- a/admin/src/main/resources/mappers/dashboard/ChartMapper.xml +++ b/admin/src/main/resources/mappers/dashboard/ChartMapper.xml @@ -12,6 +12,7 @@ COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count, COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1) , 0 ) as gift_sent_percent FROM household h + JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth} LEFT join household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false WHERE h.is_deleted = false @@ -32,6 +33,7 @@ COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count, COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq), 0), 1),0) as gift_sent_percent FROM household h + JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false JOIN researcher_has_household rhh on rhh.household_seq = h.seq and rhh.admin_seq = #{adminSeq} and rhh.is_deleted = false LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth} LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false @@ -136,10 +138,11 @@ LEFT JOIN household_visit hv ON hv.household_seq = h.seq AND hv.is_deleted = false + AND TO_CHAR(hv.visit_date, 'YYYYMM') = #{recordMonth} LEFT JOIN v_monthly_completion_rate v ON v.household_seq = h.seq AND v.record_month = #{recordMonth} - WHERE u.parent_id = 'code.region.main' + WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false GROUP BY u.code_text, u.order_no UNION ALL -- 전체 합계 행 @@ -169,10 +172,11 @@ LEFT JOIN household_visit hv ON hv.household_seq = h.seq AND hv.is_deleted = false + AND TO_CHAR(hv.visit_date, 'YYYYMM') = #{recordMonth} LEFT JOIN v_monthly_completion_rate v ON v.household_seq = h.seq AND v.record_month = #{recordMonth} - WHERE u.parent_id = 'code.region.main' + WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false ORDER BY order_no @@ -209,6 +213,7 @@ ON hv_gift.household_seq = h.seq AND hv_gift.is_deleted = false AND hv_gift.is_gift_sent = true + AND TO_CHAR(hv_gift.visit_date, 'YYYYMM') = #{recordMonth} WHERE detail_uicode.id LIKE 'code.region.detail.%' GROUP BY detail_uicode.code_text, @@ -238,6 +243,7 @@ ON hv_gift.household_seq = h.seq AND hv_gift.is_deleted = false AND hv_gift.is_gift_sent = true + AND TO_CHAR(hv_gift.visit_date, 'YYYYMM') = #{recordMonth} WHERE h.is_deleted = false AND h.is_panel = true order by region_order ASC, diff --git a/core/src/main/resources/sql/data/04_second_open.sql b/core/src/main/resources/sql/data/04_second_open.sql index 3ed64cce..681f726d 100644 --- a/core/src/main/resources/sql/data/04_second_open.sql +++ b/core/src/main/resources/sql/data/04_second_open.sql @@ -134,6 +134,81 @@ DELETE FROM uri WHERE id = 'uri.admin.communication.sms'; -- 은행자동이체 내역 칼럼 타입 크기 변경 ALTER TABLE public.bank_auto_transfer ALTER COLUMN source_purpose TYPE varchar(100) USING source_purpose::varchar(100); + +-- 뷰 테이블 수정 +-- public.v_household_with_code source +drop view v_household_with_code; + +CREATE OR REPLACE VIEW public.v_household_with_code +AS SELECT h.seq, + h.household_num, + h.owner_name, + h.owner_age, + h.tel, + h.phone, + h.address, + h.region_main_code, + main.code_text AS region_main_name, + h.region_sub_code, + sub.name AS region_sub_name, + h.region_detail_code, + detail.name AS region_detail_name, + h.industry_large_code, + ind_large.name AS industry_large_name, + h.industry_middle_code, + ind_middle.name AS industry_middle_name, + h.industry_sub_middle, + h.industry_detail, + h.is_panel, + h.usage_type, + h.employment_type, + h.memo + FROM household h + LEFT JOIN uicode main ON h.region_main_code::text = main.id::text + LEFT JOIN v_uicode_view_name sub ON h.region_sub_code::text = sub.id::text + LEFT JOIN v_uicode_view_name detail ON h.region_detail_code::text = detail.id::text + LEFT JOIN v_uicode_view_name ind_large ON h.industry_large_code::text = ind_large.id::text + LEFT JOIN v_uicode_view_name ind_middle ON h.industry_middle_code::text = ind_middle.id::text + WHERE h.is_deleted = false; + +-- 함수 생성 +-- DROP FUNCTION public.fn_uicode_text(varchar); + +CREATE OR REPLACE FUNCTION public.fn_uicode_text(p_id character varying) + RETURNS character varying + LANGUAGE plpgsql +AS $function$ +DECLARE + result VARCHAR; +BEGIN + SELECT CONCAT(code_value, '.', code_text) + INTO result + FROM public.uicode + WHERE id = p_id AND is_deleted = false; + + RETURN result; +END; +$function$ +; + +-- DROP FUNCTION public.fn_uicode_value(varchar); + +CREATE OR REPLACE FUNCTION public.fn_uicode_value(p_id character varying) + RETURNS character varying + LANGUAGE plpgsql +AS $function$ +DECLARE + result VARCHAR; +BEGIN + SELECT code_value + INTO result + FROM public.uicode + WHERE id = p_id AND is_deleted = false; + + RETURN result; +END; +$function$ +; -- ==================================================================================================================== -- 문자 발송 -- ==================================================================================================================== @@ -657,3 +732,27 @@ created_at timestamp(6) NULL, created_by varchar(255) null, CONSTRAINT term_agreement_pkey PRIMARY KEY (id) ); + +-- ============================================ +-- 영수증 매핑 테이블 +-- ============================================ +-- public.receipt_has_record +CREATE TABLE public.receipt_has_record ( + receipt_type_id int8 NOT NULL, + file_id int8 NOT NULL, + "type" varchar(10) NOT NULL, + created_at timestamp(6) DEFAULT CURRENT_TIMESTAMP NOT NULL, + created_by varchar(255) NOT NULL, + updated_at timestamp(6) NULL, + updated_by varchar(255) NULL, + deleted_at timestamp(6) NULL, + deleted_by varchar(255) NULL, + is_deleted bool DEFAULT false NOT NULL, + CONSTRAINT receipt_has_record_pkey PRIMARY KEY (receipt_type_id, file_id) +); + +--- 첨부파일 컬럼 추가 +COMMENT ON COLUMN public.upload_file.mapping_id IS '첨부파일 매핑 ID'; + +ALTER TABLE public.upload_file ADD ocr text NULL; +COMMENT ON COLUMN public.upload_file.ocr IS 'ocr'; diff --git a/front/src/main/resources/templates/record/calendar.html b/front/src/main/resources/templates/record/calendar.html index 98d347d3..35fdbff0 100644 --- a/front/src/main/resources/templates/record/calendar.html +++ b/front/src/main/resources/templates/record/calendar.html @@ -835,6 +835,7 @@ let dailyNo = [] let msgTxt = ''; let month = viewDate.getMonth() + 1; + let idxPlus = 0; msgTxt += "등록하지 않은 일계부 항목이 있습니다.\n 정확한 조사를 위해 꾸준히 입력해 주세요.\n"; if(response.dailyRecordAlertDtoList.length > 0){ response.dailyRecordAlertDtoList.forEach((dto) =>{ @@ -847,14 +848,11 @@ dailyNo.push(dateTxt); }); msgTxt += "

1. 일계부 미등록

\n

"+dailyNo.join(',')+"

\n"; + idxPlus ++; } - if(response.monthRecordAlertDtoList.length > 0) { response.monthRecordAlertDtoList.forEach((dto,idx) => { - if(response.dailyRecordAlertDtoList.length > 0){ - idx ++; - } - msgTxt += "

"+idx+". "+dto+"

\n"; + msgTxt += "

"+ (idx+idxPlus+1) +". "+dto+"

\n"; }); }