|
@@ -1,6 +1,6 @@
|
|
|
import config from '@config/index.js';
|
|
|
-import {formatContinueDots,getLabelIndex,fullfillText,getIds} from '@utils/tools';
|
|
|
-
|
|
|
+import {formatContinueDots,getLabelIndex,fullfillText,getIds,resetTagtype} from '@utils/tools';
|
|
|
+import {Notify} from '@commonComp';
|
|
|
//插入病程变化模板
|
|
|
function insertPro(data,processModule){
|
|
|
let index;
|
|
@@ -19,35 +19,19 @@ function insertPro(data,processModule){
|
|
|
//设置模板
|
|
|
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){
|
|
|
- for(let i=0; i<originalData.length;i++){
|
|
|
- if(originalData[i].tagType==4){
|
|
|
- spreadLabels.push(...originalData[i].questionMapping);
|
|
|
- }else{
|
|
|
- spreadLabels.push(originalData[i]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(originalSonData&&originalSonData.length>0){
|
|
|
- for(let j=0; j<originalSonData.length;j++){
|
|
|
- if(originalSonData[j].tagType==4){
|
|
|
- sonSpreadLabels.push(...originalSonData[j].questionMapping);
|
|
|
- }else{
|
|
|
- sonSpreadLabels.push(originalSonData[j]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // res.moduleData = action.data;
|
|
|
- // res.processModule = action.processModule;//病程变化模板
|
|
|
+ const originalEmpty = action.emptyData||[];
|
|
|
+ const originalEmptySon = action.currentEmptySon||[];
|
|
|
+ // 处理tagType=4的类型
|
|
|
+ let spreadLabels=resetTagtype(originalData);
|
|
|
+ let sonSpreadLabels=resetTagtype(originalSonData);//子模板
|
|
|
+ let emptySpreadLabels=resetTagtype(originalEmpty);//空模板
|
|
|
+ let emptySonSpreadLabels=resetTagtype(originalEmptySon);//空模板-子模板
|
|
|
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,7 +47,22 @@ export const setModule = (state,action)=>{
|
|
|
//插入病程变化
|
|
|
export const insertProcess = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
- let addSmoduleData = action.addSmoduleData;
|
|
|
+ const useEmpty = res.useEmpty;
|
|
|
+ let addSmoduleData = [];
|
|
|
+ if(res.currReadSonM.length>0){
|
|
|
+ addSmoduleData = JSON.parse(JSON.stringify(res.currReadSonM))
|
|
|
+ }else{
|
|
|
+ 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("未找到相关内容");
|
|
|
+ return
|
|
|
+ }
|
|
|
let data = res.data;
|
|
|
let newData = insertPro(data,addSmoduleData);
|
|
|
res.data = fullfillText(newData).newArr;
|
|
@@ -138,6 +137,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){//主诉使用模板
|
|
|
// 目前只需要将第一个主诉病程移植到现病史
|
|
@@ -670,6 +670,7 @@ export const clearCurrentIll = (state,action)=>{
|
|
|
res.saveText = action.saveText;
|
|
|
res.selecteds = action.selecteds?action.selecteds:[];
|
|
|
res.symptomIds = action.symptomIds;
|
|
|
+ res.currReadSonM = action.currReadSonM||[];
|
|
|
if(action.editClear){
|
|
|
res.editClear = action.editClear;
|
|
|
}
|
|
@@ -887,21 +888,36 @@ export function setInputLabel(state,action){
|
|
|
// backspace删除
|
|
|
export function backspaceText(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {delIndex,text} = action;
|
|
|
+ const {delIndex,text,flag} = action;
|
|
|
const data = res.data;
|
|
|
// if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
|
|
|
- // 前一个是文本标签或者子模板,只改变值
|
|
|
- if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
- // data[delIndex].value = text;
|
|
|
- }else if(data[delIndex-1].tagType==8){
|
|
|
- data.splice(delIndex,1);
|
|
|
- res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
- res.saveText.splice(delIndex,1);
|
|
|
- }
|
|
|
- else{
|
|
|
- data.splice(delIndex-1,2);
|
|
|
- res.selecteds.splice(delIndex-1,2); //杂音类样式选中状态对应
|
|
|
- res.saveText.splice(delIndex-1,2);
|
|
|
+ if(flag == 'backsp'){
|
|
|
+ // 前一个是文本标签或者子模板,只改变值
|
|
|
+ if(data[delIndex-1].flag&&data[delIndex-1].flag==3){//子模板不删
|
|
|
+ // data[delIndex].value = text;
|
|
|
+ }else if(data[delIndex-1].tagType==8){
|
|
|
+ data.splice(delIndex,1);
|
|
|
+ res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
+ res.saveText.splice(delIndex,1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ data.splice(delIndex-1,2);
|
|
|
+ res.selecteds.splice(delIndex-1,2);
|
|
|
+ res.saveText.splice(delIndex-1,2);
|
|
|
+ }
|
|
|
+ }else if(flag == 'del'){
|
|
|
+ if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删
|
|
|
+
|
|
|
+ }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
|
|
|
+ data.splice(delIndex,1);
|
|
|
+ res.selecteds.splice(delIndex,1); //杂音类样式选中状态对应
|
|
|
+ res.saveText.splice(delIndex,1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ data.splice(delIndex,2);
|
|
|
+ res.selecteds.splice(delIndex,2);
|
|
|
+ res.saveText.splice(delIndex,2);
|
|
|
+ }
|
|
|
}
|
|
|
// res.saveText = fullfillText(data).saveText;
|
|
|
res.update = Math.random();
|
|
@@ -911,7 +927,7 @@ export function backspaceText(state,action){
|
|
|
//删除后移除id
|
|
|
export function removeId(state,action){
|
|
|
let res = Object.assign({},state);
|
|
|
- const {index,text} = action;
|
|
|
+ const {index,text,flag} = action;
|
|
|
const data = res.data;
|
|
|
// const id = data[index].id;
|
|
|
const id = data[index].conceptId;
|
|
@@ -919,15 +935,28 @@ export function removeId(state,action){
|
|
|
if(ids.includes(id)){
|
|
|
ids.splice(ids.indexOf(id),1);
|
|
|
}
|
|
|
- if(!data[index].value && data[index-1].tagType==8){
|
|
|
- data.splice(index,1);
|
|
|
- res.saveText.splice(index,1);
|
|
|
+ if(flag == 'del'){
|
|
|
+ if(!data[index].value && data[index+1] && data[index+1].tagType==8){
|
|
|
+ data.splice(index,1);
|
|
|
+ res.saveText.splice(index,1);
|
|
|
+ }else{
|
|
|
+ data[index].id = "";
|
|
|
+ data[index].conceptId = "";
|
|
|
+ data[index].name = text;
|
|
|
+ data[index].value = text;
|
|
|
+ }
|
|
|
}else{
|
|
|
- data[index].id = "";
|
|
|
- data[index].conceptId = "";
|
|
|
- data[index].name = text;
|
|
|
- data[index].value = text;
|
|
|
+ if(!data[index].value && data[index-1].tagType==8){
|
|
|
+ data.splice(index,1);
|
|
|
+ res.saveText.splice(index,1);
|
|
|
+ }else{
|
|
|
+ data[index].id = "";
|
|
|
+ data[index].conceptId = "";
|
|
|
+ data[index].name = text;
|
|
|
+ data[index].value = text;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
res.update = Math.random();
|
|
|
return res;
|
|
|
}
|