//@ sourceURL=clinic.js //判断病人列表是否在加载中,防止重复加载 var msg_list_loading = false; //挂号卡片列表页面下标 var pageIndex = 0; $(function () { initGenderSelect(); initResponceTypeSelect(); $('#editUserBirthDayGroup').datetimepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', minView: "month", }); initDaterangepickerWithId('reportrange', "right"); formatCheck(); //数据校验 init_validator(); //时间区间 initMzWorkTime(); //初始门诊收银方式下拉选 initChequeType("payType"); /** * 清空 */ $("#clearRegistration").on("click", function (t) { $("#cardNo").val(null); $("#cardNo").attr("title", null); $("#userName").val(null); $("#age").val(null); $("#gender").selectpicker('val', 1); $("#gender").selectpicker('refresh'); $("#birthDay").val(null); $("#birthDay").attr("title", null); $("#phoneNum").val(null); $("#phoneNum").attr("title", null); $("#patientsNature").selectpicker('val', '01');//默认选中 $('#patientsNature').selectpicker('refresh'); $("#idCard").val(null); $("#idCard").attr("title", null); $("#address").val(null); $("#patientId").val(null); $("#editUser").hide(); //默认光标在卡号输入框 $("#cardNo").focus(); initMzWorkTime(); readonlyOrNot(false); }); //加载候诊患者列表 loadUnClinicTableList(); //加载接诊中患者列表 loadInClinicTableList(); //加载已接诊患者列表 loadClinicTableList(); //每隔一分钟秒读加载候诊患者列表 setInterval(function () { //加载候诊患者列表 loadUnClinicTableList(); }, 60000); //初始化快速接诊病人姓名栏事件 initUserList(); //初始化主诉弹出层 initRecommendList(); //卡号输入改变事件 cardNoChange(); /** * 患者信息修改 */ $("#saveEditUser").on("click", function (t) { modifyPatient(); }); /** * 挂号列表中的科室和医生列表初始化 */ initListSelect(); //折叠按钮初始化 $(".collapse-link").on("click", function () { var a = $(this).closest(".x_panel") , b = $(this).find("i") , c = a.find(".x_content"); a.attr("style") ? c.slideToggle(200, function () { a.removeAttr("style").css("background", "#EBEBE4"); }) : (c.slideToggle(200), a.css("height", "auto").css("background", "#EBEBE4")), b.toggleClass("fa-chevron-up fa-chevron-down") }); initSmartWizard("wizard0"); $(".actionBar").append("
金额:61.92元
"); /** * 接诊 */ $("#saveapidAccepts1").on("click", function (t) { var saveapidAccepts1 = $("#patientIdDb").val(); clinicalReception(saveapidAccepts1); clearRapidAcceptsModal(); $("#rapidAcceptsModal").modal("hide"); }); /** * 实例化智能问诊弹窗 */ // $("[data-toggle='popover']").popover(); $("#box-arrow-left").popover({ html: 'true', content: '
' }); }); /** * 关闭只能问诊弹框 */ function closePopover() { //$(".popover").popover('hide'); $("#box-arrow-left").click(); } /** * 加载只能问诊弹框内容 */ function contentMethod() { setTimeout(function () { $(".popover div.arrow").css("display", "none"); var popoverId = $("#box-arrow-left").attr("aria-describedby"); if (popoverId == undefined) { return; } var left = $("#" + popoverId).css("left"); left = left.replace("px", ""); left = parseInt(left); left = left + 55; $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px"); $("#" + popoverId + " .popover-content").css("height", "100%"); $("#smartAssistPopoverContent").css("height", "100%"); var html = '
' + ' ' + ' ' + '
' + '
' + '
' + '
' + '
' + '
' + ' ' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 畏寒发热咳嗽1周。肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + '
' + '
' + ' ' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + ' 急性上呼吸道感染' + '
' + '
诊断:肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多肺嗜酸性粒细胞增多' + '
' + '
' + '
' + '
' + '
' + '
' + '
'; $("#smartAssistPopoverContent").html(html); fitPatientHisData(); }, 100); // setTimeout(function () { // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda"); // },1000); } /** * 设置患者的就诊轨迹 */ function fitPatientHisData() { if($("#patientId").val()==null || $("#patientId").val()==""){ return; } $.ajax({ type: "POST", url: '/thmz/getClinicWithPage', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({ "patientId": $("#patientId").val(), "clinicStatuses": [5, 6], "pageSize": 10000, "offset": 0, "beginDate": "2012-02-01 00:00:00", "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss") }), 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 html = ''; var data = res.data; if (data == null || data.length == 0) { html = ''; } else { for (var i = 0; i < data.length; i++) { var icdText =data[i].icdText; if(icdText==null){ // continue; icdText="空白诊断"; } icdText=icdText.trim(); html += '
'; html += '
'; html += ' '; html += '
'; html += '
诊断:'; html += '
'; html += '
'; } } $("#patientHisData").text($("#patientName").text()+"的"); $("#patientHisDataForm").html(html); } else { errorMesage(res); } } }); } /** * 清空快速接诊弹窗 */ function clearRapidAcceptsModal() { $("#rapidAcceptsUserName").val(null); $("#rapidAcceptsUserCode").val(null); $("#patientIdDb").val(null); $("#rapidAcceptsUserCardNo").val(null); $("#rapidAcceptsUserGender").selectpicker('val', 0); $("#rapidAcceptsUserGender").selectpicker('refresh'); $("#rapidAcceptsUserPhoneNum").val(null); $("#rapidAcceptsUserIdCard").val(null); $("#rapidAcceptsUserIdCard").attr("title", null); $("#rapidAcceptsUserPhoneNum").attr("title", null); } /** * 清空接诊台用户信息 */ function clearUser() { $("#patientName").html(""); $("#patientAge").html(""); $("#patientGender").html(""); $("#patientId").val(null); $("#patientPhone").html(""); $("#patientPhoneLabel").hide(); $("#patientResponseType").html(""); $("#first").parent().addClass("checked"); $("#not").parent().removeClass("checked"); $("#patientHisData").text(""); } /** * 卡号输入改变事件 */ function cardNoChange() { if (window.ActiveXObject || "ActiveXObject" in window) { $("#rapidAcceptsUserCardNo").on('input propertychange', function () { queryUserInfoByCardNo(); }); } else { $("#rapidAcceptsUserCardNo").on('input οninput', function () { queryUserInfoByCardNo(); }); } } /** * 刷新就诊列表 */ function refreshClinic() { loadInClinicTableList(); loadClinicTableList(); } /** * 加载接诊中患者列表 */ function loadInClinicTableList() { //loadCommonClinicTableList("tb_table_in_clinic","/thmz/getInClinicWithPage"); loadCommonClinicTableList("tb_table_in_clinic", queryParamsInClinic); } /** * 加载已接诊患者列表 */ function loadClinicTableList() { //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage"); loadCommonClinicTableList("tb_table_clinic", queryParamsClinic); } /** * 加载患者列表通用方法 * @param id * @param queryParams */ function loadCommonClinicTableList(id, queryParams) { $('#' + id).bootstrapTable('refresh'); $('#' + id).bootstrapTable({ url: "/thmz/getClinicWithPage", //请求后台的URL(*) method: 'post', //请求方式(*) toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, //是否显示行间隔色 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: true, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 queryParams: queryParams, //传递参数(*) 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: 'patientName', title: '姓名/性别/年龄', align: "center", valign: 'middle', // sortable: true formatter: function (value, row, index) { return value + "/" + row.gender + "/" + row.age + "岁"; } }, { field: 'opDay', title: '接诊时间', align: "center", valign: 'middle', // sortable: true formatter: function (value, row, index) { return format(value, "MM/dd HH:mm"); } } , { title: '操作', align: "center", valign: 'middle', // sortable: true, formatter: function (value, row, index) { if (row.clinicStatus == 5) { return '修改 详情'; } else { return '接诊 详情'; } } } ], responseHandler: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var ress = eval(res); if (ress.code == -1) { new PNotify({ title: '错误提示', text: ress.message, type: 'error', hide: false, styling: 'bootstrap3' }); return { "total": 0,//总页数 "rows": {} //数据 }; } return { "total": ress.total,//总页数 "rows": ress.data //数据 }; }, onLoadSuccess: function (data) { $(".pagination-detail").css("display", "none"); if (id == "tb_table_clinic") { $("#ClinicNum").html(data.total); } else { $("#inClinicNum").html(data.total); } } }); } /** * 得到查询的参数 * @param params * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}} */ function queryParamsInClinic(params) { var rePortRangeArr = getRePortRangeArr(); var temp = { beginDate: rePortRangeArr[0], endDate: rePortRangeArr[1], commonParams: $("#userName").val(), clinicStatuses: [4], pageSize: params.limit, offset: params.offset }; return temp; }; /** * 得到查询的参数 * @param params * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}} */ function queryParamsClinic(params) { var rePortRangeArr = getRePortRangeArr(); var temp = { beginDate: rePortRangeArr[0], endDate: rePortRangeArr[1], commonParams: $("#userName").val(), clinicStatuses: [5, 6, 7], pageSize: params.limit, offset: params.offset }; return temp; }; /** * 加载待诊患者列表方法 */ function loadUnClinicTableList() { $('#tb_table_un_clinic').bootstrapTable('refresh'); $('#tb_table_un_clinic').bootstrapTable({ url: "/thmz/getUnClinicWithPage", //请求后台的URL(*) method: 'post', //请求方式(*) toolbar: '#toolbar', //工具按钮用哪个容器 striped: true, //是否显示行间隔色 cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) pagination: true, //是否显示分页(*) sortable: true, //是否启用排序 sortOrder: "asc", //排序方式 queryParams: queryParamsUnClinic, //传递参数(*) 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: 'name', title: '姓名/性别/年龄', align: "center", valign: 'middle', // sortable: true formatter: function (value, row, index) { return value + "/" + row.gender + "/" + row.age + "岁"; } }, { field: 'visitDate', title: '分诊时间', align: "center", valign: 'middle', // sortable: true formatter: function (value, row, index) { return format(value, "MM/dd HH:mm"); } } , { title: '操作', align: "center", valign: 'middle', // sortable: true, formatter: function (value, row, index) { if (row.statusFlag == 0) { return '接诊'; } else { return '通知 接诊'; } } } ], responseHandler: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } var ress = eval(res); if (ress.code == -1) { new PNotify({ title: '错误提示', text: ress.message, type: 'error', hide: false, styling: 'bootstrap3' }); return { "total": 0,//总页数 "rows": {} //数据 }; } return { "total": ress.total,//总页数 "rows": ress.data //数据 }; }, onLoadSuccess: function (data) { $(".pagination-detail").css("display", "none"); $("#unClinicNum").html(data.total); } }); } /** * 得到查询的参数 * @param params * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}} */ function queryParamsUnClinic(params) { var temp = { pageSize: params.limit, pageIndex: params.offset / params.limit, //页码 }; return temp; }; /** * 接诊方法 * @param patientId */ function clinicalReception(patientId) { var existPatientId = $("#patientId").val(); if (existPatientId != null && existPatientId != "" && existPatientId != patientId) { $("#messageModal").modal(); $("#messageButton").on("click", function (t) { $("#messageModal").modal("hide"); clearWorkSpace(); realClinicalReception(patientId) }); } else { realClinicalReception(patientId) } } /** * 真实的接诊方法 * @param patientId */ function realClinicalReception(patientId) { $.ajax({ type: "GET", url: '/thmz/getByPatientId?patientId=' + patientId, 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) { if (res.data != null) { $("#patientName").html(res.data.name); $("#patientAge").html(res.data.age); $("#patientGender").html(res.data.gender); $("#patientId").val(patientId); if (res.data.phoneNo != null && res.data.phoneNo != '') { $("#patientPhone").html(res.data.phoneNo); $("#patientPhoneLabel").show(); } else { $("#patientPhoneLabel").hide(); } $("#patientResponseType").html(res.data.responseTypeName); if (res.data.times == 1) { $("#first").parent().addClass("checked"); $("#not").parent().removeClass("checked"); } else { $("#not").parent().addClass("checked"); $("#first").parent().removeClass("checked"); } $("#patientHisData").text(res.data.name); } } else { errorMesage(res); } } }); } /** * 清空工作台 */ function clearWorkSpace() { //TODO clearUser(); } /** * 就诊详情 * @param id */ function visitingDetailModal(id) { $("#visitingDetailModal").modal(); } /** * 医疗范文 * @param id */ function medicalModelModal(id) { $("#medicalModelModal").modal(); } /** * 填充主诉 * @param appeal */ function fitAppeal(appeal) { var symptom = $("#symptom").val(); if (symptom != null && symptom != "") { if (confirm("主诉项已经录入,是否覆盖?")) { $("#symptom").val(appeal); } } else { $("#symptom").val(appeal); } } /** * 实例化处方分页 * @param id */ function initSmartWizard(id) { if (typeof ($.fn.smartWizard) === 'undefined') { return; } console.log('init_SmartWizard'); $('#' + id).smartWizard(); $('.buttonNext').addClass('btn btn-success'); $('.buttonPrevious').addClass('btn btn-primary'); $('.buttonFinish').addClass('btn btn-default'); $(".stepContainer").css("height", "270px"); $(".buttonFinish").css("display", "none"); $(".buttonNext").html("下一个"); $(".buttonPrevious").html("上一个"); //动态设置微元素的高度 $('').appendTo('head')//这里写body也可以 //$('').appendTo('head')//这里写body也可以 }; /** * 初始化性别下拉选 */ function initGenderSelect() { $(".selectpicker").selectpicker({ dropuAuto: false }); var gender = ''; $('#rapidAcceptsUserGender').html(gender); $('#rapidAcceptsUserGender').selectpicker('refresh'); $('#editUserGender').html(gender); $('#editUserGender').selectpicker('refresh'); } /** * 初始化病人身份类别下拉选 */ function initResponceTypeSelect() { $(".selectpicker").selectpicker({ dropuAuto: false }); $("#groupId").parent().css("width", "85px"); $("#groupId1").parent().css("width", "85px"); $("#groupId3").parent().css("width", "85px"); $.ajax({ type: "GET", url: '/thmz/getMzResponceType', 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) { res.data.forEach(function (item, index) { var html = ''; $('#patientsNature').append(html); $('#editUserPatientsNature').append(html); }); $('#patientsNature').selectpicker('refresh'); $('#editUserPatientsNature').selectpicker('refresh'); } else { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: false, styling: 'bootstrap3' }); } } }); } /** * 初始科室下拉选 * @param ampm 时间段区间 */ function initDeptPlus() { //科室列表 $.ajax({ type: "GET", url: '/thmz/getUnitCodeByRequestDay?ampm=' + $("#ampm").val(), 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; } var html = ''; $.each(data.data, function (commentIndex, comment) { html += ''; }); $('#deptNo').empty(); $('#deptNo').html(html); $('#deptNo').selectpicker('refresh'); $('#chargeType').empty(); $('#chargeType').selectpicker('refresh'); emptyInput(); } }); } /** * 初始医生下拉选 * @param ampm 时间段区间 */ function initEmployee() { //医生列表 $.ajax({ type: "GET", url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val(), 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 = ''; var flag = false; $.each(res.data, function (commentIndex, comment) { html += ''; if (comment.employeeCode == -1) { flag = true; } }); $('#doctor').empty(); $('#doctor').html(html); $('#doctor').selectpicker('refresh'); validator.checkAll($("#regi_form")); if (flag) { //如果有无需选择医生的选项,默认选择 $('#doctor').selectpicker('val', -1); $('#doctor').selectpicker('refresh'); fitFee(); } } }); } /** * 初始门诊时间区间下拉选 */ function initMzWorkTime() { $.ajax({ type: "GET", url: '/thmz/getMzWorkTime', 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 = ''; var ampm = null; $.each(res.data, function (commentIndex, comment) { html += ''; if (ampm == null || (ampm != "a" && ampm != "p")) { var startTime = paseToFullTime(comment.startTime); var endTime = paseToFullTime(comment.endTime); if (range(startTime, endTime)) { ampm = comment.code; } } }); $('#ampm').empty(); //清空resText里面的所有内容 $('#ampm').html(html); $('#ampm').selectpicker('refresh'); $("#ampm").selectpicker('val', ampm); $('#ampm').selectpicker('refresh'); initDeptPlus(); } }); } /** * 初始门诊号别下拉选 */ function initChargeType() { $.ajax({ type: "GET", url: '/thmz/getChargeTypeByRequestDay?unitCode=' + $('#deptNo').val() + "&m=" + $("#ampm").val(), 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 += ''; }); $('#chargeType').empty(); //清空resText里面的所有内容 $('#chargeType').html(html); $('#chargeType').selectpicker('refresh'); validator.checkAll($("#regi_form")); emptyInput(); } }); } /** * 设置挂号费等费用 */ function fitFee() { var chargeType = $('#doctor').find("option:selected").attr('data-chargeType'); var checkFee = $('#doctor').find("option:selected").attr('data-checkFee'); $("#checkFee").val(checkFee); $("#amountMoney").text(checkFee); $("#amountMoneyConfirm").text(checkFee); $("#realMoney").val(checkFee); $("#cash").val(checkFee); $("#changeAmount").val(0); $.ajax({ type: "GET", url: '/thmz/getMzChargeTypeByCode?code=' + chargeType, 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; } $("#registrationFee").val(res.data.reqFee); $("#hospitalFee").val(res.data.clinicFee); checkFee = parseFloat(checkFee) + parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee); $("#amountMoney").text(checkFee); $("#amountMoneyConfirm").text(checkFee); $("#realMoney").val(checkFee); $("#cash").val(checkFee); } }); } /** * 初始门诊收银方式下拉选 */ function initChequeType(payType) { $.ajax({ type: "GET", url: '/thmz/getAllZdChequeTypeForMz', 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 += ''; }); $('#' + payType).empty(); $('#' + payType).html(html); $('#' + payType).selectpicker('refresh'); } }); } /** * 日期值改变修改年龄字段 * @param ev */ function changeDate(ev) { } /** * 列表类型按钮切换事件 * @param object */ function titleButtonChange(object) { $("#regi_List_btn_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"); loadRegistrationList(true); } /** * 表格类型切换事件 卡片展示或者列表形式 */ function listTypeChange(object) { //var indexNum = 0; $("#regi_List_type").find("button").each(function (index, element) { if ($(element).hasClass("btn-primary")) { $(element).removeClass("btn-primary").addClass("btn-default"); } // if (object == element) { // indexNum = index; // } }); $(object).removeClass("btn-default").addClass("btn-primary"); loadRegistrationList(true); } /** * 打开编辑挂号信息窗口 * @param data */ function editRegistration(data) { $("#editRegiModal").modal(); } /** * 打开编辑用户信息窗口 * @param data */ function editUserModal() { $("#editUserModal").modal(); $.ajax({ type: "GET", url: '/thmz/getByPatientId?patientId=' + $("#patientId").val(), 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) { if (res.data != null) { //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件 setTimeout(function () { fillPlusPatinet(res.data); }, 400); } } else { errorMesage(res); } } }); } /** * 收费明细类型按钮切换事件 * @param object * @param objectIndex */ function billItemButtonChange(object, objectIndex) { $("#bill_item_group").find("button").each(function (index, element) { if ($(element).hasClass("btn-primary")) { $(element).removeClass("btn-primary").addClass("btn-default"); } if (index == objectIndex) { var id = "wizard" + index; $("#" + id).removeClass("hide").addClass("show"); initSmartWizard(id); var amountId = "amount" + index; if ($("#" + amountId).length <= 0) { $($(".actionBar")[index]).append("
金额:61.92元
"); } $("#rp_form" + index).removeClass("hide").addClass("show"); } else { $("#wizard" + index).removeClass("show").addClass("hide"); $("#rp_form" + index).removeClass("show").addClass("hide"); } }); $(object).removeClass("btn-default").addClass("btn-primary"); // initChargeDetailTable(); //默认光标在卡号输入框 // $("#cardNo").focus(); } /** * 打开智能辅助医生系统窗口 * @param data */ function smartAssistModal() { //点击模态框外不关闭模态框 $("#smartAssistModal").modal({ backdrop: "false" }); //$(".modal-backdrop").remove(); } /** * 打开退费信息窗口 * @param data */ function backNoModal(data) { $("#backNoModal").modal(); } /** * 打开打印窗口 * @param data */ function printOrPreviewModal(data) { $("#printOrPreviewModal").modal(); } /** * 打开打印内容窗口 * @param data */ function printModal(data) { $("#printOrPreviewModal").modal("hide"); $("#printModal").modal(); } /** * 打开快速接诊窗口 * @param data */ function rapidAcceptsModal() { $("#rapidAcceptsModal").modal(); //延迟触发 默认光标在卡号输入框 setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500); } /** * checkBox样式 */ function formatCheck() { if ($("input.flat")[0]) { $(document).ready(function () { $('input.flat').iCheck({ checkboxClass: 'icheckbox_flat-blue', radioClass: 'iradio_flat-blue' }); }); } } /** * 卡号有变化后查询病人信息 */ function queryUserInfoByCardNo() { //当反写的id不存在,说明不是查询后的改变事件,触发查询 var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val(); var index = rapidAcceptsUserCardNo.indexOf("-"); if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) { $("#cardNo").attr("title", rapidAcceptsUserCardNo); $.ajax({ type: "GET", url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo, 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) { if (res.data != null) { $("#rapidAcceptsUserName").val(res.data.name); $("#rapidAcceptsUserCode").val(res.data.patientId); $("#patientIdDb").val(res.data.patientId); $("#rapidAcceptsUserCardNo").val(res.data.icCardNo); $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex); $("#rapidAcceptsUserGender").selectpicker('refresh'); $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo); $("#rapidAcceptsUserIdCard").val(res.data.socialNo); $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo); $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo); } else { errorMesageSimaple("病人信息不存在!"); } } else { errorMesage(res); } } }); } } /** * 清空快速接诊查询框 */ function clearRapidAccepts() { $("#rapidAcceptsUserName").val(null); $("#rapidAcceptsUserCode").val(null); $("#patientIdDb").val(null); $("#rapidAcceptsUserCardNo").val(null); $("#rapidAcceptsUserGender").selectpicker('val', 0); $("#rapidAcceptsUserGender").selectpicker('refresh'); $("#rapidAcceptsUserPhoneNum").val(null); $("#rapidAcceptsUserIdCard").val(null); $("#rapidAcceptsUserIdCard").attr("title", null); $("#rapidAcceptsUserPhoneNum").attr("title", null); $("#rapidAcceptsUserCardNo").focus(); } /** * 校验收款金额 */ function checkFee() { var cash = parseFloat($("#cash").val()); var realMoney = parseFloat($("#realMoney").val()); realMoney = realMoney.toFixed(2); $("#realMoney").val(realMoney) if (cash < realMoney) { new PNotify({ title: '错误提示', text: "收款金额不能少于实收金额!", type: 'error', hide: true, styling: 'bootstrap3' }); } else if (cash > realMoney) { if ($("#payType").val() == 1) { var changeAmount = cash - realMoney; $("#changeAmount").val(changeAmount.toFixed(2)); } else { new PNotify({ title: '错误提示', text: "非现金收款金额不能大于实收金额!", type: 'error', hide: true, styling: 'bootstrap3' }); } } //计算和设置折扣比例 var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text()); var discount = realMoney / amountMoneyConfirm * 100; $("#discount").text(discount.toFixed(2)) } /** * 根据病人姓名输入框内容动态加载病人列表 */ function initUserList() { //var width=$("#userName").css("width"); var settings = { trigger: 'click', content: '', width: 170, multi: true, closeable: false, style: '', delay: 300, padding: true, height: 300 }; var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings); //用户姓名选中事件 $("#rapidAcceptsUserName").on("click", function (t) { if ($(webuiPopover).css("display") == "block") { refeshPatinetList(true); } }); } /** * 刷新候诊病人列表 */ function refeshPatinetList(flag) { //如果是重新加载病人列表,需要重置下标 if (flag) { //重置下标 pageIndex = 0; msg_list_loading = true; } var userName = $('#rapidAcceptsUserName').val(); if (!(userName == null || userName == "" || isChinese(userName))) { return; } $.ajax({ type: "POST", url: '/thmz/getUnClinicWithPage', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({"name": userName, "pageIndex": pageIndex}), 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) { if (res.data != null && res.data.length > 0) { $("#webuiPopover0").css("display", "block"); $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto"); var html = '
'; for (var i = 0; i < res.data.length; i++) { var mzPatientMi = res.data[i]; html += ''; if (mzPatientMi.gender == "男") { html += '' } else if (mzPatientMi.gender == "女") { html += '' } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) { html += '' } html += '
' + mzPatientMi.name + ' ' + mzPatientMi.gender + ' '; if (mzPatientMi.age != null && mzPatientMi.age != "") { html += mzPatientMi.age + '岁'; } else { html += '**岁'; } if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") { html += '' + mzPatientMi.phoneNo + ''; } html += '
'; } html += '
'; if (flag) { $("#webuiPopover0 div.webui-popover-content").html(""); } $("#webuiPopover0 div.webui-popover-content").append(html); $("#webuiPopover0 div.arrow").css("left", "23px"); refeshPatinetListScrollEvent(); } else { $("#webuiPopover0").css("display", "none"); } } //查询完成,设置加载完成 msg_list_loading = false; } }); } /** * 病人下拉列表滚动条滚动到底部时继续加载新纪录 */ function refeshPatinetListScrollEvent() { $('.webui-popover-content').scroll(function (event) { var top = $(this).scrollTop(); var height = $(this).height(); var scrollHeight = $(this).get(0).scrollHeight; if (scrollHeight <= top + height) { if (!msg_list_loading) { msg_list_loading = true; pageIndex = pageIndex + 1; refeshPatinetList(false); } } }); } /** * 按照病人id查询病人信息 * @param patientId */ function fillUnClinicPatinet(patientId) { $("#rapidAcceptsUserCardNo").val(patientId); $("#webuiPopover0").css("display", "none"); queryUserInfoByCardNo(); } /** * 加载主诉窗口 */ function initRecommendList() { var width = $("#symptom").parent().css("width"); 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, multi: true,//在页面允许其他弹出层 closeable: true,//显示关闭按钮 style: '', //值:'',inverse delay: 300,//延迟时间, 悬浮属性才执行 padding: true,//内容填充 height: 320 }; //主诉弹窗 var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings); //体格检查弹窗 settings.height = 260; $('#weight').webuiPopover('destroy').webuiPopover(settings); //诊断弹窗 settings.height = 320; var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings); //用户姓名选中事件 $("#symptom").on("click", function (t) { if ($(symptomWebuiPopover).css("display") == "block") { $("#webuiPopover1 div.arrow").css("left", "23px"); var html = '主诉'; html += "
"; html += "
"; html += '
' + '
' + '内容: ' + '
' + '
' + ' ' + '
' + '
' + '' + '
' + '
' + ' ' + '
' + '
'; $("#webuiPopover1 div.webui-popover-content").append(html); $('#paramsType').selectpicker('refresh'); $("#paramsType").parent().css("width", "140px").css("height", "34px"); loadSymptom(); } }); //体格检查各输入框选中事件 $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor").on("click", function (t) { if ($("#webuiPopover2").css("display") == "block") { $("#webuiPopover2").css("left", $("#webuiPopover1").css("left")); if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") { $("#webuiPopover2 div.arrow").css("left", "23px"); var html = '体格检查'; html += "
"; html += "
"; $("#webuiPopover2 div.webui-popover-content").append(html); loadHealthCheckup(); } //loadSymptom(); } else { $('#weight').webuiPopover('show'); $("#webuiPopover2").css("left", $("#webuiPopover1").css("left")); if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") { $("#webuiPopover2 div.arrow").css("left", "23px"); var html = '体格检查'; html += "
"; html += "
"; $("#webuiPopover2 div.webui-popover-content").append(html); loadHealthCheckup(); } } return false; }); //诊断选中事件 $("#diagnose").on("click", function (t) { if ($(diagnoseWebuiPopover).css("display") == "block") { $("#webuiPopover3 div.arrow").css("left", "23px"); $("#webuiPopover3 a.close").css("margin-top", "15px"); var html = '诊断'; html += '
' + ' ' + ' ' + '
'; html += "
"; html += "
"; $("#webuiPopover3 div.webui-popover-content").append(html); $("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val())); loadDiagnose(""); } }); } /** * 新增通用参数 */ function saveParams() { $.ajax({ type: "POST", url: '/thmz/saveTCommonParams', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({ "paramsType": $("#paramsType").val(), "paramsName": $("#paramsNameInput").val() }), 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) { successMesage(res); loadSymptom(); $("#paramsNameInput").val(null); // $("#paramsType").selectpicker('val', 0); // $("#paramsType").selectpicker('refresh'); } else { errorMesage(res); } } }); } /** * 加载主诉参数列表 */ function loadSymptom() { $.ajax({ type: "GET", url: '/thmz/loadSymptom', contentType: "application/json;charset=UTF-8", dataType: "json", async: false, 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 = ''; if (res.code == 0) { if (res.featureList != null && res.featureList.length > 0) { html += '
'; html += '
常用症状:
'; html += '
'; for (var i = 0; i < res.featureList.length; i++) { html += ''; } html += '
'; } if (res.timeList != null && res.timeList.length > 0) { html += '
'; html += '
常用时间:
'; html += '
'; for (var i = 0; i < res.timeList.length; i++) { html += ''; } html += '
'; } if (res.characterList != null && res.characterList.length > 0) { html += '
'; html += '
常用标点:
'; html += '
'; for (var i = 0; i < res.characterList.length; i++) { html += ''; } html += '
'; } if (res.wordsList != null && res.wordsList.length > 0) { html += '
'; html += '
常用词:
'; html += '
'; for (var i = 0; i < res.wordsList.length; i++) { html += ''; } html += '
'; } } else { errorMesage(res); } $("#contentHtml").html(html); } }); } /** * 加载体格检查参数列表 */ function loadHealthCheckup() { $.ajax({ type: "GET", url: '/thmz/loadHealthCheckup', contentType: "application/json;charset=UTF-8", dataType: "json", async: false, 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 = ''; if (res.code == 0) { if (res.weightList != null && res.weightList.length > 0) { html += '
'; html += '
体重:
'; html += '
'; for (var i = 0; i < res.weightList.length; i++) { html += ''; } html += '
'; } if (res.temperatureList != null && res.temperatureList.length > 0) { html += '
'; html += '
体温:
'; html += '
'; for (var i = 0; i < res.temperatureList.length; i++) { html += ''; } html += '
'; } if (res.sphygmusList != null && res.sphygmusList.length > 0) { html += '
'; html += '
脉搏:
'; html += '
'; for (var i = 0; i < res.sphygmusList.length; i++) { html += ''; } html += '
'; } if (res.breatheList != null && res.breatheList.length > 0) { html += '
'; html += '
呼吸:
'; html += '
'; for (var i = 0; i < res.breatheList.length; i++) { html += ''; } html += '
'; } if (res.pressureList != null && res.pressureList.length > 0) { html += '
'; html += '
呼吸:
'; html += '
'; for (var i = 0; i < res.pressureList.length; i++) { html += ''; } html += '
'; } } else { errorMesage(res); } $("#healthCheckupContentHtml").html(html); } }); } /** * 加载诊断参数列表 * @param value */ function loadDiagnose(value) { $.ajax({ type: "GET", url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value, contentType: "application/json;charset=UTF-8", dataType: "json", async: false, 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 = ''; if (res.code == 0) { if (res.data != null && res.data.length > 0) { html += '
'; for (var i = 0; i < res.data.length; i++) { html += ''; } html += '
'; } } else { errorMesage(res); } $("#diagnoseContentHtml").html(html); } }); } /** * 填充诊断 * @param value * @param code */ function fitDiagnoseValue(value, code) { var html = ''; var childrenNum = $("#diagnoseTags").children().length; if (childrenNum == 3) { errorMesageSimaple("最多填写三个诊断!"); return; } if (childrenNum == 0) { html += '' + value + ''; $("#diagnoseTags").append(html); var diagnoseValue = $("#diagnoseValue").val(); if (diagnoseValue == null || diagnoseValue == "") { diagnoseValue = code; } else { diagnoseValue += "," + code; } $("#diagnoseValue").val(diagnoseValue); } /** * 移除诊断 * @param code */ function removeDiagnoseValue(code) { var childrenIndex = 0; var children = $("#diagnoseTags").children(); for (var i = 0; i < children.length; i++) { if ($(children[i]).attr("id") == code) { childrenIndex = i; break; } } $($("#diagnoseTags").children("span")[childrenIndex]).remove(); if (childrenIndex == 0) { $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis"); } var diagnoseValue = $("#diagnoseValue").val(); $("#diagnoseValue").val(diagnoseValue.replace(code, "")); } /** * 点击通用参数属性值时设置值到对应的区域 * @param value * @param id */ function fitValue(value, id) { //当选择的是血压时 if (id == "pressure_") { var arr = value.split("/"); $("#pressure_high").val(arr[0]); $("#pressure_floor").val(arr[1]); //当选的是体重,体温,脉搏和呼吸时 } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") { $("#" + id).val(value); } else { //主诉拼写时 var valueExist = $("#" + id).val(); if (valueExist != null && valueExist != "") { value = valueExist + value; } $("#" + id).val(value); } } function getByPatientId(patientId) { $.ajax({ type: "GET", url: '/thmz/getByPatientId?patientId=' + patientId, 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) { if (res.data != null) { $("#cardNo").val(res.data.icCardNo); $("#cardNo").attr("title", res.data.icCardNo); $("#cardNo").blur(); $("#userName").val(res.data.name); $("#userName").blur(); $("#userNameReadOnly").val(res.data.name); $("#age").val(res.data.age); $("#age").blur(); $("#gender").selectpicker('val', res.data.sex); $("#gender").selectpicker('refresh'); $("#gender").blur(); $("#birthDayReadonly").val(res.data.birthDayStr); $("#birthDayReadonly").attr("title", res.data.birthDayStr); $("#birthDayReadonly").blur(); $("#birthDay").val(res.data.birthDayStr); $("#birthDay").blur(); $("#phoneNum").val(res.data.phoneNo); $("#phoneNum").attr("title", res.data.phoneNo); $("#phoneNum").blur(); $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中 $('#patientsNature').selectpicker('refresh'); $("#patientsNature").blur(); $("#idCard").val(res.data.socialNo); $("#idCard").attr("title", res.data.socialNo); $("#idCard").blur(); $("#address").val(res.data.address); $("#address").blur(); $("#patientId").val(res.data.patientId); if (res.data.name != null && res.data.name != "") { $("#editUser").show(); } readonlyOrNot(true); } } else { errorMesage(res); } } }); } /** * 将病人信息填入患者信息修改form * @param patinet */ function fillPlusPatinet(patinet) { if (patinet != null) { $("#editUserCode").val(patinet.patientId); $("#editUserName").val(patinet.name); $("#editUserName").blur(); $("#editUserAge").val(patinet.age); $("#editUserAge").blur(); $("#editUserGender").selectpicker('val', patinet.sex); $("#editUserGender").selectpicker('refresh'); $("#editUserGender").blur(); $("#editUserBirthDay").val(patinet.birthDayStr); $("#editUserBirthDay").blur(); $("#editUserCardNo").val(patinet.icCardNo); $("#editUserCardNo").attr("title", patinet.icCardNo); $("#editUserCardNo").blur(); $("#editUserPhoneNum").val(patinet.phoneNo); $("#editUserPhoneNum").attr("title", patinet.phoneNo); $("#editUserPhoneNum").blur(); $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中 $('#editUserPatientsNature').selectpicker('refresh'); $("#editUserPatientsNature").blur(); $("#editUserIdCard").val(patinet.socialNo); $("#editUserIdCard").attr("title", patinet.socialNo); $("#editUserIdCard").blur(); $("#editUserAddress").val(patinet.address); $("#editUserAddress").blur(); $("#editUserContact").val(patinet.relName); $("#editUserContactPhone").val(patinet.contractName); } } /** * 关闭当前这个付款方式 */ function closeThisParent(obj) { $(obj).parent().parent().remove(); } /** * 科室与时间区间下拉选改变时清空输入框内容 */ function emptyInput() { $('#doctor').empty(); $('#doctor').selectpicker('refresh'); $("#registrationFee").val(0.00); $("#hospitalFee").val(0.00); $("#checkFee").val(0.00); $("#amountMoney").text(0.00); $("#amountMoneyConfirm").text(0.00); $("#realMoney").val(0.00); } /** * 给某些域增加title或者清除title * @param obj */ function clearTextOrTitle(obj) { if ($(obj).val() == null || $(obj).val().length == 0) { $(obj).attr("title", null); } else { $(obj).attr("title", $(obj).val()); if ($(obj).attr("id") == "birthDay") { $(obj).blur() } } } /** * 当按照卡号查询时,病人信息输入框不可编辑,当清空输入框时可编辑 * @param flag */ function readonlyOrNot(flag) { if (flag) { $("#cardNo").attr("readonly", "readonly"); $("#userName").attr("readonly", "readonly"); $("#age").attr("readonly", "readonly"); $("#gender").attr("disabled", "disabled"); $("#phoneNum").attr("readonly", "readonly"); $("#patientsNature").attr("disabled", "disabled"); $("#idCard").attr("readonly", "readonly"); $("#address").attr("readonly", "readonly"); $("#birthDayReadonly").removeClass("hide").addClass("in"); $("#birthDayGroup").removeClass("in").addClass("hide"); $("#userName").removeClass("in").addClass("hide"); $("#userNameReadOnly").removeClass("hide").addClass("in"); $("#webuiPopover0").css("display", "none"); } else { $("#cardNo").removeAttr("readonly"); $("#userName").removeAttr("readonly"); $("#age").removeAttr("readonly"); $("#gender").removeAttr("disabled"); $("#gender").next().removeClass("disabled"); $("#phoneNum").removeAttr("readonly"); $("#patientsNature").removeAttr("disabled"); $("#patientsNature").next().removeClass("disabled"); $("#idCard").removeAttr("readonly"); $("#address").removeAttr("readonly"); $("#birthDayReadonly").removeClass("in").addClass("hide"); $("#birthDayGroup").removeClass("hide").addClass("in"); $("#userName").removeClass("hide").addClass("in"); $("#userNameReadOnly").removeClass("in").addClass("hide"); //$("#webuiPopover0").css("display", "block"); } } /** * 保存窗口号 */ function saveWindows() { $.ajax({ type: "POST", url: '/thmz/saveWindows', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({"windowsNo": $("#windowsNum").val()}), headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")}, success: function (res) { if (res == '401' || res == 401) { window.location.href = '/thmz/login/view' return; } $('#editWindowsModal').modal('hide'); if (res.code == 0) { new PNotify({ title: '操作提示', text: res.message, type: 'success', hide: true, styling: 'bootstrap3' }); } else { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: true, styling: 'bootstrap3' }); } } }); } /** * 保存病人信息 */ function savePatient() { $.ajax({ type: "POST", url: '/thmz/savePatient', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({ "name": $("#userName").val(), "age": $("#age").val(), "sex": $("#gender").val(), "birthDay": $("#birthDay").val(), "icCardNo": $("#cardNo").val(), "phoneNo": $("#phoneNum").val(), "responseType": $("#patientsNature").val(), "socialNo": $("#idCard").val(), "address": $("#address").val() }), 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) { $("#patientId").val(res.data.patientId); saveMzyReqrec(); } else { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: true, styling: 'bootstrap3' }); } } }); } /** * 修改病人信息 */ function modifyPatient() { $.ajax({ type: "POST", url: '/thmz/modifyPatient', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({ "name": $("#editUserName").val(), "age": $("#editUserAge").val(), "sex": $("#editUserGender").val(), "birthDay": $("#editUserBirthDay").val(), "icCardNo": $("#editUserCardNo").val(), "phoneNo": $("#editUserPhoneNum").val(), "responseType": $("#editUserPatientsNature").val(), "socialNo": $("#editUserIdCard").val(), "address": $("#editUserAddress").val(), "patientId": $("#editUserCode").val(), "relName": $("#editUserContact").val(), "contractName": $("#editUserContactPhone").val() }), 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) { $('#editUserModal').modal('hide'); realClinicalReception($("#patientId").val()); } else { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: true, styling: 'bootstrap3' }); } } }); } /** * 保存挂号信息 */ function saveMzyReqrec() { var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId'); $.ajax({ type: "POST", url: '/thmz/saveMzyReqrec', contentType: "application/json;charset=UTF-8", dataType: "json", data: JSON.stringify({ "mzyReqrec": { "patientId": $("#patientId").val(), "ampm": $("#ampm").val(), "unitCode": $("#deptNo").val(), "chargeType": $("#chargeType").val() }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId }), 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) { new PNotify({ title: '操作提示', text: res.message, type: 'success', hide: true, styling: 'bootstrap3' }); $('#confirmFeeModal').modal('hide'); loadTableCount(); loadRegistrationList(true); } else { new PNotify({ title: '错误提示', text: res.message, type: 'error', hide: true, styling: 'bootstrap3' }); } } }); } /** * 挂号列表中的科室和医生列表初始化 */ function initListSelect() { initListDeptSelect(); initListDoctorSelect(); } /** * 挂号列表中的科室列表 */ function initListDeptSelect() { //科室列表 $.ajax({ type: "GET", url: '/thmz/allMzUnitCode', 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; } var html = ''; $.each(data.data, function (commentIndex, comment) { html += ''; }); $('#deptNoParam').empty(); $('#deptNoParam').html(html); $('#deptNoParam').selectpicker('refresh'); } }); } /** * 挂号列表中的医生列表初始化 */ function initListDoctorSelect() { //医生列表 $.ajax({ type: "GET", url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(), 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 += ''; }); $('#doctorParam').empty(); $('#doctorParam').html(html); // $("#doctorParam").selectpicker({ // size: 10 // }); $('#doctorParam').selectpicker('destroy').selectpicker('refresh'); } }); } /** * 加载挂号列表 * @param flag 是否清空挂号卡片列表区域 */ function loadRegistrationList(flag) { if (flag) { pageIndex = 0; $("#card_regi_list").empty(); $("div.page").removeClass("in").addClass("hide"); } var regiListType = getIndex("regi_List_type"); if (regiListType == 0) { loadCardList(); } else if (regiListType == 1) { loadTableList(); } } /** * 获取按钮组选择的下标 * @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; } /** * 获取时间选择器的时间数组 * @returns {string[]} */ function getRePortRangeArr() { var rePortRange = $('#reportrange span').html(); var rePortRangeArr = rePortRange.split(" - "); rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00" rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59" return rePortRangeArr; } /** * 清空搜索参数 */ function clearParams() { $("#deptNoParam").selectpicker('val', null); $("#deptNoParam").selectpicker('refresh'); $("#doctorParam").selectpicker('val', null); $("#deptNoParam").selectpicker('refresh'); $("#userNameParam").val(null); $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD')); }