Browse Source

完善认证管理

ChenWuJie 4 years ago
parent
commit
db27a5d1e5

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

xqd
@@ -12,7 +12,7 @@ class Refuse extends RowAction
     public function handle(Model $model)
     {
         // $model ...
-        DocterOrganization::where('id',$model->id)->update(['state'=>3]);
+        DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0]);
 
         return $this->response()->success('审核驳回')->refresh();
     }

+ 26 - 2
app/Admin/Actions/backstage/Revoke.php

xqd xqd
@@ -1,6 +1,7 @@
 <?php
 
 namespace App\Admin\Actions\backstage;
+use App\Models\Docter;
 use App\Models\DocterOrganization;
 use Encore\Admin\Actions\RowAction;
 use Illuminate\Database\Eloquent\Model;
@@ -11,8 +12,31 @@ class Revoke extends RowAction
 
     public function handle(Model $model)
     {
-        // $model ...
-        DocterOrganization::where('id',$model->id)->update(['state'=>0]);
+
+        //获得通过认证的机构数量
+        $is_pass_num = 0;
+        $docter_approve_num = DocterOrganization::where('docter_id',$model->docter_id)->get();
+        $docter_approve_num_array = $docter_approve_num->toarray();
+        foreach ($docter_approve_num_array as $value)
+        {
+            if ($value['state'] == 2)
+            {
+                $is_pass_num=$is_pass_num+1;
+            }
+        }
+        //如果同时有多个机构认证
+        if($is_pass_num > 1)
+        {
+            //撤销到社区端
+            DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>'']);
+        }
+        if ($is_pass_num ==1)
+        {
+            DocterOrganization::where('id',$model->id)->update(['state'=>0,'authentication_time'=>0]);
+            Docter::where('id',$model->docter_id)->update(['is_then'=>0]);
+        }
+        //修改记录
+//        DocterOrganization::where('id',$model->id)->update(['state'=>0]);
         return $this->response()->success('审核撤销')->refresh();
     }
 

+ 9 - 1
app/Admin/Controllers/ApproveController.php

xqd
@@ -39,8 +39,16 @@ class ApproveController extends AdminController
         $grid->column('organization.name', __('机构'));
         $grid->column('office.name', __('科室'));
         $grid->column('qualification.name', __('医生资质'));
+        $grid->column('remarks', __('备注'));
         $grid->column('state', __('认证状态'))->using([1=>'待审核',2=>'已认证',3=>'已驳回']);
-        $grid->column('authentication_time', __('认证时间'));
+        $grid->column('authentication_time', __('认证时间'))->display(function ($time){
+            if ($time == 0){
+                return '';
+            }else
+            {
+                return $time;
+            }
+        });
         //禁用创建按钮
         $grid->disableCreateButton();
         $grid->actions(function ($actions) {