...
|
...
|
@@ -31,7 +31,7 @@ class AdminStatisticsController extends AdminBaseController{ |
|
|
$param=$this->request->param();
|
|
|
$where='';
|
|
|
if (!empty($param['hospital'])){
|
|
|
$where="where hospital='第一附属医院' AND";
|
|
|
$where="hospital='第一附属医院' AND";
|
|
|
}
|
|
|
//医院总体时长统计
|
|
|
$data=Db::name('order')
|
...
|
...
|
@@ -87,13 +87,13 @@ class AdminStatisticsController extends AdminBaseController{ |
|
|
|
|
|
//时间段统计
|
|
|
$interval=array();
|
|
|
$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')";
|
|
|
$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')";
|
|
|
$interval[0]=Db::query($sql);
|
|
|
$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'";
|
|
|
$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'";
|
|
|
$interval[1]=Db::query($sql);
|
|
|
$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'";
|
|
|
$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'";
|
|
|
$interval[2]=Db::query($sql);
|
|
|
$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'";
|
|
|
$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'";
|
|
|
$interval[3]=Db::query($sql);
|
|
|
dump($interval);
|
|
|
foreach ($interval as $k=>$v){
|
...
|
...
|
|