소스 검색

Merge branch 'master' of ssh://git.9026.com:2212/swdz-WangHaijun/BaoMa

# Conflicts:
#	composer.lock
Swdz-WangHaiJun 4 년 전
부모
커밋
4556f9ff8e
42개의 변경된 파일842개의 추가작업 그리고 212개의 파일을 삭제
  1. 50 0
      app/Admin/Actions/backstage/Docters/LabelManagement.php
  2. 1 1
      app/Admin/Actions/backstage/Evaluate/Ignore.php
  3. 1 1
      app/Admin/Actions/backstage/Evaluate/Pass.php
  4. 19 0
      app/Admin/Actions/backstage/Orders/Evaluate.php
  5. 1 1
      app/Admin/Actions/backstage/Pass.php
  6. 2 1
      app/Admin/Actions/backstage/User/Suggests.php
  7. 1 1
      app/Admin/Controllers/ArticleManagement/ArticleController.php
  8. 91 26
      app/Admin/Controllers/OrdersManagement/BookingOrderController.php
  9. 76 25
      app/Admin/Controllers/OrdersManagement/ConsultingOrdersController.php
  10. 105 0
      app/Admin/Controllers/OrdersManagement/OrdersEvaluate.php
  11. 69 25
      app/Admin/Controllers/OrdersManagement/RechargeOrderController.php
  12. 74 24
      app/Admin/Controllers/OrdersManagement/ServicePackOrderController.php
  13. 3 2
      app/Admin/Controllers/OrdersManagement/UserSuggestsController.php
  14. 1 1
      app/Admin/Controllers/ServicePacksManagment/OpenPackController.php
  15. 1 1
      app/Admin/Controllers/ServicePacksManagment/ServebannerController.php
  16. 22 13
      app/Admin/Controllers/ServicePacksManagment/ServicePacksController.php
  17. 2 2
      app/Admin/Controllers/ServicePacksManagment/TeamController.php
  18. 0 0
      app/Admin/Controllers/ServicePacksManagment/TeamDocterController.php
  19. 1 1
      app/Admin/Controllers/UserManagement/BmUser/UserListController.php
  20. 85 0
      app/Admin/Controllers/UserManagement/DocterManagement/DocterLabelController.php
  21. 18 44
      app/Admin/Controllers/UserManagement/DocterManagement/DoctorManagementController.php
  22. 1 1
      app/Admin/Controllers/UserManagement/DocterManagement/QualificationsController.php
  23. 10 5
      app/Admin/Controllers/UserManagement/DocterManagement/UserEvaluatesController.php
  24. 1 1
      app/Admin/Controllers/VaccinesManagement/VaccinesController.php
  25. 1 1
      app/Admin/Controllers/WeChatProgram/DoctorManagement/IconsDoctorController.php
  26. 1 1
      app/Admin/Controllers/WeChatProgram/DoctorManagement/NoticeDoctorController.php
  27. 1 1
      app/Admin/Controllers/WeChatProgram/UserManagement/BannerController.php
  28. 1 1
      app/Admin/Controllers/WeChatProgram/UserManagement/IconsUserController.php
  29. 1 1
      app/Admin/Controllers/WeChatProgram/UserManagement/MenubarController.php
  30. 1 1
      app/Admin/Controllers/WeChatProgram/UserManagement/NoticeUserController.php
  31. 38 19
      app/Admin/routes.php
  32. 48 4
      app/Http/Controllers/Api/V1/DocterController.php
  33. 2 2
      app/Http/Controllers/Api/V1/PatientController.php
  34. 15 1
      app/Models/Docter.php
  35. 11 0
      app/Models/DocterLabel.php
  36. 1 1
      app/Models/Organization.php
  37. 16 1
      app/Models/ServicePack.php
  38. 3 0
      app/Models/Team.php
  39. 1 1
      app/Models/Vaccines.php
  40. 2 1
      composer.json
  41. 62 0
      composer.lock
  42. 2 0
      config/config.php

+ 50 - 0
app/Admin/Actions/backstage/Docters/LabelManagement.php

xqd
@@ -0,0 +1,50 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use App\Models\Docter;
+use App\Models\DocterLabel;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+
+class LabelManagement extends RowAction
+{
+    public $name = '标签管理';
+
+    public function handle(Model $model,Request $request)
+    {
+        // $model ...
+        $label_name = $request->get('name');
+        if ($label_name == null)
+        {
+            $label_name = [];
+        }
+        $label_num = count($label_name);
+        if($label_num > 2)
+        {
+            return $this->response()->error('不能选择超过两个标签')->refresh();
+        }
+        if ($label_num == 0)
+        {
+            Docter::where('id',$model->id)->update(['label'=>$label_name]);
+            return $this->response()->success('修改标签成功')->refresh();
+        }else
+        {
+            Docter::where('id',$model->id)->update(['label'=>$label_name]);
+            return $this->response()->success('修改标签成功')->refresh();
+        }
+
+    }
+    public function form()
+    {
+        $label = Docter::where('id',$this->row->id)->pluck('label');
+        $result = [];
+        array_walk_recursive($label, function($value) use (&$result) {
+            array_push($result, $value);
+        });
+        $this->multipleSelect('name', '请选择标签')
+            ->options(DocterLabel::all()->pluck('label_name','id'))
+            ->value($result);
+    }
+}

+ 1 - 1
app/Admin/Actions/backstage/Evaluate/Ignore.php

xqd
@@ -13,7 +13,7 @@ class Ignore extends RowAction
     public function handle(Model $model)
     {
         // $model ...
-        Evaluate::where('order_id',$model->order_id)->update(['status'=>3]);
+        Evaluate::where('id',$model->id)->update(['status'=>3,'audit_time'=>time()]);
         return $this->response()->success('忽略成功')->refresh();
     }
 

+ 1 - 1
app/Admin/Actions/backstage/Evaluate/Pass.php

xqd
@@ -13,7 +13,7 @@ class Pass extends RowAction
     public function handle(Model $model)
     {
         // $model ...
-        Evaluate::where('order_id',$model->order_id)->update(['status'=>2]);
+        Evaluate::where('id',$model->id)->update(['status'=>2,'audit_time'=>time()]);
         return $this->response()->success('审核通过.')->refresh();
     }
 

+ 19 - 0
app/Admin/Actions/backstage/Orders/Evaluate.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Orders;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class Evaluate extends RowAction
+{
+    public $name = '评价管理';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转评价管理成功')->redirect('/admin/orders_evaluates?order_id='.$this->row->id.'');
+    }
+
+}

+ 1 - 1
app/Admin/Actions/backstage/Pass.php

xqd
@@ -21,7 +21,7 @@ class Pass extends RowAction
                                                             'authentication_time'=>date('Y-m-d H:i:s'),
                                                             'authentication_end_time'=>$authentication_end_time]
                                                             );
-        Docter::where('id',$model->docter_id)->update(['is_then'=>1]);
+        Docter::where('id',$model->docter_id)->update(['is_then'=>1,'office_id'=>$model->offices_id,'qualification_id'=>$model->qualifications_id]);
         return $this->response()->success('审核通过')->refresh();
     }
 

+ 2 - 1
app/Admin/Actions/backstage/User/Suggests.php

xqd
@@ -12,7 +12,8 @@ class Suggests extends RowAction
     public function handle(Model $model)
     {
         // $model ...
-        return $this->response()->success('跳转病例意见单成功')->redirect('/admin/user_suggests?patient_id='.$this->row->patient_id.'');
+//        dd($model);
+        return $this->response()->success('跳转病例意见单成功')->redirect('/admin/user_suggests?order_id='.$this->row->id.'');
     }
 
 }

+ 1 - 1
app/Admin/Controllers/ArticleController.php → app/Admin/Controllers/ArticleManagement/ArticleController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\ArticleManagement;
 
 use App\Models\Article;
 use Encore\Admin\Controllers\AdminController;

+ 91 - 26
app/Admin/Controllers/OrdersManagement/BookingOrderController.php

xqd xqd xqd xqd
@@ -2,8 +2,10 @@
 
 namespace App\Admin\Controllers\OrdersManagement;
 
+use App\Admin\Actions\backstage\Orders\Evaluate;
 use App\Models\Order;
 use App\Admin\Actions\backstage\Orders\OrderDetails;
+use App\Models\OrderPack;
 use Encore\Admin\Controllers\AdminController;
 use App\Admin\Actions\backstage\User\MapDepot;
 use App\Admin\Actions\backstage\User\Suggests;
@@ -71,19 +73,14 @@ class BookingOrderController extends AdminController
             $actions->disableDelete();
             // 去掉编辑
             $actions->disableEdit();
-            // 去掉查看
-            $actions->disableView();
-            $actions->add(new OrderDetails());
             $actions->add(new MapDepot());
+            $actions->add(new Evaluate());
             $actions->add(new Suggests());
         });
 
         $grid->column('id', __('Id'))->sortable();
-        $grid->column('user_id', __('用户id'));
         $grid->column('user.nickname', __('用户姓名'));
-        $grid->column('docter_id', __('医生id'));
         $grid->column('docter.name', __('医生姓名'));
-        $grid->column('patient_id', __('患者id'));
         $grid->column('orderPatient.name', __('患者姓名'));
         $grid->column('orderPatient.appoint_start_time', __('预约日期'))->display(function ($time){
             return date('Y-m-d H:i:s',$time);
@@ -92,10 +89,42 @@ class BookingOrderController extends AdminController
             return date('Y-m-d H:i:s',$time);
         });
         $grid->column('product_type', __('产品类型'))->using([3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约']);
-        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
+        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付',3=>'服务包支付']);
+//        $grid->column('payment_type', __('支付方式'))->display(function ($payment_type){
+//            if ($payment_type == 1)
+//            {
+//                return '微信支付';
+//            }
+//            if ($payment_type == 2){
+//                return '余额支付';
+//            }
+//            if ($payment_type == 3){
+//////                dd($this);
+////                $patient_id = $this->patient_id;
+////                $orde_id = Order::where('patient_id',$patient_id)->where('product_type',6)->get('id');
+//                return '服务包支付';
+//            }
+//        });
         $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
         $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
-
+        $grid->column('total_amount', __('订单总金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_amount', __('用户实际支付的金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_time', __('支付时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('receiving_time', __('接单时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('订单完成时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
         return $grid;
     }
 
@@ -108,25 +137,61 @@ class BookingOrderController extends AdminController
     protected function detail($id)
     {
         $show = new Show(Order::findOrFail($id));
-
         $show->field('id', __('Id'));
-        $show->field('user_id', __('User id'));
-        $show->field('docter_id', __('Docter id'));
-        $show->field('patient_id', __('Patient id'));
-        $show->field('organization_id', __('Organization id'));
-        $show->field('order_sn', __('Order sn'));
-        $show->field('payment_type', __('Payment type'));
-        $show->field('product_type', __('Product type'));
-        $show->field('order_status', __('Order status'));
-        $show->field('payment_status', __('Payment status'));
-        $show->field('total_amount', __('Total amount'));
-        $show->field('payment_amount', __('Payment amount'));
-        $show->field('discount_amount', __('Discount amount'));
-        $show->field('payment_time', __('Payment time'));
-        $show->field('created_at', __('Created at'));
-        $show->field('updated_at', __('Updated at'));
-        $show->field('outtime', __('Outtime'));
-        $show->field('receiving_time', __('Receiving time'));
+        $show->field('user_id', __('用户id'));
+        $show->field('user.nickname', __('用户姓名'));
+        $show->field('docter_id', __('医生id'));
+        $show->field('docter.name', __('医生姓名'));
+        $show->field('patient_id', __('患者id'));
+        $show->field('orderPatient.name', __('患者姓名'));
+        $show->field('organization_id', __('机构id'));
+        $show->field('organization.name', __('机构名'));
+        $show->field('order_sn', __('订单号'));
+        $show->field('product_type', __('产品类型'))->using([3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约']);
+        $show->field('payment_type', __('支付类型'))->using([1=>'微信支付',2=>'余额支付']);
+        $show->field('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $show->field('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $show->field('total_amount', __('	订单总金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_amount', __('用户实际支付的金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('discount_amount', __('折扣金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_time', __('支付时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('receiving_time', __('接单时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('end_time', __('订单完成时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('created_at', __('创建时间'));
+        $show->field('updated_at', __('更新时间'));
 
         return $show;
     }

+ 76 - 25
app/Admin/Controllers/OrdersManagement/ConsultingOrdersController.php

xqd xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\OrdersManagement;
 
+use App\Admin\Actions\backstage\Orders\Evaluate;
 use App\Admin\Actions\backstage\Orders\OrderDetails;
 use App\Admin\Actions\backstage\User\MapDepot;
 use App\Admin\Actions\backstage\User\Suggests;
@@ -68,25 +69,38 @@ class ConsultingOrdersController extends AdminController
             $actions->disableDelete();
             // 去掉编辑
             $actions->disableEdit();
-            // 去掉查看
-            $actions->disableView();
-            $actions->add(new OrderDetails());
             $actions->add(new MapDepot());
+            $actions->add(new Evaluate());
             $actions->add(new Suggests());
 
         });
         $grid->column('id', __('Id'))->sortable();
-        $grid->column('user_id', __('用户id'));
         $grid->column('user.nickname', __('用户姓名'));
-        $grid->column('docter_id', __('医生id'));
         $grid->column('docter.name', __('医生姓名'));
-        $grid->column('patient_id', __('患者id'));
         $grid->column('orderPatient.name', __('患者姓名'));
         $grid->column('orderPatient.symptoms', __('患者描述'));
         $grid->column('product_type', __('产品类型'))->using([1=>'电话咨询',2=>'图文咨询']);
-        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
+        $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付',3=>'服务包支付']);
         $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
         $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $grid->column('total_amount', __('订单总金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_amount', __('用户实际支付的金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_time', __('支付时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('receiving_time', __('接单时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('订单完成时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
 
         return $grid;
     }
@@ -100,25 +114,62 @@ class ConsultingOrdersController extends AdminController
     protected function detail($id)
     {
         $show = new Show(Order::findOrFail($id));
-
         $show->field('id', __('Id'));
-        $show->field('user_id', __('User id'));
-        $show->field('docter_id', __('Docter id'));
-        $show->field('patient_id', __('Patient id'));
-        $show->field('organization_id', __('Organization id'));
-        $show->field('order_sn', __('Order sn'));
-        $show->field('payment_type', __('Payment type'));
-        $show->field('product_type', __('Product type'));
-        $show->field('order_status', __('Order status'));
-        $show->field('payment_status', __('Payment status'));
-        $show->field('total_amount', __('Total amount'));
-        $show->field('payment_amount', __('Payment amount'));
-        $show->field('discount_amount', __('Discount amount'));
-        $show->field('payment_time', __('Payment time'));
-        $show->field('created_at', __('Created at'));
-        $show->field('updated_at', __('Updated at'));
-        $show->field('outtime', __('Outtime'));
-        $show->field('receiving_time', __('Receiving time'));
+        $show->field('user_id', __('用户id'));
+        $show->field('user.nickname', __('用户姓名'));
+        $show->field('docter_id', __('医生id'));
+        $show->field('docter.name', __('医生姓名'));
+        $show->field('patient_id', __('患者id'));
+        $show->field('orderPatient.name', __('患者姓名'));
+        $show->field('organization_id', __('机构id'));
+        $show->field('organization.name', __('机构名'));
+        $show->field('order_sn', __('订单号'));
+        $show->field('product_type', __('产品类型'))->using([1=>'电话咨询',2=>'图文咨询']);
+        $show->field('payment_type', __('支付类型'))->using([1=>'微信支付',2=>'余额支付']);
+        $show->field('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $show->field('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $show->field('total_amount', __('	订单总金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_amount', __('用户实际支付的金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('discount_amount', __('折扣金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_time', __('支付时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('receiving_time', __('接单时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('end_time', __('订单完成时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('created_at', __('创建时间'));
+        $show->field('updated_at', __('更新时间'));
+
 
         return $show;
     }

+ 105 - 0
app/Admin/Controllers/OrdersManagement/OrdersEvaluate.php

xqd
@@ -0,0 +1,105 @@
+<?php
+
+namespace App\Admin\Controllers\OrdersManagement;
+
+use App\Models\Evaluate;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class OrdersEvaluate extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '评价管理';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Evaluate());
+        $grid->filter(function ($filter){
+            $filter->disableIdFilter();
+            $filter->like('user.nickname','用户名字');
+            $filter->like('docter.name','医生名字');
+            $filter->like('content','评价内容');
+            $filter->equal('order_id','订单id');
+            $filter->equal('status','审核状态')->select([
+                1   => '待审核',
+                2    => '审核通过',
+                3    => '忽略',
+            ]);
+        });
+        $grid->disableActions();
+        $grid->column('id', __('Id'));
+        $grid->column('order_id', __('订单ID'));
+        $grid->column('user.nickname', __('用户姓名'));
+        $grid->column('docter.name', __('医生名称'));
+        $grid->column('content', __('评价内容'));
+        $grid->column('score', __('评分'));
+        $grid->column('status', __('状态'))->using([1=>'待审核',2=>'审核通过',3=>'忽略']);
+        $grid->column('audit_time', __('审核时间'))->display(function ($time){
+            if($time == 0)
+                return '';
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $grid->column('created_at', __('创建时间'));
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Evaluate::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('user_id', __('User id'));
+        $show->field('order_id', __('Order id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('status', __('Status'));
+        $show->field('audit_time', __('Audit time'));
+        $show->field('content', __('Content'));
+        $show->field('score', __('Score'));
+        $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 Evaluate());
+
+        $form->number('user_id', __('User id'));
+        $form->number('order_id', __('Order id'));
+        $form->number('docter_id', __('Docter id'));
+        $form->switch('status', __('Status'))->default(1);
+        $form->number('audit_time', __('Audit time'));
+        $form->text('content', __('Content'));
+        $form->switch('score', __('Score'));
+
+        return $form;
+    }
+}

+ 69 - 25
app/Admin/Controllers/OrdersManagement/RechargeOrderController.php

xqd xqd xqd xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\OrdersManagement;
 
+use App\Admin\Actions\backstage\Orders\Evaluate;
 use App\Models\Order;
 use App\Admin\Actions\backstage\Orders\OrderDetails;
 use Encore\Admin\Controllers\AdminController;
@@ -52,9 +53,7 @@ class RechargeOrderController extends AdminController
             $actions->disableDelete();
             // 去掉编辑
             $actions->disableEdit();
-            // 去掉查看
-            $actions->disableView();
-            $actions->add(new OrderDetails());
+            $actions->add(new Evaluate());
         });
 
         $grid->column('id', __('Id'))->sortable();
@@ -62,6 +61,8 @@ class RechargeOrderController extends AdminController
         $grid->column('user.nickname', __('用户姓名'));
         $grid->column('product_type', __('产品类型'))->using([7=>'充值订单']);
         $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
+        $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
         $grid->column('total_amount', __('订单总金额'))->display(function ($money){
             return $money/100;
         });
@@ -71,9 +72,15 @@ class RechargeOrderController extends AdminController
         $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
             return $money/100;
         });
-        $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
-        $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
-
+        $grid->column('payment_time', __('支付时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('receiving_time', __('接单时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('订单完成时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
         return $grid;
     }
 
@@ -85,26 +92,63 @@ class RechargeOrderController extends AdminController
      */
     protected function detail($id)
     {
-        $show = new Show(Order::findOrFail($id));
-
+        $show = new Show(Order::findOrFail($id));        $show->field('id', __('Id'));
         $show->field('id', __('Id'));
-        $show->field('user_id', __('User id'));
-        $show->field('docter_id', __('Docter id'));
-        $show->field('patient_id', __('Patient id'));
-        $show->field('organization_id', __('Organization id'));
-        $show->field('order_sn', __('Order sn'));
-        $show->field('payment_type', __('Payment type'));
-        $show->field('product_type', __('Product type'));
-        $show->field('order_status', __('Order status'));
-        $show->field('payment_status', __('Payment status'));
-        $show->field('total_amount', __('Total amount'));
-        $show->field('payment_amount', __('Payment amount'));
-        $show->field('discount_amount', __('Discount amount'));
-        $show->field('payment_time', __('Payment time'));
-        $show->field('created_at', __('Created at'));
-        $show->field('updated_at', __('Updated at'));
-        $show->field('outtime', __('Outtime'));
-        $show->field('receiving_time', __('Receiving time'));
+        $show->field('user_id', __('用户id'));
+        $show->field('user.nickname', __('用户姓名'));
+        $show->field('docter_id', __('医生id'));
+        $show->field('docter.name', __('医生姓名'));
+        $show->field('patient_id', __('患者id'));
+        $show->field('orderPatient.name', __('患者姓名'));
+        $show->field('organization_id', __('机构id'));
+        $show->field('organization.name', __('机构名'));
+        $show->field('order_sn', __('订单号'));
+        $show->field('product_type', __('产品类型'))->using([7=>'充值订单']);
+        $show->field('payment_type', __('支付类型'))->using([1=>'微信支付',2=>'余额支付']);
+        $show->field('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $show->field('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $show->field('total_amount', __('	订单总金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_amount', __('用户实际支付的金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('discount_amount', __('折扣金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_time', __('支付时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('receiving_time', __('接单时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('end_time', __('订单完成时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('created_at', __('创建时间'));
+        $show->field('updated_at', __('更新时间'));
+
 
         return $show;
     }

+ 74 - 24
app/Admin/Controllers/OrdersManagement/ServicePackOrderController.php

xqd xqd xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\OrdersManagement;
 
+use App\Admin\Actions\backstage\Orders\Evaluate;
 use App\Models\Order;
 use App\Admin\Actions\backstage\Orders\OrderDetails;
 use Encore\Admin\Controllers\AdminController;
@@ -59,16 +60,12 @@ class ServicePackOrderController extends AdminController
             $actions->disableDelete();
             // 去掉编辑
             $actions->disableEdit();
-            // 去掉查看
-            $actions->disableView();
-            $actions->add(new OrderDetails());
             $actions->add(new MapDepot());
             $actions->add(new Suggests());
+            $actions->add(new Evaluate());
         });
         $grid->column('id', __('Id'))->sortable();
-        $grid->column('user_id', __('用户id'));
         $grid->column('user.nickname', __('用户姓名'));
-        $grid->column('patient_id', __('患者id'));
         $grid->column('orderPatient.name', __('患者姓名'));
         $grid->column('orderPack.service_pack_id', __('服务包id'));
         $grid->column('orderPack.pack_name', __('服务包名称'));
@@ -79,7 +76,24 @@ class ServicePackOrderController extends AdminController
         $grid->column('payment_type', __('支付方式'))->using([1=>'微信支付',2=>'余额支付']);
         $grid->column('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
         $grid->column('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
-
+        $grid->column('total_amount', __('订单总金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_amount', __('用户实际支付的金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('payment_time', __('支付时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('receiving_time', __('接单时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('订单完成时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
         return $grid;
     }
 
@@ -92,25 +106,61 @@ class ServicePackOrderController extends AdminController
     protected function detail($id)
     {
         $show = new Show(Order::findOrFail($id));
-
         $show->field('id', __('Id'));
-        $show->field('user_id', __('User id'));
-        $show->field('docter_id', __('Docter id'));
-        $show->field('patient_id', __('Patient id'));
-        $show->field('organization_id', __('Organization id'));
-        $show->field('order_sn', __('Order sn'));
-        $show->field('payment_type', __('Payment type'));
-        $show->field('product_type', __('Product type'));
-        $show->field('order_status', __('Order status'));
-        $show->field('payment_status', __('Payment status'));
-        $show->field('total_amount', __('Total amount'));
-        $show->field('payment_amount', __('Payment amount'));
-        $show->field('discount_amount', __('Discount amount'));
-        $show->field('payment_time', __('Payment time'));
-        $show->field('created_at', __('Created at'));
-        $show->field('updated_at', __('Updated at'));
-        $show->field('outtime', __('Outtime'));
-        $show->field('receiving_time', __('Receiving time'));
+        $show->field('user_id', __('用户id'));
+        $show->field('user.nickname', __('用户姓名'));
+        $show->field('docter_id', __('医生id'));
+        $show->field('docter.name', __('医生姓名'));
+        $show->field('patient_id', __('患者id'));
+        $show->field('orderPatient.name', __('患者姓名'));
+        $show->field('organization_id', __('机构id'));
+        $show->field('organization.name', __('机构名'));
+        $show->field('order_sn', __('订单号'));
+        $show->field('product_type', __('产品类型'))->using([6=>'服务包订单']);
+        $show->field('payment_type', __('支付类型'))->using([1=>'微信支付',2=>'余额支付']);
+        $show->field('order_status', __('订单状态'))->using([1=>'未支付',2=>'待接单',3=>'进行中',4=>'已完成',5=>'已取消']);
+        $show->field('payment_status', __('支付状态'))->using([1=>'待付款',2=>'已付款',3=>'退款中',4=>'已退款']);
+        $show->field('total_amount', __('	订单总金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_amount', __('用户实际支付的金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('discount_amount', __('折扣金额'))->as(function ($money){
+            return $money/100;
+        });
+        $show->field('payment_time', __('支付时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('receiving_time', __('接单时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('end_time', __('订单完成时间'))->as(function ($time){
+            if($time == 0)
+            {
+                return '';
+            }
+            else
+            {
+                return date('Y-m-d H:i:s',$time);
+            }
+        });
+        $show->field('created_at', __('创建时间'));
+        $show->field('updated_at', __('更新时间'));
 
         return $show;
     }

+ 3 - 2
app/Admin/Controllers/OrdersManagement/UserSuggestsController.php

xqd
@@ -27,10 +27,11 @@ class UserSuggestsController extends AdminController
     {
         $grid = new Grid(new Suggest());
         $grid->disableCreateButton();
-        $uesr_id = \request('patient_id');
+        $grid->disableActions();
+        $uesr_id = \request('order_id');
         $grid->filter(function ($filter){
             $filter->disableIdFilter();
-            $filter->equal('patient_id','档案id');
+            $filter->equal('order_id','订单id');
         });
         $grid->column('id', __('Id'));
         $grid->column('order_id', __('订单id'));

+ 1 - 1
app/Admin/Controllers/OpenPackController.php → app/Admin/Controllers/ServicePacksManagment/OpenPackController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\ServicePacksManagment;
 
 use App\Models\Team;
 use App\Models\Order;

+ 1 - 1
app/Admin/Controllers/ServebannerController.php → app/Admin/Controllers/ServicePacksManagment/ServebannerController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\ServicePacksManagment;
 
 use App\Models\Servebanner;
 use Encore\Admin\Controllers\AdminController;

+ 22 - 13
app/Admin/Controllers/ServicePacksController.php → app/Admin/Controllers/ServicePacksManagment/ServicePacksController.php

xqd xqd xqd xqd xqd xqd xqd
@@ -1,8 +1,9 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\ServicePacksManagment;
 
 use App\Models\ServicePack;
+use App\Models\Team;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -32,10 +33,11 @@ class ServicePacksController extends AdminController
         $grid->column('desc', __('详细内容'))->limit(100);
         $grid->column('label','服务类型')->display(function (){
             $tag = [1 => '图文',2 => '电话',3 => '门诊',4 => '计免',5 => '儿保'];
-            $data = $this -> label;
-            if($data){
-                for ($i=0;$i<count($data);$i++){
-                    $str = $tag[$data[$i]];
+            $datas = $this -> label;
+
+            if($datas){
+                for ($i=0;$i<count($datas);$i++){
+                    $str = $tag[$datas[$i]];
                     $label[$i]= $str;
                 }
                 return $label;
@@ -43,7 +45,18 @@ class ServicePacksController extends AdminController
             return 0;
         })->label('info');
         $grid->column('price', __('价格'));
-        $grid->column('team.name', __('团队名称'));
+        $grid->column('team_id', __('团队名称'))->display(function (){
+            $modal = $this->team_id;
+            if ($modal){
+                for ($i=0; $i < count((array)$modal); $i++){
+                    $id = $modal[$i];
+                    $name[$i] = Team::where('id',$id)->value('name');
+                }
+                return $name;
+            }
+            return '通用';
+        })->label('success');
+
         $grid->column('image','图片')->image('','50','50');
         $grid->column('phone_minutes', __('电话次数(分钟)'));
         $grid->column('chat_num', __('图文次数'));
@@ -51,8 +64,6 @@ class ServicePacksController extends AdminController
         $grid->column('vaccine_limit_amount', __('计免次数'));
         $grid->column('nurses_limit_amount', __('儿保次数'));
         $grid->column('effective_days', __('服务时长'));
-        $grid->column('insurance_policy', __('保单名称'));
-        $grid->column('insurance_img_url', __('保单图片链接'));
         $grid->column('created_at', __('创建时间'));
         $grid->column('updated_at', __('更新时间'));
 
@@ -72,7 +83,7 @@ class ServicePacksController extends AdminController
         $form->text('intro', __('简介'))->rules('required' ,['required'=>'请填写简介!']);;
         $form->editor('desc', __('详情内容'))->rules('required' ,['required'=>'请填写内容!']);;
         $form->number('price', __('价钱'))->default(0);
-        $form->text('team_id', __('团队ID'));
+        $form->multipleSelect('team_id', __('团队选择'))->options(Team::all()->pluck('name','id'));
         //$form->multipleSelect('label','服务类型')->options([1 => '图文',2 => '电话',3 => '门诊',4 => '计免',5 => '儿保']);
         $form->checkbox('label','服务类型')
             ->options([
@@ -91,7 +102,7 @@ class ServicePacksController extends AdminController
                 $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
             })->when('has',5,function (Form $form){
                 $form->number('nurses_limit_amount', __('儿保次数'))->default(0);
-            });
+            })->rules('required',['required'=>'请选择服务类型']);
 
 //        $form->number('phone_minutes', __('电话次数(分钟)'))->default(0);
 //        $form->number('chat_num', __('图文次数'))->default(0);
@@ -99,9 +110,7 @@ class ServicePacksController extends AdminController
 //        $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
 //        $form->number('nurses_limit_amount', __('儿保次数'))->default(0);
         $form->text('effective_days', __('服务时长(秒)'))->default(0);
-        $form->text('insurance_policy', __('保单名称'))->rules('required' ,['required'=>'请填写保单名称!']);
-        $form->text('insurance_img_url', __('保单图片链接'))->rules('required' ,['required'=>'请填写保单图片链接!']);
-
+        $form->image('insurance_img_url', __('保单图片'))->rules('required' ,['required'=>'请选择图片!'])->help('请上传PTf格式!!');
         return $form;
     }
 }

+ 2 - 2
app/Admin/Controllers/TeamController.php → app/Admin/Controllers/ServicePacksManagment/TeamController.php

xqd xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\ServicePacksManagment;
 
 use App\Admin\Actions\Serve\Addmember;
 use App\Models\Docter;
@@ -82,7 +82,7 @@ class TeamController extends AdminController
         $form->switch('status', __('状态'))->states($status);
         $form->saved(function (Form $form){
 //           dd($form->member);
-            
+
             dd($form->model()->id);
 
 

+ 0 - 0
app/Admin/Controllers/TeamDocterController.php → app/Admin/Controllers/ServicePacksManagment/TeamDocterController.php


+ 1 - 1
app/Admin/Controllers/UserManagement/BmUser/UserListController.php

xqd
@@ -76,7 +76,7 @@ class UserListController extends AdminController
                 return date("Y-m-d H:i",$time);
             });
 //            $grid->column('patient', __('患者姓名'))->pluck('name')->map('ucwords')->implode(',');
-            $grid->column('patient', __('患者姓名'))->pluck('name')->label('default');
+//            $grid->column('patient', __('患者姓名'))->pluck('name')->label('default');
         return $grid;
     }
 

+ 85 - 0
app/Admin/Controllers/UserManagement/DocterManagement/DocterLabelController.php

xqd
@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\DocterLabel;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class DocterLabelController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '标签管理';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new DocterLabel());
+        $grid->actions(function ($actions) {
+            // 去掉查看
+            $actions->disableView();
+        });
+        $grid->column('id', __('Id'));
+        $grid->column('label_name', __('标签名称'));
+        $states = [
+            'on'  => ['value' => 1, 'text' => '启用', 'color' => 'primary'],
+            'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
+        ];
+        $grid->column('status', __('状态'))->switch($states);
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(DocterLabel::findOrFail($id));
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new DocterLabel());
+        $form->footer(function ($footer) {
+            // 去掉`查看`checkbox
+            $footer->disableViewCheck();
+            // 去掉`继续编辑`checkbox
+            $footer->disableEditingCheck();
+            // 去掉`继续创建`checkbox
+            $footer->disableCreatingCheck();
+        });
+        $form->tools(function (Form\Tools $tools) {
+            // 去掉`列表`按钮
+            $tools->disableList();
+            // 去掉`删除`按钮
+            $tools->disableDelete();
+            // 去掉`查看`按钮
+            $tools->disableView();
+        });
+
+        $form->text('label_name', __('标签名'))->rules('required|max:8');
+        $form->switch('status', __('状态'))->default(1);
+
+        return $form;
+    }
+}

+ 18 - 44
app/Admin/Controllers/UserManagement/DocterManagement/DoctorManagementController.php

xqd xqd xqd xqd xqd xqd
@@ -2,9 +2,13 @@
 
 namespace App\Admin\Controllers\UserManagement\DocterManagement;
 
+use App\Admin\Actions\backstage\Docters\AddLabel;
+use App\Admin\Actions\backstage\Docters\DelLabel;
+use App\Admin\Actions\backstage\Docters\LabelManagement;
 use App\Admin\Actions\backstage\Docters\SignUp;
 use App\Admin\Actions\backstage\Docters\Team;
 use App\Models\Docter;
+use App\Models\DocterLabel;
 use App\Models\DocterOrganization;
 use App\Models\Organization;
 use App\Models\User;
@@ -34,13 +38,17 @@ class DoctorManagementController extends AdminController
         $grid->filter(function ($filter){
             $filter->disableIdFilter();
             $filter->like('name','昵称');
+//            $filter->like('organization','机构名称');
+            $filter->where(function ($query) {
+                $query->whereHas('organization',function ($query){
+                    $query->where('name','like',"%{$this->input}%");
+                });
+            },'机构名');
             $filter->equal('status','工作状态')->select([
                 0    => '禁用',
                 1    => '启用',
             ]);
-
         });
-
         $grid->actions(function ($actions) {
             // 去掉编辑
             $actions->disableEdit();
@@ -50,11 +58,13 @@ class DoctorManagementController extends AdminController
             $actions->add(new SignUp());
             //团队管理
             $actions->add(new Team());
+            //标签管理
+            $actions->add(new LabelManagement());
         });
-
         $grid->column('id', __('Id'))->sortable();
         $grid->column('name', __('姓名'));
         $grid->column('avatar', __('头像'))->image('',50,50);
+        $grid->column('phone', __('电话'));
         $grid->column('score', __('评分'));
         $grid->column('service_persons', __('服务人数'));
         $states = [
@@ -62,11 +72,14 @@ class DoctorManagementController extends AdminController
             'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
         ];
         $grid->column('status', __('工作状态'))->switch($states);
+        $grid->column('organization', __('所属机构'))->pluck('name')->label('info');
         $grid->column('is_then', __('认证状态'))->using([0=>'未认证',1=>'已认证']);
-        $grid->column('label', __('标签'))->label('info');
+        $grid->column('label', __('标签'))->display(function ($label){
+                $label_value = DocterLabel::whereIn('id',$label)->pluck('label_name');
+                return $label_value;
+        })->label('info');
         return $grid;
     }
-
     /**
      * Make a show builder.
      *
@@ -76,44 +89,6 @@ class DoctorManagementController extends AdminController
     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;
     }
 
@@ -125,7 +100,6 @@ class DoctorManagementController extends AdminController
     protected function form()
     {
         $form = new Form(new Docter());
-
         $form->switch('status', __('状态'));
         return $form;
     }

+ 1 - 1
app/Admin/Controllers/UserManagement/DocterManagement/QualificationsController.php

xqd
@@ -15,7 +15,7 @@ class QualificationsController extends AdminController
      *
      * @var string
      */
-    protected $title = '职称类别';
+    protected $title = '资质管理';
 
     /**
      * Make a grid builder.

+ 10 - 5
app/Admin/Controllers/UserManagement/DocterManagement/UserEvaluatesController.php

xqd xqd
@@ -35,10 +35,15 @@ class UserEvaluatesController extends AdminController
             $actions->disableEdit();
             //去掉查看
             $actions->disableView();
-            //审核通过
-            $actions->add(new Pass());
-            //忽略
-            $actions->add(new Ignore());
+            //只有状态为待审核才可以显示通过和忽略
+            if ($actions->row->status ==1)
+            {
+                //审核通过
+                $actions->add(new Pass());
+                //忽略
+                $actions->add(new Ignore());
+            }
+
         });
 
         $grid->filter(function ($filter){
@@ -46,7 +51,7 @@ class UserEvaluatesController extends AdminController
             $filter->like('user.nickname','用户名字');
             $filter->like('docter.name','医生名字');
             $filter->like('content','评价内容');
-            $filter->equal('status','审核状态')->select([
+                $filter->equal('status','审核状态')->select([
                 1   => '待审核',
                 2    => '审核通过',
                 3    => '忽略',

+ 1 - 1
app/Admin/Controllers/VaccinesController.php → app/Admin/Controllers/VaccinesManagement/VaccinesController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\VaccinesManagement;
 
 use App\Models\Organization;
 use App\Models\Vaccines;

+ 1 - 1
app/Admin/Controllers/IconsDoctorController.php → app/Admin/Controllers/WeChatProgram/DoctorManagement/IconsDoctorController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\DoctorManagement;
 
 use App\Models\Icons;
 use Encore\Admin\Controllers\AdminController;

+ 1 - 1
app/Admin/Controllers/NoticeDoctorController.php → app/Admin/Controllers/WeChatProgram/DoctorManagement/NoticeDoctorController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\DoctorManagement;
 
 use App\Models\Notice;
 use Encore\Admin\Controllers\AdminController;

+ 1 - 1
app/Admin/Controllers/BannerController.php → app/Admin/Controllers/WeChatProgram/UserManagement/BannerController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\UserManagement;
 
 use App\Models\Banner;
 use Encore\Admin\Controllers\AdminController;

+ 1 - 1
app/Admin/Controllers/IconsUserController.php → app/Admin/Controllers/WeChatProgram/UserManagement/IconsUserController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\UserManagement;
 
 use App\Models\Icons;
 use Encore\Admin\Controllers\AdminController;

+ 1 - 1
app/Admin/Controllers/MenubarController.php → app/Admin/Controllers/WeChatProgram/UserManagement/MenubarController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\UserManagement;
 
 use App\Models\Menubar;
 use Encore\Admin\Controllers\AdminController;

+ 1 - 1
app/Admin/Controllers/NoticeUserController.php → app/Admin/Controllers/WeChatProgram/UserManagement/NoticeUserController.php

xqd
@@ -1,6 +1,6 @@
 <?php
 
-namespace App\Admin\Controllers;
+namespace App\Admin\Controllers\WeChatProgram\UserManagement;
 
 use App\Models\Notice;
 use Encore\Admin\Controllers\AdminController;

+ 38 - 19
app/Admin/routes.php

xqd xqd xqd xqd
@@ -18,14 +18,12 @@ Route::group([
     $router->resource('/cdms_user', CdmsController::class);
     $router->resource('/organizations', OrganizationController::class);
     $router->resource('/docters', DocterController::class);
-    $router->resource('banners', BannerController::class);
-    //服务包海报
-    $router->resource('servebanners', ServebannerController::class);
+
+
     //文章管理
-    $router->resource('articles', ArticleController::class);
+    $router->resource('articles', ArticleManagement\ArticleController::class);
     //疫苗管理
-    $router->resource('vaccines', VaccinesController::class);
-    $router->resource('service_applys',ServiceapplysController::class);
+    $router->resource('vaccines', VaccinesManagement\VaccinesController::class);
     //电话咨询认证
     $router->resource('phone_service_cc',PhoneServiceCCController::class);
     $router->resource('phone_service',PhoneServiceController::class);
@@ -35,20 +33,38 @@ Route::group([
     //门诊咨询认证
     $router->resource('outpatient_service_cc',OutpatientServiceCCController::class);
     $router->resource('outpatient_service',OutpatientServiceController::class);
+
+    /*
+     * 小程序管理
+     */
+    //--->用户端
+    //公告管理
+    $router->resource('notices_user', WeChatProgram\UserManagement\NoticeUserController::class);
     //图标DIV
-    $router->resource('icons_user', IconsUserController::class);
-    $router->resource('icons_doctor', IconsDoctorController::class);
-    //公告管理->用户&医生
-    $router->resource('notices_user', NoticeUserController::class);
-    $router->resource('notices_doctor', NoticeDoctorController::class);
-    //小程序->用户端->底部菜单
-    $router->resource('menubars', MenubarController::class);
-    $router->resource('teams',TeamController::class);
-    //服务包管理
-    $router->resource('service_packs', ServicePacksController::class);
+    $router->resource('icons_user', WeChatProgram\UserManagement\IconsUserController::class);
+    //轮播图
+    $router->resource('banners', WeChatProgram\UserManagement\BannerController::class);
+    //底部菜单
+    $router->resource('menubars', WeChatProgram\UserManagement\MenubarController::class);
+    //--->医生端
+    //图标DIV
+    $router->resource('icons_doctor', WeChatProgram\DoctorManagement\IconsDoctorController::class);
+    //公告管理
+    $router->resource('notices_doctor', WeChatProgram\DoctorManagement\NoticeDoctorController::class);
+
+
+    /*
+     * 服务包管理
+     */
+    //服务包列表
+    $router->resource('service_packs', ServicePacksManagment\ServicePacksController::class);
+    //服务包海报
+    $router->resource('servebanners', ServicePacksManagment\ServebannerController::class);
+    //团队医生
+    $router->resource('teams',ServicePacksManagment\TeamController::class);
     $router->resource('team_docter',TeamDocterController::class);
-    //服务包管理->开通记录
-    $router->resource('open_pack', OpenPackController::class);
+    //开通记录
+    $router->resource('open_pack', ServicePacksManagment\OpenPackController::class);
 
     $router->resource('/setting', 'Config\ConfigController');
     $router->get('/setting_form', 'Config\FormController@form');
@@ -69,7 +85,8 @@ Route::group([
     $router->resource('evaluates', UserManagement\DocterManagement\UserEvaluatesController::class);
     //职称类别
     $router->resource('qualifications', UserManagement\DocterManagement\QualificationsController::class);
-
+    //标签管理
+    $router->resource('docter_labels', UserManagement\DocterManagement\DocterLabelController::class);
     /*
      * 用户管理->宝妈用户
      * */
@@ -99,6 +116,8 @@ Route::group([
     $router->resource('orders_details', OrdersManagement\OrdersDetailsController::class);
     //订单记录中->病例意见单
     $router->resource('user_suggests', OrdersManagement\UserSuggestsController::class);
+    //评价管理
+    $router->resource('orders_evaluates', OrdersManagement\OrdersEvaluate::class);
 
     /*
      * 优惠券管理

+ 48 - 4
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd xqd
@@ -8,6 +8,7 @@
 
 namespace App\Http\Controllers\Api\V1;
 
+use App\Models\Collection;
 use App\Models\Docter;
 use App\Models\Organization;
 use App\Models\Schedule;
@@ -53,15 +54,28 @@ class DocterController extends AuthController
                 $tmpDocterIds = array_column($v['docter'], 'id');
                 $docterIds = array_merge($docterIds, $tmpDocterIds);
             }
-            $docterIds = array_values(array_unique($docterIds));
-            $builder->where(function ($query) use($name, $docterIds) {
-                $query->where('name', 'like', '%'.$name.'%')->orWhereIn('id', $docterIds);
+            $orgDocterIds = array_values(array_unique($docterIds));
+            $builder->where(function ($query) use($name, $orgDocterIds) {
+                $query->where('name', 'like', '%'.$name.'%')->orWhereIn('id', $orgDocterIds);
             });
         }
+        if (!empty($req['city_id'])) {
+            $organizations = Organization::with('docter')->select(['id'])->where('city_id', $req['city_id'])->get()->toArray();
+            $docterIds = [];
+            foreach ($organizations as $k => $v) {
+                $tmpDocterIds = array_column($v['docter'], 'id');
+                $docterIds = array_merge($docterIds, $tmpDocterIds);
+            }
+            $cityDocterIds = array_values(array_unique($docterIds));
+            $builder->whereIn('id', $cityDocterIds);
+        }
 
         if ($list_type == 3) {
             $docterIds2 = SchedulePeriod::where('time_period_id', $req['time_period_id'])->where('schedule_date', $req['schedule_date'])->pluck('docter_id')->toArray();
             $builder->whereIn('id', $docterIds2);
+            //查询我关注的医生
+            $docterIds3 = Collection::where('user_id', $user['id'])->where('docter_id', '>', 0)->pluck('docter_id')->toArray();
+            $builder->whereNotIn('id', $docterIds3);
         }
 
         if (!empty($req['sort_type'])) {
@@ -75,7 +89,37 @@ class DocterController extends AuthController
                 $builder->orderBy('service_persons', 'desc');
             }
         }
-        $data = $builder->paginate();
+        $data = $builder->paginate()->toArray();
+
+        //组合我关注的医生,放在最前面
+        $page = empty($req['page']) ? 1 : $req['page'];
+        if ($list_type == 3 && $page == 1) {
+            $builder2 = Docter::with('office', 'qualification')->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->whereIn('id', $docterIds3)->whereIn('id', $docterIds2)->where('status', 1)->where('is_then', 1)->where('phone', '<>', '')->where('is_appoint', 1);
+            if (!empty($req['name'])) {
+                $builder2->where(function ($query) use($name, $orgDocterIds) {
+                    $query->where('name', 'like', '%'.$name.'%')->orWhereIn('id', $orgDocterIds);
+                });
+            }
+            if (!empty($req['city_id'])) {
+                $builder2->whereIn('id', $cityDocterIds);
+            }
+            if (!empty($req['sort_type'])) {
+                if ($req['sort_type'] == 1) {
+                    $builder2->orderBy('distance', 'asc');
+                }
+                elseif ($req['sort_type'] == 2) {
+                    $builder2->orderBy('eva_num', 'desc');
+                }
+                elseif ($req['sort_type'] == 3) {
+                    $builder2->orderBy('service_persons', 'desc');
+                }
+            }
+
+            $collectDocters = $builder2->get()->toArray();
+            if (!empty($collectDocters)) {
+                $data['data'] = array_merge($collectDocters, $data['data'] );
+            }
+        }
 
         return out($data);
     }

+ 2 - 2
app/Http/Controllers/Api/V1/PatientController.php

xqd xqd
@@ -25,7 +25,7 @@ class PatientController extends AuthController
             'info' => 'max:1000',
             'card_type' => 'in:0,1,2',
             'card_number' => 'max:50',
-            'email' => 'required|email',
+            'email' => 'email',
             'phone' => 'required',
             'guardian_name' => 'required',
             'address' => 'required',
@@ -53,7 +53,7 @@ class PatientController extends AuthController
             'info' => 'max:1000',
             'card_type' => 'in:0,1,2',
             'card_number' => 'max:50',
-            'email' => 'required|email',
+            'email' => 'email',
             'phone' => 'required',
             'guardian_name' => 'required',
             'address' => 'required',

+ 15 - 1
app/Models/Docter.php

xqd xqd
@@ -13,7 +13,7 @@ class Docter extends BaseModel
     protected $casts = [
         'label' => 'json',
     ];
-    protected $appends = ['is_collect'];
+    protected $appends = ['is_collect', 'label_texts'];
 
     public function office()
     {
@@ -64,4 +64,18 @@ class Docter extends BaseModel
     {
         return $this->hasOne(Serviceapplys::class);
     }
+
+    public function getLabelTextsAttribute()
+    {
+        $data = [];
+        if (!empty($this->label)) {
+            $data = DocterLabel::select(['label_name'])->whereIn('id', $this->label)->where('status', 1)->get()->toArray();
+        }
+
+        return $data;
+    }
+    public function organization()
+    {
+        return $this->belongsToMany(Organization::class);
+    }
 }

+ 11 - 0
app/Models/DocterLabel.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class DocterLabel extends Model
+{
+    //
+    protected $table = 'docter_label';
+}

+ 1 - 1
app/Models/Organization.php

xqd
@@ -24,7 +24,7 @@ class Organization extends BaseModel
     }
     public function docter()
     {
-        return $this->belongsTo(Docter::class);
+        return $this->belongsToMany(Docter::class);
     }
 
     public function vaccines()

+ 16 - 1
app/Models/ServicePack.php

xqd
@@ -10,12 +10,27 @@ namespace App\Models;
 
 class ServicePack extends BaseModel
 {
+    protected $appends = ['label_texts'];
     protected $table = 'service_packs';
     protected $casts = [
         'label' => 'json',
+        'team_id' => 'json'
     ];
     public function team()
     {
-        return $this->belongsTo(Team::class);
+        return $this->belongsToMany(Team::class);
+    }
+
+    public function getLabelTextsAttribute()
+    {
+        $data = [];
+        if (!empty($this->label)) {
+            $map = config('config.pack_label_map');
+            foreach ($this->label as $k => $v) {
+                $data[$k]['name'] = $map[$v]??'';
+            }
+        }
+
+        return $data;
     }
 }

+ 3 - 0
app/Models/Team.php

xqd
@@ -30,4 +30,7 @@ class Team extends BaseModel
     public function DocterOrganization(){
         return $this->belongsTo(DocterOrganization::class);
     }
+    public function servicepack(){
+        return $this->belongsTo(ServicePack::class);
+    }
 }

+ 1 - 1
app/Models/Vaccines.php

xqd
@@ -15,7 +15,7 @@ class Vaccines extends BaseModel
 
     public function organization()
     {
-        return $this->belongsToMany(Organization::class);
+        return $this->belongsToMany(Organization::class,'org_id');
     }
 
     public function organizationvaccines(){

+ 2 - 1
composer.json

xqd
@@ -18,7 +18,8 @@
         "laravel/tinker": "^1.0",
         "maatwebsite/excel": "^3.1",
         "overtrue/wechat": "^4.0",
-        "sven/artisan-view": "^3.3"
+        "sven/artisan-view": "^3.3",
+        "wuwx/laravel-admin-timestamp-between": "^1.0"
     },
     "require-dev": {
         "filp/whoops": "^2.0",

+ 62 - 0
composer.lock

xqd
@@ -5792,6 +5792,68 @@
                 "environment"
             ],
             "time": "2020-07-14T19:04:52+00:00"
+        },
+        {
+            "name": "wuwx/laravel-admin-timestamp-between",
+            "version": "v1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/wuwx/laravel-admin-timestamp-between.git",
+                "reference": "da05f70fbd7d9f8977b4b195328ece303dcdd4ea"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/wuwx/laravel-admin-timestamp-between/zipball/da05f70fbd7d9f8977b4b195328ece303dcdd4ea",
+                "reference": "da05f70fbd7d9f8977b4b195328ece303dcdd4ea",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "encore/laravel-admin": "*",
+                "php": ">=7.0.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~6.0"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "Wuwx\\LaravelAdminTimestampBetween\\LaravelAdminTimestampBetweenServiceProvider"
+                    ]
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Wuwx\\LaravelAdminTimestampBetween\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "wuwx",
+                    "email": "wuweixin@gmail.com"
+                }
+            ],
+            "description": "Timestamp Between Filter",
+            "homepage": "https://github.com/wuwx/laravel-admin-timestamp-between",
+            "keywords": [
+                "extension",
+                "laravel-admin"
+            ],
+            "support": {
+                "issues": "https://github.com/wuwx/laravel-admin-timestamp-between/issues",
+                "source": "https://github.com/wuwx/laravel-admin-timestamp-between/tree/master"
+            },
+            "time": "2020-03-28T05:50:42+00:00"
         }
     ],
     "packages-dev": [

+ 2 - 0
config/config.php

xqd
@@ -50,4 +50,6 @@ return [
     ],
 
     'no_auth_function_map' => ['docter/docterList', 'docter/docterDetail'],
+
+    'pack_label_map' => [1 => '图文', 2 => '电话', 3 => '门诊', 4 => '计免', 5 => '儿保'],
 ];