var rightData = []; var printIndex = -1; var hospitalName = ''; $(function () { initClinicDeptNo(); //初始频次下拉选 initOrderFrequencys("orderFrequencyZl", true); initDayNum(); initExecUnit(); initSearchList('
', 'yjksItem', 800, 400); $('#yjksItem').on('input focus', function (e) { loadItemTbale(null) }); loadRightTable() getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) { hospitalName = res.data $('.hospitalName').text(hospitalName) }) }); function deldata(index) { rightData.splice(index,1) jiSuanTotalCharge(); loadRightTable() } function loadRightTable() { $('#dataTable').bootstrapTable('destroy'); // 初始化表格 $('#dataTable').bootstrapTable({ data: rightData, toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: false, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", pageNumber: 1, //初始化加载第一页,默认第一页 pageSize: 5, //每页的记录行数(*) pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*) search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大 strictSearch: true, showColumns: false, //是否显示所有的列 showRefresh: false, //是否显示刷新按钮 minimumCountColumns: 2, //最少允许的列数 clickToSelect: true, //是否启用点击选中行 uniqueId: "ID", //每一行的唯一标识,一般为主键列 showToggle: false, //是否显示详细视图和列表视图的切换按钮 cardView: false, //是否显示详细视图 detailView: false, columns: [ { title: '操作', field: 'op', align: "center", valign: 'middle', formatter: function (value, row, index) { var str = ''; return [str].join(''); } }, { field: 'zlCode', title: '编码', align: "center", valign: 'middle', }, { field: 'name', title: '名称', align: "center", valign: 'middle', } , { field: 'zlItemPrice', title: '单价(元)', align: "center", valign: 'middle', }, { field: 'itemQuantity', title: '单量', align: "center", valign: 'middle', }, { field: 'descriptions', title: '规格', align: "center", valign: 'middle', }, { field: 'chargeUnit', title: '单位', align: "center", valign: 'middle', }, { field: 'dayZlNum', title: '天数', align: "center", valign: 'middle', }, { field: 'orderFrequencyZl', title: '频次', align: "center", valign: 'middle', }, { field: 'totalNumZl', title: '总量', align: "center", valign: 'middle', }, { field: 'totalAmountZl', title: '总价(元)', align: "center", valign: 'middle', }, { field: 'execUnitName', title: '执行科室', align: "center", valign: 'middle', }, { field: 'remark', title: '备注', align: "center", valign: 'middle', } ], }); } function loadItemTbale(event) { if (event != null) { if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) { //上下键不刷新表格 return; } } $('#yjksItem').webuiPopover('show'); $('#tb_table_yjksItem').bootstrapTable('refresh'); $('#tb_table_yjksItem').bootstrapTable({ url: '/thmz/listZdChargeItem', //请求后台的URL(*) method: 'POST', //请求方式(*) toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, //是否显示行间隔色 cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: false, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 queryParams: function () { var temp = { pageSize:50, pageIndex:0, zdChargeItem:{ name: $("#yjksItem").val(), delFlag: 0 } }; return JSON.stringify(temp); }, //传递参数(*) sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*) pageNumber: 1, //初始化加载第一页,默认第一页 pageSize: 5, //每页的记录行数(*) pageList: [5, 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: 'code', title: '编码', align: "center", valign: 'middle', // sortable: true }, { field: 'name', title: '名称', align: "center", valign: 'middle', // sortable: true } , { field: 'execUnitName', title: '执行科室', align: "center", valign: 'middle', // sortable: true } , { field: 'chargeAmount', title: '价格', align: "center", valign: 'middle', // sortable: true formatter: function (value, row, index) { if (value == null) { return "0.00元"; } return value.toFixed(2) + "元"; } }, { field: 'descriptions', title: '规格', align: "center", valign: 'middle', // sortable: true }, { field: 'connotation', title: '医保说明', align: "center", valign: 'middle', // sortable: true }, { field: 'nationalCode', title: '医保编码', align: "left", valign: 'middle', // sortable: true } ], responseHandler: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var ress = eval(res); if (ress.code == -1) { errorMesage(res); return { "total": 0,//总页数 "rows": {} //数据 }; } $("#yjksPopoverContent").parent().css("background", "#EBEBE4"); return { "total": ress.data.length,//总页数 "rows": ress.data //数据 }; }, onClickRow: function (row, $element) { $('#yjksItem').webuiPopover('hide'); clearData(); setItemData(row) return; } }); } function setItemData(row) { $("#descriptions").val(row.descriptions) $("#yjksItem").val(row.name) $("#zlCode").val(row.code) $("#chargeUnit").val(row.chargeUnit) $("#zlItemPrice").val(row.chargeAmount) $("#itemQuantity").val("1") $("#dayZlNum").val(1) $('#dayZlNum').selectpicker('refresh'); $("#orderFrequencyZl").val('ONCE') $('#orderFrequencyZl').selectpicker('refresh'); $("#execUnit").val(row.execUnit) $('#execUnit').selectpicker('refresh'); calculateTotal(false) } /** * 计算诊疗金额 * @param flag true ,直接计算总价, false 还要计算总量 */ function calculateTotal(flag) { if (!flag) { var itemQuantity = $("#itemQuantity").val(); if (itemQuantity == null) { return; } var dayZlNum = $("#dayZlNum").val(); if (dayZlNum == null) { return; } //频率 var times = $('#orderFrequencyZl').find("option:selected").attr('desc'); if (times == null) { return; } var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times); $("#totalNumZl").val(totalNumZl); } //总量 var totalNumZl = $("#totalNumZl").val(); if (totalNumZl == null) { return; } //单价 var zlItemPrice = $("#zlItemPrice").val(); if (zlItemPrice == null) { return; } $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice)); } /** * 初始频次下拉选 * @param id * @param async 是否是异步 true 异步 false 同步 */ function initOrderFrequencys(id, async) { $.ajax({ type: "GET", url: '/thmz/getXyOrderFrequencys', dataType: "json", headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, async: async, success: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var html = ''; $.each(res.data, function (commentIndex, comment) { html += ''; }); $('#' + id).empty(); $('#' + id).html(html); $('#' + id).selectpicker('refresh'); } }); } function initDayNum() { var html = ''; for (var i = 1; i <= 112; i++) { html += ''; } $('#dayZlNum').html(html); $('#dayZlNum').selectpicker('refresh'); } function initExecUnit() { //父科室列表 $.ajax({ type: "GET", url: '/thmz/allUnitCode', dataType: "json", headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, success: function (data) { if (data == '401' || data == 401) { window.location.href = '/thmz/login/view' return; } $('#execUnit').empty(); //清空resText里面的所有内容 var html = ''; $.each(data.data, function (commentIndex, comment) { html += ''; }); $('#execUnit').html(html); $('#execUnit').selectpicker('refresh'); } }); } function clearData() { $("#payQrcodeYjEntry").html("") $("#yjksItem").val(null) $("#descriptions").val(null) $("#zlCode").val(null) $("#chargeUnit").val(null) $("#zlItemPrice").val(null) $("#itemQuantity").val(null) $("#dayZlNum").val(null) $('#dayZlNum').selectpicker('refresh'); $("#orderFrequencyZl").val(null) $('#orderFrequencyZl').selectpicker('refresh'); $("#totalNumZl").val(null) $("#totalAmountZl").val(null) $("#execUnit").val(null) $('#execUnit').selectpicker('refresh'); $("#remark").val(null) } //保存右边数据 function saveRightData() { let obj = { zlCode: $("#zlCode").val(), name: $("#yjksItem").val(), descriptions: $("#descriptions").val(), chargeUnit: $("#chargeUnit").val(), zlItemPrice: $("#zlItemPrice").val(), itemQuantity: $("#itemQuantity").val(), dayZlNum: $("#dayZlNum").val(), orderFrequencyZl: $("#orderFrequencyZl").val(), totalNumZl: $("#totalNumZl").val(), totalAmountZl: $("#totalAmountZl").val(), execUnit: $("#execUnit").val(), execUnitName: $('#execUnit option:selected').text(), remark: $("#remark").val(), } if(!stringNotBlank(obj.zlCode)){ errorMesageSimaple('项目编码不能为空!') return } if(!stringNotBlank(obj.itemQuantity) || obj.itemQuantity <= 0){ errorMesageSimaple('单量不能为空或单量必须大于0!') return } if(!stringNotBlank(obj.dayZlNum)){ errorMesageSimaple('天数不能为空!') return } if(!stringNotBlank(obj.orderFrequencyZl)){ errorMesageSimaple('频次不能为空!') return } if(checkCfData(obj)){ errorMesageSimaple('已经开具了该项目,请不要重复开!') return } rightData.push(obj); loadRightTable(); jiSuanTotalCharge(); clearData(); } function checkCfData(obj) { for (let i = 0; i 打印'; return str; } }, { field: 'patientId', title: '门诊号', align: "center", valign: 'middle' }, { field: 'times', title: '次数', align: "center", valign: 'middle' }, { field: 'name', title: '姓名', align: "center", valign: 'middle' }, { field: 'deptName', title: '科室', align: "center", valign: 'middle' }, { field: 'doctorName', title: '医生', align: "center", valign: 'middle' }, { field: 'visitDate', title: '时间', align: "center", valign: 'middle', formatter: function (value, row, index) { return format(value,'yyyy-MM-dd HH:mm:ss') } }, { field: 'totalFee', title: '总金额(元)', align: "center", valign: 'middle' } ], 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 queryMzPatient() { //getByIcCardNo icCardNo getAjaxRequst("/thmz/getByIcCardNo",{icCardNo:$("#patientIdParam").val()},true,function (res) { if(res.code == 0){ $("#patientIdText").text(res.data.patientId) $("#nameParam").text(res.data.name) $("#ageParam").text(res.data.ageString) $("#sexParam").text(res.data.sex == 1 ? '男' : '女') }else { errorMesage(res) } }) } /** * 清空病人信息 */ function clearPatient() { $("#patientIdText").text(null) $("#nameParam").text(null) $("#ageParam").text(null) $("#sexParam").text(null) } /** * 初始化当前医生说书科室 */ function initClinicDeptNo() { $.ajax({ type: "GET", url: '/thmz/getUnitCodeByCurrentUser', 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; } var html = ''; $.each(res.data, function (commentIndex, comment) { html += ''; }); $('#clinicDeptNo').empty(); $('#clinicDeptNo').html(html); $('#clinicDeptNo').selectpicker('refresh'); $('#clinicDeptNo').val(res.data[0].code); $('#clinicDeptNo').selectpicker('refresh'); } }); } /** * 打开科室选择页面 */ function selectDeptModal() { $("#selectDeptModal").modal("show"); } function chongPrint(patientId,times) { setPrintDetail(patientId,times) $("#yjEntryModal").modal("hide"); } /** * 加载搜索窗口 */ function initSearchList(content, searchTextIds, width, height) { var settings = { placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置 trigger: 'click', //值:click,hover 触发方式 content: '',//内容,内容可以是函数 width: width, //arrow:false,//是否显示箭头 multi: true,//在页面允许其他弹出层 closeable: true,//显示关闭按钮 style: '', //值:'',inverse delay: 300,//延迟时间, 悬浮属性才执行 padding: true,//内容填充 height: height, //offsetTop:10, cache: true,//如果缓存设置为false,则popover将销毁并重新创建 content: content }; if(Array.isArray(searchTextIds)){ for (let i = 0; i < searchTextIds.length; i++) { $('#' + searchTextIds[i]).webuiPopover('destroy').webuiPopover(settings); } }else{ $('#' + searchTextIds).webuiPopover('destroy').webuiPopover(settings); } } function setPrintDetail(patientId,times) { postAjaxJsonHttpRequst("/thmz/queryYjEntryPrintData",{patientId:patientId,times:times},true,function (res) { if(res.code == 0){ $("#patientId_t").html("门诊号:"+ res.data.patientId) $("#name_t").html("姓名:"+ res.data.name) $("#date_t").html("日期:"+ format(res.data.visitDate,'yyyy-MM-dd')) $("#dept_t").html("科室:"+ res.data.deptName) $("#doctor_t").html("医生:"+ res.data.doctorName) let html = ""; let mzChargeDetails = res.data.mzChargeDetails for (let i = 0; i '; html += ' ' + mzChargeDetails[i].tcName + ''; html += ' ' + mzChargeDetails[i].instructionText + ''; html += ' ' + mzChargeDetails[i].drugUnit + ''; html += ' ' + mzChargeDetails[i].unitPrice + ''; html += ' ' + mzChargeDetails[i].quantity + ''; html += ' ' + mzChargeDetails[i].amount + ''; html += ""; } html += '
金额合计:
'; $("#fymx_table_body").html(html); $("#total_count").text(res.data.totalFee+' 元'); setTimeout(printChargeDetail,500) }else { errorMesage(res) } }) } function jiSuanTotalCharge() { let total = 0; for (let i = 0; i = 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; } } }); }