remote.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, Selectpage) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'statistics/remote/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: 'a.createdAt',
  18. showToggle: false,
  19. showColumns: false,
  20. pageList: [10, 15, 25, 50],
  21. exportOptions: {
  22. ignoreColumn: []
  23. },
  24. queryParams: function (params) {
  25. //这里可以追加搜索条件
  26. let filter = JSON.parse(params.filter);
  27. let op = JSON.parse(params.op);
  28. if(filter.local_institution_id){
  29. filter['a.local_institution_id'] = filter.local_institution_id;
  30. op['a.local_institution_id'] = op.local_institution_id;
  31. delete filter.local_institution_id;
  32. delete op.local_institution_id;
  33. }
  34. if(filter.exam_class){
  35. filter['a.exam_class'] = filter.exam_class;
  36. op['a.exam_class'] = op.exam_class;
  37. delete filter.exam_class;
  38. delete op.exam_class;
  39. }
  40. if(filter.req_date_time){
  41. var start_time = filter.req_date_time.split(',')[0] + ' 00:00:00'
  42. var end_time = filter.req_date_time.split(',')[1] + ' 23:59:59'
  43. filter['req_date_time'] = start_time + ',' + end_time
  44. }
  45. params.filter = JSON.stringify(filter);
  46. params.op = JSON.stringify(op);
  47. common_filter = params.filter;
  48. common_op = params.op;
  49. return params;
  50. },
  51. columns: [
  52. [
  53. {field: 'name', title: __('Name'), formatter: Table.api.formatter.bold, searchable: false},
  54. {field: 'local_institution_id', title: __('Local_institution_id'), visible: false},
  55. {field: 'local_institution_name', title: __('Local_institution_name'), searchable: false},
  56. {field: 'a.remote_institution_id', title: __('Remote_institution_name'), visible: false},
  57. {field: 'remote_institution_name', title: __('Remote_institution_name'), searchable: false},
  58. {field: 'exam_class', title: __('Exam_class'), searchable: true},
  59. {field: 'exam_project', title: __('检查方法'), searchable: true,operate: 'LIKE %...%',},
  60. {field: 'id', title: __('ID'), searchable: false},
  61. {field: 'req_doctor_name', title: __('Req_doctor_name'), searchable: false},
  62. {field: 'req_date_time', title: __('Req_date_time'),
  63. searchable: true,
  64. operate: 'BETWEEN',
  65. addclass: 'datetimepicker',
  66. data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',},
  67. {field: 'report_doctor_name', title: __('Report_doctor_name'), searchable: false},
  68. {field: 'review_doctor_name', title: __('Review_doctor_name'), searchable: false},
  69. {field: 'review_datetime', title: __('Review_datetime'), searchable: false},
  70. {field: 'order_money', title: __('Order_money'), searchable: false, formatter: Table.api.formatter.italic},
  71. {
  72. field: 'pay_way', title: __('Pay_way'),
  73. searchable: false,
  74. formatter: Table.api.formatter.normal,
  75. custom: {1: 'primary', 11: 'primary', 12: 'primary', 13: 'primary'},
  76. searchList: {
  77. 1 : '医院付款',
  78. 11 : '微信',
  79. 12 : '支付宝',
  80. 13 : '银联',
  81. }
  82. },
  83. {
  84. field: 'order_status',
  85. title: __('Order_status'),
  86. searchable: false,
  87. formatter: Table.api.formatter.label,
  88. custom: {1:'default',2:'success',3:'info',4:'warning',5:'danger', },
  89. searchList: {
  90. 1 : '创建',
  91. 2 : '支付完成',
  92. 3 : '订单完成',
  93. 4 : '取消',
  94. 5 : '退款',
  95. }
  96. },
  97. {
  98. field: 'is_urgent', title: __('Is_urgent'),
  99. searchable: false,
  100. formatter: Table.api.formatter.label,
  101. searchList: {0: '正常', 1: '急诊'},
  102. custom: {0: 'primary', 1: 'danger'}
  103. },
  104. {
  105. field: 'report_status',
  106. title: __('Report_status'),
  107. align: 'left',
  108. formatter: Table.api.formatter.normal,
  109. custom: {2:'info',3:'info',4:'info',5:'danger',6:'info',7:'info',8:'info',9:'info',10:'info',11:'danger', },
  110. searchList: {
  111. 2 : '获取完善病例资料',
  112. 3 : '完善病例资料保存继续',
  113. 4 : '选择医院发起申请',
  114. 5 : '驳回申请',
  115. 6 : '接收申请',
  116. 7 : '书写报告',
  117. 8 : '审核报告',
  118. 9 : '最终完成报告',
  119. 10 : '确认报告',
  120. 11 : '撤回报告',
  121. 12 : '撤回',
  122. },
  123. },
  124. ]
  125. ]
  126. });
  127. // 为表格绑定事件
  128. Table.api.bindevent(table);
  129. $.ajax({
  130. url: 'institution/institution/institutionSelectList',
  131. type: 'post',
  132. dataType: 'json',
  133. success: function success(res) {
  134. let data = res.rows;
  135. $('#local_institution_id').selectPage({
  136. data : data,
  137. orderBy: 'index'
  138. });
  139. $('input[name="a.remote_institution_id"]').selectPage({
  140. data : data,
  141. orderBy: 'index'
  142. });
  143. }
  144. });
  145. $('.btn-remote-film').click(function () {
  146. Fast.api.ajax({
  147. type: 'GET',
  148. url: 'statistics/remote/getPositive',
  149. data: {
  150. filter : common_filter,
  151. op : common_op
  152. },
  153. loading:true
  154. }, function (data) {
  155. layer.alert('阳性总数:' + data.positive + ';阳性率:' + data.centage + '%');
  156. return false;
  157. }, function (){
  158. Toastr.warning('获取阳性率失败');
  159. });
  160. });
  161. },
  162. api: {
  163. bindevent: function () {
  164. Form.api.bindevent($("form[role=form]"));
  165. }
  166. }
  167. };
  168. return Controller;
  169. });