|
@@ -128,10 +128,7 @@ export const confirm = (state,action) =>{
|
|
|
let arr = res.data;
|
|
|
let saveText = JSON.parse(JSON.stringify(res.saveText));
|
|
|
const {exists,withs,ikey,withsName,existsName,ban} = action.data;
|
|
|
- // let existsId = getIds(exists);
|
|
|
- // let withsId = getIds(withs);
|
|
|
let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
|
- // res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
|
|
|
let length = exists.length;
|
|
|
let labelIndx = parseInt(ikey);//当前点击标签的index
|
|
|
// 取第一个添加症状的主症状和伴随
|
|
@@ -142,8 +139,18 @@ export const confirm = (state,action) =>{
|
|
|
res.mainSymptIds = res.mainSymptIds.concat(existsId,withsId);
|
|
|
}
|
|
|
|
|
|
- let text = saveText.slice(0,labelIndx);
|
|
|
- let index = text.indexOf('伴');
|
|
|
+ // 第二病程-伴位置处理
|
|
|
+ let forwardId;
|
|
|
+ let text;
|
|
|
+ for(let n=labelIndx-1; n>0; n--){
|
|
|
+ if(arr[n].id==8){
|
|
|
+ forwardId = n;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(forwardId){
|
|
|
+ text = saveText.slice(forwardId,labelIndx);
|
|
|
+ let index = text.indexOf('伴');
|
|
|
if(index==-1){//没有伴,直接插入ikey前
|
|
|
if(exists.length > 0){
|
|
|
for(let i=0; i<exists.length; i++){
|
|
@@ -181,6 +188,48 @@ export const confirm = (state,action) =>{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ let text = saveText.slice(0,labelIndx);
|
|
|
+ let index = text.indexOf('伴');
|
|
|
+ if(index==-1){//没有伴,直接插入ikey前
|
|
|
+ if(exists.length > 0){
|
|
|
+ for(let i=0; i<exists.length; i++){
|
|
|
+ let pos = labelIndx + i;
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
+ res.saveText[pos] = exists[i].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(withs.length > 0){
|
|
|
+ let newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
+ if(banText){
|
|
|
+ newWiths.unshift(banText);
|
|
|
+ }
|
|
|
+ for(let j=0; j<newWiths.length; j++){
|
|
|
+ let withsPos = labelIndx +length + j;
|
|
|
+ arr.splice(withsPos,0,getTextLabel(newWiths[j].id,newWiths[j].name,2));
|
|
|
+ res.saveText[withsPos] = newWiths[j].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{//有伴
|
|
|
+ if(exists.length > 0){
|
|
|
+ for(let i=0; i<exists.length; i++){
|
|
|
+ let pos = index + i;
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,exists[i].name,1));
|
|
|
+ res.saveText[pos] = exists[i].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(withs.length>0){//有伴插到ikey前既可
|
|
|
+ for(let j=0; j<withs.length; j++){
|
|
|
+ // let withsPos = labelIndx + j;
|
|
|
+ let withsPos = labelIndx +length + j;
|
|
|
+ arr.splice(withsPos,0,getTextLabel(withs[j].id,withs[j].name,2));
|
|
|
+ res.saveText[withsPos] = withs[j].name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
res.data = arr;
|
|
|
res.saveText = fullfillText(arr).saveText;
|
|
@@ -249,6 +298,7 @@ export const insertSearch = (state,action)=>{
|
|
|
// res.saveText[inserIndx] = searchData;
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
res.mainIds.push(id);
|
|
|
+ res.mainSymptIds.push(id);
|
|
|
res.editClear = false;//主诉框编辑状态
|
|
|
}else{
|
|
|
// 替换
|
|
@@ -272,18 +322,39 @@ export const insertSearch = (state,action)=>{
|
|
|
res.data[focusIndex].value = value;
|
|
|
res.saveText[focusIndex] = value;*/
|
|
|
|
|
|
+ /*******************第一病程搜索结果也移植到现病史修改(2-18)********************/
|
|
|
+ // 位置判断-第一病程-主症状还是伴随 前一个标签存在 并且没有pos;
|
|
|
+ // 判断在伴的前面还是后面:前exist=1(主),后exist=2(伴)
|
|
|
+ let nText = {};
|
|
|
+ if(focusIndex==0){
|
|
|
+ nText = Object.assign({},text,{exist:1});
|
|
|
+ }else{
|
|
|
+ if(!data[focusIndex-1].pos){//第一病程
|
|
|
+ const preText = res.saveText.slice(0,focusIndex);
|
|
|
+ const ind = preText.indexOf("伴");
|
|
|
+ if(ind != -1){
|
|
|
+ nText = Object.assign({},text,{exist:2});
|
|
|
+ }else{
|
|
|
+ nText = Object.assign({},text,{exist:1});
|
|
|
+ }
|
|
|
+ }else{//第二及以上病程
|
|
|
+ nText = Object.assign({},text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 从新插入一个span标签
|
|
|
const searchStr = res.searchStr;
|
|
|
let innerText = span.current.innerText;
|
|
|
const value = innerText.replace(searchStr,"");
|
|
|
let index = innerText.indexOf(searchStr);
|
|
|
if(index < 1){//前
|
|
|
- res.data.splice(focusIndex,0,text);
|
|
|
+ res.data.splice(focusIndex,0,nText);
|
|
|
res.saveText.splice(focusIndex,0,searchData);
|
|
|
res.data[focusIndex+1].value = value;
|
|
|
res.saveText[focusIndex+1] = value;
|
|
|
}else{
|
|
|
- res.data.splice(focusIndex+1,0,text);
|
|
|
+ res.data.splice(focusIndex+1,0,nText);
|
|
|
res.saveText.splice(focusIndex+1,0,searchData);
|
|
|
res.data[focusIndex].value = value;
|
|
|
}
|