Ver código fonte

一对多添加量表评估内容

wyq 4 anos atrás
pai
commit
f1a025b742
4 arquivos alterados com 3638 adições e 1601 exclusões
  1. 171 0
      src/css/staticInfoOut.less
  2. 12 0
      src/html/staticInfoOut.html
  3. 184 3
      src/js/staticInfoOut.js
  4. 3271 1598
      src/response_1624414026017.json

+ 171 - 0
src/css/staticInfoOut.less

@@ -375,3 +375,174 @@ div,li,span,i,p,h1,h2,h3,h4,h5,pre{
   background: #f0f2f5;
   opacity: .2;
 }
+
+.scaletitle{
+  font-size: 20px;
+  font-weight: 500;
+  color: #333333;
+  line-height: 28px;
+  margin: 30px 0 8px 0;
+  text-align: center;
+}
+.scaleBox{
+  border-bottom: none;
+}
+.contentList{
+  max-width: 100%;
+  border-bottom: 1PX solid #F3F3F3;
+  margin-bottom: 6px;
+  .item-list{
+    padding: 0 21px;
+    .item-title{
+      font-size: 14px;
+      font-weight: 400;
+      color: #333333;
+      line-height: 20px;
+      margin-top: 14px;
+    }
+    .item-content{
+      margin: 10px 0;
+      display: flex;
+      flex-flow: wrap;
+      .radio {
+        display: flex;
+        margin: 5px;
+        margin-right: 25px;
+        label{
+          display: flex;
+          align-items: center;
+          font-weight: 400;
+          color: #666666;
+          line-height: 20px;
+          & input{
+            margin-right: 6px;
+          }
+          .num{
+            margin-left: 10px;
+          }
+        }
+        .recommend{
+          width: 18px;
+          height: 18px;
+        }
+      } 
+    }
+  }
+}
+.scalebot{
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+  margin-bottom: 44px;
+  .but{
+    width: 94px;
+    height: 34px;
+    background: #FFFFFF;
+    border-radius: 8px;
+    border: 1px solid #2A9BD5;
+    font-size: 16px;
+    font-weight: 400;
+    color: #2A9BD5;
+  }
+  .score{
+    font-size: 16px;
+    font-weight: 400;
+    color: #333333;
+    margin-right: 30px;
+    display: none;
+  }
+}
+.result{
+  height: 72px;
+  background: #EDFAFF;
+  border-radius: 10px;
+  font-size: 14px;
+  font-weight: 500;
+  color: #333333;
+  text-align: center;
+  display: none;
+  margin: 0 6.5%;
+  .result_box{
+    height: 72px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    padding:  0 20px;
+    .hel{
+      width: 21px;
+      height: 21px;
+      background: #2C96E5;
+      border-radius: 50%;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      color: #fff;
+      margin-right: 9px;
+      font-size: 12px;
+    }
+  }
+  
+}
+.result_title{
+  max-width: 85%;
+  overflow: hidden;
+  text-overflow:ellipsis;
+  white-space: nowrap;
+}
+.foot{
+  margin-bottom: 20px;
+  margin-top: 40px;
+  display: none;
+  .foot_box{
+    display: flex;
+    justify-content: center;
+    .printing{
+      display: flex;
+      align-items: center;
+      justify-content: space-around;
+      width: 94px;
+      height: 32px;
+      background: #FFFFFF;
+      border-radius: 4px;
+      border: 1px solid #333333;
+      cursor: pointer;
+    }
+    .printing:hover{
+      background: #2C96E5;
+      color: #fff;
+      border:1px solid #2C96E5;
+    }
+    .copy{
+      width: 132px;
+      height: 32px;
+      background: #FFFFFF;
+      border-radius: 4px;
+      border: 1px solid #333333;
+      text-align: center;
+      line-height: 32px;
+      margin-left: 38px;
+      cursor: pointer;
+    }
+    .copy:hover{
+      background: #2C96E5;
+      color: #fff;
+      border:1px solid #2C96E5;
+    }
+  }
+  
+}
+#inputs{
+  position: absolute;top: 0;left: 0;opacity: 0;z-index: -10;
+}
+.scale{
+  .infos-box{
+    border: 1px solid #E6E6E6;
+    margin: 0 71px 20px 38px;
+    .infoWrapper {
+      padding: 0 75px;
+    }
+    .scalebot{
+      padding-right: 75px;
+    }
+  }
+}

+ 12 - 0
src/html/staticInfoOut.html

@@ -57,6 +57,18 @@
         </div>
     </div>
   </div>
+  <div class=" container disCopy scale">
+    <div class="content">
+      <div class="infos" id="Print">
+        <div class="infos-box"></div>
+      </div>
+      <div class="anchors">
+        <div class="a-circle"></div>
+        <ul></ul>
+        <div class="a-circle"></div>
+      </div>
+    </div>
+  </div>
 <div class="footer">
     <p>免责声明:本知识库提供的医学静态知识仅供医生学习参考。</p>
     <p>版权所有:杭州朗通信息技术有限公司      浙ICP备:16000400号-2</p>

+ 184 - 3
src/js/staticInfoOut.js

@@ -16,6 +16,10 @@ const {
   openNewWin
 } = require('./promise.js');
 const $ = require("jquery");
+require("./jquery-migrate");
+const jqprint = require("../js/jquery.PrintArea")
+let printing = require('./../images/printing.png');
+let printing2 = require('./../images/printing2.png');
 let showName,noticeName,clinicalPathwayName,showLis=[],selectedDrop=0,selectedTab=0
 
 //如果是子窗口,隐藏网页查看按钮
@@ -83,20 +87,24 @@ function showEmpty(){
 }
 function showInfo(data){
   var detailList = data.details
+  var scale = data.scale
   var staticKnowList = detailList['静态知识']
   var noticeInfo = detailList['注意事项']
   var clinicalPathwayInfo = detailList['临床路径']
+  var name = data.name
   noticeName = data.noticeName || "注意事项"
   clinicalPathwayName = data.clinicalPathwayName || "临床路径"
+  var scaleInfo = data.scale ? data.scale.scaleDetails : ''
   // $("h1").css({
   //   "color": "#267FD7",
   //   "borderBottom": "4px solid  #E9E9E9",
   //   "padding": "0px 60px 50px 0px"
   // });
-  renderTab(detailList)
+  renderTab(detailList, scale)
   staticKnowList&&renderContent(staticKnowList,'staticKnowledge')
   noticeInfo&&renderContent(noticeInfo,'notice')
   clinicalPathwayInfo&&renderContent(clinicalPathwayInfo,'clinicalPathway')
+  scaleInfo && renderContentscale(scaleInfo, 'scale', name)
 }
 function showInfoSelect(){
   $('.showWhich li').click(function(){
@@ -164,7 +172,177 @@ function renderContent(list, contentWrapClassName){
     adjustWidth()
 }
 
+function renderContentscale(list, contentWrapClassName, name) {
+  var pushInfo = []
+  anchors = '<li><i></i><a href="#' + contentWrapClassName +
+    '">' + name + '</a></li><li class="anchor-line"></li>';
+  str = '<p class="scaletitle">' + name + '</p>'
+  $(`.${contentWrapClassName} .infos .infos-box`).append(str);
+  $(`.${contentWrapClassName} .anchors ul`).append(anchors);
+  for (var i = 0; i < list[0].detailList.length; i++) {
+    var item = list[0].detailList[i];
+    if (item.textType == 11) {
+      item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
+      str = '<div class="infoBox scaleBox"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
+        '">'
+      str += item.content
+      str += '</h2></div>'
+      str = `<div class="infoWrapper">${str}</div>`
+      $(`.${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 = '<div class="contentList"><div class="item-list">';
+          str += '<p class="item-title">' + it.content + '</p>'
+          str += '<div class="item-content" data-id="' + it.id + '">'
+          str += '</div></div></div>'
+          $(`.${contentWrapClassName} .infos .infos-box .infoWrapper .infoBox`).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 = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
+            str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.score + '" />'
+            str += its.content
+            str += '<span class="num">' + '(' + its.score + ')' + '</span>'
+            str += '</label>'
+            str += `${item.match ? `<img class="recommend" src=${recommend} />` : ``}</div>`
+            $(".scale .infos .infos-box .infoWrapper .infoBox .contentList .item-content[data-id=" + its.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 = '<div class="scalebot">'
+  str += '<p class="score"></p>'
+  str += '<button class="but">结果</button></div>'
+  str += '<div class="result"><div class="result_box"><p class="hel">?</p><span>结果:</span><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>'
+  str += `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
+  $(`.${contentWrapClassName} .infos .infos-box`).append(str);
+  // str = `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
+  // $(`.${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));
+  addLinkClickEvent(contentWrapClassName);
+  adjustHeight();
+  adjustWidth()
+  getcheck()
+  getResult(pushInfo)
+  copy()
+  getprinting()
+}
 
+function getprinting() {
+  $('.printing').click(function () {
+    $('.foot').hide()
+    $('.hel').hide()
+    $('#Print').css({
+      'height': 'auto', //高度自动
+    }).jqprint();
+    $('.foot').show()
+    $('.hel').show()
+
+  })
+
+}
+
+function getcheck() {
+  $('input:radio').click(function () {
+    var domName = $(this).attr('name');
+    var $radio = $(this);
+    if ($radio.data('waschecked') == true) {
+      $radio.prop('checked', false);
+      $("input:radio[name='" + domName + "']").data('waschecked', false);
+    } else {
+      $radio.prop('checked', true);
+      $("input:radio[name='" + domName + "']").data('waschecked', false);
+      $radio.data('waschecked', true);
+    }
+    console.log("选中状态:", $(this).prop("checked"));
+    console.log($("input:radio[name='" + domName + "']:checked").val());
+  });
+}
+
+function copy() {
+  $(".copy").click(function () {
+    var texts = document.getElementById("result_title").innerText;
+    var inputs = document.getElementById("inputs");
+    inputs.value = texts; // 修改文本框的内容(赋值内容)
+    inputs.select(); // 选中文本
+    document.execCommand("copy"); // 执行浏览器复制命令
+    Toast('复制成功', 500)
+    setTimeout(() => {
+      window.close()
+    }, 500)
+
+  })
+
+}
+
+function getResult(pushInfo) {
+
+  $(".but").click(function () {
+    let arr = [];
+    let num = 0
+    $(".contentList").each(function (i) {
+      if (Number(parseFloat($(this).find('input[type="radio"]:checked').val()))) {
+        num += parseFloat($(this).find('input[type="radio"]:checked').val())
+      }
+    })
+    for (var i = 0; i < pushInfo.length; i++) {
+      console.log(pushInfo[i])
+      if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
+        $(".result_title").attr({
+          "title": pushInfo[i].result
+        });
+        $(".hel").attr({
+          "title": pushInfo[i].pushInfo
+        });
+
+        $(".result_title").html(pushInfo[i].result);
+      }
+    }
+    $(".score").html('总分:' + num + '分');
+    $(".score").css('display', 'block')
+    $(".result").css('display', 'block')
+    $(".foot").css('display', 'block')
+
+  })
+
+  $(".printing").hover(
+    function () {
+      $(".slideImg").attr("src", printing2);
+    }, function () {
+      $(".slideImg").attr("src", printing);
+
+    });
+
+}
 
 function addLinkClickEvent(contentWrapClassName) {
   $(`.${contentWrapClassName} .anchors li:first`).addClass("active");
@@ -179,7 +357,7 @@ function addLinkClickEvent(contentWrapClassName) {
   });
 }
 
-function renderTab(detailList){
+function renderTab(detailList, scale){
   $(".tabList").html('')
   if(detailList['静态知识']){
     $(".tabList").append(`<span class="tab" data-module="staticKnowledge" data-title="`+showName+`">静态知识</span>`)
@@ -193,7 +371,10 @@ function renderTab(detailList){
     $(".tabList").append(`<span class="tab" data-module="notice" data-title="`+noticeName+`">注意事项</span>`)
     //$(".titleCont .title").html(noticeName);
   }
-
+  if (scale) {
+    $(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
+    //$(".tabBox .title").html(noticeName);
+  }
   $(".tabList .tab").eq(selectedTab).addClass("activeTab")
   let defaultModuleName = $(".tabList .tab").eq(selectedTab).attr("data-module")
   $(`.${defaultModuleName}`).css("display","block")

Diferenças do arquivo suprimidas por serem muito extensas
+ 3271 - 1598
src/response_1624414026017.json