DailyCareReportController.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Models\DailyCareReport;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Grid;
  6. use Dcat\Admin\Show;
  7. use Dcat\Admin\Http\Controllers\AdminController;
  8. use Dcat\Admin\Form\NestedForm;
  9. class DailyCareReportController extends AdminController
  10. {
  11. /**
  12. * Make a grid builder.
  13. *
  14. * @return Grid
  15. */
  16. protected function grid()
  17. {
  18. return Grid::make(new DailyCareReport(), function (Grid $grid) {
  19. $grid->column('student_id')->using(config('map.students'));
  20. $grid->column('log_type')->using(config('map.log_type'));
  21. $grid->column('situation');
  22. $grid->column('log_user_id')->using(config('map.log_user_ids'));
  23. $grid->disableViewButton();
  24. $grid->filter(function (Grid\Filter $filter) {
  25. $filter->equal('id');
  26. });
  27. });
  28. }
  29. /**
  30. * Make a show builder.
  31. *
  32. * @param mixed $id
  33. *
  34. * @return Show
  35. */
  36. protected function detail($id)
  37. {
  38. return Show::make($id, new DailyCareReport(), function (Show $show) {
  39. $show->field('id');
  40. $show->field('student_id');
  41. $show->field('log_type');
  42. $show->field('situation');
  43. $show->field('log_user_id');
  44. $show->field('diet_json');
  45. $show->field('drink_json');
  46. $show->field('nurse_json');
  47. $show->field('defecation_json');
  48. $show->field('change_clothes_json');
  49. $show->field('emotion_json');
  50. $show->field('sleep_json');
  51. $show->field('clean_json');
  52. $show->field('health_json');
  53. $show->field('medication_json');
  54. $show->field('temperature_json');
  55. $show->field('created_at');
  56. $show->field('updated_at');
  57. });
  58. }
  59. /**
  60. * Make a form builder.
  61. *
  62. * @return Form
  63. */
  64. protected function form()
  65. {
  66. return Form::make(new DailyCareReport(), function (Form $form) {
  67. $form->row(function (Form\Row $row) {
  68. $row->width(6)->select('student_id')->options(config('map.students'))->required();
  69. });
  70. $form->row(function (Form\Row $row) {
  71. $row->width(12)->table('diet_json', function (NestedForm $table) {
  72. $table->text('eat','饮食');
  73. $table->datetime('time','时间');
  74. $table->text('volume','饮食量');
  75. $table->textarea('remark','特别说明');
  76. });
  77. });
  78. $form->row(function (Form\Row $row) {
  79. $row->width(12)->table('drink_json', function (NestedForm $table) {
  80. $table->text('drink','饮品')->required();
  81. $table->datetime('time','时间');
  82. $table->text('volume','饮用总量');
  83. $table->textarea('remark','特别说明');
  84. });
  85. });
  86. $form->row(function (Form\Row $row) {
  87. $row->width(12)->table('nurse_json', function (NestedForm $table) {
  88. $table->text('nurse','喂奶');
  89. $table->datetime('time','时间');
  90. $table->text('volume','饮用量');
  91. $table->textarea('remark','特别说明');
  92. });
  93. });
  94. $form->row(function (Form\Row $row) {
  95. $row->width(12)->table('defecation_json', function (NestedForm $table) {
  96. $table->text('defecation_type','排便类型');
  97. $table->datetime('time','时间');
  98. $table->text('status','状态');
  99. $table->text('color','颜色');
  100. $table->text('volume','量');
  101. $table->text('red_ass','红屁股');
  102. $table->radio('is_acerbity','是否发酸')->options([1=>'是',0=>'否']);
  103. $table->image('pic','照片');
  104. $table->radio('potty_training','如厕训练')
  105. ->when(1,function(NestedForm $table){
  106. $table->textarea('remark','如厕训练说明');
  107. })
  108. ->options([1=>'是',0=>'否']);
  109. //$table->textarea('remark','如厕训练说明');
  110. });
  111. });
  112. $form->text('log_type');
  113. $form->text('situation');
  114. $form->text('log_user_id');
  115. $form->row(function (Form\Row $row) {
  116. $row->width(12)->table('change_clothes_json', function (NestedForm $table) {
  117. $table->text('is_normal','是否正常');
  118. $table->datetime('time','时间');
  119. $table->textarea('red_ass','红屁股');
  120. });
  121. });
  122. $form->row(function (Form\Row $row) {
  123. $row->width(12)->table('emotion_json', function (NestedForm $table) {
  124. $table->text('emotion','情绪');
  125. $table->datetime('time','时间');
  126. });
  127. });
  128. $form->row(function (Form\Row $row) {
  129. $row->width(12)->table('sleep_json', function (NestedForm $table) {
  130. $table->text('sleep_status','睡眠状态');
  131. $table->datetime('time','时间');
  132. });
  133. });
  134. $form->row(function (Form\Row $row) {
  135. $row->width(12)->table('clean_json', function (NestedForm $table) {
  136. $table->text('mouth_clean','口腔清洁');
  137. $table->datetime('mouth_clean_time','口腔清洁时间');
  138. $table->devider();
  139. $table->text('nasal_clean_color','鼻涕清洁颜色');
  140. $table->text('nasal_clean_shape','鼻涕清洁形状');
  141. $table->text('nasal_clean_volume','鼻涕清洁量');
  142. $table->datetime('nasal_clean_time','鼻涕清洁时间');
  143. $table->datetime('time','时间');
  144. $table->devider();
  145. $table->radio('is_wash_head','是否洗头')->options([1=>'是',0=>'否']);
  146. $table->select('is_change_diapers','更换尿布')->options([1=>'是',0=>'否']);
  147. $table->select('is_change_clothes','更换衣物')->options([1=>'是',0=>'否']);
  148. $table->datetime('time','时间');
  149. $table->datetime('wash_ass_time','洗屁屁时间');
  150. });
  151. });
  152. $form->row(function (Form\Row $row) {
  153. $row->width(12)->table('health_json', function (NestedForm $table) {
  154. $table->datetime('time','时间');
  155. $table->select('symptom','症状')->options([1=>'是',0=>'否']);
  156. $table->textarea('remark','其他说明');
  157. });
  158. });
  159. $form->row(function (Form\Row $row) {
  160. $row->width(12)->table('medication_json', function (NestedForm $table) {
  161. $table->datetime('time','时间');
  162. $table->textarea('remark','其他说明');
  163. });
  164. });
  165. $form->row(function (Form\Row $row) {
  166. $row->width(12)->table('temperature_json', function (NestedForm $table) {
  167. $table->datetime('time','时间');
  168. $table->text('temperature','温度');
  169. $table->select('temperature_type','体温种类')->options([1=>'摄氏度',0=>'华氏度']);
  170. });
  171. });
  172. $form->disableViewButton();
  173. });
  174. }
  175. }