| xqd
@@ -29,6 +29,19 @@ class StatController extends Controller
|
|
|
if(self::$org_id){
|
|
|
$where['organization_id']=self::$org_id;
|
|
|
}
|
|
|
+ $order = Order::where(['product_type'=>4])->where($where);
|
|
|
+
|
|
|
+ $today = $order->whereHas('orderPatient',function ($query){
|
|
|
+ $query->whereBetween('appoint_start_time',[strtotime('today'),strtotime('+1days')]);
|
|
|
+ })->count();
|
|
|
+
|
|
|
+ $tomorrow = $order->whereHas('orderPatient',function ($query){
|
|
|
+ $query->whereBetween('appoint_start_time',[date('Y-m-d',strtotime('-1days')),date('Y-m-d',time())]);
|
|
|
+ })->whereNotIn('order_status',[1,5,6])->count();
|
|
|
+
|
|
|
+ //昨日接诊人数
|
|
|
+ $today = $order->whereBetween('end_time',[strtotime('-1days'),strtotime('today')])->where('order_status',4)->count();
|
|
|
+
|
|
|
$data ['sum_num'] = Vaccine::where($where)->count();
|
|
|
$data['have_num'] = Vaccine::where($where)->sum('stock');
|
|
|
$data['less_num'] = Vaccine::where($where)->where(['stock'=>0])->count();//取苗钟数
|
| xqd
@@ -47,6 +60,7 @@ class StatController extends Controller
|
|
|
if(self::$org_id){
|
|
|
$where['organization_id']=self::$org_id;
|
|
|
}
|
|
|
+
|
|
|
$data['schedule_paitent'] = Order::where(['order_status'=>1])->where($where)->whereIn('product_type',[3,4,5])->where('created_at','>',date('Y-m-d H:i:s',time()))->count();
|
|
|
$data['schedule_docter'] = SchedulePeriod::distinct('docter_id')->where($where)->where('schedule_date',date('Y-m-d H:i:s',time()))->count();
|
|
|
// $data['paitent_num'] = Order::where(['order_status'=>1])->distinct()->count()->BgroupBy('patient_id');
|
| xqd
@@ -54,7 +68,7 @@ class StatController extends Controller
|
|
|
$query->where(['appoint_start_time'=>strtotime('today')]);
|
|
|
})->where(['product_type'=>4])->where($where)->count();//接诊患者(人次)
|
|
|
|
|
|
-return $data;
|
|
|
+ return $data;
|
|
|
|
|
|
|
|
|
}
|
| xqd
@@ -102,14 +116,31 @@ return $data;
|
|
|
//门诊统计
|
|
|
public static function clinc()
|
|
|
{
|
|
|
+ $where = [];
|
|
|
+ if(self::$org_id){
|
|
|
+ $where['organization_id']=self::$org_id;
|
|
|
+ }
|
|
|
+ $order = Order::where(['product_type'=>3])->where($where);
|
|
|
|
|
|
- $orgId = self::$org_id;
|
|
|
- $order = Order::where(['product_type'=>3,'organization_id'=>$orgId]);
|
|
|
+ //今日预约数
|
|
|
$today = $order->where('created_at','>=',date('Y-m-d'))->whereNotIn('order_status',[1,5,6])->count();
|
|
|
- $docters = Schedule::where(['organization'=>$orgId,'schedule_date'=>date('Y-m-d',time())])->count();
|
|
|
- $yesterday = $order->whereBetween(date('Y-m-d',[strtotime('-1days'),date('Y-m-d')]))->whereNotIn('order_status',[1,5,6])->count();
|
|
|
- $yesterday = $order->whereBetween(date('Y-m-d',[strtotime('-1days'),date('Y-m-d')]))->whereNotIn('order_status',[1,5,6])->count();
|
|
|
|
|
|
- return [];
|
|
|
+ //医生排班人数
|
|
|
+ $docters = SchedulePeriod::where(['schedule_date'=>date('Y-m-d',time())])->distinct('docter_id')->count('docter_id');
|
|
|
+
|
|
|
+ //昨日接诊人数
|
|
|
+ $yesterday = $order->whereBetween('end_time',[strtotime('-1days'),strtotime('today')])->where('order_status',4)->count();
|
|
|
+
|
|
|
+ //明日预约数
|
|
|
+ $tomorrow = $order->whereHas('orderPatient',function ($query){
|
|
|
+ $query->whereBetween('appoint_start_time',[strtotime('today'),strtotime('+1days')]);
|
|
|
+ })->whereNotIn('order_status',[1,5,6])->count();
|
|
|
+
|
|
|
+ $data['today'] = $today;
|
|
|
+ $data['yesterday'] = $yesterday;
|
|
|
+ $data['docters'] = $docters;
|
|
|
+ $data['tomorrow'] = $tomorrow;
|
|
|
+
|
|
|
+ return $data;
|
|
|
}
|
|
|
}
|