Parcourir la source

可能诊断增加症状表现

yangdr il y a 1 mois
Parent
commit
d178fb7c2d
4 fichiers modifiés avec 130 ajouts et 41 suppressions
  1. 62 4
      src/css/cdss.less
  2. 1 1
      src/html/cdss.html
  3. BIN
      src/images/icon-down.png
  4. 67 36
      src/js/cdss.js

+ 62 - 4
src/css/cdss.less

@@ -242,21 +242,66 @@ body {
 
 .pushItemBox {
   position: relative;
-  cursor: pointer;
+  // 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: .8;
+  opacity: 0.8;
   filter: alpha(opacity=80);
 }
 
 .pushItemName {
   position: relative;
   /*display: inline;*/
-  line-height: 21px;
+  // line-height: 100%;
   padding-right: 3px;
-  cursor: pointer;
+  // cursor: pointer;
+  white-space: nowrap;
+
+  position: relative;
+
+  // height: 20px;
+  top: 0px;
+  left: 0px;
+
+  .detail-show {
+    position: absolute;
+    right: 0px;
+    top: 5px;
+    cursor: pointer;
+  }
+
+  &:is(.inline-block) {
+    width: 100%;
+    display: inline-block;
+    white-space: normal;
+  }
 
   &.noInfo {
     margin-right: 12px;
@@ -804,4 +849,17 @@ body {
 
 .casename:hover {
   color: @linkColor;
+}
+
+.red {
+  color: red;
+}
+
+.icon-down {
+  background-image: url("../images/icon-down.png");
+  display: inline-block;
+  background-repeat: no-repeat;
+  background-size: cover;
+  height: 32px;
+  width: 32px;
 }

+ 1 - 1
src/html/cdss.html

@@ -39,7 +39,7 @@
       top: 50%;
       left: 50%;
 
-      transform: translate(-50%, -50%) translate(-64px, -32px);
+      transform: translate(-50%, -50%) translate(-80px, 0px);
 
       /* margin: auto !important; */
     }

BIN
src/images/icon-down.png


+ 67 - 36
src/js/cdss.js

@@ -47,7 +47,7 @@ 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 $ = require("jquery");
 const { post, config, getUrlArgObject, openNewWin, titleConfig, get } = require('./promise.js');
 const { renderFollowUp, followEmpty } = require('./followUp.js');
@@ -133,7 +133,7 @@ function getPushInfo() {
   // console.log("@@@@@@@@", msg)
 
 
-  // $(".mask").css("display", 'block')
+  $(".mask").css("display", 'block')
   return post(config.pushInner, Object.assign({}, msg, {
     featureType: '1,4,5,6,7,8,9,10,12,13,14',
     hospitalId: hospitalIdUrl || msg.hospitalId,
@@ -319,26 +319,29 @@ function renderPushData() {
       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}`).then((res) => {
-      //     const { success, records, error_code } = res.data
-      //     // console.log(" records", res.data)
-      //     if (error_code === 0) {
-      //       console.log(" records", records)
-      //       diagPush["可能诊断"] = records["可能诊断"]
-      //       lisPush = records["推荐检验"]
-      //       let lisNum = $(".moduleItem.lis").attr("data-num") || 5
-      //       renderLis(lisPush, lisNum)
-      //       renderDiag(diagPush)
-      //     }
-
-      //     $(".mask").css("display", 'none')
-      //   }).catch(err => {
-      //     $(".mask").css("display", 'none')
-      //   })
-      // }
+      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)
+            bindSlide()
+            bindDetailShow()
+            $(".diag .moduleBox .pushItemBox .detail-show").first().click()
+          }
+
+          $(".mask").css("display", 'none')
+        }).catch(err => {
+          $(".mask").css("display", 'none')
+        })
+      }
       let scalePush = result.scale || []
       let pacsPush = result.pacs || []
       let symptomPush = result.symptom || []
@@ -360,8 +363,8 @@ 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)
-      renderDiag(diagPush)
+      // renderLis(lisPush, lisNum)
+      // renderDiag(diagPush)
       renderScale(scalePush, scaleNum)
       renderPacs(pacsPush, pacsNum)
       renderCheckup(checkupPush, checkupNum)
@@ -385,6 +388,23 @@ function adjustHei() {
   $(".contentWrapper").css("height", iframeHei - 20 - 30 - 60 + 3 + 19 + 'px')
   $(".tabList").css("height", iframeHei + 'px')
 }
+function bindDetailShow() {
+  $(".moduleBox .pushItemBox .detail-show").on("click", function () {
+    // alert($(this).parents(".pushItemBox").next().css("display"))
+    const deg = $(this).parents(".pushItemBox").next().css("display") === 'none' ? 180 : 0;
+    $(this).animate( //animate无法给动画加过渡时间
+      { deg: deg }, // 从 0 度旋转到 360 度
+      {
+        // duration: 1000, // 动画时间
+        step: function (now) {
+          $(this).css({
+            transform: 'rotate(' + now + 'deg)'
+          });
+        }
+      })
+    $(this).parents(".pushItemBox").next().slideToggle()
+  })
+}
 //这段代码通过遍历给定的 list 数组,并根据预定义的 pushCode 数组以及项目的 status 属性,判断是否存在需要推送的项目。它返回一个布尔值,用于表示是否需要执行推送操作
 function isNeedPush(list) {
   let pass = false;
@@ -763,31 +783,42 @@ function renderPushItem(item, name, index, totalItems) {
   const infoIcon = `${item.hasInfo == "1" ? `<img class="infoImg" src="${infoImg}">` : ""}`;
   let signalStr = "";
   // const percentage = (index / totalItems) * 100;
-  const percentage = item.count * 100;
-  const queryImg = `<a href="http://172.16.8.57:4500/#/kgrt/entry?keyword=${item.name}" target="_blank"><img class="queryImg" src="${queryIcon}"></a>`
+  const percentage = item.score * 100;
+  const queryImg = `<a href="${kgrtUrl}/#/kgrt/entry?keyword=${item.name}" target="_blank"><img class="queryImg" src="${queryIcon}"></a>`
 
   // 根据百分比添加不同的信号格图片
   if (name === "可能诊断") {
-
-    if (percentage <= 25) {
-      signalStr = `<span class="signal"><img class="xhg4img" src="${xhg4img}"></span>`;
-    } else if (percentage <= 50) {
-      signalStr = `<span class="signal"><img class="xhg4img" src="${xhg3img}"></span>`;
-    } else if (percentage <= 75) {
-      signalStr = `<span class="signal"><img class="xhg3img" src="${xhg2img}"></span>`;
+    if (percentage <= 20) {
+      signalStr = `<span class="signal"><img class="xhg4img" src="${xhg1img}"></span>`;
+    } else if (percentage <= 40) {
+      signalStr = `<span class="signal"><img class="xhg4img" src="${xhg2img}"></span>`;
+    } else if (percentage <= 60) {
+      signalStr = `<span class="signal"><img class="xhg3img" src="${xhg3img}"></span>`;
     } else {
-      signalStr = `<span class="signal"><img class="xhg1img" src="${xhg1img}"></span>`;
+      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>`
+    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 ${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>`;
+  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>`
+    }
+    str += `<div class="pushItemBox-detail" >
+      <ul><li><span>症状表现:</span><p>${str1}</p></li></ul>
+    </div>`
+  }
   // $(".pushItemBox").css("display", "flex")
   return str;
 }