|
@@ -15,16 +15,33 @@ function insertPro(data,processModule){
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
-
|
|
|
+// 处理tagType==4
|
|
|
+function resetTagtype(data){
|
|
|
+ let newDataArr = [];
|
|
|
+ if(data&&data.length>0){
|
|
|
+ for(let i=0; i<data.length;i++){
|
|
|
+ if(data[i].tagType==4){
|
|
|
+ newDataArr.push(...data[i].questionMapping);
|
|
|
+ }else{
|
|
|
+ newDataArr.push(data[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newDataArr;
|
|
|
+}
|
|
|
//设置模板
|
|
|
export const setModule = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
// 处理tagType=4的类型
|
|
|
const originalData = action.data||[];
|
|
|
const originalSonData = action.processModule||[];
|
|
|
- let spreadLabels=[];
|
|
|
- let sonSpreadLabels=[];//子模板
|
|
|
- if(originalData&&originalData.length>0){
|
|
|
+ const originalEmpty = action.emptyData||[];
|
|
|
+ const originalEmptySon = action.currentEmptySon||[];
|
|
|
+ let spreadLabels=resetTagtype(originalData);
|
|
|
+ let sonSpreadLabels=resetTagtype(originalSonData);//子模板
|
|
|
+ let emptySpreadLabels=resetTagtype(originalEmpty);//空模板
|
|
|
+ let emptySonSpreadLabels=resetTagtype(originalEmptySon);//空模板-子模板
|
|
|
+ /*if(originalData&&originalData.length>0){
|
|
|
for(let i=0; i<originalData.length;i++){
|
|
|
if(originalData[i].tagType==4){
|
|
|
spreadLabels.push(...originalData[i].questionMapping);
|
|
@@ -41,13 +58,16 @@ export const setModule = (state,action)=>{
|
|
|
sonSpreadLabels.push(originalSonData[j]);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// res.moduleData = action.data;
|
|
|
// res.processModule = action.processModule;//病程变化模板
|
|
|
+ // res.emptyData = action.emptyData;//空模板
|
|
|
+ // res.currentEmptySon = action.currentEmptySon;//空模板-子模板
|
|
|
res.moduleData = spreadLabels;
|
|
|
res.processModule = sonSpreadLabels;//病程变化模板
|
|
|
- res.emptyData = action.emptyData;//空模板
|
|
|
+ res.emptyData = emptySpreadLabels;//空模板
|
|
|
+ res.currentEmptySon = emptySonSpreadLabels;//空模板-子模板
|
|
|
let data = action.data;
|
|
|
let sliceIdx;
|
|
|
data&&data.map((v,i)=>{
|
|
@@ -63,11 +83,17 @@ export const setModule = (state,action)=>{
|
|
|
//插入病程变化
|
|
|
export const insertProcess = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
+ const useEmpty = res.useEmpty;
|
|
|
let addSmoduleData = [];
|
|
|
if(res.currReadSonM.length>0){
|
|
|
addSmoduleData = JSON.parse(JSON.stringify(res.currReadSonM))
|
|
|
}else{
|
|
|
- addSmoduleData = res.processModule.length>0?JSON.parse(JSON.stringify(res.processModule)):[];
|
|
|
+ if(!useEmpty){
|
|
|
+ addSmoduleData = res.processModule.length>0?JSON.parse(JSON.stringify(res.processModule)):[];
|
|
|
+ }else{//使用空模板则取空模板的子模板
|
|
|
+ addSmoduleData = res.currentEmptySon.length>0?JSON.parse(JSON.stringify(res.currentEmptySon)):[];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if(addSmoduleData.length==0){//未匹配到子模板
|
|
|
Notify.info("未找到相关内容");
|
|
@@ -147,6 +173,7 @@ export const setData = (state,action) =>{
|
|
|
if (useEmpty) {
|
|
|
const data = res.emptyData?JSON.parse(JSON.stringify(res.emptyData)):[];
|
|
|
res.data = fullfillText(data).newArr;
|
|
|
+ res.useEmpty = true; //取子模板标识
|
|
|
} else {
|
|
|
if(mainData&&mainData.length>0){//主诉使用模板
|
|
|
// 目前只需要将第一个主诉病程移植到现病史
|