|
@@ -38,7 +38,7 @@ export const setModule = (state,action)=>{
|
|
|
//插入病程变化
|
|
|
export const insertProcess = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
- const processModule = res.processModule;
|
|
|
+ const processModule = JSON.parse(JSON.stringify(res.processModule));
|
|
|
let data = res.data;
|
|
|
res.data = insertPro(data,processModule);
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
@@ -69,9 +69,13 @@ export const setData = (state,action) =>{
|
|
|
let newMain = [];
|
|
|
let mainLabelModule = res.mainLabelModule;//主诉选中的症状id获取到的模板
|
|
|
let objToArr = [];
|
|
|
- for(let m in mainLabelModule){
|
|
|
- objToArr.push(mainLabelModule[m]);
|
|
|
+ let keyArr = Object.keys(mainLabelModule);
|
|
|
+ for(let i=0; i<keyArr.length; i++){
|
|
|
+ objToArr.push(mainLabelModule[JSON.parse(keyArr[i])]);
|
|
|
}
|
|
|
+ /*for(let m in mainLabelModule){
|
|
|
+ objToArr.push(mainLabelModule[m]);
|
|
|
+ }*/
|
|
|
// 过滤掉没有mapping的数据
|
|
|
let mainLabelModuleArr = objToArr;
|
|
|
/*let mainLabelModuleArr = objToArr.filter((item)=>{
|
|
@@ -85,6 +89,7 @@ export const setData = (state,action) =>{
|
|
|
let tongYong = "";
|
|
|
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){
|
|
@@ -98,7 +103,8 @@ export const setData = (state,action) =>{
|
|
|
// 处理时间和主诉通用症状--现病史模板无“主诉通用症状” 1-7
|
|
|
for(let j=0; j<current.length; j++){
|
|
|
if(mainData[i].id==current[j].id && mainData[i].controlType==5){//处理时间,避免手动输入的值
|
|
|
- if(mainData[i].value){
|
|
|
+ firstT++
|
|
|
+ if(mainData[i].value && firstT==1){
|
|
|
current[j] = {id:mainData[i].id,name:mainData[i].value,value:mainData[i].value,tagType:config.tagType}
|
|
|
}
|
|
|
}
|
|
@@ -205,32 +211,34 @@ function getLabel(lid,lname){
|
|
|
// 多选展开确定事件--主、伴、无
|
|
|
export const confirm = (state,action) =>{
|
|
|
let res = Object.assign({},state);
|
|
|
- let length1 = res.data.length;
|
|
|
+ let length1 = res.data.length;console.log(123,action);
|
|
|
let arr = JSON.parse(JSON.stringify(res.data));
|
|
|
const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
|
|
|
- let existsId = getIds(exists);
|
|
|
- let withsId = getIds(withs);
|
|
|
+ let existsId = exists && exists.length>0?getIds(exists):[];
|
|
|
+ let withsId = withs && withs.length>0?getIds(withs):[];
|
|
|
res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重
|
|
|
// 伴 标签
|
|
|
const banText = JSON.stringify(ban)=='{}'?'':{id:ban.id,name:ban.name,value:ban.name,tagType:config.tagType};
|
|
|
-
|
|
|
+
|
|
|
// 处理主症状标签及尾巴展开symptomType=1
|
|
|
- if(exists.length>0){
|
|
|
- for(let i in exists){
|
|
|
- arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
|
|
|
+ if(exists && exists.length>0){
|
|
|
+ // for(let i in exists){//ie8不支持for in循环
|
|
|
+ for(let i=0;i<exists.length; i++){
|
|
|
+ arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
let length = arr.length - length1;
|
|
|
let withsArr = JSON.parse(JSON.stringify(arr));
|
|
|
// 伴 伴随症状标签及尾巴展开symptomType=2
|
|
|
- if(withs.length>0){
|
|
|
- for(let i in withs){
|
|
|
+ if(withs && withs.length>0){
|
|
|
+ // 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].name),...(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.length==0?(ban.name+withs[i].name+','):(ban.name+withs[i].name)),...(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;})));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 无 不用展开
|
|
|
let lengthN = withsArr.length - length1;
|
|
|
let noneArr = JSON.parse(JSON.stringify(withsArr));
|
|
@@ -245,7 +253,7 @@ export const confirm = (state,action) =>{
|
|
|
// res.data = resData;
|
|
|
res.data = fullfillText(resData).newArr;
|
|
|
res.saveText = fullfillText(resData).saveText;
|
|
|
- res.update=Math.random();
|
|
|
+ res.update=Math.random();
|
|
|
return res;
|
|
|
};
|
|
|
|
|
@@ -535,10 +543,11 @@ export function setInputLabel(state,action){
|
|
|
// backspace删除
|
|
|
export function backspaceText(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {delIndex} = action;
|
|
|
+ const {delIndex,text} = action;
|
|
|
const data = res.data;
|
|
|
if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
|
|
|
- // 前一个是文本标签或者子模板 不做处理
|
|
|
+ // 前一个是文本标签或者子模板,只改变值
|
|
|
+ // data[delIndex].value = text;
|
|
|
}else{
|
|
|
data.splice(delIndex-1,2);
|
|
|
}
|