|
@@ -156,50 +156,41 @@ export const setData = (state,action) =>{
|
|
|
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}
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ mainData.map((v,i)=>{
|
|
|
+ // 主诉通用症状描述
|
|
|
+ if(v.id==config.tongYId && v.value && !v.pos){tongYong = v.value;}
|
|
|
+ if(v.exist){v.exist==1?main.push(v):withs.push(v)}
|
|
|
+ // 时间单位
|
|
|
+ if(v.controlType==5&&v.value){
|
|
|
+ firstT++;
|
|
|
+ current.map((it,ii)=>{
|
|
|
+ if(it.id==v.id&& firstT==1){it.value=v.value}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
// 主症状添加tongYong标签选中文字
|
|
|
- let tongYText = tongYong?{name:tongYong,value:tongYong,tagType:config.tagType}:'';
|
|
|
let mainCopy = JSON.parse(JSON.stringify(main));
|
|
|
let manInput = [];
|
|
|
// 去掉主诉添加的顿号
|
|
|
- for(let j=0; j<mainCopy.length; j++){
|
|
|
- if(tongYText){
|
|
|
- mainCopy[j].name = tongYong + (mainCopy[j].name).replace('、',"");
|
|
|
- mainCopy[j].value = tongYong + (mainCopy[j].value).replace('、',"");
|
|
|
+ mainCopy.map((ele,ind)=>{
|
|
|
+ if(tongYong){
|
|
|
+ ele.name = tongYong + (ele.name).replace('、',"");
|
|
|
+ ele.value = tongYong + (ele.value).replace('、',"");
|
|
|
}else{
|
|
|
- mainCopy[j].name = (mainCopy[j].name).replace('、',"");
|
|
|
- mainCopy[j].value = (mainCopy[j].value).replace('、',"");
|
|
|
- }
|
|
|
+ ele.name = (ele.name).replace('、',"");
|
|
|
+ ele.value = (ele.value).replace('、',"");
|
|
|
+ }
|
|
|
//查询是否有手动输入--输入的内容放到最后(3-27)
|
|
|
- if(mainCopy[j].name != mainCopy[j].value){
|
|
|
- const inputText = mainCopy[j].value.replace(mainCopy[j].name,"");
|
|
|
+ if(ele.name != ele.value){
|
|
|
+ const inputText = ele.value.replace(ele.name,"");
|
|
|
const textObj = Object.assign({},JSON.parse(config.textLabel),{name:inputText});
|
|
|
if(config.textReg.test(inputText)){//包含中英文或数字->即不全是标点符号才插入
|
|
|
manInput.push(textObj);
|
|
|
}
|
|
|
- mainCopy[j].value = mainCopy[j].name;
|
|
|
+ ele.value = ele.name;
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
|
|
|
// 将ids接口获取到的模板匹配到对应主症状后面
|
|
|
// 主症状
|
|
@@ -220,16 +211,10 @@ export const setData = (state,action) =>{
|
|
|
if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
for(let j=0; j<newMainCopy.length; j++){
|
|
|
if(newMainCopy[j].id==mainCopy[k].id){
|
|
|
- // newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value+',';
|
|
|
- newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value||mainCopy[k].name+',';
|
|
|
+ newMainCopy[j].value = newMainCopy[j].name = (mainCopy[k].value||mainCopy[k].name)+',';
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- /*if(ind==1){
|
|
|
- preLength = items.length;
|
|
|
- }else{
|
|
|
- insertInd += preLength;
|
|
|
- }*/
|
|
|
+ }
|
|
|
if(ind>1){
|
|
|
insertInd += lengArr[k-1];
|
|
|
}
|
|
@@ -265,17 +250,11 @@ export const setData = (state,action) =>{
|
|
|
let items = v.questionMapping.filter((item)=>{
|
|
|
return item.symptomType==0||item.symptomType==2;
|
|
|
})
|
|
|
- /*if(withInd==1){
|
|
|
- withPreLength = items.length;
|
|
|
- }else{
|
|
|
- withInsertInd += withPreLength;
|
|
|
- }*/
|
|
|
withLengArr[d] = items.length;
|
|
|
if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
for(let j=0; j<newWiths.length; j++){
|
|
|
if(newWiths[j].id==withs[d].id){
|
|
|
- // newWiths[j].value = newWiths[j].name = withs[d].value+',';
|
|
|
- newWiths[j].value = newWiths[j].name = withs[d].value||withs[d].name+',';
|
|
|
+ newWiths[j].value = newWiths[j].name = (withs[d].value||withs[d].name)+',';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -289,18 +268,21 @@ export const setData = (state,action) =>{
|
|
|
}
|
|
|
|
|
|
let symptomArr = newMainCopy.concat(manInput,newWiths,manWithInput);
|
|
|
- let newSymptomArr = formatContinueDots(JSON.parse(JSON.stringify(symptomArr))); //过来连续标点
|
|
|
- //组装好的主症状和伴随症状插入现病史模板(flag=4前)
|
|
|
- let insertIdx = null;
|
|
|
- for(let j=0; j<current.length; j++){
|
|
|
+ let newSymptomArr = formatContinueDots(JSON.parse(JSON.stringify(symptomArr))); //过滤连续标点
|
|
|
+ //组装好的主症状和伴随症状插入现病史模板(flag=4前)--现病史是否有模板
|
|
|
+ if(moduleData&&moduleData.length>0){
|
|
|
+ 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<newSymptomArr.length; k++){
|
|
|
- let pos = insertIdx+k;
|
|
|
- current.splice(pos,0,newSymptomArr[k]);
|
|
|
+ for(let k=0; k<newSymptomArr.length; k++){
|
|
|
+ let pos = insertIdx+k;
|
|
|
+ current.splice(pos,0,newSymptomArr[k]);
|
|
|
+ }
|
|
|
+ }else{//现病史没有模板
|
|
|
+ current = newSymptomArr;
|
|
|
}
|
|
|
let currentData = JSON.parse(JSON.stringify(current));
|
|
|
res.data = fullfillText(currentData).newArr;
|
|
@@ -335,16 +317,19 @@ export const setData = (state,action) =>{
|
|
|
}
|
|
|
//组装好的主症状和伴随症状插入现病史模板(flag=4前)
|
|
|
let endFeatureData = JSON.parse(JSON.stringify(featureData));
|
|
|
- let insertIdx = null;
|
|
|
- for(let j=0; j<current.length; j++){
|
|
|
+ if(moduleData&&moduleData.length>0){
|
|
|
+ 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]);
|
|
|
+ for(let k=0; k<endFeatureData.length; k++){
|
|
|
+ let pos = insertIdx+k;
|
|
|
+ current.splice(pos,0,endFeatureData[k]);
|
|
|
+ }
|
|
|
+ }else{//现病史没有模板
|
|
|
+ current = endFeatureData;
|
|
|
}
|
|
|
let currentData = JSON.parse(JSON.stringify(current));
|
|
|
res.data = fullfillText(currentData).newArr;
|
|
@@ -623,7 +608,10 @@ export const changeLabelVal = (state,action)=>{
|
|
|
localStorage.setItem('radio'+item.id,JSON.stringify([li]));
|
|
|
}
|
|
|
//取消原选中状态
|
|
|
- item.questionDetailList.find((it)=>it.selected==true).selected=false;
|
|
|
+ const seld = item.questionDetailList.find((it)=>it.selected==true);
|
|
|
+ if(seld){
|
|
|
+ seld.selected=false;
|
|
|
+ }
|
|
|
}
|
|
|
item.labelPrefix = prefix||'';
|
|
|
item.labelSuffix = suffix||'';
|