|
@@ -4,22 +4,39 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.GetAllForRelationDTO;
|
|
|
import com.diagbot.dto.IndexBatchDTO;
|
|
|
import com.diagbot.dto.KllisDetailDTO;
|
|
|
-import com.diagbot.entity.*;
|
|
|
-import com.diagbot.enums.*;
|
|
|
+import com.diagbot.entity.KlConcept;
|
|
|
+import com.diagbot.entity.KlDisease;
|
|
|
+import com.diagbot.entity.KlLibraryInfo;
|
|
|
+import com.diagbot.entity.KlOperation;
|
|
|
+import com.diagbot.entity.TcmDisease;
|
|
|
+import com.diagbot.entity.TcmSyndrome;
|
|
|
+import com.diagbot.enums.ConceptTypeEnum;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.LexiconEnum;
|
|
|
+import com.diagbot.enums.MatchSourceEnum;
|
|
|
+import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
-import com.diagbot.vo.*;
|
|
|
+import com.diagbot.vo.ConceptVO;
|
|
|
+import com.diagbot.vo.FilterVO;
|
|
|
+import com.diagbot.vo.IndexByApprovalVO;
|
|
|
+import com.diagbot.vo.KllisDetailVO;
|
|
|
+import com.diagbot.vo.SearchCollectionConceptVO;
|
|
|
+import com.diagbot.vo.SearchConceptVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -58,7 +75,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
//根据id检索
|
|
|
List<KlConcept> concepts = this.list(new QueryWrapper<KlConcept>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- //.eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
.in("id", conceptVO.getIds()));
|
|
|
for (KlConcept concept : concepts) {
|
|
|
IndexBatchDTO dto = new IndexBatchDTO();
|
|
@@ -69,8 +86,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
}
|
|
|
} else if (conceptVO.getSource().equals(MatchSourceEnum.StandWord.getKey())) {
|
|
|
QueryWrapper<KlConcept> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- //.eq("status", StatusEnum.Enable.getKey());
|
|
|
+ queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey());
|
|
|
if (ListUtil.isNotEmpty(conceptVO.getNames())) {
|
|
|
queryWrapper.in("lib_name", conceptVO.getNames());
|
|
|
}
|
|
@@ -114,7 +131,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
= libratyInfos.stream().map(KlLibraryInfo::getConceptId).collect(Collectors.toList());
|
|
|
List<KlConcept> synonymsRelatedConcepts = this.list(new QueryWrapper<KlConcept>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- //.eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
.in("id", synonymsRelatedConceptIds));
|
|
|
Map<Long, KlConcept> conceptMap
|
|
|
= synonymsRelatedConcepts.stream().collect(Collectors.toMap(KlConcept::getId, v -> v));
|
|
@@ -183,7 +200,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
}
|
|
|
List<KlConcept> concepts = this.list(new QueryWrapper<KlConcept>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- //.eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
.in("id", conceptIds));
|
|
|
Map<Long, KlConcept> conceptMap
|
|
|
= concepts.stream().collect(Collectors.toMap(KlConcept::getId, v -> v));
|
|
@@ -272,7 +289,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
List<IndexBatchDTO> retList = Lists.newArrayList();
|
|
|
List<KlConcept> klConcepts = this.list(new QueryWrapper<KlConcept>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- //.eq("status", StatusEnum.Enable.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey())
|
|
|
.like("lib_name", filterVO.getInputStr()));
|
|
|
for (KlConcept concept : klConcepts) {
|
|
|
IndexBatchDTO indexBatchDTO = new IndexBatchDTO();
|
|
@@ -287,6 +304,33 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 国药准字校验
|
|
|
+ * @param indexByApprovalVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO) {
|
|
|
+ if (ListUtil.isEmpty(indexByApprovalVO.getApprovalList())) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ //国药准字取字母+数字编码
|
|
|
+ String regex = "[a-zA-Z]+\\d{8}";
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ List<String> approvals = Lists.newArrayList();
|
|
|
+ for (String str : indexByApprovalVO.getApprovalList()) {
|
|
|
+ if (StringUtils.isBlank(str)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Matcher matcher = pattern.matcher(str);
|
|
|
+ if (matcher.find()) {
|
|
|
+ approvals.add(matcher.group());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ indexByApprovalVO.setApprovalList(approvals);
|
|
|
+ return super.indexByApproval(indexByApprovalVO);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 类型互转
|
|
@@ -414,7 +458,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
.eq("lib_type", libType)
|
|
|
.eq("status", StatusEnum.Enable.getKey())
|
|
|
.notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds)
|
|
|
- .last("limit 100"));
|
|
|
+ .last("limit 100"));
|
|
|
if (ListUtil.isNotEmpty(conceptList)) {
|
|
|
getAllForRelationDTOS = conceptList.stream().map(x -> {
|
|
|
GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
|
|
@@ -439,8 +483,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
|
|
|
|
|
|
public List<GetAllForRelationDTO> searchCollectionConceptFac(SearchCollectionConceptVO searchCollectionConceptVO) {
|
|
|
- searchCollectionConceptVO.setNames(searchCollectionConceptVO.getNames().stream().filter(x ->StringUtil.isNotBlank(x)).collect(Collectors.toList()));
|
|
|
+ searchCollectionConceptVO.setNames(searchCollectionConceptVO.getNames().stream().filter(x -> StringUtil.isNotBlank(x)).collect(Collectors.toList()));
|
|
|
List<GetAllForRelationDTO> getAllForRelationDTOS = this.searchCollectionConcept(searchCollectionConceptVO);
|
|
|
return getAllForRelationDTOS;
|
|
|
}
|
|
|
-}
|
|
|
+}
|