ChenWuJie vor 4 Jahren
Ursprung
Commit
5e7944c544

+ 1 - 1
app/Admin/Controllers/BannerController.php

xqd
@@ -28,7 +28,7 @@ class BannerController extends AdminController
 
         $grid->column('id', __('Id'));
         $grid->column('image', __('图片'))->image('',100,100);
-        $grid->column('type','类型')->using([1=>'用户端',2=>'医生端']);
+        $grid->column('type','类型')->using([1=>'热门推荐',2=>'普通推荐']);
         $grid->column('url', __('链接'));
         $states = [
             'on'  => ['value' => 1, 'text' => '启用', 'color' => 'success'],

+ 55 - 0
app/Admin/Controllers/OutpatientServiceController.php

xqd
@@ -0,0 +1,55 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Docter;
+use App\Models\Order;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class OutpatientServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = 'Docter';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Docter());
+
+        $grid->column('id','ID');
+        $grid->column('name','医生姓名');
+        $grid->column('appoint_price','咨询价格');
+        $grid->column('orders','总订单数')->display(function (){
+
+            $order_type = Order::where(['docter_id'=>$this->id,'product_type'=>3])->count();
+            return $order_type;
+        });
+        $grid->column('orders_actions','进行中数')->display(function (){
+            $action = Order::where(['docter_id'=>$this->id,'product_type'=>3,'order_status'=>3])->count();
+            return $action;
+        });
+        $grid->column('orders_inishs','完成数')->display(function (){
+            $finish = Order::where(['docter_id'=>$this->id,'product_type'=>3,'order_status'=>4])->count();
+            return $finish;
+        });
+        $grid->column('orders_anomaly','异常数')->display(function (){
+            $anomaly = Order::where(['docter_id'=>$this->id,'product_type'=>3])->whereIn('order_status',[1,2,5])->count();
+//            dd($anomaly);
+            return $anomaly;
+        });
+
+        return $grid;
+    }
+
+}

+ 62 - 0
app/Admin/Controllers/PhoneServiceController.php

xqd
@@ -0,0 +1,62 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Docter;
+use App\Models\Order;
+use App\Models\Doctertimes;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class PhoneServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = 'Docter';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Docter());
+
+        $grid->column('id','ID');
+        $grid->column('name','医生姓名');
+        $grid->column('phone_price','咨询价格');
+        $grid->column('step_price','步进价格')->display(function (){
+            $step = Doctertimes::where(['docter_id'=>$this->id])->value('step_price');
+            return $step;
+        });
+
+
+        $grid->column('orders','总订单数')->display(function (){
+
+            $order_type = Order::where(['docter_id'=>$this->id,'product_type'=>1])->count();
+            return $order_type;
+        });
+        $grid->column('orders_actions','进行中数')->display(function (){
+            $action = Order::where(['docter_id'=>$this->id,'product_type'=>1,'order_status'=>3])->count();
+            return $action;
+        });
+        $grid->column('orders_inishs','完成数')->display(function (){
+            $finish = Order::where(['docter_id'=>$this->id,'product_type'=>1,'order_status'=>4])->count();
+            return $finish;
+        });
+        $grid->column('orders_anomaly','异常数')->display(function (){
+            $anomaly = Order::where(['docter_id'=>$this->id,'product_type'=>1])->whereIn('order_status',[1,2,5])->count();
+//            dd($anomaly);
+            return $anomaly;
+        });
+
+        return $grid;
+    }
+
+}

+ 1 - 1
app/Admin/Controllers/ReplySevriceCCController.php → app/Admin/Controllers/ReplyServiceCCController.php

xqd
@@ -10,7 +10,7 @@ use Encore\Admin\Form;
 use Encore\Admin\Grid;
 use Encore\Admin\Show;
 
-class ReplySevriceCCController extends AdminController
+class ReplyServiceCCController extends AdminController
 {
     /**
      * Title for current resource.

+ 56 - 0
app/Admin/Controllers/ReplyServiceController.php

xqd
@@ -0,0 +1,56 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Docter;
+use App\Models\Order;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ReplyServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = 'Docter';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Docter());
+
+
+        $grid->column('id','ID');
+        $grid->column('name','医生姓名');
+        $grid->column('chat_price','咨询价格');
+        $grid->column('orders','总订单数')->display(function (){
+
+            $order_type = Order::where(['docter_id'=>$this->id,'product_type'=>2])->count();
+            return $order_type;
+        });
+        $grid->column('orders_actions','进行中数')->display(function (){
+            $action = Order::where(['docter_id'=>$this->id,'product_type'=>2,'order_status'=>3])->count();
+            return $action;
+        });
+        $grid->column('orders_inishs','完成数')->display(function (){
+            $finish = Order::where(['docter_id'=>$this->id,'product_type'=>2,'order_status'=>4])->count();
+            return $finish;
+        });
+        $grid->column('orders_anomaly','异常数')->display(function (){
+            $anomaly = Order::where(['docter_id'=>$this->id,'product_type'=>2])->whereIn('order_status',[1,2,5])->count();
+//            dd($anomaly);
+            return $anomaly;
+        });
+
+        return $grid;
+    }
+
+}

+ 8 - 1
app/Admin/routes.php

xqd
@@ -27,13 +27,20 @@ Route::group([
     $router->resource('users', UserListController::class);
     $router->resource('user_patients', UserPatientsController::class);
 
+    //电话咨询
+    $router->resource('phone_service',PhoneServiceController::class);
+
+
     $router->resource('service_applys',ServiceapplysController::class);
     //电话咨询认证
+
     $router->resource('phone_service_cc',PhoneServiceCCController::class);
     //图文咨询认证
-    $router->resource('reply_service_cc',ReplySevriceCCController::class);
+    $router->resource('reply_service',ReplyServiceController::class);
+    $router->resource('reply_service_cc',ReplyServiceCCController::class);
     //门诊咨询认证
     $router->resource('outpatient_service_cc',OutpatientServiceCCController::class);
+    $router->resource('outpatient_service',OutpatientServiceController::class);
 
     $router->resource('/setting', 'Config\ConfigController');
     $router->get('/setting_form', 'Config\FormController@form');

+ 1 - 1
app/Http/Controllers/Api/V1/UserController.php

xqd
@@ -81,7 +81,7 @@ class UserController extends AuthController
         $docter_ids = Order::where('user_id', $user['id'])->whereIn('order_status', [2, 3])->where('docter_id', '>', 0)->pluck('docter_id')->toArray();
         $docter_ids = array_values(array_unique($docter_ids));
 
-        $data = Order::with(['docter.office', 'docter.qualification', 'orderPatient'])->select(['id', 'docter_id'])->whereIn('docter_id', $docter_ids)->paginate();
+        $data = Order::with(['docter.office', 'docter.qualification'])->select(['id', 'docter_id'])->whereIn('docter_id', $docter_ids)->groupBy('docter_id')->paginate();
 
         return out($data);
     }

+ 2 - 2
app/Models/Banner.php

xqd
@@ -9,7 +9,7 @@ class Banner extends Model
     //
     protected $table = 'banner';
     public static $_post_type = [
-        1=>'用户端',
-        2=>'医生端'
+        1=>'热门推荐',
+        2=>'普通推荐'
     ];
 }

+ 8 - 0
app/Models/Docter.php

xqd
@@ -40,6 +40,14 @@ class Docter extends BaseModel
         return $this->hasOne(TeamDocter::class);
     }
 
+    public function order()
+    {
+        return $this->hasMany(Order::class,'docter_id','id');
+    }
+
+    public function doctertimes(){
+        return $this->belongsTo(Doctertimes::class);
+    }
     public function getIsCollectAttribute()
     {
         if (!empty(request()->header('token'))) {

+ 15 - 0
app/Models/Doctertimes.php

xqd
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Doctertimes extends Model
+{
+    //
+    protected $table = 'docter_times';
+
+    public function docter(){
+        return $this->hasOne(Docter::class);
+    }
+}