UserSuggestsController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Admin\Controllers\OrdersManagement;
  3. use App\Models\Suggest;
  4. use App\Models\User;
  5. use Encore\Admin\Controllers\AdminController;
  6. use Encore\Admin\Form;
  7. use Encore\Admin\Grid;
  8. use Encore\Admin\Show;
  9. class UserSuggestsController 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 Suggest());
  25. $grid->disableCreateButton();
  26. $grid->disableActions();
  27. $uesr_id = \request('order_id');
  28. $grid->filter(function ($filter){
  29. $filter->disableIdFilter();
  30. $filter->equal('order_id','订单id');
  31. });
  32. $grid->column('id', __('Id'));
  33. $grid->column('order_id', __('订单id'));
  34. $grid->column('user_id', __('用户id'));
  35. $grid->column('patient_id', __('档案id'));
  36. $grid->column('symptoms', __('病症'))->limit(20,'...');
  37. $grid->column('pathogen', __('病因'))->limit(20,'...');
  38. $grid->column('suggest', __('结论建议'))->limit(20,'...');
  39. $grid->column('supplement_reason', __('补充原因'))->limit(20,'...');
  40. $grid->column('supplement_content', __('补充内容'))->limit(20,'...');
  41. $grid->column('created_at', __('创建时间'));
  42. $grid->column('updated_at', __('更新时间'));
  43. return $grid;
  44. }
  45. /**
  46. * Make a show builder.
  47. *
  48. * @param mixed $id
  49. * @return Show
  50. */
  51. protected function detail($id)
  52. {
  53. $show = new Show(Suggest::findOrFail($id));
  54. $show->field('id', __('Id'));
  55. $show->field('order_id', __('Order id'));
  56. $show->field('user_id', __('User id'));
  57. $show->field('patient_id', __('Patient id'));
  58. $show->field('symptoms', __('Symptoms'));
  59. $show->field('pathogen', __('Pathogen'));
  60. $show->field('suggest', __('Suggest'));
  61. $show->field('supplement_reason', __('Supplement reason'));
  62. $show->field('supplement_content', __('Supplement content'));
  63. $show->field('created_at', __('Created at'));
  64. $show->field('updated_at', __('Updated at'));
  65. return $show;
  66. }
  67. /**
  68. * Make a form builder.
  69. *
  70. * @return Form
  71. */
  72. protected function form()
  73. {
  74. $form = new Form(new Suggest());
  75. $form->number('order_id', __('Order id'));
  76. $form->number('user_id', __('User id'));
  77. $form->number('patient_id', __('Patient id'));
  78. $form->text('symptoms', __('Symptoms'));
  79. $form->text('pathogen', __('Pathogen'));
  80. $form->text('suggest', __('Suggest'));
  81. $form->text('supplement_reason', __('Supplement reason'));
  82. $form->text('supplement_content', __('Supplement content'));
  83. return $form;
  84. }
  85. }