Browse Source

Merge remote-tracking branch 'origin/dev/otherHis' into dev/new1

zhouna 6 years ago
parent
commit
aec6017a2c

+ 25 - 1
src/common/components/InlineTag/index.jsx

@@ -28,6 +28,7 @@ class InlineTag extends Component {
     this.handleBlur = this.handleBlur.bind(this);
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
+    this.handleFixClick = this.handleFixClick.bind(this);
   }
   changeToEdit(e){
     const {handledbClick,id} = this.props;
@@ -80,12 +81,34 @@ class InlineTag extends Component {
     }
     return style['selected-tag'];
   }
- 
+  moveEnd(obj) {
+    if(window.getSelection){//ie11 10 9 ff safari
+      obj.focus(); //解决ff不获取焦点无法定位问题
+      var range = window.getSelection();//创建range
+      range.selectAllChildren(obj);//range 选择obj下所有子内容
+      range.collapseToEnd();//光标移至最后
+    }
+    else if (document.selection) {//ie10 9 8 7 6 5
+      var range = document.selection.createRange();//创建选择对象
+      range.moveToElementText(obj);//range定位到obj
+      range.collapse(false);//光标移至最后
+      range.select();
+    }
+  }
+  handleFixClick(){
+    this.moveEnd(this.$span.current);
+  }
+  componentDidMount(){
+    //设置最小宽度避免输入后宽度跳动
+    const spanWidth = window.getComputedStyle(this.$span.current).width;
+    this.$span.current.style.minWidth=spanWidth;
+  }
   render(){
     const {placeholder,value,prefix,suffix} = this.props;
     const inp = this.state.value;
     return <div className={this.getStyle()}
                  onDoubleClick={this.changeToEdit}
+                  onClick={this.handleFixClick}
                  onkeydown={handleEnter}
                  onBlur={this.changeToClick} ref={this.$box} contentEditable={this.state.editable}>
                 {prefix}
@@ -94,6 +117,7 @@ class InlineTag extends Component {
                       onBlur={this.handleBlur}
                       onInput={this.handleInput}
                       onFocus={this.handleFocus}
+                      onClick={e=>e.stopPropagation()}
                       onkeydown={handleEnter}
                       ref={this.$span}>{value||(inp?'':placeholder)}</span>
                 {suffix}

+ 2 - 2
src/components/RadioDrop/index.jsx

@@ -99,11 +99,11 @@ class RadioDrop extends Component{
     },$("#addScrollEvent")[0])
   }
   componentDidMount(){    //默认值选中
-    const {data,ikey,handleSelect} = this.props;
+    const {data,ikey,handleSelect,hideTag} = this.props;
     const selected = data.find((it)=>{
       return it.selected === undefined&&+it.defaultSelect===1;
     });
-    if(selected){
+    if(!hideTag&&selected){
       // const text = selected.labelPrefix+selected.name+selected.labelSuffix;
       const text = selected.name;
       handleSelect&&handleSelect({ikey,id:selected.id,text});

+ 10 - 3
src/components/SpreadDrop/index.jsx

@@ -224,14 +224,21 @@ class SpreadDrop extends Component{
       return;
     }
     //操作单选项
-    if(selected){
+    if(!noneOn&&selected){
       const tIndex= exists.findIndex((it)=>it.questionId===item.questionId);
+      const bIndex= withs.findIndex((it)=>it.questionId===item.questionId);
       if(tIndex!=-1){
         exists.splice(tIndex,1,item);
         this.setState({
           exists,
         })
       }
+      if(bIndex!=-1){
+        withs.splice(tIndex,1,item);
+        this.setState({
+          withs,
+        })
+      }
       return;
     }
     if(exclusion!==''){     //互斥项被选中,其他不可操作
@@ -287,7 +294,7 @@ class SpreadDrop extends Component{
         nones += name+'、';
         noneIds.push(id);
       }else if(nowOn=='with'){
-        withs.push({id:id,name:name});
+        withs.push({id:id,name:name,questionId:item.questionId});
       }else{
         exists.push({id:id,name:name,listIndex,questionId:item.questionId});
       }
@@ -421,7 +428,7 @@ class ListItem extends Component{
         return exists.findIndex((i)=>i.questionId===it.id)!==-1||noneIds.includes(it.id)||withs.findIndex((i)=>i.questionId===it.id)!==-1;
       });*/
       if(selected&&selected.id!=item.id){     //该列已有选中项,传回已选中的id,name取消选中
-        handleClick&&handleClick(item,isExclu,joint,index,{id:selected.id,name:selected.name});
+        handleClick&&handleClick(item,isExclu,joint,index,{id:selected.id,name:selected.name,questionId:selected.questionId});
       }else{
         handleClick&&handleClick(item,isExclu,joint,index);
       }

+ 49 - 32
static/pages/diag_push.html

@@ -30,7 +30,7 @@
             font-family: 'Microsoft YaHei', arial, tahoma, sans-serif;
         }
         tr{
-            height: 30px;
+            line-height: 30px;
         }
         td{
             vertical-align: top;
@@ -41,13 +41,13 @@
             margin-left: 5px;
         }
         a{
-            margin-right: 10px;
             color: blue;
             cursor: default;
             cursor: pointer;
             text-decoration: underline;
         }
         a.info{
+            margin-right: 10px;
             display: inline-block;
             width:14px;
             height: 14px;
@@ -74,9 +74,6 @@
             border-radius: 3px;
             cursor: pointer;
         }
-        .item-box{
-            display: none;
-        }
         .clearfix{
             zoom: 1;
         }
@@ -88,55 +85,61 @@
             visibility: hidden;
         }
         .vertical,.horizontal{
-            display: none;
-        }
-        .vertical .item-box{
-            margin-top:20px;
-        }
-        .vertical .title{
-            font-size: 14px;
-        }
-        .vertical .item-title{
+             display: none;
+         }
+        .item-title{
             font-weight: bold;
             font-size: 14px;
             line-height: 30px;
             border-bottom: 1px #ccc solid;
         }
-        .vertical .item-content{
+        .item-content{
             font-size: 13px;
             line-height: 30px;
-
+        }
+        .little{
+            float: left;
+        }
+        .info-item .title,.info-item .content{
+            float: left;
+        }
+        .box7,.box8,.box9{
+            display: none;
+        }
+        .item-content .inner-item{
+            display: inline-block;
+           white-space:nowrap;
         }
     </style>
 </head>
 <body>
 <table class="container horizontal" cellspacing="0">
     <tbody>
-    <tr class="item-box box1">
-        <td rowspan="7">
+    <tr class="item-box box7">
+        <!--<td rowspan="5">
             <div class="clearfix">
-                <span>智<br/>能<br/>推<br/>送</span>
+                <span class="little" style="margin-top: 17px;">智<br/>能<br/>推<br/>送</span>
                 <span class="little">︵<br/>仅<br/>供<br/>参<br/>考<br/>︶</span>
             </div>
-        </td>
+        </td>-->
         <td>
-            <label>>伴随症状:</label>
+            <label>>初步诊断:</label>
         </td>
         <td class="item-content">
         </td>
     </tr>
-    <tr class="item-box box4">
+    <tr class="item-box box8">
         <td>
-            <label>>查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;体:</label>
+            <label>>疑似诊断:</label>
         </td>
         <td>
             <div class="item-content">
             </div>
         </td>
     </tr>
-    <tr class="item-box box7">
+    <tr class="item-box box9">
         <td>
-            <label>>初步诊断:</label>
+            <label>>警惕:</label>
         </td>
         <td>
             <div class="item-content">
@@ -167,23 +170,33 @@
         </td>
         <td>
             <div class="item-content box">
+                无
+            </div>
+        </td>
+    </tr>
+    <tr class="item-box box0">
+        <td style="vertical-align: text-bottom;">
+            <label>>提示信息:</label>
+        </td>
+        <td>
+            <div class="item-content box0">
             </div>
         </td>
     </tr>
     </tbody>
 </table>
-<div class="vertical">
+<div class="container vertical">
     <div class="title">智能推送(仅供参考)</div>
-    <div class="item-box box1">
-        <div class="item-title">伴随症状</div>
+    <div class="item-box box7">
+        <div class="item-title">初步诊断</div>
         <div class="item-content"></div>
     </div>
-    <div class="item-box box4">
-        <div class="item-title">查体</div>
+    <div class="item-box box8">
+        <div class="item-title">疑似诊断</div>
         <div class="item-content"></div>
     </div>
-    <div class="item-box box7">
-        <div class="item-title">初步诊断</div>
+    <div class="item-box box9">
+        <div class="item-title">警惕</div>
         <div class="item-content"></div>
     </div>
     <div class="item-box box5">
@@ -196,6 +209,10 @@
     </div>
     <div class="item-box box">
         <div class="item-title">治疗建议</div>
+        <div class="item-content">无</div>
+    </div>
+    <div class="item-box box0">
+        <div class="item-title">提示信息</div>
         <div class="item-content"></div>
     </div>
 </div>

+ 71 - 25
static/pages/hisLib/diag_push.js

@@ -1,8 +1,8 @@
 (function ($) {
   var urls = {
-    'host':"/icss-web",
     //His推送接口
-    'get_push':'http://192.168.2.234:5008/push-web/algorithm/neural'
+    'get_push':'http://192.168.2.236/api/icss/emr/pushEMR',
+    'get_info':'http://192.168.2.236/api/icss/emr/getIntroduceByEMR'
   };
   $.support.cors = true;
   var config = {
@@ -13,7 +13,7 @@
   };
   var urlSearch = parseUrl();
   handleConfig();
-  getPushData();
+  //getPushData();
 
   function parseUrl() {
     var r = window.location.search.substr(1).split("&"),
@@ -28,13 +28,10 @@
   };
 
   function handleConfig(){
-    $("tr td:last-child,.item-box").css({width:config.width});
+    $(".container").css({'width':'560px'});
+    getPushData();
     $('.'+config.mode).show();
-    $('.item-box:visible:first td:first').attr('rowspan',config.models.length);
-    //显示对应项目
-    config.models.map((it)=>{
-      $('.'+config.mode+" .box"+it).show();
-    });
+
   }
   function getPushData(){
     var url = urls.get_push;
@@ -43,21 +40,25 @@
       past: urlSearch.pastJson||"",
       other: urlSearch.otherJson||"",
       vital: urlSearch.vitalsJson||"",
-      lis: urlSearch.labsJson||"",
+      lis: JSON.parse(urlSearch.labsJson||null),
       pacs: urlSearch.pacsJson||"",
       diag: urlSearch.disJson||"",
-      featureType: config.models.join(",")
+      featureType: config.models.join(","),
+      hosCode:'A001',
+      age:urlSearch.age,
+      sex:urlSearch.sexType
     };
 
     $.ajax({
       url: url,
       type:'post',
       dataType: "json",
+      cache:false,
       contentType:"application/json",
       data:JSON.stringify(myParam),
       success:function(response){
         var data = response.data;
-        if(response.ret=='0'){
+        if(response.code=='0'){
           fillPushData(data);
         }
       },
@@ -70,42 +71,87 @@
     });
   }
 
+  function getTreatInfo(type,name,detailName){
+    var url = urls.get_info;
+    var myParam = {
+      icdCode:urlSearch.icd,
+      type:type,
+      name:name,
+      detailName:detailName,
+      hosCode:'A001',
+      age:urlSearch.age,
+      sex:urlSearch.sexType
+    };
+
+    $.ajax({
+      url: url,
+      type:'post',
+      dataType: "json",
+      cache:false,
+      contentType:"application/json",
+      data:JSON.stringify(myParam),
+      success:function(response){
+        var data = response.data;
+        if(response.code=='0'){
+          fillInfomation(data);
+        }
+      },
+      error:function(error){
+        console.log("error:"+error);
+      },
+      complete:function(){
+        console.log("complete")
+      }
+    });
+  }
+
+  //填入提示信息
+  function fillInfomation(data){
+    var dom='';
+    for(var i=0;i<data.length;i++){
+      dom+='<div class="info-item clearfix"><span class="title">'+data[i].title+':</span><p class="content">'+data[i].text+'</p></div>';
+    }
+    $(".box0 .item-content").html(dom);
+  }
+
   //填入推送信息
   function fillPushData(data){
-    var maps = {1:'symptom',4:'vitals',5:'labs',6:'pacs',7:'dis',};
     if(!data||JSON.stringify(data)=='{}'){
       console.warn("获取推送数据为空!");
       return ;
     }
     var key='',modeClass='.'+config.mode;
-    config.models.map((it)=>{
-        key = maps[it];
-        var arr = [];
-      for(var n = 0;n <data[key].length; n++){
-        arr.push(data[key][n].featureName);
-      }
-      mapItem(modeClass+" .box"+it+' .item-content', arr);
+    mapItem(modeClass+" .box5", data['lisList'],5);   //化验
+    mapItem(modeClass+" .box6", data['pacsList'],6);   //辅捡
+    data['dis']['可能诊断'].length>0&&mapItem(modeClass+" .box7", data['dis']['可能诊断'],7);   //初步诊断
+    data['dis']['确诊'].length>0&&mapItem(modeClass+" .box8", data['dis']['确诊'],7);   //疑似诊断
+    data['dis']['警惕'].length>0&&mapItem(modeClass+" .box9", data['dis']['警惕'],7);   //警惕
+
+    $("a.info").click(function(e){
+      getTreatInfo($(e.target).attr('type'),$(e.target).attr('name'),$(e.target).attr('detailName'))
     });
+
     //$(modeClass+" .box .item-content").html(str);         //治疗建议
   }
   //遍历数据
-  function mapItem(dom,item){
+  function mapItem(dom,item,type){
     var itemDom = '';
     for(var i=0;i<item.length;i++){
       if(i>config.num-1){
-        itemDom += '<a href="##" class="hide">'+item[i]+'</a>';
+        itemDom += '<p class="inner-item"><a href="##" class="hide">'+(item[i].name||item[i].uniqueName)+'</a><a class="info hide" target="_blank name="'+item[i].name+'" type='+type+' detail="'+item[i].detailName+'>i</a></p>';
       }else{
-        itemDom += '<a href="##">'+item[i]+'</a>';
+        itemDom += '<p class="inner-item"><a href="##">'+(item[i].name||item[i].uniqueName)+'</a><a class="info" target="_blank" name='+item[i].name+' type="'+type+'" detail="'+item[i].detailName+'">i</a></p>';
       }
     }
-    $(dom).html(itemDom||"无");
+    $(dom+" .item-content").html(itemDom||"无");
+    $(dom).show();
     var hide = $(dom).find(".hide")[0];
     if(hide){
       $("<a class='more'>...</a>").insertBefore(hide);
       $(".more").click(function(e){
         $(e.target).siblings(".hide").removeClass("hide");
         $(e.target).hide();
-      })
+      });
     }
   }
 })(jQuery);