Переглянути джерело

静态知识搜索,右侧为空全部展开

luolei 5 роки тому
батько
коміт
4ba1a41a7a

+ 7 - 0
src/css/indexHorizontal.less

@@ -371,3 +371,10 @@
 .medicineWaringDis:hover {
 color: @grayColor;
 }
+
+.staticWin {
+    text-decoration: underline;
+    cursor: pointer;
+    position: relative;
+    margin: 10px 0 0 0;
+}

+ 9 - 3
src/css/indexVert.less

@@ -35,7 +35,7 @@
     }
 }
 
-.treatRecommend {
+.treatRecommend,.knowledgeInfo,.scaleInfo {
     h4 {
         background-color: #E3FEFE;
     }
@@ -54,10 +54,10 @@
 }
 
 .recommendInfoBox {
-    padding: 17px;
+    padding: 4px 17px;
 }
 
-.treatRecommend h4 i {
+.treatRecommend h4 i,.knowledgeInfo h4 i,.scaleInfo h4 i {
     background: url(/images/zhiliao.png) center center no-repeat;
 }
 .tipsInfo h4 i {
@@ -361,4 +361,10 @@
   }
 .medicineWaringDis:hover {
     color: @grayColor;
+}
+
+.staticWin {
+    color: #040428;
+    text-decoration: underline;
+    cursor: pointer;
 }

+ 11 - 3
src/js/index.js

@@ -7,7 +7,8 @@ var Promise = require("bluebird");
 const $ = require("jquery");
 const { post,config,getUrlArgObject,openNewWin } = require('./promise.js');
 const { transConf } = require('./util.js');
-const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo } = require('./indexVertDom.js');
+const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo ,renderKnowledgeInfo,renderScaleInfo} = require('./indexVertDom.js');
+
 
 let mrId = getUrlArgObject('mrId') 
 let msg;
@@ -78,7 +79,7 @@ function getTipsInfo() {
 function getPageInfo() {
 
   Promise.all([getConf(),getPushInfo(),getTreatment(),getTipsInfo()]).then(([res1, res2, res3, res4]) =>{
-    console.log({res1, res2, res3, res4})
+    // console.log({res1, res2, res3, res4})
     const configArr = res1&&res1.data&&res1.data.data || []
     const pushInfo = res2&&res2.data || {}
     const treatInfo = res3&&res3.data || {}
@@ -113,6 +114,7 @@ function getPageInfo() {
     window.pushMessage = medicalIndications;//计算的需要的相关数据
 
     for(let i = 0; i < confArr.length; i++) {
+
       switch(confArr[i].code) {
         case "inquiry_show":  //问诊症状
           renderRecommendInfo('symptomRecommend', '问诊症状', symptomRecommend, false)
@@ -139,8 +141,14 @@ function getPageInfo() {
           renderTipsInfo('tipsInfo','提示信息',tipsResult)
           moreInfo()
           break;
+        case "knowledge_show": //医学知识
+          renderKnowledgeInfo('knowledgeInfo','医学知识','点击搜索医学知识')
+          break;
+        case "scale_show": //全部量表
+          renderScaleInfo('scaleInfo','全部量表','点击搜索全部量表')
+          break;
         default:
-           return
+          break
       } 
     }
   }).catch(function (err) {

+ 18 - 3
src/js/indexHorizontal.js

@@ -14,7 +14,7 @@ let treatImg = require('./../images/zhiliao.png')
 const $ = require("jquery");
 const { post,config,getUrlArgObject,openNewWin, isIe8 } = require('./promise.js');
 const { transConf } = require('./util.js');
-const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo } = require('./indexHorizontalDom.js');
+const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo ,renderKnowledgeInfo,renderScaleInfo} = require('./indexHorizontalDom.js');
 const is8Ie = isIe8() //判断是否为IE8
 if(is8Ie) {
   let reg = /undefined/g
@@ -155,8 +155,16 @@ function getPageInfo() {
           renderTipsInfo('', 'tipsInfo','提示信息',tipsResult)
           moreInfo()
           break;
+        case "knowledge_show": //医学知识
+          tipsNum++;
+          renderKnowledgeInfo('','knowledgeInfo','医学知识','点击搜索医学知识')
+          break;
+        case "scale_show": //全部量表
+          tipsNum++;
+          renderScaleInfo('','scaleInfo','全部量表','点击搜索全部量表')
+          break;
         default:
-           return
+          break;
       } 
     }
     
@@ -167,6 +175,7 @@ function getPageInfo() {
       } else {
         $('.infoTabBox .treatTab').addClass('activeTab')
         $('.infomationBox .tipsInfo').css("display","none")
+        $('.infomationBox .staticWin').css("display","none")
       }
 
       $('.infomationBox .infoTab').click(function() {
@@ -177,8 +186,14 @@ function getPageInfo() {
       })
     
     }
-    if(tipsNum === 2) {
+    if(tipsNum > 1) {
       bindTab();
+    }else if(tipsNum == 0){
+      $('.push').css({
+        "width":"95%",
+        "border-right":"0 none"
+      })
+      $('.itemAllBox').css({"width":"98%"})
     }
     function moreInfo() {
       $('.moreInfo').click(function(){

+ 28 - 4
src/js/indexHorizontalDom.js

@@ -111,6 +111,26 @@ function renderTreat(icon, className,title, data) {
     renderTreatText('commonTreatment', '一般治疗', commonTreatmentInfo, className+'box')
     renderTreatDrug('drugTreatment', '药物治疗', treatmentList, className+'box')
 }
+function renderKnowledgeInfo(icon, className,title, data) {
+    $('.infoTabBox').append(`<span class="infoTab tipsTab"  data-box="${className}">${title}</span>`)
+    const str = `<div class="informationBox staticWin recommendInfoWrapper ${className} clearfix">
+                    <p class="diagName">${data}</p>
+                </div>`
+    $('.infomationBox').append(str)
+    $('.'+className+'.staticWin' ).on('click', function(){
+        openNewWin(`staticSearch.html?type=1`)
+    })
+}
+function renderScaleInfo(icon, className,title, data) {
+    $('.infoTabBox').append(`<span class="infoTab tipsTab"  data-box="${className}">${title}</span>`)
+    const str = `<div class="informationBox staticWin recommendInfoWrapper ${className} clearfix">
+                    <p class="diagName">${data}</p>
+                </div>`
+    $('.infomationBox').append(str)
+    $('.'+className+'.staticWin' ).on('click', function(){
+        openNewWin(`staticSearch.html?type=2&msg=${encodeURIComponent(JSON.stringify(msg))}`)
+    })
+}
 
 function renderTreatText(className,title,data, parentNode) {
     const childrenNodeBoxStr = `
@@ -316,9 +336,11 @@ function renderRecommendConditTips(icon, className,title,data) {
 function slideToggle(className){//展开收起
     const domName = $(className)
     const domNameBoxAll = $(className+'All')
-    if(domName.height() > 20){
-      domName.append(`<span class="slideDown"><img src="${showImg}"></span>`)
-    }
+    setTimeout(() => {
+        if(domName.height() > 20){
+          domName.append(`<span class="slideDown"><img src="${showImg}"></span>`)
+        }
+    });
     domName.on('click',".slideDown",function(){
         $(".itemAllBox").css('display', 'none')
         $(domNameBoxAll).css('display', 'block')
@@ -338,5 +360,7 @@ module.exports = {
     renderMultRecommendInfo,
     renderTreat,
     renderRecommendConditTips,
-    renderTipsInfo
+    renderTipsInfo,
+    renderKnowledgeInfo,
+    renderScaleInfo
 }

+ 26 - 1
src/js/indexVertDom.js

@@ -74,6 +74,29 @@ function renderTipsInfo(className,title, data) {
     }
 }
 
+function renderKnowledgeInfo(className,title, data) {
+    const str = `<div class="recommendInfoWrapper ${className}">
+                    <h4><i></i>${title}</h4>
+                    <div class="recommendInfoBox clearfix ${className + 'box'}"></div>
+                </div>`
+    $('.recommendWrap').append(str)
+    $('.' + className+'box').append('<p class="TipsInfoNull staticWin">'+data+'</p>')
+    $('.'+className+' .staticWin' ).on('click', function(){
+        openNewWin(`staticSearch.html?type=1`)
+    })
+}
+function renderScaleInfo(className,title, data) {
+    const str = `<div class="recommendInfoWrapper ${className}">
+                    <h4><i></i>${title}</h4>
+                    <div class="recommendInfoBox clearfix ${className + 'box'}"></div>
+                </div>`
+    $('.recommendWrap').append(str)
+    $('.' + className+'box').append('<p class="TipsInfoNull staticWin">'+data+'</p>')
+    $('.'+className+' .staticWin' ).on('click', function(){
+        openNewWin(`staticSearch.html?type=2&msg=${encodeURIComponent(JSON.stringify(msg))}`)
+    })
+}
+
 function renderTipsInfoMsg(className,title,data, parentNode) {
     const childrenNodeBoxStr = `
         <div class = "treatItemBox ${className + 'box'}">
@@ -361,5 +384,7 @@ module.exports = {
     renderMultRecommendInfo,
     renderTreat,
     renderRecommendConditTips,
-    renderTipsInfo
+    renderTipsInfo,
+    renderKnowledgeInfo,
+    renderScaleInfo
 }

+ 54 - 52
src/js/promise.js

@@ -3,12 +3,12 @@ const $ = require("jquery");
 var Promise = require('./rePromise');
 //重写assign方法
 if (typeof Object.assign != 'function') {
-  Object.assign = function(target) {
+  Object.assign = function (target) {
     'use strict';
     if (target == null) {
       throw new TypeError('Cannot convert undefined or null to object');
     }
- 
+
     target = Object(target);
     for (var index = 1; index < arguments.length; index++) {
       var source = arguments[index];
@@ -23,16 +23,25 @@ if (typeof Object.assign != 'function') {
     return target;
   };
 }
+
+window.console = window.console || (function () {
+  var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
+    = c.clear = c.exception = c.trace = c.assert = function () { };
+  return c;
+})();
+
 const config = {
-  pushInner:'/api/data/push/push',
-  calculate:'/api/data/calc/calculate',
+  pushInner: '/api/data/push/push',
+  calculate: '/api/data/calc/calculate',
   disclaimer: '/api/data/disclaimerInformation/getDisclaimerInformations',
   information: '/api/data/conceptDetail/getConceptDetail',
   pushScale: '/api/data/push/pushScale',
   pushTreatment: '/api/data/push/pushTreatment',
   getSysSetInfoDatas: '/api/data/sysSet/getSysSetInfoDatas',
   getMr: '/api/data/mr/getMr',
-  getVersion:'/api/data/versionInfo/getVersionInfoAlls',
+  getVersion: '/api/data/versionInfo/getVersionInfoAlls',
+  getStaticKnowledge: '/api/data/search/getStaticKnowledge',
+  getStaticScale: '/api/data/search/getScale',
 }
 const imageUrlPrefix = 'http://192.168.2.121:82';
 // const getUrlArgObject = function(parm) {  
@@ -41,42 +50,35 @@ const imageUrlPrefix = 'http://192.168.2.121:82';
 //   return args[parm];//返回对象  
 // } 
 
-
 const getUrlArgObject = function getQueryString(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
   var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
   var r = window.location.search.substr(1).match(reg);
   var q = window.location.pathname.substr(1).match(reg_rewrite);
-  if(r != null){
-  return decodeURIComponent(r[2]);
-  }else if(q != null){
-  return decodeURIComponent(q[2]);
-  }else{
-  return null;
-  }
-
-
-
-
-  
-
+  if (r != null) {
+    return decodeURIComponent(r[2]);
+  } else if (q != null) {
+    return decodeURIComponent(q[2]);
+  } else {
+    return null;
   }
+}
 
-const post = function(url,data){
-  return new Promise((resolve,reject)=>{
+const post = function (url, data) {
+  return new Promise((resolve, reject) => {
     $.ajax({
-      method:'post',
-      url:url,
-      data:JSON.stringify(data),
-      contentType:"application/json; charset=UTF-8",
-      beforeSend :function(xmlHttp){
-        xmlHttp.setRequestHeader("If-Modified-Since","0");
-        xmlHttp.setRequestHeader("Cache-Control","no-cache");
+      method: 'post',
+      url: url,
+      data: JSON.stringify(data),
+      contentType: "application/json; charset=UTF-8",
+      beforeSend: function (xmlHttp) {
+        xmlHttp.setRequestHeader("If-Modified-Since", "0");
+        xmlHttp.setRequestHeader("Cache-Control", "no-cache");
       },
-      success:function(res){
-        resolve({data:res});
+      success: function (res) {
+        resolve({ data: res });
       },
-      error:function(error){
+      error: function (error) {
         reject(error);
       },
     });
@@ -91,45 +93,45 @@ const newinConf = {
 }
 
 const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
-const openNewWin = function(url) {
+const openNewWin = function (url) {
   window.open(url, newinConf.openMode, newWindowLocation)
 }
 
 //判断浏览器是否为Ie8
-const isIe8 = function(){
+const isIe8 = function () {
   var DEFAULT_VERSION = 8.0;
   var ua = navigator.userAgent.toLowerCase();
-  var isIE = ua.indexOf("msie")>-1;
+  var isIE = ua.indexOf("msie") > -1;
   var safariVersion;
-  if(isIE){
-  safariVersion =  ua.match(/msie ([\d.]+)/)[1];
-  } 
-  if(safariVersion <= DEFAULT_VERSION ) {
+  if (isIE) {
+    safariVersion = ua.match(/msie ([\d.]+)/)[1];
+  }
+  if (safariVersion <= DEFAULT_VERSION) {
     return true
-  } 
+  }
 }
 
-const throttle =  function(fn, threshhold) {
+const throttle = function (fn, threshhold) {
   var timeout
   var start = new Date;
   var threshhold = threshhold || 160
   return function () {
- 
-  var context = this, args = arguments, curr = new Date() - 0
-  
-  clearTimeout(timeout)//总是干掉事件回调
-  if(curr - start >= threshhold){ 
+
+    var context = this, args = arguments, curr = new Date() - 0
+
+    clearTimeout(timeout)//总是干掉事件回调
+    if (curr - start >= threshhold) {
       // console.log("now", curr, curr - start)//注意这里相减的结果,都差不多是160左右
       fn.apply(context, args) //只执行一部分方法,这些方法是在某个时间段内执行一次
       start = curr
-  }else{
-  //让方法在脱离事件后也能执行一次
-      timeout = setTimeout(function(){
-         fn.apply(context, args) 
+    } else {
+      //让方法在脱离事件后也能执行一次
+      timeout = setTimeout(function () {
+        fn.apply(context, args)
       }, threshhold);
-     }
-   }
- }
+    }
+  }
+}
 
 module.exports = {
   config,

+ 7 - 3
src/js/util.js

@@ -5,7 +5,7 @@ const transConf = function(arr) {
     //     {hospitalCode: "A001", sysType: 16, name: "问诊症状", code: "inquiry_show", value: 1},
     //     {hospitalCode: "A001", sysType: 16, name: "体格检查", code: "health_show", value: 1},
     //     {hospitalCode: "A001", sysType: 16, name: "病情提示", code: "illness_show", value: 1},
-    //     {hospitalCode: "A001", sysType: 16, name: "治疗方案", code: "cure_show", value: 1},
+    //     {hospitalCode: "A001", sysType: 16, name: "治疗方案", code: "cure_show", value: 0},
     //     {hospitalCode: "A001", sysType: 16, name: "检验检查", code: "lispacs_show", value: 1},
     //     {hospitalCode: "A001", sysType: 16, name: "推荐诊断", code: "diagnose_no", value: 7},
     //     {hospitalCode: "A001", sysType: 16, name: "问诊症状", code: "inquiry_no", value: 1},
@@ -14,8 +14,12 @@ const transConf = function(arr) {
     //     {hospitalCode: "A001", sysType: 16, name: "治疗方案", code: "cure_no", value: 6},
     //     {hospitalCode: "A001", sysType: 16, name: "检验检查", code: "lispacs_no", value: 5},
     //     {hospitalCode: "A001", sysType: 16, name: "是否对接", code: "connect", value: 1},
-    //     {hospitalCode: null, sysType: 16, name: "警惕诊断", code: "vigilant_show", value: 1},
-    //     {hospitalCode: null, sysType: 16, name: "警惕诊断", code: "vigilant_no", value: 3}
+    //     {hospitalCode: "A001", sysType: 16, name: "医学知识", code: "knowledge_show", value: 0},
+    //     {hospitalCode: "A001", sysType: 16, name: "医学知识", code: "knowledge_no", value: 19},
+    //     {hospitalCode: "A001", sysType: 16, name: "全部量表", code: "scale_show", value: 0},
+    //     {hospitalCode: "A001", sysType: 16, name: "全部量表", code: "scale_no", value: 10},
+    //     {hospitalCode: "A001", sysType: 16, name: "警惕诊断", code: "vigilant_show", value: 1},
+    //     {hospitalCode: "A001", sysType: 16, name: "警惕诊断", code: "vigilant_no", value: 3}
     // ]
     const reg = /_show$/g;
     var newArr = arr.filter(item => item.code.match(reg) && item.value === 1 )

+ 15 - 1
webpack.config.js

@@ -4,7 +4,7 @@ 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.236:5050";
+const proxyHost = "http://192.168.2.241:5050";
 module.exports = {
   entry: {
     index: path.resolve(__dirname, 'src/js', 'index.js'),
@@ -16,6 +16,7 @@ module.exports = {
     illness: path.resolve(__dirname, 'src/js', 'illness.js'),
     treatplan: path.resolve(__dirname, 'src/js', 'treatplan.js'),
     indexHorizontal: path.resolve(__dirname, 'src/js', 'indexHorizontal.js'),
+    staticSearch: path.resolve(__dirname, 'src/js', 'staticSearch.js'),
     vendor: 'lodash'// 多个页面所需的公共库文件,防止重复打包带入
   },
   output: {
@@ -158,6 +159,19 @@ module.exports = {
         collapseWhitespace: true //删除空白符与换行符
       }
     }),
+    new HtmlWebpackPlugin({
+      title: 'staticSearch',
+      template: path.resolve(__dirname, 'src/html', 'staticSearch.html'),
+      filename: 'staticSearch.html',
+      chunks: ['staticSearch', 'vendor', 'common'],
+      inject: true,
+      hash: true, //防止缓存
+      minify: {
+        removeAttributeQuotes: true, //压缩 去掉引号
+        removeComments: true, //移除HTML中的注释
+        collapseWhitespace: true //删除空白符与换行符
+      }
+    }),
     new MiniCssExtractPlugin({
       filename: 'css/[name].css',
       chunkFilename: '[id].css'