//@ sourceURL=clinic.js
//判断病人列表是否在加载中,防止重复加载
var msg_list_loading = false;
//挂号卡片列表页面下标
var pageIndex = 0;
var nthTabs=null;
$(function () {
// nthTabs = $("#ypListTables").nthTabs();
//
// nthTabs.addTab({
// id:'a',
// title:'孙悟空',
// content:'看我七十二变',
// }).addTab({
// /*换个姿势*/
// id:'b',
// title:'猪八戒-关不掉',
// content:'高老庄娶媳妇',
// active:true,
// allowClose:false,
// }).addTab({
// id:'c',
// title:'沙和尚',
// content:'请叫我大叔',
// }).addTab({
// id:'d',
// title:'唐僧',
// content:'光头一个',
// }).addTab({
// id:'e',
// title:'武松',
// content:'打虎猛汉',
// }).addTab({
// id:'f',
// title:'潘金莲',
// content:'求爱爱',
// }).addTab({
// id:'g',
// title:'来个标题长一点的的的来个标题长一点的的的',
// content:'你赢了',
// }).addTab({
// id:'h',
// title:'支持连贯操作',
// content:'没错就是这么爽',
// }).addTab({
// id:'i',
// title:'欢迎提意见',
// content:'一定一定',
// }).addTab({
// id:'j',
// title:'熬夜写的啊',
// content:'码农苦逼~',
// }).setActTab("#c");
initGenderSelect();
initResponceTypeSelect();
$('#editUserBirthDayGroup').datetimepicker({
format: 'yyyy-mm-dd',
language: 'zh-CN',
minView: "month",
});
initDaterangepickerWithId('reportrange', "right");
formatCheck();
//数据校验
init_validator();
//时间区间
initMzWorkTime();
//初始频次下拉选
initOrderFrequencys();
//初始用药方式下拉选
initSupplyTypes();
/**
* 清空
*/
$("#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")
});
/**
* 接诊
*/
$("#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: '
'
});
//初始化药品分组下拉选
initGroupOrder();
// 初始化用药天数下拉选
initDayNum();
/**
* 给药方式设置最高的下拉选高度
*/
$("#supplyType").on('shown.bs.select', function (e) {
$("#supplyType").siblings('.dropdown-menu').css("max-height", "360px");
$('#supplyType').parent().find("input").keydown(function () {
$("#supplyType").siblings.css("max-height", "360px");
})
});
/**
* 用药频率设置最高的下拉选高度
*/
$("#orderFrequency").on('shown.bs.select', function (e) {
$("#orderFrequency").siblings('.dropdown-menu').css("max-height", "360px");
$('#orderFrequency').parent().find("input").keydown(function () {
$("#orderFrequency").siblings('.dropdown-menu').css("max-height", "360px");
})
});
});
/**
* 初始化用药天数下拉选
*/
function initDayNum() {
var html = '1 2 3 4 5 6 7 8 9 10 ';
$('#dayNum').html(html);
$('#dayNum').selectpicker('refresh');
}
/**
* 初始化药品分组下拉选
*/
function initGroupOrder() {
var html = '1 ';
$('#groupId').html(html);
$('#groupId').selectpicker('refresh');
$("#groupId").selectpicker('val', 1);
$('#groupId').selectpicker('refresh');
}
/**
* 追加分组
*/
function appendGroupOrder() {
var last = parseInt($("#groupId > option:last").val());
last++;
var html = '' + last + ' ';
$('#groupId').append(html);
$('#groupId').selectpicker('refresh');
}
/**
* 关闭只能问诊弹框
*/
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").css("z-index", "11");
$("#" + popoverId + " .popover-content").css("height", "100%");
$("#smartAssistPopoverContent").css("height", "100%");
var html = ' ' +
'
' +
' 就医轨迹' +
' ' +
'
× ' +
' ' +
'
' +
' ' +
'
' +
'
' +
' ' +
'
' +
' 推荐' +
' ' +
'
' +
'
' +
' ' +
'
' +
' 医疗范本' +
' ' +
'
' +
'
';
$("#smartAssistPopoverContent").html(html);
fitPatientHisData();
fitSymptomData();
fitEmrHpiData();
fitEmrPsData();
fitDiagnoseData();
}, 100);
// setTimeout(function () {
// $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
// },1000);
}
/**
* 设置患者的就诊轨迹
*/
function fitPatientHisData() {
var popoverId = $("#box-arrow-left").attr("aria-describedby");
if (!$("#" + popoverId).hasClass("in")) {
return;
}
var emptyHtml = ' ';
if ($("#patientId").val() == null || $("#patientId").val() == "") {
$("#patientHisDataForm").html(emptyHtml);
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 += emptyHtml;
} else {
for (var i = 0; i < data.length; i++) {
var icdText = data[i].icdText;
if (icdText == null) {
// continue;
icdText = "空白诊断";
}
icdText = icdText.trim();
html += ' ';
}
}
$("#patientHisData").text($("#patientName").text() + "的");
if ($("#patientId").val() == null || $("#patientId").val() == "") {
$("#patientHisDataForm").html(emptyHtml);
} else {
$("#patientHisDataForm").html(html);
}
} else {
errorMesage(res);
}
}
});
}
/**
* 设置主诉推荐
*/
function fitSymptomData() {
fitRecommendData(12);
}
/**
* 设置现病史推荐
*/
function fitEmrHpiData() {
fitRecommendData(5);
}
/**
* 设置既往史推荐
*/
function fitEmrPsData() {
fitRecommendData(6);
}
/**
* 设置诊断推荐
*/
function fitDiagnoseData() {
fitRecommendData(13);
}
/**
* 设置推荐通用方法
*/
function fitRecommendData(paramsType) {
var popoverId = $("#box-arrow-left").attr("aria-describedby");
if (!$("#" + popoverId).hasClass("in")) {
return;
}
var inputId = "symptom";
var text = "主诉";
if (paramsType == 5) {
inputId = "emrHpi";
text = "现病史";
} else if (paramsType == 6) {
inputId = "emrPs";
text = "既往史";
} else if (paramsType == 13) {
inputId = "diagnose";
text = "诊断";
}
//光标不在现病史上
if (document.activeElement.id != inputId) {
return;
}
$("#recommendType").html(text);
var emptyHtml = ' ';
$.ajax({
type: "GET",
url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
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;
}
if (res.code == 0) {
var html = '';
var data = res.data;
if (data == null || data.length == 0) {
html += emptyHtml;
} else {
for (var i = 0; i < data.length; i++) {
var paramsContent = data[i].paramsContent;
html += ' ';
}
}
$("#recommendForm").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();
$("#messageContent").html("当前有病人正在接诊,是否切换?");
$("#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);
fitPatientHisData();
}
} else {
errorMesage(res);
}
}
});
}
/**
* 清空工作台
*/
function clearWorkSpace() {
//TODO
clearUser();
}
/**
* 就诊详情
* @param id
*/
function visitingDetailModal(id) {
$("#visitingDetailModal").modal();
}
/**
* 医疗范文
* @param id
*/
function medicalModelModal(id) {
$("#medicalModelModal").modal();
}
/**
* 底层填充推荐方法
* @param paramsType
* @param appeal
* @param inputId
*/
function extracted(paramsType, appeal, inputId) {
if (paramsType == 13) {
var contentArr = appeal.split(",");
if (contentArr != null && contentArr.length > 0) {
for (var i = 0; i < contentArr.length; i++) {
var content = contentArr[i].replace(")", "").replace("(", "-");
var diagnoseArr = content.split("-");
if (diagnoseArr == null || diagnoseArr.length == 0) {
continue;
}
fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
}
}
} else {
$("#" + inputId).val(appeal);
}
}
/**
* 填充推荐
* @param appeal
* @param paramsType
*/
function fitAppeal(appeal, paramsType) {
var inputId = "symptom";
var text = "主诉项已经录入,是否覆盖?";
if (paramsType == 5) {
inputId = "emrHpi";
text = "现病史项已经录入,是否覆盖?";
} else if (paramsType == 6) {
inputId = "emrPs";
text = "既往史项已经录入,是否覆盖?";
} else if (paramsType == 13) {
inputId = "diagnoseValue";
text = "诊断项已经录入,是否覆盖?";
}
var symptom = $("#" + inputId).val();
if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
symptom = null;
}
if (symptom != null && symptom != "") {
$("#messageModal").modal();
$("#messageContent").html(text);
$("#messageButton").on("click", function (t) {
$("#messageModal").modal("hide");
if (paramsType == 13) {
$("#" + inputId).val(null);
$("#diagnoseTags").html(null);
}
extracted(paramsType, appeal, inputId);
});
} else {
extracted(paramsType, appeal, inputId);
}
}
/**
* 初始化性别下拉选
*/
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
});
$.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 = '' + item.name + ' ';
$('#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 += '' + comment.name + ' ';
});
$('#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 += '' + comment.employee.employeeName + ' ';
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 += '' + comment.name + ' ';
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 += '' + comment.name + ' ';
});
$('#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 initOrderFrequencys() {
$.ajax({
type: "GET",
url: '/thmz/getOrderFrequencys',
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 += '' + comment.name + '(' + comment.code + ')' + ' ';
});
$('#orderFrequency').empty();
$('#orderFrequency').html(html);
$('#orderFrequency').selectpicker('refresh');
}
});
}
/**
* 初始用药方式下拉选
*/
function initSupplyTypes() {
$.ajax({
type: "GET",
url: '/thmz/getSupplyTypes',
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 += '' + comment.name + ' ';
});
$('#supplyType').empty();
$('#supplyType').html(html);
$('#supplyType').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);
}
/**
* 保存当前药品到右边处方区域 西药
*/
function saveWesternMedicine() {
$("#xyTab").append('test ');
$("#xyTabContent").append('规则内容面板sdfdfasdfasdfd
');
//组号
var groupId = $("#groupId").val();
//药品名称
var westernMedicineNamme = $("#western_medicine_namme").val();
//当前药品编码
var currentCode = $("#current_code").val();
//当前药品规格
var currentSerial = $("#current_serial").val();
//用法编码
var supplyType = $("#supplyType").val();
//用法描述
var supplyTypeText = $('#supplyType option:selected').text();
//药品默认单次使用剂量
var drugWinDb = $("#drugWinDb").val();
//处方实际单次使用剂量
var drugWin = $("#drugWin").val();
//剂量单位
var drugWinUnit = $("#drugWinUnit").val();
//天数
var dayNum = $("#dayNum").val();
//频次编码
var orderFrequency = $("#orderFrequency").val();
//频次描述
var orderFrequencyText = $('#orderFrequency option:selected').text();
//总量
var gross = $("#gross").val();
//包装单位
var packUnit = $("#packUnit").val();
//医嘱
var medicalAdvice = $("#medicalAdvice").val();
var html = '';
html += groupId + '. ';
html += westernMedicineNamme + ' ';
html += drugWinDb + drugWinUnit + ' ';
html += drugWin + drugWinUnit + ' 共';
html += gross + packUnit + ' ';
html += '用法:' + supplyTypeText + ' ';
html += '频次:' + orderFrequencyText + ' ';
html += dayNum + '天 ';
if (medicalAdvice != null && medicalAdvice != '') {
html += '医嘱:' + medicalAdvice;
}
html += ' ';
html += ' ';
html += '
';
$("div.rb_item_0").each(function () {
if ($(this).css("display") === "block") {
$(this).find("div:eq(1)").append(html);
}
});
var groupIdLast = $("#groupId option:last-child").text();
if (groupId === groupIdLast) {
appendGroupOrder();
}
// clearWesternMedicine();
}
/**
* 清空西药
*/
function clearWesternMedicine() {
//药品名称
$("#western_medicine_namme").val(null);
//当前药品编码
$("#current_code").val(null);
//当前药品规格
$("#current_serial").val(null);
//用法编码
$("#supplyType").selectpicker('val', null);
$('#supplyType').selectpicker('refresh');
//药品默认单次使用剂量
$("#drugWinDb").val(null);
//处方实际单次使用剂量
$("#drugWin").val(null);
//剂量单位
$("#drugWinUnit").selectpicker('val', null);
$('#drugWinUnit').selectpicker('refresh');
//天数
$("#dayNum").selectpicker('val', null);
$('#dayNum').selectpicker('refresh');
//频次编码
$("#orderFrequency").selectpicker('val', null);
$('#orderFrequency').selectpicker('refresh');
//总量
$("#gross").val(null);
//包装单位
$("#packUnit").selectpicker('val', null);
$('#packUnit').selectpicker('refresh');
//单价
$("#packRetprice").val(null);
//金额
$("#totalRetprice").val(null);
//医嘱
$("#medicalAdvice").val(null);
}
/**
* 打开编辑用户信息窗口
* @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) {
} else {
}
});
$(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 = '';
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,
//arrow:false,//是否显示箭头
multi: true,//在页面允许其他弹出层
closeable: true,//显示关闭按钮
style: '', //值:'',inverse
delay: 300,//延迟时间, 悬浮属性才执行
padding: true,//内容填充
height: 320,
//offsetTop:10,
cache: true,//如果缓存设置为false,则popover将销毁并重新创建
};
//主诉弹窗
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);
//西药弹窗
settings.width = 980;
settings.closeable = false;
settings.content = '';
var westernMedicineWebuiPopover = $('#western_medicine_namme').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").html(html);
$('#paramsType').selectpicker('refresh');
$("#paramsType").parent().css("width", "140px").css("height", "34px");
$("#webuiPopover1").css("z-index", "10");
if ($("#webuiPopover1").hasClass("in")) {
loadSymptom();
}
}
//加载智能接诊模块的主诉推荐
fitSymptomData();
});
//体格检查各输入框选中事件
$("#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").html(html);
$("#webuiPopover2").css("z-index", "10");
if ($("#webuiPopover2").hasClass("in")) {
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").html(html);
$("#webuiPopover2").css("z-index", "10");
if ($("#webuiPopover2").hasClass("in")) {
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").html(html);
$("#webuiPopover3").css("z-index", "10");
//$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
loadDiagnose("");
}
//加载智能接诊模块的诊断推荐推荐
fitDiagnoseData();
});
//现病史选中事件
$("#emrHpi").on("click", function (t) {
//加载智能接诊模块的现病史推荐推荐
fitEmrHpiData();
});
//既往史选中事件
$("#emrPs").on("click", function (t) {
//加载智能接诊模块的既往史推荐推荐
fitEmrPsData();
});
//西药选中事件
$("#western_medicine_namme").on("click", function (t) {
if ($(westernMedicineWebuiPopover).css("display") == "block") {
$("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
loadYpList();
}
});
}
/**
* 新增通用参数
*/
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 += res.featureList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.timeList != null && res.timeList.length > 0) {
html += '';
html += '
常用时间:
';
html += '
';
for (var i = 0; i < res.timeList.length; i++) {
html += '';
html += res.timeList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.characterList != null && res.characterList.length > 0) {
html += '';
html += '
常用标点:
';
html += '
';
for (var i = 0; i < res.characterList.length; i++) {
html += '';
html += res.characterList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.wordsList != null && res.wordsList.length > 0) {
html += '';
html += '
常用词:
';
html += '
';
for (var i = 0; i < res.wordsList.length; i++) {
html += '';
html += res.wordsList[i].paramsName;
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 += res.weightList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.temperatureList != null && res.temperatureList.length > 0) {
html += '';
html += '
体温:
';
html += '
';
for (var i = 0; i < res.temperatureList.length; i++) {
html += '';
html += res.temperatureList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.sphygmusList != null && res.sphygmusList.length > 0) {
html += '';
html += '
脉搏:
';
html += '
';
for (var i = 0; i < res.sphygmusList.length; i++) {
html += '';
html += res.sphygmusList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.breatheList != null && res.breatheList.length > 0) {
html += '';
html += '
呼吸:
';
html += '
';
for (var i = 0; i < res.breatheList.length; i++) {
html += '';
html += res.breatheList[i].paramsName;
html += ' ';
}
html += '
';
}
if (res.pressureList != null && res.pressureList.length > 0) {
html += '';
html += '
呼吸:
';
html += '
';
for (var i = 0; i < res.pressureList.length; i++) {
html += '';
html += res.pressureList[i].paramsName;
html += ' ';
}
html += '
';
}
} else {
errorMesage(res);
}
$("#healthCheckupContentHtml").html(html);
}
});
}
/**
* 加载诊断参数列表
* @param value
*/
function loadDiagnose(value) {
if (!$("#webuiPopover3").hasClass("in")) {
return;
}
$.ajax({
type: "GET",
url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value + '&pageSize=100',
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 += res.data[i].paramsName;
html += ' (' + res.data[i].paramsCode + ') ';
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);
}
}
/**
* 加载药品列表数列表
* @param value
*/
function loadYpList() {
if (!$("#westernMedicinePopoverContent").parent().parent().parent().hasClass("in")) {
return;
}
$('#tb_table_western_medicine').bootstrapTable('refresh');
$('#tb_table_western_medicine').bootstrapTable({
url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
method: 'GET', //请求方式(*)
toolbar: '#toolbar', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: true, //是否启用排序
sortOrder: "asc", //排序方式
queryParams: function (params) {
var temp = {
groupNo: 71,
commonParams: $("#western_medicine_namme").val()
};
return 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: 'specification',
title: '规格',
align: "center",
valign: 'middle',
// sortable: true
}, {
field: 'manufactory',
title: '生产厂家',
align: "center",
valign: 'middle',
// sortable: true
}, {
field: 'miniUnitName',
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.0元';
}
return value.toFixed(2) + "元";
}
}, {
field: 'drugWinDesc',
title: '剂量',
align: "center",
valign: 'middle',
// sortable: true
}, {
field: 'stockAmountVirtual',
title: '库存数量',
align: "center",
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": {} //数据
};
}
return {
"total": ress.data.length,//总页数
"rows": ress.data //数据
};
},
onClickRow: function (row, $element) {
$('#western_medicine_namme').webuiPopover('hide');
checkYpInfo(row.code, row.serial);
}
});
}
/**
* 按照药品的编码 和药品拆零规格查询药品信息
* @param code
* @param serial
*/
function checkYpInfo(code, serial) {
$.ajax({
type: "GET",
url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
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) {
//每个处方不能超过5个药品
$("div.rb_item_0").each(function () {
if ($(this).css("display") === "block") {
var stepId = $(this).attr("id");
var childrens = $(this).find("div:eq(1)").children().length;
if (childrens === 5) {
$("#messageModal").modal();
$("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
$("#messageButton").on("click", function (t) {
$("#messageModal").modal("hide");
refreshWizard("wizard0", "wizard_steps-0", stepId, "rb_item_0");
fitWesternMedicine(res);
});
} else {
fitWesternMedicine(res);
}
}
});
}
} else {
errorMesage(res);
}
}
});
}
/**
* 添加处方分页
* @param wizardId
* @param wizardStepId
* @param stepId
* @param rbItemClass
*/
function refreshWizard(wizardId, wizardStepId, stepId, rbItemClass) {
var index = parseInt(stepId.split("-")[1]);
index++;
var newStepId = "step-" + index;
var wizardStepHtml = '' + index + ' ';
wizardStepHtml += '处方' + numToChineseNum(index) + ' ';
var wizardHtml = '';
wizardHtml += '
';
wizardHtml += '
';
$("#" + wizardStepId).append(wizardStepHtml);
$("#" + wizardId).append(wizardHtml);
initSmartWizard(wizardId);
}
/**
* 填充西药选中的内容
*/
function fitWesternMedicine(res) {
$("#western_medicine_namme").val(res.data.name);
$("#western_medicine_namme").blur();
var drugWinHtml = '';
var index = null;
if (res.data.weight != null) {
$("#drugWin").val(res.data.weight);
$("#drugWinDb").val(res.data.weight);
drugWinHtml = '' + res.data.weighUnitDesc + ' ';
index = res.data.weighUnitDesc;
}
if (res.data.volum != null) {
if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
$("#drugWin").val(res.data.volum);
$("#drugWinDb").val(res.data.volum);
}
drugWinHtml += '' + res.data.volUnitDesc + ' ';
if (index == null) {
index = res.data.volUnitDesc;
}
}
$('#drugWinUnit').html(drugWinHtml);
$('#drugWinUnit').selectpicker('refresh');
$("#drugWinUnit").selectpicker('val', index);
$('#drugWinUnit').selectpicker('refresh');
if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
var html = '' + res.data.packUnitDesc + ' ';
$('#packUnit').html(html);
$('#packUnit').selectpicker('refresh');
$("#packUnit").selectpicker('val', res.data.packUnitDesc);
$('#packUnit').selectpicker('refresh');
}
if (res.data.supplyType != null) {
$("#supplyType").selectpicker('val', res.data.supplyType);
$('#supplyType').selectpicker('refresh');
}
if (res.data.frequency != null) {
$("#orderFrequency").selectpicker('val', res.data.frequency);
$('#orderFrequency').selectpicker('refresh');
}
$("#packRetprice").val(res.data.packRetprice);
$("#packSize").val(res.data.packSize);
$("#current_code").val(res.data.code);
$("#current_serial").val(res.data.serial);
}
/**
* 剂量单位改变事件
*/
function drugWinUnitChange() {
var desc = $('#drugWinUnit').find("option:selected").attr('desc');
$("#drugWin").val(desc);
$("#drugWinDb").val(desc);
calculate();
}
/**
* 根据选择的内容计算总的用药量
*/
function calculate() {
//最小规格剂量
var drugWinDb = $("#drugWinDb").val();
//天数
var dayNum = $("#dayNum").val();
//当前使用的最小剂量
var drugWin = $("#drugWin").val();
//频率
var times = $('#orderFrequency').find("option:selected").attr('desc');
//包装规格数量
var packSize = $("#packSize").val();
//单价
var packRetprice = $("#packRetprice").val();
if (drugWinDb == null || drugWinDb === "") {
return;
}
if (dayNum == null || dayNum === "") {
return;
}
if (drugWin == null || drugWin === "") {
return;
}
if (times == null || times === "") {
return;
}
if (packSize == null || packSize === "") {
return;
}
//拆零总量
var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
//整包装的数量
var totalNum = Division(scatteredTotalNum, Multiply(packSize, drugWinDb));
$("#gross").val(totalNum);
$("#totalRetprice").val(Multiply(totalNum, packRetprice));
}
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 += '' + comment.name + ' ';
});
$('#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 += '' + comment.employeeName + ' ';
});
$('#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'));
}