Selaa lähdekoodia

1、术语关联映射-非标准词包含禁用词
2、术语关联映射-国药准字匹配

zhaops 3 vuotta sitten
vanhempi
commit
5cb10dac30

+ 12 - 0
src/main/java/com/diagbot/dto/IndexBatchDTO.java

@@ -16,4 +16,16 @@ public class IndexBatchDTO {
     private String code;
     private String synonyms;
     private Integer type;
+    /**
+     * 国药准字
+     */
+    private String approval;
+    /**
+     * 药品剂型
+     */
+    private String form;
+    /**
+     * 药品剂型id
+     */
+    private Long formConceptId;
 }

+ 56 - 12
src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -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;
     }
-}
+}

+ 3 - 0
src/main/java/com/diagbot/mapper/KlConceptMapper.java

@@ -2,6 +2,7 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.GetAllForRelationDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
@@ -22,6 +23,8 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
 
     List<IndexDTO> index(MedRetrievalVO medRetrievalVO);
 
+    List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO);
+
     List<StaticKnowledgeIndexDTO> staticIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO);
 
     List<KllisDetailDTO> getLisDetaisByNames(KllisDetailVO kllisDetailVO);

+ 3 - 0
src/main/java/com/diagbot/service/KlConceptService.java

@@ -2,6 +2,7 @@ package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.GetAllForRelationDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
@@ -22,6 +23,8 @@ public interface KlConceptService extends IService<KlConcept> {
 
     List<IndexDTO> index(MedRetrievalVO medRetrievalVO);
 
+    List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO);
+
     List<StaticKnowledgeIndexDTO> staticIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO);
 
     List<KllisDetailDTO> getLisDetaisByNames(KllisDetailVO kllisDetailVO);

+ 6 - 0
src/main/java/com/diagbot/service/impl/KlConceptServiceImpl.java

@@ -3,6 +3,7 @@ package com.diagbot.service.impl;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.GetAllForRelationDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
@@ -31,6 +32,11 @@ public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept
         return baseMapper.index(medRetrievalVO);
     }
 
+    @Override
+    public List<IndexBatchDTO> indexByApproval(IndexByApprovalVO indexByApprovalVO){
+        return baseMapper.indexByApproval(indexByApprovalVO);
+    }
+
     @Override
     public List<StaticKnowledgeIndexDTO> staticIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
         return baseMapper.staticIndex(staticKnowledgeIndexVO);

+ 18 - 0
src/main/java/com/diagbot/vo/IndexByApprovalVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/8/24 15:49
+ */
+@Data
+public class IndexByApprovalVO {
+    /**
+     * 国药准字列表
+     */
+    private List<String> approvalList;
+}

+ 13 - 0
src/main/java/com/diagbot/web/RetrievalController.java

@@ -9,6 +9,7 @@ import com.diagbot.facade.KlConceptFacade;
 import com.diagbot.facade.MedRetrievalFacade;
 import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.FilterVO;
+import com.diagbot.vo.IndexByApprovalVO;
 import com.diagbot.vo.KllisDetailVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
@@ -85,4 +86,16 @@ public class RetrievalController {
         List<IndexBatchDTO> data = klConceptFacade.filter(filterVO);
         return RespDTO.onSuc(data);
     }
+
+    /**
+     * @param indexByApprovalVO
+     * @return
+     */
+    @ApiOperation(value = "术语关联医学术语检索[zhaops]",
+            notes = "approvalList: 国药准字列表<br>")
+    @PostMapping("/indexByApproval")
+    public RespDTO<List<IndexBatchDTO>> indexByApproval(@Valid @RequestBody IndexByApprovalVO indexByApprovalVO) {
+        List<IndexBatchDTO> data = klConceptFacade.indexByApproval(indexByApprovalVO);
+        return RespDTO.onSuc(data);
+    }
 }

+ 40 - 0
src/main/resources/mapper/KlConceptMapper.xml

@@ -833,4 +833,44 @@
         LIMIT 100
     </select>
 
+    <select id="indexByApproval" resultType="com.diagbot.dto.IndexBatchDTO">
+        SELECT
+        t1.approvalNum,
+        t1.approval,
+        t1.id,
+        t1.NAME,
+        t1.regName,
+        t1.form,
+        t2.id AS formConceptId
+        FROM
+        (
+        SELECT
+        REPLACE ( a.approval, '国药准字', '' )  AS approvalNum,
+        a.approval AS approval,
+        c.id AS id,
+        c.lib_name AS NAME,
+        a.NAME AS regName,
+        a.form AS form
+        FROM
+        kl_drug_register a,
+        `kl_drug_mapping` b,
+        kl_concept c
+        WHERE
+        a.id = b.register_id
+        AND b.drug_concept = c.id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND c.STATUS = 1
+        <if test="approvalList != null and approvalList.size > 0">
+            <foreach item="approval" collection="approvalList" open="and(" separator="or" close=")">
+                REPLACE ( a.approval, '国药准字', '' )  =  #{approval}
+            </foreach>
+        </if>
+        ) t1
+        LEFT JOIN ( SELECT * FROM kl_concept WHERE is_deleted = 'N' AND STATUS = 1 AND lib_type = 102 ) t2 ON t1.form = t2.lib_name
+        GROUP BY
+        t1.approval
+    </select>
+
 </mapper>