Bläddra i källkod

Merge branch 'bugFix20190722' into muban

Luolei1992 5 år sedan
förälder
incheckning
7ae18780f7

+ 30 - 3
src/common/components/EditableSpan/index.jsx

@@ -151,8 +151,8 @@ class EditableSpan extends Component{
     let innerVal = target.innerText || target.innerHTML,ele,boxTop;
     //禁止回车事件
     if(ev.keyCode==13){return false;}
-    //backspace事件
-    if(ev.keyCode==8){
+    //backspace事件 和delete
+    if(ev.keyCode==8 || ev.keyCode==46){
       //用于对比backspace前后的值
       this.setState({
         preVal:innerVal
@@ -196,6 +196,33 @@ class EditableSpan extends Component{
     const ev = e||window.event;
     const target = ev.target||ev.srcElement;
     let innerVal = target.innerText || target.innerHTML,ele,boxTop;
+    if(ev.keyCode==46){//delete
+      //判断nexObj
+      let nextObj = $(this.$span.current).next();
+      if(preVal.trim().length==1&& !innerVal){
+        removeId && removeId({boxMark,i:index,text:"",flag:'del'});
+        handleClear && handleClear({boxMark});//删除最后一个字时清空搜索结果,避免现病史搜索框不立即消失的情况
+        //如果后一个不是标签,则光标移到最前
+        if(nextObj && nextObj[0].nodeName !=="DIV"){
+          nextObj.focus();
+        }
+      }
+      //action里往后删除
+      if(innerVal == preVal){
+        let data = innerVal.trim();
+        if(nextObj && !config.punctuationReg.test(data)){
+          handleKeydown&&handleKeydown({boxMark,i:index,text:data,flag:'del'});
+          // nextObj.focus();  
+          if(nextObj[0].nodeName !=="DIV"){
+            nextObj.focus();
+          }
+          /*this.setState({
+            index: null
+          })*/
+        }
+      }
+    }
+
     if(ev.keyCode==8){     
       // 主诉现病史去重:删除最后一个字的时候移除该数据(将name、id和value替换成空)并移除id
       // 前面是标签,内容为空时再删一次才移除标签;前面是文本,则直接移除;
@@ -229,7 +256,7 @@ class EditableSpan extends Component{
         if(index!==0 && !config.punctuationReg.test(data)){
           // let preObj = $(this.$span.current).prev();
           let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
-          handleKeydown&&handleKeydown({boxMark,i:index,text:data});
+          handleKeydown&&handleKeydown({boxMark,i:index,text:data,flag:'backsp'});
           this.moveEnd(obj[0]);  
           this.setState({
             index: null

+ 15 - 2
src/components/CheckBody/index.jsx

@@ -34,19 +34,32 @@ class CheckBody extends Component{
     }
     this.setState({boxLeft:next.boxLeft})
   }
+  isThereHigh(arr,ids){
+    if(!arr||!ids){
+      return false;
+    }
+    const item = arr.find((it)=>{
+      return ids.includes(it.id);
+    });
+    if(item){
+      return true;
+    }
+    return false;
+  }
   getLabels(){
     const {data,showArr,saveText,selecteds,importLabel} = this.props;
     let arr = [],list=[];
     const {boxMark,showAll} = this.state;
     const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
     const moreText = filterDataArr([...saveText].splice(moreNum+1));     //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''
+    const hasHigh = this.isThereHigh([...data].splice(moreNum+1),importLabel);         //隐藏的标签中是否有高亮的
     const more = showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
-    const showMoreBtn = data.length>config.showCheckNum&&(data.length-1>moreNum&&!data[0].full)&&!moreText;
+    const showMoreBtn = data.length>config.showCheckNum&&(data.length-1>moreNum&&!data[0].full)&&!moreText&&!hasHigh;
     let showArray = data.filter((it)=>{
       if(it.showInCheck)
         return it;
     });
-    const showData = moreText||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
+    const showData = moreText||hasHigh||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
     if(showData){
       list = showData;
       arr = list.map((it,i)=>{

+ 10 - 11
src/components/Emergency/index.jsx

@@ -104,28 +104,27 @@ class EmergencyHis extends Component{
     const {chooseItem,index,filtFlag,changeInd} = this.state;
     const {addSecond,data} = this.props;
     if(chooseItem.trim()){
+      // 在非默认筛选条件下添加二次诊断后重新调筛选接口
+      if(filtFlag !== -1){
+        if(filtFlag ==0){//无二次诊断添加后重置index
+          this.setState({
+            index:0,
+            changeInd:!changeInd //重置list中的index标识
+          })
+        }
+      }
       // 添加接口
       const item = {
         name:chooseItem,
         id:data[index].inquiryId
       }
-      addSecond&&addSecond(item);
+      addSecond&&addSecond({item,flag:filtFlag});
       this.searInp.current.value = "";
       this.setState({
         valChange:true,
         chooseItem:''
       });
     }
-    // 在非默认筛选条件下添加二次诊断后重新调筛选接口
-    if(filtFlag !== -1){
-      this.handleFilter({flag:filtFlag});
-      if(filtFlag ==0){//无二次诊断添加后重置index
-        this.setState({
-          index:0,
-          changeInd:!changeInd //重置list中的index标识
-        })
-      }
-    }
   }
 
   componentWillUnmount(){

+ 0 - 10
src/containers/CurrentIll.js

@@ -56,18 +56,8 @@ function mapDispatchToProps(dispatch) {
           clickType:'单击',
           num:1
         });
-        // 判断是否有子模板数据
-        const sonId = obj.relationModule;//子模板id
-        let sonArr = allModules.filter((item)=>{return item.id==sonId})
-        if(sonArr.length==0){//未匹配到子模板
-          Notify.info("未找到相关内容");
-          return
-        }
         dispatch({
           type:INSERT_PROCESS,
-          // id:obj.relationModule,
-          // allModules:allModules
-          addSmoduleData:JSON.parse(JSON.stringify(sonArr[0].moduleDetailDTOList))
         });
         dispatch({
           type:ISREAD

+ 9 - 8
src/containers/EditableSpan.js

@@ -223,20 +223,20 @@ function mapDispatchToProps(dispatch,state) {
           break;
       }
     },
-    handleKeydown(obj){//backspace删除
+    handleKeydown(obj){//backspace删除 + delete
       if(obj.i==null){return}
       switch (+obj.boxMark){
         case 1:
-          dispatch({type:DEL_MAIN,delIndex:obj.i,text:obj.text});
+          dispatch({type:DEL_MAIN,delIndex:obj.i,text:obj.text,flag:obj.flag});
           break;
         case 2:
-          dispatch({type:DEL_CURRENT,delIndex:obj.i,text:obj.text});
+          dispatch({type:DEL_CURRENT,delIndex:obj.i,text:obj.text,flag:obj.flag});
           break;
         case 3:
-          dispatch({type:DEL_OTHERHIS,delIndex:obj.i});
+          dispatch({type:DEL_OTHERHIS,delIndex:obj.i,flag:obj.flag});
           break;
         case 4:
-          dispatch({type:DEL_CHECKBODY,delIndex:obj.i});
+          dispatch({type:DEL_CHECKBODY,delIndex:obj.i,flag:obj.flag});
           break;
         default:
           break;
@@ -247,15 +247,16 @@ function mapDispatchToProps(dispatch,state) {
       })
     },
     removeId(obj){//删除时移除id
+      if(obj.i==null){return}
       switch (+obj.boxMark){
         case 1:
-          dispatch({type:REMOVE_MAIN_ID,index:obj.i,text:obj.text});
+          dispatch({type:REMOVE_MAIN_ID,index:obj.i,text:obj.text,flag:obj.flag});
           break;
         case 2:
-          dispatch({type:REMOVE_CURR_ID,index:obj.i,text:obj.text});
+          dispatch({type:REMOVE_CURR_ID,index:obj.i,text:obj.text,flag:obj.flag});
           break;
         case 3:
-          dispatch({type:REMOVE_OTHER_ID,index:obj.i});//移除多余空标签
+          dispatch({type:REMOVE_OTHER_ID,index:obj.i,flag:obj.flag});//移除多余空标签
           break;
         default:
           break;

+ 4 - 4
src/containers/Emergency.js

@@ -35,12 +35,12 @@ const mapDispatchToProps = function(dispatch){
     handleChangeValue(val){
       dispatch(getSearchList(val,true))
     },
-    async addSecond(item){
-      // dispatch(addSecondDiag(item))
-      let resData = await addSecondDiag(item);
+    async addSecond(obj){
+      let resData = await addSecondDiag(obj.item);
       if(resData&&resData.data.code==0){
         Notify.info("添加成功");
-        dispatch(getFilterHis({flag:-1}));
+        // dispatch(getFilterHis({flag:-1}));
+        dispatch(getFilterHis({flag:obj.flag}));
       }
       
     }

+ 2 - 15
src/containers/MainSuit.js

@@ -59,7 +59,8 @@ function mapDispatchToProps(dispatch) {
             type: CLEAR_COMSYMPTOMS
           })
         },
-        handleTailClick:(obj,saveText,allModules)=>{//点击带尾巴的标签,如添加病程变化
+        handleTailClick:(obj,saveText,allModules)=>{
+        //点击带尾巴的标签,如添加病程变化
           let text = filterDataArr(saveText);
           if(text.length >= config.limited){
             Notify.info(config.limitText);
@@ -72,22 +73,8 @@ function mapDispatchToProps(dispatch) {
             clickType:'单击',
             num:1
           });
-          // 判断是否有子模板数据
-          const sonId = obj.relationModule;
-          let sonArr = allModules.filter((item)=>{return item.id==sonId})
-          if(sonArr.length==0){//未匹配到子模板
-            Notify.info("未找到相关内容");
-            return
-          }
-          /*dispatch({
-            type: SHOW_TAIL,
-            info:obj.questionMapping,
-            id:obj.relationModule,
-            allModules:allModules
-          })*/
           dispatch({
             type: SHOW_TAIL,
-            addSmoduleData:JSON.parse(JSON.stringify(sonArr[0].moduleDetailDTOList))
           })
           dispatch({
             type:ISREAD

+ 28 - 13
src/store/actions/checkBody.js

@@ -456,20 +456,35 @@ export function setInputLabel(state,action){
 // backspace删除
 export function backspaceText(state,action){
   let res = Object.assign({},state);
-  const {delIndex} = action;
+  const {delIndex,flag} = action;
   const data = res.data;
-  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
-    // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
-    // 前一个是文本标签或者子模板 不做处理
-  }else if(data[delIndex-1].tagType==8){
-    data.splice(delIndex,1);
-    res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex,1);
-  }
-  else{
-    data.splice(delIndex-1,2);
-    res.selecteds.splice(delIndex-1,2);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex-1,2);
+  if(flag == 'backsp'){
+    // 前一个是文本标签或者子模板,只改变值
+    if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删  
+      // data[delIndex].value = text;
+    }else if(data[delIndex-1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex-1,2);
+      res.selecteds.splice(delIndex-1,2); 
+      res.saveText.splice(delIndex-1,2);
+    }
+  }else if(flag == 'del'){
+    if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删  
+      
+    }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex,2);
+      res.selecteds.splice(delIndex,2);  
+      res.saveText.splice(delIndex,2);
+    }
   }
   // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();

+ 61 - 23
src/store/actions/currentIll.js

@@ -1,6 +1,6 @@
 import config from '@config/index.js';
 import {formatContinueDots,getLabelIndex,fullfillText,getIds} from '@utils/tools';
-
+import {Notify} from '@commonComp';
 //插入病程变化模板
 function insertPro(data,processModule){
   let index;
@@ -63,7 +63,16 @@ export const setModule = (state,action)=>{
 //插入病程变化
 export const insertProcess = (state,action)=>{
   const res = Object.assign({},state);
-  let addSmoduleData = action.addSmoduleData;
+  let addSmoduleData = [];
+  if(res.currReadSonM.length>0){
+    addSmoduleData = JSON.parse(JSON.stringify(res.currReadSonM))
+  }else{
+    addSmoduleData = res.processModule.length>0?JSON.parse(JSON.stringify(res.processModule)):[];
+  }
+  if(addSmoduleData.length==0){//未匹配到子模板
+    Notify.info("未找到相关内容");
+    return
+  }
   let data = res.data;
   let newData = insertPro(data,addSmoduleData);
   res.data = fullfillText(newData).newArr;
@@ -670,6 +679,7 @@ export const clearCurrentIll = (state,action)=>{
   res.saveText = action.saveText;
   res.selecteds = action.selecteds?action.selecteds:[];
   res.symptomIds = action.symptomIds;
+  res.currReadSonM = action.currReadSonM||[];
   if(action.editClear){
     res.editClear = action.editClear;
   }
@@ -887,21 +897,36 @@ export function setInputLabel(state,action){
 // backspace删除
 export function backspaceText(state,action){
   let res = Object.assign({},state);
-  const {delIndex,text} = action;
+  const {delIndex,text,flag} = action;
   const data = res.data;
   // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
-  // 前一个是文本标签或者子模板,只改变值
-  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删  
-    // data[delIndex].value = text;
-  }else if(data[delIndex-1].tagType==8){
-    data.splice(delIndex,1);
-    res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex,1);
-  }
-  else{
-    data.splice(delIndex-1,2);
-    res.selecteds.splice(delIndex-1,2);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex-1,2);
+  if(flag == 'backsp'){
+    // 前一个是文本标签或者子模板,只改变值
+    if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删  
+      // data[delIndex].value = text;
+    }else if(data[delIndex-1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex-1,2);
+      res.selecteds.splice(delIndex-1,2); 
+      res.saveText.splice(delIndex-1,2);
+    }
+  }else if(flag == 'del'){
+    if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删  
+      
+    }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex,2);
+      res.selecteds.splice(delIndex,2);  
+      res.saveText.splice(delIndex,2);
+    }
   }
   // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
@@ -911,7 +936,7 @@ export function backspaceText(state,action){
 //删除后移除id
 export function removeId(state,action){
   let res = Object.assign({},state);
-  const {index,text} = action;
+  const {index,text,flag} = action;
   const data = res.data;
   // const id = data[index].id;
   const id = data[index].conceptId;
@@ -919,15 +944,28 @@ export function removeId(state,action){
   if(ids.includes(id)){
     ids.splice(ids.indexOf(id),1);
   }
-  if(!data[index].value && data[index-1].tagType==8){
-    data.splice(index,1);
-    res.saveText.splice(index,1);
+  if(flag == 'del'){
+    if(!data[index].value && data[index+1] && data[index+1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    }else{
+      data[index].id = "";
+      data[index].conceptId = "";
+      data[index].name = text;
+      data[index].value = text;
+    }
   }else{
-    data[index].id = "";
-    data[index].conceptId = "";
-    data[index].name = text;
-    data[index].value = text;
+    if(!data[index].value && data[index-1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    }else{
+      data[index].id = "";
+      data[index].conceptId = "";
+      data[index].name = text;
+      data[index].value = text;
+    }
   }
+  
   res.update = Math.random();
   return res;
 }

+ 61 - 20
src/store/actions/mainSuit.js

@@ -1,6 +1,6 @@
 import {getLabelIndex,fullfillText,getIds} from '@utils/tools.js';
 import config from '@config/index.js';
-
+import {Notify} from '@commonComp';
 
 function insertPro(data,processModule){//插入添加病情变化模板
   let index;
@@ -97,7 +97,17 @@ export const handleTailClick = (state,action)=>{
   const res = Object.assign({},state);
   let num = res.moduleNum.num;
   num++;
-  let addSmoduleData = action.addSmoduleData;
+  // 有回读的子模板,则优先用回读的
+  let addSmoduleData = [];
+  if(res.mainReadSonM.length>0){
+    addSmoduleData = JSON.parse(JSON.stringify(res.mainReadSonM))
+  }else{
+    addSmoduleData = res.addSmoduleData.length>0?JSON.parse(JSON.stringify(res.addSmoduleData)):[];
+  }
+  if(addSmoduleData.length==0){//未匹配到子模板
+    Notify.info("未找到相关内容");
+    return
+  }
   let datas = JSON.parse(JSON.stringify(res.data));
   
   for(let i=0; i<addSmoduleData.length; i++){
@@ -655,6 +665,11 @@ export const clearMainSuit = (state,action)=>{//回读和清除
   res.mainIds = action.mainIds;
   res.mainTailIds = action.mainTailIds || [];
   res.chronicDesease = action.chronicDesease;//慢病疾病字段
+  res.mainReadSonM = action.mainReadSonM || [];//子模板
+  /*const readModule = action.mainReadSonM;
+  if(readModule&&readModule.length>0){//有回读子模板,则覆盖
+    res.addSmoduleData = readModule;
+  }*/
   if(action.editClear){
     res.editClear = action.editClear;
   }
@@ -734,19 +749,33 @@ export function setInputLabel(state,action){
 // backspace删除
 export function backspaceText(state,action){
   let res = Object.assign({},state);
-  const {delIndex} = action;
+  const {delIndex,flag} = action;
   const data = res.data;
-  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
-  // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
-    // 前一个是文本标签或者子模板 不做处理
-  }else if(data[delIndex-1].tagType==8){
-    data.splice(delIndex,1);
-    res.saveText.splice(delIndex,1);
-  }
-  else{
-    data.splice(delIndex-1,2);
-    res.saveText.splice(delIndex-1,2);
+  if(flag == 'backsp'){
+    if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
+    // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
+      // 前一个是文本标签或者子模板 不做处理
+    }else if(data[delIndex-1].tagType==8){
+      data.splice(delIndex,1);
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex-1,2);
+      res.saveText.splice(delIndex-1,2);
+    }
+  }else if(flag == 'del'){
+    if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){
+      // 后一个是文本标签或者子模板 不做处理
+    }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
+      data.splice(delIndex,1);
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      data.splice(delIndex,2);
+      res.saveText.splice(delIndex,2);
+    }
   }
+  
   // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
@@ -755,7 +784,7 @@ export function backspaceText(state,action){
 //删除后移除id
 export function removeId(state,action){
   let res = Object.assign({},state);
-  const {index,text} = action;
+  const {index,text,flag} = action;
   const data = res.data;
   // 获取尾巴id-questionId
   const id = data[index].id;
@@ -769,14 +798,26 @@ export function removeId(state,action){
   if(ids.includes(copid)){
     ids.splice(ids.indexOf(copid),1);
   }
-  if(!data[index].value && data[index-1].tagType==8){
-    data.splice(index,1);
-    res.saveText.splice(index,1);
+  if(flag == 'del'){
+    if(!data[index].value && data[index+1] &&data[index+1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    }else{
+      data[index].id = "";
+      data[index].name = text;
+      data[index].value = text;
+    }
   }else{
-    data[index].id = "";
-    data[index].name = text;
-    data[index].value = text;
+    if(!data[index].value && data[index-1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    }else{
+      data[index].id = "";
+      data[index].name = text;
+      data[index].value = text;
+    }
   }
+  
   res.update = Math.random();
   return res;
 }

+ 49 - 21
src/store/actions/otherHistory.js

@@ -448,25 +448,45 @@ export const otherEditClear = (state,action)=>{
 // backspace删除
 export function backspaceText(state,action){
   let res = Object.assign({},state);
-  const {delIndex} = action;
+  const {delIndex,flag} = action;
   const data = res.data;
-  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
-  // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
-    // 前一个是文本标签或者子模板 不做处理
-  }else if(data[delIndex-1].tagType==8){
-    data.splice(delIndex,1);
-    res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex,1);
-  }
-  else{
-    //月经史删除处理
-    if(data[delIndex-1].formulaCode){
-      res[data[delIndex-1].formulaCode]=undefined;
+  if(flag == 'backsp'){
+    if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
+    // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
+      // 前一个是文本标签或者子模板 不做处理
+    }else if(data[delIndex-1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      //月经史删除处理
+      if(data[delIndex-1].formulaCode){
+        res[data[delIndex-1].formulaCode]=undefined;
+      }
+      data.splice(delIndex-1,2);
+      res.selecteds.splice(delIndex-1,2);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex-1,2);
+    }
+  }else if(flag == 'del'){
+    if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删  
+      
+    }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
+      data.splice(delIndex,1);
+      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
+      res.saveText.splice(delIndex,1);
+    }
+    else{
+      //月经史删除处理
+      if(data[delIndex+1] &&data[delIndex+1].formulaCode){
+        res[data[delIndex+1].formulaCode]=undefined;
+      }
+      data.splice(delIndex,2);
+      res.selecteds.splice(delIndex,2);  
+      res.saveText.splice(delIndex,2);
     }
-    data.splice(delIndex-1,2);
-    res.selecteds.splice(delIndex-1,2);      //杂音类样式选中状态对应
-    res.saveText.splice(delIndex-1,2);
   }
+  
   // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
@@ -475,12 +495,20 @@ export function backspaceText(state,action){
 //删除后移除空标签
 export function removeId(state,action){
   let res = Object.assign({},state);
-  const {index} = action;
+  const {index,flag} = action;
   const data = res.data;
-  if(!data[index].value && data[index-1].tagType==8){
-    data.splice(index,1);
-    res.saveText.splice(index,1);
-  } 
+  if(flag == 'del'){//delete
+    if(!data[index].value && data[inde+1] && data[inde+1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    } 
+  }else{ //backspace
+    if(!data[index].value && data[index-1].tagType==8){
+      data.splice(index,1);
+      res.saveText.splice(index,1);
+    } 
+  }
+  
   res.update = Math.random();
   return res;
 }

+ 1 - 1
src/store/async-actions/fetchModules.js

@@ -148,7 +148,7 @@ export function pregetCheckbodyData(flag){     //flag=true获取到数据后立
     const emrData = getEMRParams();
     const param = {
       age: emrData.age,
-      featureType: "1,4,41,7",
+      featureType: "1,42,41,7",
       diag: emrData.dis,
       lis: emrData.lis,
       other: emrData.other,

+ 2 - 1
src/store/reducers/currentIll.js

@@ -16,7 +16,8 @@ const initState = {
   editClear:true,
   addModule:[],
   emptyData:[],
-  symptomIds:[] //搜索去重
+  symptomIds:[], //搜索去重
+  currReadSonM:[] //回读的子模板
 };
 export default function(state=initState,action){    
   const res = Object.assign({},state);

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

@@ -28,7 +28,8 @@ const initState = {
     refresh:false //用于数据更新
   },
   chronicDesease:null, //慢病
-  mainTailIds:[]  //获取症状尾巴用
+  mainTailIds:[],  //获取症状尾巴用
+  mainReadSonM:[] //回读的子模板
 }
 
 export default function(state=initState,action){

+ 10 - 4
src/utils/tools.js

@@ -181,6 +181,8 @@ const getAllDataList =(baseList) =>{           //获取所有模块结构化的
     jsonData.diagChronicMagItem = baseList.diagnosticList.chronicMagItem;      //诊断慢病{}
     jsonData.currentIds = baseList.currentIll.symptomIds;      //现病史去重
     jsonData.isFirstMainDiag = baseList.treat.isFirstMainDiag;      //治疗方案
+    jsonData.mainReadSonM = baseList.mainSuit.addSmoduleData;      //主诉-子模板
+    jsonData.currReadSonM = baseList.currentIll.currReadSonM;      //现病史-子模板
     // console.log(jsonData,'结构化数据获取')
     return jsonData;
 }
@@ -233,8 +235,8 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
 const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清空所有的数据
     if(action == 'clear'){     //清空
       const block = Object.assign(JSON.parse(config.textLabel),{full:true});//空白时保留一个自由文本标签
-      store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[],mainTailIds:[],clearAction:true,symptomFeature:[],chronicDesease:null});
-        store.dispatch({type: CLEAR_CURRENT_ILL,data:[],saveText:[],selecteds:[],editClear:true,symptomIds:[]});
+      store.dispatch({type: CLEAR_MAIN_SUIT,data:[],saveText:[],selecteds:[],editClear:true,mainIds:[],mainTailIds:[],clearAction:true,symptomFeature:[],chronicDesease:null,mainReadSonM:[]});
+        store.dispatch({type: CLEAR_CURRENT_ILL,data:[],saveText:[],selecteds:[],editClear:true,symptomIds:[],currReadSonM:[]});
         store.dispatch({type: CLEAROTHERHISTORY,data:[block],isEmpty:true,saveText:[],selecteds:[],editClear:true,yjs_1:'',yjs_2:'',yjs_3:'',yjs_4:''});
         store.dispatch({type: CLEARCHECKBODY,data:[block],isEmpty:true,saveText:[],selecteds:[]});
         store.dispatch(clearAssistData([],'',[]));
@@ -296,13 +298,15 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     saveText:JSON.parse(dataJsonStr.chief),
                     mainIds:dataJson.mainsuitIds?dataJson.mainsuitIds:[],
                     chronicDesease:dataJson.mainChronicDesease,
+                    mainReadSonM:dataJson.mainReadSonM,
                 });
                 store.dispatch({
                     type: CLEAR_CURRENT_ILL,
                     data:dataJson.present,
                     selecteds:dataJson.currentIllSelecteds?dataJson.currentIllSelecteds:[],
                     saveText:JSON.parse(dataJsonStr.present),
-                    symptomIds:dataJson.currentIds?dataJson.currentIds:[]
+                    symptomIds:dataJson.currentIds?dataJson.currentIds:[],
+                    currReadSonM:dataJson.currReadSonM
                 });
                 store.dispatch({
                     type: CLEAROTHERHISTORY,
@@ -363,13 +367,15 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     saveText:dataJsonStr[0].content ? JSON.parse(dataJsonStr[0].content) :[],
                     mainIds:dataJson.mainsuitIds?dataJson.mainsuitIds:[],
                     chronicDesease:dataJson.mainChronicDesease,
+                    mainReadSonM:dataJson.mainReadSonM,
                 });
                 store.dispatch({
                     type: CLEAR_CURRENT_ILL,
                     data:dataJson.present,
                     selecteds:dataJson.currentIllSelecteds?dataJson.currentIllSelecteds:[],
                     saveText:dataJsonStr[1].content ? JSON.parse(dataJsonStr[1].content):[],
-                    symptomIds:dataJson.currentIds?dataJson.currentIds:[]
+                    symptomIds:dataJson.currentIds?dataJson.currentIds:[],
+                    currReadSonM:dataJson.currReadSonM
                 });
                 store.dispatch({
                     type: CLEAROTHERHISTORY,