瀏覽代碼

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

Luolei 6 年之前
父節點
當前提交
3c34d701b3
共有 6 個文件被更改,包括 103 次插入159 次删除
  1. 1 1
      src/html/information.html
  2. 8 0
      src/html/scale.html
  3. 36 36
      src/index.js
  4. 5 26
      src/js/drugInfo.js
  5. 5 21
      src/js/information.js
  6. 48 75
      src/js/scale.js

+ 1 - 1
src/html/information.html

@@ -56,7 +56,7 @@
             border-bottom: 1px dashed #ccc;
         }
         .container{
-            width: 76%;
+            width: 80%;
             overflow: hidden;
             background: #fff;
             margin: 0 auto;

+ 8 - 0
src/html/scale.html

@@ -46,10 +46,12 @@
         }
         .groupRowBox {
           line-height: 30px;
+          padding-left: 30px;
         }
         .groupRowRadio {
           margin: 0 20px 0 0;
           vertical-align: middle;
+          display: inline-block;
         }
         .groupRowRecommend {
           color: #267FD7;
@@ -86,6 +88,12 @@
         .groupRowWrapper {
           margin-top: 15px;
         }
+        .groupRowIndex {
+          display: inline-block;
+          width: 25px;
+          text-align: right;
+          margin-right: 5px;
+        }
         .noSelect {
           border: 1px solid red;  
           box-sizing: border-box;

+ 36 - 36
src/index.js

@@ -6,43 +6,43 @@ import {post,config,getUrlArgObject} from './js/promise.js';
 import {bqtsFun,ybzlFun,cyywFun,knzdFun,jtFun,tjwzFun,tjtgFun,tjhyFun,tjfjFun} from './js/indexDom';
 //地址栏参数 ?age=99&lisJson=&diseaseId=&diagJson=糖尿病&pastJson=无心脏病&otherJson=无高血压&pacsJson=腹部B超:无异常, 报告日期:2019-05-07&sex=男&symptomJson=恶心呕吐腰痛&vitalJson=血压左上肢13/12mmHg
 
-// var msg= {
-// 	age: 28,
-//   diag: "急性胰腺炎",
-//   diseaseId: 280,
-//   featureType: "1,4,5,6,7,8,22",
-//   lis: [
-//     {
-//       detailName: "HGB*3/HCT",
-//       maxValue: "",
-//       minValue: "",
-//       name: "血常规",
-//       otherValue: "",
-//       source: "0",
-//       time: "2019-05-07 17:11",
-//       uniqueName: "血常规-HGB*3/HCT",
-//       units: "",
-//       value: "4"
-//     }
-//   ],
-//   other: "无高血压",
-//   pacs: "腹部B超:无异常, 报告日期:2019-05-07",
-//   sex: 1,
-//   symptom: "恶心呕吐腰痛", //胸痛,背痛,恶心,呕吐     //恶心呕吐腰痛   //牙周袋形成
-//   vital: "血压左上肢13/12mmHg",
-// }
-var msg = {
-  age: getUrlArgObject('age'),
-  diseaseId: getUrlArgObject('diseaseId') || 21773,
-  sex: getUrlArgObject('sex') == '男'?1:(getUrlArgObject('sex') == '女'?2:(getUrlArgObject('sex') == '通用'?3:getUrlArgObject('sex'))),
-  symptom: getUrlArgObject('symptomJson'),
-  vital: getUrlArgObject('vitalJson'),
-  lis: getUrlArgObject('lisJson')? JSON.parse(getUrlArgObject('lisJson')) : [],
-  pacs: getUrlArgObject('pacsJson'),
-  diag: getUrlArgObject('diagJson'),
+var msg= {
+	age: 28,
+  diag: "急性胰腺炎",
+  diseaseId: 280,
   featureType: "1,4,5,6,7,8,22",
-  other: getUrlArgObject('otherJson') + getUrlArgObject('pastJson'),
-}//推送相关信息
+  lis: [
+    {
+      detailName: "HGB*3/HCT",
+      maxValue: "",
+      minValue: "",
+      name: "血常规",
+      otherValue: "",
+      source: "0",
+      time: "2019-05-07 17:11",
+      uniqueName: "血常规-HGB*3/HCT",
+      units: "",
+      value: "4"
+    }
+  ],
+  other: "无高血压",
+  pacs: "腹部B超:无异常, 报告日期:2019-05-07",
+  sex: 1,
+  symptom: "恶心呕吐腰痛", //胸痛,背痛,恶心,呕吐     //恶心呕吐腰痛   //牙周袋形成
+  vital: "血压左上肢13/12mmHg",
+}
+// var msg = {
+//   age: getUrlArgObject('age'),
+//   diseaseId: getUrlArgObject('diseaseId') || 21773,
+//   sex: getUrlArgObject('sex') == '男'?1:(getUrlArgObject('sex') == '女'?2:(getUrlArgObject('sex') == '通用'?3:getUrlArgObject('sex'))),
+//   symptom: getUrlArgObject('symptomJson'),
+//   vital: getUrlArgObject('vitalJson'),
+//   lis: getUrlArgObject('lisJson')? JSON.parse(getUrlArgObject('lisJson')) : [],
+//   pacs: getUrlArgObject('pacsJson'),
+//   diag: getUrlArgObject('diagJson'),
+//   featureType: "1,4,5,6,7,8,22",
+//   other: getUrlArgObject('otherJson') + getUrlArgObject('pastJson'),
+// }//推送相关信息
 
 window.msg = msg
 window.pushMessage = {}

+ 5 - 26
src/js/drugInfo.js

@@ -1,23 +1,18 @@
-import {post, imageUrlPrefix} from './promise.js';
+import {post, imageUrlPrefix,getUrlArgObject, throttle} from './promise.js';
 (function(){
     getInfomation();
     function getInfomation(){
         // var infoUrl ="http://" + window.location.host+'/icss-web/kl/introduce/get_by_itemidAndType';
         // var infoUrl ="http://" + window.location.host+'/api/icss/introduceInfo/getByQuestionId';
         var infoUrl ='http://192.168.2.236:5050/api/icss/introduceInfo/getByQuestionId'
-        var urlParam = parseUrlParams();
-        console.log(urlParam)
+      
         var param = {
-            "type": urlParam.type,
-            "questionId": urlParam.questionId,
-            // "type": 8,
-            // "questionId": 145,
-            "position": 5
+            "type":  getUrlArgObject('type'),
+            "questionId":  getUrlArgObject('questionId'),
+            "position": getUrlArgObject('position')
         };
         post(infoUrl, param).then((res) => {
-            console.log('ressssssss', res)
             const data = res.data.data
-            console.log(res) 
             var str='',anchors='',item='';
             if(!data){
                 $("h1").html("暂时没有数据");
@@ -66,22 +61,6 @@ import {post, imageUrlPrefix} from './promise.js';
 
     }
 
-    function parseUrlParams(){
-        // var url = 'http://localhost:8082/scale.html?type=8&questionId=145'
-        var url = window.location.search;
-        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;
-    }
 
     function addLinkClickEvent(){
         $("li:first").addClass("active");

+ 5 - 21
src/js/information.js

@@ -1,18 +1,17 @@
-import {post, throttle, imageUrlPrefix} from './promise.js';
+import {post, throttle, imageUrlPrefix, getUrlArgObject} from './promise.js';
 (function(){
     getInfomation();
     function getInfomation(){
         // var infoUrl ="http://" + window.location.host+'/icss-web/kl/introduce/get_by_itemidAndType';
         // var infoUrl ="http://" + window.location.host+'/api/icss/introduceInfo/getByQuestionId';
         var infoUrl ='http://192.168.2.236:5050/api/icss/introduceInfo/getByQuestionId'
-        var urlParam = parseUrlParams();
-        console.log(urlParam)
+       
         var param = {
-            "type": urlParam.type || 7,
-            "questionId": urlParam.questionId || 21773,
+            "type":  getUrlArgObject('type'),
+            "questionId":  getUrlArgObject('questionId'),
             // "type": 7,
             // "questionId": 21773,
-            "position":2
+            "position": getUrlArgObject('position')
         };
 
         post(infoUrl, param).then((res) => {
@@ -72,21 +71,6 @@ import {post, throttle, imageUrlPrefix} from './promise.js';
 
     }
 
-    function parseUrlParams(){
-        // var url = 'http://localhost:8082/scale.html?type=7&questionId=21733'
-        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;
-        
-    }
 
     function addLinkClickEvent(){
         $("li:first").addClass("active");

+ 48 - 75
src/js/scale.js

@@ -9,11 +9,11 @@ $(function(){
     }
 
     var scaleInfo;
-    var id = GetQueryString('id') || 40744;
-    var name = GetQueryString('name') || "密西根糖尿病周围神经病评分(MDNS)";
+    var id = GetQueryString('id') || 40743;
+    var name = GetQueryString('name') || "危重病人APACHEII评分表";
     var url = "http://192.168.2.236:5050/api/icss/push/pushInner";
     var urlParam = parseUrlParams(); //参数
-    console.log('urlParam', urlParam.lis)
+    // console.log('urlParam', urlParam.lis)
     // 用GetQueryString方法从地址栏获取参数,暂时写死
     var params = {
       "age": getUrlArgObject('age') || 28,
@@ -44,49 +44,60 @@ $(function(){
                 for (var i = 0; i < scaleInfo.length; i++) {
                     if( scaleInfo[i].type == 1) {
                         var scaleList = JSON.parse(scaleInfo[i].content)
-                        // console.log('scaleList', scaleList)
+                        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++) {
+                }
+                 
+                $('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().attr('class'))
+                    const className = $(this).parent().parent().parent().attr('data-group')
+                    for(let i = 0; i < $('.'+className).length; i++) {
+                        $('.'+className).eq(i).removeClass('noSelect')
+                    }
+                    // for(let i = 0; i < $(this).parent().parent().parent().parent().find(className).length; i++) {
+                    //     $(this).parent().parent().parent().parent().find(className).eq(i).removeClass('noSelect')
+                    // }
+                    // $(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++) {
+                            if(scaleList.group[i].rows[j].required == 1) {
+                                let itemSelect = false
                                 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(!itemSelect) {
+                                    allSelect = false
+                                    $('.' + i + j).addClass('noSelect')
                                 }
                             }
+                            
                         }
-                        if(allSelect) {
-                            getCalcuResult(scaleList)
-                        }
-                    })
+                    }
+                    if(allSelect) {
+                        getCalcuResult(scaleList)
+                    }
+                })
     
-                }
               }
 
 
@@ -106,17 +117,21 @@ function renderCalcu(scaleList) {
             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
+                    str2 += '<span class="groupRowRadio"><input  type=radio data-index='+ j +',' + x+',' + y +',' + z +'  name='+ j + x + y +' id=' + j + x + y + z
                     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>'
+                    str2 += ' />'+'<label for="'+ j + x + y + z+'">' + 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>'
+                str +='<div class="groupRowWrapper '+ j + x +'" data-group='+ j + x +' id="'+ j + x + y +'"><div class="groupRowName"> <span class="groupRowIndex">'  
+                if(y==0) {
+                    str += (x+1)+'.'  
+                }
+                str +='</span>' +scaleList.group[j].rows[x].row[y].name  + '</div><div class="groupRowBox">' + str2 + '</div>' + '</div>'
             }
             
         }
@@ -188,46 +203,4 @@ function parseUrlParams(){
             alert(res.msg)
         }
     })
-    // $.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)
-    //     }
-    // })
 }