UserPatientsController.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. namespace App\Admin\Controllers\UserManagement\BmUser;
  3. use App\Admin\Actions\backstage\User\MapDepot;
  4. use App\Admin\Actions\backstage\User\Suggests;
  5. use App\Models\Patient;
  6. use Encore\Admin\Controllers\AdminController;
  7. use App\Admin\Actions\backstage\User\service;
  8. use Illuminate\Http\Request;
  9. use Encore\Admin\Form;
  10. use Encore\Admin\Grid;
  11. use Encore\Admin\Show;
  12. class UserPatientsController extends AdminController
  13. {
  14. /**
  15. * Title for current resource.
  16. *
  17. * @var string
  18. */
  19. protected $title = '患者列表';
  20. /**
  21. * Make a grid builder.
  22. *
  23. * @return Grid
  24. */
  25. protected function grid()
  26. {
  27. $grid = new Grid(new Patient());
  28. $grid->disableCreateButton();
  29. $uesr_id = \request('user_id');
  30. $grid->filter(function ($filter){
  31. $filter->disableIdFilter();
  32. $filter->equal('user_id','用户id');
  33. $filter->equal('id','患者id');
  34. $filter->like('name','患者姓名');
  35. });
  36. $grid->actions(function ($actions) {
  37. // 去掉删除
  38. $actions->disableDelete();
  39. // 去掉编辑
  40. $actions->disableEdit();
  41. //服务包
  42. // $actions->add(new service());
  43. });
  44. $grid->column('id', __('档案id'));
  45. $grid->column('user_id', __('用户id'));
  46. $grid->column('name', __('患者姓名'));
  47. $grid->column('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女',]);
  48. $grid->column('avatar', __('头像'))->image("",'',50);
  49. $grid->column('age', __('年龄'));
  50. $grid->column('email', __('邮箱'));
  51. $grid->column('phone', __('联系电话'));
  52. $grid->column('address', __('家庭住址'))->limit(20,'...');
  53. $grid->column('guardian_name', __('监护人姓名'));
  54. $grid->column('card_type', __('证件类型'))->using([1=>'身份证',2=>'护照']);
  55. $grid->column('card_number', __('证件号'));
  56. $grid->column('social_card_number', __('社保卡号'));
  57. $grid->column('created_at', __('创建时间'));
  58. $grid->column('updated_at', __('更新时间'));
  59. return $grid;
  60. }
  61. /**
  62. * Make a show builder.
  63. *
  64. * @param mixed $id
  65. * @return Show
  66. */
  67. protected function detail($id)
  68. {
  69. $show = new Show(Patient::findOrFail($id));
  70. $show->field('id', __('档案id'));
  71. $show->field('user_id', __('用户id'));
  72. $show->field('name', __('姓名'));
  73. $show->field('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女',]);
  74. $show->field('avatar', __('头像'))->image();
  75. $show->field('card_img_url', __('身份证正面照片'))->image();
  76. $show->field('card_back_img_url', __('身份证背面照片'))->image();
  77. $show->field('birthday', __('生日'));
  78. $show->field('age', __('年龄'));
  79. $show->field('email', __('邮箱'));
  80. $show->field('phone', __('联系电话'));
  81. $show->field('address', __('家庭住址'));
  82. $show->field('guardian_name', __('监护人姓名'));
  83. $show->field('relationship_type', __('与就诊人关系类型'))
  84. ->using([1=>'父亲',2=>'母亲',3=>'祖父',4=>'祖母',5=>'外祖父',6=>'外祖母',7=>'叔侄',8=>'其他']);
  85. $show->field('info', __('就诊信息'));
  86. $show->field('card_type', __('证件类型'))->using([1=>'身份证',2=>'护照']);
  87. $show->field('card_number', __('证件号'));
  88. $show->field('social_card_number', __('社保卡号'));
  89. $show->field('born_hospital', __('出生医院'));
  90. $show->field('created_at', __('创建时间'));
  91. $show->field('updated_at', __('更新时间'));
  92. return $show;
  93. }
  94. /**
  95. * Make a form builder.
  96. *
  97. * @return Form
  98. */
  99. protected function form()
  100. {
  101. $form = new Form(new Patient());
  102. return $form;
  103. }
  104. }