(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,
(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,
(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,
(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,
(case when t1.city = '' or t1.city is null then '本级' else t1.city end)
(case when t1.area = '' or t1.area is null then '本级' else t1.area end)
(case when t1.road = '' or t1.road is null then '本级' else t1.road end)
(case when t1.village = '' or t1.village is null then '本级' else t1.village end)
and t3.sync_status = 0
and t3.input_way = 1
and t1.prov = #{terms.queProv}
and t1.city = #{terms.queCity}
and t1.area = #{terms.queArea}
and t1.road = #{terms.queRoad}
and t1.village = #{terms.queVillage}
and (t3.create_time = ]]> #{terms.createStart}
and t3.create_time #{terms.createEnd})
and (t4.close_time = ]]> #{terms.closeStart}
and t4.close_time #{terms.closeEnd})
and t3.case_type = #{terms.caseType}
and t3.case_type_first = #{terms.caseTypeFirst}
and t3.canal = #{terms.canal}
and t1.id in(${terms.unitIds})
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
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,
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
group by
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
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
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
and t1.prov = #{terms.queProv}
and t1.city = #{terms.queCity}
and t1.area = #{terms.queArea}
and t1.road = #{terms.queRoad}
and t1.village = #{terms.queVillage}
and t3.case_type = #{terms.caseType}
and t3.case_type_first = #{terms.caseTypeFirst}
and t3.canal = #{terms.canal}
and (DATE_FORMAT(t3.create_time,'%Y-%m-%d') = ]]> #{terms.createStart}
and DATE_FORMAT(t3.create_time,'%Y-%m-%d') #{terms.createEnd})
and t1.id in(${terms.unitIds})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
)
select
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
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
and (t2.audit_time = ]]> #{terms.closeStart}
and t2.audit_time #{terms.closeEnd})
) t1
group by
t1.delete_status = 0
and t2.delete_status = 0
and t3.delete_status = 0
and t3.sync_status = 0
and t3.input_way = 1
and t1.prov = #{terms.queProv}
and t1.city = #{terms.queCity}
and t1.area = #{terms.queArea}
and t1.road = #{terms.queRoad}
and t1.village = #{terms.queVillage}
and t3.case_type = #{terms.caseType}
and t3.case_type_first = #{terms.caseTypeFirst}
and (t3.create_time = ]]> #{terms.createStart}
and t3.create_time #{terms.createEnd})
and t3.canal = #{terms.canal}
and (t2.reply_time = ]]> #{terms.closeStart}
and t2.reply_time #{terms.closeEnd})
and t1.id in(${terms.unitIds})
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
and t2.sup_status = 1
select
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
and t2.sup_status = 1
group by
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
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
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
case_type_first_name as groupByType,
area_name as groupByType,
road_name as groupByType,
DATE_FORMAT(ci.create_time, '%Y-%m-%d') as groupByType,
DATE_FORMAT(ci.create_time, '%Y-%m') as groupByType,
DATE_FORMAT(ci.create_time, '%Y') as groupByType,
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
AND ci.create_time BETWEEN #{createStart} AND #{createEnd}
AND cui.close_time BETWEEN #{closeStart} AND #{closeEnd}
AND CI."case_type_first" = #{caseTypeFirst}
AND CI."case_type" = #{caseType}
AND unit.city = #{queCity}
AND unit.area = #{queArea}
AND unit.road = #{queRoad}
AND CI."process" == '6'
AND CI."process" != '6'
GROUP BY case_type_first_name
GROUP BY area_name
GROUP BY road_name
GROUP BY groupByType
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
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))
select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime,
(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
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))
isnull(${s.property}), ${s.property} ${s.direction}
order by isnull(t2.create_time), t2.create_time desc
limit #{page.offset}, #{page.size}
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
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) )
select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime,
(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
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))
isnull(${s.property}), ${s.property} ${s.direction}
order by isnull(t2.create_time), t2.create_time desc
limit #{page.offset}, #{page.size}
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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
select t2.case_id as caseId, t2.sup_time as turnaroundTime,
(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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
isnull(${s.property}), ${s.property} ${s.direction}
order by isnull(t2.sup_time), t2.sup_time desc
limit #{page.offset}, #{page.size}
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
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))
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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
)
select * from(
select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime,
(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
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))
union all
select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime,
(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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
)
isnull(${s.property}), ${s.property} ${s.direction}
order by isnull(t2.sup_time), t2.sup_time desc
limit #{page.offset}, #{page.size}
and t3.sync_status = 0
and t3.input_way = 1
and t1.prov = #{terms.queProv}
and t1.city = #{terms.queCity}
and t1.area = #{terms.queArea}
and t1.road = #{terms.queRoad}
and t1.village = #{terms.queVillage}
and t3.case_type = #{terms.caseType}
and t3.case_type_first = #{terms.caseTypeFirst}
and t1.id in(${terms.unitIds})
and (t3.create_time = ]]> #{terms.createStart}
and t3.create_time #{terms.createEnd})
and t3.canal = #{terms.canal}
and (t2.close_time = ]]> #{terms.closeStart}
and t2.close_time #{terms.closeEnd})
select
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
group by
city_name as groupName
area_name as groupName
road_name as groupName
village_name as groupName
unit_name as groupName
city
area
road
village
village
id
select
city_name as name,
city as code,
'queCity' as region
area_name as name,
area as code,
'queArea' as region
road_name as name,
road as code,
'queRoad' as region
village_name as name,
village as code,
'queVillage' as region
village_name as name,
village as code,
'queVillage' as region
from dyh_ct_unit
where
delete_status = 0
and prov = #{terms.queProv}
and village_name is not null
and village_name != ''
and city = #{terms.queCity}
and village_name is not null
and village_name != ''
and area = #{terms.queArea}
and village_name is not null
and village_name != ''
and road = #{terms.queRoad}
and village_name is not null
and village_name != ''
and village = #{terms.queVillage}
and id in(${terms.unitIds})
group by
select
from dyh_ct_unit
where
delete_status = 0
and prov = #{terms.queProv}
and village_name is not null
and village_name != ''
and city = #{terms.queCity}
and village_name is not null
and village_name != ''
and area = #{terms.queArea}
and village_name is not null
and village_name != ''
and road = #{terms.queRoad}
and village_name is not null
and village_name != ''
and village = #{terms.queVillage}
and id in(${terms.unitIds})
group by
SELECT id
FROM dyh_ct_unit
START WITH id = #{unitId}
CONNECT BY PRIOR id = parent_id;
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
(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,
(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,
(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,
(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,
(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,
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
and t3.prov = #{terms.queProv}
and t3.city = #{terms.queCity}
and t3.area = #{terms.queArea}
and t3.road = #{terms.queRoad}
and t3.village = #{terms.queVillage}
and (t1.create_time = ]]> #{terms.createStart}
and t1.create_time #{terms.createEnd})
and (t2.close_time = ]]> #{terms.closeStart}
and t2.close_time #{terms.closeEnd})
and t1.case_type = #{terms.caseType}
and t1.case_type_first = #{terms.caseTypeFirst}
and t3.id in(${terms.unitIds})
and t2.mediate_unit_id = #{terms.mediateUnitId}
and t2.assist_unit_id = #{terms.assistUnitId}
group by
(case when t3.city_name = '' or t3.city_name is null then '本级' else t3.city_name end)
(case when t3.area_name = '' or t3.area_name is null then '本级' else t3.area_name end)
(case when t3.road_name = '' or t3.road_name is null then '本级' else t3.road_name end)
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)
(case when t3.village_name = '' or t3.village_name is null then '本级' else t3.village_name end)
(case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)
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
and t3.prov = #{terms.queProv}
and t3.city = #{terms.queCity}
and t3.area = #{terms.queArea}
and t3.road = #{terms.queRoad}
and t3.village = #{terms.queVillage}
and t3.id in (${terms.unitId})
and (t1.create_time = ]]> #{terms.createStart}
and t1.create_time #{terms.createEnd})
and (t2.close_time = ]]> #{terms.closeStart}
and t2.close_time #{terms.closeEnd})
and t1.case_type = #{terms.caseType}
and t1.case_type_first = #{terms.caseTypeFirst}
and t2.mediate_unit_id = #{terms.mediateUnitId}
and t2.assist_unit_id = #{terms.assistUnitId}
group by t1.case_type_first_name order by count(t1.case_type_first_name) desc limit 3
select id from dyh_ct_unit
where delete_status = 0
and (unit_type = 101 or unit_type = 103)
and prov = #{terms.queProv}
and city = #{terms.queCity}
and area = #{terms.queArea}
and road = #{terms.queRoad}
and village = #{terms.queVillage}
and id in (${terms.unitId})
order by unit_grade asc limit 1
select
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
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
order by quantity asc
select
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
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
order by quantity asc
select
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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
group by
order by quantity asc
select
groupName,
groupCode,
sum(zs) as quantity
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
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
union all
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
and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
group by
)t1 group by
order by quantity asc
SELECT name
FROM dyh_sy_region
WHERE
level = 2
level = 3
and parent_id = #{terms.queArea}
ORDER BY level ASC,create_time ASC
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
and t3.zxsl_status = 1
and t3.zxsl_status = 0 and t4.node_id in ('JAGD','BLFK', 'JASH', 'JASH_EJ', 'JASH_YJ')
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'))
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')
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
and t3.zxsl_status = 1
and t3.zxsl_status = 0 and t4.node_id in ('JAGD','BLFK', 'JASH', 'JASH_EJ', 'JASH_YJ')
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'))
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')
isnull(${s.property}), ${s.property} ${s.direction}
order by isnull(t3.create_time), t3.create_time desc
limit #{page.offset}, #{page.size}