UserSuggestsController.php 2.8 KB

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