(t.itemCloseTotal - t.itemUnsatisfactoryTotal), 0) as satisfactionRatioFz,
IFNULL(t.itemCloseTotal,0) as satisfactionRatioFm
from (
select
DATE_FORMAT(STR_TO_DATE(#{yearMonth, jdbcType=VARCHAR}, '%Y'),'%Y') AS yearId,
@ -1499,8 +1497,7 @@ select gr.id as orgId,
)t
) projectTotal,
(select count(*) itemCloseTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.ITEM_STATE = 10 GROUP BY `EVENT_ID`) itemCloseTotal,
(select count(*) itemUnsatisfactoryTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 0 GROUP BY `EVENT_ID`) itemUnsatisfactoryTotal,
(select count(*) itemVeryTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 GROUP BY `EVENT_ID`) itemVeryTotal
(select count(*) itemUnsatisfactoryTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 0 GROUP BY `EVENT_ID`) itemUnsatisfactoryTotal
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
) itemUnsatisfactoryTotal on itemUnsatisfactoryTotal.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
(select GRID_ID,count(itemNum)itemNum FROM( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 0 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemUnsatisfactoryTotal on itemUnsatisfactoryTotal.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( SELECT GRID_ID,count(itemNum)itemNum from( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
left join (select count(*) partyNum,uu.DEPT_ID from esua_epdc_user.epdc_user uu where uu.DEL_FLAG = '0' and uu.PARTY_FLAG = '1' group by uu.DEPT_ID) user on user.DEPT_ID = sd.ID
left join (
@ -1844,7 +1824,6 @@ select gr.id as orgId,
) itemCount on itemCount.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 0 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemUnsatisfactoryTotal on itemUnsatisfactoryTotal.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID