AdminAllStatisticsController.php 1.0 KB
<?php
/**
 * Created by PhpStorm.
 * User: ruidiudiu
 * Date: 2018/11/23
 * Time: 11:34
 */

namespace app\portal\controller;


use app\portal\model\EquipmentModel;
use app\portal\model\OrderModel;
use cmf\controller\AdminBaseController;
/**
 * Class AdminAllStatisticsController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'整体统计',
 *     'action' =>'index',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 1,
 *     'icon'   =>'th',
 *     'remark' =>'整体统计'
 * )
 */
class AdminAllStatisticsController extends AdminBaseController{

    public function index(){
        $Order=new OrderModel();
        $data=$Order->alias('a')
            ->field('a.*,b.serial_number,b.hospital,count(mac_address),sum(a.time) as sumTime,sum(*) as num')
            ->join('equipment b','a.mac_address=b.mac_address')
            ->group('mac_address')
            ->order('start_time','desc')
            ->paginate(10);
        $this->assign('data',$data);
        return $this->fetch();
    }


}