`
$(`.${contentWrapClassName} .infos .infos-box`).append(str);
for (var j = 0; j < item.subList.length; j++) {
var items = item.subList[j];
for (var k = 0; k < items.detailList.length; k++) {
var it = items.detailList[k];
it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
str = '
';
if (it.selectType == 21) {
str += '
' + it.content + '
'
} else if (it.selectType == 22) {
str += '
' + it.content + '
'
}
str += '
'
str += '
'
$(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
for (var l = 0; l < it.subList[0].detailList.length; l++) {
var its = it.subList[0].detailList[l];
its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
str = '
`
$(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "] .contentList .item-content[data-id=" + its.parentId + "]").append(str);
}
}
}
}
if (item.textType == 12) {
item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
str = '
'
str += item.content
str += '
'
str = `
${str}
`
$(`.${contentWrapClassName} .infos .infos-box`).append(str);
for (var j = 0; j < item.subList.length; j++) {
var items = item.subList[j];
for (var k = 0; k < items.detailList.length; k++) {
var it = items.detailList[k];
it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
str = '
';
str += '
' + it.content + '
'
str += '
'
str += '
'
$(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
}
}
}
if (item.textType == 13) {
for (var m = 0; m < item.subList[0].detailList[0].subList[0].detailList.length; m++) {
var itl = item.subList[0].detailList[0].subList[0].detailList[m]
let arr = {
content: JSON.parse(itl.content),
result: itl.result,
pushInfo: itl.pushInfo
}
pushInfo.push(arr)
}
}
}
str = '
'
str += `
结果:`
str += ``
$(`.${contentWrapClassName} .infos .infos-box`).append(str);
// str = ``
// $(`.${contentWrapClassName} .infos`).after(str);
function addScrollEvent() {
var scrollTop = $(`.${contentWrapClassName} .infos .infos-box`).scrollTop()
var divHeight = 0;
for (var i = 0; i < list.length; i++) {
divHeight = divHeight + parseInt($('#' + contentWrapClassName + i).css('height')) + parseInt($('#' + contentWrapClassName + i).parent().next().css('height')) + 20
if (divHeight > scrollTop) {
var anchor = 2 * i;
$(`.${contentWrapClassName} .anchors ul`).children().eq(anchor).addClass('active').siblings().removeClass('active');
return;
}
}
}
$(`.${contentWrapClassName} .infos .infos-box`).scroll(throttle(addScrollEvent, 200));
var mb = myBrowser();
if ("IE" == mb) {
$('.result_left').css({
'position': 'relative', //高度自动
})
$('.result_title').css({
'margin-left': '0', //高度自动
})
}
addLinkClickEvent(contentWrapClassName);
adjustHeight();
adjustWidth()
getcheck()
getResult(pushInfo, textType)
copy(name)
getprinting()
}
function getprinting() {
$('.printing').click(function () {
$('.foot').hide()
// $('.hel').hide()
$('#Print').css({
'height': 'auto', //高度自动
}).jqprint();
$('.foot').show()
// $('.hel').show()
$('#Print').css({
'height': '100%', //高度自动
});
})
}
function getcheck() {
$('input:radio').click(function () {
const domName = $(this).attr('name');
const $radio = $(this);
const id = $(this).parents('.contentList').data("id");
if ($radio.data('waschecked') == true) {
$radio.prop('checked', false);
$("input:radio[name='" + domName + "']").data('waschecked', false);
$radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
if (isclick) {
getchecks()
$(".score").html('');
$(".result_title").html('');
$(".result").css('display', 'none')
$(".foot").css('display', 'none')
}
} else {
$radio.prop('checked', true);
$("input:radio[name='" + domName + "']").data('waschecked', false);
$radio.data('waschecked', true);
$radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
if (isclick) {
getchecks()
$(".score").html('');
$(".result_title").html('');
$(".result").css('display', 'none')
$(".foot").css('display', 'none')
}
}
});
$('input:checkbox').click(function () {
const domName = $(this).attr('name');
const $radio = $(this);
const id = $(this).parents('.contentList').data("id");
$radio.parents('.contentList').each(function (i) {
if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
$radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
if (isclick) {
getchecks()
$(".score").html('');
$(".result_title").html('');
$(".result").css('display', 'none')
$(".foot").css('display', 'none')
}
} else {
$radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
if (isclick) {
getchecks()
$(".score").html('');
$(".result_title").html('');
$(".result").css('display', 'none')
$(".foot").css('display', 'none')
}
}
})
});
}
function copy(name) {
$(".copy").click(function () {
var texts = document.getElementById("result_title").innerText;
if (texts == '') {
Toast('结果为空,无法复制', 500, 'warn')
return
}
var inputs = document.getElementById("inputs");
inputs.value = name + '结果为:' + texts; // 修改文本框的内容(赋值内容)
console.log(inputs.value)
inputs.select(); // 选中文本
document.execCommand("copy"); // 执行浏览器复制命令
Toast('复制成功', 500, 'success')
})
}
function getchecks() {
$(".contentList").each(function (i) {
if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
$(this).find(".item-title").addClass('chColor');
} else {
$(this).find(".item-title").removeClass('chColor');
}
if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
$(this).find(".item-titles").addClass('chColor');
} else {
$(this).find(".item-titles").removeClass('chColor');
}
});
}
function getResult(pushInfo, textType) {
$(".but").click(function () {
let arr = [];
let multarr = []
let multname
let num = 0
let result
let key = false
let proposal = ''
let proposals = []
isclick = true
$(".contentList").each(function (i) {
if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
$(this).find(".item-title").addClass('chColor');
} else {
$(this).find(".item-title").removeClass('chColor');
}
if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
$(this).find(".item-titles").addClass('chColor');
} else {
$(this).find(".item-titles").removeClass('chColor');
}
});
if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
$('input[type="radio"]:checked').each(function () {
if (!isNaN($(this).val())) {
num += parseFloat($(this).val())
} else {
arr.push($(this).attr("data_obj"))
proposals.push($(this).attr("proposal"))
}
});
$('input[type="checkbox"]:checkbox:checked').each(function () {
if (!isNaN($(this).val())) {
num += parseFloat($(this).val())
} else {
arr.push($(this).attr("data_obj"))
proposals.push($(this).attr("proposal"))
}
});
tmp = arr.join(";");
if (pushInfo.length > 0) {
for (var i = 0; i < pushInfo.length; i++) {
if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && !tmp) {
result = pushInfo[i].result + '(' + num + '分' + ')'
proposal = pushInfo[i].pushInfo
break
} else if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min && tmp) {
result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
proposal = pushInfo[i].pushInfo
break
} else {
result = tmp
}
}
} else {
result = tmp
proposal = proposals.join(";");
}
if (result == undefined) {
if ($.inArray(13, textType) > 0) {
$(".score").html('总分:' + num + '分');
}
$(".score").css('display', 'block')
$(".copy").css('display', 'none')
$(".foot").css('display', 'block')
} else {
$(".hel").attr({
"title": proposal
});
$(".result_title").html(result);
if ($.inArray(13, textType) > 0) {
$(".score").html('总分:' + num + '分');
}
$(".result").css('display', 'block')
$(".score").css('display', 'block')
$(".copy").css('display', 'block')
$(".foot").css('display', 'block')
}
} else {
Toast('温馨提示:必填选项不能为空~', 500, 'warn')
}
})
$(".printing").hover(
function () {
$(".slideImg").attr("src", "./../images/printing2.png");
}, function () {
$(".slideImg").attr("src", "./../images/printing.png");
});
}
function addLinkClickEvent(contentWrapClassName) {
$(`.${contentWrapClassName} .anchors li:first`).addClass("active");
$(`.${contentWrapClassName} .anchors li>a`).on("click", function () {
const that = this
setTimeout(function () {
$(`.${contentWrapClassName} .anchors .active`).removeClass('active');
$(that).parent().addClass("active");
}, 20)
});
}
function renderTab(detailList, scale) {
if (detailList['静态知识']) {
$(".tabList").append(`
静态知识`)
}
if (detailList['临床路径']) {
$(".tabList").append(`
临床路径`)
//$(".tabBox .title").html(clinicalPathwayName);
}
if (detailList['注意事项']) {
$(".tabList").append(`
注意事项`)
//$(".tabBox .title").html(noticeName);
}
if (scale || getUrlArgObject('gauge') == 'gauge' || getUrlArgObject('type') == 8) {
$(".tabList").append(`
评估内容`)
//$(".tabBox .title").html(noticeName);
}
let defaultModuleName
if ((getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale && detailList['静态知识']) || getUrlArgObject('scale') == 'scale') {
$(".tabList .tab").eq(1).addClass("activeTab")
defaultModuleName = $(".tabList .tab").eq(1).attr("data-module")
} else {
$(".tabList .tab").eq(0).addClass("activeTab")
defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
}
$(`.${defaultModuleName}`).css("display", "block")
bindTabClick()
}
function bindTabClick(){
$(".tabList .tab").on("click", function(){
const moduleName = $(this).attr("data-module")
//const display = $(`.${moduleName}`).css("display")
selectedTab=$('.tabList .tab').index(this);
$(".titleCont .title").html($(this).attr('data-title'));
//if(display == "none"){
$(".activeTab").removeClass("activeTab")
$(this).addClass("activeTab")
$(".container").css("display","none")
$(`.${moduleName}`).css("display","block")
$(`.${moduleName} .infos`).scrollTop(0)
//}
})
$("#openWin").on("click", function () {
const type = getUrlArgObject('type');
const hospitalId = getUrlArgObject('hospitalId');
const hisName = getUrlArgObject('hisName');
const hisDetailName = getUrlArgObject('hisDetailName');
const scale = $('.activeTab').attr('data-module')
openNewWin("informationOut.html?hospitalId=" + encodeURIComponent(hospitalId) + "&hisName=" + encodeURIComponent(hisName) + "&hisDetailName=" + encodeURIComponent(hisDetailName || '') + "&type=" + encodeURIComponent(type) + "&d=" + selectedDrop + "&t=" + selectedTab + "&scale=" + scale);
})
}
function adjustHeight() {
const extHt = window.opener?60:0;
var ht = window.innerHeight || document.documentElement.clientHeight;
$(".content").height(ht - 160 + "px");
$(".content .infos").height(ht - 170 + "px");
$(".content .anchors").height(ht - 217 + "px");
}
function adjustWidth() {
var wt = window.innerWidth || document.documentElement.clientWidth;
$(".titleH2").width(wt - 0.2 * wt - 33 - 200 - 17 - 40 - 15 + 'px')
$(".content .infos").width(wt - 243 + 'px');
}
$(window).on('resize', function(){
adjustHeight()
adjustWidth()
})