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

XIAOPAN

@@ -85,6 +85,7 @@ class AdminStatisticsController extends AdminBaseController{ @@ -85,6 +85,7 @@ class AdminStatisticsController extends AdminBaseController{
85 $Month_statistics=array(); 85 $Month_statistics=array();
86 $Month_money=array(); 86 $Month_money=array();
87 $Month=array(); 87 $Month=array();
  88 + $Month_note_money=array();
88 for ($i = 0; $i<24; $i++){ 89 for ($i = 0; $i<24; $i++){
89 $Month[]=date('Y-m-d',$month_interval[$i][1]); 90 $Month[]=date('Y-m-d',$month_interval[$i][1]);
90 $Month_statistics[]=Db::name('order')->where('start_time','between',$month_interval[$i])->count(); 91 $Month_statistics[]=Db::name('order')->where('start_time','between',$month_interval[$i])->count();
@@ -107,7 +108,7 @@ class AdminStatisticsController extends AdminBaseController{ @@ -107,7 +108,7 @@ class AdminStatisticsController extends AdminBaseController{
107 $this->assign('month',json_encode($Month)); 108 $this->assign('month',json_encode($Month));
108 $this->assign('monthData',json_encode($Month_statistics)); 109 $this->assign('monthData',json_encode($Month_statistics));
109 $this->assign('monthMoney',json_encode($Month_money)); 110 $this->assign('monthMoney',json_encode($Month_money));
110 - 111 + $this->assign('Month_note_money',json_encode($Month_note_money));
111 //时间段统计 112 //时间段统计
112 $interval=array(); 113 $interval=array();
113 $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'))"; 114 $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'))";
@@ -59,6 +59,11 @@ @@ -59,6 +59,11 @@
59 <div id="main12" class="my_main3"></div> 59 <div id="main12" class="my_main3"></div>
60 </div> 60 </div>
61 </div> 61 </div>
  62 + <div class="xhzb_wrap" style="height: 250px">
  63 + <div>
  64 + <div id="main13" class="my_main3"></div>
  65 + </div>
  66 + </div>
62 67
63 </div> 68 </div>
64 </div> 69 </div>
@@ -143,7 +148,7 @@ @@ -143,7 +148,7 @@
143 var monthDataX = JSON.parse('{$month}'); 148 var monthDataX = JSON.parse('{$month}');
144 var monthDataY = JSON.parse('{$monthData}'); 149 var monthDataY = JSON.parse('{$monthData}');
145 var monthMoney = JSON.parse('{$monthMoney}'); 150 var monthMoney = JSON.parse('{$monthMoney}');
146 - 151 + var Month_note_money = JSON.parse('{$Month_note_money}');
147 152
148 // 路径配置 153 // 路径配置
149 require.config({ 154 require.config({
@@ -168,7 +173,7 @@ @@ -168,7 +173,7 @@
168 var myChart10 = ec.init(document.getElementById('main10'),'macarons'); 173 var myChart10 = ec.init(document.getElementById('main10'),'macarons');
169 var myChart11 = ec.init(document.getElementById('main11'),'macarons'); 174 var myChart11 = ec.init(document.getElementById('main11'),'macarons');
170 var myChart12 = ec.init(document.getElementById('main12'),'macarons'); 175 var myChart12 = ec.init(document.getElementById('main12'),'macarons');
171 - 176 + var myChart13 = ec.init(document.getElementById('main13'),'macarons');
172 //时间段统计(柱形图) 177 //时间段统计(柱形图)
173 var option = { 178 var option = {
174 backgroundColor:'white', 179 backgroundColor:'white',
@@ -546,6 +551,58 @@ @@ -546,6 +551,58 @@
546 } 551 }
547 ] 552 ]
548 }; 553 };
  554 + var option13 = {
  555 + backgroundColor : "white",
  556 + color : ["#c05050","#59678c"],
  557 + title:{
  558 + text : '科室月营业额统计',
  559 + y: '15'
  560 + },
  561 + tooltip : {
  562 + trigger: 'axis',
  563 +
  564 + showDelay: 0, // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
  565 + formatter: "{b}</br>{a} : {c}元"
  566 +
  567 + },
  568 + dataZoom : {
  569 + show : true,
  570 + realtime: true,
  571 + y : 220,
  572 + height: 20,
  573 + start : 75,
  574 + end : 100
  575 + },
  576 + calculable : true,
  577 + grid: {
  578 + x: 80,
  579 + y: 40,
  580 + x2:60,
  581 + },
  582 + xAxis : [
  583 + {
  584 + type : 'category',
  585 + boundaryGap : true,
  586 + data : monthDataX
  587 + }
  588 + ],
  589 + yAxis : [
  590 + {
  591 + type : 'value',
  592 + scale:true,
  593 +
  594 + }
  595 + ],
  596 + series : [
  597 + {
  598 + name:'月统计',
  599 + type:'line',
  600 + //stack: '人数',
  601 + barWidth : 10,
  602 + data:Month_note_money
  603 + }
  604 + ]
  605 + };
549 // 为echarts对象加载数据 606 // 为echarts对象加载数据
550 myChart.setOption(option); 607 myChart.setOption(option);
551 myChart2.setOption(option4); 608 myChart2.setOption(option4);
@@ -553,6 +610,7 @@ @@ -553,6 +610,7 @@
553 myChart10.setOption(option10); 610 myChart10.setOption(option10);
554 myChart11.setOption(option11); 611 myChart11.setOption(option11);
555 myChart12.setOption(option12); 612 myChart12.setOption(option12);
  613 + myChart13.setOption(option13);
556 // console.log({c}); 614 // console.log({c});
557 } 615 }
558 ); 616 );