作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

XIAOPAN

@@ -31,10 +31,14 @@ class AdminStatisticsController extends AdminBaseController{ @@ -31,10 +31,14 @@ class AdminStatisticsController extends AdminBaseController{
31 $param=$this->request->param(); 31 $param=$this->request->param();
32 $where=''; 32 $where='';
33 $where1=[]; 33 $where1=[];
  34 + $where2=[];
34 if (!empty($param['hospital'])){ 35 if (!empty($param['hospital'])){
35 $where="hospital='".$param['hospital']."' AND"; 36 $where="hospital='".$param['hospital']."' AND";
36 $where1['hospital']=$param['hospital']; 37 $where1['hospital']=$param['hospital'];
37 } 38 }
  39 + if (!empty($param['note'])){
  40 + $where2['note']=$param['note'];
  41 + }
38 //医院总体时长统计 42 //医院总体时长统计
39 $data=Db::name('order') 43 $data=Db::name('order')
40 ->alias('a') 44 ->alias('a')
@@ -91,6 +95,14 @@ class AdminStatisticsController extends AdminBaseController{ @@ -91,6 +95,14 @@ class AdminStatisticsController extends AdminBaseController{
91 ->where('o.start_time','between',$month_interval[$i]) 95 ->where('o.start_time','between',$month_interval[$i])
92 ->where('o.state',3) 96 ->where('o.state',3)
93 ->sum('o.price'); 97 ->sum('o.price');
  98 + $Month_note_money[]=Db::name('order')
  99 + ->alias('o')
  100 + ->join('equipment e','o.eq_name=e.name')
  101 + ->where($where1)
  102 + ->where($where2)
  103 + ->where('o.start_time','between',$month_interval[$i])
  104 + ->where('o.state',3)
  105 + ->sum('o.price');
94 } 106 }
95 $this->assign('month',json_encode($Month)); 107 $this->assign('month',json_encode($Month));
96 $this->assign('monthData',json_encode($Month_statistics)); 108 $this->assign('monthData',json_encode($Month_statistics));
@@ -125,8 +137,12 @@ class AdminStatisticsController extends AdminBaseController{ @@ -125,8 +137,12 @@ class AdminStatisticsController extends AdminBaseController{
125 137
126 public function getNote(){ 138 public function getNote(){
127 $param=$this->request->param(); 139 $param=$this->request->param();
128 - $data=Db::name('equipment')->where(['hospital'=>$param['hospital'],'is_delete'=>0])->whereNotNull('note')->group('note')->select()->toArray();  
129 - return $data; 140 + if ($param['hospital']!="") {
  141 + $data = Db::name('equipment')->where(['hospital' => $param['hospital'], 'is_delete' => 0])->whereNotNull('note')->group('note')->select()->toArray();
  142 + return $data;
  143 + }else{
  144 + return "";
  145 + }
130 } 146 }
131 147
132 148