sql+=" left join ( select t.depart_id , count(1) 'count' from ajh_rectification_info t where t.handle_result = 1 and t.rec_ord_report_date >='"+startDate+"' and t.rec_ord_report_date <='"+endDate+"' group by t.depart_id) aa on aa.depart_id = d.id";
// 隐患已处理
sql+=" left join ( select t.depart_id , count(1) 'count' from ajh_rectification_info t where t.handle_result = 3 and t.rec_ord_report_date >='"+startDate+"' and t.rec_ord_report_date <='"+endDate+"' group by t.depart_id) bb on bb.depart_id = d.id ";
//风险排查处理中
sql+=" left join ( select depart_id ,count(id) 'count' from danger_inspection_record where status<2 and report_date >= '"+startDate+" 00:00:00' and report_date <='"+endDate+" 23:59:59' group by depart_id ) cc on cc.depart_id = d.id";
//风险排查:已经处理
sql+=" left join ( select depart_id ,count(id) 'count' from danger_inspection_record where status=2 and report_date >= '"+startDate+" 00:00:00' and report_date <='"+endDate+" 23:59:59' group by depart_id ) dd on dd.depart_id = d.id";
//风险区域数量
sql+=" left join ( select depart_id ,count(id) 'count' from danger_level_manage group by depart_id ) ee on ee.depart_id = d.id";
//风险点数量
sql+=" left join ( select dlm.depart_id,count(dii.id) 'count' from danger_inspect_info dii left join danger_level_manage dlm on dii.danger_id = dlm.id group by dlm.depart_id ) ff on ff.depart_id = d.id";
//隐患排查检查项
sql+=" left join ( select dlm.depart_id,count(dii.id) 'count' from danger_inspect_item dii left join danger_level_manage dlm on dii.danger_id = dlm.id group by dlm.depart_id ) gg on gg.depart_id = d.id";