//@ sourceURL=jc_jy_zd_item.js
var chargeItemMap = null;
var chargeItemObj = null;
$(function () {
$("#btn_add").click(function (t) {
var sourceGroup = getIndex("source_group");
if (sourceGroup == 0) {
$("#editJcModal").modal();
$("#classJcTitle").text("新增");
clearJcInput();
} else {
$("#editJyModal").modal();
$("#classJyTitle").text("新增");
clearJyInput()
}
});
$("#btn_save").click(function (t) {
$("#messageModal").modal();
$("#editJcModal").modal("hide");
$("#messageContent").html("确认要保存当前检查项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
saveJcZdItem();
});
$("#cancelButton").off("click").on("click", function (t) {
$("#editJcModal").modal();
});
});
$("#btn_jy_save").click(function (t) {
$("#messageModal").modal();
$("#editJyModal").modal("hide");
$("#messageContent").html("确认要保存当前检验项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
saveJyZdItem();
});
$("#cancelButton").off("click").on("click", function (t) {
$("#editJyModal").modal();
});
});
$("#btn_saveJcCharge").click(function (t) {
$("#messageModal").modal();
$("#messageContent").html("确认要保存当前明细项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
saveJcCharge();
});
});
$("#btn_saveJyCharge").click(function (t) {
$("#messageModal").modal();
$("#messageContent").html("确认要保存当前明细项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
saveJyCharge();
});
});
initJcZdItemList();
$("#btn_query").click(function (t) {
var sourceGroup = getIndex("source_group");
if (sourceGroup == 0) {
initJcZdItemList()
} else {
initJyZdItemList();
}
});
initSelect();
initExecUnit();
initBwCode();
$('#btn_clean').click(function () {
$("#jcClassParams").selectpicker('val', null);//默认选中
$("#jcClassParams").selectpicker('refresh');
$("#bwParams").selectpicker('val', null);//默认选中
$("#bwParams").selectpicker('refresh');
$("#jyClassParams").selectpicker('val', null);//默认选中
$("#jyClassParams").selectpicker('refresh');
$("#sampleCodeParams").selectpicker('val', null);//默认选中
$("#sampleCodeParams").selectpicker('refresh');
$("#vesselParams").selectpicker('val', null);//默认选中
$("#vesselParams").selectpicker('refresh');
$("#execUnitParams").selectpicker('val', null);//默认选中
$("#execUnitParams").selectpicker('refresh');
$("#nameParam").val(null);
$("#delFlagParams").selectpicker('val', null);//默认选中
$("#delFlagParams").selectpicker('refresh');
});
});
/**
* 号表类型切换事件
* @param object
*/
function sourceChange(object) {
$("#source_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");
var sourceGroup = getIndex("source_group");
if (sourceGroup == 0) {
$("#jcParams").removeClass("hide").addClass("in");
$("#jyParams").removeClass("in").addClass("hide");
initJcZdItemList();
} else {
$("#jyParams").removeClass("hide").addClass("in");
$("#jcParams").removeClass("in").addClass("hide");
initJyZdItemList();
}
$('#tb_table_mx').bootstrapTable("destroy");
}
/**
* 获取按钮组选择的下标
* @param id
* @returns {number}
*/
function getIndex(id) {
var index = 0;
var item = $("#" + id).find("button");
for (var i = 0; i <= item.length; i++) {
if ($(item[i]).hasClass("btn-primary")) {
index = i;
break;
}
}
return index;
}
/**
* 保存檢查项目
*/
function saveJcZdItem() {
var code = $("#code").val();
var data = null;
let min = $("#minAgeRestriction").val();
let max = $("#maxAgeRestriction").val();
let s;
if(min){
s = callJcJyAgeFormat(min)
if(s === '-1'){
return false;
}
}
if(max){
s = callJcJyAgeFormat(max)
if(s === '-1'){
return false;
}
}
//修改檢查
if (code != null) {
data = JSON.stringify({
code: code,
name: $("#name").val(),
classCode: $("#classCode").val(),
execUnit: $("#execUnit").val(),
bwCode: $("#bwCode").val(),
delFlag: $("#delFlag").val(),
zyFlag: $("#zyFlag").val(),
mzFlag: $("#mzFlag").val(),
execAddress:$("#execAddress").val(),
genderRestriction:$("#genderRestriction").val(),
minAgeRestriction:$("#minAgeRestriction").val(),
maxAgeRestriction:$("#maxAgeRestriction").val(),
timeLimit:$("#timeLimit").val()
});
} else {
//新增檢查
data = JSON.stringify({
name: $("#name").val(),
classCode: $("#classCode").val(),
execUnit: $("#execUnit").val(),
bwCode: $("#bwCode").val(),
delFlag: $("#delFlag").val(),
zyFlag: $("#zyFlag").val(),
mzFlag: $("#mzFlag").val(),
execAddress:$("#execAddress").val(),
genderRestriction:$("#genderRestriction").val(),
minAgeRestriction:$("#minAgeRestriction").val(),
maxAgeRestriction:$("#maxAgeRestriction").val(),
timeLimit:$("#timeLimit").val()
});
}
$.ajax({
type: "POST",
url: '/thmz/saveJcZdItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: data,
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#editJcModal").modal("hide");
clearJcInput();
$('#tb_table').bootstrapTable('refresh');
successMesage(res);
} else {
$("#editJcModal").modal();
errorMesage(res);
}
}
});
}
/**
* 保存檢查项目明细
*/
function saveJcCharge() {
$.ajax({
type: "POST",
url: '/thmz/saveJcChargeItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: $("#jcItemCode").val(),
chargeCode: $("#chargeItem").val(),
amount: $("#amount").val(),
zyFlag: $("#zyFlagJcCharge").val(),
mzFlag: $("#mzFlagJcCharge").val()
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#editJcChargeItemModal").modal("hide");
getJcItemChargesByItemCode($("#jcItemCode").val());
clearJcChargeItemInput();
successMesage(res);
} else {
errorMesage(res);
}
}
});
}
/**
* 保存檢验项目明细
*/
function saveJyCharge() {
$.ajax({
type: "POST",
url: '/thmz/saveJyChargeItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: $("#jyItemCode").val(),
chargeCode: $("#chargeItemJy").val(),
amount: $("#amountJy").val(),
zyFlag: $("#zyFlagJyCharge").val(),
mzFlag: $("#mzFlagJyCharge").val()
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#editJyChargeItemModal").modal("hide");
getJyItemChargesByItemCode($("#jyItemCode").val());
clearJyChargeItemInput();
successMesage(res);
} else {
errorMesage(res);
}
}
});
}
/**
* 保存檢验项目
*/
function saveJyZdItem() {
var code = $("#codeJy").val();
var data = null;
let min = $("#minAgeRestrictionJy").val();
let max = $("#maxAgeRestrictionJy").val();
let s;
if(min){
s = callJcJyAgeFormat(min)
if(s === '-1'){
return false;
}
}
if(max){
s = callJcJyAgeFormat(max)
if(s === '-1'){
return false;
}
}
//修改檢验
if (code != null) {
data = JSON.stringify({
code: code,
name: $("#nameJy").val(),
classCode: $("#classCodeJy").val(),
execUnit: $("#execUnitJy").val(),
sampleCode: $("#sampleCode").val(),
vessel: $("#vessel").val(),
delFlag: $("#delFlagJy").val(),
zyFlag: $("#zyFlagJy").val(),
mzFlag: $("#mzFlagJy").val(),
execAddress:$("#jyExecAddress").val(),
genderRestriction:$("#genderRestrictionJy").val(),
minAgeRestriction:$("#minAgeRestrictionJy").val(),
maxAgeRestriction:$("#maxAgeRestrictionJy").val(),
timeLimit:$("#timeLimitJy").val()
});
} else {
//新增檢验
data = JSON.stringify({
name: $("#nameJy").val(),
classCode: $("#classCodeJy").val(),
execUnit: $("#execUnitJy").val(),
sampleCode: $("#sampleCode").val(),
vessel: $("#vessel").val(),
delFlag: $("#delFlagJy").val(),
zyFlag: $("#zyFlagJy").val(),
mzFlag: $("#mzFlagJy").val(),
execAddress:$("#jyExecAddress").val(),
genderRestriction:$("#genderRestrictionJy").val(),
minAgeRestriction:$("#minAgeRestrictionJy").val(),
maxAgeRestriction:$("#maxAgeRestrictionJy").val(),
timeLimit:$("#timeLimitJy").val(),
});
}
$.ajax({
type: "POST",
url: '/thmz/saveJyZdItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: data,
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#editJyModal").modal("hide");
clearJyInput();
$('#tb_table').bootstrapTable('refresh');
successMesage(res);
} else {
$("#editJyModal").modal();
errorMesage(res);
}
}
});
}
/**
* 清空输入框
*/
function clearJcInput() {
$("#code").val(null);
$("#name").val(null);
$("#classCode").selectpicker('val', null);//默认不选中
$("#classCode").selectpicker('refresh');
$("#execUnit").selectpicker('val', null);//默认不选中
$("#execUnit").selectpicker('refresh');
$("#bwCode").selectpicker('val', null);//默认不选中
$("#bwCode").selectpicker('refresh');
$("#delFlag").selectpicker('val', 0);//默认不选中
$("#delFlag").selectpicker('refresh');
$("#zyFlag").selectpicker('val', 0);//默认不选中
$("#zyFlag").selectpicker('refresh');
$("#mzFlag").selectpicker('val', 0);//默认不选中
$("#mzFlag").selectpicker('refresh');
$("#execAddress").val(null);
$("#genderRestriction").selectpicker('val', '');//默认不选中
$("#genderRestriction").selectpicker('refresh');
$("#minAgeRestriction").val(null);
$("#maxAgeRestriction").val(null);
$("#timeLimit").val(null);
}
/**
* 清空输入框
*/
function clearJcChargeItemInput() {
$("#jcItemCode").val(null);
$("#amount").val(null);
$("#chargeAmount").val(null);
$("#chargeItem").selectpicker('val', null);//默认不选中
$("#chargeItem").selectpicker('refresh');
$("#zyFlagJcCharge").selectpicker('val', 0);//默认不选中
$("#zyFlagJcCharge").selectpicker('refresh');
$("#mzFlagJcCharge").selectpicker('val', 0);//默认不选中
$("#mzFlagJcCharge").selectpicker('refresh');
}
/**
* 清空输入框
*/
function clearJyChargeItemInput() {
$("#jyItemCode").val(null);
$("#amountJy").val(null);
$("#chargeAmountJy").val(null);
$("#chargeItemJy").selectpicker('val', null);//默认不选中
$("#chargeItemJy").selectpicker('refresh');
$("#zyFlagJyCharge").selectpicker('val', 0);//默认不选中
$("#zyFlagJyCharge").selectpicker('refresh');
$("#mzFlagJyCharge").selectpicker('val', 0);//默认不选中
$("#mzFlagJyCharge").selectpicker('refresh');
}
/**
* 清空输入框
*/
function clearJyInput() {
$("#codeJy").val(null);
$("#nameJy").val(null);
$("#classCodeJy").selectpicker('val', null);//默认不选中
$("#classCodeJy").selectpicker('refresh');
$("#execUnitJy").selectpicker('val', null);//默认不选中
$("#execUnitJy").selectpicker('refresh');
$("#sampleCode").selectpicker('val', null);//默认不选中
$("#sampleCode").selectpicker('refresh');
$("#vessel").selectpicker('val', null);//默认不选中
$("#vessel").selectpicker('refresh');
$("#delFlagJy").selectpicker('val', 0);//默认不选中
$("#delFlagJy").selectpicker('refresh');
$("#zyFlagJy").selectpicker('val', 0);//默认不选中
$("#zyFlagJy").selectpicker('refresh');
$("#mzFlagJy").selectpicker('val', 0);//默认不选中
$("#mzFlagJy").selectpicker('refresh');
$("#jyExecAddress").val(null);
$("#genderRestrictionJy").selectpicker('val', '');//默认不选中
$("#genderRestrictionJy").selectpicker('refresh');
$("#minAgeRestrictionJy").val(null);
$("#maxAgeRestrictionJy").val(null);
$("#timeLimitJy").val(null);
}
/**
* 查询检查项目列表
*/
function initJcZdItemList() {
$('#tb_table').bootstrapTable("destroy");
$('#tb_table').bootstrapTable({
url: '/thmz/listJcZdItem', //请求后台的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: [
{
title: '操作',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
var str;
if (row.delFlag == 1) {
str = '';
} else {
str = '';
}
str += '';
str += '';
return [str].join('');
}
},
{
field: 'name',
title: '项目名称',
align: "center",
valign: 'middle'
}, {
field: 'classCode',
title: '分类',
align: "center",
valign: 'middle',
}, {
field: 'execUnit',
title: '执行科室',
align: "center",
valign: 'middle',
}, {
field: 'bwCode',
title: '部位',
align: "center",
valign: 'middle'
}
],
onClickRow: function (row) {
getJcItemChargesByItemCode(row.code);
},
responseHandler: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
var ress = eval(res);
if (ress.code == -1) {
if (ress.message != null && ress.message != '') {
errorMesage(res);
}
return {
"total": 0,//总页数
"rows": {} //数据
};
}
return {
"total": ress.total,//总页数
"rows": ress.data //数据
};
},
});
}
/**
* 根据检查项目查询对应的明细列表
* @param code
*/
function getJcItemChargesByItemCode(code) {
$('#tb_table_mx').bootstrapTable("destroy");
$('#tb_table_mx').bootstrapTable({
url: '/thmz/getJcItemChargesByItemCode?code=' + code, //请求后台的URL(*)
method: 'get', //请求方式(*)
toolbar: '#toolbar', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, //是否显示分页(*)
sortable: true, //是否启用排序
sortOrder: "asc", //排序方式
sidePagination: "client", //分页方式: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: [
{
title: '操作',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
var str = '';
str += '';
return [str].join('');
}
},
{
field: 'code',
title: '项目编码',
align: "center",
valign: 'middle'
},
{
field: 'charge_code',
title: '收费编码',
align: "center",
valign: 'middle'
},
{
field: 'name',
title: '收费项目名称',
align: "center",
valign: 'middle'
},
{
field: 'amount',
title: '数量',
align: "center",
valign: 'middle'
},
{
field: 'charge_amount',
title: '单价',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (value != null) {
return Math.abs(value).toFixed(2);
}
}
},
{
field: 'hnsyb_code',
title: '省医保编码',
align: "center",
valign: 'middle'
},
{
field: 'national_code',
title: '国家医保编码',
align: "center",
valign: 'middle'
},
{
field: 'national_name',
title: '国家医保名称',
align: "center",
valign: 'middle'
},
{
field: 'zy_flag',
title: '住院停用',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
if (value == 1 || value == "1") {
return "是";
}
return "否";
}
},
{
field: 'mz_flag',
title: '门诊停用',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
if (value == 1 || value == "1") {
return "是";
}
return "否";
}
}
],
responseHandler: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
var ress = eval(res);
if (ress.code == -1) {
if (ress.message != null && ress.message != '') {
errorMesage(res);
}
return {
"total": 0,//总页数
"rows": {} //数据
};
}
return {
"total": ress.data.length,//总页数
"rows": ress.data //数据
};
},
});
}
/**
* 查询检验列表
*/
function initJyZdItemList() {
$('#tb_table').bootstrapTable("destroy");
$('#tb_table').bootstrapTable({
url: '/thmz/listJyZdItem', //请求后台的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: [
{
title: '操作',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
var str;
if (row.delFlag == 1) {
str = '';
} else {
str = '';
}
str += '';
str += '';
return [str].join('');
}
},
{
field: 'name',
title: '项目名称',
align: "center",
valign: 'middle'
},
{
field: 'classCode',
title: '分类',
align: "center",
valign: 'middle'
},
{
field: 'sampleCode',
title: '标本',
align: "center",
valign: 'middle'
},
{
field: 'vessel',
title: '容器类型',
align: "center",
valign: 'middle'
}, {
field: 'execUnit',
title: '执行科室',
align: "center",
valign: 'middle',
}
],
onClickRow: function (row) {
getJyItemChargesByItemCode(row.code);
},
responseHandler: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
var ress = eval(res);
if (ress.code == -1) {
if (ress.message != null && ress.message != '') {
errorMesage(res);
}
return {
"total": 0,//总页数
"rows": {} //数据
};
}
return {
"total": ress.total,//总页数
"rows": ress.data //数据
};
},
});
}
/**
* 构建列表查询参数
* @param params
* @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
*/
function queryParams(params) {
var sourceGroup = getIndex("source_group");
if (sourceGroup == 0) {
var temp = {
code: $('#nameParam').val(),
execUnit: $('#execUnitParams').val(),
classCode: $('#jcClassParams').val(),
bwCode: $('#bwParams').val(),
delFlag: $('#delFlagParams').val(),
pageSize: params.limit, //页面大小
pageIndex: params.offset / params.limit, //页码
};
} else {
var temp = {
code: $('#nameParam').val(),
execUnit: $('#execUnitParams').val(),
classCode: $('#jyClassParams').val(),
sampleCode: $('#sampleCodeParams').val(),
vessel: $('#vesselParams').val(),
delFlag: $('#delFlagParams').val(),
pageSize: params.limit, //页面大小
pageIndex: params.offset / params.limit, //页码
};
}
return temp;
};
/**
* 根据检验项目查询对应的明细列表
* @param code
*/
function getJyItemChargesByItemCode(code) {
$('#tb_table_mx').bootstrapTable("destroy");
$('#tb_table_mx').bootstrapTable({
url: '/thmz/getJyItemChargesByItemCode?code=' + code, //请求后台的URL(*)
method: 'get', //请求方式(*)
toolbar: '#toolbar', //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, //是否显示分页(*)
sortable: true, //是否启用排序
sortOrder: "asc", //排序方式
sidePagination: "client", //分页方式: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: [
{
title: '操作',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
var str = '';
str += '';
return [str].join('');
}
},
{
field: 'code',
title: '项目编码',
align: "center",
valign: 'middle'
},
{
field: 'charge_code',
title: '收费编码',
align: "center",
valign: 'middle'
},
{
field: 'name',
title: '收费项目名称',
align: "center",
valign: 'middle'
},
{
field: 'amount',
title: '数量',
align: "center",
valign: 'middle'
},
{
field: 'charge_amount',
title: '单价',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (value != null) {
return Math.abs(value).toFixed(2);
}
}
},
{
field: 'hnsyb_code',
title: '省医保编码',
align: "center",
valign: 'middle'
},
{
field: 'national_code',
title: '国家医保编码',
align: "center",
valign: 'middle'
},
{
field: 'national_name',
title: '国家医保名称',
align: "center",
valign: 'middle'
},
{
field: 'zy_flag',
title: '住院停用',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
if (value == 1 || value == "1") {
return "是";
}
return "否";
}
},
{
field: 'mz_flag',
title: '门诊停用',
align: "center",
valign: 'middle',
formatter: function (value, row, index) {
if (row.code == null || row.code == "") {
return "";
}
if (value == 1 || value == "1") {
return "是";
}
return "否";
}
}
],
responseHandler: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
var ress = eval(res);
if (ress.code == -1) {
if (ress.message != null && ress.message != '') {
errorMesage(res);
}
return {
"total": 0,//总页数
"rows": {} //数据
};
}
return {
"total": ress.data.length,//总页数
"rows": ress.data //数据
};
},
});
}
/**
* 删除记录 (停用)
* @param code
*/
function updateDeleteJcZdItem(code, name, delFlag) {
var message = null;
if (delFlag == 1) {
message = "您确认要启用【" + name + "】项目吗?";
delFlag = 0;
} else {
message = "您确认要停用【" + name + "】项目吗?";
delFlag = 1;
}
$("#messageModal").modal();
$("#messageContent").html(message);
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
$.ajax({
type: "POST",
url: '/thmz/saveJcZdItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
delFlag: delFlag,
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$('#tb_table').bootstrapTable('refresh');
successMesage(res);
} else {
errorMesage(res);
}
}
});
});
}
/**
* 删除记录 (停用) 检验
* @param code
*/
function updateDeleteJyZdItem(code, name, delFlag) {
var message = null;
if (delFlag == 1) {
message = "您确认要启用【" + name + "】项目吗?";
delFlag = 0;
} else {
message = "您确认要停用【" + name + "】项目吗?";
delFlag = 1;
}
$("#messageModal").modal();
$("#messageContent").html(message);
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
$.ajax({
type: "POST",
url: '/thmz/saveJyZdItem',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
delFlag: delFlag,
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$('#tb_table').bootstrapTable('refresh');
successMesage(res);
} else {
errorMesage(res);
}
}
});
});
}
/**
* 打开编辑检查窗口
* @param code
*/
function editJcZdItem(code) {
$("#classJcTitle").text("修改");
$.ajax({
type: "GET",
url: '/thmz/getJcZdItemByCode?code=' + code,
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) {
$("#code").val(res.data.code);
$("#name").val(res.data.name);
$("#classCode").selectpicker('val', res.data.classCode);//默认不选中
$("#classCode").selectpicker('refresh');
$("#execUnit").selectpicker('val', res.data.execUnit);//默认不选中
$("#execUnit").selectpicker('refresh');
$("#bwCode").selectpicker('val', res.data.bwCode);//默认不选中
$("#bwCode").selectpicker('refresh');
$("#delFlag").selectpicker('val', res.data.delFlag);//默认不选中
$("#delFlag").selectpicker('refresh');
$("#zyFlag").selectpicker('val', res.data.zyFlag);//默认不选中
$("#zyFlag").selectpicker('refresh');
$("#mzFlag").selectpicker('val', res.data.mzFlag);//默认不选中
$("#mzFlag").selectpicker('refresh');
$("#execAddress").val(res.data.execAddress);
$("#genderRestriction").selectpicker('val', res.data.genderRestriction);//默认不选中
$("#genderRestriction").selectpicker('refresh');
$("#minAgeRestriction").val(res.data.minAgeRestriction);
$("#maxAgeRestriction").val(res.data.maxAgeRestriction);
$("#timeLimit").val(res.data.timeLimit);
$("#editJcModal").modal();
} else {
errorMesage(res);
}
}
});
}
/**
* 打开编辑检验窗口
* @param code
*/
function editJyZdItem(code) {
$("#classJyTitle").text("修改");
$.ajax({
type: "GET",
url: '/thmz/getJyZdItemByCode?code=' + code,
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) {
$("#codeJy").val(res.data.code);
$("#nameJy").val(res.data.name);
$("#classCodeJy").selectpicker('val', res.data.classCode);//默认不选中
$("#classCodeJy").selectpicker('refresh');
$("#execUnitJy").selectpicker('val', res.data.execUnit);//默认不选中
$("#execUnitJy").selectpicker('refresh');
$("#sampleCode").selectpicker('val', res.data.sampleCode);//默认不选中
$("#sampleCode").selectpicker('refresh');
$("#vessel").selectpicker('val', res.data.vessel);//默认不选中
$("#vessel").selectpicker('refresh');
$("#delFlagJy").selectpicker('val', res.data.delFlag);//默认不选中
$("#delFlagJy").selectpicker('refresh');
$("#zyFlagJy").selectpicker('val', res.data.zyFlag);//默认不选中
$("#zyFlagJy").selectpicker('refresh');
$("#mzFlagJy").selectpicker('val', res.data.mzFlag);//默认不选中
$("#mzFlagJy").selectpicker('refresh');
$("#jyExecAddress").val(res.data.execAddress);
$("#genderRestrictionJy").selectpicker('val', res.data.genderRestriction);//默认不选中
$("#genderRestrictionJy").selectpicker('refresh');
$("#minAgeRestrictionJy").val(res.data.minAgeRestriction);
$("#maxAgeRestrictionJy").val(res.data.maxAgeRestriction);
$("#timeLimitJy").val(res.data.timeLimit);
$("#editJyModal").modal();
} else {
errorMesage(res);
}
}
});
}
/**
* 打开编辑检查收费明细弹窗
* @param code
* @param chargeCode
*/
function editJcChargeItem(code, chargeCode) {
$.ajax({
type: "POST",
url: '/thmz/getJcItemCharge',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
chargeCode: chargeCode
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#chargeJcTitle").text("编辑");
$("#jcItemCode").val(res.data.code);
$("#amount").val(res.data.amount);
$("#chargeItem").selectpicker('val', res.data.chargeCode);//默认不选中
$("#chargeItem").selectpicker('refresh');
$("#zyFlagJcCharge").selectpicker('val', res.data.zyFlag);//默认不选中
$("#zyFlagJcCharge").selectpicker('refresh');
$("#mzFlagJcCharge").selectpicker('val', res.data.mzFlag);//默认不选中
$("#mzFlagJcCharge").selectpicker('refresh');
setChargeAmount();
$("#editJcChargeItemModal").modal();
} else {
errorMesage(res);
}
}
});
}
/**
* 删除检查收费明细
* @param code
* @param chargeCode
*/
function deleteJcChargeItem(code, chargeCode) {
$("#messageModal").modal();
$("#messageContent").html("确认删除当前检查项目的该条明细项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
$.ajax({
type: "POST",
url: '/thmz/removeJcItemCharge',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
chargeCode: chargeCode
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$('#tb_table_mx').bootstrapTable('refresh');
successMesage(res);
} else {
errorMesage(res);
}
}
});
});
}
/**
* 打开编辑检验收费明细弹窗
* @param code
* @param chargeCode
*/
function editJyChargeItem(code, chargeCode) {
$.ajax({
type: "POST",
url: '/thmz/getJyItemCharge',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
chargeCode: chargeCode
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$("#chargeJyTitle").text("编辑");
$("#jyItemCode").val(res.data.code);
$("#amountJy").val(res.data.amount);
$("#chargeItemJy").selectpicker('val', res.data.chargeCode);//默认不选中
$("#chargeItemJy").selectpicker('refresh');
$("#zyFlagJyCharge").selectpicker('val', res.data.zyFlag);//默认不选中
$("#zyFlagJyCharge").selectpicker('refresh');
$("#mzFlagJyCharge").selectpicker('val', res.data.mzFlag);//默认不选中
$("#mzFlagJyCharge").selectpicker('refresh');
setChargeAmountJy();
$("#editJyChargeItemModal").modal();
} else {
errorMesage(res);
}
}
});
}
/**
* 删除检验收费明细
* @param code
* @param chargeCode
*/
function deleteJyChargeItem(code, chargeCode) {
$("#messageModal").modal();
$("#messageContent").html("确认删除当前检查项目的该条明细项目吗?");
$("#messageButton").off("click").on("click", function (t) {
$("#messageModal").modal("hide");
$.ajax({
type: "POST",
url: '/thmz/removeJyItemCharge',
contentType: "application/json;charset=UTF-8",
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
data: JSON.stringify({
code: code,
chargeCode: chargeCode
}),
success: function (res) {
if (res == '401' || res == 401) {
window.location.href = '/thmz/login/view'
return;
}
if (res.code == 0) {
$('#tb_table_mx').bootstrapTable('refresh');
successMesage(res);
} else {
errorMesage(res);
}
}
});
});
}
/**
* 初始化科室下拉选
*/
function initExecUnit() {
//父科室列表
$.ajax({
type: "GET",
url: '/thmz/allUnitCode',
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
success: function (data) {
if (data == '401' || data == 401) {
window.location.href = '/thmz/login/view'
return;
}
$('#execUnit').empty(); //清空resText里面的所有内容
var html = '';
$.each(data.data, function (commentIndex, comment) {
html += '';
});
$('#execUnit').html(html);
$('#execUnit').selectpicker('refresh');
$('#execUnitJy').empty();
$('#execUnitJy').html(html);
$('#execUnitJy').selectpicker('refresh');
$('#execUnitParams').empty();
$('#execUnitParams').html(html);
$('#execUnitParams').selectpicker('refresh');
}
});
}
/**
* 初始化部位下拉选
*/
function initBwCode() {
$.ajax({
type: "GET",
url: '/thmz/getYshZdPartCode',
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 += '';
});
$('#bwCode').empty(); //清空resText里面的所有内容
$('#bwCode').html(html);
$('#bwCode').selectpicker('refresh');
$('#bwParams').empty(); //清空resText里面的所有内容
$('#bwParams').html(html);
$('#bwParams').selectpicker('refresh');
}
});
}
/**
* 初始化下拉选
*/
function initSelect() {
//启动Bootsrap-Select
$(".selectpicker").selectpicker({
dropuAuto: false
});
var yesNo = '';
var optionSex = '';
$('#genderRestriction').html(optionSex);
$('#genderRestriction').selectpicker('refresh');
$("#genderRestriction").selectpicker('val', '');
$("#genderRestriction").selectpicker('refresh');
$('#delFlag').html(yesNo);
$('#delFlag').selectpicker('refresh');
$("#delFlag").selectpicker('val', 0);
$("#delFlag").selectpicker('refresh');
$('#zyFlag').html(yesNo);
$('#zyFlag').selectpicker('refresh');
$("#zyFlag").selectpicker('val', 0);
$("#delFlag").selectpicker('refresh');
$('#mzFlag').html(yesNo);
$('#mzFlag').selectpicker('refresh');
$("#mzFlag").selectpicker('val', 0);
$("#mzFlag").selectpicker('refresh');
$('#zyFlagJcCharge').html(yesNo);
$('#zyFlagJcCharge').selectpicker('refresh');
$("#zyFlagJcCharge").selectpicker('val', 0);
$("#zyFlagJcCharge").selectpicker('refresh');
$('#mzFlagJcCharge').html(yesNo);
$('#mzFlagJcCharge').selectpicker('refresh');
$("#mzFlagJcCharge").selectpicker('val', 0);
$("#mzFlagJcCharge").selectpicker('refresh');
$('#genderRestrictionJy').html(optionSex);
$('#genderRestrictionJy').selectpicker('refresh');
$("#genderRestrictionJy").selectpicker('val', '');
$("#genderRestrictionJy").selectpicker('refresh');
$('#delFlagJy').html(yesNo);
$('#delFlagJy').selectpicker('refresh');
$("#delFlagJy").selectpicker('val', 0);
$("#delFlagJy").selectpicker('refresh');
$('#zyFlagJy').html(yesNo);
$('#zyFlagJy').selectpicker('refresh');
$("#zyFlagJy").selectpicker('val', 0);
$("#zyFlagJy").selectpicker('refresh');
$('#mzFlagJy').html(yesNo);
$('#mzFlagJy').selectpicker('refresh');
$("#mzFlagJy").selectpicker('val', 0);
$("#mzFlagJy").selectpicker('refresh');
$('#zyFlagJyCharge').html(yesNo);
$('#zyFlagJyCharge').selectpicker('refresh');
$("#zyFlagJyCharge").selectpicker('val', 0);
$("#zyFlagJyCharge").selectpicker('refresh');
$('#mzFlagJyCharge').html(yesNo);
$('#mzFlagJyCharge').selectpicker('refresh');
$("#mzFlagJyCharge").selectpicker('val', 0);
$("#mzFlagJyCharge").selectpicker('refresh');
$('#delFlagParams').html(yesNo);
$('#delFlagParams').selectpicker('refresh');
$.ajax({
type: "GET",
url: '/thmz/getAllJcZdClass',
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) {
var pyCode=comment.pyCode;
if(pyCode==null || pyCode=="null"){
pyCode="";
}
if(comment.code!=null && comment.code!="null"){
pyCode=pyCode+"-"+comment.code;
}
html += '';
});
$('#classCode').empty(); //清空resText里面的所有内容
$('#classCode').html(html);
$('#classCode').selectpicker('refresh');
$('#jcClassParams').empty(); //清空resText里面的所有内容
$('#jcClassParams').html(html);
$('#jcClassParams').selectpicker('refresh');
}
});
$.ajax({
type: "post",
url: '/thmz/listJyZdClass',
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({}),
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 += '';
});
$('#classCodeJy').empty(); //清空resText里面的所有内容
$('#classCodeJy').html(html);
$('#classCodeJy').selectpicker('refresh');
$('#jyClassParams').empty(); //清空resText里面的所有内容
$('#jyClassParams').html(html);
$('#jyClassParams').selectpicker('refresh');
}
});
/**
* 初始化验物下拉选
*/
$.ajax({
type: "GET",
url: '/thmz/getJyZdSample',
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 += '';
});
$('#sampleCode').empty();
$('#sampleCode').html(html);
$('#sampleCode').selectpicker('refresh');
$('#sampleCodeParams').empty();
$('#sampleCodeParams').html(html);
$('#sampleCodeParams').selectpicker('refresh');
}
});
/**
* 查询所有容器
*/
$.ajax({
type: "GET",
url: '/thmz/getAllJyZdTube',
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 += '';
});
$('#vessel').empty();
$('#vessel').html(html);
$('#vessel').selectpicker('refresh');
$('#vesselParams').empty();
$('#vesselParams').html(html);
$('#vesselParams').selectpicker('refresh');
}
});
initZdChargeSelect();
}
/**
* 使用中的收费项目列表
*/
function initZdChargeSelect() {
//科室列表
$.ajax({
type: "GET",
url: '/thmz/getAllZdCharge',
dataType: "json",
headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
// async: false,
success: function (data) {
if (data == '401' || data == 401) {
window.location.href = '/thmz/login/view'
return;
}
var html = '';
// if (chargeItemObj == null) {
// chargeItemObj = []
// }
$.each(data.data, function (commentIndex, comment) {
html += '';
if (chargeItemMap == null) {
chargeItemMap = new MyMap()
}
if (chargeItemObj == null) {
chargeItemObj = new MyMap()
}
chargeItemMap.put(comment.code, comment.chargeAmount);
let obj = {
code: comment.code,
hnsybCode: comment.hnsybCode,
nationalCode: comment.nationalCode,
nationalName: comment.nationalName
}
chargeItemObj.put(comment.code,obj)
});
$('#chargeItem').empty();
$('#chargeItem').html(html);
$('#chargeItem').selectpicker('refresh');
$('#chargeItemJy').empty();
$('#chargeItemJy').html(html);
$('#chargeItemJy').selectpicker('refresh');
}
});
}
/**
* 设置单价
*/
function setChargeAmount() {
var chargeAmount = chargeItemMap.get($('#chargeItem').val());
var chargeObj = chargeItemObj.get($('#chargeItem').val());
if (chargeAmount != null) {
$("#chargeAmount").val(chargeAmount.toFixed(2));
}
if (chargeObj != null) {
$("#hnsybCode").val(chargeObj.hnsybCode);
$("#nationalCode").val(chargeObj.nationalCode);
$("#nationalName").val(chargeObj.nationalName);
}
}
/**
* 设置单价
*/
function setChargeAmountJy() {
var chargeAmount = chargeItemMap.get($('#chargeItemJy').val());
var chargeObj = chargeItemObj.get($('#chargeItemJy').val());
if (chargeAmount != null) {
$("#chargeAmountJy").val(chargeAmount.toFixed(2));
}
if (chargeObj != null) {
$("#hnsybCodeJy").val(chargeObj.hnsybCode);
$("#nationalCodeJy").val(chargeObj.nationalCode);
$("#nationalNameJy").val(chargeObj.nationalName);
}
}
/**
* 增加检查项目的细目
* @param code
*/
function addChargeZdItem(code) {
$("#editJcChargeItemModal").modal();
$("#jcItemCode").val(code);
$("#chargeJcTitle").text("新增");
}
/**
* 增加检验项目的细目
* @param code
*/
function addChargeJyZdItem(code) {
$("#editJyChargeItemModal").modal();
$("#jyItemCode").val(code);
$("#chargeJyTitle").text("新增");
}
function callJcJyAgeFormat(number){
if (/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(number) === false) {
let r = {
message: '年龄填写不合法,请检查!'
}
errorMesage(r);
return "-1";
} else {
return "0";
}
}