UserPatientsController.php 3.8 KB

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