UserPatientsController.php 3.7 KB

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