瀏覽代碼

新增静态知识一对多

luolei 4 年之前
父節點
當前提交
271dcb690c
共有 6 個文件被更改,包括 571 次插入1 次删除
  1. 282 0
      src/css/informationOut.less
  2. 65 0
      src/html/informationOut.html
  3. 二進制
      src/images/d.png
  4. 208 0
      src/js/informationOut.js
  5. 1 0
      src/js/promise.js
  6. 15 1
      webpack.config.js

+ 282 - 0
src/css/informationOut.less

@@ -0,0 +1,282 @@
+* {
+    margin: 0;
+    padding: 0;
+  }
+
+  ul,
+  li {
+    list-style: none;
+  }
+
+  table {
+    border-collapse: collapse;
+    border-spacing: 0;
+  }
+
+  body {
+    font-size: 14px;
+    overflow-y: hidden;
+    font-family: '微软雅黑', '宋体';
+    background: #dde2ea;
+    height: 100%;
+    color: #1E1E1E;
+    line-height: 21px;
+  }
+
+  h1 {
+    margin: 0 0px 25px 0px !important;
+    font-size: 22px !important;
+    line-height: 37px;
+    padding: 0 0 0 40px;
+  }
+
+  .titleH2 {
+    font-size: 16px;
+    position: relative;
+    background: #fff;
+    padding-right: 6px;
+    font-weight: bold;
+    line-height: 30px;
+  }
+
+  .content {
+    position: relative;
+    height: 550px;
+  }
+  .infoBox {
+    border-left: 1px solid #969C9F;
+    padding: 0 0 0 33px;
+    margin: 0 0 20px 0;
+  }
+  .infoWrapper {
+    padding: 0 0 0 40px;
+  }
+  .circleBox {
+    position: absolute;
+    z-index: 10;
+    background: #fff;
+    left: -40px;
+    height: 32px;
+    top: -1px;
+  }
+  .circle {
+    display: inline-block;
+    *display:inline;
+    *zoom:1;
+    width: 10px;
+    height: 10px;
+    border-radius: 50%;
+    background: #3B9ED0;
+    position: relative;
+    top: 2px;
+  }
+  .infos {
+    height: 100%;
+    overflow-y: auto;
+    padding: 0 60px 0 0;
+  }
+
+  .infos>div {
+    margin-right: 160px;
+  }
+
+  .title {
+    position: relative;
+    line-height: 24px;
+    
+    margin: 0 0 13px;
+  }
+
+  .line {
+    border-bottom: 1px dashed #ccc;
+  }
+
+  .container {
+    width:100%;
+    overflow: hidden;
+    background: #fff;
+    margin: 0 auto;
+    padding: 40px 0 0px 0px;
+    display: none;
+    position: relative;
+    left: 0;
+    right: 0;
+  }
+
+  pre {
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    color: #1E1E1E;
+  }
+  .anchors {
+    width: 200px;
+    position: absolute;
+    right:15px;
+    top: 0;
+    margin-right: 14px;
+    overflow: auto;
+    height: 100%;
+  }
+
+  .anchors ul {
+    padding: 15px 0px 15px 20px;
+    border-radius: 4px;
+    border: 1px solid #F5F6F7;
+    background-color: #F5F6F7;
+    line-height: 19px;
+  }
+
+  .anchors li {
+    position: relative;
+    border-left: 2px solid #E0E2E3;
+  }
+
+  .anchors .anchor-line {
+    height: 20px;
+    width: 0;
+    border-left: 2px solid #E0E2E3;
+  }
+
+  .anchors .anchor-line:last-child {
+    display: none;
+  }
+
+  .anchors i {
+    position: absolute;
+    display: inline-block;
+    width: 8px;
+    height: 8px;
+    border-radius: 5px;
+    border: 1px solid #E0E2E3;
+    background-color: #E0E2E3;
+    left: -6px;
+    top: 5px;
+  }
+
+  .anchors a {
+    display: inline-block;
+    position: relative;
+    top: 0;
+    left: 0;
+    width: 132px;
+    padding: 0 0px 0 20px;
+    text-decoration: none;
+    font-size: 14px;
+    font-weight: 400;
+    color: #777;
+    word-wrap: break-word;
+  }
+
+  .anchors .active a {
+    color: #3B9ED0 !important;
+    font-weight: 700 !important;
+  }
+
+  .anchors .active i {
+    width: 16px;
+    height: 16px;
+    top: 1px;
+    left: -8px;
+    border-radius: 0;
+    border: none;
+    background-color: #F5F6F7;
+    background: url('../images/icon_current.png') center center no-repeat;
+  }
+
+  a:visited {
+    color: #777;
+  }
+  .disCopy {
+    -webkit-touch-callout: none;
+    -webkit-user-select: none;
+    -khtml-user-select: none;
+    -moz-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+  }
+  .tabBox{
+    position: relative;
+    background: #fff;
+    height: 95px;
+    border-bottom: 1px solid #E6E6E6;
+    padding: 0 40px;
+  }
+  .showWhich {
+    width: 94px;
+    text-align: center;
+    padding-top: 16px;
+    position: absolute;
+    z-index: 20;
+    img {
+      width: 8px;
+      position: absolute;
+      top: 29px;
+      left: 76px;
+    }
+    .showWhichSelect {
+      border-radius: 4px;
+      background: #E2F1F8;
+      height: 32px;
+      line-height: 32px;
+      display: inline-block;
+      width: 100%;
+      padding-right: 20px;
+      padding-left: 10px;
+      box-sizing: border-box;
+      cursor: pointer;
+    }
+    ul {
+      display: none;
+      position: absolute;
+      left: -9px;
+      top: 48px;
+      z-index: 10;
+      background-color: #fff;
+      width: 110px;
+      box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.18);
+      border-radius: 4px;
+      border: 1px solid #E6E6E6;
+      li {
+        height: 35px;
+        line-height: 35px;
+        white-space: nowrap;/*强制在一行显示*/
+        text-overflow:ellipsis;/*设置超出内容显示...*/
+        overflow: hidden;/*一定不能少 超出的内容进行隐藏*/
+        padding:0 20px;
+        cursor: pointer;
+        &:hover {
+          background-color: #E2F1F8;
+        }
+      }
+    }
+  }
+  .tabList{
+    position: absolute;
+    bottom: 0;
+  }
+  .tab{
+    display: inline-block;
+    padding: 7px 18px;
+    margin-right: 5px;
+    background: #EEEEEE;
+    border-radius:6px 6px 0px 0px;
+    cursor: pointer;
+    font-size: 14px;
+    color: #333;
+  }
+  .activeTab{
+    background: #3B9ED0;
+    color: #fff;
+  }
+  .ql-align-right{
+    text-align: right;
+  }
+  .ql-align-center{
+    text-align: center;
+  }
+  
+.ellipsis{
+  white-space: nowrap;/*强制在一行显示*/
+  text-overflow:ellipsis;/*设置超出内容显示...*/
+  overflow: hidden;/*一定不能少 超出的内容进行隐藏*/
+}

File diff suppressed because it is too large
+ 65 - 0
src/html/informationOut.html


二進制
src/images/d.png


+ 208 - 0
src/js/informationOut.js

@@ -0,0 +1,208 @@
+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
+  })
+}
+require('../css/informationOut.less')
+const {
+  post,
+  throttle,
+  imageUrlPrefix,
+  config,
+  getUrlArgObject
+} = require('./promise.js');
+const $ = require("jquery");
+let showName,noticeName,clinicalPathwayName,showLis=[]
+
+let icond = require('./../images/d.png').replace(/^undefined/g, '')
+function getInfomation() {
+  // var param = {
+  //   "type": getUrlArgObject('type'),
+  //   "name": getUrlArgObject('name'),
+  //   "position": getUrlArgObject('position'),
+  //   "contentTypes":[1,2,3]
+  // };
+  var param = {
+    "type": getUrlArgObject('type'),
+    "hospitalId": getUrlArgObject('hospitalId'),
+    "hisName": getUrlArgObject('hisName'),
+    "hisDetailName": getUrlArgObject('hisDetailName'),
+    "contentTypes":[1,2,3]
+  };
+  const uname = getUrlArgObject('uname')
+  // showName = param.name
+  // if (param.type == 5 || param.type == 51) {
+  //   param.type = 12;
+  //   param.name = uname;
+  // }
+
+  post(config.getStaticKnowledgeForHIS, param).then((res) => {
+    const data = res.data.data
+    var str = '';
+    var anchors = '';
+    if (!data||data.length==0) {
+      $("h1").html("暂时没有数据");
+      $(".anchors").css("display", "none");
+      return;
+    }
+    showLis=data
+    for(let i = 0;i < showLis.length;i++){
+      let tmp = showLis[i]
+      str+=`<li data-idx="${i}" title="${tmp.name}">${tmp.name}</li>`
+    }
+    $(".showWhich ul").html(str)
+    $(".showWhichSelect").html(showLis[0].name).attr("title",showLis[0].name)
+    showName = data[0].name
+    document.title = showName
+    showInfoSelect()
+    showInfo(data[0])
+    $('.content img').bind('contextmenu', function(){
+      return false
+    })
+   
+  })
+}
+getInfomation();
+
+function showInfo(data){
+  var detailList = data.details
+  var staticKnowList = detailList['静态知识']
+  var noticeInfo = detailList['注意事项']
+  var clinicalPathwayInfo = detailList['临床路径']
+  noticeName = data.noticeName || "注意事项"
+  clinicalPathwayName = data.clinicalPathwayName || "临床路径"
+  // $("h1").css({
+  //   "color": "#267FD7",
+  //   "borderBottom": "4px solid  #E9E9E9",
+  //   "padding": "0px 60px 50px 0px"
+  // });
+  renderTab(detailList)
+  staticKnowList&&renderContent(staticKnowList,'staticKnowledge')
+  noticeInfo&&renderContent(noticeInfo,'notice')
+  clinicalPathwayInfo&&renderContent(clinicalPathwayInfo,'clinicalPathway')
+}
+function showInfoSelect(){
+  $('.showWhich li').click(function(){
+    let idx = $(this).attr('data-idx')
+    let name = $(this).html(),str=''
+    showName = showLis[idx].name
+    document.title = showName
+    showInfo(showLis[idx])
+    $('.content .infos').scrollTop(0)
+    $(".showWhich ul").css("display","none")
+    $(".showWhichSelect").html(name).attr("title",name)
+  })
+  $(".showWhichSelect").click(function(e){
+    e.stopPropagation()
+    $(".showWhich ul").slideToggle()
+  })
+  $(document).click(function(){
+    $(".showWhich ul").css("display","none")
+  })
+}
+function renderContent(list, contentWrapClassName){
+  $(`.${contentWrapClassName} .infos`).html('');
+  $(`.${contentWrapClassName} .anchors ul`).html('');
+    for (var i = 0; i < list.length; i++) {
+        var item = list[i];
+        item.content = item.content&&item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
+        anchors = '<li><i></i><a href="#' + contentWrapClassName+i +
+          '">' + item.title + '</a></li><li class="anchor-line"></li>';
+        str = '<div class="infoBox"><div class="title"> <div class= "circleBox"><span class="circle"> </span></div> <h2 class="titleH2" id="' + contentWrapClassName+i +
+          '">'
+        if (getUrlArgObject('type') == 8) {
+          str += '【' + item.title + '】'
+        } else {
+          str += item.title
+        }
+        str += '</h2></div>' +
+          '<div class="contentWrapper"><pre>' + item.content + '</pre><div></div>';
+          str = `<div class="infoWrapper">${str}</div>`
+        $(`.${contentWrapClassName} .infos`).append(str);
+        $(`.${contentWrapClassName} .anchors ul`).append(anchors);
+    }
+
+    function addScrollEvent() {
+      var scrollTop = $(`.${contentWrapClassName} .infos`).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`).scroll(throttle(addScrollEvent, 200));
+    addLinkClickEvent(contentWrapClassName);
+    adjustHeight();
+    adjustWidth()
+}
+
+
+
+function addLinkClickEvent(contentWrapClassName) {
+  $(`.${contentWrapClassName} .anchors li:first`).addClass("active");
+  $(`.${contentWrapClassName}  .anchors li>a`).on("click", function () {
+
+    const that = this
+    setTimeout(function(){
+      $(`.${contentWrapClassName} .anchors .active`).removeClass('active');
+      $(that).parent().addClass("active");
+    },20)
+
+  });
+}
+
+function renderTab(detailList){
+  $(".tabList").html('')
+  if(detailList['静态知识']){
+    $(".tabList").append(`<span class="tab" data-module="staticKnowledge">静态知识</span>`)
+    $(".staticKnowledge h1").html(showName);
+  }
+  if(detailList['临床路径']){
+    $(".tabList").append(`<span class="tab" data-module="clinicalPathway">临床路径</span>`)
+    $(".clinicalPathway h1").html(clinicalPathwayName);
+  }
+  if(detailList['注意事项']){
+    $(".tabList").append(`<span class="tab" data-module="notice">注意事项</span>`)
+    $(".notice h1").html(noticeName);
+  }
+  $(".tabList .tab").eq(0).addClass("activeTab")
+  let defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
+  $(`.${defaultModuleName}`).css("display","block")
+  bindTabClick()
+}
+function bindTabClick(){
+  $(".tabList .tab").on("click", function(){
+    const moduleName = $(this).attr("data-module")
+    const display = $(`.${moduleName}`).css("display")
+    if(display == "none"){
+      $(".activeTab").removeClass("activeTab")
+      $(this).addClass("activeTab")
+      $(".container").css("display","none")
+  
+      $(`.${moduleName}`).css("display","block")
+      $(`.${moduleName} .infos`).scrollTop(0)
+    }
+  })
+}
+function adjustHeight() {
+  var ht = window.innerHeight || document.documentElement.clientHeight;
+  $(".content").height(ht - 145 - 30 + "px");
+}
+function adjustWidth() {
+  var wt = window.innerWidth || document.documentElement.clientWidth;
+  $(".titleH2").width(wt- 0.2*wt -33 - 200 - 17 - 40 -15 + 'px')
+  $("pre").width(wt- 0.2*wt - 200 + 'px')
+}
+$(window).on('resize', function(){
+  adjustHeight()
+  adjustWidth()
+})
+

+ 1 - 0
src/js/promise.js

@@ -53,6 +53,7 @@ const config = {
   calculate: '/api/data/calc/calculate',
   disclaimer: '/sys/disclaimerInfo/getDisclaimerInfo',
   information: '/graph/conceptInfo/getStaticKnowledge',
+  getStaticKnowledgeForHIS:'/graph/conceptInfo/getStaticKnowledgeForHIS', //对接一对多
   informationMore: '/api/data/conceptDetail/getConceptDetails',
   pushScale: '/api/data/push/pushScale',
   getSysSetInfoDatas: '/sys/plan/getSysPlanInfoDatas',

+ 15 - 1
webpack.config.js

@@ -4,12 +4,13 @@ const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
 const webpack = require('webpack');
-const proxyHost = "http://192.168.2.241:6060";
+const proxyHost = "http://192.168.2.236:6060";
 module.exports = {
   entry: {
     index: path.resolve(__dirname, 'src/js', 'index.js'),
     page: path.resolve(__dirname, 'src', 'page.js'),
     information: path.resolve(__dirname, 'src/js', 'information.js'),
+    informationOut: path.resolve(__dirname, 'src/js', 'informationOut.js'),
     disclaimer: path.resolve(__dirname, 'src/js', 'disclaimer.js'),
     version: path.resolve(__dirname, 'src/js', 'version.js'),
     scale: path.resolve(__dirname, 'src/js', 'scale.js'),
@@ -155,6 +156,19 @@ module.exports = {
         collapseWhitespace: true //删除空白符与换行符
       }
     }),
+    new HtmlWebpackPlugin({
+      title: 'informationOut',
+      template: path.resolve(__dirname, 'src/html', 'informationOut.html'),
+      filename: 'informationOut.html',
+      chunks: ['informationOut', 'vendor', 'common'],
+      inject: true,
+      hash: true, //防止缓存
+      minify: {
+        removeAttributeQuotes: true, //压缩 去掉引号
+        removeComments: true, //移除HTML中的注释
+        collapseWhitespace: true //删除空白符与换行符
+      }
+    }),
     new HtmlWebpackPlugin({
       title: 'drugInfo',
       template: path.resolve(__dirname, 'src/html', 'drugInfo.html'),