Browse Source

医生列表中服务管理中的所有操作

ChenWuJie 4 years ago
parent
commit
df6988d961

+ 19 - 0
app/Admin/Actions/backstage/Docters/AppointAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class AppointAction extends RowAction
+{
+    public $name = '门诊预约配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转门诊预约配置成功')->redirect('/admin/docter_appoint?docter_id='.$this->row->id.'');
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Docters/ChatAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class ChatAction extends RowAction
+{
+    public $name = '图文服务配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转图文服务配置成功')->redirect('/admin/docter_chat?docter_id='.$this->row->id.'');
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Docters/PhoneAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class PhoneAction extends RowAction
+{
+    public $name = '电话服务配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转电话服务配置成功')->redirect('/admin/docter_phone?docter_id='.$this->row->id.'');
+    }
+
+}

+ 135 - 0
app/Admin/Controllers/UserManagement/DocterManagement/AppointController.php

xqd
@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\DocterSetting;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class AppointController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '门诊预约配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new DocterSetting());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',1);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('organization.name', __('机构名'));
+        $grid->column('type', __('类型'))->using([1=>'门诊预约']);
+        $grid->column('show_days', __('可预约天数'));
+        $grid->column('service_times', __('就诊时长'));
+        $grid->column('service_num', __('同时服务订单数'));
+        $grid->column('appoint_price', __('预约单价'));
+
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(DocterSetting::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('type', __('Type'));
+        $show->field('status', __('Status'));
+        $show->field('show_days', __('Show days'));
+        $show->field('service_times', __('Service times'));
+        $show->field('service_num', __('Service num'));
+        $show->field('org_id', __('Org id'));
+        $show->field('appoint_price', __('Appoint price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new DocterSetting());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->number('type', __('Type'));
+        $form->number('status', __('Status'));
+        $form->number('show_days', __('Show days'));
+        $form->number('service_times', __('Service times'));
+        $form->number('service_num', __('Service num'));
+        $form->number('org_id', __('Org id'));
+        $form->decimal('appoint_price', __('Appoint price'))->default(0.00);
+        $form->text('service_time', __('Service time'));
+
+        return $form;
+    }
+}

+ 128 - 0
app/Admin/Controllers/UserManagement/DocterManagement/ChatController.php

xqd
@@ -0,0 +1,128 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\Docter;
+use App\Models\Doctertimes;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ChatController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '图文服务配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Doctertimes());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',2);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('type', __('类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊咨询',4=>'疫苗预约接种',5=>'儿保预约',6=>'服务包',7=>'充值']);
+        $grid->column('base_price', __('基础价格'));
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('person', __('服务人数'));
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Doctertimes::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('base_price', __('Base price'));
+        $show->field('step_price', __('Step price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('person', __('Person'));
+        $show->field('type', __('Type'));
+        $show->field('relation_id', __('Relation id'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Doctertimes());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->decimal('base_price', __('Base price'));
+        $form->decimal('step_price', __('Step price'));
+        $form->text('service_time', __('Service time'));
+        $form->number('person', __('Person'));
+        $form->number('type', __('Type'));
+        $form->number('relation_id', __('Relation id'));
+
+        return $form;
+    }
+}

+ 129 - 0
app/Admin/Controllers/UserManagement/DocterManagement/PhoneController.php

xqd
@@ -0,0 +1,129 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\Doctertimes;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class PhoneController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '电话服务配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Doctertimes());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',1);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('type', __('类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊咨询',4=>'疫苗预约接种',5=>'儿保预约',6=>'服务包',7=>'充值']);
+
+        $grid->column('base_price', __('基础价格'));
+        $grid->column('base_price', __('步进价格'));
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('person', __('服务人数'));
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Doctertimes::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('base_price', __('Base price'));
+        $show->field('step_price', __('Step price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('person', __('Person'));
+        $show->field('type', __('Type'));
+        $show->field('relation_id', __('Relation id'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Doctertimes());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->decimal('base_price', __('Base price'));
+        $form->decimal('step_price', __('Step price'));
+        $form->text('service_time', __('Service time'));
+        $form->number('person', __('Person'));
+        $form->number('type', __('Type'));
+        $form->number('relation_id', __('Relation id'));
+
+        return $form;
+    }
+}

+ 7 - 0
app/Admin/Controllers/UserManagement/DocterManagement/ServiceManagementController.php

xqd xqd
@@ -2,6 +2,10 @@
 
 namespace App\Admin\Controllers\UserManagement\DocterManagement;
 
+use App\Admin\Actions\backstage\Docters\AppointAction;
+use App\Admin\Actions\backstage\Docters\ChatAction;
+use App\Admin\Actions\backstage\Docters\PhoneAction;
+use App\Admin\Actions\Community\Docter\Chat;
 use App\Models\Docter;
 use App\Models\ServiceApply;
 use App\Models\Serviceapplys;
@@ -37,6 +41,9 @@ class ServiceManagementController extends AdminController
         $grid->actions(function ($actions){
            $actions->disableView();
            $actions->disableDelete();
+           $actions->add (new ChatAction());
+           $actions->add (new PhoneAction());
+           $actions->add (new AppointAction());
         });
         $grid->model()->where('id',$id);
         $grid->column('id', __('id'));

+ 6 - 0
app/Admin/routes.php

xqd
@@ -92,6 +92,12 @@ Route::group([
         //处理数据
 //        $router->put('put', '');
     $router->any('putdata', 'UserManagement\DocterManagement\PutdataController@putdata');
+    //服务管理->图文服务配置
+    $router->resource('docter_chat', UserManagement\DocterManagement\ChatController::class);
+    //服务管理->电话服务配置
+    $router->resource('docter_phone', UserManagement\DocterManagement\PhoneController::class);
+    //服务管理->门诊预约配置
+    $router->resource('docter_appoint', UserManagement\DocterManagement\AppointController::class);
     /*
      * 用户管理->宝妈用户
      * */

+ 6 - 0
app/Models/DocterSetting.php

xqd
@@ -7,4 +7,10 @@ use Illuminate\Database\Eloquent\Model;
 class DocterSetting extends Model
 {
     public $timestamps = false;
+    public function docter(){
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
+    public function organization(){
+        return $this->hasOne(Organization::class,'id','org_id');
+    }
 }

+ 1 - 1
app/Models/Doctertimes.php

xqd
@@ -10,6 +10,6 @@ class Doctertimes extends Model
     protected $table = 'docter_times';
 
     public function docter(){
-        return $this->hasOne(Docter::class);
+        return $this->hasOne(Docter::class,'id','docter_id');
     }
 }