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

interface

@@ -31,7 +31,7 @@ class AdminStatisticsController extends AdminBaseController{ @@ -31,7 +31,7 @@ class AdminStatisticsController extends AdminBaseController{
31 $param=$this->request->param(); 31 $param=$this->request->param();
32 $where=''; 32 $where='';
33 if (!empty($param['hospital'])){ 33 if (!empty($param['hospital'])){
34 - $where="where hospital='第一附属医院' AND"; 34 + $where="hospital='第一附属医院' AND";
35 } 35 }
36 //医院总体时长统计 36 //医院总体时长统计
37 $data=Db::name('order') 37 $data=Db::name('order')
@@ -87,13 +87,13 @@ class AdminStatisticsController extends AdminBaseController{ @@ -87,13 +87,13 @@ class AdminStatisticsController extends AdminBaseController{
87 87
88 //时间段统计 88 //时间段统计
89 $interval=array(); 89 $interval=array();
90 - $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where "+$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 INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where ".$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 sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where "+$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 sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where hospital='第一附属医院' AND 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);
94 - $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where "+$where+" FROM_UNIXTIME(start_time,'%H:%i:%S')>'12:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'17:00:00'"; 94 + $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where hospital='第一附属医院' AND FROM_UNIXTIME(start_time,'%H:%i:%S')>'12:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'17:00:00'";
95 $interval[2]=Db::query($sql); 95 $interval[2]=Db::query($sql);
96 - $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where "+$where+" FROM_UNIXTIME(start_time,'%H:%i:%S')>'17:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'21:00:00'"; 96 + $sql="SELECT sleep_equipment.hospital,count(*) as num FROM sleep_order INNER JOIN sleep_equipment ON sleep_order.eq_name=sleep_equipment.name where hospital='第一附属医院' AND FROM_UNIXTIME(start_time,'%H:%i:%S')>'17:00:00' AND FROM_UNIXTIME(start_time,'%H:%i:%S')<'21:00:00'";
97 $interval[3]=Db::query($sql); 97 $interval[3]=Db::query($sql);
98 dump($interval); 98 dump($interval);
99 foreach ($interval as $k=>$v){ 99 foreach ($interval as $k=>$v){