@ -243,78 +243,280 @@
ORDER BY a.sort
</select>
<select id= "getScreenExportData" resultType= "com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO" >
SELECT a.id AS deptId,
a.`name` AS deptName,
a.pid,
a.pids,
a.type_key AS deptLevel,
a.sort AS deptSort,
IFNULL(SUM(b.eventCount), 0) AS 'eventCount',
IFNULL(SUM(b.closedCount), 0) AS 'closedCount',
IFNULL(SUM(b.livelihoodCount), 0) AS 'livelihoodCount',
IFNULL(SUM(b.developCount), 0) AS 'developCount',
IFNULL(SUM(b.lawCount), 0) AS 'lawCount',
IFNULL(SUM(b.responseCount), 0) AS 'responseCount'
<select id= "getSatisfiedInfo" resultType= "com.elink.esua.epdc.dto.item.result.EvaluationInfoResultDTO"
parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
SELECT
a.id AS deptId,
IFNULL(SUM(b.value), 0) AS value,
concat(ROUND(IFNULL(SUM(b.value) / SUM(b.total) * 100 , 0) ,1 ),'%') as proportion
FROM meta_sys_dept a
LEFT JOIN (
SELECT a.ALL_DEPT_IDS,
COUNT(a.ID) AS 'eventCount',
CASE WHEN a.ITEM_STATE = '10' THEN COUNT(a.ID) END AS 'closedCount',
CASE a.PEOPLE_FLAG WHEN '0' THEN COUNT(a.ID) END AS 'livelihoodCount',
CASE a.PEOPLE_FLAG WHEN '1' THEN COUNT(a.ID) END AS 'developCount',
CASE a.PEOPLE_FLAG WHEN '2' THEN COUNT(a.ID) END AS 'lawCount',
COUNT(c.ITEM_ID) AS 'responseCount'
FROM epdc_item a
left join (
select
item.ALL_DEPT_IDS,
count((item.EVALUATION_SCORE = 1 or item.EVALUATION_SCORE = 2) or null) as value,
count(item.ID) as total
from epdc_item item
where item.DEL_FLAG = '0'
and item.IS_PEOPLE = '1'
and item.EVENT_ID is null
and item.ISSUE_ID is null
and item.EVALUATION_SCORE is not null
and ((SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他' and item.PEOPLE_FLAG = '0') or (item.PEOPLE_FLAG in ('1','2')))
<if test= '"1" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{statDate}
</if>
<if test= '"2" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"3" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"4" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') > = #{startDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{endDate}
</if>
<if test= "peopleFlag != null and peopleFlag != ''" >
AND item.PEOPLE_FLAG = #{peopleFlag}
</if>
GROUP BY item.ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
<if test= "deptId != null and deptId != ''" >
AND a.pid = #{deptId}
</if>
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
<select id= "getOnTimeDealInfo" resultType= "com.elink.esua.epdc.dto.item.result.OnTimeDealInfoResultDTO"
parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
SELECT
a.id AS deptId,
IFNULL(SUM(b.value), 0) AS value,
concat(ROUND(IFNULL(SUM(b.value) / SUM(b.total) * 100 , 0) ,1 ),'%') as proportion
FROM meta_sys_dept a
left join (
SELECT
item.ALL_DEPT_IDS,
count(item.ID) as total,
count((getworkminute(item.CREATED_TIME,process.CREATED_TIME) / 60 < = 8) or null) value
FROM epdc_item item
left join (
select b.ID,b.ITEM_ID,b.CREATED_TIME,b.state
from epdc_item_handle_process b
where b.DEL_FLAG = '0'
and b.CREATED_TIME = (
SELECT
min(CREATED_TIME)
from epdc_item_handle_process
where b.ITEM_ID = ITEM_ID
and DEL_FLAG = '0'
and HANDLER_DEPT = '网格化平台'
)
) process on process.ITEM_ID = item.ID
where item.DEL_FLAG = '0'
and item.ITEM_STATE = '10'
and item.IS_PEOPLE = '1'
and item.EVENT_ID is null
and item.ISSUE_ID is null
and item.EVALUATION_SCORE is not null
and ((SUBSTRING_INDEX(item.CATEGORY_FULL_NAME,'-',1) != '其他' and item.PEOPLE_FLAG = '0') or (item.PEOPLE_FLAG in ('1','2')))
<if test= '"1" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{statDate}
</if>
<if test= '"2" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"3" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"4" == statType' >
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') > = #{startDate}
AND DATE_FORMAT(item.CREATED_TIME, '%Y-%m-%d') < = #{endDate}
</if>
<if test= "peopleFlag != null and peopleFlag != ''" >
AND item.PEOPLE_FLAG = #{peopleFlag}
</if>
GROUP BY item.ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
<if test= "deptId != null and deptId != ''" >
AND a.pid = #{deptId}
</if>
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
<select id= "getYellowRedInfo" resultType= "com.elink.esua.epdc.dto.item.result.YellowRedInfoResultDTO"
parameterType="com.elink.esua.epdc.dto.screen.form.EventStatisticsFormDTO">
SELECT
a.id AS deptId,
IFNULL(SUM(b.redNum), 0) AS redNum,
IFNULL(SUM(b.yellowNum), 0) AS yellowNum
FROM meta_sys_dept a
left join (
SELECT
aa.ALL_DEPT_IDS,
sum((case when bb.handleId is null and aa.item_state='0' and getworkminute(aa.created_time, now()) > 480 then 1 else 0 end)) redNum,
sum((case when bb.handleId is null and aa.item_state = '0' and (getworkminute(aa.created_time, now()) BETWEEN 360 and 480) then 1 else 0 end))yellowNum
FROM epdc_item aa
LEFT JOIN (
select h.id,h.item_id,h.created_time,h.state,p.id as handleId
from epdc_item ei
inner join epdc_item_handle_process h on ei.id = h.item_id
LEFT JOIN (
SELECT h.id,
h.item_id,
h.created_time,
h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1'
AND ei.del_flag = '0'
AND ei.event_id IS NULL
AND ei.issue_id IS NULL
AND h.del_flag = '0'
AND h.created_time = (SELECT max(created_time)
FROM epdc_item_handle_process
WHERE h.item_id = item_id AND del_flag = '0')
AND h.STATE != 1001
GROUP BY h.item_id
ORDER BY h.item_id
) c ON c.ITEM_ID = a.ID
WHERE a.DEL_FLAG = '0'
AND a.PEOPLE_FLAG IS NOT NULL
AND a.IS_PEOPLE = '1'
AND a.EVENT_ID is null
AND a.ISSUE_ID is null
<if test= '"1" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{statDate}
</if>
<if test= '"2" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"3" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"4" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') > = #{startDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{endDate}
</if>
<if test= "mobile != null and mobile != ''" >
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
<if test= "category != null and category != ''" >
AND a.CATEGORY_FULL_CODE LIKE CONCAT('%', #{category}, '%')
</if>
<if test= "evaluationScore != null and evaluationScore != ''" >
AND a.EVALUATION_SCORE = #{category}
</if>
GROUP BY ALL_DEPT_IDS
select id,item_id FROM epdc_item_handle_process where handler_dept = '网格化平台' and del_flag = '0' group by item_id
) p ON ei.id = p.item_id
where ei.is_people = '1'
and ei.del_flag = '0'
AND ei.event_id is NULL
AND ei.issue_id is NULL
and h.del_flag = '0'
and h.created_time = (
select max(created_time)
from epdc_item_handle_process
where h.item_id = item_id
and del_flag = '0'
)
GROUP BY h.item_id
)bb ON aa.id = bb.item_id
WHERE aa.is_people = '1'
AND aa.del_flag = '0'
AND aa.event_id is NULL
AND aa.issue_id is NULL
<if test= '"1" == statType' >
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') < = #{statDate}
</if>
<if test= '"2" == statType' >
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"3" == statType' >
AND DATE_FORMAT(aa.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"4" == statType' >
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') > = #{startDate}
AND DATE_FORMAT(aa.CREATED_TIME, '%Y-%m-%d') < = #{endDate}
</if>
<if test= "peopleFlag != null and peopleFlag != ''" >
AND aa.PEOPLE_FLAG = #{peopleFlag}
</if>
GROUP BY aa.ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
<if test= "deptId != null and deptId != ''" >
AND a.pid = #{deptId}
</if>
AND a.type_key != 'street_dept'
AND a.type_key != 'district_dept'
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
<select id= "getScreenExportData" resultType= "com.elink.esua.epdc.dto.screen.result.EventStatisticsResultDTO" >
SELECT
a.id AS deptId,
a.`name` AS deptName,
a.pid,
a.pids,
a.type_key AS deptLevel,
a.sort AS deptSort,
IFNULL(SUM(b.eventCount), 0) AS 'eventCount',
IFNULL(SUM(b.closedCount), 0) AS 'closedCount',
CONCAT(ROUND(IFNULL(SUM(b.closedCount) / SUM(b.eventCount) * 100,0),1),'%') as closedRatio,
IFNULL(SUM(b.livelihoodCount), 0) AS 'livelihoodCount',
IFNULL(SUM(b.developCount), 0) AS 'developCount',
IFNULL(SUM(b.lawCount), 0) AS 'lawCount',
IFNULL(SUM(b.responseCount), 0) AS 'responseCount',
CONCAT(ROUND(IFNULL(SUM(b.responseCount) / SUM(b.eventCount) * 100,0),1),'%') as responseRatio,
IFNULL(SUM(b.unAcceptCount), 0) AS 'unAcceptCount',
IFNULL(SUM(b.gridCommunityDealNum), 0) AS 'gridCommunityDealNum'
FROM meta_sys_dept a
LEFT JOIN (
SELECT
a.ALL_DEPT_IDS,
COUNT(a.ID) AS 'eventCount',
CASE WHEN a.ITEM_STATE = '10' THEN COUNT(a.ID) END AS 'closedCount',
CASE a.PEOPLE_FLAG WHEN '0' THEN COUNT(a.ID) END AS 'livelihoodCount',
CASE a.PEOPLE_FLAG WHEN '1' THEN COUNT(a.ID) END AS 'developCount',
CASE a.PEOPLE_FLAG WHEN '2' THEN COUNT(a.ID) END AS 'lawCount',
COUNT(c.ITEM_ID) AS 'responseCount',
COUNT(d.ITEM_ID) AS 'unAcceptCount',
COUNT(e.ITEM_ID) AS 'gridCommunityDealNum'
FROM epdc_item a
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.created_time = (SELECT max(created_time) FROM epdc_item_handle_process WHERE h.item_id = item_id AND del_flag = '0')
AND h.STATE != 1001
GROUP BY h.item_id
ORDER BY h.item_id
) c ON c.ITEM_ID = a.ID
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.HANDLE_ADVICE like '%您反映的诉求属于不予受理情形中的%'
GROUP BY h.item_id
ORDER BY h.item_id
) d ON d.ITEM_ID = a.ID
LEFT JOIN (
SELECT h.id, h.item_id, h.created_time, h.state
FROM epdc_item ei
INNER JOIN epdc_item_handle_process h ON ei.id = h.item_id
WHERE ei.is_people = '1' AND ei.del_flag = '0' AND ei.event_id IS NULL AND ei.issue_id IS NULL AND h.del_flag = '0'
AND h.STATE = '11'
GROUP BY h.item_id
ORDER BY h.item_id
) e ON e.ITEM_ID = a.ID
WHERE a.DEL_FLAG = '0'
AND a.PEOPLE_FLAG IS NOT NULL
AND a.IS_PEOPLE = '1'
AND a.EVENT_ID is null
AND a.ISSUE_ID is null
<if test= '"1" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{statDate}
</if>
<if test= '"2" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"3" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y') = #{statDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{startDate}
</if>
<if test= '"4" == statType' >
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') > = #{startDate}
AND DATE_FORMAT(a.CREATED_TIME, '%Y-%m-%d') < = #{endDate}
</if>
<if test= "mobile != null and mobile != ''" >
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
<if test= "category != null and category != ''" >
AND a.CATEGORY_FULL_CODE LIKE CONCAT('%', #{category}, '%')
</if>
<if test= "evaluationScore != null and evaluationScore != ''" >
AND a.EVALUATION_SCORE = #{category}
</if>
GROUP BY ALL_DEPT_IDS
) b ON b.ALL_DEPT_IDS LIKE CONCAT('%', a.id, '%')
WHERE a.del_flag = '0'
AND a.pid = #{deptId}
@ -323,4 +525,4 @@
GROUP BY a.id
ORDER BY a.sort, CONVERT(a.`name` USING gbk) ASC
</select>
</mapper>
</mapper>