Bladeren bron

修改格式

yangdr 2 maanden geleden
bovenliggende
commit
def409a64f
7 gewijzigde bestanden met toevoegingen van 490 en 174 verwijderingen
  1. BIN
      dist.zip
  2. 177 57
      src/css/cdss.less
  3. 0 2
      src/html/cdss.html
  4. 299 105
      src/js/cdss.js
  5. 1 1
      src/js/promise.js
  6. 12 8
      src/js/tcmiss.js
  7. 1 1
      webpack.config.js

BIN
dist.zip


+ 177 - 57
src/css/cdss.less

@@ -228,48 +228,21 @@ body {
 
 
 // CDSS6.0
-.diag {
 
-  .longBox,
-  .shortBox {
-    padding: 0 10px 8px;
-  }
-}
 
 .longBox {
-  display: none;
+  // display: none;
 }
 
 .pushItemBox {
-  position: relative;
+  // position: relative;
   // cursor: pointer;
   // display: block;
   /*display: inline-block;*/
 }
 
 
-.pushItemBox-detail {
-  display: none;
 
-  ul {
-    li {
-      display: flex;
-      flex-wrap: nowrap;
-      flex-direction: row;
-
-      span {
-        flex: 0 0 auto;
-        display: inline-block;
-        // width: 100px;
-      }
-
-      p {
-        width: calc(100% - 100px);
-        flex: 1 1 auto;
-      }
-    }
-  }
-}
 
 .warning .pushItemName .item-name {
   opacity: 0.8;
@@ -277,25 +250,12 @@ body {
 }
 
 .pushItemName {
-  position: relative;
-  /*display: inline;*/
-  // line-height: 100%;
-  padding-right: 3px;
-  // cursor: pointer;
+  // display: inline-block;
   white-space: nowrap;
-
-  position: relative;
-
-  // height: 20px;
-  top: 0px;
-  left: 0px;
-
-  .detail-show {
-    position: absolute;
-    right: 0px;
-    top: 5px;
-    cursor: pointer;
-  }
+  line-height: 21px;
+  // margin-right: 20px;
+  box-sizing: border-box;
+  // cursor: pointer;
 
   &:is(.inline-block) {
     width: 100%;
@@ -337,13 +297,6 @@ body {
   }
 }
 
-.pushItemBox:hover {
-
-  .infoImg,
-  .queryImg {
-    visibility: inline;
-  }
-}
 
 .infoImg,
 .hidden-i,
@@ -359,6 +312,7 @@ body {
 
 .queryImg {
   width: 30px;
+  // margin-right: 20px;
 }
 
 .hidden-i {
@@ -406,14 +360,17 @@ body {
 .moduleBox {
   padding: 0;
 
+
   .longBox,
   .shortBox {
     border-bottom: 1px #E6E6E6 dashed;
+    // padding-bottom: 20px !important;
   }
 
   &:last-child .longBox,
   &:last-child .shortBox {
     border-bottom: none;
+    // padding-bottom: 10px !important;
   }
 }
 
@@ -450,12 +407,175 @@ body {
 
   .longBox,
   .shortBox {
-    padding: 4px 14px;
+    padding: 4px 10px;
     position: relative;
     /****bug8454***/
   }
 }
 
+// .medicine {
+
+//   .showMore,
+//   .showLess {
+//     right: 0px;
+//   }
+// }
+.divider {
+  border-bottom: 1px solid #F1F0F0;
+  // width: 100%;
+  margin: 0px 10px 5px;
+
+  &:last-child {
+    display: none;
+  }
+}
+
+.pacs,
+.lis,
+.medicine,
+.operation {
+  // padding-bottom: 15px;
+
+  .moduleItem {
+    position: relative;
+    border-radius: 8px;
+    box-shadow: 0px 5px 5px 0px @shadowColor;
+    margin-bottom: 10px;
+    // padding-bottom: 10px;
+    border: 1px #D8D8D8 solid;
+
+    .longBox,
+    .shortBox {
+      padding: 4px 14px;
+      position: relative;
+      /****bug8454***/
+    }
+  }
+
+  .pushItemBox-detail {
+    display: none;
+    padding: 0px 12px;
+    font-size: 13px;
+    position: relative;
+
+    li {
+      padding: 2px 0px;
+
+      .padding-1 {
+        padding: 2px 0px;
+      }
+    }
+  }
+
+  .showMore,
+  .showLess {
+    right: 20px;
+    bottom: -5px;
+  }
+
+  .pushItemName {
+    // padding-right: 3px;
+    white-space: normal;
+    position: relative;
+    // height: 20px;
+    top: 0px;
+    left: 0px;
+
+    .detail-show {
+      position: absolute;
+      right: 0px;
+      top: 5px;
+      cursor: pointer;
+    }
+  }
+
+
+  .pushItemBox:hover {
+
+    .infoImg,
+    .queryImg {
+      visibility: inline;
+    }
+  }
+
+}
+
+.diag {
+  .divider {
+    margin: 5px 0px 0px;
+  }
+
+  .longBox,
+  .shortBox {
+    padding: 0 10px 5px;
+    // margin-bottom: 5px;
+    max-height: 300px;
+    overflow: auto;
+
+  }
+
+  .showMore,
+  .showLess {
+    right: 16px;
+    bottom: 0px;
+  }
+
+  .pushItemName {
+    // padding-right: 3px;
+    white-space: normal;
+    position: relative;
+    // height: 20px;
+    top: 0px;
+    left: 0px;
+
+    .detail-show {
+      position: absolute;
+      right: 0px;
+      top: 5px;
+      cursor: pointer;
+    }
+  }
+
+  .possible-diagnosis {
+    .disease-name {
+      cursor: pointer;
+    }
+  }
+
+  .pushItemBox-detail {
+    display: none;
+    color: #000;
+
+    pre {
+      margin: 0px;
+      white-space: pre-line;
+      line-height: 1.5;
+      font-size: 13px;
+    }
+
+    ul {
+
+      li {
+        display: flex;
+        flex-wrap: nowrap;
+        flex-direction: row;
+
+        span {
+          flex: 0 0 auto;
+          display: inline-block;
+          // width: 100px;
+        }
+
+        p {
+          width: calc(100% - 100px);
+          flex: 1 1 auto;
+          font-size: 13px;
+        }
+      }
+    }
+  }
+}
+
 .tabList {
   margin-bottom: 8px;
   position: relative;
@@ -860,6 +980,6 @@ body {
   display: inline-block;
   background-repeat: no-repeat;
   background-size: cover;
-  height: 32px;
-  width: 32px;
+  height: 24px;
+  width: 24px;
 }

+ 0 - 2
src/html/cdss.html

@@ -29,8 +29,6 @@
       top: 0px;
       display: none;
       z-index: 10;
-
-
     }
 
     .mask img {

+ 299 - 105
src/js/cdss.js

@@ -47,7 +47,8 @@ let xhg2img = require('./../images/xhg2.png')
 let xhg3img = require('./../images/xhg3.png')
 let xhg4img = require('./../images/xhg4.png')
 
-const kgrtUrl = "http://172.16.8.57:4500" //知识图谱检索工具地址
+const kgrtUrl = 'http://' + window.location.hostname + ":88" //知识图谱检索工具地址
+// const kgrtUrl = 'http://' + window.location.hostname + ":4500" //知识图谱检索工具地址
 const $ = require("jquery");
 const { post, config, getUrlArgObject, openNewWin, titleConfig, get } = require('./promise.js');
 const { renderFollowUp, followEmpty } = require('./followUp.js');
@@ -162,9 +163,6 @@ function getHosptDeptUsal() {
   return post(config.getHosptDeptUsal, param)
 }
 
-
-
-
 function getPushData(res) {
   if (res && res.data && res.data.data && res.data.data.dis && res.data.data.dis) {
     let dis = res.data.data.dis;
@@ -213,7 +211,7 @@ $(document).on('click', ".allDis .right,.allDis .secDis", function () {
 
 
 function moreInfo() {
-  $('.infoImg').off("click").click(function () {
+  $('.infoImg').off("click").on('click', function () {
     const name = $(this).parents(".pushItemBox").attr('data-name')
     const type = $(this).parents(".pushItemBox").attr('data-type')
     openNewWin(`staticInfo.html?type=${encodeURIComponent(type)}&position=0&name=${encodeURIComponent(name)}&mrId=${encodeURIComponent(mrId)}`)
@@ -252,6 +250,7 @@ function renderPage(pageSet) {
   if (!pageSet || !setInfo) {
     return
   }
+
   renderTab(setInfo)
   adjustHei()
   const hasAuxiliary = hasTab("辅助信息", setInfo);
@@ -259,6 +258,8 @@ function renderPage(pageSet) {
   const hastcmk = hasTab("中医知识", setInfo)
   const hasFollowUp = hasTab("随访计划", setInfo)
   const hasTcm = hasTab("中医辅助", setInfo);
+
+  // console.log("pageSet", pageSet, hasAuxiliary)
   //所有模块都未开启配置,显示功能未开启(无tab)
   if (hasAuxiliary.status === 0 && hasMedical.status === 0 && hastcmk.status === 0 && hasFollowUp.status === 0 && hasTcm.status === 0) {
     const nullTxt = `<div class="empty-box" style="left: -20px;display: block;">
@@ -312,36 +313,77 @@ function renderPage(pageSet) {
 function renderPushData() {
   return getPushInfo().then(res => {
     $(".loading").hide();
-    // $(".loading").show();
+
     hasCompleteTnterface++
     if (res.data.code == "0") {
       const result = res.data.data
       let diagPush = result.dis || {}
       let lisPush = result.lis || []
       // console.log("lisPush", lisPush, diagPush)
-      if (msg.chief) {
-        // $(".loading").show();
-        get(`/graph/nodes/recommend?chief=${msg.chief}&sex=${+msg.sex === 2 ? '女' : '男'}&age=${+msg.age * 12}&department=${msg.dept[0].name}&present_illness=${msg.symptom}`).then((res) => {
-          const { success, data, error_code } = res.data
-          const records = data
-          // console.log(" records", res.data)
-          if (success) {
-            diagPush["可能诊断"] = records["可能诊断"] || []
-            // console.log("records可能诊断", diagPush["可能诊断"])
-            lisPush = records["推荐检验"] || []
-            let lisNum = $(".moduleItem.lis").attr("data-num") || 5
-            renderLis(lisPush, lisNum)
-            renderDiag(diagPush)
+
+      get(`knowledge/disease/recommend?chief=${msg.chief.trim()}&sex=${+msg.sex === 2 ? '女' : '男'}&age=${+msg.age * 12}&department=${msg.dept[0].name}&present_illness=${msg.symptom.trim()}`).then((res) => {
+        const { success, data, error_code } = res.data
+        const records = data
+        // console.log(" records", res.data)
+        if (success) {
+          diagPush["可能诊断"] = records["可能诊断"] || []
+          diagPush["鉴别诊断"] = records.disease_detail?.differential_diagnosis || []
+          renderDiag(diagPush)
+
+          let pacsPush = records.disease_detail?.examinations || []
+          let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
+          renderPacs(pacsPush, pacsNum)
+
+          lisPush = records.disease_detail?.laboratory_tests || []
+          let lisNum = $(".moduleItem.lis").attr("data-num") || 5
+          renderLis(lisPush, lisNum)
+
+          let medicinesPush = data.disease_detail?.treatments['药物治疗'] || {}
+          let medicinesNum = $(".moduleItem.medicine").attr("data-num") || 5
+          renderMedicinesPush(medicinesPush, medicinesNum)
+
+          let operationsPush = data.disease_detail?.treatments['非药物治疗'] || {}
+          let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
+          renderOperationPush(operationsPush, operationsNum)
+        }
+      }).catch(err => {
+        console.log(e)
+      }).finally(() => {
+        bindSlide()
+        bindDetailShow()
+        bindOpenInfo()
+        moreInfo()
+        $(".mask").css("display", 'none')
+        $(".diag .moduleBox .pushItemBox .detail-show").first().trigger("click")
+        $(".diag .pushItemName .disease-name").on("click", function () {
+          const diseaseName = $(this).attr("disease-name")
+          get(`/knowledge/disease/${diseaseName}/detail`).then((res) => {
+            // console.log(res)
+            const { data, success } = res.data
+            if (success) {
+              let pacsPush = data.examinations || []
+              let pacsNum = $(".moduleItem.pacs").attr("data-num") || 5
+              renderPacs(pacsPush, pacsNum)
+
+              lisPush = data.laboratory_tests || []
+              let lisNum = $(".moduleItem.lis").attr("data-num") || 5
+              renderLis(lisPush, lisNum)
+
+              let diagNum = $('.moduleItem.diag').attr("data-num") || 5
+              renderDiagItem(data.differential_diagnosis, "鉴别诊断", diagNum, "differential-diagnosis")
+            }
+          }).catch(err => {
+            console.log(err)
+          }).finally(() => {
             bindSlide()
             bindDetailShow()
-            $(".diag .moduleBox .pushItemBox .detail-show").first().click()
-          }
-
-          $(".mask").css("display", 'none')
-        }).catch(err => {
-          $(".mask").css("display", 'none')
+            bindOpenInfo()
+            moreInfo()
+          })
         })
-      }
+        // $(".diag .possible-diagnosis .disease-name").first().trigger("click")
+      })
+
       let scalePush = result.scale || []
       let pacsPush = result.pacs || []
       let symptomPush = result.symptom || []
@@ -363,7 +405,7 @@ function renderPushData() {
       let casesNum = $(".moduleItem.classiccase").attr("data-num") || 5
       let operationsNum = $(".moduleItem.operation").attr("data-num") || 5
       let nurseNum = $(".moduleItem.nurse").attr("data-num") || 5
-      // renderLis(lisPush, lisNum)
+      renderLis(lisPush, lisNum)
       // renderDiag(diagPush)
       renderScale(scalePush, scaleNum)
       renderPacs(pacsPush, pacsNum)
@@ -376,11 +418,13 @@ function renderPushData() {
       rendergeneraTreatPush(generaTreatPush)
       renderNurse(nursePush, nurseNum)
 
-      bindOpenInfo()
-      moreInfo()
-      bindSlide();
+      // bindOpenInfo()
+      // moreInfo()
+      // bindSlide();
     }
     empty();  //判断是否显示空状态
+  }).catch((e) => {
+    console.log(e)
   })
 }
 function adjustHei() {
@@ -389,7 +433,7 @@ function adjustHei() {
   $(".tabList").css("height", iframeHei + 'px')
 }
 function bindDetailShow() {
-  $(".moduleBox .pushItemBox .detail-show").on("click", function () {
+  $(".pushItemBox .detail-show.icon-down").off('click').on("click", function () {
     // alert($(this).parents(".pushItemBox").next().css("display"))
     const deg = $(this).parents(".pushItemBox").next().css("display") === 'none' ? 180 : 0;
     $(this).animate( //animate无法给动画加过渡时间
@@ -415,6 +459,7 @@ function isNeedPush(list) {
       if (list[i].status == "1") {
         pass = true
       }
+      // pass = true
     }
   }
   // console.log(pass);
@@ -554,22 +599,26 @@ function renderDiag(diagPush) {
   // let warningDiagPush = [{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(previousDiagPush, "既往诊断", number)
-  renderDiagItem(firstDiagPush, "初步诊断", number)
-  renderDiagItem(identifyDiagPush, "鉴别诊断", number)
-  renderWarningDiag(warningDiagPush, "警惕", warnNumber)
+  renderDiagItem(possibleDiagPush, "可能诊断", number, 'possible-diagnosis')
+  renderDiagItem(previousDiagPush, "既往诊断", number, 'previous-diagnosis')
+  renderDiagItem(firstDiagPush, "初步诊断", number, 'primary-diagnosis')
+  renderDiagItem(identifyDiagPush, "鉴别诊断", number, 'differential-diagnosis')
+  renderWarningDiag(warningDiagPush, "警惕", warnNumber, 'warning-diagnosis')
   moreInfo()
 }
 
-function renderDiagItem(list, name, number) {
+function renderDiagItem(list, name, number, boxClassName = "") {
+  if (boxClassName) {
+    $(`.${boxClassName}`).remove()
+  }
   if (list.length === 0) {
     return
   }
+
   moduleNum++
   let titleStr = titleStr2(name)
   let { shortStr, longStr } = renderItemWrapper(list, number, name)
-  let boxStr = `<div class="moduleBox">
+  let boxStr = `<div class="moduleBox ${boxClassName}">
         ${titleStr}
         ${shortStr}
         ${longStr}
@@ -592,10 +641,11 @@ function renderWarningDiag(list, name, number) {
 }
 
 function renderLis(list, showNum) {
+  $(".lis").empty()
   if (list.length > 0 && $(".moduleItem.lis").length > 0) {
     moduleNum++
     $('.moduleItem.lis').append(titleStr("lisPush"))
-    let { shortStr, longStr } = renderItemWrapper(list, showNum)
+    let { shortStr, longStr } = renderItemWrapper(list, showNum, '推荐检验')
     $('.moduleItem.lis').append(shortStr).append(longStr)
     $('.moduleItem.lis').css("display", "block")
   }
@@ -621,10 +671,11 @@ function renderNurse(list, showNum) {
   }
 }
 function renderPacs(list, showNum) {
+  $(".pacs").empty()
   if (list.length > 0 && $(".moduleItem.pacs").length > 0) {
     moduleNum++
     $(".moduleItem.pacs").append(titleStr("pacsPush"))
-    let { shortStr, longStr } = renderItemWrapper(list, showNum)
+    let { shortStr, longStr } = renderItemWrapper(list, showNum, '推荐检查')
     $(".moduleItem.pacs").append(shortStr).append(longStr)
     $('.moduleItem.pacs').css("display", "block")
   }
@@ -666,45 +717,66 @@ function rendergeneraTreatPush(list) {
   }
 }
 function renderMedicinesPush(obj, showNum) {
+  $(".moduleItem.medicine").empty()
+  if (JSON.stringify(obj) === '{}') return
   $(".moduleItem.medicine").append(titleStr('drugPush'));
   let showNum1 = 2;
   let mshortStr1 = "";
   let mlongStr1 = "";
   let keys = Object.keys(obj);
   let cateNames = Array.from(keys);
-  if (cateNames.length > 0 && $(".moduleItem.medicine").length > 0) {
-    moduleNum++;
-    for (let i = 0; i < cateNames.length; i++) {
-      let drugs = obj[cateNames[i]];
-      let { shortStr, longStr } = renderItemWrapper(drugs, showNum);
-      // console.log("long", shortStr);
-
-      if (i < showNum1) {
-        mshortStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
-        mshortStr1 += shortStr;
-      }
-      // // 添加药品分类和短内容
-      // mshortStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
-      // mshortStr1 += shortStr;
-
-      // 添加药品分类和长内容
-      mlongStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
-
-      mlongStr1 += longStr;
-
-    }
-    // 判断显示逻辑
-    if (showNum1 > cateNames.length) {
-      $(".moduleItem.medicine").append(`<div class="shortBox">${mshortStr1}</div>`);
+  // console.log(cateNames, keys)
+  const itemList = []
+  for (let i in obj) {
+    if (obj[i].hasOwnProperty('items')) {
+      itemList.push({ name: i, content: [{ scheme: "", subScheme: obj[i].items }] })
     } else {
-      mshortStr1 += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`;
-      mlongStr1 += `<span class="showLess"><img class="iconArrowImg"  src="${iconArrowUp}"></span>`;
-      $(".moduleItem.medicine").append(`<div class="shortBox">${mshortStr1}</div>`);
-      $(".moduleItem.medicine").append(`<div class="longBox">${mlongStr1}</div>`);
+      let items = []
+      for (let j in obj[i]) {
+        items.push({ scheme: j, subScheme: obj[i][j].items })
+      }
+      itemList.push({ name: i, content: items })
     }
-
-    $(".moduleItem.medicine").css("display", "block");
   }
+  // console.log("renderMedicinesPush", itemList)
+  let { shortStr, longStr } = renderItemWrapper(itemList, showNum, '推荐用药');
+  // if (cateNames.length > 0 && $(".moduleItem.medicine").length > 0) {
+  //   moduleNum++;
+  //   for (let i = 0; i < cateNames.length; i++) {
+  //     let drugs = obj[cateNames[i]];
+  //     console.log("drugs", cateNames[i], drugs)
+  //     let { shortStr, longStr } = renderItemWrapper(drugs, showNum, '推荐用药');
+  //     // console.log("long", shortStr);
+
+  //     if (i < showNum1) {
+  //       mshortStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
+  //       mshortStr1 += shortStr;
+  //     }
+  //     // // 添加药品分类和短内容
+  //     // mshortStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
+  //     // mshortStr1 += shortStr;
+
+  //     // 添加药品分类和长内容
+  //     mlongStr1 += `&nbsp;&nbsp;${i + 1}.${cateNames[i]}<br>`;
+
+  //     mlongStr1 += longStr;
+
+  //   }
+  // 判断显示逻辑
+  // if (showNum > itemList.length) {
+  //   // $(".moduleItem.medicine").append(`<div class="shortBox">${shortStr}</div>`);
+  //   $(".moduleItem.medicine").append(shortStr);
+  // } else {
+  //   // mshortStr1 += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`;
+  //   // mlongStr1 += `<span class="showLess"><img class="iconArrowImg"  src="${iconArrowUp}"></span>`;
+  //   // $(".moduleItem.medicine").append(`<div class="shortBox">${shortStr}</div>`);
+  //   // $(".moduleItem.medicine").append(`<div class="longBox">${longStr}</div>`);
+  //   $(".moduleItem.medicine").append(shortStr);
+  //   $(".moduleItem.medicine").append(longStr);
+  // }
+  $(".moduleItem.medicine").append(longStr);
+  $(".moduleItem.medicine").css("display", "block");
+
 }
 
 
@@ -740,11 +812,25 @@ function renderCasesPush(list, showNum) {
   }
 
 }
-function renderOperationPush(list, showNum) {
+function renderOperationPush(obj, showNum) {
+  $(".moduleItem.operation").empty()
+  // const changeList = []
+  const itemList = []
+  for (let i in obj) {
+    if (obj[i].hasOwnProperty('items')) {
+      itemList.push({ name: i, content: [{ scheme: "", subScheme: obj[i].items }] })
+    } else {
+      let items = []
+      for (let j in obj[i]) {
+        items.push({ scheme: j, subScheme: obj[i][j].items })
+      }
+      itemList.push({ name: i, content: items })
+    }
+  }
   $(".moduleItem.operation").append(titleStr('operationPush'))
-  if (list.length > 0 && $(".moduleItem.operation").length > 0) {
+  if (itemList.length > 0 && $(".moduleItem.operation").length > 0) {
     moduleNum++
-    let { shortStr, longStr } = renderItemWrapper(list, showNum)
+    let { shortStr, longStr } = renderItemWrapper(itemList, showNum, '非药物治疗方案')
     $(".moduleItem.operation").append(shortStr).append(longStr)
     $(".moduleItem.operation").css("display", "block")
   }
@@ -763,31 +849,39 @@ function renderItemWrapper(list, showNum, name) {
   }
   // console.log(shortStr);
 
+  return {
+    shortStr: "",
+    longStr: `<div class="longBox">${longStr}</div>`
+  }
   if (showNum1 >= list.length) {
     return {
       shortStr: `<div class="shortBox">${shortStr}</div>`,
       longStr: `<div class="longBox">${longStr}</div>`
     }
   } else {
-    shortStr += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`
-    longStr += `<span class="showLess"><img class="iconArrowImg"  src="${iconArrowUp}"></span>`
+    // shortStr += `<span class="showMore"><img class="iconArrowImg" src="${iconArrowDown}"></span>`
+    // longStr += `<span class="showLess"><img class="iconArrowImg"  src="${iconArrowUp}"></span>`
     return {
       shortStr: `<div class="shortBox">${shortStr}</div>`,
       longStr: `<div class="longBox">${longStr}</div>`
     }
   }
+
+
 }
 
 function renderPushItem(item, name, index, totalItems) {
-
+  item.hasInfo = "1"
   const infoIcon = `${item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : ""}`;
   let signalStr = "";
-  // const percentage = (index / totalItems) * 100;
-  const percentage = item.score * 100;
-  const queryImg = `<a href="${kgrtUrl}/#/kgrt/entry?keyword=${item.name}" target="_blank"><img class="queryImg" src="${queryIcon}"></a>`
+  let queryImg = `<a href="${kgrtUrl}/#/kgrt/entry?keyword=${item.dest_node?.name || item.name}${name === '可能诊断' || name === '鉴别诊断' ? '&category=疾病&exact' : ''}" target="_blank"><img class="queryImg" src="${queryIcon}"></a>`
+  let str = `<span class="pushItemBox" data-name="${item.dest_node?.name || item.name}" data-type="${item.dest_node?.category || item.type}">`
 
-  // 根据百分比添加不同的信号格图片
-  if (name === "可能诊断") {
+  if (name === "经典病例") {
+    str += `<span class="pushItemName ${item.hasInfo == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">${item.type == 8 ? ('【' + item.name + '】') : item.name} ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i></span>`
+  } else if (name === "可能诊断") {
+    // 根据百分比添加不同的信号格图片
+    const percentage = item.score * 100;
     if (percentage <= 20) {
       signalStr = `<span class="signal"><img class="xhg4img" src="${xhg1img}"></span>`;
     } else if (percentage <= 40) {
@@ -798,27 +892,103 @@ function renderPushItem(item, name, index, totalItems) {
       signalStr = `<span class="signal"><img class="xhg1img" src="${xhg4img}"></span>`;
     }
     signalStr += `<i class="detail-show icon-down"></i>`
-  }
-  str = `<span class="pushItemBox" data-name="${item.name}" data-type="${item.type}">`
 
-  if (name === "经典病例") {
-    str += `<span class="pushItemName ${item.hasInfo == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">${item.type == 8 ? ('【' + item.name + '】') : item.name} ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i></span>`
-  } else if (name === "可能诊断") {
-    str += `<span class="pushItemName inline-block ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">${item.type == 8 ? ('【' + item.name + '】') : item.name} ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i></span>`
-  } else {
-    str += `<span class="pushItemName ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">${item.type == 8 ? ('【' + item.name + '】') : item.name} ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i></span>`
-  }
+    str += `<span class="pushItemName inline-block ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">
+      <i class="disease-name" disease-name="${item.name}">
+        ${item.type == 8 ? ('【' + item.name + '】') : item.name}
+      </i>
+        ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i>
+      </span>`
+
+
+    str += `</span>`;
+
 
-  str += `</span>`;
-  if (name === "可能诊断") {
     let str1 = ""
     for (let i = 0; i < item.symptoms.length; i++) {
-      str1 += `<i class="${item.symptoms[i].matched ? 'red' : ''}" style="margin-right:10px">${item.symptoms[i].name}</i>`
+      str1 += `<i class="${item.symptoms[i].matched ? 'red' : ''}" style="margin-right:10px;white-space:nowrap;">${item.symptoms[i].name}</i>`
     }
     str += `<div class="pushItemBox-detail" >
       <ul><li><span>症状表现:</span><p>${str1}</p></li></ul>
     </div>`
+    str += `<div class="divider"></div>`
+  } else if (name === '鉴别诊断') {
+    signalStr += `<i class="detail-show icon-down"></i>`
+    str += `<span class="pushItemName inline-block ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">
+        <i class="disease-name" disease-name="${item.dest_node.name}" >
+          ${item.type == 8 ? ('【' + item.dest_node.name + '】') : item.dest_node.name}
+        </i>
+        ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i>
+      </span>`
+    str += `</span>`;
+    let str1 = ""
+    if (Array.isArray(item.props)) {
+      for (let i = 0; i < item.props.length; i++) {
+        // console.log(item.props[i].prop_value)
+        str1 += `<li>
+          <pre>${Array.isArray(item.props[i].prop_value) ? item.props[i].prop_value.join("").replace(/\*\*(.*?)\*\*/g, (a, b) => '<strong>' + b + '</strong>') : ""}</pre>
+        </li>`
+      }
+    } else {
+      str1 += `<li><pre>无</pre></li>`
+    }
+    str += `<div class="pushItemBox-detail" >
+      <ul>${str1}</ul>
+    </div>`
+    str += `<div class="divider"></div>`
+  } else if (name === '推荐检查' || name === '推荐检验' || name === '推荐用药' || name === '非药物治疗方案') {
+    let itemName = item.dest_node?.name || item.name
+
+    let str1 = ""
+    if (Array.isArray(item.props)) {
+      let index = 1
+      for (let i = 0; i < item.props.length; i++) {
+        if (Array.isArray(item.props[i].prop_value) && item.props[i].prop_name !== 'timelimit') {
+          for (let j = 0; j < item.props[i].prop_value.length; j++) {
+            str1 += `<li>${index}. ${item.props[i].prop_value[j]}</li>`
+            index++
+          }
+        } else if (item.props[i].prop_name === 'timelimit' && typeof item.props[i].prop_value === 'string') {
+          itemName += `(${item.props[i].prop_value})`
+        }
+      }
+    } else if (Array.isArray(item.content)) { //针对“推荐用药”和“非药物治疗方案”设置的
+      for (let i = 0; i < item.content.length; i++) {
+        let str2 = ""
+        if (Array.isArray(item.content[i].subScheme)) {
+          for (let j = 0; j < item.content[i].subScheme.length; j++) {
+            str2 += `<i style="margin-right:10px">${item.content[i].subScheme[j].name}</i>`
+          }
+        }
+        if (item.content[i].scheme) {
+          str1 += `<li >
+            <div class="padding-1">●${item.content[i].scheme}</div>
+            <div class="padding-1">${str2}</div>
+          </li>`
+        } else {
+          str1 += `<li><div class="padding-1">${str2}</div></li>`
+        }
+      }
+    }
+
+    signalStr += `<i class="detail-show icon-down"></i>`
+    str += `<span  class="pushItemName inline-block ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">
+      <i style="border-left:2px solid #EC5F18;padding-left:10px;" >
+        ${item.type == 8 ? ('【' + itemName + '】') : itemName}
+      </i> 
+        ${signalStr}${infoIcon}${queryImg}
+        <i class="hidden-i"></i>
+    </span>`
+    str += `</span>`;
+
+    str += `<div class="pushItemBox-detail" >
+    <ul>${str1}</ul>
+    </div>`
+    str += `<div class="divider"></div>`
+  } else {
+    str += `<span class="pushItemName ${item.hasScale == "1" ? 'evaluationtitle' : ''} ${item.hasInfo == "1" ? '' : 'noInfo'}">${item.type == 8 ? ('【' + item.name + '】') : item.name} ${signalStr}${infoIcon}${queryImg}<i class="hidden-i"></i></span>`
   }
+  // console.log("name", name)
   // $(".pushItemBox").css("display", "flex")
   return str;
 }
@@ -831,13 +1001,26 @@ function bindOpenInfo() {
 }
 
 function bindSlide() {
+  //moduleItem可以包含多个moduleBox
   $(".showMore").off("click").on("click", function () {
-    $(this).parent().parent().find(".longBox").css("display", "block")
-    $(this).parent().parent().find(".shortBox").css("display", "none")
+    if ($(this).parents(".moduleBox").length > 0) {
+      $(this).parents(".moduleBox").find(".longBox").css("display", "block")
+      $(this).parents(".moduleBox").find(".shortBox").css("display", "none")
+    } else {
+      $(this).parents(".moduleItem").find(".longBox").css("display", "block")
+      $(this).parents(".moduleItem").find(".shortBox").css("display", "none")
+    }
+
   })
   $(".showLess").off("click").on("click", function () {
-    $(this).parent().parent().find(".longBox").css("display", "none")
-    $(this).parent().parent().find(".shortBox").css("display", "block")
+    if ($(this).parents(".moduleBox").length > 0) {
+      $(this).parents(".moduleBox").find(".longBox").css("display", "none")
+      $(this).parents(".moduleBox").find(".shortBox").css("display", "block")
+    } else {
+      $(this).parents(".moduleItem").find(".longBox").css("display", "none")
+      $(this).parents(".moduleItem").find(".shortBox").css("display", "block")
+    }
+
   })
 }
 
@@ -845,15 +1028,26 @@ function renderModuleWrapper(moduleList) {
   if (!moduleList) {
     return
   }
+  let pushCode = ['critical', "diag", "lis", "pacs", "symptom", "vital", "treat", "medicines", 'evaluation', 'general', 'medicine', 'operation', 'nurse', 'classiccase']
+
   let moduleStr = ''
-  for (let i = 0; i < moduleList.length; i++) {
-    if (moduleList[i].status != '0') {
-      if (moduleList[i].code == 'critical') {
-        moduleStr += `<div class="moduleItem warning"  data-num="${moduleList[i].number}" style="display:none"></div>`
-        // moduleStr += `<div class="moduleItem tips"  data-num="${moduleList[i].number}" style="display:none"></div>`
-      } else {
-        moduleStr += `<div class="moduleItem ${moduleList[i].code}"  data-num="${moduleList[i].number}" style="display:none"></div>`
-      }
+  // for (let i = 0; i < moduleList.length; i++) {
+  //   if (moduleList[i].status != '0') {
+  //     if (moduleList[i].code == 'critical') {
+  //       moduleStr += `<div class="moduleItem warning"  data-num="${moduleList[i].number}" style="display:none"></div>`
+  //       // moduleStr += `<div class="moduleItem tips"  data-num="${moduleList[i].number}" style="display:none"></div>`
+  //     } else {
+  //       moduleStr += `<div class="moduleItem ${moduleList[i].code}"  data-num="${moduleList[i].number}" style="display:none"></div>`
+  //     }
+  //   }
+  // }
+
+  for (let i = 0; i < pushCode.length; i++) {
+    if (pushCode[i] == 'critical') {
+      moduleStr += `<div class="moduleItem warning"  data-num="${5}" style="display:none"></div>`
+      // moduleStr += `<div class="moduleItem tips"  data-num="${moduleList[i].number}" style="display:none"></div>`
+    } else {
+      moduleStr += `<div class="moduleItem ${pushCode[i]}"  data-num="${5}" style="display:none"></div>`
     }
   }
   $(".recommendWrap").append(moduleStr)

+ 1 - 1
src/js/promise.js

@@ -251,7 +251,7 @@ const titleConfig = {
   operationPush: {
     background: colorMap.treatColor,
     icon: iconOperationPush,
-    name: "推荐手术及操作"
+    name: "非药物治疗方案", //原名:推荐手术及操作
   },
   generaTreatPush: {
     background: colorMap.treatColor,

+ 12 - 8
src/js/tcmiss.js

@@ -1,5 +1,5 @@
 const $ = require("jquery");
-const {get, post, config, getUrlArgObject, openNewWin, titleConfig} = require('./promise.js');
+const { get, post, config, getUrlArgObject, openNewWin, titleConfig } = require('./promise.js');
 const targetUrl = '/lantone/index';
 let treatUrl = targetUrl;
 $(function () {
@@ -28,7 +28,7 @@ function getTcmMr(mrId, config) {
         $("#goPush").on("click", function () {
             openNewWin(window.encodeURI(targetUrl + '?page=bztd&jibing='), true);
         });
-    }else{
+    } else {
         post('/sys/mr/getTcmMr', { mrId: mrId }).then((res) => {
             let data = res.data.data || {}
             const { tcmdisease, tcmsyndrome } = data;
@@ -42,7 +42,7 @@ function getTcmMr(mrId, config) {
             }
         })
     }
-    
+
 }
 
 //获取处方推荐
@@ -50,7 +50,7 @@ function getTcmData(param, config) {
     const item = config.planDetails.filter((it) => it.code === "treatment");
     const isHor = window.location.pathname.indexOf("cdssHorizontal") > -1;
     const num = isHor ? 3 : ((item[0] || {}).number || 3);
-    const {tcmDiag, tcmSyndrome} = param;
+    const { tcmDiag, tcmSyndrome } = param;
     $("#jibing").text(tcmDiag + "-" + tcmSyndrome);
     $('#bingming').text(tcmDiag);
     $('#zhenghou').text(tcmSyndrome);
@@ -64,6 +64,10 @@ function getTcmData(param, config) {
         } else {
 
         }
+    }).catch(e => {
+        console.log(e)
+    }).finally(() => {
+
     })
     //治法推荐-暂时不用
     /*get('/lantone/private/zhongyizx?type=1&code=' + tcmDiag + '&value=' + tcmSyndrome).then((res) => {
@@ -81,8 +85,8 @@ function renderTcm(data, num = 3) {
     let str = ``, it;
     $("#goTreat").hide();
     let n = num < data.length ? num : data.length;
-    if($(".horizontal-detail").length){
-        n=1;
+    if ($(".horizontal-detail").length) {
+        n = 1;
     }
     for (let i = 0; i < n; i++) {
         it = data[i];
@@ -103,8 +107,8 @@ function renderTcm(data, num = 3) {
         }
     }
     $('.detail ul').html(str);
-    if(data.length > num){
-        $(".horizontal-detail .val:nth-child(2) .desc").css("width",'420px')
+    if (data.length > num) {
+        $(".horizontal-detail .val:nth-child(2) .desc").css("width", '420px')
     }
     //更多治法
     $("#goTreat").on('click', function () {

+ 1 - 1
webpack.config.js

@@ -344,7 +344,7 @@ module.exports = {
       '/sys': proxyHost,
       '/lantone': "http://114.55.109.16:81",
       '/kl': proxyHost,
-      "/graph": "http://173.18.12.205:8001/"
+      "/knowledge": "http://173.18.12.205:8001"
     },
     hot: true,
     // openPage:'index.html?age=28&tipsName=血常规&tipsType=12&diseaseId=280&lisJson=&diagJson=急性胰腺炎&diseaseName=糖尿病&pastJson=无心脏病&otherJson=无高血压&pacsJson=腹部B超:无异常,%20报告日期:2019-05-07&sex=男&symptomJson=恶心呕吐腰痛&vitalJson=血压左上肢13/12mmHg&hospitalCode=A001',