|
@@ -11,6 +11,7 @@ import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.CommonParam;
|
|
|
import com.diagbot.entity.DeptInfo;
|
|
|
import com.diagbot.entity.DeptVital;
|
|
|
+import com.diagbot.entity.DisType;
|
|
|
import com.diagbot.entity.ModuleDetail;
|
|
|
import com.diagbot.entity.ModuleInfo;
|
|
|
import com.diagbot.entity.QuestionDetail;
|
|
@@ -21,7 +22,9 @@ import com.diagbot.entity.VitalOrder;
|
|
|
import com.diagbot.entity.wrapper.QuestionInfoWrapper;
|
|
|
import com.diagbot.entity.wrapper.QuestionMappingWrapper;
|
|
|
import com.diagbot.entity.wrapper.QuestionWrapper;
|
|
|
+import com.diagbot.enums.InsertOrUpdateEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.QuestionTypeEnum;
|
|
|
import com.diagbot.enums.TagTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
@@ -92,6 +95,8 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
DeptVitalFacade deptVitalFacade;
|
|
|
@Autowired
|
|
|
RetrievalMappingFacade retrievalMappingFacade;
|
|
|
+ @Autowired
|
|
|
+ DisTypeFacade disTypeFacade;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -102,7 +107,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
public void saveOrUpdate(QuestionSaveVO questionSaveVO) {
|
|
|
QuestionWrapper questionWrapper = questionSaveVO.getQuestionWrapper();
|
|
|
CommonParam param = initCommonParam();
|
|
|
- saveQuestionInfo(questionWrapper, param);
|
|
|
+ saveQuestionInfo(questionWrapper, param); //保存|修改主表信息
|
|
|
switch (TagTypeEnum.getEnum(questionWrapper.getTagType())) {
|
|
|
case T1: //单项,例如:程度、体温
|
|
|
saveQuestionDetail(questionWrapper, param);
|
|
@@ -117,12 +122,15 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
saveQuestionMapping(questionWrapper, param);
|
|
|
break;
|
|
|
case T8: //文字,无单独维护
|
|
|
- case T9: //空标签,只维护主表信息
|
|
|
+ case T9: //空标签,无单独维护
|
|
|
case T10: //组合,无单独维护
|
|
|
break;
|
|
|
default:
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请选择标签显示类型");
|
|
|
}
|
|
|
+
|
|
|
+ //保存诊断类型
|
|
|
+ saveDisType(param, questionSaveVO.getDisTypeVO().getType());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -136,11 +144,38 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
String person = UserUtils.getCurrentPrincipleID();
|
|
|
param.setNow(DateUtil.now());
|
|
|
param.setPerson(person);
|
|
|
- param.setSaveOrUpdate("save");
|
|
|
+ param.setInsertOrUpdate(InsertOrUpdateEnum.Insert.getKey());
|
|
|
return param;
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存诊断类型
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @param disType
|
|
|
+ */
|
|
|
+ public void saveDisType(CommonParam param, Integer disType) {
|
|
|
+ if (param.getQuestionInfo().getType() == QuestionTypeEnum.Disease.getKey()) {
|
|
|
+ DisType bean = disTypeFacade.getOne(new QueryWrapper<DisType>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("dis_id", param.getQuestionInfo().getId()));
|
|
|
+ if (bean == null) {
|
|
|
+ bean = new DisType();
|
|
|
+ }
|
|
|
+ if (InsertOrUpdateEnum.Insert.getKey() == param.getInsertOrUpdate()) {
|
|
|
+ bean.setGmtCreate(param.getNow());
|
|
|
+ bean.setCreator(param.getPerson());
|
|
|
+ }
|
|
|
+ bean.setType(disType);
|
|
|
+ bean.setDisId(param.getQuestionInfo().getId());
|
|
|
+ bean.setModifier(param.getPerson());
|
|
|
+ bean.setGmtModified(param.getNow());
|
|
|
+ disTypeFacade.saveOrUpdate(bean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 保存映射关系
|
|
|
*
|
|
@@ -210,11 +245,11 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
public void deleteMapping(Long questionId, CommonParam param) {
|
|
|
questionMappingFacade.update(new QuestionMapping(),
|
|
|
new UpdateWrapper<QuestionMapping>()
|
|
|
- .eq("parent_question", questionId)
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("gmt_modified", param.getNow())
|
|
|
- .set("modifier", param.getPerson())
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
+ .eq("parent_question", questionId)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .set("gmt_modified", param.getNow())
|
|
|
+ .set("modifier", param.getPerson())
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -350,7 +385,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
if (questionInfo == null) { //校验
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标签不存在");
|
|
|
}
|
|
|
- param.setSaveOrUpdate("update");
|
|
|
+ param.setInsertOrUpdate(InsertOrUpdateEnum.Update.getKey());
|
|
|
}
|
|
|
BeanUtil.copyProperties(questionWrapper, questionInfo);
|
|
|
List<QuestionInfo> questionInfoList = this.list(new QueryWrapper<QuestionInfo>()
|
|
@@ -361,7 +396,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
if (ListUtil.isNotEmpty(questionInfoList)) { //标签type、tagName唯一
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标签系统名称已重复,无法建立");
|
|
|
}
|
|
|
- if ("save".equals(param.getSaveOrUpdate())) {
|
|
|
+ if (InsertOrUpdateEnum.Insert.getKey() == param.getInsertOrUpdate()) {
|
|
|
questionInfo.setCreator(param.getPerson()); //创建人
|
|
|
questionInfo.setGmtCreate(param.getNow());//创建时间
|
|
|
}
|
|
@@ -398,7 +433,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
/**
|
|
|
* 根据id删除标签
|
|
|
*
|
|
|
- * @param ids
|
|
|
+ * @param deleteQuestionVO
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean deleteByIdsFac(DeleteQuestionVO deleteQuestionVO) {
|
|
@@ -413,8 +448,8 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
for (String id : idList) {
|
|
|
// 查询映射关系中是否存在父级
|
|
|
List<QuestionInfo> info = this.getParentQuestion(Long.parseLong(id));
|
|
|
- for(QuestionInfo bean : info) {
|
|
|
- if(bean.getTagType() != null && bean.getTagType() == TagTypeEnum.T10.getKey()) {
|
|
|
+ for (QuestionInfo bean : info) {
|
|
|
+ if (bean.getTagType() != null && bean.getTagType() == TagTypeEnum.T10.getKey()) {
|
|
|
List<QuestionInfo> info2 = this.getParentQuestion(bean.getId());
|
|
|
List<String> msg = info2.stream().map(row -> "【" + row.getTagName() + "】").collect(Collectors.toList());
|
|
|
errMsg.append(String.join("", msg));
|
|
@@ -422,7 +457,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
errMsg.append("【").append(bean.getTagName()).append("】");
|
|
|
}
|
|
|
}
|
|
|
- if(StringUtil.isNotEmpty(errMsg.toString())) {
|
|
|
+ if (StringUtil.isNotEmpty(errMsg.toString())) {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请先删除标签的关联:" + errMsg);
|
|
|
}
|
|
|
|
|
@@ -471,6 +506,15 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
.set("modifier", person)
|
|
|
.set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
|
|
|
+ //如果是诊断,删除映射关系
|
|
|
+ if (deleteQuestionVO.getType() == QuestionTypeEnum.Disease.getKey()) {
|
|
|
+ disTypeFacade.update(new DisType(), new UpdateWrapper<DisType>()
|
|
|
+ .eq("dis_id", id)
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .set("gmt_modified", now)
|
|
|
+ .set("modifier", person)
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey()));
|
|
|
+ }
|
|
|
//TODO 如果是量表,删除量表内容,并删除诊断和量表的关联
|
|
|
|
|
|
|
|
@@ -501,7 +545,7 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
paramMap.put("notControlType", questionIndexVO.getNotControlType());
|
|
|
return this.index(paramMap);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 别名新增标签检索
|
|
|
*
|
|
@@ -521,15 +565,15 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
paramMap.put("notTagType", questionIndexVO.getNotTagType());
|
|
|
paramMap.put("notControlType", questionIndexVO.getNotControlType());
|
|
|
List<QuestionInfo> list = this.index(paramMap);
|
|
|
- if(ListUtil.isEmpty(list)){
|
|
|
- return list;
|
|
|
+ if (ListUtil.isEmpty(list)) {
|
|
|
+ return list;
|
|
|
}
|
|
|
- Map<Long,Long> couMap = retrievalMappingFacade.getMapCouByQuesIds(list.stream().map(i->i.getId()).collect(Collectors.toList()));
|
|
|
- return list.stream().filter(i->{
|
|
|
- if(couMap.get(i.getId())!=null){
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
+ Map<Long, Long> couMap = retrievalMappingFacade.getMapCouByQuesIds(list.stream().map(i -> i.getId()).collect(Collectors.toList()));
|
|
|
+ return list.stream().filter(i -> {
|
|
|
+ if (couMap.get(i.getId()) != null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
@@ -561,9 +605,9 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
return getQuestionInfoDTOS;
|
|
|
}
|
|
|
|
|
|
- public List<Long> getQuestionIdsByType(GetQuestionIdsByTypeVO getQuestionIdsByTypeVO){
|
|
|
+ public List<Long> getQuestionIdsByType(GetQuestionIdsByTypeVO getQuestionIdsByTypeVO) {
|
|
|
QueryWrapper<QuestionInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("id",getQuestionIdsByTypeVO.getQuestionIds() )
|
|
|
+ queryWrapper.in("id", getQuestionIdsByTypeVO.getQuestionIds())
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("type", getQuestionIdsByTypeVO.getQuestionType());
|
|
|
List<QuestionInfo> questionInfoList = this.list(queryWrapper);
|