|
@@ -1,5 +1,6 @@
|
|
|
import {getLabelIndex,fullfillText,getIds} from '@common/js/func.js';
|
|
|
import config from '@config/index.js';
|
|
|
+import {getInitModules} from '@store/async-actions/homePage.js';
|
|
|
|
|
|
//插入病程变化模板
|
|
|
function insertPro(data,processModule){
|
|
@@ -38,12 +39,23 @@ export const setModule = (state,action)=>{
|
|
|
//插入病程变化
|
|
|
export const insertProcess = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
- const processModule = JSON.parse(JSON.stringify(res.processModule));
|
|
|
+ const sonId = action.id;//子模板id
|
|
|
+ // const processModule = JSON.parse(JSON.stringify(res.processModule));
|
|
|
+ let addSmoduleData;
|
|
|
+ // let allModules = JSON.parse(localStorage.getItem('modules'));
|
|
|
+ let allModules = action.allModules;
|
|
|
+ for(let k=0; k<allModules.length; k++){
|
|
|
+ if(allModules[k].id==sonId){
|
|
|
+ addSmoduleData = JSON.parse(JSON.stringify(allModules[k].moduleDetailDTOList));
|
|
|
+ }
|
|
|
+ }
|
|
|
let data = res.data;
|
|
|
- res.data = insertPro(data,processModule);
|
|
|
+ let newData = insertPro(data,addSmoduleData);
|
|
|
+ res.data = fullfillText(newData).newArr;
|
|
|
res.saveText = fullfillText(res.data).saveText;
|
|
|
res.update=Math.random();
|
|
|
return res;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -63,12 +75,10 @@ export const setData = (state,action) =>{
|
|
|
res.symptomIds = JSON.parse(JSON.stringify(mainIds));
|
|
|
const num = action.info.num;//点击了几次添加病情变化
|
|
|
const symptomFeature = action.info.symptomFeature;//分词
|
|
|
- // const useEmpty = action.info.useEmpty;
|
|
|
let useEmpty,mainData;
|
|
|
- // let mainData = JSON.parse(JSON.stringify(action.info.mainData));//主诉模板数据
|
|
|
let mainModleData = JSON.parse(JSON.stringify(action.info.mainData));//主诉模板数据
|
|
|
let moduleData = JSON.parse(JSON.stringify(res.moduleData));//现病史模板
|
|
|
- let addModule = JSON.parse(JSON.stringify(res.addModule));//拷贝的模板
|
|
|
+ // let addModule = JSON.parse(JSON.stringify(res.addModule));//拷贝的模板
|
|
|
let current = JSON.parse(JSON.stringify(moduleData));
|
|
|
let newMain = [];
|
|
|
let mainLabelModule = res.mainLabelModule;//主诉选中的症状id获取到的模板
|
|
@@ -102,7 +112,7 @@ export const setData = (state,action) =>{
|
|
|
})
|
|
|
useEmpty = existData&&existData.length>0?false:true;
|
|
|
}
|
|
|
- // console.log(888,useEmpty);
|
|
|
+
|
|
|
if (useEmpty) {
|
|
|
// res.data = res.emptyData;
|
|
|
res.data = JSON.parse(JSON.stringify(res.emptyData));
|
|
@@ -137,12 +147,8 @@ export const setData = (state,action) =>{
|
|
|
// 主症状添加tongYong标签选中文字
|
|
|
let tongYText = tongYong?{name:tongYong,value:tongYong,tagType:config.tagType}:'';
|
|
|
let mainCopy = JSON.parse(JSON.stringify(main));
|
|
|
- /*if(tongYText){
|
|
|
- for(let j=0; j<mainCopy.length; j++){
|
|
|
- mainCopy[j].name = tongYong + (mainCopy[j].name).replace('、',"");
|
|
|
- mainCopy[j].value = tongYong + (mainCopy[j].value).replace('、',"");
|
|
|
- }
|
|
|
- }*/
|
|
|
+ let manInput = [];
|
|
|
+ // 去掉主诉添加的顿号
|
|
|
for(let j=0; j<mainCopy.length; j++){
|
|
|
if(tongYText){
|
|
|
mainCopy[j].name = tongYong + (mainCopy[j].name).replace('、',"");
|
|
@@ -150,11 +156,18 @@ export const setData = (state,action) =>{
|
|
|
}else{
|
|
|
mainCopy[j].name = (mainCopy[j].name).replace('、',"");
|
|
|
mainCopy[j].value = (mainCopy[j].value).replace('、',"");
|
|
|
+ }
|
|
|
+ //查询是否有手动输入--输入的内容放到最后(3-27)
|
|
|
+ if(mainCopy[j].name != mainCopy[j].value){
|
|
|
+ const inputText = mainCopy[j].value.replace(mainCopy[j].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;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 将ids接口获取到的模板匹配到对应主症状后面
|
|
|
// 主症状
|
|
|
let newMainCopy = JSON.parse(JSON.stringify(mainCopy));
|
|
@@ -174,7 +187,8 @@ 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+',';
|
|
|
+ newMainCopy[j].value = newMainCopy[j].name = mainCopy[k].value||mainCopy[k].name+',';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -192,15 +206,20 @@ export const setData = (state,action) =>{
|
|
|
}
|
|
|
// 伴随
|
|
|
// 去掉顿号
|
|
|
- /* for(let b=0; b<withs.length; b++){
|
|
|
- withs[b].name = withs[b].name.replace('、',"");
|
|
|
- }*/
|
|
|
- // let newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
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,"");
|
|
|
+ const textObj = Object.assign({},JSON.parse(config.textLabel),{name:inputText});
|
|
|
+ if(config.textReg.test(inputText)){//包含中英文或数字->即不全是标点符号才插入
|
|
|
+ manWithInput.push(textObj);
|
|
|
+ }
|
|
|
+ withs[b].value = withs[b].name;
|
|
|
+ }
|
|
|
}
|
|
|
newWiths = JSON.parse(JSON.stringify(withs));
|
|
|
let withInd = 0;
|
|
@@ -221,8 +240,9 @@ export const setData = (state,action) =>{
|
|
|
withLengArr[d] = items.length;
|
|
|
if(items.length==0){//没有尾巴时给症状后加逗号(3.5)
|
|
|
for(let j=0; j<newWiths.length; j++){
|
|
|
- if(newWiths[j].id==mainCopy[d].id){
|
|
|
- newWiths[j].value = newWiths[j].name = withs[d].value+',';
|
|
|
+ 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+',';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -235,7 +255,7 @@ export const setData = (state,action) =>{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let symptomArr = newMainCopy.concat(newWiths);
|
|
|
+ let symptomArr = newMainCopy.concat(manInput,newWiths,manWithInput);
|
|
|
let newSymptomArr = JSON.parse(JSON.stringify(symptomArr));
|
|
|
//组装好的主症状和伴随症状插入现病史模板(flag=4前)
|
|
|
let insertIdx = null;
|
|
@@ -269,7 +289,7 @@ export const setData = (state,action) =>{
|
|
|
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+',';
|
|
|
+ featureData[j].value = featureData[j].name = symptomFeature[k].value||symptomFeature[k].name+',';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -361,16 +381,15 @@ export const confirm = (state,action) =>{
|
|
|
//普通多选确定事件-主诉通用特征、初为后为等
|
|
|
export const setCheckBox = (state,action)=>{
|
|
|
const res = Object.assign({},state);
|
|
|
- const {exists,labelInx,existsName} = action.data;
|
|
|
+ const {labelInx,excluName,existsName,nones,withsName,ban} = action.data;
|
|
|
// 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
|
|
|
- let names=existsName;
|
|
|
+ let showText = (excluName||'')+(existsName||'')+(ban.name||'')+(withsName||'')+(nones&&nones.replace('、','')||'');
|
|
|
let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
|
|
|
- if(pattern.test(existsName)){
|
|
|
- names = existsName.substr(0,existsName.length-1);
|
|
|
+ if(pattern.test(showText)){
|
|
|
+ showText = showText.substr(0,showText.length-1);
|
|
|
}
|
|
|
- let arr = res.data;
|
|
|
- arr[labelInx].value = names;
|
|
|
- res.saveText[labelInx] = names;
|
|
|
+ res.data[labelInx].value = showText;
|
|
|
+ res.saveText[labelInx] = showText;
|
|
|
res.selecteds[labelInx] = action.data;
|
|
|
res.update=Math.random();
|
|
|
return res;
|