|
@@ -131,6 +131,7 @@ export const insertMain = (state,action) => {
|
|
|
const res = Object.assign({},state);
|
|
|
const items = action.item.select;
|
|
|
const id = action.item.ids;
|
|
|
+ const conceptId = action.item.conceptId;
|
|
|
let data = JSON.parse(JSON.stringify(res.moduleData));
|
|
|
if(items.length>1){
|
|
|
for(let i=1; i<items.length; i++){
|
|
@@ -140,7 +141,7 @@ export const insertMain = (state,action) => {
|
|
|
}
|
|
|
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});
|
|
|
+ obj.push({id:items[i].questionId,name:items[i].name,value:items[i].name,tagType:config.tagType,exist:1,conceptId:items[i].conceptId});
|
|
|
}
|
|
|
let inserIndx = null;
|
|
|
data.map((it,i)=>{
|
|
@@ -160,17 +161,17 @@ export const insertMain = (state,action) => {
|
|
|
res.saveText = [];//将手动输入的值清掉
|
|
|
// res.saveText[inserIndx] = text.name;
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- // res.mainIds.push(id);
|
|
|
- res.mainIds = res.mainIds.concat(id);
|
|
|
+ res.mainIds = res.mainIds.concat(conceptId);
|
|
|
+ res.mainTailIds = res.mainTailIds.concat(id);
|
|
|
res.editClear = false;//主诉框编辑状态
|
|
|
res.update=Math.random();
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
|
|
|
-function getTextLabel(id,name,flag){
|
|
|
+function getTextLabel(id,name,flag,copid){
|
|
|
// exist 主症状1,伴随2
|
|
|
- return {id:id,name:name,value:name,tagType:config.tagType,exist:flag};
|
|
|
+ return {id:id,name:name,value:name,tagType:config.tagType,exist:flag,conceptId:copid};
|
|
|
}
|
|
|
|
|
|
function addPoint(data,num){//给伴随添加顿号
|
|
@@ -188,12 +189,21 @@ export const confirm = (state,action) =>{
|
|
|
const {exists,withs,ikey,withsName,existsName,ban} = action.data;
|
|
|
let banText = JSON.stringify(ban) == "{}" ? '':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
|
let length = exists.length;
|
|
|
+ let existConpId = [];
|
|
|
+ let withConpId = [];
|
|
|
+ exists.map((v,i)=>{
|
|
|
+ existConpId.push(v.conceptId);
|
|
|
+ })
|
|
|
+ withs.map((v,i)=>{
|
|
|
+ withConpId.push(v.conceptId);
|
|
|
+ })
|
|
|
let labelIndx = parseInt(ikey);//当前点击标签的index
|
|
|
// 取第一个添加症状的主症状和伴随
|
|
|
if(!arr[labelIndx].pos){
|
|
|
let existsId = getIds(exists);
|
|
|
let withsId = getIds(withs);
|
|
|
- res.mainIds = res.mainIds?res.mainIds.concat(existsId,withsId):[];
|
|
|
+ res.mainIds = res.mainIds?res.mainIds.concat(existConpId,withConpId):[];
|
|
|
+ res.mainTailIds = res.mainTailIds?res.mainTailIds.concat(existsId,withsId):[];
|
|
|
}
|
|
|
|
|
|
// 第二病程-伴位置处理
|
|
@@ -217,7 +227,7 @@ export const confirm = (state,action) =>{
|
|
|
let withsAddP = addPoint(exists,1);
|
|
|
for(let i=0; i<withsAddP.length; i++){
|
|
|
let pos = labelIndx + i;
|
|
|
- arr.splice(pos,0,getTextLabel(withsAddP[i].id,withsAddP[i].name,1));
|
|
|
+ arr.splice(pos,0,getTextLabel(withsAddP[i].id,withsAddP[i].name,1,withsAddP[i].conceptId));
|
|
|
res.saveText[pos] = withsAddP[i].name;
|
|
|
}
|
|
|
}
|
|
@@ -229,7 +239,7 @@ export const confirm = (state,action) =>{
|
|
|
}
|
|
|
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));
|
|
|
+ arr.splice(withsPos,0,getTextLabel(newWiths[j].id,newWiths[j].name,2,newWiths[j].conceptId));
|
|
|
res.saveText[withsPos] = newWiths[j].name;
|
|
|
}
|
|
|
}
|
|
@@ -248,7 +258,7 @@ export const confirm = (state,action) =>{
|
|
|
existsAddP = addPoint(exists,startInd);
|
|
|
for(let i=0; i<existsAddP.length; i++){
|
|
|
let pos = forwardId + index + i;
|
|
|
- arr.splice(pos,0,getTextLabel(existsAddP[i].id,existsAddP[i].name,1));
|
|
|
+ arr.splice(pos,0,getTextLabel(existsAddP[i].id,existsAddP[i].name,1,existsAddP[i].conceptId));
|
|
|
res.saveText[pos] = existsAddP[i].name;
|
|
|
}
|
|
|
}
|
|
@@ -257,7 +267,7 @@ export const confirm = (state,action) =>{
|
|
|
let withsAddP = addPoint(withs,0);
|
|
|
for(let j=0; j<withsAddP.length; j++){
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
- arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
+ arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2,withsAddP[j].conceptId));
|
|
|
res.saveText[withsPos] = withsAddP[j].name;
|
|
|
}
|
|
|
}
|
|
@@ -269,7 +279,7 @@ export const confirm = (state,action) =>{
|
|
|
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));
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1,exists[i].conceptId));
|
|
|
res.saveText[pos] = exists[i].name;
|
|
|
}
|
|
|
}
|
|
@@ -281,7 +291,7 @@ export const confirm = (state,action) =>{
|
|
|
}
|
|
|
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));
|
|
|
+ arr.splice(withsPos,0,getTextLabel(newWiths[j].id,newWiths[j].name,2,newWiths[j].conceptId));
|
|
|
res.saveText[withsPos] = newWiths[j].name;
|
|
|
}
|
|
|
}
|
|
@@ -289,7 +299,7 @@ export const confirm = (state,action) =>{
|
|
|
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));
|
|
|
+ arr.splice(pos,0,getTextLabel(exists[i].id,'、'+exists[i].name,1,exists[i].conceptId));
|
|
|
res.saveText[pos] = exists[i].name;
|
|
|
}
|
|
|
}
|
|
@@ -298,7 +308,7 @@ export const confirm = (state,action) =>{
|
|
|
let withsAddP = addPoint(withs,0);
|
|
|
for(let j=0; j<withsAddP.length; j++){
|
|
|
let withsPos = labelIndx +length + j;
|
|
|
- arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2));
|
|
|
+ arr.splice(withsPos,0,getTextLabel(withsAddP[j].id,withsAddP[j].name,2,withsAddP[j].conceptId));
|
|
|
res.saveText[withsPos] = withsAddP[j].name;
|
|
|
}
|
|
|
}
|
|
@@ -345,10 +355,11 @@ export const insertSearch = (state,action)=>{
|
|
|
let data = res.data;
|
|
|
let moduleData = JSON.parse(JSON.stringify(res.moduleData));
|
|
|
let searchData = action.info.name;
|
|
|
- const id = action.info.questionId;
|
|
|
+ const id = action.info.questionId;//获取尾巴id
|
|
|
+ const ids = action.info.conceptId;//去重id
|
|
|
let focusIndex = res.focusIndex;
|
|
|
let span = action.span;
|
|
|
- let text = {id:id,name:searchData,value:searchData,tagType:config.tagType};
|
|
|
+ let text = {id:id,name:searchData,value:searchData,tagType:config.tagType,conceptId:ids};
|
|
|
const emptySpan = JSON.parse(config.textLabel);
|
|
|
if(data.length==0){
|
|
|
let inserIndx = null;
|
|
@@ -360,14 +371,17 @@ export const insertSearch = (state,action)=>{
|
|
|
// flag=1前是文本标签就替换,否则插入
|
|
|
const iftext = inserIndx&&moduleData[inserIndx-1]&&moduleData[inserIndx-1].tagType;
|
|
|
if(iftext==config.tagType){
|
|
|
- moduleData.splice(inserIndx-1,1,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1});
|
|
|
+ moduleData.splice(inserIndx-1,1,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1,conceptId:ids});
|
|
|
}else{
|
|
|
- moduleData.splice(inserIndx,0,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1});
|
|
|
+ moduleData.splice(inserIndx,0,{id:id,name:searchData,value:searchData,tagType:config.tagType,exist:1,conceptId:ids});
|
|
|
}
|
|
|
res.saveText = [];//将手动输入的值清掉
|
|
|
res.data = moduleData;
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
- res.mainIds.push(id);
|
|
|
+ res.mainIds.push(ids);
|
|
|
+ if(id){
|
|
|
+ res.mainTailIds.push(id);
|
|
|
+ }
|
|
|
res.editClear = false;//主诉框编辑状态
|
|
|
}else{
|
|
|
/*******************第一病程搜索结果也移植到现病史修改(2-18)********************/
|
|
@@ -411,7 +425,10 @@ export const insertSearch = (state,action)=>{
|
|
|
res.data[focusIndex].value = value;
|
|
|
}
|
|
|
span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
|
|
|
- res.mainIds.push(id);
|
|
|
+ res.mainIds.push(ids);
|
|
|
+ if(id){
|
|
|
+ res.mainTailIds.push(id);
|
|
|
+ }
|
|
|
}
|
|
|
res.update=Math.random();
|
|
|
return res;
|
|
@@ -644,6 +661,7 @@ export const clearMainSuit = (state,action)=>{//回读和清除
|
|
|
// res.saveText = fullfillText(action.data).saveText;//解决删除data里的值保存,回读后页面上有内容saveText里没有的情况
|
|
|
res.selecteds = action.selecteds?action.selecteds:[];
|
|
|
res.mainIds = action.mainIds;
|
|
|
+ res.mainTailIds = action.mainTailIds || [];
|
|
|
res.chronicDesease = action.chronicDesease;//慢病疾病字段
|
|
|
if(action.editClear){
|
|
|
res.editClear = action.editClear;
|
|
@@ -747,10 +765,17 @@ export function removeId(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
const {index,text} = action;
|
|
|
const data = res.data;
|
|
|
+ // 获取尾巴id-questionId
|
|
|
const id = data[index].id;
|
|
|
+ let tailIds = res.mainTailIds;
|
|
|
+ if(tailIds.includes(id)){
|
|
|
+ tailIds.splice(tailIds.indexOf(id),1);
|
|
|
+ }
|
|
|
+ // 去重id
|
|
|
+ const copid = data[index].conceptId;
|
|
|
let ids = res.mainIds;
|
|
|
- if(ids.includes(id)){
|
|
|
- ids.splice(ids.indexOf(id),1);
|
|
|
+ if(ids.includes(copid)){
|
|
|
+ ids.splice(ids.indexOf(copid),1);
|
|
|
}
|
|
|
if(!data[index].value && data[index-1].tagType==8){
|
|
|
data.splice(index,1);
|
|
@@ -799,7 +824,10 @@ export function getSymptomFeature(state,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.mainIds.push(data[i].conceptId);
|
|
|
+ if(data[i].id){//questionId有可能为null
|
|
|
+ res.mainTailIds.push(data[i].id);
|
|
|
+ }
|
|
|
}
|
|
|
res.symptomFeature.featureData = data;
|
|
|
res.symptomFeature.refresh = !res.symptomFeature.refresh;
|