<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!--
|
* @title: 纠纷信息主表
|
* @description: 自定义sql,请自行实现业务逻辑
|
* @company: hugeinfo
|
* @author: wangwh
|
* @time:2024-08-27 10:00:57
|
* @version 1.0.0
|
-->
|
<mapper namespace="cn.huge.module.analysis.dao.mapper.AnalysisMapper">
|
|
<!-- 分组查询字段 -->
|
<sql id="selectPart">
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
(case when t1.city_name = '' or t1.city_name is null then '本级' else t1.city_name end)as groupName,
|
t1.city as groupCode,
|
t1.city,
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
(case when t1.area_name = '' or t1.area_name is null then '本级' else t1.area_name end)as groupName,
|
t1.area as groupCode,
|
t1.area,
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
(case when t1.road_name = '' or t1.road_name is null then '本级' else t1.road_name end)as groupName,
|
t1.road as groupCode,
|
t1.road,
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
(case when t1.village_name = '' or t1.village_name is null then '本级' else t1.village_name end)as
|
groupName,
|
t1.village as groupCode,
|
t1.village,
|
</if>
|
<!-- <if test="terms.unitIds != null and terms.unitIds !=''">-->
|
<!-- t1.unit_name as groupName,-->
|
<!-- </if>-->
|
</if>
|
</sql>
|
|
<!-- 分组字段 -->
|
<sql id="groupPart">
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
(case when t1.city = '' or t1.city is null then '本级' else t1.city end)
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
(case when t1.area = '' or t1.area is null then '本级' else t1.area end)
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
(case when t1.road = '' or t1.road is null then '本级' else t1.road end)
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
(case when t1.village = '' or t1.village is null then '本级' else t1.village end)
|
</if>
|
<!-- <if test="terms.unitIds != null and terms.unitIds !=''">-->
|
<!-- t1.id-->
|
<!-- </if>-->
|
</if>
|
</sql>
|
|
<!-- 条件 -->
|
<sql id="statisticsAVG-wherePart">
|
and t3.sync_status = 0
|
and t3.input_way = 1
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t1.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t1.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t1.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t1.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t1.village = #{terms.queVillage}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (t3.create_time <![CDATA[ >= ]]> #{terms.createStart}
|
and t3.create_time <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t4.close_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t4.close_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t3.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t3.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t3.canal = #{terms.canal}
|
</if>
|
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t1.id in(${terms.unitIds})
|
</if>
|
|
</if>
|
</sql>
|
|
<!-- 统计任务平均时长 -->
|
<select id="statisticsAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO">
|
select AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id =
|
'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
|
AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
|
AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND,
|
t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
</select>
|
|
<!-- 分组统计任务平均时长 -->
|
<select id="statisticsGroupAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
|
select
|
<include refid="selectPart"/>
|
AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
|
count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and t2.status = 2 then t2.id end) as fps,
|
AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
|
count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and t2.status = 2 then t2.id end) as sls,
|
AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND,
|
t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz,
|
count(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then t2.id end) as bls
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
group by
|
<include refid="groupPart"/>
|
</select>
|
|
<!-- 分组统计任务 -->
|
<select id="statisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
|
select
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as
|
fpcs,
|
count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as
|
slcs
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
fpcs,
|
count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
slcs
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
fpcs,
|
count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
slcs
|
</if>
|
|
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
</select>
|
|
<!-- 首页-统计超时任务 -->
|
<select id="homeStatisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
|
select
|
count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
fpcs,
|
count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
|
slcs
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
</select>
|
|
<!-- 条件 -->
|
<sql id="statisticsApplyAVG-wherePart">
|
and t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
and t3.sync_status = 0
|
and t3.input_way = 1
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t1.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t1.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t1.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t1.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t1.village = #{terms.queVillage}
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t3.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t3.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t3.canal = #{terms.canal}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (DATE_FORMAT(t3.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createStart}
|
and DATE_FORMAT(t3.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t1.id in(${terms.unitIds})
|
</if>
|
</sql>
|
|
<!-- 统计审批平均时长 -->
|
<select id="statisticsApplyAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO">
|
select avg(usetime_hour) as sp
|
from
|
(
|
select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour
|
from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour
|
from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour
|
from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.return_status = 1
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour
|
from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
)
|
</select>
|
|
<!-- 分组统计审批平均时长 -->
|
<select id="statisticsApplyGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
|
select
|
<include refid="selectPart"/>
|
avg(usetime_hour) as sp,
|
count(distinct ownerId) as sps
|
from
|
(
|
select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId,
|
t1.*
|
from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1 and t2.audit_time != t2.appear_time
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
|
from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1 and t2.audit_time != t2.apply_time
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId,
|
t1.*
|
from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.return_status = 1 and t2.audit_time!= t2.return_time
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
union all
|
select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
|
from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where t2.apply_status = 1 and t2.audit_time != t2.apply_time
|
<if test="terms != null">
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.audit_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.audit_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<include refid="statisticsApplyAVG-wherePart"/>
|
</if>
|
) t1
|
group by
|
<include refid="groupPart"/>
|
</select>
|
|
<!-- 条件 -->
|
<sql id="statisticsSuperviseAVG-wherePart">
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
and t3.sync_status = 0
|
and t3.input_way = 1
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t1.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t1.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t1.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t1.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t1.village = #{terms.queVillage}
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t3.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t3.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (t3.create_time <![CDATA[ >= ]]> #{terms.createStart}
|
and t3.create_time<![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t3.canal = #{terms.canal}
|
</if>
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.reply_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.reply_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t1.id in(${terms.unitIds})
|
</if>
|
|
</sql>
|
|
<!-- 统计督办平均时长 -->
|
<select id="statisticsSuperviseAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO">
|
select AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
and t2.sup_status = 1
|
</select>
|
|
<!-- 分组统计督办平均时长 -->
|
<select id="statisticsSuperviseGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
|
select
|
<include refid="selectPart"/>
|
AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db, count(case when sup_status = 1 then
|
t2.id end ) as hfs
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
and t2.sup_status = 1
|
group by
|
<include refid="groupPart"/>
|
</select>
|
|
<!-- 分组查询超时数量 -->
|
<select id="statisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
|
select
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
count(case when (t2.overtime_status = '1') then t2.id end) as dbcs
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
count(case when (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) then t2.id end) as dbcs
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or
|
(t2.overtime_status = '1')) then t2.id end) as dbcs
|
</if>
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
</select>
|
|
<!-- 首页-查询超时数量 -->
|
<select id="homeStatisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
|
select
|
count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or
|
(t2.overtime_status = '1')) then t2.id end) as dbcs
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
|
t2.case_id = t3.id
|
where
|
<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 ci.delete_status = 0 AND ci.process = 6
|
<if test="createStart != null and createStart != '' and createEnd != null and createEnd != ''">
|
AND ci.create_time BETWEEN #{createStart} AND #{createEnd}
|
</if>
|
<if test="closeStart != null and closeStart != '' and closeEnd != null and closeEnd != ''">
|
AND cui.close_time BETWEEN #{closeStart} AND #{closeEnd}
|
</if>
|
<if test="caseTypeFirst != null and caseTypeFirst != ''">
|
AND CI."case_type_first" = #{caseTypeFirst}
|
</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>
|
|
<!-- 查询分派超时案件统计 -->
|
<select id="countFPQuantity" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
</select>
|
|
<!-- 查询分派超时案件 -->
|
<select id="listFPQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
|
select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName,
|
(case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
|
(case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
|
timeLimit,
|
t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
|
concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
|
concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
|
(select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(t2.create_time), t2.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 查询签收超时案件统计 -->
|
<select id="countSLQuantity" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and
|
(t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
</select>
|
|
<!-- 查询受理超时案件 -->
|
<select id="listSLQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
|
select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime, t2.node_name as nodeName,
|
(case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
|
(case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
|
timeLimit,
|
t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
|
concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
|
concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
|
(select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and
|
(t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(t2.create_time), t2.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 查询督办超时案件统计 -->
|
<select id="countDBQuantity" resultType="java.lang.Long">
|
select
|
COUNT(1)
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = '1')
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
|
</if>
|
</select>
|
|
<!-- 查询督办超时案件 -->
|
<select id="listDBQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
|
select t2.case_id as caseId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, t2.sup_status as taskStatus,
|
(case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term,
|
t2.sup_time), sysdate) end) as timeLimit,
|
t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
|
concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
|
concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
|
(select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = '1')
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
|
</if>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(t2.sup_time), t2.sup_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
|
<!-- 查询督办超时案件统计 -->
|
<select id="countAllQuantity" resultType="java.lang.Long">
|
select sum(zs)
|
from(
|
select
|
COUNT(1) as zs
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
union
|
select
|
COUNT(1) as zs
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = '1')
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status =
|
'1'))
|
</if>)
|
</select>
|
|
<!-- 查询督办超时案件 -->
|
<select id="listAllQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
|
select * from(
|
select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName,
|
(case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
|
(case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
|
timeLimit,
|
t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
|
concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
|
concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
|
(select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and ((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = 1 and t2.status = 2)
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > expire_time and t2.status = 1)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
</if>
|
union all
|
select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime, '督办回复' as nodeName,
|
t2.sup_status as taskStatus,
|
(case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term,
|
t2.sup_time), sysdate) end) as timeLimit,
|
t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
|
concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
|
concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
|
(select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
<if test="terms.taskStatus != null and terms.taskStatus == 1 ">
|
and (t2.overtime_status = '1')
|
</if>
|
<if test="terms.taskStatus != null and terms.taskStatus == 0">
|
and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
|
</if>
|
<if test="terms.taskStatus == null or terms.taskStatus ==''">
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status =
|
'1'))
|
</if>
|
)
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(t2.sup_time), t2.sup_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
|
</select>
|
|
<sql id="statisticsCirculation-wherePart">
|
and t3.sync_status = 0
|
and t3.input_way = 1
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t1.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t1.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t1.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t1.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t1.village = #{terms.queVillage}
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t3.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t3.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t1.id in(${terms.unitIds})
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (t3.create_time <![CDATA[ >= ]]> #{terms.createStart}
|
and t3.create_time <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.canal != null and terms.canal !=''">
|
and t3.canal = #{terms.canal}
|
</if>
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.close_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.close_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
</if>
|
</sql>
|
|
<select id="statisticsCirculation" resultType="cn.huge.module.analysis.domain.dto.StatisticsCirculationDTO">
|
select
|
<include refid="selectPart"/>
|
count(distinct t3.id) as zdj,
|
count(distinct case when t3.zxsl_status = 1 then t4.id end) as zxsl,
|
count(distinct case when t3.zxsl_status = 0 and (t4.node_id = 'JAGD' or t4.node_id = 'BLFK'
|
or t4.node_id = 'JASH' or t4.node_id = 'JASH_EJ' or t4.node_id = 'JASH_YJ') then t4.id end) as lzsl,
|
-- count(distinct case when t3.zxsl_status = 0 and (((t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP'
|
-- or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL'
|
-- or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result !=3)
|
-- or t4.node_id = 'SJ_SBSH'
|
-- or t4.node_id = 'SJ_HTSH' or t4.node_id = 'QJ_HTSH' or t4.node_id = 'QJ_SBSH' or t4.node_id = 'ZJ_HTSH'
|
-- or t4.node_id = 'JASQ' or t4.node_id = 'HTSH'
|
-- ) then t4.id end) as lzz,
|
count(distinct case when (t3.zxsl_status = 0 and (t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP'
|
or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL'
|
or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result =3) then t4.id end) as bysl
|
from
|
dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
|
t2.id = t3.id
|
left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
|
FROM (
|
SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
|
ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY node_type desc, create_time DESC) AS rn
|
FROM dyh_case_task where node_id != 'DSRPJ' and delete_status = 0
|
) s
|
WHERE rn = 1
|
group by s.case_id) t4 on t2.id = t4.case_id
|
where t1.delete_status = 0 and t3.delete_status = 0
|
<include refid="statisticsCirculation-wherePart"/>
|
group by
|
<include refid="groupPart"/>
|
</select>
|
|
<!-- 分组查询字段 -->
|
<sql id="selectALLPart">
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
city_name as groupName
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
area_name as groupName
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
road_name as groupName
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
village_name as groupName
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
unit_name as groupName
|
</if>
|
</if>
|
</sql>
|
|
<!-- 分组字段 -->
|
<sql id="groupALLPart">
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
city
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
area
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
road
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
village
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
village
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
id
|
</if>
|
</if>
|
</sql>
|
|
<!-- 查询下属所有属地 -->
|
<select id="listSubordinateTerritory1" resultType="cn.huge.module.analysis.domain.dto.LevelGroupYYJDDTO">
|
select
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
city_name as name,
|
city as code,
|
'queCity' as region
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
area_name as name,
|
area as code,
|
'queArea' as region
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
road_name as name,
|
road as code,
|
'queRoad' as region
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
village_name as name,
|
village as code,
|
'queVillage' as region
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
village_name as name,
|
village as code,
|
'queVillage' as region
|
</if>
|
<!-- <if test="terms.unitIds != null and terms.unitIds !=''">-->
|
<!-- unit_name as name,-->
|
<!-- id as code-->
|
<!-- </if>-->
|
</if>
|
from dyh_ct_unit
|
where
|
delete_status = 0
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and prov = #{terms.queProv}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and city = #{terms.queCity}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and area = #{terms.queArea}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and road = #{terms.queRoad}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and village = #{terms.queVillage}
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and id in(${terms.unitIds})
|
</if>
|
group by
|
<include refid="groupALLPart"/>
|
</select>
|
|
<!-- 查询下属所有属地 -->
|
<select id="listSubordinateTerritory" resultType="string">
|
select
|
<include refid="selectALLPart"/>
|
from dyh_ct_unit
|
where
|
delete_status = 0
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and prov = #{terms.queProv}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and city = #{terms.queCity}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and area = #{terms.queArea}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and road = #{terms.queRoad}
|
and village_name is not null
|
and village_name != ''
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and village = #{terms.queVillage}
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and id in(${terms.unitIds})
|
</if>
|
group by
|
<include refid="groupALLPart"/>
|
</select>
|
|
<!-- 获取所有下属组织包括自己 -->
|
<select id="getAllParentUnit" resultType="string">
|
SELECT id
|
FROM dyh_ct_unit START WITH id = #{unitId}
|
CONNECT BY PRIOR id = parent_id;
|
</select>
|
|
<!-- 获取所有下属组织包括自己 -->
|
<select id="getAllDeptParentUnit" resultType="string">
|
SELECT id
|
FROM dyh_ct_unit START WITH id = #{unitId}
|
CONNECT BY PRIOR id = parent_id and unit_type != 101 and unit_type != 103;
|
</select>
|
|
<!-- 分组查询扬言极端数量 -->
|
<select id="statisticsYYJDQuantity" resultType="cn.huge.module.analysis.domain.dto.LevelGroupYYJDDTO">
|
select
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
(case when t3.city_name = '' or t3.city_name is null then '本级' else t3.city_name end)as name,
|
t3.city as code,
|
'queCity' as region,
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
(case when t3.area_name = '' or t3.area_name is null then '本级' else t3.area_name end)as name,
|
t3.area as code,
|
'queArea' as region,
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
(case when t3.road_name = '' or t3.road_name is null then '本级' else t3.road_name end)as name,
|
t3.road as code,
|
'queRoad' as region,
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)as name,
|
t3.village as code,
|
'queVillage' as region,
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)as name,
|
t3.village as code,
|
'queVillage' as region,
|
</if>
|
<!-- <if test="terms.unitIds != null and terms.unitIds !=''">-->
|
<!-- (case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)as name,-->
|
<!-- t3.id as code,-->
|
<!-- 'unitId' as region,-->
|
<!-- </if>-->
|
</if>
|
count(distinct t1.id) as total
|
FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
|
left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id
|
where
|
t2.is_risk = 1
|
and t1.delete_status = 0 and t3.delete_status = 0
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t3.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t3.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t3.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t3.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t3.village = #{terms.queVillage}
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (t1.create_time <![CDATA[ >= ]]> #{terms.createStart}
|
and t1.create_time <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.close_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.close_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t1.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t1.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
and t3.id in(${terms.unitIds})
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t2.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.assistUnitId != null and terms.assistUnitId !=''">
|
and t2.assist_unit_id = #{terms.assistUnitId}
|
</if>
|
</if>
|
group by
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
(case when t3.city_name = '' or t3.city_name is null then '本级' else t3.city_name end)
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
(case when t3.area_name = '' or t3.area_name is null then '本级' else t3.area_name end)
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
(case when t3.road_name = '' or t3.road_name is null then '本级' else t3.road_name end)
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)
|
</if>
|
<if test="terms.unitIds != null and terms.unitIds !=''">
|
(case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)
|
</if>
|
</if>
|
</select>
|
|
<!-- 获取所有下属组织包括自己 -->
|
<select id="listCaseTypeByRegion" resultType="string">
|
SELECT t1.case_type_first_name
|
FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
|
left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id
|
where t1.delete_status = 0
|
and t3.delete_status = 0
|
and t2.is_risk = 1
|
<if test="terms != null">
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and t3.prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and t3.city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and t3.area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and t3.road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and t3.village = #{terms.queVillage}
|
</if>
|
<if test="terms.unitId != null and terms.unitId !=''">
|
and t3.id in (${terms.unitId})
|
</if>
|
<if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
|
and (t1.create_time <![CDATA[ >= ]]> #{terms.createStart}
|
and t1.create_time <![CDATA[ <= ]]> #{terms.createEnd})
|
</if>
|
<if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
|
and (t2.close_time <![CDATA[ >= ]]> #{terms.closeStart}
|
and t2.close_time <![CDATA[ <= ]]> #{terms.closeEnd})
|
</if>
|
<if test="terms.caseType != null and terms.caseType !=''">
|
and t1.case_type = #{terms.caseType}
|
</if>
|
<if test="terms.caseTypeFirst != null and terms.caseTypeFirst !=''">
|
and t1.case_type_first = #{terms.caseTypeFirst}
|
</if>
|
<if test="terms.mediateUnitId != null and terms.mediateUnitId !=''">
|
and t2.mediate_unit_id = #{terms.mediateUnitId}
|
</if>
|
<if test="terms.assistUnitId != null and terms.assistUnitId !=''">
|
and t2.assist_unit_id = #{terms.assistUnitId}
|
</if>
|
</if>
|
group by t1.case_type_first_name order by count(t1.case_type_first_name) desc limit 3
|
</select>
|
|
<!-- 获取所有下属组织包括自己 -->
|
<select id="getZZZXUnitId" resultType="string">
|
select id from dyh_ct_unit
|
where delete_status = 0
|
and (unit_type = 101 or unit_type = 103)
|
<if test="terms.queProv != null and terms.queProv !=''">
|
and prov = #{terms.queProv}
|
</if>
|
<if test="terms.queCity != null and terms.queCity !=''">
|
and city = #{terms.queCity}
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
and area = #{terms.queArea}
|
</if>
|
<if test="terms.queRoad != null and terms.queRoad !=''">
|
and road = #{terms.queRoad}
|
</if>
|
<if test="terms.queVillage != null and terms.queVillage !=''">
|
and village = #{terms.queVillage}
|
</if>
|
<if test="terms.unitId != null and terms.unitId !=''">
|
and id in (${terms.unitId})
|
</if>
|
order by unit_grade asc limit 1
|
</select>
|
|
<!-- 分组查询分派超时案件统计 -->
|
<select id="countFPQuantityGroup" resultType="cn.huge.module.analysis.domain.dto.TimeOutTaskGroupDTO">
|
select
|
<include refid="selectPart"/>
|
COUNT(1) as quantity
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and
|
((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
group by
|
<include refid="groupPart"/>
|
order by quantity asc
|
</select>
|
|
<!-- 分组查询受理超时案件统计 -->
|
<select id="countSLQuantityGroup" resultType="cn.huge.module.analysis.domain.dto.TimeOutTaskGroupDTO">
|
select
|
<include refid="selectPart"/>
|
COUNT(1) as quantity
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and
|
(t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and
|
((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) )
|
group by
|
<include refid="groupPart"/>
|
order by quantity asc
|
</select>
|
|
<!-- 分组查询督办超时案件统计 -->
|
<select id="countDBQuantityGroup" resultType="cn.huge.module.analysis.domain.dto.TimeOutTaskGroupDTO">
|
select
|
<include refid="selectPart"/>
|
COUNT(1) as quantity
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
|
group by
|
<include refid="groupPart"/>
|
order by quantity asc
|
</select>
|
|
<!-- 分组查询全部类型案件超时统计 -->
|
<select id="countAllQuantityGroup" resultType="cn.huge.module.analysis.domain.dto.TimeOutTaskGroupDTO">
|
select
|
groupName,
|
groupCode,
|
sum(zs) as quantity
|
from(
|
select
|
<include refid="selectPart"/>
|
COUNT(1) as zs
|
from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
t1.delete_status = 0
|
and t2.delete_status = 0
|
and t3.delete_status = 0
|
<include refid="statisticsAVG-wherePart"/>
|
and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
|
or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
|
and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
|
group by
|
<include refid="groupPart"/>
|
union all
|
select
|
<include refid="selectPart"/>
|
COUNT(1) as zs
|
from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
|
left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
|
where
|
<include refid="statisticsSuperviseAVG-wherePart"/>
|
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
|
group by
|
<include refid="groupPart"/>
|
)t1 group by
|
<include refid="groupPart"/>
|
order by quantity asc
|
</select>
|
|
<!-- 获取所有下属区域 -->
|
<select id="listRegion" resultType="string">
|
SELECT name
|
FROM dyh_sy_region
|
WHERE
|
<if test="terms.queCity != null and terms.queCity !=''">
|
level = 2
|
</if>
|
<if test="terms.queArea != null and terms.queArea !=''">
|
level = 3
|
and parent_id = #{terms.queArea}
|
</if>
|
ORDER BY level ASC,create_time ASC
|
</select>
|
|
<resultMap id="dataResult-CasePageDTO" type="cn.huge.module.cases.domain.dto.CasePageDTO">
|
<result property="id" column="id"/>
|
<result property="status" column="status"/>
|
<result property="statusName" column="status_name"/>
|
<result property="canal" column="canal"/>
|
<result property="canalName" column="canal_name"/>
|
<result property="canalSecond" column="canal_second"/>
|
<result property="canalSecondName" column="canal_second_name"/>
|
<result property="caseLevel" column="case_level"/>
|
<result property="caseType" column="case_type"/>
|
<result property="caseTypeName" column="case_type_name"/>
|
<result property="caseTypeFirstName" column="case_type_first_name"/>
|
<result property="inputUnitId" column="input_unit_id"/>
|
<result property="inputUnitName" column="input_unit_name"/>
|
<result property="mediResult" column="medi_result"/>
|
<result property="mediResultName" column="medi_result_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="windupContent" column="windup_content"/>
|
<result property="createTime" column="create_time"/>
|
<result property="plaintiffs" column="plaintiffs"/>
|
<result property="defendants" column="defendants"/>
|
<result property="queCityName" column="que_city_name"/>
|
<result property="queAreaName" column="que_area_name"/>
|
<result property="queRoadName" column="que_road_name"/>
|
<result property="queVillageName" column="que_village_name"/>
|
<result property="caseTypeFirst" column="case_type_first"/>
|
<result property="caseTypeFirstName" column="case_type_first_name"/>
|
<result property="caseTaskId" column="caseTaskId"/>
|
<result property="visitTime" column="visit_time"/>
|
<result property="occurTime" column="occur_time"/>
|
<result property="addr" column="addr"/>
|
<result property="peopleNum" column="people_num"/>
|
<result property="amount" column="amount"/>
|
<result property="caseDes" column="case_des"/>
|
<result property="caseClaim" column="case_claim"/>
|
<result property="caseRef" column="case_ref"/>
|
<result property="majorStatus" column="major_status"/>
|
<result property="mediator" column="mediator"/>
|
<result property="isRisk" column="is_risk"/>
|
</resultMap>
|
|
<select id="countStatisticsCirculation" resultType="java.lang.Long">
|
select
|
count(1)
|
from
|
dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
|
t2.id = t3.id
|
left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
|
FROM (
|
SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
|
ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY node_type desc, create_time DESC) AS rn
|
FROM dyh_case_task where node_id != 'DSRPJ' and delete_status = 0
|
) s
|
WHERE rn = 1
|
group by s.case_id) t4 on t2.id = t4.case_id
|
where t1.delete_status = 0 and t3.delete_status = 0
|
<if test="terms.caseStatus != null and terms.caseStatus == 1">
|
and t3.zxsl_status = 1
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 2">
|
and t3.zxsl_status = 0 and t4.node_id in ('JAGD','BLFK', 'JASH', 'JASH_EJ', 'JASH_YJ')
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 3">
|
and t3.zxsl_status = 0
|
and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
|
and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ',
|
'HTSH'))
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 4">
|
and t3.zxsl_status = 0
|
and t4.handle_result = 3
|
and t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
|
</if>
|
<include refid="statisticsCirculation-wherePart"/>
|
</select>
|
|
<select id="listStatisticsCirculation" resultMap="dataResult-CasePageDTO">
|
select
|
t3.id,
|
t3.status,t3.status_name,t3.canal,t3.canal_name,t3.canal_second,t3.canal_second_name,t3.case_level,t3.case_type,
|
t3.case_type_name,t3.case_type_first_name,t3.input_unit_id,t3.input_unit_name,t3.create_time,t3.plaintiffs,t3.defendants,
|
IF(t1.city_name is null,t3.que_city_name,t1.city_name) as que_city_name,
|
IF(t1.area_name is null,t3.que_area_name,t1.area_name) as que_area_name,
|
IF(t1.road_name is null,t3.que_road_name,t1.road_name) as que_road_name,
|
IF(t1.village_name is null,t3.que_village_name,t1.village_name) as que_village_name,
|
t3.case_type_first,t3.case_type_first_name,t3.visit_time,t3.occur_time,t3.addr,t3.people_num,t3.amount,t3.case_des,
|
t3.case_claim,t3.case_ref,t3.major_status,
|
t2.mediator,t2.is_risk,t2.medi_result,t2.medi_result_name,t2.mediate_unit_id,t2.mediate_unit_name,t2.assist_unit_id,
|
t2.assist_unit_name,t2.close_time,t2.agree_type,t2.agree_type_name,t2.agree_content,t2.windup_content,
|
t4.id
|
from
|
dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
|
t2.id = t3.id
|
left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
|
FROM (
|
SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
|
ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY node_type desc, create_time DESC) AS rn
|
FROM dyh_case_task where node_id != 'DSRPJ' and delete_status = 0
|
) s
|
WHERE rn = 1
|
group by s.case_id) t4 on t2.id = t4.case_id
|
where t1.delete_status = 0 and t3.delete_status = 0
|
<if test="terms.caseStatus != null and terms.caseStatus == 1">
|
and t3.zxsl_status = 1
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 2">
|
and t3.zxsl_status = 0 and t4.node_id in ('JAGD','BLFK', 'JASH', 'JASH_EJ', 'JASH_YJ')
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 3">
|
and t3.zxsl_status = 0
|
and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
|
and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ',
|
'HTSH'))
|
</if>
|
<if test="terms.caseStatus != null and terms.caseStatus == 4">
|
and t3.zxsl_status = 0
|
and t4.handle_result = 3
|
and t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
|
</if>
|
<include refid="statisticsCirculation-wherePart"/>
|
<if test="page.sort != null">
|
<foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
|
isnull(${s.property}), ${s.property} ${s.direction}
|
</foreach>
|
</if>
|
<if test="page.sort == null">
|
order by isnull(t3.create_time), t3.create_time desc
|
</if>
|
limit #{page.offset}, #{page.size}
|
</select>
|
</mapper>
|