瀏覽代碼

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

# Conflicts:
#	src/common/components/EditableSpan/index.jsx
zhouna 6 年之前
父節點
當前提交
d6c5de52f3

+ 48 - 52
src/common/components/EditableSpan/index.jsx

@@ -37,7 +37,6 @@ class EditableSpan extends Component{
     this.handleKeydown = this.handleKeydown.bind(this);
     this.handleKeyup = this.handleKeyup.bind(this);
     this.moveEnd = this.moveEnd.bind(this);
-    this.stopIt = this.stopIt.bind(this);
   }
   handleFocus(e){
     e.stopPropagation();
@@ -98,7 +97,7 @@ class EditableSpan extends Component{
       isEnd = !(newText.indexOf(searchPre)>0);
       search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
       // if(!search&&searchPre){
-      if(!temp&&searchPre){
+      if(!temp&&searchPre&&newText){
         search = searchPre;
       }
       //console.log(labelVal,'旧:',searchPre,'新:',newText,'搜索:',search);
@@ -158,15 +157,23 @@ class EditableSpan extends Component{
         preVal:innerVal
       })
     }
-  }
-  stopIt(e){  
-    if(e.returnValue){  
-        e.returnValue = false ;  
-    }  
-    if(e.preventDefault ){  
-        e.preventDefault();  
-    }                 
-    return false;  
+    let range = window.getSelection();
+    let textIndex = range.focusOffset;
+    let textLength = range.anchorNode.length;
+    if(ev.keyCode==37){//向左
+      let preObj = $(this.$span.current).prev();
+      let obj = preObj[0]&&preObj[0].nodeName=="DIV"?preObj.prev():preObj;
+      if(textIndex == 0){
+        this.moveEnd(obj[0]);
+      }
+    }
+    if(ev.keyCode==39){//向右
+      let nextObj = $(this.$span.current).next();
+      let obj = nextObj[0]&&nextObj[0].nodeName=="DIV"?nextObj.next():nextObj;
+      if(textIndex == textLength){
+        obj.focus();
+      }
+    }
   }  
   handleKeyup(e){
     const {boxMark,handleKeydown,i,value,removeId,handleClear,delSingleLable,setSearchLocation} = this.props;
@@ -174,19 +181,12 @@ class EditableSpan extends Component{
     const ev = e||window.event;
     const target = ev.target||ev.srcElement;
     let innerVal = target.innerText || target.innerHTML;
-    if(ev.keyCode==8){
-      const elem = ev.srcElement || ev.currentTarget;
-      const nodeN = elem.nodeName;
-      
+    if(ev.keyCode==8){     
       let ele = document.activeElement;
-      let boxTop = target.innerText?getPageCoordinate(e).boxTop:NaN;
-      setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
-      if(nodeN != "SPAN"){//光标没落到span的时候阻止默认事件(backspace回退页面的情况)
-        return this.stopIt(ev);
-      }
+      let boxTop = getPageCoordinate(e).boxTop;
+      // setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
       // 主诉现病史去重:删除最后一个字的时候移除该数据(将name、id和value替换成空)并移除id
       // 前面是标签,内容为空时再删一次才移除标签;前面是文本,则直接移除;
-      // console.log(77,elem,nodeN);
       let preObj = $(this.$span.current).prev();
       if(index!==0&&preVal.trim().length==1&& !innerVal){
           removeId && removeId({boxMark,i:index,text:""});
@@ -196,28 +196,33 @@ class EditableSpan extends Component{
           }
         }
 
-      if(innerVal !==preVal){return false}
-      // 中英文数字和下划线--单独删除标签
-      /*const reg = new RegExp("([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9_])");
-      if(index!==0 && reg.test(innerVal)){
-        let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
-        delSingleLable && delSingleLable({boxMark,i:index});
-        this.moveEnd(obj[0]);  
-        this.setState({
-          index: null
-        })
-      }*/
-      let data = innerVal.trim();
-      //判断是否为空、中英文:, 。、;,且不是第一位
-      let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$\s/);
-      if(index!==0 && pattern.test(data)){
-        // let preObj = $(this.$span.current).prev();
-        let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
-        handleKeydown&&handleKeydown({boxMark,i:index,text:data});
-        this.moveEnd(obj[0]);  
-        this.setState({
-          index: null
-        })
+      // if(innerVal !==preVal){return false}
+      if(innerVal !==preVal){
+
+      }
+      else{
+        // 中英文数字和下划线--单独删除标签
+        /*const reg = new RegExp("([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9_])");
+        if(index!==0 && reg.test(innerVal)){
+          let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
+          delSingleLable && delSingleLable({boxMark,i:index});
+          this.moveEnd(obj[0]);  
+          this.setState({
+            index: null
+          })
+        }*/
+        let data = innerVal.trim();
+        //判断是否为空、中英文:, 。、;,且不是第一位
+        let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$|\s/);
+        if(index!==0 && pattern.test(data)){
+          // let preObj = $(this.$span.current).prev();
+          let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
+          handleKeydown&&handleKeydown({boxMark,i:index,text:data});
+          this.moveEnd(obj[0]);  
+          this.setState({
+            index: null
+          })
+        }
       }
     }
   }
@@ -247,15 +252,6 @@ class EditableSpan extends Component{
       }
     }*/
 
-  /*cancelSelect(e){//双击不选中
-    if(document.selection&&document.selection.empty){
-        document.selection.empty();
-      }else if (window.getSelection) {
-        var sel=window.getSelection();
-        sel.removeAllRanges();
-      }
-    }*/
-
   getClass(){
     const {full,value,saveText,i} = this.props;
     const preSelected = saveText[i-1];

+ 2 - 2
src/common/components/ItemBox/index.jsx

@@ -47,10 +47,10 @@ class ItemBox extends Component {
   }
 
   render(){
-    const {title,children,editable,className,handleFocus,onchange,fuzhen,border,handleBlur,titleTop,backgroundColor} = this.props;
+    const {title,children,editable,className,handleFocus,onchange,fuzhen,border,handleBlur,titleTop,backgroundColor,boxId} = this.props;
     return <div className={style["box"]+" "+"clearfix"} >
       <div className={style["title"] + ' '+(className||'')} style={{marginTop:titleTop?'22px':''}}>{title}</div>
-      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur}>
+      <div ref={this.$div} className={`${style["content"]} ${border?style["border"]:''} ${backgroundColor?style["noBorder"]:''}`} contentEditable={editable} style={this.getBoxStyle()} onFocus={handleFocus} onInput={this.handleInput} onClick={(e)=>{this.handleClick(e);}} onBlur={handleBlur} id={boxId}>
         {fuzhen?children||fuzhen:children}
       </div>
     </div>

+ 17 - 16
src/common/components/NumberUnitPan/index.jsx

@@ -3,6 +3,7 @@ import style from './index.less';
 import config from '@config/index.js';
 import Notify from '../Notify/index.js';
 import ReactDom from "react-dom";
+import backspace from '../../images/backspace.png'
 
 class NumberUnitPan extends Component{
   constructor(props){
@@ -25,7 +26,7 @@ class NumberUnitPan extends Component{
     this.setState({
       value: value+text
     });
-    onSelect&&onSelect(value+text);
+    onSelect&&onSelect({text:value+text,mark:true});//增加mark参数,清空删除不提示字数限制
   }
   handleClear(e){
     e.stopPropagation();
@@ -33,7 +34,7 @@ class NumberUnitPan extends Component{
     this.setState({
       value: ''
     });
-    onSelect&&onSelect('');
+    onSelect&&onSelect({text:'',mark:false});
   }
   handleClose(e){
     e.stopPropagation();
@@ -54,7 +55,7 @@ class NumberUnitPan extends Component{
     this.setState({
       value:text
     });
-    onSelect&&onSelect(text);
+    onSelect&&onSelect({text,mark:false});
   }
   getStyle(){
     const {left,top,show} = this.props;
@@ -82,36 +83,36 @@ class NumberUnitPan extends Component{
           <td><span onClick={this.handleSelect}>1</span></td>
           <td><span onClick={this.handleSelect}>2</span></td>
           <td><span onClick={this.handleSelect}>3</span></td>
-          <td><span onClick={this.handleSelect}>/</span></td>
+          <td><span onClick={this.handleSelect}>分</span></td>
+          <td><span onClick={this.handleSelect}>周</span></td>
+          <td><span onClick={this.handleSelect}>余</span></td>
         </tr>
         <tr>
           <td><span onClick={this.handleSelect}>4</span></td>
           <td><span onClick={this.handleSelect}>5</span></td>
           <td><span onClick={this.handleSelect}>6</span></td>
-          <td><span onClick={this.handleBack.bind(this)}>回退</span></td>
+          <td><span onClick={this.handleSelect}>时</span></td>
+          <td><span onClick={this.handleSelect}>月</span></td>
+          <td><span onClick={this.handleSelect}>次</span></td> 
         </tr>
         <tr>
           <td><span onClick={this.handleSelect}>7</span></td>
           <td><span onClick={this.handleSelect}>8</span></td>
           <td><span onClick={this.handleSelect}>9</span></td>
-          <td><span onClick={this.handleClear.bind(this)}>清空</span></td>
+          <td><span onClick={this.handleSelect}>天</span></td>
+          <td><span onClick={this.handleSelect}>年</span></td>
+          <td><span onClick={this.handleSelect}>岁</span></td> 
         </tr>
         <tr>
           <td><span onClick={this.handleSelect}>.</span></td>
           <td><span onClick={this.handleSelect}>0</span></td>
           <td><span onClick={this.handleSelect}>~</span></td>
-          <td><span onClick={this.handleClose.bind(this)}>确定</span></td>
-        </tr>
-        <tr>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.minute}</span></td>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.hour}</span></td>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.day}</span></td>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.age}</span></td>
+          <td><span onClick={this.handleSelect}>/</span></td>
+          <td colspan="2" className={style['imgN']}><img src={backspace} onClick={this.handleBack.bind(this)} /></td>
         </tr>
         <tr>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.week}</span></td>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.month}</span></td>
-          <td><span onClick={this.handleSelect}>{config.timeUnit.year}</span></td>
+          <td colspan="3"><span onClick={this.handleClear.bind(this)} className={style['clearN']}>清空</span></td>
+          <td colspan="3"><span onClick={this.handleClose.bind(this)} className={style['comf']}>确定</span></td>
         </tr>
       </table>
       </div>

+ 24 - 0
src/common/components/NumberUnitPan/index.less

@@ -24,4 +24,28 @@
   span:hover{
     border-color: @blue;
   }
+   .imgN{
+    text-align: right;
+    vertical-align: middle;
+    padding-right: 8px;
+    cursor: pointer;
+  } 
+  .clearN{
+    color:#F6514A;
+    text-align: left;
+    padding-left: 8px;
+    font-weight: bold;
+  }
+  .comf{
+    color:#3B9ED0;
+    text-align: right;
+    padding-right: 8px;
+    font-weight: bold;
+  }
+  .comf:hover{
+    border-color: #fff;
+  }
+  .clearN:hover{
+    border-color: #fff;
+  }
 }

二進制
src/common/images/backspace.png


+ 79 - 9
src/components/CommonSymptom/index.jsx

@@ -1,9 +1,9 @@
 import React,{Component} from 'react';
 import classNames from 'classnames';
-
+import $ from 'jquery';
 import style from "./index.less";
 /****
- * 主诉常见症状下拉
+ * 主诉常见症状下拉--修改为横铺多选(3.13)
  * 接收参数:
  * data: json数组
  * show:true/false
@@ -17,7 +17,14 @@ import style from "./index.less";
 class CommonSymptom extends Component{
   constructor(props){
     super(props);
+    this.state={
+      select:[],
+      ids:[],
+      hide:false
+    }
     this.handleSelect = this.handleSelect.bind(this);
+    this.handleClear = this.handleClear.bind(this);
+    this.handleConfirm = this.handleConfirm.bind(this);
   }
   getClass(){
     let name = style['text-list'];
@@ -37,18 +44,81 @@ class CommonSymptom extends Component{
 
   handleSelect(e,item){
     e.stopPropagation();
-    const {onSelect,onShow} = this.props;
-    onSelect&&onSelect(item);
-    // onShow&&onShow(e,false);
+    let {select,ids} = this.state;
+    const id = item.questionId
+    if(ids.includes(id)){
+      ids.splice(ids.indexOf(id),1);
+      let selectData = select;
+      select.forEach((it,i)=>{
+        if(it.id==id){
+         selectData.splice(i,1); 
+        }
+      })
+      select = selectData;
+    }else{
+      ids.push(id);
+      select.push(item);
+    }
+    this.setState({
+      select,
+      ids
+    })
+  }
+  getStyle(id){
+    const {ids} = this.state;
+    if(ids.includes(id)){
+      return style['selected'];
+    }
+    return '';
+  }
+  handleClear(e){
+    e.stopPropagation();
+    this.setState({
+      select:[],
+      ids:[]
+    })
+  }
+  handleConfirm(e){
+    e.stopPropagation();
+    const {onSelect} = this.props;
+    const {select,ids} = this.state;
+    onSelect&&onSelect({select,ids});
   }
-  render(){  
+
+  componentDidMount(){
+    const {hideSymptom} = this.props;
+    $(document).click((e)=>{     
+      let itemBox = $('#mainSuit')[0];
+      let divBox = $('#symptBox')[0];
+      let listBox = $('#listBox')[0];
+      let operBox = $('#oper')[0];
+      if(e.target != itemBox && e.target.parentNode != divBox && e.target.parentNode != listBox && e.target.parentNode != operBox){
+        this.setState({
+          hide:true,
+          select:[],
+          ids:[]
+        })
+      }else{
+        this.setState({
+          hide:false
+        })
+      }
+    })
+  }
+
+  render(){ 
     const {data} = this.props;
-    return <div className={this.getClass()} contenteditable="false">
-      <ul className={style["listBox"]}>
+    const {hide} = this.state;
+    return <div className={this.getClass()} contenteditable="false" id="symptBox" style={{'display':hide?'none':'block'}}>
+      <ul className={style["listBox"]} id="listBox">
         {data&&data.map((it)=>{
-          return <li onClick={(e)=>this.handleSelect(e,it)}>{it.name}</li>
+          return <li onClick={(e)=>this.handleSelect(e,it)} className={this.getStyle(it.questionId)} title={it.name.length>5?it.name:''}>{it.name.length>5?it.name.slice(0,4)+'...':it.name}</li>
         })}
       </ul>
+      <div className={style['oper']} id="oper">
+        <span className={style['clear']} onClick={this.handleClear}>清空选项</span>
+        <span className={style['confirm']} onClick={this.handleConfirm}>确定</span>
+      </div>
     </div>
   }
 }

+ 37 - 8
src/components/CommonSymptom/index.less

@@ -2,22 +2,51 @@
 .list{
   .pop;
   left: 85px;
-  padding: 0 0 10px;
+  // padding: 0 0 10px;
+  padding: 5px;
+  white-space: pre-wrap;
   .listBox{
-    max-height: 370px;
-    overflow-y: auto;
+    // max-height: 370px;
+    // overflow-y: auto;
+    max-width: 460px;
+    // overflow-x: auto;
+    // display: inline-block;
+    // margin-right: 5px;
   }
   li{
-    width: 200px;
-    line-height: 35px;
-    border:1px #fff solid;
-    padding: 0 20px 0 30px;
-    white-space: nowrap;
+    width: 85px;
+    line-height: 32px;
+    // border:1px #fff solid;
+    // padding: 0 20px 0 30px;
+    // padding:0 20px;
+    // white-space: nowrap;
+    padding-left: 15px;
+    margin-right: 5px;
     cursor: pointer;
+    display: inline-block;
+    // text-align: center;
   }
   li:hover{
     border-color:#3B9ED0;
   }
+  .selected{
+    .select-li;
+    width: 85px;
+    // text-align: center;
+  }
+  .clear{
+    .clear;
+    margin-left: 15px;
+  }
+  .confirm{
+    .confirm;
+    width: 75px;
+    margin-left: 15px;
+  }
+  .oper{
+    margin-top: 5px;
+    padding-right: 5px;
+  }
 }
 .hide{
   display: none;

+ 12 - 5
src/components/CurrentIll/index.jsx

@@ -22,6 +22,7 @@ class CurrentIll extends Component{
       show:true,
       tmpScroll:0,
       tmpTop:0,
+      setDataTimer:null
     }
     this.toggleEditable = this.toggleEditable.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
@@ -42,8 +43,9 @@ class CurrentIll extends Component{
 
   handleFocus(e){
     // 判断主诉是否为空
-    const {mainData,mainText,setData,moduleNum,mainIds,data,changeEditIll,editClear} = this.props;
+    const {mainData,mainText,setData,moduleNum,mainIds,data,changeEditIll,editClear,symptomFeature} = this.props;
     const that = this;
+    let {setDataTimer} = this.state; 
     let mainFinallyText = filterDataArr(mainText);
     // if(mainData.length == 0 && !mainText[0]){
     if(!mainFinallyText){
@@ -53,12 +55,17 @@ class CurrentIll extends Component{
         forbidInput:true
       })
     }else {
-      // let useEmpty = mainData.length>0?false:true;
       let num = moduleNum.num;//主诉使用了几个模板
       // if(editClear && data.length==0){//第一次聚焦去设置现病史的data
-      if(data.length==0){//第一次聚焦去设置现病史的data
-        // setData && setData({useEmpty,num,mainData,mainIds});//是否使用空模板 及数据处理
-        setData && setData({num,mainData,mainIds});//是否使用空模板 及数据处理
+      if(data.length==0){
+        // setData && setData({useEmpty,num,mainData,mainIds});
+        clearTimeout(setDataTimer);
+        setDataTimer = setTimeout(function(){//延时,等待主诉失焦数据返回
+          setData && setData({num,mainData,mainIds,symptomFeature:symptomFeature.featureData});
+        },200)  
+        this.setState({
+          setDataTimer
+        })
       }
       this.setState({
           showMoudle:true,

+ 27 - 19
src/components/MainSuit/index.jsx

@@ -101,18 +101,23 @@ class MainSuit extends Component{
   }*/
 
   handleSelect(item){//选中的常见症状
-    const {clearCommS,insertMain,getData} = this.props;
-    // 获取主诉模板
-    getData && getData();
-    // 让模板出现
-    this.setState({
-        showModule:true,
-        symptom: false,
-      }) 
-    //选中后清空下拉结果
-    insertMain && insertMain(item);
-    clearCommS && clearCommS();
-    
+    if(item.select.length>0){
+      const {clearCommS,insertMain,getData} = this.props;
+      // 获取主诉模板
+      getData && getData();
+      // 让模板出现
+      this.setState({
+          showModule:true,
+          symptom: false,
+        }) 
+      //选中后清空下拉结果
+      insertMain && insertMain(item);
+      clearCommS && clearCommS();
+    }else{//没有选中点确定-关闭
+      this.setState({
+        symptom: false
+      })
+    } 
   }
 
 
@@ -126,7 +131,7 @@ class MainSuit extends Component{
       clearSearch && clearSearch();
       return
     }
-    clearTimeout(this.state.timer);
+    // clearTimeout(this.state.timer);
     if(datas.length==0){//没有使用模板时点击搜索结构要展开模板
       insertSearch &&insertSearch({item,span});
       this.setState({
@@ -217,7 +222,7 @@ class MainSuit extends Component{
     const timer = setTimeout(function(){
       pushMessage && pushMessage(data);
       //调搜索接口 使用模板走EditableSpan里的搜索方法
-      getSearchData && getSearchData({inpStr:data,boxMark:1});
+      getSearchData && getSearchData({inpStr:data,boxMark:1,itemType:0});
     },config.delayTime);
     this.setState({
       timer
@@ -226,10 +231,13 @@ class MainSuit extends Component{
   }
 
   handleBlur(e){//隐藏常见症状下拉、存自由输入的值
-    const {freeText,saveText,datas,clearSearch} = this.props;
+    const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData} = this.props;
     const that = this;
     let data = this.state.inpText;
     if(!isIE()){
+      if(currentData&&currentData.length==0){//现病史没有模板的时候才去获取
+        getSymptomFeature && getSymptomFeature(e.target.innerText);
+      } 
       e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
       freeText && freeText(data.trim());
     }else{
@@ -241,7 +249,7 @@ class MainSuit extends Component{
       }
     }
     // 延时关闭常见症状下拉、清空搜索结果,不延时会影响选中
-      clearTimeout(this.state.clearTimer);
+      /*clearTimeout(this.state.clearTimer);
       const clearTimer = setTimeout(function(){
         clearSearch && clearSearch();
         that.setState({
@@ -250,8 +258,7 @@ class MainSuit extends Component{
       },config.delayTime-200);
       this.setState({
         clearTimer
-      });
-    
+      });*/  
   }
 
 
@@ -273,7 +280,8 @@ class MainSuit extends Component{
       onchange={(e)=>{this.handleChange(e)}} 
       handleClick={this.handleClick} 
       handleBlur={this.handleBlur}
-      data={datas}>
+      data={datas}
+      boxId="mainSuit">
         {datas.length>0?<div style={{display:'inline-block'}}>{this.getInlineTag()}</div>:(saveText[0]?saveText[0]:'')}
       </ItemBox>
       {/*没有推送结果就不显示*/}

+ 4 - 4
src/components/NumberUnitDrop/index.jsx

@@ -40,17 +40,17 @@ class NumberUnitDrop extends Component{
     this.handleNumClick = this.handleNumClick.bind(this);
     this.changeToEdit = this.changeToEdit.bind(this);
   }
-  select(text){         //选中键盘上数字事件
+  select(obj){         //选中键盘上数字事件
     const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
     this.setState({
       hasSelect:true
     });
-    if(!text){
+    if(!obj.text){
       this.setState({
         value:''
       });
     }
-    handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
+    handleSelect&&handleSelect({ikey,text:obj.text,suffix,prefix,mainSaveText,mark:obj.mark});
   }
   
   handleNumClick(e){ 
@@ -181,7 +181,7 @@ class NumberUnitDrop extends Component{
             onkeydown={handleEnter}
             style={{cursor:editable?'text':'pointer'}}>{value||placeholder}</span>
       <span>{suffix}</span>
-      <NumberUnitPan handleSelect={(text)=>this.select(text)}
+      <NumberUnitPan handleSelect={(obj)=>this.select(obj)}
                  onClose={handleHide}
                  top={boxTop}
                  left={boxLeft}

+ 1 - 1
src/components/NumberUnitDrop/index.less

@@ -17,4 +17,4 @@
 .blued{
   background: @blue;
   color: #fff;
-}
+}

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

@@ -52,7 +52,7 @@ class RadioDrop extends Component{
     return style['tag'];
   }
   handleSelect(item){
-    const {handleSelect,ikey,mainSaveText} = this.props;
+    const {handleSelect,ikey,mainSaveText,value} = this.props;
     if(!item){      //清空
       handleSelect&&handleSelect({ikey});
       return ;
@@ -70,7 +70,7 @@ class RadioDrop extends Component{
         text = item.name;
         // text = item.questionDetailList&&item.questionDetailList.length>0?item.questionDetailList[0].name: item.name;
     }
-    handleSelect&&handleSelect({ikey,id:item.id,text,mainSaveText});
+    handleSelect&&handleSelect({ikey,id:item.id,text,mainSaveText,value});
   }
   handleShow(e){
     //e.stopPropagation();

+ 1 - 1
src/components/SearchDrop/index.jsx

@@ -61,7 +61,7 @@ class SearchDrop extends Component{
         <ul>
           {this.props.data&&this.props.data.map((it)=>{
             litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
-            return <li onmouseup={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
+            return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
           })}
         </ul>
       </div>

+ 1 - 0
src/containers/CurrentIll.js

@@ -26,6 +26,7 @@ function mapStateToProps(state) { //console.log(111,state);
         update:state.currentIll.update,//用于更新
         mainText:state.mainSuit.saveText,//主诉选中的数据
         mainData:state.mainSuit.data,//主诉使用的模板
+        symptomFeature:state.mainSuit.symptomFeature,//主诉分词数据
         moduleNum:state.mainSuit.moduleNum,//主诉使用的模板
         type: state.typeConfig.typeConfig,
         mainIds:state.mainSuit.mainIds,//主诉症状选中的id(去重用)

+ 1 - 1
src/containers/EditableSpan.js

@@ -21,7 +21,7 @@ function mapStateToProps(state){//console.log(state)
 function mainSuitSearch(obj){
   return (dispatch)=>{
     const text = obj.text.replace(/\,/,'');
-    getSearch({boxMark:1,inpStr:text,mainIds:obj.mainIds}).then((res)=>{
+    getSearch({boxMark:1,inpStr:text,mainIds:obj.mainIds,itemType:0}).then((res)=>{
       if(res.data.code=='0'){
         dispatch({
           type:SET_SEARCH,

+ 15 - 3
src/containers/MainSuit.js

@@ -1,18 +1,18 @@
 import React from 'react';
 import { connect } from 'react-redux';
 import MainSuit from '@components/MainSuit';
-import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE} from '@store/types/mainSuit';
+import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE} from '@store/types/mainSuit';
 import {RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION} from '@store/types/homePage.js';
 import {getCommSymptoms,getCommSymptomPush} from '@store/async-actions/mainSuit.js'
 import {SET_MAIN_SUIT} from '@store/types/fillInfo';
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
-import {getSearch} from '@store/async-actions/fetchModules';
+import {getSearch,getFeature} from '@store/async-actions/fetchModules';
 import {billing} from '@store/async-actions/pushMessage';
 import {filterArr,didPushParamChange,filterDataArr} from '@utils/tools.js';
 import config from '@config/index.js';
 import {Notify} from '@commonComp';
 
-function mapStateToProps(state) {
+function mapStateToProps(state) {//console.log(11,state);
   return {
     showDrop:state.mainSuit.showDrop,//用于更新
     update:state.mainSuit.update,
@@ -35,6 +35,7 @@ function mapStateToProps(state) {
     commSymHide:state.homePage.commSymHide,
     boxTop:state.homePage.boxTop,
     boxLeft:state.homePage.boxLeft,
+    currentData:state.currentIll.data,
   }
 }
 
@@ -166,6 +167,17 @@ function mapDispatchToProps(dispatch) {
           left:left,
           dis:0
         })
+      },
+      async getSymptomFeature(item){
+        const it = item&&item.trim();
+        const symptomFeature = await getFeature(it);
+        if(symptomFeature.data.code==0){
+          const data = symptomFeature.data.data;
+          dispatch({
+            type:SET_FEATURE,
+            data:data
+          })
+        }
       }
     }
 }

+ 8 - 6
src/containers/NumberUnitDrop.js

@@ -47,15 +47,17 @@ function currentSelect(dispatch,params){
 }
 
 function handleModuleDiff(dispatch,params){
-  const {mainSaveText} = params;
+  const {mainSaveText,mark} = params;
   const type = params.ikey.substr(0,1);    //当前所在的项目
   switch (+type){
     case 1:
-      let text = filterDataArr(mainSaveText);
-      if(text.length >= config.limited){
-        Notify.info(config.limitText);
-        return
-      }
+      if(mark){//选中才限制,清空和回退无需验证
+        let text = filterDataArr(mainSaveText);
+        if(text.length >= config.limited){
+          Notify.info(config.limitText);
+          return
+        }
+      } 
       mainSelect(dispatch,params);
       break;
     case 2:

+ 8 - 5
src/containers/RadioDrop.js

@@ -64,14 +64,17 @@ function checkSelect(dispatch,params){
 }
 //在不同模块(主诉、现病史等)下拉选中调用不同事件
 function handleModuleDiff(dispatch,store,params){
-  const {mainSaveText} = params;
+  const {mainSaveText,value,text} = params;
   const type = params.ikey.substr(0,1);    //当前所在的项目
   switch (+type){
     case 1:
-      let text = filterDataArr(mainSaveText);
-      if(text.length >= config.limited){
-        Notify.info(config.limitText);
-        return
+      if(text){//有选值才需要判断,清空不需要处理
+        let mainText = filterDataArr(mainSaveText);
+        let lengths = value?mainText.length - value.length + text.length:mainText.length + text.length;
+        if(lengths >= config.limited){
+          Notify.info(config.limitText);
+          return
+        }
       }
       mainSelect(dispatch,params);
       break;

+ 2 - 2
src/containers/SpreadDrop.js

@@ -295,10 +295,10 @@ function mainSuitCheck(dispatch,store,params){
   const {nones,exists,withs,order,mainSaveText,value} = params;
   let existsName = getNames(exists,order);
   let text = filterDataArr(mainSaveText);
-  if(text.length >= config.limited){
+  /*if(text.length >= config.limited){
     Notify.info(config.limitText);
     return
-  }
+  }*/
   // let lengths = text.length + existsName.length;
   let lengths = value?(text.length - value.length + existsName.length):(text.length + existsName.length);
   if(lengths > config.limited){

+ 12 - 1
src/modules/HomePage/index.jsx

@@ -38,8 +38,19 @@ class HomePage extends Component {
             let reHeight = $(window).height();  
             setWindow && setWindow({width:reWidth,height:reHeight});
         })    
-
+        //光标没落到元素上继续backspace防止页面回退
+        $(window).on("keydown",(e)=>{   
+            let ev = e || window.event;  
+            if(ev.keyCode==8){
+                const elem = ev.srcElement || ev.target;
+                const nodeN = elem.nodeName;
+                if(nodeN != "SPAN" && nodeN != "DIV" && nodeN != "INPUT"){
+                    return false;
+                }
+            } 
+        })
     }
+
     render() {
         const {flag} = this.props;
         return <div className={style['home-page']} onClick={this.props.hideAllDrop}>

+ 144 - 78
src/store/actions/currentIll.js

@@ -62,6 +62,7 @@ export const setData = (state,action) =>{
   const mainIds = action.info.mainIds;
   res.symptomIds = JSON.parse(JSON.stringify(mainIds));
   const num = action.info.num;//点击了几次添加病情变化
+  const symptomFeature = action.info.symptomFeature;//分词
   // const useEmpty = action.info.useEmpty;
   let useEmpty,mainData;
   // let mainData = JSON.parse(JSON.stringify(action.info.mainData));//主诉模板数据
@@ -84,10 +85,9 @@ export const setData = (state,action) =>{
   /*let mainLabelModuleArr = objToArr.filter((item)=>{
     return item.questionMapping.length>0;
   })*/
-
   // 是否使用空模板:num=0时判断mainIds,num>=1,截取第一病程遍历是否有症状exist
   if(num==0){
-    useEmpty = mainIds.length>0?false:true;
+    useEmpty = mainIds.length>0 ? false:true;
     mainData = mainModleData;
   }else{
     let sliceIdx;
@@ -102,36 +102,37 @@ export const setData = (state,action) =>{
     })
     useEmpty = existData&&existData.length>0?false:true;
   }
-  
+  // console.log(888,useEmpty);
   if (useEmpty) {
     // res.data = res.emptyData;
     res.data = JSON.parse(JSON.stringify(res.emptyData));
   } else {
-    // 目前只需要将第一个主诉病程移植到现病史
-    let tongYong = "";
-    let main = [];//主症状
-    let withs = [];//伴随
-    let firstT = 0;
-    for(let i=0; i<mainData.length; i++){
-        if(mainData[i].id==config.tongYId && !mainData[i].pos){//第一个通用特征描述
-          if(mainData[i].value){
-            tongYong = mainData[i].value;
-          }
-        }       
-        else if(mainData[i].exist){
-          mainData[i].exist==1?main.push(mainData[i]):withs.push(mainData[i])
-        }
-        
-        // 处理时间和主诉通用症状--现病史模板无“主诉通用症状” 1-7
-        for(let j=0; j<current.length; j++){
-          if(mainData[i].id==current[j].id && mainData[i].controlType==5){//处理时间,避免手动输入的值
-            firstT++
-            if(mainData[i].value && firstT==1){
-              current[j] = {id:mainData[i].id,name:mainData[i].value,value:mainData[i].value,tagType:config.tagType}
+    if(mainData&&mainData.length>0){//主诉使用模板
+      // 目前只需要将第一个主诉病程移植到现病史
+      let tongYong = "";
+      let main = [];//主症状
+      let withs = [];//伴随
+      let firstT = 0;
+      for(let i=0; i<mainData.length; i++){
+          if(mainData[i].id==config.tongYId && !mainData[i].pos){//第一个通用特征描述
+            if(mainData[i].value){
+              tongYong = mainData[i].value;
             }
-          }  
+          }       
+          else if(mainData[i].exist){
+            mainData[i].exist==1?main.push(mainData[i]):withs.push(mainData[i])
+          }
+          
+          // 处理时间和主诉通用症状--现病史模板无“主诉通用症状” 1-7
+          for(let j=0; j<current.length; j++){
+            if(mainData[i].id==current[j].id && mainData[i].controlType==5){//处理时间,避免手动输入的值
+              firstT++
+              if(mainData[i].value && firstT==1){
+                current[j] = {id:mainData[i].id,name:mainData[i].value,value:mainData[i].value,tagType:config.tagType}
+              }
+            }  
+          }
         }
-      }
       
       // 主症状添加tongYong标签选中文字
       let tongYText = tongYong?{name:tongYong,value:tongYong,tagType:config.tagType}:'';
@@ -250,7 +251,52 @@ export const setData = (state,action) =>{
       }
       let currentData = JSON.parse(JSON.stringify(current));
       res.data = fullfillText(currentData).newArr;
-
+    }else{//分词
+      if(symptomFeature&&symptomFeature.length>0){
+        let featureData = JSON.parse(JSON.stringify(symptomFeature));
+        let ind = 0;
+        let insertInd = 0;
+        let lengArr=[];
+        for(let k=0; k <symptomFeature.length;k++){        
+          mainLabelModuleArr.map((v,i)=>{
+            if(symptomFeature[k].id==v.id){
+              ind++;
+              let items = v.questionMapping.filter((item)=>{
+                              return item.symptomType==0||item.symptomType==1;
+                            })          
+              lengArr[k] = items.length;  //每一个主诉尾巴长度 
+              
+              if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
+                for(let j=0; j<featureData.length; j++){
+                  if(featureData[j].id==symptomFeature[k].id){
+                    featureData[j].value = featureData[j].name = symptomFeature[k].value+',';
+                  }
+                }
+              }
+              if(ind>1){
+                insertInd += lengArr[k-1];
+              }
+              featureData.splice(k+insertInd+1,0,...items);
+            }
+          })
+        }
+        //组装好的主症状和伴随症状插入现病史模板(flag=4前)
+        let endFeatureData = JSON.parse(JSON.stringify(featureData));
+        let insertIdx = null;
+        for(let j=0; j<current.length; j++){
+            if(current[j].flag && current[j].flag==4){
+              insertIdx = j;  
+            }
+          }
+     
+        for(let k=0; k<endFeatureData.length; k++){
+          let pos = insertIdx+k;
+          current.splice(pos,0,endFeatureData[k]);
+        }
+        let currentData = JSON.parse(JSON.stringify(current));
+        res.data = fullfillText(currentData).newArr;
+      }
+    }
   }
   let resData = JSON.parse(JSON.stringify(res.data));
   res.saveText = fullfillText(resData).saveText;
@@ -535,11 +581,12 @@ export function setCheckText(state,action) {
 //搜索 插入标签数据
 export function insertLabelData(state,action){
   let res = Object.assign({},state); 
-  const {index,data,isReplace,span}=action;
+  const {index,data,isReplace,span}=action;console.log('现病史搜索数据',action);
   let id = data.id;
   let searchData = action.name;
-  res.symptomIds.push(id);
+  // res.symptomIds.push(id);
   const text = Object.assign(JSON.parse(config.textLabel),{name:searchData},{id:id});
+  const textEmpty = Object.assign({},JSON.parse(config.textLabel));
   let focusIndex = res.focusIndex;
   let saveText = res.saveText;
   let banIdx = saveText.indexOf("伴");
@@ -556,55 +603,15 @@ export function insertLabelData(state,action){
     res.saveText[focusIndex] = searchData;
   }else{
     let resData;
-    // res.data.splice(index,0,data);
     const searchStr = res.searchStr;
     let innerText = span.current.innerText || span.current.innerHTML;
     let strIndex = innerText.indexOf(searchStr);
     const value = innerText.replace(searchStr,"");
-    // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
-    if(banIdx==-1){
-      // if(strIndex <= 1){//前
-      if(strIndex < 1){//前
-        res.data.splice(focusIndex,0,text);
-        res.saveText.splice(focusIndex,0,searchData);
-        res.data[focusIndex+1].value = value;
-        res.saveText[focusIndex+1] = value;
-        resData = JSON.parse(JSON.stringify(res.data));
-        resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
-                                return item.symptomType==0||item.symptomType==1;
-                              })));
-      }else{
-        res.data.splice(focusIndex+1,0,text);
-        res.saveText.splice(focusIndex+1,0,searchData);
-        res.data[focusIndex].value = value;
-        resData = JSON.parse(JSON.stringify(res.data));
-        // +2是因为插入一个文本标签  
-        resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
-                                return item.symptomType==0||item.symptomType==1;
-                              })));
-      }
-    }else{
-      if(focusIndex > banIdx){//伴后
-        if(strIndex < 1){//前
-          res.data.splice(focusIndex,0,text);
-          res.saveText.splice(focusIndex,0,searchData);
-          res.data[focusIndex+1].value = value;
-          res.saveText[focusIndex+1] = value;
-          resData = JSON.parse(JSON.stringify(res.data));
-          resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
-                                  return item.symptomType==0||item.symptomType==2;
-                                })));
-        }else{
-          res.data.splice(focusIndex+1,0,text);
-          res.saveText.splice(focusIndex+1,0,searchData);
-          res.data[focusIndex].value = value;
-          resData = JSON.parse(JSON.stringify(res.data));
-          // +2是因为插入一个文本标签  
-          resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
-                                  return item.symptomType==0||item.symptomType==2;
-                                })));
-        }
-      }else{//伴前
+    if(data.itemType==0){//症状
+      res.symptomIds.push(id);
+      // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
+      if(banIdx==-1){
+        // if(strIndex <= 1){//前
         if(strIndex < 1){//前
           res.data.splice(focusIndex,0,text);
           res.saveText.splice(focusIndex,0,searchData);
@@ -618,20 +625,79 @@ export function insertLabelData(state,action){
           res.data.splice(focusIndex+1,0,text);
           res.saveText.splice(focusIndex+1,0,searchData);
           res.data[focusIndex].value = value;
+          res.saveText[focusIndex] = value;
           resData = JSON.parse(JSON.stringify(res.data));
           // +2是因为插入一个文本标签  
           resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
                                   return item.symptomType==0||item.symptomType==1;
                                 })));
         }
+      }else{
+        if(focusIndex > banIdx){//伴后
+          if(strIndex < 1){//前
+            res.data.splice(focusIndex,0,text);
+            res.saveText.splice(focusIndex,0,searchData);
+            res.data[focusIndex+1].value = value;
+            res.saveText[focusIndex+1] = value;
+            resData = JSON.parse(JSON.stringify(res.data));
+            resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
+                                    return item.symptomType==0||item.symptomType==2;
+                                  })));
+          }else{
+            res.data.splice(focusIndex+1,0,text);
+            res.saveText.splice(focusIndex+1,0,searchData);
+            res.data[focusIndex].value = value;
+            resData = JSON.parse(JSON.stringify(res.data));
+            // +2是因为插入一个文本标签  
+            resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
+                                    return item.symptomType==0||item.symptomType==2;
+                                  })));
+          }
+        }else{//伴前
+          if(strIndex < 1){//前
+            res.data.splice(focusIndex,0,text);
+            res.saveText.splice(focusIndex,0,searchData);
+            res.data[focusIndex+1].value = value;
+            res.saveText[focusIndex+1] = value;
+            resData = JSON.parse(JSON.stringify(res.data));
+            resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
+                                    return item.symptomType==0||item.symptomType==1;
+                                  })));
+          }else{
+            res.data.splice(focusIndex+1,0,text);
+            res.saveText.splice(focusIndex+1,0,searchData);
+            res.data[focusIndex].value = value;
+            resData = JSON.parse(JSON.stringify(res.data));
+            // +2是因为插入一个文本标签  
+            resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
+                                    return item.symptomType==0||item.symptomType==1;
+                                  })));
+          }
+        }
+      }
+      res.data = fullfillText(resData).newArr;
+      res.saveText = fullfillText(resData).saveText;
+    }else{//标签
+      if(strIndex < 1){//前
+        res.data.splice(focusIndex,0,data,textEmpty);
+        res.saveText.splice(focusIndex,0,'','');
+        res.selecteds.splice(focusIndex,0,null,null);
+        res.data[focusIndex+1].value = value;
+        res.saveText[focusIndex+1] = value;
+      }else{
+        res.data.splice(focusIndex+1,0,data,textEmpty);
+        res.saveText.splice(focusIndex+1,0,'','');
+        res.selecteds.splice(focusIndex+1,0,null,null);
+        res.data[focusIndex].value = value;
+        res.saveText[focusIndex] = value;
       }
     }
-    span.current.innerText?(span.current.innerText = value):(span.current.innerHTML = value);
-    res.data = fullfillText(resData).newArr;
-    res.saveText = fullfillText(resData).saveText;
+    // span.current.innerText?(span.current.innerText = value):(span.current.innerHTML = value);
+    // res.data = fullfillText(resData).newArr;
+    // res.saveText = fullfillText(resData).saveText;
   }
   res.searchData = [];    //选中清空搜索内容(即关闭搜索弹窗)
-  res.update = Math.random();//console.log(899,res,action);
+  res.update = Math.random();
   return res;
 }
 

+ 39 - 12
src/store/actions/mainSuit.js

@@ -92,24 +92,33 @@ export const handleTailClick = (state,action)=>{
 //将选择的常见症状插入
 export const insertMain = (state,action) => {
   const res = Object.assign({},state);
-  const item = action.item.name;
-  const id = action.item.questionId;
-  // 将选中的id存起,现病史时获取模板
+  const items = action.item.select;
+  const id = action.item.ids;
   let data = JSON.parse(JSON.stringify(res.moduleData));
-  const text = {id:id,name:item,value:item,tagType:config.tagType,exist:1};
+  if(items.length>1){
+    for(let i=1; i<items.length; i++){
+      items[i].name = '、'+items[i].name;
+      items[i].value = '、'+items[i].value;
+    } 
+  }
+  let obj = [];
+  for(let i=0; i<items.length; i++){
+    obj.push({id:items[i].questionId,name:items[i].name,value:items[i].name,tagType:config.tagType,exist:1});
+  }
   let inserIndx = null;
   data.map((it,i)=>{
-    if(it.flag == 1){//在此处插入主诉数据
-      inserIndx = i;
-    }
-  })
-  data.splice(inserIndx-1,1,text);
+      if(it.flag == 1){//在此处插入主诉数据
+        inserIndx = i;
+      }
+    })
+  data.splice(inserIndx-1,1,...obj);
   // data[inserIndx-1] = text;//替换空标签
   res.data = data;
   res.saveText = [];//将手动输入的值清掉
   // res.saveText[inserIndx] = text.name;
   res.saveText = fullfillText(res.data).saveText;
-  res.mainIds.push(id);
+  // res.mainIds.push(id);
+  res.mainIds = res.mainIds.concat(id);
   res.editClear = false;//主诉框编辑状态
   res.update=Math.random();
   return res;
@@ -311,6 +320,7 @@ export const insertSearch = (state,action)=>{
     res.data = moduleData;
     // res.saveText[inserIndx] = searchData;
     res.saveText = fullfillText(res.data).saveText;
+    // res.saveText[inserIndx] = searchData;
     res.mainIds.push(id);
     res.editClear = false;//主诉框编辑状态
   }else{
@@ -478,7 +488,8 @@ export const changeLabelVal = (state,action)=>{
   const nextVal = next.value||next.name;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
-  if(newVal&&newVal.trim()){
+  // if(newVal&&newVal.trim()){//时间单位传空--键盘输入
+  if(newVal){
     if(item){
       item.value = newVal;
       res.saveText[index] = newVal;
@@ -533,7 +544,7 @@ export const saveFreeVal = (state,action)=>{
   }else{
     res.saveText = [];
   }*/
-  res.update = Math.random();
+  // res.update = Math.random();
   return res;
 }
 
@@ -681,3 +692,19 @@ export function delSingleLable(state,action){
   res.update = Math.random();
   return res;
 }
+
+
+export function getSymptomFeature(state,action){
+  let res = Object.assign({},state);
+  const {data} = action;
+  if(data && data.length>0){
+    for(let i=0; i<data.length; i++){
+      data[i].tagType = '8';
+      res.mainIds.push(data[i].id);
+    }
+    res.symptomFeature.featureData = data;
+    res.symptomFeature.refresh = !res.symptomFeature.refresh;
+  }
+  res.update = Math.random();
+  return res;
+}

+ 27 - 9
src/store/async-actions/fetchModules.js

@@ -15,8 +15,14 @@ const api={
   getOtherHisRecord: '/api/icss/inquiryInfo/getLastOther',
   getBigPush:'/api/icss/push/pushInner',
   saveMode:'/api/icss/doctorPageMode/saveDoctorPageModes',
+  getSymptomFeature:'/api/icss/feature/getSymptomFeature'
 };
 
+export const getFeature = (item)=>{
+  const datas = json(api.getSymptomFeature+'?text='+item,{});
+  return datas;
+}
+
 //获取模板,多个
 export const getModules = (ids)=>{
   const {patInfo} = store.getState();
@@ -41,15 +47,27 @@ export const getModule = (id)=>{
 //搜索接口
 export const getSearch = (param)=>{
   const {patInfo} = store.getState();
-    const {inpStr,boxMark,mainIds} = param;
-    const params = {
-      "age": patInfo.message.patientAge,
-      "inputIds":mainIds&&mainIds.length>0?mainIds:[],//主诉去重
-      "inputStr": inpStr.trim(),
-      // "inputStr": inpStr,
-      "sexType": patInfo.message.sex,
-      "type": boxMark //1为搜症状
-    };
+    const {inpStr,boxMark,mainIds,itemType} = param;
+    let params = {};
+    if(itemType==0){//主诉,仅限症状
+      params = {
+        "age": patInfo.message.patientAge,
+        "inputIds":mainIds&&mainIds.length>0?mainIds:[],//主诉去重
+        "inputStr": inpStr.trim(),
+        "sexType": patInfo.message.sex,
+        "type": boxMark, //1为主诉现病史
+        "itemType":itemType
+      };
+    }else{
+      params = {
+        "age": patInfo.message.patientAge,
+        "inputIds":mainIds&&mainIds.length>0?mainIds:[],//主诉去重
+        "inputStr": inpStr.trim(),
+        // "inputStr": inpStr,
+        "sexType": patInfo.message.sex,
+        "type": boxMark //1为搜症状
+      };
+    }
     return json(api.searchURL,params);
 };
 

+ 8 - 2
src/store/reducers/mainSuit.js

@@ -1,9 +1,9 @@
 import {COMM_SYMPTOMS,CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,
   SET_SEARCH,CLEAR_SEARCH,GET_BIGDATAPUSH,SET_MAINSUIT,MIX_CONFIRM,NUMBER_SELECT,
   RADIO_SELECT,COMM_CONFIRM,CHANGE_LABELVAL,SAVE_FREE,CLEAR_MAIN_SUIT,SET_DATA,
-  INSERT_SEARCH,MAIN_FOCUS_INDEX,SETTEXTMODEVALUE,SETMAINTEXT,MAINADDLABELITEM,SETMAININPUT,DEL_MAIN,CHANGE_LABELVAL_NUMBER,REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE} from '../types/mainSuit'
+  INSERT_SEARCH,MAIN_FOCUS_INDEX,SETTEXTMODEVALUE,SETMAINTEXT,MAINADDLABELITEM,SETMAININPUT,DEL_MAIN,CHANGE_LABELVAL_NUMBER,REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE} from '../types/mainSuit'
 import {getCommSymptoms,handleTailClick,insertMain,setSearch,getBigSymptom,setMainMoudle,confirm,
-  setNumberValue,setRadioValue,commConfirm,changeLabelVal,saveFreeVal,clearMainSuit,insertSearch,setTextModeValue,setCheckText,changeEditClear,addLabelItem,setInputLabel,backspaceText,changeNumLabelVal,removeId,multipleComfirn,delSingleLable} from '../actions/mainSuit'
+  setNumberValue,setRadioValue,commConfirm,changeLabelVal,saveFreeVal,clearMainSuit,insertSearch,setTextModeValue,setCheckText,changeEditClear,addLabelItem,setInputLabel,backspaceText,changeNumLabelVal,removeId,multipleComfirn,delSingleLable,getSymptomFeature} from '../actions/mainSuit'
 
 
 const initState = {
@@ -20,6 +20,10 @@ const initState = {
   focusIndex:'',
   mainIds:[], //选中的主症状和伴随的id(搜索去重)
   editClear:true,
+  symptomFeature:{//分词
+    featureData:[],
+    refresh:false //用于数据更新
+  }
 }
 
 export default function(state=initState,action){
@@ -88,6 +92,8 @@ export default function(state=initState,action){
       return multipleComfirn(state,action);
     case DEL_MAIN_LABLE://单独删除标签
       return delSingleLable(state,action);
+    case SET_FEATURE://主诉分词
+      return getSymptomFeature(state,action);
     default:
       return state;
   }

+ 1 - 0
src/store/types/mainSuit.js

@@ -26,3 +26,4 @@ export const CHANGE_LABELVAL_NUMBER = 'CHANGE_LABELVAL_NUMBER';     //数字键
 export const REMOVE_MAIN_ID = 'REMOVE_MAIN_ID';     //移除id
 export const MAINSUIT_MUL = 'MAINSUIT_MUL';     //单列多选
 export const DEL_MAIN_LABLE = 'DEL_MAIN_LABLE';     
+export const SET_FEATURE = 'SET_FEATURE';  //主诉分词