//@ sourceURL=daily.js var LODOP; //声明为全局变量 //默认打印机下标 var printIndex = -1; $(function () { initFeeTable(); //重置查询参数 $('#btn_clean').click(function () { cleanParams(); }); //初始化页面上面的按钮事件 $("#btn_daily").click(function (t) { dcountCharge(); }); setTimeout(function () { getLodop(); }, 800); }); /** * 列表类型按钮切换事件 * @param object */ function reportButtonChange(object) { $("#pay_mark_group").find("button").each(function (index, element) { if ($(element).hasClass("btn-primary")) { $(element).removeClass("btn-primary").addClass("btn-default"); } }); $(object).removeClass("btn-default").addClass("btn-primary"); initFeeTable(); } /** * 初始化收费表格 */ function initFeeTable() { $('#tb_table').bootstrapTable("destroy"); $("#report_table").removeClass("in").addClass("hide"); var payMarkGroup = getIndex("pay_mark_group"); if (payMarkGroup == 0) { getRjbb(); } else if (payMarkGroup == 1) { getsfqd(); } else if (payMarkGroup == 2) { getGhqd(); } } /** * 设置收费参数 * @param res */ function extractedSf (res) { //现金收款 $("#xjbs").html(res.chargeCountVo.xjbs); if (res.chargeCountVo.xjsk != null) { $("#xjsk").html(res.chargeCountVo.xjsk.toFixed(2)); } $("#xjtfbs").html(res.chargeCountVo.xjtfbs); if (res.chargeCountVo.xjtf != null) { $("#xjtf").html(res.chargeCountVo.xjtf.toFixed(2)); } $("#xjssbs").html(res.chargeCountVo.xjssbs); if (res.chargeCountVo.xjss != null) { $("#xjss").html(res.chargeCountVo.xjss.toFixed(2)); } //银行卡收款 $("#yhsbs").html(res.chargeCountVo.yhsbs); if (res.chargeCountVo.yhksk != null) { $("#yhksk").html(res.chargeCountVo.yhksk.toFixed(2)); } $("#yhktfbs").html(res.chargeCountVo.yhktfbs); if (res.chargeCountVo.yhktf != null) { $("#yhktf").html(res.chargeCountVo.yhktf.toFixed(2)); } $("#yhkssbs").html(res.chargeCountVo.yhkssbs); if (res.chargeCountVo.yhkss != null) { $("#yhkss").html(res.chargeCountVo.yhkss.toFixed(2)); } //医保卡卡收款 $("#ybjzbs").html(res.chargeCountVo.ybjzbs); if (res.chargeCountVo.ybjzsk != null) { $("#ybjzsk").html(res.chargeCountVo.ybjzsk.toFixed(2)); } $("#ybjztfbs").html(res.chargeCountVo.ybjztfbs); if (res.chargeCountVo.ybjztf != null) { $("#ybjztf").html(res.chargeCountVo.ybjztf.toFixed(2)); } $("#ybjzssbs").html(res.chargeCountVo.ybjzssbs); if (res.chargeCountVo.ybjzss != null) { $("#ybjzss").html(res.chargeCountVo.ybjzss.toFixed(2)); } //支付宝收款 $("#zfbbs").html(res.chargeCountVo.zfbbs); if (res.chargeCountVo.zfbsk != null) { $("#zfbsk").html(res.chargeCountVo.zfbsk.toFixed(2)); } $("#zfbtfbs").html(res.chargeCountVo.zfbtfbs); if (res.chargeCountVo.zfbtf != null) { $("#zfbtf").html(res.chargeCountVo.zfbtf.toFixed(2)); } $("#zfbssbs").html(res.chargeCountVo.zfbssbs); if (res.chargeCountVo.zfbss != null) { $("#zfbss").html(res.chargeCountVo.zfbss.toFixed(2)); } //微信收款 $("#wxbs").html(res.chargeCountVo.wxbs); if (res.chargeCountVo.wxsk != null) { $("#wxsk").html(res.chargeCountVo.wxsk.toFixed(2)); } $("#wxtfbs").html(res.chargeCountVo.wxtfbs); if (res.chargeCountVo.wxtf != null) { $("#wxtf").html(res.chargeCountVo.wxtf.toFixed(2)); } $("#wxssbs").html(res.chargeCountVo.wxssbs); if (res.chargeCountVo.wxss != null) { $("#wxss").html(res.chargeCountVo.wxss.toFixed(2)); } //记账绿色通道收款 $("#zfbs").html(res.chargeCountVo.zfbs); if (res.chargeCountVo.zfsk != null) { $("#zfsk").html(res.chargeCountVo.zfsk.toFixed(2)); } $("#zftfbs").html(res.chargeCountVo.zftfbs); if (res.chargeCountVo.zftf != null) { $("#zftf").html(res.chargeCountVo.zftf.toFixed(2)); } $("#zfssbs").html(res.chargeCountVo.zfssbs); if (res.chargeCountVo.zfss != null) { $("#zfss").html(res.chargeCountVo.zfss.toFixed(2)); } //医保卡收款 $("#sybbs").html(res.chargeCountVo.sybbs); if (res.chargeCountVo.sybksk != null) { $("#sybksk").html(res.chargeCountVo.sybksk.toFixed(2)); } $("#sybtfbs").html(res.chargeCountVo.sybtfbs); if (res.chargeCountVo.sybtf != null) { $("#sybtf").html(res.chargeCountVo.sybtf.toFixed(2)); } $("#sybssbs").html(res.chargeCountVo.sybssbs); if (res.chargeCountVo.sybkss != null) { $("#sybkss").html(res.chargeCountVo.sybkss.toFixed(2)); } //总计收款 $("#zjbs").html(res.chargeCountVo.zjbs); if (res.chargeCountVo.zjsk != null) { $("#zjsk").html(res.chargeCountVo.zjsk.toFixed(2)); } $("#ztfbs").html(res.chargeCountVo.ztfbs); if (res.chargeCountVo.zjtk != null) { $("#zjtk").html(res.chargeCountVo.zjtk.toFixed(2)); } $("#zjssbs").html(res.chargeCountVo.zjssbs); if (res.chargeCountVo.zjss != null) { $("#zjss").html(res.chargeCountVo.zjss.toFixed(2)); } if (res.chargeCountVo.sjhj != null) { $("#sjhj").html(res.chargeCountVo.sjhj.toFixed(2)); } $("#sjhjdx").html(res.chargeCountVo.sjhjdx); if (res.chargeCountVo.zfss != null) { $("#zfsshj").html(res.chargeCountVo.zfss.toFixed(2)); } $("#zfdx").html(res.chargeCountVo.zfdx); if (res.chargeCountVo.ybjzss != null) { $("#ybkjzhj").html(res.chargeCountVo.ybjzss.toFixed(2)); } $("#ybkjzhjdx").html(res.chargeCountVo.ybkjzhjdx); if (res.chargeCountVo.zj != null) { $("#zj").html(res.chargeCountVo.zj.toFixed(2)); } $("#zjdx").html(res.chargeCountVo.zjdx); } /** * 设置挂号参数 * @param res */ function extractedGh (res) { //现金收款 $("#ghxjbs").html(res.ghsrgcmx.xjhs); if (res.ghsrgcmx.xjsk != null) { $("#ghxjsk").html(res.ghsrgcmx.xjsk.toFixed(2)); } $("#ghxjtfbs").html(res.ghsrgcmx.xjthhs); if (res.ghsrgcmx.xjth != null) { $("#ghxjtf").html(res.ghsrgcmx.xjth.toFixed(2)); } $("#ghxjssbs").html(res.ghsrgcmx.xjsshs); if (res.ghsrgcmx.xjss != null) { $("#ghxjss").html(res.ghsrgcmx.xjss.toFixed(2)); } //银行卡收款 $("#ghyhsbs").html(res.ghsrgcmx.yhkhs); if (res.ghsrgcmx.yhksk != null) { $("#ghyhksk").html(res.ghsrgcmx.yhksk.toFixed(2)); } $("#ghyhktfbs").html(res.ghsrgcmx.yhkthhs); if (res.ghsrgcmx.yhkth != null) { $("#ghyhktf").html(res.ghsrgcmx.yhkth.toFixed(2)); } $("#ghyhkssbs").html(res.ghsrgcmx.yhksshs); if (res.ghsrgcmx.yhkss != null) { $("#ghyhkss").html(res.ghsrgcmx.yhkss.toFixed(2)); } //医保卡卡收款 $("#ghsybbs").html(res.ghsrgcmx.ybkhs); if (res.ghsrgcmx.ybksk != null) { $("#ghsybksk").html(res.ghsrgcmx.ybksk.toFixed(2)); } $("#ghsybtfbs").html(res.ghsrgcmx.ybkthhs); if (res.ghsrgcmx.ybkth != null) { $("#ghsybtf").html(res.ghsrgcmx.ybkth.toFixed(2)); } $("#ghsybssbs").html(res.ghsrgcmx.ybksshs); if (res.ghsrgcmx.ybkss != null) { $("#ghsybkss").html(res.ghsrgcmx.ybkss.toFixed(2)); } //支付宝收款 $("#ghzfbbs").html(res.ghsrgcmx.zfbhs); if (res.ghsrgcmx.zfbsk != null) { $("#ghzfbsk").html(res.ghsrgcmx.zfbsk.toFixed(2)); } $("#ghzfbtfbs").html(res.ghsrgcmx.zfbthhs); if (res.ghsrgcmx.zfbth != null) { $("#ghzfbtf").html(res.ghsrgcmx.zfbth.toFixed(2)); } $("#ghzfbssbs").html(res.ghsrgcmx.zfbsshs); if (res.ghsrgcmx.zfbss != null) { $("#ghzfbss").html(res.ghsrgcmx.zfbss.toFixed(2)); } //微信收款 $("#ghwxbs").html(res.ghsrgcmx.wxhs); if (res.ghsrgcmx.wxsk != null) { $("#ghwxsk").html(res.ghsrgcmx.wxsk.toFixed(2)); } $("#ghwxtfbs").html(res.ghsrgcmx.wxthhs); if (res.ghsrgcmx.wxth != null) { $("#ghwxtf").html(res.ghsrgcmx.wxth.toFixed(2)); } $("#ghwxssbs").html(res.ghsrgcmx.wxsshs); if (res.ghsrgcmx.wxss != null) { $("#ghwxss").html(res.ghsrgcmx.wxss.toFixed(2)); } //记账绿色通道收款 $("#ghzfbs").html(res.ghsrgcmx.byjzhs); if (res.ghsrgcmx.byjzsk != null) { $("#ghzfsk").html(res.ghsrgcmx.byjzsk.toFixed(2)); } $("#ghzftfbs").html(res.ghsrgcmx.byjzthhs); if (res.ghsrgcmx.byjzth != null) { $("#ghzftf").html(res.ghsrgcmx.byjzth.toFixed(2)); } $("#ghzfssbs").html(res.ghsrgcmx.byjzsshs); if (res.ghsrgcmx.byjzss != null) { $("#ghzfss").html(res.ghsrgcmx.byjzss.toFixed(2)); } //总计收款 $("#ghzjbs").html(res.ghsrgcmx.hjhs); if (res.ghsrgcmx.hjsk != null) { $("#ghzjsk").html(res.ghsrgcmx.hjsk.toFixed(2)); } $("#ghztfbs").html(res.ghsrgcmx.hjthhs); if (res.ghsrgcmx.hjth != null) { $("#ghzjtk").html(res.ghsrgcmx.hjth.toFixed(2)); } $("#ghzjssbs").html(res.ghsrgcmx.hjsshs); if (res.ghsrgcmx.hjss != null) { $("#ghzjss").html(res.ghsrgcmx.hjss.toFixed(2)); } if (res.ghsrgcmx.ghjebhjz != null) { $("#ghsjhj").html(res.ghsrgcmx.ghjebhjz.toFixed(2)); } $("#ghsjhjdx").html(res.ghsrgcmx.ghjebhjzdx); if (res.ghsrgcmx.byjzss != null) { $("#ghzfsshj").html(res.ghsrgcmx.byjzss.toFixed(2)); } $("#ghzfdx").html(res.ghsrgcmx.byjzssdx); if (res.ghsrgcmx.hjss != null) { $("#ghzj").html(res.ghsrgcmx.hjss.toFixed(2)); } $("#ghzjdx").html(res.ghsrgcmx.hjssdx); if (res.ghsrgcmx.zcsr != null) { $("#zcsr").html(res.ghsrgcmx.zcsr.toFixed(2)); } if (res.ghsrgcmx.jcsr != null) { $("#jcsr").html(res.ghsrgcmx.jcsr.toFixed(2)); } if (res.ghsrgcmx.ghsr != null) { $("#ghsr").html(res.ghsrgcmx.ghsr.toFixed(2)); } } /** * 获取日结报表 */ function getRjbb() { $("#report_table").removeClass("hide").addClass("in"); $.ajax({ type: "GET", url: '/thmz/getFullChargeUnAccount', contentType: "application/json;charset=UTF-8", dataType: "json", headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, success: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } if (res.code == 0) { $("#userIdCode").html(res.user.userCode); $("#username").html(res.user.userName); $("#dcountDate").html(format(new Date(), "yyyy-MM-dd HH:mm:ss")); $("#charge1").html(res.mzReceiptSerial.charge1.toFixed(2)); $("#charge2").html(res.mzReceiptSerial.charge2.toFixed(2)); $("#charge3").html(res.mzReceiptSerial.charge3.toFixed(2)); $("#charge4").html(res.mzReceiptSerial.charge4.toFixed(2)); $("#charge5").html(res.mzReceiptSerial.charge5.toFixed(2)); $("#charge6").html(res.mzReceiptSerial.charge6.toFixed(2)); $("#charge7").html(res.mzReceiptSerial.charge7.toFixed(2)); $("#charge8").html(res.mzReceiptSerial.charge8.toFixed(2)); $("#charge9").html(res.mzReceiptSerial.charge9.toFixed(2)); $("#charge10").html(res.mzReceiptSerial.charge10.toFixed(2)); $("#charge11").html(res.mzReceiptSerial.charge11.toFixed(2)); $("#charge12").html(res.mzReceiptSerial.charge12.toFixed(2)); $("#charge13").html(res.mzReceiptSerial.charge13.toFixed(2)); $("#charge14").html(res.mzReceiptSerial.charge14.toFixed(2)); $("#charge15").html(res.mzReceiptSerial.charge15.toFixed(2)); $("#charge16").html(res.mzReceiptSerial.charge16.toFixed(2)); $("#charge17").html(res.mzReceiptSerial.charge17.toFixed(2)); $("#charge18").html(res.mzReceiptSerial.charge18.toFixed(2)); $("#charge19").html(res.mzReceiptSerial.charge19.toFixed(2)); $("#charge20").html(res.mzReceiptSerial.charge20.toFixed(2)); $("#totalCharge").html(res.mzReceiptSerial.totalCharge); $("#totalChargeStr").html(res.mzReceiptSerial.totalChargeStr); extractedSf(res); extractedGh (res); $("#receiptBills_table").html(null); var html = ''; if (res.receiptBills != null && res.receiptBills.length > 0) { for (var i = 0; i < res.receiptBills.length; i++) { if (i % 4 == 0) { html += ''; } html += '' + res.receiptBills[i] + ''; if (i % 4 == 3 || i == res.receiptBills.length - 1) { html += ''; } } } html+='发票总数:'+res.sffps+'退票张数:'+res.tpzs+'作废张数:'+res.zffps+''; $("#receiptBills_table").html(html); if (res.zffpmx.length == 0) { $("#sfzffpmx_table").css("display", "none"); } else if (res.zffpmx.length > 0) { $("#sfzffpmx_table").css("display", "block"); var html = ''; for (var i = 0; i < res.zffpmx.length; i++) { var receiptBill = res.zffpmx[i].receiptBill; if (res.zffpmx[i].receiptBill != null && res.zffpmx[i].receiptBill.length > 8) { receiptBill = receiptBill.substring(0, 8); } if (i % 2 == 0) { html += ''; } html += '' + receiptBill + ''; html += '' + res.zffpmx[i].name + ''; html += '' + res.zffpmx[i].totalCharge.toFixed(2) + ''; if (i % 2 == 1 || i == res.zffpmx.length - 1) { html += ''; } } $("#sfzffpmx").html(html); } $("#username_zbr").html(res.user.userName); } else if (res.code == -1) { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: true, styling: 'bootstrap3' }); } } }); } /** * 挂号清单 */ function getGhqd() { $('#tb_table').bootstrapTable({ url: '/thmz/getReqrecVoUnAccount', //请求后台的URL(*) method: 'post', //请求方式(*) toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, //是否显示行间隔色 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: true, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 // queryParams: queryParams, //传递参数(*) sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*) pageNumber: 1, //初始化加载第一页,默认第一页 pageSize: 10, //每页的记录行数(*) pageList: [10, 25, 50, 100], //可供选择的每页的行数(*) search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大 strictSearch: true, showColumns: false, //是否显示所有的列 showRefresh: false, //是否显示刷新按钮 minimumCountColumns: 2, //最少允许的列数 clickToSelect: true, //是否启用点击选中行 uniqueId: "ID", //每一行的唯一标识,一般为主键列 showToggle: false, //是否显示详细视图和列表视图的切换按钮 cardView: false, //是否显示详细视图 detailView: false, //rowStyle:rowStyle,//通过自定义函数设置行样式 ajaxOptions: { headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token") } }, columns: [ { field: 'receiptBill', title: '收据号', align: "center", valign: 'middle' }, { field: 'serialNo', title: '机制号', align: "center", valign: 'middle', }, { field: 'patientId', title: '病人ID', align: "center", valign: 'middle', }, { field: 'name', title: '病人姓名', align: "center", valign: 'middle', }, { field: 'unitCode', title: '科别', align: "center", valign: 'middle' }, { field: 'chargeType', title: '号别', align: "center", valign: 'middle' }, { field: 'cancelMark', title: '状态', align: "center", valign: 'middle', }, { field: 'chargeFee', title: '金额', align: "center", valign: 'middle', formatter: function (value, row, index) { return value.toFixed(2); } }, { field: 'opDay', title: '挂号日期', align: "center", valign: 'middle', formatter: function (value, row, index) { return format(value, "yyyy-MM-dd HH:mm:ss"); } } ], responseHandler: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var ress = eval(res); if (ress.code == -1) { if (ress.message != null && ress.message != '') { new PNotify({ title: '错误提示', text: ress.message, type: 'error', hide: true, styling: 'bootstrap3' }); } return { "total": 0,//总页数 "rows": {} //数据 }; } return { "total": ress.data.length,//总页数 "rows": ress.data //数据 }; }, }); } /** * 收费请单 */ function getsfqd() { $('#tb_table').bootstrapTable({ url: '/thmz/getChargeFeeVoUnAccount', //请求后台的URL(*) method: 'post', //请求方式(*) toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, //是否显示行间隔色 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: true, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 // queryParams: queryParams, //传递参数(*) sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*) pageNumber: 1, //初始化加载第一页,默认第一页 pageSize: 10, //每页的记录行数(*) pageList: [10, 25, 50, 100], //可供选择的每页的行数(*) search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大 strictSearch: true, showColumns: false, //是否显示所有的列 showRefresh: false, //是否显示刷新按钮 minimumCountColumns: 2, //最少允许的列数 clickToSelect: true, //是否启用点击选中行 uniqueId: "ID", //每一行的唯一标识,一般为主键列 showToggle: false, //是否显示详细视图和列表视图的切换按钮 cardView: false, //是否显示详细视图 detailView: false, //rowStyle:rowStyle,//通过自定义函数设置行样式 ajaxOptions: { headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token") } }, columns: [ { field: 'patientId', title: '病人ID', align: "center", valign: 'middle' }, { field: 'serialNo', title: '机制号', align: "center", valign: 'middle', }, { field: 'payMark', title: '退欠标识', align: "center", valign: 'middle', }, { field: 'totalCharge', title: '金额', align: "center", valign: 'middle', formatter: function (value, row, index) { return value.toFixed(2); } }, { field: 'receiptBill', title: '发票号', align: "center", valign: 'middle' }, { field: 'chequeType', title: '付款方式', align: "center", valign: 'middle' }, { field: 'chargeDate', title: '收费日期', align: "center", valign: 'middle', formatter: function (value, row, index) { return format(value, "yyyy-MM-dd HH:mm:ss"); } } ], responseHandler: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var ress = eval(res); if (ress.code == -1) { if (ress.message != null && ress.message != '') { new PNotify({ title: '错误提示', text: ress.message, type: 'error', hide: true, styling: 'bootstrap3' }); } return { "total": 0,//总页数 "rows": {} //数据 }; } return { "total": ress.data.length,//总页数 "rows": ress.data //数据 }; }, }); } /** * 获取按钮组选择的下标 * @param id * @returns {number} */ function getIndex(id) { var index = 0; var item = $("#" + id).find("button"); for (var i = 0; i <= item.length; i++) { if ($(item[i]).hasClass("btn-primary")) { index = i; break; } } return index; } /** * 查询默认打印机 */ function setPrint() { if (printIndex >= 0) { return; } $.ajax({ type: "GET", url: '/thmz/getLastWindowsByCurrentUser', contentType: "application/json;charset=UTF-8", dataType: "json", headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, async: false, success: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } if (res.code == 0) { printIndex = res.data.cgPrintIndex; } else { printIndex = -1; } } }); } /** * 清空查询条件 */ function cleanParams() { $("#printNum").val(null); } /** * 费用结算 */ function dcountCharge() { $.ajax({ type: "POST", url: '/thmz/dcountCharge', contentType: "application/json;charset=UTF-8", dataType: "json", headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, success: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } if (res.code == 0) { var printNum = $("#printNum").val(); if (printNum == null || printNum == undefined || printNum == '') { printNum = 1; } for (var i = 0; i < printNum; i++) { $("#dcountDate").html(format(res.dcountDate, "yyyy-MM-dd HH:mm:ss")); $("#dcountDate_gh").html(format(res.dcountDate, "yyyy-MM-dd HH:mm:ss")); setPrint(); LODOP = getLodop(); LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "门诊收费收入日报表"); LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小 //设置默认打印机 LODOP.SET_PRINTER_INDEX(printIndex); LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "210mm"); LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "297mm"); var strStyle="" LODOP.ADD_PRINT_HTM("0mm", "5mm", "200mm", "280mm",strStyle+ document.getElementById("report_table_1").innerHTML); LODOP.NewPageA(); LODOP.ADD_PRINT_HTM("0mm", "5mm", "200mm", "280mm", document.getElementById("zbr_div").innerHTML); LODOP.PRINT(); //LODOP.PREVIEW(); //刷新数据 getRjbb(); } successMesage(res); } else { errorMesage(res); } } }); }