exams.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, SelectPage) {
  2. let examStatusList = {
  3. 1: '登记',
  4. 2: '开始检查',
  5. 3: '检查完毕',
  6. 4: '申请',
  7. 5: '驳回',
  8. 6: '接收',
  9. 7: '初步报告',
  10. 8: '审核报告',
  11. 9: '确认报告',
  12. };
  13. let filmTypeList = {0: '未定义', 1: '传统胶片', 2: '数字影像'};
  14. let Controller = {
  15. index: function () {
  16. // 初始化表格参数配置
  17. Table.api.init({
  18. extend: {
  19. index_url: 'exams/exams/index' + location.search,
  20. add_url: 'exams/exams/add',
  21. edit_url: '',
  22. del_url: '',
  23. multi_url: 'exams/exams/multi',
  24. table: 'exams',
  25. }
  26. });
  27. let table = $("#table");
  28. var common_filter = {};
  29. var common_op = {};
  30. // 初始化表格
  31. table.bootstrapTable({
  32. url: $.fn.bootstrapTable.defaults.extend.index_url,
  33. pk: 'id',
  34. sortName: 'createdAt',
  35. showToggle: false,
  36. showColumns: false,
  37. showExport: true,
  38. pageList: [10, 15, 25, 50],
  39. queryParams: function (params) {
  40. //这里可以追加搜索条件
  41. let filter = JSON.parse(params.filter);
  42. let op = JSON.parse(params.op);
  43. params.filter = JSON.stringify(filter);
  44. params.op = JSON.stringify(op);
  45. common_filter = params.filter;
  46. common_op = params.op;
  47. return params;
  48. },
  49. columns: [
  50. [
  51. {field: 'institution_id', title: __('Institution_name'), visible: false},
  52. {field: 'institution_name', title: __('Institution_name'), align: 'left', searchable: false},
  53. {field: 'name', title: __('name')},
  54. {field: 'pay_status', title: __('是否支付'),searchList:{0:'未支付',1:'已支付'},formatter:function (value) {
  55. if(value == 1)
  56. {
  57. return '已支付'
  58. }else {
  59. return '未支付'
  60. }
  61. }},
  62. {field: 'patient_num', title: __('Patient_num')},
  63. {field: 'accession_num', title: __('Accession_num')},
  64. {field: 'exam_datetime', title: __('Exam_datetime'),defaultValue:Controller.api.formatter.get_today(0)},
  65. {
  66. field: 'studytime',
  67. title: __('检查时间'),
  68. searchable: false
  69. },{
  70. field: 'report_datetime',
  71. title: __('报告时间'),
  72. searchable: false
  73. },
  74. {
  75. field: 'timeDiff',
  76. title: __('检查-报告时间差'),
  77. searchable: false
  78. },
  79. {field: 'hopitalized_no', title: __('Hopitalized_no')},
  80. {field: 'exam_class', title: __('Exam_class'), searchList: $.getJSON('dict/device/classSelectList')},
  81. {field: 'body_part', title: __('Body_part')},
  82. {field: 'phone', title: __('Phone')},
  83. {
  84. field: 'exam_status',
  85. title: __('Exam_status'),
  86. formatter: Controller.api.formatter.exam_status,
  87. searchList: examStatusList,
  88. },
  89. {
  90. field: 'urgent',
  91. title: __('Urgent'),
  92. formatter: Table.api.formatter.normal,
  93. custom: {1: 'danger'},
  94. searchList: {1: '是', 0: '否'},
  95. },
  96. {field: 'createdAt', title: __('Createdat'), operate:'RANGE', addclass:'datetimerange'},
  97. {
  98. field: 'status',
  99. title: __('Status'),
  100. formatter: Table.api.formatter.status,
  101. searchList: {1: '正常', 0: '禁用'},
  102. custom: {1: 'success', 0: 'danger'}
  103. },
  104. {
  105. field: 'operate',
  106. export:false,
  107. title: __('Operate'),
  108. table: table,
  109. buttons: [
  110. {
  111. name : 'btn_topup',
  112. title : __('change_status'),
  113. extend : 'data-toggle="tooltip"',
  114. classname: 'btn btn-xs btn-warning btn-dialog',
  115. icon : 'fa fa-cny',
  116. url : 'exams/exams/change_pay',
  117. },
  118. {
  119. name : 'btn_exam',
  120. title : '更改检查信息',
  121. extend : 'data-toggle="tooltip"',
  122. classname: 'btn btn-xs btn-info btn-dialog',
  123. icon : 'fa fa-edit',
  124. url : 'exams/exams/change_status',
  125. },
  126. ],
  127. events: Table.api.events.operate,
  128. formatter: Table.api.formatter.operate,
  129. }
  130. ]
  131. ]
  132. });
  133. // 为表格绑定事件
  134. Table.api.bindevent(table);
  135. initInstitutionSearchList('institution_id');
  136. $('.btn-positive').click(function () {
  137. window.location.href = 'exams/expExcel?filter='+common_filter+'&op='+common_op;
  138. });
  139. $('.btn-exams-download').click(function () {
  140. window.location.href = 'exams/exportExcel';
  141. });
  142. },
  143. add: function () {
  144. Controller.api.bindevent();
  145. },
  146. edit: function () {
  147. Controller.api.bindevent();
  148. },
  149. api: {
  150. bindevent: function () {
  151. Form.api.bindevent($("form[role=form]"));
  152. },
  153. formatter: {
  154. exam_status: function (value) {
  155. return examStatusList[value];
  156. },
  157. get_today: function (AddDayCount) {
  158. const dd = new Date();
  159. dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  160. let y = dd.getFullYear() + '';
  161. let m = dd.getMonth()+1;//获取当前月份的日期
  162. let d = dd.getDate();
  163. //判断月
  164. if (m < 10) {
  165. m = "0" + m + '';
  166. }
  167. //判断日
  168. if (d < 10) {
  169. d = "0" + d + '';
  170. }
  171. return y + m + d;
  172. },
  173. film_type: function (value) {
  174. return filmTypeList[value];
  175. }
  176. }
  177. }
  178. };
  179. // 选择机构下拉列表
  180. let initInstitutionSearchList = function (id) {
  181. $.ajax({
  182. url: 'institution/institution/institutionSelectList',
  183. type: 'post',
  184. dataType: 'json',
  185. success: function success(res) {
  186. let data = res.rows;
  187. $('#'+id).selectPage({
  188. data : data,
  189. orderBy: 'index'
  190. });
  191. }
  192. });
  193. };
  194. return Controller;
  195. });