sql+=" left join (select eee.depart_id ,count(1) 'count' from (select left(ee.time,7) time , ee.depart_id from "+view4411Sql+" ee where 1=1 and ee.yyf is not null and ee.yyf <> '' and ee.ysfsl is not null and ee.ysfsl <> '' group by ee.depart_id ,left(ee.time,7) )eee group by eee.depart_id )fff on fff.depart_id = d.id ";
sql+=" ";
//目标年报
sql+=" left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id ";
//目标年报 :年度目标报表改成生产经营报表的统计
//sql += " left join(select depart_id ,count(depart_id) 'count' from report_target_config where target_year = year('"+startTime+"') group by depart_id) ggg on ggg.depart_id = d.id ";
sql+=" left join( select factory_id,count(id) 'count' from ajh_plan_schedule_data where LEFT(date_time,4) = year('"+startTime+"') group by factory_id ) ggg on ggg.factory_id = d.id";