Pārlūkot izejas kodu

Merge branch 'test' of http://192.168.2.236:10080/zhouna/icssDService into test

Luolei 6 gadi atpakaļ
vecāks
revīzija
a5e6d5e4d8

+ 21 - 2
src/html/disclaimer.html

@@ -6,12 +6,31 @@
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <title><%= htmlWebpackPlugin.options.title %></title>
     <style>
+         *{
+            margin: 0;
+            padding: 0;
+        }
+        html {
+            height: 100%;
+        }
+        body{
+            font-size: 14px;
+            overflow-y: auto;
+            font-family: '微软雅黑', '宋体';
+            background: #dde2ea;
+            height: 100%;
+            color: #505050;
+            line-height: 28px;
+        }
         h1 {
             text-align: center;
+            padding: 80px 0 60px;
         }
-        .content {
-            width: 60%;
+        .container {
+            width: 80%;
+            background: #fff;
             margin: 0 auto;
+            padding: 0 30px 40px;
         }
     </style>
 </head>

+ 18 - 14
src/html/drugInfo.html

@@ -2,7 +2,7 @@
 <html>
 <head>
     <meta charset="utf-8">
-    <title>诊断指南</title>
+    <title>药品说明</title>
     <style>
         *{
             margin: 0;
@@ -16,7 +16,7 @@
             border-spacing: 0;
         }
         body{
-            font-size: 12px;
+            font-size: 14px;
             overflow-y: scroll;
             font-family: '微软雅黑', '宋体';
             background: #dde2ea;
@@ -24,7 +24,8 @@
             color: #33475f;
         }
         h1{
-            margin-bottom: 50px;
+            font-size: 32px;
+            margin: 0 77px 0px 210px;
         }
         h2{
             font-size: 18px;
@@ -33,9 +34,11 @@
             background: #fff;
             padding-right: 6px;
         }
+        .contentBox {
+            padding-right: 60px;
+        }
         .content{
             position: relative;
-            height: 550px;
         }
         .infos{
 
@@ -59,12 +62,12 @@
             overflow: hidden;
             background: #fff;
             margin: 0 auto;
-            padding: 30px 24px;
+            padding: 30px 0px 30px 30px;
         }
         .anchors{
             width: 160px;
             position: absolute;
-            right: 15px;
+            left: 15px;
             top: 0;
             margin-right: 14px;
             overflow: auto;
@@ -77,34 +80,35 @@
         }
         .anchors li{
             position: relative;
-            height: 20px;
+            border-left: 2px solid #ccc; 
         }
         .anchors .anchor-line{
             height: 15px;
             width: 0;
-            border: 1px solid #ccc;
-            background-color: #ccc;
-            margin-left: 4px;
+            border-left: 2px solid #ccc;
+            /* background-color: #ccc; */
         }
         .anchors .anchor-line:last-child{
             display: none;
         }
         .anchors i{
+            position: absolute;
             display: inline-block;
             width: 8px;
             height: 8px;
             border-radius: 5px;
             border: 1px solid #ccc;
-            margin-top: 5px;
             background-color: #eee;
-            margin-right: 10px;
+            left: -5px;
+            top: 5px;
         }
         .anchors a{
-            position: absolute;
+            display: inline-block;
+            position: relative;
             top: 0;
             left: 0;
             width: calc(100% - 20px);
-            padding-left: 20px;
+            padding-left: 10px;
             text-decoration: none;
             font-size: 13px;
             font-weight: 400;

+ 10 - 9
src/html/information.html

@@ -76,38 +76,39 @@
             border-radius: 4px;
             border: 1px solid #eee;
             background-color: #eee;
+            line-height: 17px;
         }
         .anchors li{
             position: relative;
-            /* height: 20px; */
-            line-height: 19px;
+            border-left: 2px solid #ccc; 
         }
         .anchors .anchor-line{
             height: 15px;
             width: 0;
-            border: 1px solid #ccc;
-            background-color: #ccc;
-            margin-left: 4px;
+            border-left: 2px solid #ccc;
+            /* background-color: #ccc; */
         }
         .anchors .anchor-line:last-child{
             display: none;
         }
         .anchors i{
+            position: absolute;
             display: inline-block;
             width: 8px;
             height: 8px;
             border-radius: 5px;
             border: 1px solid #ccc;
-            margin-top: 5px;
             background-color: #eee;
-            margin-right: 10px;
+            left: -5px;
+            top: 5px;
         }
         .anchors a{
-            position: absolute;
+            display: inline-block;
+            position: relative;
             top: 0;
             left: 0;
             width: calc(100% - 20px);
-            padding-left: 20px;
+            padding-left: 10px;
             text-decoration: none;
             font-size: 13px;
             font-weight: 400;

+ 150 - 0
src/html/scale.html

@@ -0,0 +1,150 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>量表明细</title>
+  <style>
+      *{
+            margin: 0;
+            padding: 0;
+        }
+        ul,li{
+            list-style: none;
+        }
+        table{
+            border-collapse: collapse;
+            border-spacing: 0;
+        }
+        body{
+            font-size: 14px;
+            overflow-y: scroll;
+            font-family: '微软雅黑', '宋体';
+            background: #dde2ea;
+            height: 100%;
+            color: #33475f;
+        }
+        .container {
+          width: 80%;
+          overflow: hidden;
+          background: #fff;
+          margin: 0 auto;
+          padding: 30px 30px 30px 30px;
+        }
+        h1 {
+          text-align: center;
+          padding: 20px 0;
+        }
+        .groupBox {
+          border-bottom: 4px solid #EBEBEB;
+        }
+        .groupName {
+          font-weight: bold;
+          padding: 10px 0;
+        }
+        .groupRowName {
+          line-height: 30px;
+        }
+        .groupRowBox {
+          line-height: 30px;
+        }
+        .groupRowRadio {
+          margin: 0 20px 0 0;
+          vertical-align: middle;
+        }
+        .groupRowRecommend {
+          color: #267FD7;
+          margin-left: 5px;
+        }
+        .calcu {
+          text-align: right;
+          height: 40px;
+          margin: 10px 0 0 0;
+          line-height: 40px;
+          border-top: 1px solid #979797;
+        }
+        .allCalcuBox {
+          text-align: right;
+          height: 60px;
+          line-height: 60px;
+          vertical-align: middle;
+          position: relative;
+          padding: 0 80px 0 0;
+        }
+        .calcuBtn {
+          position: absolute;
+          right: 0;
+          top: 12px;
+          display: inline-block;
+          width: 70px;
+          height: 36px;
+          line-height: 36px;
+          text-align: center;
+          background: #267FD7;
+          color: #fff;
+          border-radius: 4px;
+        }
+        .groupRowWrapper {
+          margin-top: 15px;
+        }
+        .noSelect {
+          border: 1px solid red;  
+          box-sizing: border-box;
+        }
+  
+  </style>
+</head>
+<body>
+  <div class="container">
+      <h1></h1>
+      <div class="content"></div>
+
+  </div>
+  
+  <!-- <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
+  <script type="text/javascript">
+    $(function(){
+      // 从地址栏获取参数,请求量表内容
+      function GetQueryString(name){     
+        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");     
+        var r = window.location.search.substr(1).match(reg);     
+        if(r!=null)return  unescape(r[2]); return null;
+      }
+
+      var scaleInfo;
+      var id = GetQueryString('id') || 40744;
+      var name = GetQueryString('name') || "密西根糖尿病周围神经病评分(MDNS)";
+      var url = "http://192.168.2.236:5050/api/icss/push/pushInner";
+      // 用GetQueryString方法从地址栏获取参数,暂时写死
+      var params = {
+        "age":28,
+        "featureType":'21',
+        "scaleId":id,
+        "scaleName":name,
+        "sex":1,
+        "diag": "肺结核(复诊); ",
+        "lis":[]
+      }
+      if(id){
+        $.ajax({
+          method:'post',
+          url:url,
+          data:JSON.stringify(params),
+          dataType:'json',
+          contentType:'application/json',
+          success:function(res){ 
+            if(res.code==0){
+              scaleInfo = res.data.scale;
+              console.log('量表数据为:',scaleInfo);
+            }
+          },
+          error:function(err){
+            console.log('请求失败:',err);
+          }
+        })
+      }
+
+    })
+      
+  </script> -->
+</body>
+</html>

+ 39 - 22
src/js/drugInfo.js

@@ -9,10 +9,10 @@
         var urlParam = parseUrlParams();
         console.log(urlParam)
         var param = {
-            // "type": urlParam.type,
-            // "questionId": urlParam.questionId,
-            "type": 8,
-            "questionId": 145,
+            "type": urlParam.type,
+            "questionId": urlParam.questionId,
+            // "type": 8,
+            // "questionId": 145,
             "position": 5
         };
         $.ajax({
@@ -28,6 +28,7 @@
                    var str='',anchors='',item='';
                 if(!res.data){
                     $("h1").html("暂时没有数据");
+                    $(".anchors").css("display", "none");
                     return;
                 }
                 var list  = res.data.introduceDetailList;
@@ -36,12 +37,12 @@
                 for(var i=0;i<list.length;i++) {
                     item = list[i];
                     item.content = item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)
-                    anchors = '<li><i></i><a href="#anchor' + i +
+                    anchors = '<li><i></i><a href="#' + item.id +
                         '">' + item.title + '</a></li><li class="anchor-line"></li>';
-                    str = '<div class="title"><h2 id="anchor' + i +
-                        '">' + item.title +
-                        '</h2><div class="line"></div></div>' +
-                        '<div>' + item.content + '<div>';
+                    str = '<div class="title"><h2 id="' + item.id +
+                        '">' + '【'+ item.title + '】'+
+                        '</h2></div>' +
+                        '<div class="contentBox">' + item.content + '<div>';
                     $(".infos").append(str);
                     $(".anchors ul").append(anchors);
                     //});
@@ -49,6 +50,23 @@
                 addLinkClickEvent();
                 adjustHeight();
 
+                $(".infos").scroll(function() {
+                    var scrollTop = $('.infos').scrollTop()
+                    var divHeight = 0;
+                    for (var i = 0; i < list.length; i++) {
+                        divHeight = divHeight + parseInt($('#' + list[i].id).css('height')) + parseInt($('#' + list[i].id).parent().next().css('height')) +40
+                        if(divHeight > scrollTop) {
+                            // this.setState({
+                            //     currentIndex: i
+                            // })
+                            var anchor = 2*i
+
+                            $('.anchors ul').children().eq(anchor).addClass('active').siblings().removeClass('active')
+                            return
+                        }
+                    }
+                })
+
             }
         })
 
@@ -86,20 +104,19 @@
     }
 
     function parseUrlParams(){
+        // var url = 'http://localhost:8082/scale.html?type=8&questionId=145'
         var url = window.location.search;
-        // var params = url.substring(1).split("&");
-        // var tmp = '',obj = {},it={};
-        // //params.map((it) =>{
-        // for(var i=0;i<params.length;i++) {
-        //     it = params[i];
-        //     tmp = it.split("=");
-        //     if (tmp[0] && tmp[1]) {
-        //         obj[tmp[0]] = tmp[1];
-        //     }
-        // }
-        // //});
-        // return obj;
-        obj={};url.replace(/([^?&=]+)=([^&]+)/g,(_,k,v)=>q[k]=v);
+        var params = url.substring(url.indexOf('?')+1).split("&");
+        var tmp = '',obj = {},it={};
+        //params.map((it) =>{
+        for(var i=0;i<params.length;i++) {
+            it = params[i];
+            tmp = it.split("=");
+            if (tmp[0] && tmp[1]) {
+                obj[tmp[0]] = tmp[1];
+            }
+        }
+        //});
         return obj;
     }
 

+ 27 - 7
src/js/information.js

@@ -9,10 +9,10 @@
         var urlParam = parseUrlParams();
         console.log(urlParam)
         var param = {
-            // "type": urlParam.type,
-            // "questionId": urlParam.questionId,
-            "type": 7,
-            "questionId": 21773,
+            "type": urlParam.type || 7,
+            "questionId": urlParam.questionId || 21773,
+            // "type": 7,
+            // "questionId": 21773,
             "position":2
         };
         $.ajax({
@@ -38,9 +38,9 @@
                 for(var i=0;i<list.length;i++) {
                     item = list[i];
                     item.content = item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)
-                    anchors = '<li><i></i><a href="#anchor' + i +
+                    anchors = '<li><i></i><a href="#' + item.id +
                         '">' + item.title + '</a></li><li class="anchor-line"></li>';
-                    str = '<div class="title"><h2 id="anchor' + i +
+                    str = '<div class="title"><h2 id="' + item.id +
                         '">' + item.title +
                         '</h2></div>' +
                         '<div>' + item.content + '<div>';
@@ -54,6 +54,25 @@
                 addLinkClickEvent();
                 adjustHeight();
 
+                $(".infos").scroll(function() {
+                    var scrollTop = $('.infos').scrollTop()
+                    var divHeight = 0;
+                    for (var i = 0; i < list.length; i++) {
+                        divHeight = divHeight + parseInt($('#' + list[i].id).css('height')) + parseInt($('#' + list[i].id).parent().next().css('height')) +40
+                        if(divHeight > scrollTop) {
+                            // this.setState({
+                            //     currentIndex: i
+                            // })
+                            var anchor = 2*i
+
+                            $('.anchors ul').children().eq(anchor).addClass('active').siblings().removeClass('active')
+                            return
+                        }
+                    }
+                })
+
+                
+
             }
         })
 
@@ -91,8 +110,9 @@
     }
 
     function parseUrlParams(){
+        // var url = 'http://localhost:8082/scale.html?type=7&questionId=21733'
         var url = window.location.search;
-        var params = url.substring(1).split("&");
+        var params = url.substring(url.indexOf('?')+1).split("&");
         var tmp = '',obj = {},it={};
         //params.map((it) =>{
         for(var i=0;i<params.length;i++) {

+ 206 - 0
src/js/scale.js

@@ -0,0 +1,206 @@
+const qs = require('qs');
+$(function(){
+    // 从地址栏获取参数,请求量表内容
+    function GetQueryString(name){     
+      var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");     
+      var r = window.location.search.substr(1).match(reg);     
+      if(r!=null)return  unescape(r[2]); return null;
+    }
+
+    var scaleInfo;
+    var id = GetQueryString('id') || 40744;
+    var name = GetQueryString('name') || "密西根糖尿病周围神经病评分(MDNS)";
+    var url = "http://192.168.2.236:5050/api/icss/push/pushInner";
+    var urlParam = parseUrlParams(); //参数
+    // 用GetQueryString方法从地址栏获取参数,暂时写死
+    var params = {
+    //   "age": parseInt(urlParam.age) || 28,
+    //   "featureType": urlParam.featureType ||'21',
+    //   "scaleId": urlParam.scaleId ||40744,
+    //   "scaleName": urlParam.scaleName || "密西根糖尿病周围神经病评分(MDNS)",
+    //   "sex": parseInt(urlParam.sex) || 1,
+    //   "diag": urlParam.diag || "肺结核(复诊); ",
+    //   "lis":    JSON.parse(urlParam.lis) || []
+
+      "age": 28,
+      "featureType": '21',
+      "scaleId": id,
+      "scaleName": name,
+      "sex": 1,
+      "diag": "肺结核(复诊); ",
+      "lis":  []
+    
+    }
+    if(id){
+      $.ajax({
+        method:'post',
+        url:url,
+        data:JSON.stringify(params),
+        dataType:'json',
+        contentType:'application/json',
+        success:function(res){ 
+          if(res.code==0){
+            scaleInfo = res.data.scale;
+            // console.log('量表数据为:',scaleInfo);
+            for (var i = 0; i < scaleInfo.length; i++) {
+                if( scaleInfo[i].type == 1) {
+                    var scaleList = JSON.parse(scaleInfo[i].content)
+                    // console.log('scaleList', scaleList)
+                    renderCalcu(scaleList)
+                   
+                } else {
+                    $('.content').append(scaleInfo[i].content)
+                }
+                
+                $('input').on('change', function(e) {
+                    var indexList = $(this).attr('data-index').split(',')
+                    for (var i = 0; i < scaleList.group[indexList[0]].rows[indexList[1]].row[indexList[2]].details.length; i++) {
+                        scaleList.group[indexList[0]].rows[indexList[1]].row[indexList[2]].details[i].select = 0
+                    }
+                    scaleList.group[indexList[0]].rows[indexList[1]].row[indexList[2]].details[indexList[3]].select = 1
+                    // console.log('this',$(this).parent().parent().parent())
+                    $(this).parent().parent().parent().removeClass('noSelect')
+                })
+
+                $('.calcuBtn').on('click', function() {
+                    // console.log('scaleList', scaleList)
+                    let allSelect = true
+                    for (let i = 0; i < scaleList.group.length; i++) {
+                        for (let j = 0; j < scaleList.group[i].rows.length; j++) {
+                            for (let x = 0; x < scaleList.group[i].rows[j].row.length; x++) {
+                                let itemSelect = false 
+                                // console.log('scaleList.group[i].rows[j].row[x].details', scaleList.group[i].rows[j].row[x].details)
+                                for (let y = 0; y < scaleList.group[i].rows[j].row[x].details.length; y++) {
+                                    if (scaleList.group[i].rows[j].row[x].details[y].select == 1) {
+                                        itemSelect = true
+                                    }
+                                }
+                                if(!itemSelect) {
+                                    allSelect = false
+                                    $('#' + i + j + x).addClass('noSelect')
+                                }
+                            }
+                        }
+                    }
+                    if(allSelect) {
+                        getCalcuResult(scaleList)
+                    }
+                })
+
+            }
+          }
+        },
+        error:function(err){
+          console.log('请求失败:',err);
+        }
+      })
+    }
+
+  })
+
+function renderCalcu(scaleList) {
+    $("h1").html(scaleList.scaleName);
+    var str = ''
+    for(var j = 0; j < scaleList.group.length; j++) {
+        str += '<div class="groupBox"> <div class="groupName">' + scaleList.group[j].groupName + '</div>';
+        for (var x = 0; x < scaleList.group[j].rows.length; x++) {
+            for (var y = 0; y < scaleList.group[j].rows[x].row.length; y++) {
+                var str2 = ''
+                for(var z = 0; z < scaleList.group[j].rows[x].row[y].details.length; z++) {
+                    str2 += '<span class="groupRowRadio"><input  type=radio data-index='+ j +',' + x+',' + y +',' + z +'  name='+scaleList.group[j].rows[x].row[y].name +' id='+scaleList.group[j].rows[x].row[y].name+scaleList.group[j].rows[x].row[y].details[z].detailName
+                    if (scaleList.group[j].rows[x].row[y].details[z].select == 1) {
+                        str2 += ' checked="checked"'
+                    }
+                    str2 += ' />'+'<label for="'+scaleList.group[j].rows[x].row[y].name+scaleList.group[j].rows[x].row[y].details[z].detailName+'">' + scaleList.group[j].rows[x].row[y].details[z].detailName + '('+scaleList.group[j].rows[x].row[y].details[z].score +')'+'</label>'
+                    if (scaleList.group[j].rows[x].row[y].name+scaleList.group[j].rows[x].row[y].details[z].state == 1) {
+                        str2 += '<span class="groupRowRecommend">智能推荐</span>'
+                    }
+                    str2 += '</span>'
+                }
+                str +='<div class="groupRowWrapper" id="'+ j+ x + y +'"><div class="groupRowName">'+  (x+1) + ' ' +scaleList.group[j].rows[x].row[y].name  + '</div><div class="groupRowBox">' + str2 + '</div>' + '</div>'
+            }
+            
+        }
+        if(scaleList.group[j].groupCalculate.isShow == 1) {
+            str += '<div class="calcu">记分:'+ scaleList.group[j].groupCalculate.result.value +' '+ scaleList.group[j].groupCalculate.result.text +'</div>'
+
+        }
+        str +=  '</div>'
+        
+    }
+    var calcuStr = '<div class="allCalcuBox"><span class="allCalcu">总分:'
+    if(scaleList.calculate && scaleList.calculate.result) {
+        calcuStr += scaleList.calculate.result.value + ' ' + scaleList.calculate.result.text
+    }
+    calcuStr += '</span><span class="calcuBtn">计算<span></div>'
+    var allStr = '<div class="calcuWrapper">' + str + calcuStr + '</div>'
+    $('.content').append(allStr)
+}
+
+function parseUrlParams(){
+    // var url = 'http://localhost:8082/scale.html?age=28&featureType=21&scaleId=40744&scaleName=密西根糖尿病周围神经病评分(MDNS)&sex=1&diag=肺结核(复诊);&lis=[]'
+    var url = window.location.search;
+    var params = url.substring(url.indexOf('?')+1).split("&");
+    var tmp = '',obj = {},it={};
+    for(var i=0;i<params.length;i++) {
+        it = params[i];
+        tmp = it.split("=");
+        if (tmp[0] && tmp[1]) {
+            obj[tmp[0]] = tmp[1];
+        }
+    }
+    return obj;
+    // var obj={};
+    // url.replace(/([^?&=]+)=([^&]+)/g,(_,k,v)=>q[k]=v);
+    // return obj;
+}
+
+  function getCalcuResult(data) {
+    var url = "http://192.168.2.236:5050/api/icss/calc/calculate";
+    const param = {
+        type: 1,
+        data: data
+    }
+    $.ajax({
+        type: 'post',
+        url: url,
+        headers: {
+            // 'Accept': 'application/json, text/plain, */*',
+            'Content-Type':'application/json; charset=utf-8'
+        },
+        data: JSON.stringify(param),
+        success: function(res) {
+            // console.log('calcaRes', res, data)
+            if (res.code == 0) {
+
+                data.calculate.result = res.data.calcalculate.result
+                for(let i = 0; i < res.data.group.length; i++) {
+                    for(let j = 0; j < data.group.length; j++) {
+                        if (res.data.group[i].groupName == data.group[j].groupName) {
+                            data.group[j].groupCalculate.result = res.data.group[i].groupCalculate.result
+                        }
+                    }
+                }
+                if($('.calcu')) {
+                    for (let i = 0; i < $('.calcu').length; i++) {
+                        let calcuItemName  = $('.calcu').eq(i).prev().find('.groupName').html();
+                        let calcuItem = data.group.filter(function(item) {
+                            return item.groupName == calcuItemName
+                        })[0]
+                        $('.calcu').eq(i).html('记分:' + calcuItem.groupCalculate.result.value +  ' ' +  calcuItem.groupCalculate.result.text)
+                    }
+                }
+                $('.allCalcu').eq(0).html('总分:' + data.calculate.result.value +  ' ' + data.calculate.result.text)
+
+
+            } else {
+                alert(res.msg)
+            }
+           
+            
+        },
+        error: function(error) {
+            console.log(error)
+        }
+    })
+}

+ 14 - 0
webpack.config.js

@@ -13,6 +13,7 @@ module.exports = {
     information: path.resolve(__dirname, 'src/js', 'information.js'),
     drugInfo: path.resolve(__dirname, 'src/js', 'drugInfo.js'),
     disclaimer: path.resolve(__dirname, 'src/js', 'disclaimer.js'),
+    scale: path.resolve(__dirname, 'src/js', 'scale.js'),
     vendor:'lodash' // 多个页面所需的公共库文件,防止重复打包带入
   },
   output: {
@@ -104,6 +105,19 @@ module.exports = {
         collapseWhitespace: true //删除空白符与换行符
       }
     }),
+    new HtmlWebpackPlugin({
+      title: 'scale',
+      template: path.resolve(__dirname, 'src/html', 'scale.html'),
+      filename: 'scale.html',
+      chunks: ['scale', 'vendor','common'],
+      inject: true,
+      hash: true, //防止缓存
+      minify: {
+        removeAttributeQuotes: true, //压缩 去掉引号
+        removeComments: true, //移除HTML中的注释
+        collapseWhitespace: true //删除空白符与换行符
+      }
+    }),
     new MiniCssExtractPlugin({
       // Options similar to the same options in webpackOptions.output
       // both options are optional