From fca638bd85eb9e5c04a766e7d5c3f469fe2388ca Mon Sep 17 00:00:00 2001
From: zhouxiantao <1026371446@qq.com>
Date: Fri, 20 Sep 2024 17:30:15 +0800
Subject: [PATCH] 态势分析

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml |  187 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 139 insertions(+), 48 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
index 6aa05bb..350543c 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -94,14 +94,15 @@
         <result property="inputUnitName" column="input_unit_name"/>
         <result property="mediResult" column="medi_result"/>
         <result property="mediResultName" column="medi_result_name"/>
-        <result property="mediateDeptId" column="mediate_dept_id"/>
-        <result property="mediateDeptName" column="mediate_dept_name"/>
+        <result property="mediateUnitId" column="mediate_unit_id"/>
+        <result property="mediateUnitName" column="mediate_unit_name"/>
         <result property="assistUnitId" column="assist_unit_id"/>
         <result property="assistUnitName" column="assist_unit_name"/>
         <result property="closeTime" column="close_time"/>
         <result property="agreeType" column="agree_type"/>
         <result property="agreeTypeName" column="agree_type_name"/>
         <result property="agreeContent" column="agree_content"/>
+        <result property="createTime" column="create_time"/>
     </resultMap>
     <!-- 表 -->
     <sql id='table-name'>dyh_case_info</sql>
@@ -116,10 +117,11 @@
         a.case_type_name,
         a.input_unit_id,
         a.input_unit_name,
+        a.create_time,
         b.medi_result,
         b.medi_result_name,
-        b.mediate_dept_id,
-        b.mediate_dept_name,
+        b.mediate_unit_id,
+        b.mediate_unit_name,
         b.assist_unit_id,
         b.assist_unit_name,
         b.close_time,
@@ -273,50 +275,67 @@
     <!-- 条件 -->
     <sql id="where-part-all">
         <if test="terms != null">
-            <if test="terms.status != null and terms.status !=''">
-                and a.status = #{terms.status}
-            </if>
-            <if test="terms.statusName != null and terms.statusName !=''">
-                and a.status_name = #{terms.statusName}
-            </if>
-            <if test="terms.canal != null and terms.canal !=''">
-                and a.canal = #{terms.canal}
-            </if>
-            <if test="terms.canalName != null and terms.canalName !=''">
-                and a.canal_name = #{terms.canalName}
-            </if>
-            <if test="terms.caseLevel != null and terms.caseLevel !=''">
-                and a.case_level = #{terms.caseLevel}
-            </if>
-            <if test="terms.caseType != null and terms.caseType !=''">
-                and a.case_type = #{terms.caseType}
-            </if>
-            <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
-                and a.case_type_name = #{terms.caseTypeName}
-            </if>
-            <if test="terms.inputUnitId != null and terms.inputUnitId !=''">
-                and a.input_unit_id = #{terms.inputUnitId}
-            </if>
-            <if test="terms.inputUnitName != null and terms.inputUnitName !=''">
-                and a.input_unit_name = #{terms.inputUnitName}
-            </if>
-            <if test="terms.visitTimeStart != null and terms.visitTimeStart !='' and terms.visitTimeEnd != null and terms.visitTimeEnd !=''">
-                and (DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.visitTimeStart}
-                and DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.visitTimeEnd})
-            </if>
-            <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
-                and (DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.createStart}
-                and DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.createEnd})
-            </if>
-            <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
-                and (DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.closeStart}
-                and DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.closeEnd})
-            </if>
-            <if test="terms.fileStart != null and terms.fileStart !='' and terms.fileEnd != null and terms.fileEnd !=''">
-                and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart}
-                and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd})
-            </if>
-
+            <where>
+                and delete_status = 0
+                <if test="terms.status != null and terms.status !=''">
+                    and a.status = #{terms.status}
+                </if>
+                <if test="terms.statusName != null and terms.statusName !=''">
+                    and a.status_name = #{terms.statusName}
+                </if>
+                <if test="terms.canal != null and terms.canal !=''">
+                    and a.canal = #{terms.canal}
+                </if>
+                <if test="terms.canalName != null and terms.canalName !=''">
+                    and a.canal_name = #{terms.canalName}
+                </if>
+                <if test="terms.caseLevel != null and terms.caseLevel !=''">
+                    and a.case_level = #{terms.caseLevel}
+                </if>
+                <if test="terms.caseType != null and terms.caseType !=''">
+                    and a.case_type = #{terms.caseType}
+                </if>
+                <if test="terms.caseTypeName != null and terms.caseTypeName !=''">
+                    and a.case_type_name = #{terms.caseTypeName}
+                </if>
+                <if test="terms.inputUnitId != null and terms.inputUnitId !=''">
+                    and a.input_unit_id = #{terms.inputUnitId}
+                </if>
+                <if test="terms.inputUnitName != null and terms.inputUnitName !=''">
+                    and a.input_unit_name = #{terms.inputUnitName}
+                </if>
+                <if test="terms.visitTimeStart != null and terms.visitTimeStart !='' and terms.visitTimeEnd != null and terms.visitTimeEnd !=''">
+                    and (DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.visitTimeStart}
+                    and DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.visitTimeEnd})
+                </if>
+                <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
+                    and (DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.createStart}
+                    and DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.createEnd})
+                </if>
+                <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
+                    and (DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.closeStart}
+                    and DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.closeEnd})
+                </if>
+                <if test="terms.fileStart != null and terms.fileStart !='' and terms.fileEnd != null and terms.fileEnd !=''">
+                    and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart}
+                    and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd})
+                </if>
+                <if test="terms.queProv != null and terms.queProv !=''">
+                    and a.que_prov = #{terms.queProv}
+                </if>
+                <if test="terms.queCity != null and terms.queCity !=''">
+                    and a.que_city = #{terms.queCity}
+                </if>
+                <if test="terms.queArea != null and terms.queArea !=''">
+                    and a.que_area = #{terms.queArea}
+                </if>
+                <if test="terms.queRoad != null and terms.queRoad !=''">
+                    and a.que_road = #{terms.queRoad}
+                </if>
+                <if test="terms.isArea != null and terms.isArea !=''">
+                    and a.que_city is not null
+                </if>
+            </where>
         </if>
     </sql>
     <!-- 条件 -->
@@ -659,4 +678,76 @@
         limit #{page.offset}, #{page.size}
     </select>
 
+    <!--  统计分析(区域)  -->
+    <select id="statisticsArea" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsAreaDTO">
+        SELECT
+        <if test="terms.areaType == null or terms.areaType ==''">
+            a.que_area as areaCode,a.que_area_name as areaName,
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="1"'>
+            a.que_area as areaCode,a.que_area_name as areaName,
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="2"'>
+            a.que_road as areaCode,a.que_road_name as areaName,
+        </if>
+        count(1) as caseNum,
+        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
+        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum
+        FROM
+        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        <include refid="where-part-all"/>
+        <if test="terms.areaType == null or terms.areaType ==''">
+            group by a.que_area
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="1"'>
+            group by a.que_area
+        </if>
+        <if test='terms.areaType != null and terms.areaType =="2"'>
+            group by a.que_road
+        </if>
+
+    </select>
+    <!--  统计分析(基础)  -->
+    <select id="statisticsBase" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsBaseDTO">
+        SELECT
+        count(1) as totalNum,
+        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
+        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum,
+        sum(case when a.case_level = 1 then 1 else 0 end) as oneLevelNum,
+        sum(case when a.case_level = 2 then 1 else 0 end) as twoLevelNum,
+        sum(case when a.case_level = 3 then 1 else 0 end) as threeLevelNum,
+        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as processNum,
+        sum(case when a.info_process = 3 then 1 else 0 end) as finishNum,
+        sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
+        FROM
+        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        <include refid="where-part-all"/>
+    </select>
+    <!--  统计分析(类型)  -->
+    <select id="statisticsType" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
+        SELECT
+        a.case_type as caseType,a.case_type_name as caseTypeName,count(1) as caseNum
+        FROM
+        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        <include refid="where-part-all"/>
+        group by a.case_type
+    </select>
+
+    <!--  统计分析(来源)  -->
+    <select id="statisticsSource" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsSourceDTO">
+        SELECT
+        a.canal,a.canal_name as canalName,count(1) as caseNum,
+        sum(case when b.medi_result = '22_00025-1' then 1 else 0 end) as resolveNum,
+        sum(case when b.medi_result is null and a.info_process <![CDATA[ < ]]> 4 then 1 else 0 end) as resolveingNum,
+        sum(case when b.medi_result = '22_00025-2' then 1 else 0 end) as unResolveNum,
+        sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
+        FROM
+        dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
+        <include refid="where-part-all"/>
+        group by a.canal
+    </select>
+
+
 </mapper> 
\ No newline at end of file

--
Gitblit v1.8.0