...
|
...
|
@@ -30,21 +30,19 @@ use think\Db; |
|
|
class AdminFaultController extends AdminBaseController{
|
|
|
|
|
|
public function index(){
|
|
|
$Order=new OrderModel();
|
|
|
$data=Db::name('fault')->alias('a')
|
|
|
->field('eq_name')
|
|
|
->group('eq_name')
|
|
|
->order('start_time','desc')
|
|
|
->select()->each(function ($item){
|
|
|
$item['average']=round($item['sumTime']/$item['num']);
|
|
|
//计费故障次数
|
|
|
$item['fault_time']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>1])->count();
|
|
|
//锁故障次数
|
|
|
$item['fault_lock']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>5])->count();
|
|
|
$item['fault_lock']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>3])->count();
|
|
|
//床故障次数
|
|
|
$item['fault_bed']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>['in',[2,3,4]]])->count();
|
|
|
$item['fault_bed']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>2])->count();
|
|
|
//其他故障次数
|
|
|
$item['fault_other']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>6])->count();
|
|
|
$item['fault_other']=Db::name('fault')->where(['eq_name'=>$item['eq_name'],'fault_type'=>4])->count();
|
|
|
//故障总数
|
|
|
$item['fault']=Db::name('fault')->where(['eq_name'=>$item['eq_name']])->count();
|
|
|
return $item;
|
...
|
...
|
|