|
@@ -8,12 +8,15 @@ import com.diagbot.dto.GetAllForRelationDTO;
|
|
import com.diagbot.dto.KlConceptAllDTO;
|
|
import com.diagbot.dto.KlConceptAllDTO;
|
|
import com.diagbot.dto.KlConceptAllSubDTO;
|
|
import com.diagbot.dto.KlConceptAllSubDTO;
|
|
import com.diagbot.dto.KlConceptInfoDTO;
|
|
import com.diagbot.dto.KlConceptInfoDTO;
|
|
|
|
+import com.diagbot.dto.KlConceptSimDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
|
|
+import com.diagbot.entity.CommonParam;
|
|
import com.diagbot.entity.KlConcept;
|
|
import com.diagbot.entity.KlConcept;
|
|
import com.diagbot.entity.KlConceptCommon;
|
|
import com.diagbot.entity.KlConceptCommon;
|
|
import com.diagbot.entity.KlConceptStatic;
|
|
import com.diagbot.entity.KlConceptStatic;
|
|
import com.diagbot.entity.KlDiagnose;
|
|
import com.diagbot.entity.KlDiagnose;
|
|
import com.diagbot.entity.KlDiagnoseBase;
|
|
import com.diagbot.entity.KlDiagnoseBase;
|
|
|
|
+import com.diagbot.entity.KlDrugMapping;
|
|
import com.diagbot.entity.KlLexicon;
|
|
import com.diagbot.entity.KlLexicon;
|
|
import com.diagbot.entity.KlLibraryInfo;
|
|
import com.diagbot.entity.KlLibraryInfo;
|
|
import com.diagbot.entity.KlRelation;
|
|
import com.diagbot.entity.KlRelation;
|
|
@@ -21,16 +24,19 @@ import com.diagbot.entity.KlRule;
|
|
import com.diagbot.entity.KlRuleBase;
|
|
import com.diagbot.entity.KlRuleBase;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.LexiconEnum;
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
|
+import com.diagbot.enums.RelationLibTypeEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
import com.diagbot.enums.StatusEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
|
|
+import com.diagbot.util.EntityUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.RespDTOUtil;
|
|
import com.diagbot.util.RespDTOUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
|
|
+import com.diagbot.vo.ConceptRelationVO;
|
|
import com.diagbot.vo.GetAllForRelationVO;
|
|
import com.diagbot.vo.GetAllForRelationVO;
|
|
import com.diagbot.vo.KlConceptAllVO;
|
|
import com.diagbot.vo.KlConceptAllVO;
|
|
import com.diagbot.vo.KlConceptClearVO;
|
|
import com.diagbot.vo.KlConceptClearVO;
|
|
@@ -40,14 +46,15 @@ import com.diagbot.vo.KlConceptSaveSubVO;
|
|
import com.diagbot.vo.KlConceptSaveVO;
|
|
import com.diagbot.vo.KlConceptSaveVO;
|
|
import com.diagbot.vo.KlLibraryInfoVO;
|
|
import com.diagbot.vo.KlLibraryInfoVO;
|
|
import com.diagbot.vo.SearchConceptVO;
|
|
import com.diagbot.vo.SearchConceptVO;
|
|
|
|
+import com.diagbot.vo.SearchVO;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
import java.util.Random;
|
|
@@ -86,6 +93,20 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
KlDiagnoseBaseFacade klDiagnoseBaseFacade;
|
|
KlDiagnoseBaseFacade klDiagnoseBaseFacade;
|
|
@Autowired
|
|
@Autowired
|
|
KlDrugFacade klDrugFacade;
|
|
KlDrugFacade klDrugFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlSymptomFacade klSymptomFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlPacsFacade klPacsFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlOperationFacade klOperationFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlVitalResFacade klVitalResFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlDrugMappingFacade klDrugMappingFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlTcmDiseaseFacade klTcmDiseaseFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ KlTcmSyndromeFacade klTcmSyndromeFacade;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @param klConceptInfoVO
|
|
* @param klConceptInfoVO
|
|
@@ -146,21 +167,14 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public KlConceptAllDTO getConceptAlls(KlConceptAllVO klConceptAllVO) {
|
|
public KlConceptAllDTO getConceptAlls(KlConceptAllVO klConceptAllVO) {
|
|
- //获取科室;
|
|
|
|
- QueryWrapper<KlConcept> klConceptQuer = new QueryWrapper<>();
|
|
|
|
- klConceptQuer.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("lib_type", LexiconEnum.Dept.getKey());
|
|
|
|
- List<KlConcept> klConceptsDept = list(klConceptQuer);
|
|
|
|
- Map<Long, String> deptMap = klConceptsDept.stream().collect(HashMap::new,
|
|
|
|
- (m, v) -> m.put(v.getId(), v.getLibName()), HashMap::putAll);
|
|
|
|
|
|
+ Long conceptId = klConceptAllVO.getConceptId();
|
|
List<KlConceptAllDTO> conceptAll = getConceptAll(klConceptAllVO);
|
|
List<KlConceptAllDTO> conceptAll = getConceptAll(klConceptAllVO);
|
|
|
|
+
|
|
KlConceptAllDTO klConceptAll = new KlConceptAllDTO();
|
|
KlConceptAllDTO klConceptAll = new KlConceptAllDTO();
|
|
List<KlConceptAllSubDTO> klConceptSub = new ArrayList<>();
|
|
List<KlConceptAllSubDTO> klConceptSub = new ArrayList<>();
|
|
if (ListUtil.isNotEmpty(conceptAll)) {
|
|
if (ListUtil.isNotEmpty(conceptAll)) {
|
|
for (KlConceptAllDTO data : conceptAll) {
|
|
for (KlConceptAllDTO data : conceptAll) {
|
|
if (data.getIsConcept().equals(1)) {
|
|
if (data.getIsConcept().equals(1)) {
|
|
- if (null != data.getDeptId()) {
|
|
|
|
- data.setDeptName(deptMap.get(data.getDeptId()));
|
|
|
|
- }
|
|
|
|
BeanUtil.copyProperties(data, klConceptAll);
|
|
BeanUtil.copyProperties(data, klConceptAll);
|
|
} else {
|
|
} else {
|
|
KlConceptAllSubDTO klConceptAllSubDTO = new KlConceptAllSubDTO();
|
|
KlConceptAllSubDTO klConceptAllSubDTO = new KlConceptAllSubDTO();
|
|
@@ -170,6 +184,43 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
klConceptAll.setKlConceptSub(klConceptSub);
|
|
klConceptAll.setKlConceptSub(klConceptSub);
|
|
|
|
+
|
|
|
|
+ LexiconEnum lexiconEnum = LexiconEnum.getEnum(klConceptAllVO.getLibType());
|
|
|
|
+ if (lexiconEnum != null) {
|
|
|
|
+ ConceptRelationVO conceptRelationVO = new ConceptRelationVO();
|
|
|
|
+ conceptRelationVO.setConceptId(conceptId);
|
|
|
|
+ switch (lexiconEnum) {
|
|
|
|
+ case Disease: // 疾病扩展 kl_disease, kl_relation,kl_relation_order
|
|
|
|
+ klDiseaseFacade.getKlDisease(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case Symptom: // 症状扩展 kl_symptom, kl_relation,kl_relation_order
|
|
|
|
+ klSymptomFacade.getKlSymptom(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case Medicine: // 药品扩展 kl_drug
|
|
|
|
+ klDrugFacade.getKlDrug(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case LisName:
|
|
|
|
+ case LisSubName: // 化验扩展 kl_lis
|
|
|
|
+ klLisFacade.getKlLis(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case PacsName:
|
|
|
|
+ case PacsSubName: // 辅检扩展 kl_pacs
|
|
|
|
+ klPacsFacade.getKlPacs(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case Operation: // 手术扩展 kl_operation
|
|
|
|
+ klOperationFacade.getKlOperation(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case VitalResult: //体征结果扩展 kl_vital_result, kl_relation,kl_relation_order
|
|
|
|
+ klVitalResFacade.getKlVitalResult(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case Tcmdisease: // 中医疾病
|
|
|
|
+ klTcmDiseaseFacade.getKlTcmDisease(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ case Tcmsyndrome: // 中医证候
|
|
|
|
+ klTcmSyndromeFacade.getKlTcmSyndrome(conceptId, klConceptAll);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return klConceptAll;
|
|
return klConceptAll;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -179,6 +230,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
*/
|
|
*/
|
|
public Boolean saveConceptInfo(KlConceptSaveVO klConceptSaveVO) {
|
|
public Boolean saveConceptInfo(KlConceptSaveVO klConceptSaveVO) {
|
|
Date now = DateUtil.now();
|
|
Date now = DateUtil.now();
|
|
|
|
+
|
|
|
|
+ CommonParam commonParam = initCommonParam();
|
|
boolean res = false;
|
|
boolean res = false;
|
|
// 校验名称是否相同
|
|
// 校验名称是否相同
|
|
checkConcept(klConceptSaveVO);
|
|
checkConcept(klConceptSaveVO);
|
|
@@ -191,6 +244,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
klLibraryInfoFacade.checkLibraryInfoData(paesubVO);
|
|
klLibraryInfoFacade.checkLibraryInfoData(paesubVO);
|
|
//先判断是新加的,还是修改
|
|
//先判断是新加的,还是修改
|
|
if (null != klConceptSaveVO.getConceptId() && null != klConceptSaveVO.getLibId()) {
|
|
if (null != klConceptSaveVO.getConceptId() && null != klConceptSaveVO.getLibId()) {
|
|
|
|
+ commonParam.setConceptId(klConceptSaveVO.getConceptId());
|
|
//更新标准词
|
|
//更新标准词
|
|
res = updateAll(klConceptSaveVO);
|
|
res = updateAll(klConceptSaveVO);
|
|
//更新同义词
|
|
//更新同义词
|
|
@@ -237,11 +291,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
klConceptPare.setGmtCreate(now);
|
|
klConceptPare.setGmtCreate(now);
|
|
klConceptPare.setGmtModified(now);
|
|
klConceptPare.setGmtModified(now);
|
|
res = save(klConceptPare);
|
|
res = save(klConceptPare);
|
|
|
|
+ commonParam.setConceptId(klConceptPare.getId()); // 赋值conceptId
|
|
if (res) {
|
|
if (res) {
|
|
//2.再把标准词d的conceptId保存到kl_library_info表 生成libId,
|
|
//2.再把标准词d的conceptId保存到kl_library_info表 生成libId,
|
|
Long conceptId = klConceptPare.getId();
|
|
Long conceptId = klConceptPare.getId();
|
|
KlLibraryInfo klLibraryInfoSub = new KlLibraryInfo();
|
|
KlLibraryInfo klLibraryInfoSub = new KlLibraryInfo();
|
|
- klLibraryInfoSub.setConceptId(conceptId);
|
|
|
|
|
|
+ klLibraryInfoSub.setConceptId(commonParam.getConceptId());
|
|
klLibraryInfoSub.setName(klConceptSaveVO.getLibName());
|
|
klLibraryInfoSub.setName(klConceptSaveVO.getLibName());
|
|
klLibraryInfoSub.setSpell(klConceptSaveVO.getSpell());
|
|
klLibraryInfoSub.setSpell(klConceptSaveVO.getSpell());
|
|
klLibraryInfoSub.setTypeId(klConceptSaveVO.getLibType());
|
|
klLibraryInfoSub.setTypeId(klConceptSaveVO.getLibType());
|
|
@@ -274,32 +329,53 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
conceptCommon.setGmtModified(now);
|
|
conceptCommon.setGmtModified(now);
|
|
klConceptCommonFacade.save(conceptCommon);
|
|
klConceptCommonFacade.save(conceptCommon);
|
|
}
|
|
}
|
|
- //更新kl_disease
|
|
|
|
- if (null != klConceptSaveVO.getIcdCode()) {
|
|
|
|
- res = klDiseaseFacade.saveAll(klConceptPare, klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //更新kl_lis
|
|
|
|
- if (null != klConceptSaveVO.getScopeType()) {
|
|
|
|
- res = klLisFacade.saveAll(klConceptPare, klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
- if (null != klConceptSaveVO.getDrug()) {
|
|
|
|
- res = klDrugFacade.saveAll(klConceptPare, klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
//增加同义词
|
|
//增加同义词
|
|
List<KlConceptSaveSubVO> klConceptSub = klConceptSaveVO.getKlConceptSub();
|
|
List<KlConceptSaveSubVO> klConceptSub = klConceptSaveVO.getKlConceptSub();
|
|
if (ListUtil.isNotEmpty(klConceptSub)) {
|
|
if (ListUtil.isNotEmpty(klConceptSub)) {
|
|
for (KlConceptSaveSubVO subVO : klConceptSub) {
|
|
for (KlConceptSaveSubVO subVO : klConceptSub) {
|
|
if (subVO.getLibId() == null) {
|
|
if (subVO.getLibId() == null) {
|
|
-
|
|
|
|
klLibraryInfoFacade.checkLibraryInfoData(subVO);
|
|
klLibraryInfoFacade.checkLibraryInfoData(subVO);
|
|
-
|
|
|
|
res = klLibraryInfoFacade.savekLibraryInfoData(klConceptPare.getId(), subVO);
|
|
res = klLibraryInfoFacade.savekLibraryInfoData(klConceptPare.getId(), subVO);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
|
|
+ LexiconEnum lexiconEnum = LexiconEnum.getEnum(klConceptSaveVO.getLibType().intValue());
|
|
|
|
+ if (lexiconEnum != null) {
|
|
|
|
+ switch (lexiconEnum) {
|
|
|
|
+ case Disease: // 疾病扩展 kl_disease, kl_relation,kl_relation_order
|
|
|
|
+ res = klDiseaseFacade.saveAll(commonParam, klConceptSaveVO.getKlDiseaseVO());
|
|
|
|
+ klRelationFacade.saveKlDisease(commonParam, klConceptSaveVO.getKlDiseaseVO());
|
|
|
|
+ break;
|
|
|
|
+ case Symptom: // 症状扩展 kl_symptom, kl_relation,kl_relation_order
|
|
|
|
+ klSymptomFacade.saveAll(commonParam, klConceptSaveVO.getKlSymptomVO());
|
|
|
|
+ klRelationFacade.saveKlSymptom(commonParam, klConceptSaveVO.getKlSymptomVO());
|
|
|
|
+ break;
|
|
|
|
+ case Medicine: // 药品通用名扩展 kl_drug
|
|
|
|
+ klDrugFacade.saveKlDrug(commonParam, klConceptSaveVO.getKlDrugVO());
|
|
|
|
+ break;
|
|
|
|
+ case LisName: // 实验室检查套餐
|
|
|
|
+ case LisSubName: // 实验室检查子项目
|
|
|
|
+ klLisFacade.saveAll(commonParam, klConceptSaveVO.getKlLisVO());
|
|
|
|
+ break;
|
|
|
|
+ case PacsSubName: // 辅助检查子项目
|
|
|
|
+ case PacsName: // 辅助检查项目
|
|
|
|
+ klPacsFacade.saveAll(commonParam, klConceptSaveVO.getKlPacsVO());
|
|
|
|
+ break;
|
|
|
|
+ case Operation: // 手术和操作
|
|
|
|
+ klOperationFacade.saveAll(commonParam, klConceptSaveVO.getKlOperationVO());
|
|
|
|
+ break;
|
|
|
|
+ case VitalResult: // 体征结果
|
|
|
|
+ klRelationFacade.saveKlVitalRes(commonParam, klConceptSaveVO.getKlVitalResultVO());
|
|
|
|
+ break;
|
|
|
|
+ case Tcmdisease: // 中医疾病
|
|
|
|
+ klTcmDiseaseFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmDiseaseVO());
|
|
|
|
+ break;
|
|
|
|
+ case Tcmsyndrome: // 中医证候
|
|
|
|
+ klTcmSyndromeFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmSyndromeVO());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
@@ -330,18 +406,6 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
//当是疾病的时候才保存性别和年龄大小的数据
|
|
//当是疾病的时候才保存性别和年龄大小的数据
|
|
res = klConceptCommonFacade.saveOrUpdateAll(klConceptSaveVO);
|
|
res = klConceptCommonFacade.saveOrUpdateAll(klConceptSaveVO);
|
|
}
|
|
}
|
|
- //更新kl_disease
|
|
|
|
- if (null != klConceptSaveVO.getIcdCode()) {
|
|
|
|
- //当icd10编码不为空
|
|
|
|
- res = klDiseaseFacade.saveOrUpdateAll(klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
- //更新kl_lis
|
|
|
|
- if (null != klConceptSaveVO.getScopeType()) {
|
|
|
|
- res = klLisFacade.saveOrUpdateAll(klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
- if (null != klConceptSaveVO.getDrug()) {
|
|
|
|
- klDrugFacade.saveOrUpdateAll(klConceptSaveVO);
|
|
|
|
- }
|
|
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -379,6 +443,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
return retList;
|
|
return retList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据类型和名称查找术语,名称和类型不能为空
|
|
|
|
+ *
|
|
|
|
+ * @param searchConceptVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
|
|
public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
|
|
List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
String name = searchConceptVO.getName();
|
|
String name = searchConceptVO.getName();
|
|
@@ -405,6 +475,34 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
return getAllForRelationDTOS;
|
|
return getAllForRelationDTOS;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据类型和名称查找术语,名称可为空
|
|
|
|
+ *
|
|
|
|
+ * @param SearchVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchVO SearchVO) {
|
|
|
|
+ List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
|
|
+ List<Long> excludedConceptIds = SearchVO.getExcludedConceptIds();
|
|
|
|
+ List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("lib_type", SearchVO.getLibType())
|
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
|
+ .like(StringUtil.isNotBlank(SearchVO.getName()), "lib_name", SearchVO.getName())
|
|
|
|
+ .notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds));
|
|
|
|
+ if (ListUtil.isNotEmpty(conceptList)) {
|
|
|
|
+ getAllForRelationDTOS = conceptList.stream().map(x -> {
|
|
|
|
+ GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
|
|
|
|
+ getAllForRelationDTO.setConceptNameType(x.getLibName());
|
|
|
|
+ getAllForRelationDTO.setConceptName(x.getLibName());
|
|
|
|
+ getAllForRelationDTO.setConceptId(x.getId());
|
|
|
|
+ getAllForRelationDTO.setLibType(x.getLibType());
|
|
|
|
+ return getAllForRelationDTO;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ return getAllForRelationDTOS;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 筛选符合类型的概念id
|
|
* 筛选符合类型的概念id
|
|
*
|
|
*
|
|
@@ -451,11 +549,17 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
}
|
|
}
|
|
|
|
|
|
//kl_relation
|
|
//kl_relation
|
|
- int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
- .eq("start_id", klConceptSatarOrdisaVO.getConceptId()).or()
|
|
|
|
- .eq("end_id", klConceptSatarOrdisaVO.getConceptId()));
|
|
|
|
|
|
+ List<Integer> notRelationList = Lists.newArrayList(RelationLibTypeEnum.relationDept.getKey(),
|
|
|
|
+ RelationLibTypeEnum.relationPart.getKey(), RelationLibTypeEnum.relationSystem.getKey(),
|
|
|
|
+ RelationLibTypeEnum.relationAccSymptom.getKey(), RelationLibTypeEnum.relationNature.getKey());
|
|
|
|
+ int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .and(r -> r.eq("end_id", klConceptSatarOrdisaVO.getConceptId())
|
|
|
|
+ .or(r1 -> r1.eq("start_id", klConceptSatarOrdisaVO.getConceptId()).notIn("relation_id", notRelationList))
|
|
|
|
+ )
|
|
|
|
+ );
|
|
if (relationsum > 0) {
|
|
if (relationsum > 0) {
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关存在关系!");
|
|
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关或扩展信息存在关系!");
|
|
}
|
|
}
|
|
//kl_rule
|
|
//kl_rule
|
|
int rulesum = klRuleFacade.count(new QueryWrapper<KlRule>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
int rulesum = klRuleFacade.count(new QueryWrapper<KlRule>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
@@ -481,12 +585,19 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
if (diagnoseBasesum > 0) {
|
|
if (diagnoseBasesum > 0) {
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
|
|
}
|
|
}
|
|
|
|
+ //kl_drug_mapping
|
|
|
|
+ int drugMappingSum = klDrugMappingFacade.count(new QueryWrapper<KlDrugMapping>().eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("drug_concept", klConceptSatarOrdisaVO.getConceptId()));
|
|
|
|
+ if (drugMappingSum > 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与注册药品存在关系!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
|
|
UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
|
|
klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
.eq("id", klConceptSatarOrdisaVO.getConceptId())
|
|
.eq("id", klConceptSatarOrdisaVO.getConceptId())
|
|
- .set("status", status).set("gmt_modified", now)
|
|
|
|
- .set("modifier", UserUtils.getCurrentPrincipleID());
|
|
|
|
|
|
+ .set("status", status).set("gmt_modified", now);
|
|
|
|
+ // .set("modifier", UserUtils.getCurrentPrincipleID()
|
|
|
|
+ // );
|
|
return this.update(klLibraryUpdate);
|
|
return this.update(klLibraryUpdate);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -526,4 +637,32 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "医学标准术语名称已存在同义词");
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "医学标准术语名称已存在同义词");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据conceptId和relationId获取关联数据(通用方法)
|
|
|
|
+ *
|
|
|
|
+ * @param conceptRelationVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Map<Integer, List<KlConceptSimDTO>> getRelationConceptFac(ConceptRelationVO conceptRelationVO) {
|
|
|
|
+ Map<Integer, List<KlConceptSimDTO>> map = Maps.newLinkedHashMap();
|
|
|
|
+ List<KlConceptSimDTO> relationConcept = this.getRelationConcept(conceptRelationVO);
|
|
|
|
+ if (ListUtil.isNotEmpty(relationConcept)) {
|
|
|
|
+ map = EntityUtil.makeEntityListMap(relationConcept, "libType");
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 初始化参数
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public CommonParam initCommonParam() {
|
|
|
|
+ CommonParam param = new CommonParam();
|
|
|
|
+ String person = UserUtils.getCurrentPrincipleID();
|
|
|
|
+ param.setNow(DateUtil.now());
|
|
|
|
+ param.setPerson(person);
|
|
|
|
+ return param;
|
|
|
|
+ }
|
|
}
|
|
}
|