|
@@ -1,52 +1,27 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.CdssCoreClient;
|
|
|
-import com.diagbot.dto.ConceptDetailDTO;
|
|
|
-import com.diagbot.dto.ConceptInfoDTO;
|
|
|
import com.diagbot.dto.DictionaryInfoDTO;
|
|
|
import com.diagbot.dto.GetAllForRelationDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeDetailDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeHISDTO;
|
|
|
-import com.diagbot.dto.StaticKnowledgeIndexDTO;
|
|
|
import com.diagbot.entity.ConceptDetail;
|
|
|
import com.diagbot.entity.ConceptInfo;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
-import com.diagbot.exception.CommonErrorCode;
|
|
|
-import com.diagbot.exception.CommonException;
|
|
|
-import com.diagbot.service.ConceptDetailService;
|
|
|
import com.diagbot.service.impl.ConceptInfoServiceImpl;
|
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.util.SysUserUtils;
|
|
|
-import com.diagbot.vo.ChangeStatusVO;
|
|
|
-import com.diagbot.vo.ConceptDetailVO;
|
|
|
-import com.diagbot.vo.ConceptInfoPageVO;
|
|
|
-import com.diagbot.vo.ConceptInfoVO;
|
|
|
import com.diagbot.vo.HasStaticKnowledgeVO;
|
|
|
-import com.diagbot.vo.IdVO;
|
|
|
import com.diagbot.vo.SearchConceptVO;
|
|
|
import com.diagbot.vo.StaticKnowledgeHISVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeIndexVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeNameVO;
|
|
|
-import com.diagbot.vo.StaticKnowledgeVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -62,541 +37,10 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
@Autowired
|
|
|
private CdssCoreClient cdssCoreClient;
|
|
|
@Autowired
|
|
|
- private DictionaryFacade dictionaryFacade;
|
|
|
- @Autowired
|
|
|
private ConceptDetailFacade conceptDetailFacade;
|
|
|
@Autowired
|
|
|
- @Qualifier("conceptDetailServiceImpl")
|
|
|
- private ConceptDetailService conceptDetailService;
|
|
|
- @Autowired
|
|
|
private MappingConfigFacade mappingConfigFacade;
|
|
|
|
|
|
- /**
|
|
|
- * 返回带静态知识的检索结果
|
|
|
- *
|
|
|
- * @param staticKnowledgeIndexVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<StaticKnowledgeIndexDTO> staticKnowledgeIndexWithInfo(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
- staticKnowledgeIndexVO.setHasInfo(1);
|
|
|
- List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
- //过滤没有静态知识的检索结果
|
|
|
- staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList
|
|
|
- .stream()
|
|
|
- .filter(i -> (i.getHasInfo().equals(1))
|
|
|
- && (i.getHasStaticKnowledge().equals(1)
|
|
|
- || i.getHasClinicalPathway().equals(1)
|
|
|
- || i.getHasNotice().equals(1)))
|
|
|
- .collect(Collectors.toList());
|
|
|
- return staticKnowledgeIndexDTOList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 返回不带静态知识的检索结果
|
|
|
- *
|
|
|
- * @param staticKnowledgeIndexVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<StaticKnowledgeIndexDTO> staticKnowledgeIndexWithoutInfo(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
- staticKnowledgeIndexVO.setHasInfo(0);
|
|
|
- List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
- //过滤没有静态知识的检索结果
|
|
|
- staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList
|
|
|
- .stream()
|
|
|
- .filter(i -> i.getHasInfo().equals(0))
|
|
|
- .collect(Collectors.toList());
|
|
|
- return staticKnowledgeIndexDTOList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 医学知识(静态信息)检索
|
|
|
- *
|
|
|
- * @param staticKnowledgeIndexVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
|
|
|
- List<StaticKnowledgeIndexDTO> retList = Lists.newLinkedList();
|
|
|
- //静态知识检索顺序
|
|
|
- List<DictionaryInfoDTO> dicStaticIndexList = dictionaryFacade.getListByGroupType(7);
|
|
|
- //页面术语类型和图谱映射
|
|
|
- List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(8);
|
|
|
- //静态知识类型
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
-
|
|
|
- List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = Lists.newLinkedList();
|
|
|
- RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
|
|
|
- RespDTOUtil.respNGDealCover(respDTO, "检索失败");
|
|
|
- staticKnowledgeIndexDTOList = respDTO.data;
|
|
|
- if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)) {
|
|
|
- //typeName转换
|
|
|
- staticKnowledgeIndexDTOList.forEach(item -> {
|
|
|
- item.setTypeName(convertTypeName(item.getTypeName(), 2, dicTypeMappingList));
|
|
|
- });
|
|
|
- if (staticKnowledgeIndexVO.getHasInfo().equals(1)) {
|
|
|
- //是否有静态知识
|
|
|
- List<String> conNameList = staticKnowledgeIndexDTOList
|
|
|
- .stream()
|
|
|
- .map(i -> i.getName())
|
|
|
- .collect(Collectors.toList());
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- conceptInfoQueryWrapper.in("name", conNameList);
|
|
|
- conceptInfoQueryWrapper.eq("status", StatusEnum.Enable.getKey());
|
|
|
- List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
|
|
|
- if (ListUtil.isNotEmpty(conceptInfoList)) {
|
|
|
- //typeName转换
|
|
|
- conceptInfoList.forEach(item -> {
|
|
|
- item.setType(convertTypeName(item.getType(), 2, dicTypeMappingList));
|
|
|
- });
|
|
|
- Map<String, ConceptInfo> infoMap
|
|
|
- = EntityUtil.makeEntityMapByKeys(conceptInfoList, "_", "name", "type");
|
|
|
- for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
|
|
|
- if (infoMap.containsKey(item.getName() + "_" + item.getTypeName())) {
|
|
|
- item.setId(infoMap.get(item.getName() + "_" + item.getTypeName()).getId());
|
|
|
- }
|
|
|
- }
|
|
|
- List<Long> conceptIdList = conceptInfoList.stream()
|
|
|
- .map(i -> i.getId())
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (ListUtil.isNotEmpty(conceptIdList)) {
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- conceptDetailQueryWrapper.in("concept_id", conceptIdList);
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- Map<Long, List<ConceptDetail>> detailMap
|
|
|
- = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
|
|
|
- for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
|
|
|
- if (item.getId() == null
|
|
|
- || !detailMap.containsKey(item.getId())) {
|
|
|
- item.setHasInfo(0);
|
|
|
- item.setHasStaticKnowledge(0);
|
|
|
- item.setHasClinicalPathway(0);
|
|
|
- item.setHasNotice((0));
|
|
|
- item.setHasTreatInfo(0);
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (ConceptDetail detail : detailMap.get(item.getId())) {
|
|
|
- item.setHasInfo(1);
|
|
|
- List<String> contentTypeList = Arrays.asList(detail.getContentType().split(","));
|
|
|
- if (contentTypeList.contains("1")) {
|
|
|
- item.setHasStaticKnowledge(1);
|
|
|
- }
|
|
|
- if (contentTypeList.contains("2")) {
|
|
|
- item.setHasNotice(1);
|
|
|
- }
|
|
|
- if (contentTypeList.contains("3")) {
|
|
|
- item.setHasClinicalPathway(1);
|
|
|
- }
|
|
|
- if (contentTypeList.contains("4")) {
|
|
|
- item.setHasTreatInfo(1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //排序
|
|
|
- Map<String, List<StaticKnowledgeIndexDTO>> map
|
|
|
- = EntityUtil.makeEntityListMap(staticKnowledgeIndexDTOList, "typeName");
|
|
|
- Map<Integer, String> staticTypeDicMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- for (DictionaryInfoDTO dic : dicStaticIndexList) {
|
|
|
- if (dic.getVal().equals("3")) {//检验
|
|
|
- //3-检验套餐、4-检验细项
|
|
|
- if (map.containsKey(staticTypeDicMap.get("3"))) {
|
|
|
- retList.addAll(map.get(staticTypeDicMap.get("3")));
|
|
|
- }
|
|
|
- if (map.containsKey(staticTypeDicMap.get("4"))) {
|
|
|
- retList.addAll(map.get(staticTypeDicMap.get("4")));
|
|
|
- }
|
|
|
- } else if (dic.getVal().equals("5")) {//检查
|
|
|
- //5-检查、6-检查子项
|
|
|
- if (map.containsKey(staticTypeDicMap.get("5"))) {
|
|
|
- retList.addAll(map.get(staticTypeDicMap.get("5")));
|
|
|
- }
|
|
|
- if (map.containsKey(staticTypeDicMap.get("6"))) {
|
|
|
- retList.addAll(map.get(staticTypeDicMap.get("6")));
|
|
|
- }
|
|
|
- } else if (map.containsKey(dic.getName())) {
|
|
|
- retList.addAll(map.get(dic.getName()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return retList;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面获取静态知识
|
|
|
- *
|
|
|
- * @param staticKnowledgeVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public StaticKnowledgeDTO getStaticKnowledge(StaticKnowledgeVO staticKnowledgeVO) {
|
|
|
- StaticKnowledgeDTO staticKnowledgeDTO = new StaticKnowledgeDTO();
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- Map<String, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- String typeName = dicStaticTypeValNameMap.get(staticKnowledgeVO.getType().toString());
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- typeName = convertTypeName(typeName, 1, dicList);
|
|
|
-
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("name", staticKnowledgeVO.getName())
|
|
|
- .eq("status", StatusEnum.Enable.getKey())
|
|
|
- .eq("type", typeName);
|
|
|
- ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
|
|
|
-
|
|
|
- if (conceptInfo == null) {
|
|
|
- StaticKnowledgeNameVO superName = new StaticKnowledgeNameVO();
|
|
|
- if (typeName.equals("实验室检查名称")) {
|
|
|
- StaticKnowledgeNameVO staticKnowledgeNameVO = new StaticKnowledgeNameVO();
|
|
|
- staticKnowledgeNameVO.setName(staticKnowledgeVO.getName());
|
|
|
- staticKnowledgeNameVO.setType(staticKnowledgeVO.getType());
|
|
|
- RespDTO<StaticKnowledgeNameVO> respDTO = cdssCoreClient.getSuperName(staticKnowledgeNameVO);
|
|
|
- if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
- superName = respDTO.data;
|
|
|
- }
|
|
|
- } else if (typeName.equals("辅助检查名称")) {
|
|
|
- StaticKnowledgeNameVO staticKnowledgeNameVO = new StaticKnowledgeNameVO();
|
|
|
- staticKnowledgeNameVO.setName(staticKnowledgeVO.getName());
|
|
|
- staticKnowledgeNameVO.setType(6);
|
|
|
- RespDTO<StaticKnowledgeNameVO> respDTO = cdssCoreClient.getSuperName(staticKnowledgeNameVO);
|
|
|
- if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
- superName = respDTO.data;
|
|
|
- }
|
|
|
- } else {
|
|
|
- throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
|
|
|
- }
|
|
|
- typeName = dicStaticTypeValNameMap.get(superName.getType().toString());
|
|
|
- typeName = convertTypeName(typeName, 1, dicList);
|
|
|
-
|
|
|
- conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("name", superName.getName())
|
|
|
- .eq("status", StatusEnum.Enable.getKey())
|
|
|
- .eq("type", typeName);
|
|
|
- conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
|
|
|
-
|
|
|
- if (conceptInfo == null) {
|
|
|
- throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- BeanUtil.copyProperties(conceptInfo, staticKnowledgeDTO);
|
|
|
- Long conceptId = conceptInfo.getId();
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("concept_id", conceptId);
|
|
|
- if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
|
|
|
- String sql = "";
|
|
|
- for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
|
|
|
- if (contentType.equals(0)) {
|
|
|
- sql = "";
|
|
|
- break;
|
|
|
- }
|
|
|
- if (StringUtil.isNotBlank(sql)) {
|
|
|
- sql += " or ";
|
|
|
- }
|
|
|
- sql += "find_in_set(" + contentType + ",content_type)";
|
|
|
- }
|
|
|
- if (StringUtil.isNotBlank(sql)) {
|
|
|
- sql = "(" + sql + ")";
|
|
|
- conceptDetailQueryWrapper.apply(sql);
|
|
|
- }
|
|
|
- }
|
|
|
- conceptDetailQueryWrapper.orderByAsc("order_no");
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- List<StaticKnowledgeDetailDTO> detailList
|
|
|
- = BeanUtil.listCopyTo(conceptDetailList, StaticKnowledgeDetailDTO.class);
|
|
|
- List<StaticKnowledgeDetailDTO> introduceList = detailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("1"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> noticeList = detailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("2"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> clinicalPathwayList = detailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> treatInfoList = detailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- Map<String, List<StaticKnowledgeDetailDTO>> detailMap = new HashMap<>();
|
|
|
- if (ListUtil.isEmpty(staticKnowledgeVO.getContentTypes()) || staticKnowledgeVO.getContentTypes().contains(0)) {
|
|
|
- if (ListUtil.isNotEmpty(introduceList)) {
|
|
|
- detailMap.put("静态知识", introduceList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(noticeList)) {
|
|
|
- detailMap.put("注意事项", noticeList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(clinicalPathwayList)) {
|
|
|
- detailMap.put("临床路径", clinicalPathwayList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(treatInfoList)) {
|
|
|
- detailMap.put("治疗方案", treatInfoList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeVO.getContentTypes().contains(1)) {
|
|
|
- detailMap.put("静态知识", introduceList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeVO.getContentTypes().contains(2)) {
|
|
|
- detailMap.put("注意事项", noticeList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeVO.getContentTypes().contains(3)) {
|
|
|
- detailMap.put("临床路径", clinicalPathwayList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeVO.getContentTypes().contains(4)) {
|
|
|
- detailMap.put("治疗方案", treatInfoList);
|
|
|
- }
|
|
|
- }
|
|
|
- staticKnowledgeDTO.setDetails(detailMap);
|
|
|
- return staticKnowledgeDTO;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 医院端获取静态知识(对接)
|
|
|
- *
|
|
|
- * @param staticKnowledgeHISVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<StaticKnowledgeHISDTO> getStaticKnowledgeForHIS(StaticKnowledgeHISVO staticKnowledgeHISVO) {
|
|
|
-
|
|
|
- List<StaticKnowledgeHISDTO> retList = Lists.newArrayList();
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- Map<String, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
-
|
|
|
- List<String> typeNames = ListUtil.newArrayList();
|
|
|
- List<Integer> types = ListUtil.newArrayList();
|
|
|
- types.add(staticKnowledgeHISVO.getType());
|
|
|
- if (staticKnowledgeHISVO.getType().equals(3)) {
|
|
|
- types.add(4);
|
|
|
- } else if (staticKnowledgeHISVO.getType().equals(4)) {
|
|
|
- types.add(3);
|
|
|
- }
|
|
|
- if (staticKnowledgeHISVO.getType().equals(5)) {
|
|
|
- types.add(6);
|
|
|
- } else if (staticKnowledgeHISVO.getType().equals(6)) {
|
|
|
- types.add(5);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- for (Integer type : types) {
|
|
|
- String typeName = dicStaticTypeValNameMap.get(type.toString());
|
|
|
- typeName = convertTypeName(typeName, 1, dicList);
|
|
|
- typeNames.add(typeName);
|
|
|
- }
|
|
|
-
|
|
|
- //术语映射
|
|
|
- List<String> uniqueNameList = getUniqueNames(staticKnowledgeHISVO);
|
|
|
- if (ListUtil.isEmpty(uniqueNameList)) {
|
|
|
- return retList;
|
|
|
- }
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("name", uniqueNameList)
|
|
|
- .eq("status", StatusEnum.Enable.getKey())
|
|
|
- .in("type", typeNames);
|
|
|
- List<ConceptInfo> conceptList = this.list(conceptInfoQueryWrapper);
|
|
|
- List<ConceptInfo> conceptInfoList = Lists.newLinkedList();
|
|
|
- if (staticKnowledgeHISVO.getType().equals(3)) {
|
|
|
- conceptInfoList.addAll(conceptList.stream().filter(i -> i.getType().equals("实验室检查套餐名")).collect(Collectors.toList()));
|
|
|
- for (ConceptInfo info : conceptList) {
|
|
|
- if (info.getType().equals("实验室检查名称")
|
|
|
- && ListUtil.isEmpty(conceptInfoList.stream().filter(i -> i.getName().equals(info.getName())).collect(Collectors.toList()))) {
|
|
|
- conceptInfoList.add(info);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (staticKnowledgeHISVO.getType().equals(4)) {
|
|
|
- conceptInfoList.addAll(conceptList.stream().filter(i -> i.getType().equals("实验室检查名称")).collect(Collectors.toList()));
|
|
|
- for (ConceptInfo info : conceptList) {
|
|
|
- if (info.getType().equals("实验室检查套餐名")
|
|
|
- && ListUtil.isEmpty(conceptInfoList.stream().filter(i -> i.getName().equals(info.getName())).collect(Collectors.toList()))) {
|
|
|
- conceptInfoList.add(info);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- conceptInfoList.addAll(conceptList);
|
|
|
- }
|
|
|
-
|
|
|
- List<String> existUniqueNameList = Lists.newLinkedList();
|
|
|
-
|
|
|
- if (ListUtil.isNotEmpty(conceptInfoList)) {
|
|
|
- existUniqueNameList.addAll(conceptInfoList
|
|
|
- .stream()
|
|
|
- .map(i -> i.getName())
|
|
|
- .collect(Collectors.toList()));
|
|
|
- }
|
|
|
-
|
|
|
- //未匹配到静态知识
|
|
|
- List<String> notExistUniqueNameList = Lists.newLinkedList();
|
|
|
- uniqueNameList.forEach(name -> {
|
|
|
- if (!existUniqueNameList.contains(name)) {
|
|
|
- notExistUniqueNameList.add(name);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //获取上级静态知识
|
|
|
- if (ListUtil.isNotEmpty(notExistUniqueNameList)) {
|
|
|
- List<StaticKnowledgeNameVO> paramNames = Lists.newLinkedList();
|
|
|
- List<StaticKnowledgeNameVO> superNames = Lists.newLinkedList();
|
|
|
- for (String name : notExistUniqueNameList) {
|
|
|
- StaticKnowledgeNameVO paramName = new StaticKnowledgeNameVO();
|
|
|
- paramName.setName(name);
|
|
|
- if (staticKnowledgeHISVO.getType().equals(3)) {
|
|
|
- paramName.setType(4);
|
|
|
- } else if (staticKnowledgeHISVO.getType().equals(5)) {
|
|
|
- paramName.setType(6);
|
|
|
- } else {
|
|
|
- paramName.setType(staticKnowledgeHISVO.getType());
|
|
|
- }
|
|
|
- paramNames.add(paramName);
|
|
|
- }
|
|
|
- RespDTO<List<StaticKnowledgeNameVO>> respDTO = cdssCoreClient.getSuperNameBatch(paramNames);
|
|
|
- if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
- superNames = respDTO.data;
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(superNames)) {
|
|
|
- List<String> superNameList = superNames.stream().map(i -> i.getName()).distinct().collect(Collectors.toList());
|
|
|
- List<Integer> superTypes = superNames.stream().map(i -> i.getType()).distinct().collect(Collectors.toList());
|
|
|
- List<String> superTypeNames = Lists.newLinkedList();
|
|
|
- for (Integer type : superTypes) {
|
|
|
- String typeName = dicStaticTypeValNameMap.get(type.toString());
|
|
|
- typeName = convertTypeName(typeName, 1, dicList);
|
|
|
- superTypeNames.add(typeName);
|
|
|
- }
|
|
|
- conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("name", superNameList)
|
|
|
- .eq("status", StatusEnum.Enable.getKey())
|
|
|
- .in("type", superTypeNames);
|
|
|
- List<ConceptInfo> superConceptInfoList = this.list(conceptInfoQueryWrapper);
|
|
|
- if (ListUtil.isNotEmpty(superConceptInfoList)) {
|
|
|
- conceptInfoList.addAll(superConceptInfoList);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- conceptInfoList = conceptInfoList.stream().distinct().collect(Collectors.toList());
|
|
|
-
|
|
|
- if (ListUtil.isEmpty(conceptInfoList)) {
|
|
|
- return retList;
|
|
|
- }
|
|
|
-
|
|
|
- retList = BeanUtil.listCopyTo(conceptInfoList, StaticKnowledgeHISDTO.class);
|
|
|
- List<Long> conceptIdList = conceptInfoList.stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("concept_id", conceptIdList);
|
|
|
- if (ListUtil.isNotEmpty(staticKnowledgeHISVO.getContentTypes())) {
|
|
|
- String sql = "";
|
|
|
- for (Integer contentType : staticKnowledgeHISVO.getContentTypes()) {
|
|
|
- if (contentType.equals(0)) {
|
|
|
- sql = "";
|
|
|
- break;
|
|
|
- }
|
|
|
- if (StringUtil.isNotBlank(sql)) {
|
|
|
- sql += " or ";
|
|
|
- }
|
|
|
- sql += "find_in_set(" + contentType + ",content_type)";
|
|
|
- }
|
|
|
- if (StringUtil.isNotBlank(sql)) {
|
|
|
- sql = "(" + sql + ")";
|
|
|
- }
|
|
|
- conceptDetailQueryWrapper.apply(sql);
|
|
|
- }
|
|
|
- conceptDetailQueryWrapper.orderByAsc("concept_id", "order_no");
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- List<StaticKnowledgeDetailDTO> detailList
|
|
|
- = BeanUtil.listCopyTo(conceptDetailList, StaticKnowledgeDetailDTO.class);
|
|
|
- Map<Long, List<StaticKnowledgeDetailDTO>> conceptMap
|
|
|
- = EntityUtil.makeEntityListMap(detailList, "conceptId");
|
|
|
- for (StaticKnowledgeHISDTO staticKnowledgeDTO : retList) {
|
|
|
- staticKnowledgeDTO.setHisName(staticKnowledgeHISVO.getHisName());
|
|
|
- staticKnowledgeDTO.setHisDetailName(staticKnowledgeHISVO.getHisDetailName());
|
|
|
- List<StaticKnowledgeDetailDTO> subDetailList = conceptMap.get(staticKnowledgeDTO.getId());
|
|
|
- if (ListUtil.isNotEmpty(subDetailList)) {
|
|
|
- List<StaticKnowledgeDetailDTO> introduceList = subDetailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("1"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> noticeList = subDetailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("2"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> clinicalPathwayList = subDetailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- List<StaticKnowledgeDetailDTO> treatInfoList = subDetailList
|
|
|
- .stream()
|
|
|
- .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- Map<String, List<StaticKnowledgeDetailDTO>> subDetailMap = new HashMap<>();
|
|
|
- if (ListUtil.isEmpty(staticKnowledgeHISVO.getContentTypes()) || staticKnowledgeHISVO.getContentTypes().contains(0)) {
|
|
|
- if (ListUtil.isNotEmpty(introduceList)) {
|
|
|
- subDetailMap.put("静态知识", introduceList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(noticeList)) {
|
|
|
- subDetailMap.put("注意事项", noticeList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(clinicalPathwayList)) {
|
|
|
- subDetailMap.put("临床路径", clinicalPathwayList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(treatInfoList)) {
|
|
|
- subDetailMap.put("治疗方案", treatInfoList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeHISVO.getContentTypes().contains(1)) {
|
|
|
- subDetailMap.put("静态知识", introduceList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeHISVO.getContentTypes().contains(2)) {
|
|
|
- subDetailMap.put("注意事项", noticeList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeHISVO.getContentTypes().contains(3)) {
|
|
|
- subDetailMap.put("临床路径", clinicalPathwayList);
|
|
|
- }
|
|
|
- if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeHISVO.getContentTypes().contains(4)) {
|
|
|
- subDetailMap.put("治疗方案", treatInfoList);
|
|
|
- }
|
|
|
- }
|
|
|
- staticKnowledgeDTO.setDetails(subDetailMap);
|
|
|
- }
|
|
|
- }
|
|
|
- return retList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面术语类型和图谱标签名称相互转换
|
|
|
- *
|
|
|
- * @param typeName
|
|
|
- * @param flag 1-页面术语类型转图谱标签名称,2- 图谱标签名称转页面术语类型
|
|
|
- * @param dicList
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String convertTypeName(String typeName, Integer flag, List<DictionaryInfoDTO> dicList) {
|
|
|
- if (ListUtil.isNotEmpty(dicList)) {
|
|
|
- Map<String, String> nameValMap = new HashMap<>();
|
|
|
- if (flag.equals(1)) {
|
|
|
- nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "name", "val");
|
|
|
- } else if (flag.equals(2)) {
|
|
|
- nameValMap = EntityUtil.makeMapWithKeyValue(dicList, "val", "name");
|
|
|
- }
|
|
|
- if (nameValMap.containsKey(typeName)) {
|
|
|
- return nameValMap.get(typeName);
|
|
|
- }
|
|
|
- }
|
|
|
- return typeName;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param staticKnowledgeHISVO
|
|
|
* @return
|
|
@@ -608,7 +52,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 1:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> disConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Disease.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Disease.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (disConfigMap != null
|
|
|
&& disConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = disConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -620,7 +64,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 2:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> drugConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Drug.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Drug.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (drugConfigMap != null
|
|
|
&& drugConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = drugConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -633,7 +77,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 4:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> lisConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.LisPack.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.LisPack.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (lisConfigMap != null) {
|
|
|
if (StringUtil.isBlank(staticKnowledgeHISVO.getHisDetailName())) {
|
|
|
staticKnowledgeHISVO.setHisDetailName("");
|
|
@@ -652,7 +96,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 6:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> pacsConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Pacs.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Pacs.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (pacsConfigMap != null
|
|
|
&& pacsConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = pacsConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -664,7 +108,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 7:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> operationConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Operation.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Operation.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (operationConfigMap != null &&
|
|
|
operationConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = operationConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -676,7 +120,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 8:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> scaleConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Scale.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Scale.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (scaleConfigMap != null &&
|
|
|
scaleConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = scaleConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -688,7 +132,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
case 9:
|
|
|
Map<String, Map<String, Map<String, List<String>>>> nurseConfigMap
|
|
|
= mappingConfigFacade.groupByHisNameWithName(ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }),
|
|
|
- ConceptTypeEnum.Nurse.getKey(), hospitalId,StatusEnum.Enable.getKey());
|
|
|
+ ConceptTypeEnum.Nurse.getKey(), hospitalId, StatusEnum.Enable.getKey());
|
|
|
if (nurseConfigMap != null &&
|
|
|
nurseConfigMap.get(staticKnowledgeHISVO.getHisName()) != null) {
|
|
|
nameList = nurseConfigMap.get(staticKnowledgeHISVO.getHisName())
|
|
@@ -710,285 +154,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
|
|
|
return nameList;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 列表
|
|
|
- *
|
|
|
- * @param conceptInfoPageVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public IPage<ConceptInfoDTO> getPage(ConceptInfoPageVO conceptInfoPageVO) {
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- Map<Integer, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- Map<String, Integer> dicStaticTypeNameValMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
|
|
|
- if (StringUtil.isNotBlank(conceptInfoPageVO.getType())) {
|
|
|
- String typeName
|
|
|
- = convertTypeName(dicStaticTypeValNameMap.get(conceptInfoPageVO.getType()), 1, dicList);
|
|
|
- conceptInfoPageVO.setTypeName(typeName);
|
|
|
- }
|
|
|
- IPage<ConceptInfoDTO> page = super.getPage(conceptInfoPageVO);
|
|
|
- List<ConceptInfoDTO> records = page.getRecords();
|
|
|
- if (ListUtil.isNotEmpty(records)) {
|
|
|
- records.forEach(record -> {
|
|
|
- String typeName = convertTypeName(record.getType(), 2, dicList);
|
|
|
- record.setTypeName(typeName);
|
|
|
- record.setType(String.valueOf(dicStaticTypeNameValMap.get(typeName)));
|
|
|
- });
|
|
|
- }
|
|
|
- page.setRecords(records);
|
|
|
- return page;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存记录(新增or修改)
|
|
|
- *
|
|
|
- * @param conceptInfoVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Boolean saveOrUpdateRecord(ConceptInfoVO conceptInfoVO) {
|
|
|
- String userId = SysUserUtils.getCurrentPrincipleID();
|
|
|
- Date now = DateUtil.now();
|
|
|
- //术语类型映射
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- //静态知识类型
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- Map<Integer, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- //术语类型转换
|
|
|
- String typeName = convertTypeName(dicStaticTypeValNameMap.get(conceptInfoVO.getType()), 1, dicList);
|
|
|
- conceptInfoVO.setTypeName(typeName);
|
|
|
- ConceptInfo conceptInfo = new ConceptInfo();
|
|
|
-
|
|
|
- if (conceptInfoVO.getId() != null) {
|
|
|
- conceptInfo = this.getById(conceptInfoVO.getId());
|
|
|
- if (conceptInfo != null
|
|
|
- && !conceptInfo.getName().equals(conceptInfoVO.getName())) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语名称不允许修改");
|
|
|
- }
|
|
|
- } else {
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("name", conceptInfoVO.getName())
|
|
|
- .eq("type", typeName);
|
|
|
- conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
|
|
|
- //术语不存在,保存术语信息
|
|
|
- if (conceptInfo == null) {
|
|
|
- conceptInfo = new ConceptInfo();
|
|
|
- conceptInfo.setCreator(userId);
|
|
|
- conceptInfo.setGmtCreate(now);
|
|
|
- }
|
|
|
- }
|
|
|
- conceptInfo.setName(conceptInfoVO.getName());
|
|
|
- conceptInfo.setClinicalPathwayName(conceptInfoVO.getClinicalPathwayName());
|
|
|
- conceptInfo.setNoticeName(conceptInfoVO.getNoticeName());
|
|
|
- conceptInfo.setType(typeName);
|
|
|
- conceptInfo.setModifier(userId);
|
|
|
- conceptInfo.setGmtModified(now);
|
|
|
-
|
|
|
- //是否包含静态信息
|
|
|
- List<ConceptDetail> oldDetails = null;
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- if (conceptInfo.getId() != null) {
|
|
|
- conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- oldDetails = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- }
|
|
|
- if (conceptInfoVO.getId() == null
|
|
|
- && ListUtil.isNotEmpty(oldDetails)) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "静态信息已添加,不允许重复添加");
|
|
|
- }
|
|
|
- if (ListUtil.isEmpty(oldDetails)
|
|
|
- && ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
|
|
|
- //TODO 更新图谱是否有静态信息
|
|
|
- HasStaticKnowledgeVO hasStaticKnowledgeVO = new HasStaticKnowledgeVO();
|
|
|
- hasStaticKnowledgeVO.setName(conceptInfoVO.getName());
|
|
|
- hasStaticKnowledgeVO.setType(typeName);
|
|
|
- hasStaticKnowledgeVO.setHasInfo(1);
|
|
|
- RespDTO<Boolean> respDTO = cdssCoreClient.updateHasInfoStatus(hasStaticKnowledgeVO);
|
|
|
- //更新失败
|
|
|
- if (RespDTOUtil.respIsNG(respDTO)) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "图谱更新静态知识状态失败");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //删除已有静态信息
|
|
|
- if (conceptInfo.getId() != null) {
|
|
|
- conceptDetailFacade.remove(conceptDetailQueryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- //更新术语信息
|
|
|
- this.saveOrUpdate(conceptInfo);
|
|
|
-
|
|
|
- //插入新的静态信息
|
|
|
- List<ConceptDetail> conceptDetailList = Lists.newLinkedList();
|
|
|
- if (ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
|
|
|
- for (ConceptDetailVO detailVO : conceptInfoVO.getDetails()) {
|
|
|
- ConceptDetail conceptDetail = new ConceptDetail();
|
|
|
- BeanUtil.copyProperties(detailVO, conceptDetail);
|
|
|
- conceptDetail.setConceptId(conceptInfo.getId());
|
|
|
- conceptDetail.setCreator(userId);
|
|
|
- conceptDetail.setGmtCreate(now);
|
|
|
- conceptDetail.setModifier(userId);
|
|
|
- conceptDetail.setGmtModified(now);
|
|
|
- conceptDetailList.add(conceptDetail);
|
|
|
- }
|
|
|
- conceptDetailService.saveBatch(conceptDetailList);
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 启用禁用
|
|
|
- *
|
|
|
- * @param changeStatusVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Boolean changeStatus(ChangeStatusVO changeStatusVO) {
|
|
|
- String userId = SysUserUtils.getCurrentPrincipleID();
|
|
|
- Date now = DateUtil.now();
|
|
|
- //更新主表
|
|
|
- UpdateWrapper<ConceptInfo> conceptInfoUpdateWrapper = new UpdateWrapper<>();
|
|
|
- conceptInfoUpdateWrapper.eq("id", changeStatusVO.getId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("gmt_modified", now)
|
|
|
- .set("modifier", userId)
|
|
|
- .set("status", changeStatusVO.getStatus());
|
|
|
- this.update(conceptInfoUpdateWrapper);
|
|
|
- //更新明细表
|
|
|
- UpdateWrapper<ConceptDetail> conceptDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
- conceptDetailUpdateWrapper.eq("concept_id", changeStatusVO.getId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("gmt_modified", now)
|
|
|
- .set("modifier", userId);
|
|
|
- conceptDetailService.update(conceptDetailUpdateWrapper);
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 是否已存在
|
|
|
- *
|
|
|
- * @param conceptInfoVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Boolean isExist(ConceptInfoVO conceptInfoVO) {
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- //静态知识类型
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- Map<Integer, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- //术语类型转换
|
|
|
- String typeName = convertTypeName(dicStaticTypeValNameMap.get(conceptInfoVO.getType()), 1, dicList);
|
|
|
- conceptInfoVO.setTypeName(typeName);
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("name", conceptInfoVO.getName())
|
|
|
- .eq("type", typeName);
|
|
|
- ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
|
|
|
- if (conceptInfo == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId())
|
|
|
- .eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailService.list(conceptDetailQueryWrapper);
|
|
|
- if (ListUtil.isEmpty(conceptDetailList)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据术语id获取静态信息
|
|
|
- *
|
|
|
- * @param idVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public ConceptInfoDTO getRecordById(IdVO idVO) {
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- //静态知识类型
|
|
|
- List<DictionaryInfoDTO> dicStaticTypeList = dictionaryFacade.getListByGroupType(10);
|
|
|
- Map<Integer, String> dicStaticTypeValNameMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "val", "name");
|
|
|
- Map<String, Integer> dicStaticTypeNameValMap =
|
|
|
- EntityUtil.makeMapWithKeyValue(dicStaticTypeList, "name", "val");
|
|
|
- ConceptInfoDTO conceptInfoDTO = new ConceptInfoDTO();
|
|
|
- ConceptInfo conceptInfo = this.getById(idVO.getId());
|
|
|
- if (conceptInfo == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- BeanUtil.copyProperties(conceptInfo, conceptInfoDTO);
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("concept_id", idVO.getId())
|
|
|
- .orderByAsc("order_no");
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- if (ListUtil.isNotEmpty(conceptDetailList)) {
|
|
|
- List<ConceptDetailDTO> details = BeanUtil.listCopyTo(conceptDetailList, ConceptDetailDTO.class);
|
|
|
- conceptInfoDTO.setDetails(details);
|
|
|
- //启用状态、修改人、修改时间为明细的内容
|
|
|
- String typeName = convertTypeName(conceptInfoDTO.getType(), 2, dicList);
|
|
|
- conceptInfoDTO.setTypeName(typeName);
|
|
|
- conceptInfoDTO.setType(String.valueOf(dicStaticTypeNameValMap.get(typeName)));
|
|
|
- conceptInfoDTO.setModifier(conceptDetailList.get(0).getModifier());
|
|
|
- conceptInfoDTO.setGmtModified(conceptDetailList.get(0).getGmtModified());
|
|
|
- }
|
|
|
- return conceptInfoDTO;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取静态知识map Map<name_type,List<ConceptDetail>>
|
|
|
- *
|
|
|
- * @param nameList
|
|
|
- * @return
|
|
|
- */
|
|
|
- public Map<String, List<ConceptDetail>> getDetailByConcept(List<String> nameList, List<Integer> contentTypes) {
|
|
|
- Map<String, List<ConceptDetail>> retMap = new HashMap<>();
|
|
|
- List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
|
|
|
- QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("status", 1);
|
|
|
- if (ListUtil.isNotEmpty(nameList)) {
|
|
|
- conceptInfoQueryWrapper.in("name", nameList);
|
|
|
- }
|
|
|
- List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
|
|
|
- Map<Long, ConceptInfo> conceptMap = EntityUtil.makeEntityMap(conceptInfoList, "id");
|
|
|
-
|
|
|
- if (ListUtil.isNotEmpty(conceptInfoList)) {
|
|
|
- List<Long> conceptIds = conceptInfoList.stream()
|
|
|
- .map(i -> i.getId())
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
|
|
|
- conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .in("concept_id", conceptIds);
|
|
|
- if (ListUtil.isNotEmpty(contentTypes)) {
|
|
|
- conceptDetailQueryWrapper.and(sql -> {
|
|
|
- for (int i = 0; i < contentTypes.size(); i++) {
|
|
|
- if (i > 0) {
|
|
|
- sql.or();
|
|
|
- }
|
|
|
- sql.apply("find_in_set({0},content_type)", contentTypes.get(i));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
|
|
|
- Map<Long, List<ConceptDetail>> detailMap
|
|
|
- = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
|
|
|
-
|
|
|
- for (Map.Entry<Long, ConceptInfo> entry : conceptMap.entrySet()) {
|
|
|
- if (detailMap.containsKey(entry.getKey())) {
|
|
|
- retMap.put(entry.getValue().getName() + "_" + convertTypeName(entry.getValue().getType(), 2, dicList), detailMap.get(entry.getKey()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return retMap;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 批量更新静态知识标志
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean updateHasInfoStatusBatch() {
|