jingyuzhi 4 vuotta sitten
vanhempi
commit
660f0154a5

+ 150 - 0
app/Admin/Controllers/DoctorManagementController.php

xqd
@@ -0,0 +1,150 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Models\Docter;
+use App\Models\DocterOrganization;
+use App\Models\Organization;
+use App\Models\User;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class DoctorManagementController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '医生列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Docter());
+
+        $grid->column('id', __('Id'))->sortable();
+        $grid->column('name', __('姓名'));
+        $grid->column('avatar', __('头像'))->image('',50,50);
+        $grid->column('score', __('评分'));
+        $grid->column('service_persons', __('服务人数'));
+        $grid->column('DocterOrganization', __('所属机构'));
+//        $grid->column('DocterOrganization', __('所属机构'))->pluck('organization_id')->display(function ($organization_id){
+//            $str = '';
+//            foreach ($organization_id as $value)
+//            {
+//                $name = Organization::where('id',$value)->value('name');
+//                $str = $str.','.$name;
+//            }
+//            $str = ltrim($str, ",");
+//            return $str;
+//        });
+        $grid->column('teamdocter.team_id', __('团队id'));
+
+        $grid->column('label', __('标签'))->map('ucwords')->implode('-');
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Docter::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('type', __('Type'));
+        $show->field('name', __('Name'));
+        $show->field('phone', __('Phone'));
+        $show->field('sex', __('Sex'));
+        $show->field('birthday', __('Birthday'));
+        $show->field('avatar', __('Avatar'));
+        $show->field('status', __('Status'));
+        $show->field('label', __('Label'));
+        $show->field('sign', __('Sign'));
+        $show->field('intro', __('Intro'));
+        $show->field('office_id', __('Office id'));
+        $show->field('qualification_id', __('Qualification id'));
+        $show->field('score', __('Score'));
+        $show->field('service_persons', __('Service persons'));
+        $show->field('eva_num', __('Eva num'));
+        $show->field('service_days', __('Service days'));
+        $show->field('phone_minutes', __('Phone minutes'));
+        $show->field('chat_price', __('Chat price'));
+        $show->field('phone_price', __('Phone price'));
+        $show->field('appoint_price', __('Appoint price'));
+        $show->field('is_chat', __('Is chat'));
+        $show->field('is_phone', __('Is phone'));
+        $show->field('is_appoint', __('Is appoint'));
+        $show->field('latitude', __('Latitude'));
+        $show->field('longitude', __('Longitude'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+        $show->field('user_id', __('User id'));
+        $show->field('password', __('Password'));
+        $show->field('is_then', __('Is then'));
+        $show->field('practice', __('Practice'));
+        $show->field('card_photo', __('Card photo'));
+        $show->field('is_quail', __('Is quail'));
+        $show->field('card_id', __('Card id'));
+        $show->field('receiving_time', __('Receiving time'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Docter());
+
+        $form->switch('type', __('Type'));
+        $form->text('name', __('Name'));
+        $form->mobile('phone', __('Phone'));
+        $form->switch('sex', __('Sex'));
+        $form->text('birthday', __('Birthday'));
+        $form->image('avatar', __('Avatar'));
+        $form->switch('status', __('Status'))->default(1);
+        $form->text('label', __('Label'));
+        $form->text('sign', __('Sign'));
+        $form->text('intro', __('Intro'));
+        $form->number('office_id', __('Office id'));
+        $form->number('qualification_id', __('Qualification id'));
+        $form->decimal('score', __('Score'))->default(0.0);
+        $form->number('service_persons', __('Service persons'));
+        $form->number('eva_num', __('Eva num'));
+        $form->number('service_days', __('Service days'));
+        $form->number('phone_minutes', __('Phone minutes'));
+        $form->number('chat_price', __('Chat price'));
+        $form->number('phone_price', __('Phone price'));
+        $form->number('appoint_price', __('Appoint price'));
+        $form->switch('is_chat', __('Is chat'))->default(1);
+        $form->switch('is_phone', __('Is phone'))->default(1);
+        $form->switch('is_appoint', __('Is appoint'))->default(1);
+        $form->decimal('latitude', __('Latitude'))->default(0.0000000);
+        $form->decimal('longitude', __('Longitude'))->default(0.0000000);
+        $form->number('user_id', __('User id'));
+        $form->password('password', __('Password'));
+        $form->number('is_then', __('Is then'));
+        $form->text('practice', __('Practice'));
+        $form->text('card_photo', __('Card photo'));
+        $form->text('is_quail', __('Is quail'));
+        $form->text('card_id', __('Card id'));
+        $form->number('receiving_time', __('Receiving time'));
+
+        return $form;
+    }
+}

+ 5 - 1
app/Admin/Controllers/UserListController.php

xqd xqd xqd
@@ -5,7 +5,9 @@ namespace App\Admin\Controllers;
 use App\Admin\Actions\backstage\User\archives;
 use App\Admin\Actions\backstage\User\BalanceLog;
 use App\Admin\Actions\backstage\User\BlackList;
+use App\Admin\Actions\backstage\User\coupons;
 use App\Admin\Actions\backstage\User\service;
+use App\Models\Patient;
 use App\Models\User;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
@@ -40,12 +42,13 @@ class UserListController extends AdminController
             $actions->add(new service());
             $actions->add(new BalanceLog());
             $actions->add(new BlackList());
+            $actions->add(new coupons());
         });
         //筛选
         $grid->filter(function ($filter){
             $filter->disableIdFilter();
             $filter->equal('phone','手机')->mobile()->placeholder("请输入手机");
-            $filter->equal('phone','订单号')->placeholder("请输入订单号");
+            $filter->like('patient.name','患者姓名')->placeholder("请输入患者姓名");
             $filter->like('nickname','昵称');
             $filter->equal('status','用户状态')->radio([
                 ''   => '不限',
@@ -72,6 +75,7 @@ class UserListController extends AdminController
             $grid->column('last_login_time', __('最后登录时间'))->display(function ($time){
                 return date("Y-m-d H:i",$time);
             });
+            $grid->column('patient', __('患者姓名'))->pluck('name')->map('ucwords')->implode(',');
         return $grid;
     }
 

+ 2 - 0
app/Admin/routes.php

xqd
@@ -32,5 +32,7 @@ Route::group([
     $router->resource('user_orders', UserServiceController::class);
     $router->resource('user_balance_logs', UserBalanceLogController::class);
 
+    //用户管理->优惠券管理
+    $router->resource('user_coupons', UserCouponsController::class);
 });
 

+ 7 - 2
app/Models/Docter.php

xqd xqd
@@ -25,9 +25,9 @@ class Docter extends BaseModel
         return $this->belongsTo(Qualification::class)->select(['id', 'name']);
     }
 
-    public function organization()
+    public function DocterOrganization()
     {
-        return $this->belongsToMany(Organization::class);
+        return $this->belongsTo(DocterOrganization::class,'docter_id','id');
     }
 
     public function evaluate()
@@ -35,6 +35,11 @@ class Docter extends BaseModel
         return $this->hasMany(Evaluate::class)->where('status', 2);
     }
 
+    public  function teamdocter()
+    {
+        return $this->hasOne(TeamDocter::class);
+    }
+
     public function getIsCollectAttribute()
     {
         if (!empty(request()->header('token'))) {

+ 3 - 0
app/Models/Team.php

xqd
@@ -14,4 +14,7 @@ class Team extends BaseModel
     {
         return $this->belongsToMany(Docter::class, 'team_docters');
     }
+    public function DocterOrganization(){
+        return $this->belongsTo(DocterOrganization::class);
+    }
 }

+ 6 - 1
app/Models/TeamDocter.php

xqd
@@ -10,5 +10,10 @@ namespace App\Models;
 
 class TeamDocter extends BaseModel
 {
-
+    public function DocterOrganization(){
+        return $this->belongsTo(DocterOrganization::class);
+    }
+    public function docter(){
+        return $this->belongsTo(Docter::class);
+    }
 }

+ 3 - 0
app/Models/User.php

xqd
@@ -93,4 +93,7 @@ class User extends BaseModel
     public function UserBalanceLog(){
         return $this->hasMany(UserBalanceLog::class);
     }
+    public function patient(){
+        return $this->hasMany(Patient::class);
+    }
 }