|
@@ -3007,7 +3007,10 @@ class CameraApiController extends BaseController
|
|
|
//导出分类表
|
|
|
public function export2Type(Request $request){
|
|
|
$params = $request->all();
|
|
|
- $result = [];
|
|
|
+ $result['type_list'] = [];
|
|
|
+ $index = 0;
|
|
|
+
|
|
|
+ $type_list = ['高空坠落','起重伤害','触电','火灾','机械伤害','中毒和窒息'];
|
|
|
|
|
|
if(isset($params['date'])){
|
|
|
$date = $params['date'];
|
|
@@ -3015,13 +3018,66 @@ class CameraApiController extends BaseController
|
|
|
$date = date('Y-m-d');
|
|
|
}
|
|
|
|
|
|
+ $coal_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery')->where('is_delete',0)->orderBy('sort')->get();
|
|
|
+
|
|
|
+ for($i=0;$i<count($type_list);$i++){
|
|
|
+ for($j=0;$j<count($coal_list);$j++){
|
|
|
+ $risk_level = '';
|
|
|
+
|
|
|
+ $risk_gao_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->where('risk_level',0)->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('coal_washery_id',$coal_list[$j]->ID)->where('risk_type',$i)->orderBy('create_time')->get();
|
|
|
+ $risk_zhong_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->where('risk_level',1)->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('coal_washery_id',$coal_list[$j]->ID)->where('risk_type',$i)->orderBy('create_time')->get();
|
|
|
+
|
|
|
+ if(count($risk_gao_list) > 0){
|
|
|
+ $risk_level = '高风险'.count($risk_gao_list).'项,';
|
|
|
+ }
|
|
|
+ if(count($risk_zhong_list) > 0){
|
|
|
+ $risk_level = $risk_level . '中风险'.count($risk_zhong_list).'项';
|
|
|
+ }
|
|
|
+
|
|
|
+ $risk_level = rtrim($risk_level, ",");
|
|
|
+
|
|
|
+ if(count($risk_gao_list) > 0){
|
|
|
+ for($x=0;$x<count($risk_gao_list);$x++){
|
|
|
+ $index++;
|
|
|
+ array_push($result['type_list'],[
|
|
|
+ 'index'=>$index,
|
|
|
+ 'risk_type'=>$type_list[$i],
|
|
|
+ 'risk_level'=>$risk_level,
|
|
|
+ 'unit'=>$coal_list[$j]->title,
|
|
|
+ 'content'=>$risk_gao_list[$x]->risk_name,
|
|
|
+ 'people_count'=>$risk_gao_list[$x]->work_num,
|
|
|
+ 'work_location'=>$risk_gao_list[$x]->risk_location,
|
|
|
+ 'leader'=>$risk_gao_list[$x]->work_people
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(count($risk_zhong_list) > 0){
|
|
|
+ for($x=0;$x<count($risk_zhong_list);$x++){
|
|
|
+ $index++;
|
|
|
+ array_push($result['type_list'],[
|
|
|
+ 'index'=>$index,
|
|
|
+ 'risk_type'=>$type_list[$i],
|
|
|
+ 'risk_level'=>$risk_level,
|
|
|
+ 'unit'=>$coal_list[$j]->title,
|
|
|
+ 'content'=>$risk_zhong_list[$x]->risk_name,
|
|
|
+ 'people_count'=>$risk_zhong_list[$x]->work_num,
|
|
|
+ 'work_location'=>$risk_zhong_list[$x]->risk_location,
|
|
|
+ 'leader'=>$risk_zhong_list[$x]->work_people
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
//导出摄像头表
|
|
|
public function export2Camera(Request $request){
|
|
|
$params = $request->all();
|
|
|
- $result = [];
|
|
|
+ $result['camera_list'] = [];
|
|
|
+ $index = 0;
|
|
|
|
|
|
if(isset($params['date'])){
|
|
|
$date = $params['date'];
|
|
@@ -3029,6 +3085,31 @@ class CameraApiController extends BaseController
|
|
|
$date = date('Y-m-d');
|
|
|
}
|
|
|
|
|
|
+ $coal_list = DB::connection('mysql_fwe10')->table('uf_xx_coal_washery')
|
|
|
+ ->select('uf_xx_coal_washery.*','uf_xx_area.title as area_title')
|
|
|
+ ->leftJoin('uf_xx_area','uf_xx_area.id','=','uf_xx_coal_washery.area_id')
|
|
|
+ ->where('uf_xx_coal_washery.is_delete',0)->orderBy('uf_xx_area.create_time')->orderBy('uf_xx_coal_washery.sort')->get();
|
|
|
+
|
|
|
+ if(count($coal_list) > 0){
|
|
|
+ for($i=0;$i<count($coal_list);$i++){
|
|
|
+ $risk_list = DB::connection('mysql_fwe10')->table('uf_xx_risk_assignment')->where('risk_level',2)->whereDate('create_time', $date)->where('IS_DELETE', 0)->where('coal_washery_id',$coal_list[$i]->ID)->where('move_camera','!=',null)->orderBy('create_time')->get();
|
|
|
+ if(count($risk_list) > 0){
|
|
|
+ for($j=0;$j<count($risk_list);$j++){
|
|
|
+ $index++;
|
|
|
+ array_push($result['camera_list'],[
|
|
|
+ 'area'=>$coal_list[$i]->area_title,
|
|
|
+ 'unit'=>$risk_list[$j]->unit,
|
|
|
+ 'index'=>$index,
|
|
|
+ 'people_num'=>$risk_list[$j]->work_num,
|
|
|
+ 'content'=>$risk_list[$j]->risk_name,
|
|
|
+ 'work_location'=>$risk_list[$j]->risk_location,
|
|
|
+ 'leader'=>$risk_list[$j]->work_people
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $result;
|
|
|
}
|
|
|
|