UserPatientsController.php 3.5 KB

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