|
@@ -1,6 +1,7 @@
|
|
|
var $ = require("jquery");
|
|
|
var { post,config,getUrlArgObject,openNewWin,isIe8 } = require('./promise.js');
|
|
|
-
|
|
|
+let showImg = require('./../images/show2.png').replace(/^undefined/g, '')
|
|
|
+let collapseImg = require('./../images/collapse2.png').replace(/^undefined/g, '')
|
|
|
function getFollowUp(msg){
|
|
|
return post(config.followUp, msg)
|
|
|
}
|
|
@@ -23,13 +24,13 @@ function renderPage(data,type){
|
|
|
renderDetailHorizontal(operaItemDetail)
|
|
|
}else{
|
|
|
renderDetail(operaItemDetail)
|
|
|
- }
|
|
|
-
|
|
|
+ checkDom()
|
|
|
+ }
|
|
|
}
|
|
|
function renderName(data){
|
|
|
const operationTime = data.dateValue&&getTime(data.dateValue)
|
|
|
const operationName = data.name || ""
|
|
|
- const str = `<div class="operaNameWrap"><div class="operaNameBox">患者于<span class="operaNameBold">${operationTime}</span>进行<span class="operaNameBold">${operationName}</span>。根据临床路径要求,特制订检验检查计划如下。</div></div>`
|
|
|
+ const str = `<div class="operaNameWrap" id="operaNameWrap"><div class="operaNameBox">患者于<span class="operaNameBold">${operationTime}</span>进行<span class="operaNameBold">${operationName}</span>。根据临床路径要求,特制订检验检查计划如下。</div></div>`
|
|
|
$(".followUpWrap").append(str)
|
|
|
}
|
|
|
function renderDetailHorizontal(data){
|
|
@@ -62,45 +63,63 @@ function renderDetailHorizontal(data){
|
|
|
$(".followUpWrap").append(`<div class="infoWrap">${str}</div>`)
|
|
|
}
|
|
|
function renderDetail(data){
|
|
|
- let str = ``
|
|
|
+ let historyStr = ``
|
|
|
+ let laterStr = ``
|
|
|
for(let i = 0; i < data.length; i++){
|
|
|
const item = data[i]
|
|
|
const lisArr = item.lis || []
|
|
|
const pacsArr = item.pacs || []
|
|
|
let lisStr=``
|
|
|
let pacsStr=``
|
|
|
- let title = `<p>${getTime(item.examineDate)}${item.description&&(item.description)}</p>`
|
|
|
+ let title = `<p class="infoBoxTitle">${getTime(item.examineDate)}${item.description?'('+item.description+')':''} <img class="toggleInfo" src="${showImg}"/></p>`
|
|
|
for(let i = 0; i < lisArr.length; i++){
|
|
|
- lisStr += `<div><span class="circle"></span>${lisArr[i]}</div>`
|
|
|
+ lisStr += `<div class="lisItem"><span class="circle"></span>${lisArr[i]}</div>`
|
|
|
}
|
|
|
for(let i = 0; i < pacsArr.length; i++){
|
|
|
- pacsStr += `<div><span class="circle"></span>${pacsArr[i]}</div>`
|
|
|
+ pacsStr += `<div class="lisItem"><span class="circle"></span>${pacsArr[i]}</div>`
|
|
|
}
|
|
|
- str += `<div class="infoBox">
|
|
|
+ if(item.history === 1){
|
|
|
+ historyStr+=`<div class="infoBox historyBox" >
|
|
|
${title}
|
|
|
- <div class="lisBox">${lisStr}</div>
|
|
|
- <div class="pacsBox">${pacsStr}</div>
|
|
|
- </div>`
|
|
|
+ <div class="childrenBox">
|
|
|
+ ${lisArr.length>0?`<div class="lisBox"><span class="itemBoxTitle">检验</span>${lisStr}</div>`:""}
|
|
|
+ ${pacsArr.length>0?`<div class="pacsBox"><span class="itemBoxTitle">检查</span>${pacsStr}</div>`:""}
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }else{
|
|
|
+ laterStr += `<div class="infoBox">
|
|
|
+ ${title}
|
|
|
+ <div class="childrenBox">
|
|
|
+ ${lisArr.length>0?`<div class="lisBox"><span class="itemBoxTitle">检验</span>${lisStr}</div>`:""}
|
|
|
+ ${pacsArr.length>0?`<div class="pacsBox"><span class="itemBoxTitle">检查</span>${pacsStr}</div>`:""}
|
|
|
+ </div>
|
|
|
+ </div>`
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- $(".followUpWrap").append(`<div class="infoWrap">${str}</div>`)
|
|
|
- setTimeout(function(){
|
|
|
- adjustHeight()
|
|
|
- },4000)
|
|
|
+ $(".followUpWrap").append(`<div class="infoWrap" id="infoWrap">
|
|
|
+ <div class="historyWrap">${historyStr}</div>
|
|
|
+ <div class="laterWrap">${laterStr}</div>
|
|
|
+ </div>`)
|
|
|
+ // adjustHeight()
|
|
|
+ bindToggleInfo()
|
|
|
+
|
|
|
}
|
|
|
function renderBtn(data){
|
|
|
- const hasBtn = data[0]&&data[0].history&&data[0].history === 0
|
|
|
+ const hasBtn = data[0]&&data[0].history&&data[0].history === 1
|
|
|
if(!hasBtn){
|
|
|
return
|
|
|
}
|
|
|
- const str = `<div class="btnBox"><span class="btnName">显示历史计划</span></div>`
|
|
|
+ const str = `<div class="btnBox" id="btnBox"><span class="btnName">显示历史计划</span></div>`
|
|
|
$(".followUpWrap").append(str)
|
|
|
+ bindToggleHistory()
|
|
|
|
|
|
}
|
|
|
function adjustHeight() {
|
|
|
var containerHt = $(".contentWrapper").height()
|
|
|
var ht1 = $(".operaNameWrap").height()
|
|
|
var ht2 = $(".btnBox").height()
|
|
|
- $(".followUpWrap .infoWrap").height(containerHt -ht1- ht2 + "px");
|
|
|
+ $(".followUpWrap .infoWrap").height(containerHt -ht1- ht2-30 + "px");
|
|
|
$(".infoWrap").preventScroll();
|
|
|
}
|
|
|
function getTime(date){
|
|
@@ -112,6 +131,51 @@ function getTime(date){
|
|
|
const day = new Date(date).getDate()
|
|
|
return `${year}年${month}月${day}日`
|
|
|
}
|
|
|
+
|
|
|
+// 声明定时器
|
|
|
+var cheakDomTimer = null
|
|
|
+// 检查dom是否执行完成
|
|
|
+function checkDom() {
|
|
|
+ let dom1Hei = $("#operaNameWrap").height()
|
|
|
+ let dom2 = document.getElementById('btnBox')
|
|
|
+ let dom3 = document.getElementById('infoWrap')
|
|
|
+ let dom2Hei = $("#btnBox").height()
|
|
|
+ if(dom1Hei!==0&&(dom2&&dom2Hei!=0 || !dom2)&&dom3) {
|
|
|
+ // 执行dom加载完成后的操作
|
|
|
+
|
|
|
+ adjustHeight()
|
|
|
+ // 清除定时器
|
|
|
+ if(!cheakDomTimer) {
|
|
|
+ clearTimeout(cheakDomTimer)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 自我调用
|
|
|
+ cheakDomTimer = setTimeout(checkDom, 200)
|
|
|
+ }
|
|
|
+}
|
|
|
+function bindToggleHistory(){
|
|
|
+ $(document).on("click",".btnName",function(){
|
|
|
+ const btnText = $(".btnName").text()
|
|
|
+ if(btnText==="显示历史计划"){
|
|
|
+ $(".btnName").text("隐藏历史计划")
|
|
|
+ }else{
|
|
|
+ $(".btnName").text("显示历史计划")
|
|
|
+ }
|
|
|
+ $(".historyWrap").slideToggle()
|
|
|
+ })
|
|
|
+}
|
|
|
+function bindToggleInfo(){
|
|
|
+ $(document).on("click",".infoBoxTitle",function(){
|
|
|
+ const img = $(this).parents(".infoBox").find(".toggleInfo").attr("src")
|
|
|
+ if(img === showImg){
|
|
|
+ $(this).parents(".infoBox").find(".toggleInfo").attr("src",collapseImg)
|
|
|
+ }else{
|
|
|
+ $(this).parents(".infoBox").find(".toggleInfo").attr("src",showImg)
|
|
|
+ }
|
|
|
+ $(this).parents(".infoBox").find(".childrenBox").slideToggle()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
$(window).on('resize', function(){
|
|
|
adjustHeight()
|
|
|
})
|