exams.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage', 'citypicker'], function ($, undefined, Backend, Table, Form, Selectpage, Citypicker) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'statistics/exams/index' + location.search,
  8. }
  9. });
  10. var table = $("#table");
  11. var common_filter = {};
  12. var common_op = {};
  13. // 初始化表格
  14. table.bootstrapTable({
  15. url: $.fn.bootstrapTable.defaults.extend.index_url,
  16. pk: 'id',
  17. sortName: 'exam.createdAt',
  18. sortOrder: 'desc',
  19. showToggle: false,
  20. showColumns: false,
  21. exportDataType: "all",
  22. pageList: [10, 15, 25, 50],
  23. queryParams: function (params) {
  24. //这里可以追加搜索条件
  25. let filter = JSON.parse(params.filter);
  26. let op = JSON.parse(params.op);
  27. if (op.exam_datetime_start && op.exam_datetime_end) {
  28. op.exam_datetime = 'BETWEEN';
  29. filter.exam_datetime = filter['exam_datetime_start'].replace(/-/g,'') + "," + filter['exam_datetime_end'].replace(/-/g,'')
  30. delete op.exam_datetime_start
  31. delete op.exam_datetime_end
  32. delete filter.exam_datetime_start
  33. delete filter.exam_datetime_end
  34. } else if (op.exam_datetime_start && !op.exam_datetime_end) {
  35. op.exam_datetime = op.exam_datetime_start
  36. filter.exam_datetime = filter.exam_datetime_start.replace(/-/g,'')
  37. delete op.exam_datetime_start
  38. delete filter.exam_datetime_start
  39. } else if (!op.exam_datetime_start && op.exam_datetime_end) {
  40. op.exam_datetime = op.exam_datetime_end;
  41. filter.exam_datetime = filter.exam_datetime_end.replace(/-/g,'')
  42. delete op.exam_datetime_end
  43. delete filter.exam_datetime_end
  44. }
  45. if(filter.province){
  46. delete op.province;
  47. let arr = filter.province.split("/");
  48. delete filter.province;
  49. if(arr[0]){
  50. filter['i.ris_province'] = arr[0];
  51. op['i.ris_province'] = '=';
  52. }
  53. if(arr[1]){
  54. filter['i.ris_city'] = arr[1];
  55. op['i.ris_city'] = '=';
  56. }
  57. // if(arr[2]){
  58. // filter['i.district'] = arr[2];
  59. // op['i.district'] = '=';
  60. // }
  61. }
  62. if(filter.is_bind){
  63. params.is_bind = filter.is_bind
  64. delete filter.is_bind
  65. delete op.is_bind
  66. }
  67. params.filter = JSON.stringify(filter);
  68. params.op = JSON.stringify(op);
  69. common_filter = params.filter;
  70. common_op = params.op;
  71. $("#centage").text('??')
  72. $("#centage").data('total', '??');
  73. return params;
  74. },
  75. columns: [
  76. [
  77. {field: 'institution_id', title: __('Institution_Name'), visible: false},
  78. {
  79. field: 'institution_name', title: __('Institution_Name'),
  80. searchable: false,
  81. align: 'left',
  82. formatter: Table.api.formatter.bold,
  83. width: '15%'
  84. },
  85. {field: 'exam_status',
  86. title: __('Exam_status'),
  87. visible: false,
  88. searchList: {3: '影像到达', 7: '已写报告',8:'已审报告',9:'报告完成'},
  89. formatter:Table.api.formatter.status,
  90. addClass:'selectpicker',data:'multiple',operate:'IN'
  91. },
  92. // {field: 'name', title: __('Name'), searchable: false},
  93. // {field: 'patient_num', title: __('Patient_num'), searchable: false, align: 'left',},
  94. // {field: 'accession_num', title: __('Accession_num'), searchable: false, align: 'left',},
  95. // {
  96. // field: 'sex', title: __('Sex'),
  97. // searchable: false,
  98. // formatter: Table.api.formatter.normal,
  99. // searchList: {M: '男', F: '女'},
  100. // custom: {M: 'primary', F: 'primary'}
  101. // },
  102. {field: 'name', title: '姓名', width: '20%', operate: 'LIKE %...%'},
  103. {field: 'exam_class', title: __('Exam_class'), searchList: {CR: "CR",
  104. CT: "CT",
  105. DX: "DX",
  106. ECG: "ECG",
  107. ES: "ES",
  108. MG: "MG",
  109. MR: "MR",
  110. PETCT: "PETCT",
  111. PT: "PT",
  112. RF: "RF",
  113. US: "US",
  114. XA: "XA"},
  115. addClass:'selectpicker',data:'multiple',operate:'IN'
  116. },
  117. {field: 'application_department', title: '申请科室', searchable: true},
  118. {field: 'application_doctor', title: '申请医生'},
  119. {field: 'patient_num', title: '病历号'},
  120. {field: 'accession_num', title: '检查号'},
  121. // {
  122. // field: 'report_result', title: __('Report_result'),
  123. // searchable: false,
  124. // formatter: Table.api.formatter.normal,
  125. // searchList: {1: '阴性', 2: '阳性'},
  126. // custom: {1: 'primary', 2: 'danger'}
  127. //
  128. // },
  129. {
  130. field: 'exam_datetime',
  131. title: __('Exam_datetime'),
  132. operate: 'BETWEEN',
  133. searchable: false,
  134. addclass: 'datetimepicker',
  135. data: 'data-date-format="YYYYMMDD" autocomplete="off"',
  136. },
  137. {
  138. field: 'exam_datetime_start',
  139. title: __('检查-开始日期'),
  140. visible: false,
  141. operate: '>',
  142. addclass: 'datetimepicker',
  143. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',
  144. },
  145. {
  146. field: 'exam_datetime_end',
  147. title: __('检查-结束日期'),
  148. visible: false,
  149. operate: '<',
  150. addclass: 'datetimepicker',
  151. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',
  152. },
  153. {field: 'province', title: '省市', visible: false},
  154. {
  155. field: 'pay_status', title: '支付状态',
  156. formatter: Table.api.formatter.status,
  157. searchList: {1: '已支付', 0: '未支付'},
  158. // searchable: false,
  159. custom: {1: 'success', 0: 'gray'}
  160. },
  161. {
  162. field: 'is_bind', title: '患者绑定状态',
  163. formatter: Table.api.formatter.status,
  164. searchList: {1: '已绑定', 0: '未绑定'},
  165. // searchable: false,
  166. custom: {1: 'success', 0: 'gray'}
  167. },
  168. {
  169. field: 'createdAt',
  170. title: '创建时间',
  171. operate : 'RANGE',
  172. addclass: 'datetimerange',
  173. data:' autocomplete="off"'
  174. },
  175. // {
  176. // field: 'pb_id', title: '患者绑定状态',
  177. // formatter: Table.api.formatter.status,
  178. // searchList: {1: '已绑定', 0: '未绑定'},
  179. // searchable: false,
  180. // custom: {1: 'success', 0: 'gray'}
  181. // }
  182. // {field: 'register_name', title: __('Register_name'), searchable: false},
  183. // {field: 'register_datetime', title: __('Register_datetime'), searchable: false},
  184. // {field: 'report_doctor_name', title: __('Report_doctor_name'), searchable: false},
  185. // {field: 'review_doctor_name', title: __('Review_doctor_name'), searchable: false},
  186. // {field: 'id', title: __('Price'), searchable: false, formatter: function (value) {
  187. // return '20';
  188. // }},
  189. ]
  190. ]
  191. });
  192. // $("#province").on("cp:updated", function() {
  193. // var citypicker = $(this).data("province");
  194. // var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
  195. // $("#code").val(code);
  196. // });
  197. $('#province').attr('data-level','city')
  198. $('#province').citypicker();
  199. $('.city-picker-span').css('width','100%');
  200. // 为表格绑定事件
  201. Table.api.bindevent(table);
  202. //当表格数据加载完成时
  203. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  204. //这里可以获取从服务端获取的JSON数据
  205. $('input[name="exam_datetime_start-operate"]').parent().css('white-space','break-spaces')
  206. $('input[name="exam_datetime_end-operate"]').parent().css('white-space','break-spaces')
  207. });
  208. table.on('load-success.bs.table', function (e, data) {
  209. if(typeof data.rows === 'undefined' && typeof typeof data.code != 'undefined')
  210. {
  211. Toastr.error(data.msg);
  212. }
  213. });
  214. $('.btn-positive').click(function () {
  215. Fast.api.ajax({
  216. type: 'GET',
  217. url: 'statistics/exams/getPositive',
  218. data: {
  219. filter : common_filter,
  220. op : common_op
  221. },
  222. loading:true
  223. }, function (data) {
  224. // $("#centage").text(data.centage)
  225. // $("#centage").data('total', data.positive);
  226. layer.alert('阳性总数:' + data.positive + ';阳性率:' + data.centage + '%');
  227. return false;
  228. }, function (){
  229. Toastr.warning('获取阳性率失败');
  230. });
  231. });
  232. $('.btn-film').click(function () {
  233. Fast.api.ajax({
  234. type: 'GET',
  235. url: 'statistics/exams/getFilm',
  236. data: {
  237. filter : common_filter,
  238. op : common_op
  239. },
  240. loading:true
  241. }, function (data) {
  242. // $("#centage").text(data.centage)
  243. // $("#centage").data('total', data.positive);
  244. layer.alert('照片质量比例:优秀(' + data.you + '%);良好(' + data.liang + '%);合格(' + data.hege + '%);差(' + data.cha + '%);');
  245. return false;
  246. }, function (){
  247. Toastr.warning('获取照片质量比例失败');
  248. });
  249. });
  250. $('.btn-excel').click(function () {
  251. window.location.href = 'exams/getExcel?filter='+common_filter+'&op='+common_op;
  252. // Fast.api.ajax({
  253. // type: 'GET',
  254. // url: 'statistics/exams/getExcel',
  255. // data: {
  256. // filter : common_filter,
  257. // op : common_op
  258. // },
  259. // loading:true
  260. // }, function (data) {
  261. // }, function (){
  262. // });
  263. });
  264. $.ajax({
  265. url: 'institution/institution/institutionSelectList',
  266. type: 'post',
  267. dataType: 'json',
  268. success: function success(res) {
  269. let data = res.rows;
  270. $('#institution_id').selectPage({
  271. data : data,
  272. orderBy: 'index'
  273. });
  274. }
  275. });
  276. },
  277. api: {
  278. bindevent: function () {
  279. Form.api.bindevent($("form[role=form]"));
  280. }
  281. }
  282. };
  283. return Controller;
  284. });