123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, SelectPage) {
- let examStatusList = {
- 1: '登记',
- 2: '开始检查',
- 3: '检查完毕',
- 4: '申请',
- 5: '驳回',
- 6: '接收',
- 7: '初步报告',
- 8: '审核报告',
- 9: '确认报告',
- };
- let filmTypeList = {0: '未定义', 1: '传统胶片', 2: '数字影像'};
- let Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'exams/exams/index' + location.search,
- add_url: 'exams/exams/add',
- edit_url: '',
- del_url: '',
- multi_url: 'exams/exams/multi',
- table: 'exams',
- }
- });
- let table = $("#table");
- var common_filter = {};
- var common_op = {};
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'createdAt',
- showToggle: false,
- showColumns: false,
- showExport: true,
- pageList: [10, 15, 25, 50],
- queryParams: function (params) {
- //这里可以追加搜索条件
- let filter = JSON.parse(params.filter);
- let op = JSON.parse(params.op);
- params.filter = JSON.stringify(filter);
- params.op = JSON.stringify(op);
- common_filter = params.filter;
- common_op = params.op;
- return params;
- },
- columns: [
- [
- {field: 'institution_id', title: __('Institution_name'), visible: false},
- {field: 'institution_name', title: __('Institution_name'), align: 'left', searchable: false},
- {field: 'name', title: __('name')},
- {field: 'pay_status', title: __('是否支付'),searchList:{0:'未支付',1:'已支付'},formatter:function (value) {
- if(value == 1)
- {
- return '已支付'
- }else {
- return '未支付'
- }
- }},
- {field: 'patient_num', title: __('Patient_num')},
- {field: 'accession_num', title: __('Accession_num')},
- {field: 'exam_datetime', title: __('Exam_datetime'),defaultValue:Controller.api.formatter.get_today(0)},
- {
- field: 'studytime',
- title: __('检查时间'),
- searchable: false
- },{
- field: 'report_datetime',
- title: __('报告时间'),
- searchable: false
- },
- {
- field: 'timeDiff',
- title: __('检查-报告时间差'),
- searchable: false
- },
- {field: 'hopitalized_no', title: __('Hopitalized_no')},
- {field: 'exam_class', title: __('Exam_class'), searchList: $.getJSON('dict/device/classSelectList')},
- {field: 'body_part', title: __('Body_part')},
- {field: 'phone', title: __('Phone')},
- {
- field: 'exam_status',
- title: __('Exam_status'),
- formatter: Controller.api.formatter.exam_status,
- searchList: examStatusList,
- },
- {
- field: 'urgent',
- title: __('Urgent'),
- formatter: Table.api.formatter.normal,
- custom: {1: 'danger'},
- searchList: {1: '是', 0: '否'},
- },
- {field: 'createdAt', title: __('Createdat'), operate:'RANGE', addclass:'datetimerange'},
- {
- field: 'status',
- title: __('Status'),
- formatter: Table.api.formatter.status,
- searchList: {1: '正常', 0: '禁用'},
- custom: {1: 'success', 0: 'danger'}
- },
- {
- field: 'operate',
- export:false,
- title: __('Operate'),
- table: table,
- buttons: [
- {
- name : 'btn_topup',
- title : __('change_status'),
- extend : 'data-toggle="tooltip"',
- classname: 'btn btn-xs btn-warning btn-dialog',
- icon : 'fa fa-cny',
- url : 'exams/exams/change_pay',
- },
- {
- name : 'btn_exam',
- title : '更改检查信息',
- extend : 'data-toggle="tooltip"',
- classname: 'btn btn-xs btn-info btn-dialog',
- icon : 'fa fa-edit',
- url : 'exams/exams/change_status',
- },
- ],
- events: Table.api.events.operate,
- formatter: Table.api.formatter.operate,
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- initInstitutionSearchList('institution_id');
- $('.btn-positive').click(function () {
- window.location.href = 'exams/expExcel?filter='+common_filter+'&op='+common_op;
- });
- $('.btn-exams-download').click(function () {
- window.location.href = 'exams/exportExcel';
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- exam_status: function (value) {
- return examStatusList[value];
- },
- get_today: function (AddDayCount) {
- const dd = new Date();
- dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
- let y = dd.getFullYear() + '';
- let m = dd.getMonth()+1;//获取当前月份的日期
- let d = dd.getDate();
- //判断月
- if (m < 10) {
- m = "0" + m + '';
- }
- //判断日
- if (d < 10) {
- d = "0" + d + '';
- }
- return y + m + d;
- },
- film_type: function (value) {
- return filmTypeList[value];
- }
- }
- }
- };
- // 选择机构下拉列表
- let initInstitutionSearchList = function (id) {
- $.ajax({
- url: 'institution/institution/institutionSelectList',
- type: 'post',
- dataType: 'json',
- success: function success(res) {
- let data = res.rows;
- $('#'+id).selectPage({
- data : data,
- orderBy: 'index'
- });
- }
- });
- };
- return Controller;
- });
|