|
@@ -110,7 +110,6 @@ export const setData = (state,action) =>{
|
|
|
res.symptomIds = JSON.parse(JSON.stringify(mainIds));
|
|
|
const num = action.info.num;//点击了几次添加病情变化
|
|
|
const symptomFeature = action.info.symptomFeature;//分词
|
|
|
- const isChronic = action.info.isChronic;//慢病标识
|
|
|
let useEmpty,mainData;
|
|
|
let mainModleData = JSON.parse(JSON.stringify(action.info.mainData));//主诉模板数据
|
|
|
let moduleData = JSON.parse(JSON.stringify(res.moduleData));//现病史模板
|
|
@@ -147,7 +146,6 @@ export const setData = (state,action) =>{
|
|
|
}
|
|
|
|
|
|
if (useEmpty) {
|
|
|
- // res.data = res.emptyData;
|
|
|
res.data = res.emptyData&&res.emptyData.length>0?JSON.parse(JSON.stringify(res.emptyData)):moduleData;
|
|
|
} else {
|
|
|
if(mainData&&mainData.length>0){//主诉使用模板
|
|
@@ -156,104 +154,85 @@ 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接口获取到的模板匹配到对应主症状后面
|
|
|
// 主症状
|
|
|
let newMainCopy = JSON.parse(JSON.stringify(mainCopy));
|
|
|
let ind = 0;
|
|
|
let insertInd = 0;
|
|
|
- // let preLength = 0;
|
|
|
let lengArr=[];
|
|
|
- for(let k=0; k <mainCopy.length;k++){
|
|
|
- mainLabelModuleArr.map((v,i)=>{
|
|
|
- if(mainCopy[k].id==v.id){
|
|
|
- ind++;
|
|
|
- let items = v.questionMapping.filter((item)=>{
|
|
|
- return item.symptomType==0||item.symptomType==1;
|
|
|
- })
|
|
|
- lengArr[k] = items.length; //每一个主诉尾巴长度
|
|
|
-
|
|
|
- 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+',';
|
|
|
- }
|
|
|
+ mainCopy.map((it,ii)=>{
|
|
|
+ mainLabelModuleArr.map((v,i)=>{
|
|
|
+ if(it.id==v.id){
|
|
|
+ ind++;
|
|
|
+ let items = v.questionMapping.filter((item)=>{
|
|
|
+ return item.symptomType==0||item.symptomType==1;
|
|
|
+ })
|
|
|
+ lengArr[ii] = items.length; //每一个主诉尾巴长度
|
|
|
+ if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
+ newMainCopy.map((el,ind)=>{
|
|
|
+ if(el.id==it.id){
|
|
|
+ el.value = el.name = (it.value||it.name)+',';
|
|
|
}
|
|
|
- }
|
|
|
- /*if(ind==1){
|
|
|
- preLength = items.length;
|
|
|
- }else{
|
|
|
- insertInd += preLength;
|
|
|
- }*/
|
|
|
- if(ind>1){
|
|
|
- insertInd += lengArr[k-1];
|
|
|
- }
|
|
|
- newMainCopy.splice(k+insertInd+1,0,...items);
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(ind>1){ insertInd += lengArr[ii-1]; }
|
|
|
+ newMainCopy.splice(ii+insertInd+1,0,...items);
|
|
|
+ }
|
|
|
})
|
|
|
- }
|
|
|
+ })
|
|
|
// 伴随
|
|
|
// 去掉顿号
|
|
|
let newWiths = [];
|
|
|
let manWithInput = [];
|
|
|
if(withs.length>0){
|
|
|
- for(let b=0; b<withs.length; b++){
|
|
|
- withs[b].name = withs[b].name.replace('、',"");
|
|
|
- withs[b].value = withs[b].value.replace('、',"");
|
|
|
- if(withs[b].name != withs[b].value){
|
|
|
- const inputText = withs[b].value.replace(withs[b].name,"");
|
|
|
+ withs.map((v,i)=>{
|
|
|
+ v.name = v.name.replace('、',"");
|
|
|
+ v.value = v.value.replace('、',"");
|
|
|
+ if(v.name != v.value){
|
|
|
+ const inputText = v.value.replace(v.name,"");
|
|
|
const textObj = Object.assign({},JSON.parse(config.textLabel),{name:inputText});
|
|
|
if(config.textReg.test(inputText)){//包含中英文或数字->即不全是标点符号才插入
|
|
|
manWithInput.push(textObj);
|
|
|
}
|
|
|
- withs[b].value = withs[b].name;
|
|
|
+ v.value = v.name;
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
let withInd = 0;
|
|
|
let withInsertInd = 0;
|
|
@@ -265,19 +244,13 @@ 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.map((it,ind)=>{
|
|
|
+ if(it.id==withs[d].id){
|
|
|
+ it.value = it.name = (withs[d].value||withs[d].name)+',';
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
if(withInd>1){
|
|
|
withInsertInd += withLengArr[d-1];
|
|
@@ -292,11 +265,11 @@ export const setData = (state,action) =>{
|
|
|
let newSymptomArr = formatContinueDots(JSON.parse(JSON.stringify(symptomArr))); //过来连续标点
|
|
|
//组装好的主症状和伴随症状插入现病史模板(flag=4前)
|
|
|
let insertIdx = null;
|
|
|
- for(let j=0; j<current.length; j++){
|
|
|
- if(current[j].flag && current[j].flag==4){
|
|
|
- insertIdx = j;
|
|
|
- }
|
|
|
+ current.map((item,i)=>{
|
|
|
+ if(item.flag&& item.flag==4){
|
|
|
+ insertIdx = i;
|
|
|
}
|
|
|
+ })
|
|
|
|
|
|
for(let k=0; k<newSymptomArr.length; k++){
|
|
|
let pos = insertIdx+k;
|
|
@@ -314,17 +287,17 @@ export const setData = (state,action) =>{
|
|
|
mainLabelModuleArr.map((v,i)=>{
|
|
|
if(symptomFeature[k].id==v.id){
|
|
|
ind++;
|
|
|
- let items = v.questionMapping.filter((item)=>{
|
|
|
+ let items = v.questionMapping&&v.questionMapping.filter((item)=>{
|
|
|
return item.symptomType==0||item.symptomType==1;
|
|
|
})
|
|
|
lengArr[k] = items.length; //每一个主诉尾巴长度
|
|
|
|
|
|
- if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
- for(let j=0; j<featureData.length; j++){
|
|
|
- if(featureData[j].id==symptomFeature[k].id){
|
|
|
- featureData[j].value = featureData[j].name = symptomFeature[k].value||symptomFeature[k].name+',';
|
|
|
+ if(items&&items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
+ featureData.map((ele,ind)=>{
|
|
|
+ if(ele.id==symptomFeature[k].id){
|
|
|
+ ele.value = ele.name = (symptomFeature[k].value||symptomFeature[k].name)+',';
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
if(ind>1){
|
|
|
insertInd += lengArr[k-1];
|
|
@@ -388,7 +361,6 @@ export const confirm = (state,action) =>{
|
|
|
// for(let i in withs){
|
|
|
for(let i=0;i<withs.length; i++){
|
|
|
withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].name+','):(withs[i].name)),...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
|
|
|
- /*withsArr.splice(parseInt(ikey)+length,0,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(withs[i].questionMapping && withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;})));*/
|
|
|
}
|
|
|
}
|
|
|
|