ApproveController.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. namespace App\Admin\Controllers\UserManagement\DocterManagement;
  3. use App\Admin\Actions\backstage\Pass;
  4. use App\Admin\Actions\backstage\Refuse;
  5. use App\Admin\Actions\backstage\Revoke;
  6. use App\Models\Docter;
  7. use App\Models\DocterOrganization;
  8. use App\Models\Office;
  9. use Encore\Admin\Controllers\AdminController;
  10. use Encore\Admin\Form;
  11. use Encore\Admin\Grid;
  12. use Encore\Admin\Show;
  13. class ApproveController extends AdminController
  14. {
  15. /**
  16. * Title for current resource.
  17. *
  18. * @var string
  19. */
  20. protected $title = '认证列表';
  21. /**
  22. * Make a grid builder.
  23. *
  24. * @return Grid
  25. */
  26. protected function grid()
  27. {
  28. $grid = new Grid(new DocterOrganization());
  29. $grid->filter(function($filter){
  30. $filter->between('authentication_time', '签约时间')->datetime();
  31. $filter->between('authentication_end_time', '签约到期时间')->datetime();
  32. });
  33. $grid ->model()->where('state','>',0)->orderBy('id','desc');
  34. $grid->column('id', __('Id'));
  35. $grid->column('docter.id', __('医生ID'));
  36. $grid->column('docter.name', __('医生姓名'));
  37. $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
  38. $grid->column('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
  39. $grid->column('organization.name', __('机构'));
  40. $grid->column('office.name', __('科室'));
  41. $grid->column('qualification.name', __('医生资质'));
  42. $grid->column('remarks', __('备注'));
  43. $grid->column('docter.practice','医生照片和执业证书')->display(function ($img) {
  44. $arr = explode(',',$img);
  45. return $arr;
  46. })->lightbox(['width' =>'', 'height' => 30]);
  47. $grid->column('docter.card_photo',' 身份证正反面')->display(function ($img) {
  48. $arr = explode(',',$img);
  49. return $arr;
  50. })->lightbox(['width' =>'', 'height' => 30]);
  51. $grid->column('docter.is_quail','照片和资格证书')->display(function ($img) {
  52. $arr = explode(',',$img);
  53. return $arr;
  54. })->lightbox(['width' =>'', 'height' => 30]);
  55. $grid->column('state', __('认证状态'))->using([1=>'已认证',2=>'审核驳回',3=>'待审核'])->label('info');
  56. $grid->column('authentication_time', __('签约时间'))->display(function ($time){
  57. if ($time == 0){
  58. return '';
  59. }else
  60. {
  61. return $time;
  62. }
  63. });
  64. $grid->column('authentication_end_time', __('签约到期时间'))->display(function ($time){
  65. if ($time == 0){
  66. return '';
  67. }else
  68. {
  69. return $time;
  70. }
  71. });
  72. //禁用创建按钮
  73. $grid->disableCreateButton();
  74. $grid->actions(function ($actions) {
  75. // 去掉删除
  76. $actions->disableDelete();
  77. // 去掉编辑
  78. $actions->disableEdit();
  79. // 去掉查看
  80. $actions->disableView();
  81. //待审核状态下 给通过和驳回
  82. if ($actions->row->state == 3){
  83. //通过申请
  84. $actions->add(new Pass());
  85. //驳回申请
  86. $actions->add(new Refuse());
  87. }
  88. //已认证状态下 给撤销
  89. if ($actions->row->state == 1){
  90. $actions->add(new Revoke());
  91. }
  92. //驳回状态下 不给任何操作
  93. if ($actions->row->state == 2){
  94. }
  95. });
  96. return $grid;
  97. }
  98. /**
  99. * Make a show builder.
  100. *
  101. * @param mixed $id
  102. * @return Show
  103. */
  104. protected function detail($id)
  105. {
  106. $show = new Show(DocterOrganization::findOrFail($id));
  107. $show->field('id', __('Id'));
  108. $show->field('docter.id', __('医生ID'));
  109. $show->field('docter.name', __('名字'));
  110. $show->field('docter.sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
  111. $show->field('docter.card_id', __('身份证'));
  112. $show->field('organization.name', __('机构'));
  113. $show->field('office.name', __('科室'));
  114. $show->field('qualification.name', __('医生资质'));
  115. // $show->field('docter.card_photo', __('身份证正反面'))->as(function ($id){
  116. //// dd($id);
  117. // $imgs = explode(',',$id);
  118. // $html = '';
  119. // foreach ($imgs as $val){
  120. // $html .='img src="'.$val.'"';
  121. // }
  122. // return "<{$html}>";
  123. //// return json_decode($id,true);
  124. // });
  125. $show->field('docter.card_photo', __('身份证正反面'))->image();
  126. return $show;
  127. }
  128. /**
  129. * Make a form builder.
  130. *
  131. * @return Form
  132. */
  133. protected function form()
  134. {
  135. $form = new Form(new DocterOrganization());
  136. $form->number('docter_id', __('Docter id'));
  137. $form->number('organization_id', __('Organization id'));
  138. $form->number('offices_id', __('Offices id'));
  139. $form->number('qualifications_id', __('Qualifications id'));
  140. $form->number('state', __('State'));
  141. return $form;
  142. }
  143. }