作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -87,7 +87,7 @@ class AdminStatisticsController extends AdminBaseController{ @@ -87,7 +87,7 @@ class AdminStatisticsController extends AdminBaseController{
87 87
88 //时间段统计 88 //时间段统计
89 $interval=array(); 89 $interval=array();
90 - $sql="SELECT count(*) as num FROM sleep_order JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where (FROM_UNIXTIME(start_time,'%H:%i:%S')>'00:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'07:00:00') OR (FROM_UNIXTIME(start_time,'%H:%i:%S')>'21:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'24:00:00')"; 90 + $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where (FROM_UNIXTIME(start_time,'%H:%i:%S')>'00:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'07:00:00') OR (FROM_UNIXTIME(start_time,'%H:%i:%S')>'21:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'24:00:00')";
91 $interval[0]=Db::query($sql); 91 $interval[0]=Db::query($sql);
92 $sql="SELECT count(*) as num FROM sleep_order where FROM_UNIXTIME(start_time,'%H:%i:%S')>'07:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'12:00:00'"; 92 $sql="SELECT count(*) as num FROM sleep_order where FROM_UNIXTIME(start_time,'%H:%i:%S')>'07:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'12:00:00'";
93 $interval[1]=Db::query($sql); 93 $interval[1]=Db::query($sql);
@@ -98,17 +98,11 @@ class AdminStatisticsController extends AdminBaseController{ @@ -98,17 +98,11 @@ class AdminStatisticsController extends AdminBaseController{
98 foreach ($interval as $k=>$v){ 98 foreach ($interval as $k=>$v){
99 $interval[$k]=$interval[$k][0]['num']; 99 $interval[$k]=$interval[$k][0]['num'];
100 } 100 }
  101 + dump($interval);
101 $this->assign('interval',json_encode($interval)); 102 $this->assign('interval',json_encode($interval));
102 103
103 $this->assign('hospital', isset($param['hospital']) ? $param['hospital'] : ''); 104 $this->assign('hospital', isset($param['hospital']) ? $param['hospital'] : '');
104 105
105 -  
106 - $SQL123=Db::name('order')  
107 - ->alias('a')  
108 - ->field('b.hospital')  
109 - ->join('equipment b','a.eq_name=b.name')  
110 - ->select();  
111 - echo DB::name('order')->getlastsql();  
112 return $this->fetch(); 106 return $this->fetch();
113 } 107 }
114 108