|
@@ -2,7 +2,14 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.diagbot.dto.DictionaryInfoDTO;
|
|
import com.diagbot.dto.DictionaryInfoDTO;
|
|
import com.diagbot.entity.node.EntityInfo;
|
|
import com.diagbot.entity.node.EntityInfo;
|
|
-import com.diagbot.repository.EntityInfoRepository;
|
|
|
|
|
|
+import com.diagbot.entity.node.LisName;
|
|
|
|
+import com.diagbot.enums.LabelTypeEnum;
|
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
|
+import com.diagbot.repository.*;
|
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
|
+import com.diagbot.util.Cn2SpellUtil;
|
|
|
|
+import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.vo.EntityInfoVO;
|
|
import com.diagbot.vo.EntityInfoVO;
|
|
import com.diagbot.vo.EntityPageVO;
|
|
import com.diagbot.vo.EntityPageVO;
|
|
@@ -28,6 +35,81 @@ public class EntityInfoFacade {
|
|
@Autowired
|
|
@Autowired
|
|
EntityInfoRepository entityInfoRepository;
|
|
EntityInfoRepository entityInfoRepository;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ YiBaoDiseaseNameRepository yiBaoDiseaseNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ LisSetRepository lisSetRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ LisNameRepository lisNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsNameRepository pacsNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsSubNameRepository pacsSubNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedicineRepository medicineRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ YiBaoOperationNameRepository yiBaoOperationNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ DiseaseRepository diseaseRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ LisRepository lisRepository;
|
|
|
|
+ //TODO 化验细项及结果
|
|
|
|
+ @Autowired
|
|
|
|
+ LisCriticalRepository lisCriticalRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ LisRemindRepository lisRemindRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ LisBigNameRepository lisBigNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsCriticalRepository pacsCriticalRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsDescribeRepository pacsDescribeRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsResultRepository pacsResultRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ PacsRemindRepository pacsRemindRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedicineCodeRepository medicineCodeRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedRegNameRepository medRegNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedClassRepository medClassRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedZhiLiaoClassRepository medZhiLiaoClassRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedYaoLiClassRepository medYaoLiClassRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedJiePouClassRepository medJiePouClassRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedChemClassRepository medChemClassRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ OralMedicineRepository oralMedicineRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ ConflictDeviceRepository conflictDeviceRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ GenderRepository genderRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ VitalRepository vitalRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ SymptomNameRepository symptomNameRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ ClinicalFindingRepository clinicalFindingRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ DeptRepository deptRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ BillConflictItemRepository billConflictItemRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ GroupRepository groupRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ TransfusionSuggestRepository transfusionSuggestRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ MedAllergenRepository medAllergenRepository;
|
|
|
|
+ @Autowired
|
|
|
|
+ AllergenRepository allergenRepository;
|
|
|
|
+ //TODO 食物过敏原
|
|
|
|
+ @Autowired
|
|
|
|
+ TransfusionRemindRepository transfusionRemindRepository;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分页查询
|
|
* 分页查询
|
|
*
|
|
*
|
|
@@ -59,20 +141,217 @@ public class EntityInfoFacade {
|
|
*/
|
|
*/
|
|
public Boolean isExist(EntityInfoVO entityInfoVO) {
|
|
public Boolean isExist(EntityInfoVO entityInfoVO) {
|
|
Boolean exist = false;
|
|
Boolean exist = false;
|
|
- Integer count = entityInfoRepository.existNodes(entityInfoVO.getName(), entityInfoVO.getLabelType());
|
|
|
|
- if (count > 0) {
|
|
|
|
- exist = true;
|
|
|
|
|
|
+ List<EntityInfo> entities = entityInfoRepository.existNodes(entityInfoVO.getName(), entityInfoVO.getLabelType());
|
|
|
|
+ if (ListUtil.isNotEmpty(entities)) {
|
|
|
|
+ if (entityInfoVO.getId() == null) {
|
|
|
|
+ exist = true;
|
|
|
|
+ } else {
|
|
|
|
+ //修改记录
|
|
|
|
+ List<Long> existIds = entities.stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
|
+ if (existIds.contains(entityInfoVO.getId())) {
|
|
|
|
+ exist = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (!exist) {
|
|
if (!exist) {
|
|
if (entityInfoVO.getLabelType().equals("辅助检查名称")) {
|
|
if (entityInfoVO.getLabelType().equals("辅助检查名称")) {
|
|
- count = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查子项目名称");
|
|
|
|
|
|
+ entities = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查子项目名称");
|
|
} else if (entityInfoVO.getLabelType().equals("辅助检查子项目名称")) {
|
|
} else if (entityInfoVO.getLabelType().equals("辅助检查子项目名称")) {
|
|
- count = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查名称");
|
|
|
|
|
|
+ entities = entityInfoRepository.existNodes(entityInfoVO.getName(), "辅助检查名称");
|
|
}
|
|
}
|
|
- if (count > 0) {
|
|
|
|
- exist = true;
|
|
|
|
|
|
+ if (ListUtil.isNotEmpty(entities)) {
|
|
|
|
+ if (entityInfoVO.getId() == null) {
|
|
|
|
+ exist = true;
|
|
|
|
+ } else {
|
|
|
|
+ //修改记录
|
|
|
|
+ List<Long> existIds = entities.stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
|
+ if (existIds.contains(entityInfoVO.getId())) {
|
|
|
|
+ exist = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return exist;
|
|
return exist;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public EntityInfo getById(Long id) {
|
|
|
|
+ EntityInfo entityInfo = entityInfoRepository.getById(id);
|
|
|
|
+ if (entityInfo != null) {
|
|
|
|
+ if (entityInfo.getLabelType().equals(LabelTypeEnum.YiBaoDiseaseName.getName())) {
|
|
|
|
+ if (StringUtil.isNotBlank(entityInfo.getAgeRange())) {
|
|
|
|
+ String[] ages = entityInfo.getAgeRange().split("-");
|
|
|
|
+ if (ages.length == 2) {
|
|
|
|
+ entityInfo.setMinAge(Integer.valueOf(ages[0]));
|
|
|
|
+ entityInfo.setMaxAge(Integer.valueOf(ages[1]));
|
|
|
|
+ } else if (ages.length == 1) {
|
|
|
|
+ if (entityInfo.getAgeRange().startsWith("-")) {
|
|
|
|
+ entityInfo.setMaxAge(Integer.valueOf(ages[0]));
|
|
|
|
+ } else if (entityInfo.getAgeRange().endsWith("-")) {
|
|
|
|
+ entityInfo.setMinAge(Integer.valueOf(ages[0]));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return entityInfo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 术语保存
|
|
|
|
+ * @param entityInfo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean saveNode(EntityInfo entityInfo) {
|
|
|
|
+ EntityInfoVO entityInfoVO = new EntityInfoVO();
|
|
|
|
+ BeanUtil.copyProperties(entityInfo, entityInfoVO);
|
|
|
|
+ Boolean exists = isExist(entityInfoVO);
|
|
|
|
+ if (exists) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.IS_EXISTS, "术语已存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //术语类型校验
|
|
|
|
+ List<DictionaryInfoDTO> dicTypeLabelType = dictionaryFacade.getListByGroupType(8);
|
|
|
|
+ if (ListUtil.isEmpty(dicTypeLabelType)) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "术语类型字典缺失");
|
|
|
|
+ }
|
|
|
|
+ List<String> labels = dicTypeLabelType.stream().map(i -> i.getVal()).collect(Collectors.toList());
|
|
|
|
+ if (!labels.contains(entityInfo.getLabelType())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "术语类型错误");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //默认值处理
|
|
|
|
+ if (StringUtil.isBlank(entityInfo.getPycode())) {
|
|
|
|
+ entityInfo.setPycode(Cn2SpellUtil.converterToFirstSpell(entityInfo.getName()));
|
|
|
|
+ }
|
|
|
|
+ if (entityInfo.getStatus() == null) {
|
|
|
|
+ entityInfo.setStatus(1);
|
|
|
|
+ }
|
|
|
|
+ if (entityInfo.getIs_kl() == null) {
|
|
|
|
+ entityInfo.setIs_kl(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ switch (entityInfo.getLabelType()) {
|
|
|
|
+ case "医保疾病名称":
|
|
|
|
+ entityInfo.setAgeRange(entityInfo.getMinAge() + "-" + entityInfo.getMaxAge());
|
|
|
|
+ if (entityInfo.getId() != null) {
|
|
|
|
+ yiBaoDiseaseNameRepository.update(entityInfo,
|
|
|
|
+ entityInfo.getAgeRange(),
|
|
|
|
+ entityInfo.getAlias(),
|
|
|
|
+ entityInfo.getCategory(),
|
|
|
|
+ entityInfo.getDep(),
|
|
|
|
+ entityInfo.getGender());
|
|
|
|
+ } else {
|
|
|
|
+ yiBaoDiseaseNameRepository.create(entityInfo,
|
|
|
|
+ entityInfo.getAgeRange(),
|
|
|
|
+ entityInfo.getAlias(),
|
|
|
|
+ entityInfo.getCategory(),
|
|
|
|
+ entityInfo.getDep(),
|
|
|
|
+ entityInfo.getGender());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "实验室检查套餐名":
|
|
|
|
+ if (entityInfo.getId() != null) {
|
|
|
|
+ lisSetRepository.update(entityInfo);
|
|
|
|
+ } else {
|
|
|
|
+ lisSetRepository.create(entityInfo);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "实验室检查名称":
|
|
|
|
+ LisName lisName = new LisName();
|
|
|
|
+ BeanUtil.copyProperties(entityInfo, lisName);
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ case "辅助检查名称":
|
|
|
|
+ if (entityInfo.getId() != null) {
|
|
|
|
+ pacsNameRepository.update(entityInfo, entityInfo.getGender());
|
|
|
|
+ } else {
|
|
|
|
+ pacsNameRepository.create(entityInfo, entityInfo.getGender());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "辅助检查子项目名称":
|
|
|
|
+ if (entityInfo.getId() != null) {
|
|
|
|
+ pacsSubNameRepository.update(entityInfo, entityInfo.getGender());
|
|
|
|
+ } else {
|
|
|
|
+ pacsSubNameRepository.create(entityInfo, entityInfo.getGender());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "药品通用名称":
|
|
|
|
+ break;
|
|
|
|
+ case "医保手术和操作名称":
|
|
|
|
+ if (entityInfo.getOpgrade() == null) {
|
|
|
|
+ entityInfo.setOpgrade("0");
|
|
|
|
+ }
|
|
|
|
+ if (entityInfo.getId() != null) {
|
|
|
|
+ yiBaoOperationNameRepository.update(entityInfo, entityInfo.getOpgrade());
|
|
|
|
+ } else {
|
|
|
|
+ yiBaoOperationNameRepository.create(entityInfo, entityInfo.getOpgrade());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "疾病":
|
|
|
|
+ break;
|
|
|
|
+ case "实验室检查":
|
|
|
|
+ break;
|
|
|
|
+ case "化验细项及结果":
|
|
|
|
+ break;
|
|
|
|
+ case "实验室检查危急值":
|
|
|
|
+ break;
|
|
|
|
+ case "化验提醒指标":
|
|
|
|
+ break;
|
|
|
|
+ case "化验套餐名称":
|
|
|
|
+ break;
|
|
|
|
+ case "辅助检查危急值":
|
|
|
|
+ break;
|
|
|
|
+ case "辅助检查名称描述":
|
|
|
|
+ break;
|
|
|
|
+ case "辅助检查名称结果":
|
|
|
|
+ break;
|
|
|
|
+ case "辅检提醒指标":
|
|
|
|
+ break;
|
|
|
|
+ case "药品代码通用名":
|
|
|
|
+ break;
|
|
|
|
+ case "药品注册名称":
|
|
|
|
+ break;
|
|
|
|
+ case "药品类别":
|
|
|
|
+ break;
|
|
|
|
+ case "药品治疗学类别":
|
|
|
|
+ break;
|
|
|
|
+ case "药品药理学类别":
|
|
|
|
+ break;
|
|
|
|
+ case "药品解剖学类别":
|
|
|
|
+ break;
|
|
|
|
+ case "药品化学物质类别":
|
|
|
|
+ break;
|
|
|
|
+ case "服用药品":
|
|
|
|
+ break;
|
|
|
|
+ case "禁忌医疗器械及物品":
|
|
|
|
+ break;
|
|
|
|
+ case "性别":
|
|
|
|
+ break;
|
|
|
|
+ case "体征":
|
|
|
|
+ break;
|
|
|
|
+ case "症状":
|
|
|
|
+ break;
|
|
|
|
+ case "临床表现":
|
|
|
|
+ break;
|
|
|
|
+ case "科室":
|
|
|
|
+ break;
|
|
|
|
+ case "开单项互斥":
|
|
|
|
+ break;
|
|
|
|
+ case "禁忌人群":
|
|
|
|
+ break;
|
|
|
|
+ case "建议输血提醒":
|
|
|
|
+ break;
|
|
|
|
+ case "药物过敏原":
|
|
|
|
+ break;
|
|
|
|
+ case "过敏原":
|
|
|
|
+ break;
|
|
|
|
+ case "食物过敏原":
|
|
|
|
+ break;
|
|
|
|
+ case "输血提醒指标":
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|