From 3c8b8029a94666ce55e38d1f11c0d1bb0330afa5 Mon Sep 17 00:00:00 2001
From: huangh <hshgjzd5@163.com>
Date: Tue, 29 Oct 2024 14:59:11 +0800
Subject: [PATCH] fix:统计重复案件,添加本级数据处理,修改请求方式
---
dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
index af7666f..1bbba00 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
@@ -199,4 +199,97 @@
<include refid="statisticsSuperviseAVG-wherePart"/>
</select>
+ <!-- 统计重复来访案件数量 -->
+ <select id="countRepeatedCases" resultType="cn.huge.module.analysis.domain.dto.CountRepeateDto" parameterType="cn.huge.module.analysis.domain.vo.CountRepeateVo">
+ WITH RepeatedPersons AS (
+ SELECT true_name, mobile, certi_no
+ FROM gzdyh_test.dyh_case_person
+ WHERE per_type = '15_020008-1'
+ AND per_class = '09_01001-1'
+ AND certi_type = '09_00015-1'
+ GROUP BY true_name, mobile, certi_no
+ HAVING COUNT(*) > 1
+ ),
+ MinCaseIds AS (
+ SELECT rp.true_name, rp.mobile, rp.certi_no, MIN(p.case_id) as min_case_id
+ FROM RepeatedPersons rp
+ JOIN gzdyh_test.dyh_case_person p ON rp.true_name = p.true_name AND rp.mobile = p.mobile AND rp.certi_no = p.certi_no
+ GROUP BY rp.true_name, rp.mobile, rp.certi_no
+ ),
+ FilteredCases AS (
+ SELECT p.case_id
+ FROM gzdyh_test.dyh_case_person p
+ JOIN RepeatedPersons rp ON p.true_name = rp.true_name AND p.mobile = rp.mobile AND p.certi_no = rp.certi_no
+ JOIN MinCaseIds mci ON rp.true_name = mci.true_name AND rp.mobile = mci.mobile AND rp.certi_no = mci.certi_no
+ WHERE p.case_id != mci.min_case_id
+ )
+ SELECT
+ <if test="groupByCaseType != null and groupByCaseType != ''">
+ case_type_first_name as groupByType,
+ </if>
+ <if test="groupByArea != null and groupByArea != ''">
+ area_name as groupByType,
+ </if>
+ <if test="groupByRoad != null and groupByRoad != ''">
+ road_name as groupByType,
+ </if>
+ <if test="groupByTime != null and groupByTime != ''">
+ <if test="groupByTime == 'day'">
+ DATE_FORMAT(ci.create_time, '%Y-%m-%d') as groupByType,
+ </if>
+ <if test="groupByTime == 'month'">
+ DATE_FORMAT(ci.create_time, '%Y-%m') as groupByType,
+ </if>
+ <if test="groupByTime == 'year'">
+ DATE_FORMAT(ci.create_time, '%Y') as groupByType,
+ </if>
+ </if>
+ COUNT(DISTINCT fc.case_id) as repeatCount
+ FROM FilteredCases fc
+ JOIN gzdyh_test.dyh_case_info ci ON fc.case_id = ci.id
+ JOIN gzdyh_test.dyh_case_info_unfold cui ON ci.id = cui.id
+ JOIN gzdyh_test.dyh_ct_unit unit ON cui.mediate_unit_id = unit.id
+ WHERE 1=1
+ <if test="createTimeStart != null and createTimeStart != '' and createTimeEnd != null and createTimeEnd != ''">
+ AND ci.create_time BETWEEN #{createTimeStart} AND #{createTimeEnd}
+ </if>
+ <if test="finishTimeStart != null and finishTimeStart != '' and finishTimeEnd != null and finishTimeEnd != ''">
+ AND cui.close_time BETWEEN #{finishTimeStart} AND #{finishTimeEnd}
+ </if>
+ <if test="caseType != null and caseType != ''">
+ AND CI."case_type" = #{caseType}
+ </if>
+ <if test="queCity != null and queCity != ''">
+ AND unit.city = #{queCity}
+ </if>
+ <if test="queArea != null and queArea != ''">
+ AND unit.area = #{queArea}
+ </if>
+ <if test="queRoad != null and queRoad != ''">
+ AND unit.road = #{queRoad}
+ </if>
+ <if test="isFinish != null and isFinish != ''">
+ <if test="isFinish == 'true'">
+ AND CI."process" == '6'
+ </if>
+ <if test="isFinish == 'false'">
+ AND CI."process" != '6'
+ </if>
+ </if>
+ <if test="groupByCaseType != null and groupByCaseType != ''">
+ GROUP BY case_type_first_name
+ </if>
+ <if test="groupByArea != null and groupByArea != ''">
+<!-- AND road_name is not NULL-->
+ GROUP BY area_name
+ </if>
+ <if test="groupByRoad != null and groupByRoad != ''">
+<!-- AND road_name is not NULL-->
+ GROUP BY road_name
+ </if>
+ <if test="groupByTime != null and groupByTime != ''">
+ GROUP BY groupByType
+ </if>
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0