if(!Promise){ var Promise = require("bluebird"); // Configure Promise.config({ longStackTraces: true, warnings: true // note, run node with --trace-warnings to see full stack traces for warnings }) } const $ = require("jquery"); require('./../css/reset.css'); require('./../css/cdssHorizontal.less'); require('./../css/popup.css'); require('./../css/staticSearch.css') require('./../js/staticSearch.js') require('./../images/empty2.png').replace(/^undefined/g, '') require('./../images/loading.gif').replace(/^undefined/g, '') const { post,config,getUrlArgObject,openNewWin,titleConfigH } = require('./promise.js'); let infoImg = require('./../images/icon_info.png').replace(/^undefined/g, '') let infoImgOn = require('./../images/icon_info_on.png').replace(/^undefined/g, '') let iconArrowUp = require('./../images/icon_arrow_up.png').replace(/^undefined/g, '') let iconArrowDown = require('./../images/icon_arrow_down.png').replace(/^undefined/g, '') let showImg = require('./../images/show.png').replace(/^undefined/g, '') let collapseImg = require('./../images/collapse.png').replace(/^undefined/g, '') setWidth() let moduleConfig={ auxiliary:"recommendWrap", qc:"qcWrap", medical:"medicalKonwledgeWrap" } let allInterface = 0 let hasCompleteTnterface = 0 let moduleNum = 0 let mrId = getUrlArgObject('mrId') const tipsMode = getUrlArgObject('tipsMode') || 1 let planCode = getUrlArgObject('planCode') || 'all' let hospitalIdUrl = getUrlArgObject('hospitalId') || '' let msg; function getMRInfo() { return post(config.getMr2,{mrId:mrId}) } function getConf() { var msg = window.msg return post(config.getPushSet,{hospitalId:hospitalIdUrl||msg.hospitalId||1,planCode: planCode}) } function getPushInfo() { return post(config.pushInner,Object.assign({},msg,{featureType: '1,4,5,6,7,8,9',hospitalId:hospitalIdUrl||msg.hospitalId,ruleType:config.ruleTypeMap['22']})) } function getPusgWarning(){ return post(config.indicationPush,Object.assign({},msg,{ruleType: '1,2,3',hospitalId:hospitalIdUrl||msg.hospitalId})) } if(mrId){ getMRInfo().then(res =>{ if(res.data.code == '0'){ msg = res.data.data ||{} window.msg = msg } }).catch(function (err) { console.log(err); }) } getConf().then(res =>{ if(res.data.code == '0'){ // const configArr = res.data.data.pushSetList || [] // getPageInfo(configArr) const data = res.data.data&&res.data.data[0] renderPage(data) } }) function renderPage(pageSet){ renderTab(pageSet.sysSetInfo) const iframeHei = $(".bodyWrap").height() const tabHei = $(".tabList").height() $(".contentWrapper").css("height",iframeHei-tabHei-10-20-30+'px') const hasAuxiliary = hasTab("辅助信息",pageSet.sysSetInfo) const hasMedical = hasTab("医学知识",pageSet.sysSetInfo) if(hasAuxiliary){ renderModuleWrapper(hasAuxiliary.planDetails) let needPush = isNeedPush(hasAuxiliary.planDetails) let needPushWarning = isNeedPushWarning(hasAuxiliary.planDetails) if(needPush || needPushWarning){ renderPushData() allInterface++ } if(needPushWarning){ renderPushWarning() allInterface++ } } } function renderTab(tabList){ let tabStr = '' let TabNum = 0 for(let i = 0; i < tabList.length; i++){ if(tabList[i].status == '1'){ TabNum++ tabStr += `${tabList[i].name}` } } $(".tabList").append(tabStr) $(".tabList .tab").eq(0).addClass("activeTab") $(".tabList .tab").css("height", 1/TabNum * 100 + '%') let showModuleName = $(".tabList .tab").eq(0).attr("data-name") getModuleShow(moduleConfig[showModuleName]) bindTabClick() setTabNameTop() } function hasTab(tabName,tabList){ for(let i = 0; i < tabList.length; i++){ if(tabList[i].name == tabName){ return tabList[i] } } return false } function renderModuleWrapper(moduleList){ let moduleStr = '',treatStr="" for(let i = 0; i < moduleList.length; i++){ if(moduleList[i].status !='0'){ if(moduleList[i].code == 'treat'){ treatStr += `` treatStr += `` }else if(moduleList[i].code == 'tips'){ moduleStr += `` moduleStr += `` }else{ moduleStr += `` } } } $(".recommendWrap .leftBox").append(moduleStr) $(".recommendWrap .rightBox").append(treatStr) } function isNeedPush(list){ let pushCode = ["diag","lis","pacs","symptom","vital"] for(let i = 0; i < list.length; i++){ if(pushCode.indexOf(list[i].code)>-1){ return true } } return false } function isNeedPushWarning(list){ let pushCode = ["tips"] for(let i = 0; i < list.length; i++){ if(pushCode.indexOf(list[i].code)>-1){ return true } } return false } function bindTabClick(){ $(".tabList .tab").on("click", function(){ $(".activeTab").removeClass("activeTab") $(this).addClass("activeTab") const moduleName = $(this).attr("data-name") getModuleShow(moduleConfig[moduleName]) }) } function getModuleShow(moduleClassName){ console.log("moduleClassName",moduleClassName) if( $(`.${moduleClassName}`).css("display") =="none"){ $(".moduleWrapper").css("display","none") $(`.${moduleClassName}`).css("display","block") } } function setTabNameTop(){ tabNameList = $(".tabList .tab .tabName") for(let i = 0; i < tabNameList.length; i++){ let tabNameHei = $(".tabList .tab .tabName").eq(i).height() console.log("tabNameHei",tabNameList) $(".tabList .tab .tabName").eq(i).css("marginTop",-tabNameHei/2+"px") } } function renderPushData(){ return getPushInfo().then(res =>{ hasCompleteTnterface++ if(res.data.code == "0"){ const result = res.data.data let diagPush = result.dis let lisPush = result.lis || [] let pacsPush = result.pacs || [] let symptomPush = result.symptom ||[] let checkupPush = result.vital ||[] let medicinesPush = result.medicines || [] let operationsPush = result.operations ||[] // let lisPush =[{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}] // let pacsPush = [{name:"胸部x射线",hisNameList:null},{name:"心电图",hisNameList:null}] // let checkupPush = [{name:"神志表情",hisNameList:null},{name:"面部表情",hisNameList:null}] let lisNum = $(".moduleItem.lis").attr("data-num") || 5 let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5 let checkupNum = $(".moduleItem.vital").attr("data-num") || 5 let symptomNum = $(".moduleItem.symptom").attr("data-num") || 5 let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5 let operationsNum = $(".moduleItem.operation").attr("data-num") || 5 renderLis(lisPush,lisNum,3,true) renderPacs(pacsPush,pacsNum,5,true) renderCheckup(checkupPush,checkupNum,null,true) renderSymptomPush(symptomPush,symptomNum,null,true) renderDiag(diagPush) if(medicinesPush.length > 0 || operationsPush.length > 0){ let str = `${titleConfigH["treat"].name}` $(".rightBoxTitle").append(str) $(".rightWrapper").css("display","inline-block") }else{ $(".leftWrapper").css({ borderRight: "0px", width: "100%" }) } renderMedicinesPush(medicinesPush,medicinesNum,2,true) renderOperationPush(operationsPush,operationsNum,6,true) // if(hasCompleteTnterface === allInterface){ // $('.loading').css("display","none") // if(moduleNum === 0){ // empty() // } // }icon bindOpenInfo() bindSlide() } }) } function renderLis(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.lis").length > 0){ moduleNum++ $('.moduleItem.lis .moduleItemTitBox').append(titleStr("lisPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $('.moduleItem.lis').append(shortStr) $('.moduleItem.lis').append(renderLongStr(titleConfigH["lisPush"].name,longStr)) $('.moduleItem.lis').css("display","block") } } function renderPacs(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.pacs").length > 0){ moduleNum++ $('.moduleItem.pacs .moduleItemTitBox').append(titleStr("pacsPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $(".moduleItem.pacs").append(shortStr) $(".moduleItem.pacs").append(renderLongStr(titleConfigH["pacsPush"].name,longStr)) $('.moduleItem.pacs').css("display","block") } } function renderSymptomPush(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.symptom").length > 0){ moduleNum++ $('.moduleItem.symptom .moduleItemTitBox').append(titleStr("symptomPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $(".moduleItem.symptom").append(shortStr) $(".moduleItem.symptom").append(renderLongStr(titleConfigH["symptomPush"].name,longStr)) $('.moduleItem.symptom').css("display","block") } } function renderMedicinesPush(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.medicine").length > 0){ moduleNum++ $('.moduleItem.medicine .moduleItemTitBox').append(titleStr("drugPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $(".moduleItem.medicine").append(shortStr) $(".moduleItem.medicine").append(renderLongStr(titleConfigH["drugPush"].name,longStr)) $(".moduleItem.medicine").css("display","block") } } function renderOperationPush(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.operation").length > 0){ moduleNum++ $('.moduleItem.operation .moduleItemTitBox').append(titleStr("operationPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $(".moduleItem.operation").append(shortStr) $(".moduleItem.operation").append(renderLongStr(titleConfigH["operationPush"].name,longStr)) $(".moduleItem.operation").css("display","block") } } function renderCheckup(list,showNum,type,hasInfo){ if(list.length > 0 && $(".moduleItem.vital").length > 0){ moduleNum++ $(".moduleItem.vital .moduleItemTitBox").append(titleStr("checkupPush")) let {shortStr, longStr} = renderItemWrapper(list,showNum,type,hasInfo) $(".moduleItem.vital").append(shortStr) $(".moduleItem.vital").append(renderLongStr(titleConfigH["checkupPush"].name,longStr)) $('.moduleItem.vital').css("display","block") } } function renderDiag(diagPush){ let possibleDiagPush = diagPush["可能诊断"] || [] let firstDiagPush = diagPush["初步诊断"] || [] let identifyDiagPush = diagPush["鉴别诊断"] || [] let warningDiagPush = diagPush["警惕"] || [] let number = $('.moduleItem.diag').attr("data-num") || 5 let warnNumber = $('.moduleItem.warning').attr("data-num") || 5 $('.moduleItem.diag .moduleItemTitBox').append(titleStr("diagPush")) // let warningDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}] // let firstDiagPush = [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}] // let identifyDiagPush = diagPush["鉴别诊断"] || [{name:"血常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null},{name:"尿常规",hisNameList:null}] renderDiagItem(possibleDiagPush,"可能诊断",number) renderDiagItem(firstDiagPush,"初步诊断",number) renderDiagItem(identifyDiagPush,"鉴别诊断",number) renderWarningDiag(warningDiagPush,"警惕",1000) moreInfo() } function renderDiagItem(list,name,number){ if(list.length === 0){ return } let titleStr = `${name}` let {shortStr, longStr} = renderItemWrapper(list,number,1,true) let boxStr = `
${titleStr} ${shortStr}
` $(".diag").append(boxStr) $(".diag").append(renderLongStr(name,longStr)) $('.moduleItem.diag').css("display","block") } function renderWarningDiag(list,name,showNum){ if(list.length > 0 && $(".moduleItem.warning").length > 0){ moduleNum++ $('.moduleItem.warning .moduleItemTitBox').append(titleStr("vigilancePush")) console.log("") let {shortStr, longStr} = renderItemWrapper(list,showNum,1,true) $('.moduleItem.warning').append(shortStr) $('.moduleItem.warning').append(renderLongStr(titleConfigH["lisPush"].name,longStr)) $('.moduleItem.warning').css("display","block") } } function renderPushWarning(){ return getPusgWarning().then(res =>{ hasCompleteTnterface++ if(res.data.code == '0'){ const result = res.data.data let billMsgList = result.billMsgList || [] //开单合理性提醒 let highRiskList = result.highRiskList || [] //高危药品、手术 let criticalValList = result.criticalValList || [] //危急值提醒 let noteList = result.noteList || [] //检查内容注意事项 let dubugStr = result.dubugStr || [] //注意调试信息 $('.moduleItem.tips .moduleItemTitBox').append(titleStr('warning')) renderBillingPush(billMsgList,'开单合理性') renderBillingPush(highRiskList,'高风险提示') renderBillingPush(criticalValList,'危急值提醒') renderBillingPush(noteList,'检查注意事项') moreInfo() // renderBillingPush(dubugStr,'注意调试信息') } if(hasCompleteTnterface === allInterface){ $('.loading').css("display","none") if(moduleNum === 0){ empty() } } }) } function renderBillingPush(list,name){ if(list.length === 0){ return } let str = `` for(let i = 0; i < list.length; i++){ str += `
${list[i].msg}
` } let titleStr = `${name}` let boxStr = `
${titleStr} ${str}
` $(".tips").append(boxStr) $('.moduleItem.tips').css("display","block") } function renderLongStr(name,longStr){ if(!longStr){ return } let str = `
${name}: ${longStr}
` return str } function renderItemWrapper(list,showNum,type,hasInfo){ let showNum1 = showNum || 5 let shortStr = '', longStr = '' for(let i = 0; i < list.length; i++){ if(i <= showNum1-1){ shortStr += renderPushItem(list[i],type) } longStr += renderPushItem(list[i],type) } if(showNum1 >= list.length){ return { shortStr:`
${shortStr}
`, longStr:'' } }else{ shortStr += ` ` longStr += `` return { shortStr:`
${shortStr}
`, longStr:`
${longStr}
` } } } function renderPushItem(item,type){ str= `${item.name}${item.hasInfo=="1"?``:""}` return str } function bindOpenInfo(){ $(".infoImg").on("mouseenter", function(){ $(this).attr("src", infoImgOn) }).on("mouseleave", function(){ $(this).attr("src", infoImg) }) } function titleStr(type){ let titleStr = '' titleStr += `
${titleConfigH[type].name}:
` return titleStr } function bindSlide(){ $(".showMore").on("click", function(){ $(".longStrBox").css("display","none") $(this).parents(".moduleItem ").find(".longStrBox").css("display","block") }) $(".showLess").on("click", function(){ $(this).parent().parent().css("display","none") }) } function setWidth(){ let winWidth = $(".bodyWrap").css("width") $(".contentBox").css("width",winWidth) } //医学知识搜索 searchMedical() function searchMedical(){ $(".medicalKonwledgeWrap .search").on("click", function(){ openNewWin(`staticSearch.html?searchType=1`) }) } function moreInfo() { $('.infoImg').off("click").click(function(){ const name = $(this).parent().attr('data-name') const type = $(this).parent().attr('data-type') openNewWin(`information.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}`) }) } $(function(){ $(window).on("resize",function(){ setWidth() }) $(".versionTop").on("click", function(){ openNewWin("disclaimer.html") }); $(".versionBottom").on("click", function(){ // const ver = localStorage.getItem('versionTime'); // $(".version-tip").removeClass('new-icon'); // localStorage.setItem('versionTime',ver.replace("=new","")); openNewWin("version.html"); }); })