left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_img t2 on t1.EVENT_ID = t2.REFERENCE_ID and t1.DEL_FLAG = '0'
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_handle_process t3 on t3.ITEM_ID = t1.ID and t3.DEL_FLAG = '0' and t3.STATE = 10
when (t4.ID is not null and t1.STATE = 0 and t1.CREATED_TIME != (select min(t.CREATED_TIME) from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_handle_process t where t.DEL_FLAG = '0' and t1.ITEM_ID = t.ITEM_ID group by t.ITEM_ID)) then 'transfer'
when (t4.ID is null and t1.STATE = 0 and t1.CREATED_TIME != (select min(t.CREATED_TIME) from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_handle_process t where t.DEL_FLAG = '0' and t1.ITEM_ID = t.ITEM_ID group by t.ITEM_ID)) then 'response'
when (t1.STATE = 0 and t1.CREATED_TIME = (select min(t.CREATED_TIME) from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_handle_process t where t.DEL_FLAG = '0' and t1.ITEM_ID = t.ITEM_ID group by t.ITEM_ID)) then 'created'
from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_handle_process t1
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item_dept t4 on t4.ITEM_HANDLE_ID = t1.ID and t4.DEL_FLAG = '0'
left join <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_img t3 on t3.REFERENCE_ID = t.processId and t3.DEL_FLAG = '0'
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as
resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000')
as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
left join (select lin.* from (select * from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item order by id) lin
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
left join (select lin.* from (select * from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item order by id) lin
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
left join (select lin.* from (select * from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item order by id) lin
count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null) as resolvedNum,
ifnull(format(round(count((it.ITEM_STATE=5 or it.ITEM_STATE=10) or null)/count(it.id),4),4),'0.0000') as resolvedRatio,
ifnull(format(round(count((it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null)/count(it.id),4),4),'0.0000') as goodRatio,
count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as evaluateTotal,
count( (it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null) as goodTotal,
count( it.EVALUATION_SCORE=0 or null) as badTotal,
ifnull(format(round(count(it.EVALUATION_SCORE=0 or null)/count( (it.EVALUATION_SCORE=0 or it.EVALUATION_SCORE=1 or it.EVALUATION_SCORE=2) or null),4),4),'0.0000') as badRatio
left join (select lin.* from (select * from <includerefid="com.elink.esua.epdc.modules.common.dao.EpdcTableNameDao.tb_events"/>.epdc_item order by id) lin