Bläddra i källkod

现病史搜索展开去连续标点

zhouna 6 år sedan
förälder
incheckning
ea50e9fc27
1 ändrade filer med 25 tillägg och 29 borttagningar
  1. 25 29
      src/store/actions/currentIll.js

+ 25 - 29
src/store/actions/currentIll.js

@@ -710,15 +710,21 @@ export function insertLabelData(state,action){
   let focusIndex = res.focusIndex;
   let saveText = res.saveText;
   let banIdx = saveText.indexOf("伴");
-  
+  //伴随展开数据-过滤了连续标点
+  const FilteredDotMapping2=formatContinueDots(data.questionMapping.filter((item)=>{
+    return item.symptomType==0||item.symptomType==2;
+  }));
+  //主症状展开数据-过滤连续了标点
+  const FilteredDotMapping1=formatContinueDots(data.questionMapping.filter((item)=>{
+    return item.symptomType==0||item.symptomType==1;
+  }));
   if(isReplace){
     span.current.innerText?(span.current.innerText = ''):(span.current.innerHTML = '');
     // res.data.splice(focusIndex,1,text,data);
     // 搜索结果展开伴随symptomType==2的尾巴
+
     let resData = JSON.parse(JSON.stringify(res.data));
-    resData.splice(focusIndex,1,text,...(data.questionMapping.filter((item)=>{
-                              return item.symptomType==0||item.symptomType==2;
-                            })));
+    resData.splice(focusIndex,1,text,...(FilteredDotMapping2));
     res.data = fullfillText(resData).newArr;
     res.saveText[focusIndex] = searchData;
   }else{
@@ -732,55 +738,45 @@ export function insertLabelData(state,action){
       res.symptomIds.push(id);
       // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
       if(banIdx==-1){
+
         // if(strIndex <= 1){//前
         if(strIndex < 1){//前
-          res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==1;
-                                })),pText);
+          res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
+          res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
         }else{
-          res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==1;
-                                })));
+          res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
+          res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
         }
       }else{
         if(focusIndex > banIdx){//伴后
           if(strIndex < 1){//前
-            res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==2;
-                                })),pText);
+            res.data.splice(index,1,text,...(FilteredDotMapping2),pText);
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
+            res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping2.length).fill(null),null);
           }else{
-            res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==2;
-                                })));
+            res.data.splice(index,1,pText,text,...(FilteredDotMapping2));
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
+            res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping2.length).fill(null));
           }
         }else{//伴前
           if(strIndex < 1){//前
-            res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==1;
-                                })),pText);
+            res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
+            res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
           }else{
-            res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
-                                   return item.symptomType==0||item.symptomType==1;
-                                })));
+            res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
+            res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
           }
         }
       }
       res.data = fullfillText(res.data).newArr;
       res.saveText = fullfillText(res.data).saveText;
     }else{//标签
-      const spreadLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
+      const arr=fullfillText(data.questionMapping).newArr;      //过滤连续标点
+      const spreadLabels = data.tagType==4?formatContinueDots(arr):[data];
       if(strIndex < 1){//前
         // 判断前一个是否为文本标签,是直接插入标签,不是则在前面插入一个空文本标签
         const preItem = res.data[index-1];