LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '960' and t1.call_time between #{startDate} and #{endDate}) as trappedNum,
(SELECT count(1) FROM
tz_alert_called t1
LEFT JOIN idx_biz_jg_use_info t2 ON t1.equipment_id = t2.RECORD WHERE t2.USE_PLACE = #{placeCode} and t1.alarm_type_code = '961' and t1.call_time between #{startDate} and #{endDate}) as faultNum
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate})
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960')
and org_type_code = 'levelOneUnit') as levelOne,
(select count(1)
from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate})
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960')
and org_type_code = 'levelTwoUnit') as levelTwo,
(select count(1)
from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate})
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960')
and org_type_code = '953') as levelThree,
(select count(DISTINCT (response_org_id))
from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate})
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960')
and org_type_code = 'levelOneUnit') as maintenanceUnit,
(select count(1)
from tz_dispatch_task
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate})
where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960')
and org_type_code = 'levelOneUnit'
and date_part('minute', arrive_time - rec_date) < 30) as lessNum,
(SELECT sum(times) from (SELECT date_part('second', arrive_time - rec_date)as times from tz_dispatch_task where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate}) and org_type_code = 'levelOneUnit')) as avgNum
(SELECT sum(times) from (SELECT date_part('second', arrive_time - rec_date)as times from tz_dispatch_task where alert_id in (SELECT sequence_nbr from tz_alert_called where biz_org_code like concat(#{orgCode}, '%') and call_time BETWEEN #{startDate} and #{endDate} and alarm_type_code = '960') and org_type_code = 'levelOneUnit')) as avgNum