Swdz-WangHaiJun 4 роки тому
батько
коміт
960469fc23

+ 56 - 0
app/Community/Controllers/NurseServiceController.php

xqd
@@ -0,0 +1,56 @@
+<?php
+
+
+namespace App\Community\Controllers;
+
+
+use App\Models\Order;
+use App\Models\Organization;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Grid;
+
+class NurseServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '儿保服务';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Organization());
+        $grid->column('name', __('社区医院'));
+        $type = request('product_type',5);
+        $grid->column('orders', __('总订单数'))->display(function () use ($type) {
+            return Order::where('organization_id',$this->id)->where('product_type',$type)->count();
+        });
+        $grid->column('ordering', __('进行中订单'))->where('product_type',$type)->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>3])->count();
+        });
+        $grid->column('is_ok', __('完成数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>4])->where('product_type',$type)->count();
+        });
+        $grid->column('anomaly', __('异常数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id])->where('product_type',$type)->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
+        });
+        $grid->filter(function ($filter){
+            $filter->disableIdFilter();
+            $filter->equal('id','机构')->select(Organization::pluck('name','id'));
+        });
+
+        $grid->actions(function ($actions) {
+            $actions->disableEdit();
+            $actions->disableView();
+            $actions->disableDelete();
+        });
+
+        return $grid;
+    }
+}

+ 9 - 8
app/Community/Controllers/OrganizationController.php

xqd xqd
@@ -19,7 +19,7 @@ class OrganizationController extends AdminController
      *
      * @var string
      */
-    protected $title = '机构列表';
+    protected $title = '计免服务';
 
     /**
      * Make a grid builder.
@@ -31,17 +31,18 @@ class OrganizationController extends AdminController
         $grid = new Grid(new Organization());
 
         $grid->column('name', __('社区医院'));
-        $grid->column('orders', __('总订单数'))->display(function (){
-            return Order::where('organization_id',$this->id)->count();
+        $type = request('product_type',4);
+        $grid->column('orders', __('总订单数'))->display(function () use ($type) {
+            return Order::where('organization_id',$this->id)->where('product_type',$type)->count();
         });
-        $grid->column('ordering', __('进行中订单'))->display(function (){
+        $grid->column('ordering', __('进行中订单'))->where('product_type',$type)->display(function () use ($type) {
             return Order::where(['organization_id'=>$this->id,'order_status'=>3])->count();
         });
-        $grid->column('is_ok', __('完成数量'))->display(function (){
-            return Order::where(['organization_id'=>$this->id,'order_status'=>4])->count();
+        $grid->column('is_ok', __('完成数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>4])->where('product_type',$type)->count();
         });
-        $grid->column('anomaly', __('异常数量'))->display(function (){
-            return Order::where(['organization_id'=>$this->id])->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
+        $grid->column('anomaly', __('异常数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id])->where('product_type',$type)->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
         });
         $grid->filter(function ($filter){
             $filter->disableIdFilter();

+ 1 - 0
app/Community/routes.php

xqd
@@ -18,6 +18,7 @@ Route::resource('docter_account', DocterAccountController::class);
 Route::resource('docter_chats', DocterChatController::class);
 Route::resource('services', ServiceController::class);
 Route::resource('orgservice', OrganizationController::class);
+Route::resource('nurse_ervice', NurseServiceController::class);
 
 
 //社区通告