Browse Source

1、术语校验

zhaops 4 years ago
parent
commit
72e79e5912

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

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/7 10:27
+ */
+@Getter
+@Setter
+public class IndexBatchDTO {
+    private Long id;
+    private String name;
+    private String code;
+}

+ 146 - 0
src/main/java/com/diagbot/entity/TcmDisease.java

@@ -0,0 +1,146 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 中医疾病表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+@TableName("kl_tcm_disease")
+public class TcmDisease implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "TcmDisease{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", code=" + code +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 146 - 0
src/main/java/com/diagbot/entity/TcmSyndrome.java

@@ -0,0 +1,146 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 中医证候表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+@TableName("kl_tcm_syndrome")
+public class TcmSyndrome implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "TcmSyndrome{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", code=" + code +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 57 - 3
src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -2,8 +2,12 @@ package com.diagbot.facade;
 
 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.KlConcept;
+import com.diagbot.entity.KlDisease;
+import com.diagbot.entity.TcmDisease;
+import com.diagbot.entity.TcmSyndrome;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.StatusEnum;
@@ -16,6 +20,7 @@ import com.diagbot.vo.KllisDetailVO;
 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;
@@ -32,17 +37,24 @@ import java.util.stream.Collectors;
 @Component
 public class KlConceptFacade extends KlConceptServiceImpl {
 
+    @Autowired
+    private KlDiseaseFacade klDiseaseFacade;
+    @Autowired
+    private TcmDiseaseFacade tcmDiseaseFacade;
+    @Autowired
+    private TcmSyndromeFacade tcmSyndromeFacade;
+
     /**
      * 批量校验标准术语
      *
      * @param conceptVO
      * @return
      */
-    public List<String> getConceptNames(ConceptVO conceptVO) {
+    public List<IndexBatchDTO> getConceptNames(ConceptVO conceptVO) {
         if (ListUtil.isEmpty(conceptVO.getNames())) {
             return new ArrayList<>();
         }
-        List<String> retList = Lists.newLinkedList();
+        List<IndexBatchDTO> retList = Lists.newLinkedList();
         //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
         Integer type = convertType(conceptVO.getType());
 
@@ -58,7 +70,49 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         List<KlConcept> concepts = this.list(queryWrapper);
 
         if (ListUtil.isNotEmpty(concepts)) {
-            retList = concepts.stream().map(i -> i.getLibName()).distinct().collect(Collectors.toList());
+            for (KlConcept concept : concepts) {
+                IndexBatchDTO dto = new IndexBatchDTO();
+                dto.setId(concept.getId());
+                dto.setName(concept.getLibName());
+                retList.add(dto);
+            }
+        }
+
+        if (ListUtil.isEmpty(retList)) {
+            return retList;
+        }
+        List<Long> conceptIds = retList.stream().map(IndexBatchDTO::getId).collect(Collectors.toList());
+
+        if (type.equals(LexiconEnum.Disease.getKey())) {
+            List<KlDisease> diseases = klDiseaseFacade.list(new QueryWrapper<KlDisease>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("concept_id", conceptIds));
+            if (ListUtil.isNotEmpty(diseases)) {
+                Map<Long, KlDisease> idMap = diseases.stream().collect(Collectors.toMap(KlDisease::getConceptId, v -> v));
+                for (IndexBatchDTO dto : retList) {
+                    dto.setCode(idMap.get(dto.getId()).getIcd10Code());
+                }
+            }
+        } else if (type.equals(LexiconEnum.Tcmdisease.getKey())) {
+            List<TcmDisease> tcmDiseases = tcmDiseaseFacade.list(new QueryWrapper<TcmDisease>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("concept_id", conceptIds));
+            if (ListUtil.isNotEmpty(tcmDiseases)) {
+                Map<Long, TcmDisease> idMap = tcmDiseases.stream().collect(Collectors.toMap(TcmDisease::getConceptId, v -> v));
+                for (IndexBatchDTO dto : retList) {
+                    dto.setCode(idMap.get(dto.getId()).getCode());
+                }
+            }
+        } else if (type.equals(LexiconEnum.Tcmsyndrome.getKey())) {
+            List<TcmSyndrome> tcmSyndromes = tcmSyndromeFacade.list(new QueryWrapper<TcmSyndrome>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("concept_id", conceptIds));
+            if (ListUtil.isNotEmpty(tcmSyndromes)) {
+                Map<Long, TcmSyndrome> idMap = tcmSyndromes.stream().collect(Collectors.toMap(TcmSyndrome::getConceptId, v -> v));
+                for (IndexBatchDTO dto : retList) {
+                    dto.setCode(idMap.get(dto.getId()).getCode());
+                }
+            }
         }
 
         return retList;

+ 13 - 0
src/main/java/com/diagbot/facade/TcmDiseaseFacade.java

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.TcmDiseaseServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/7 11:08
+ */
+@Component
+public class TcmDiseaseFacade extends TcmDiseaseServiceImpl {
+}

+ 13 - 0
src/main/java/com/diagbot/facade/TcmSyndromeFacade.java

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.TcmSyndromeServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/7 11:08
+ */
+@Component
+public class TcmSyndromeFacade extends TcmSyndromeServiceImpl {
+}

+ 16 - 0
src/main/java/com/diagbot/mapper/TcmDiseaseMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.TcmDisease;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 中医疾病表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+public interface TcmDiseaseMapper extends BaseMapper<TcmDisease> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/mapper/TcmSyndromeMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.TcmSyndrome;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 中医证候表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+public interface TcmSyndromeMapper extends BaseMapper<TcmSyndrome> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/TcmDiseaseService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.TcmDisease;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 中医疾病表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+public interface TcmDiseaseService extends IService<TcmDisease> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/TcmSyndromeService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.TcmSyndrome;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 中医证候表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+public interface TcmSyndromeService extends IService<TcmSyndrome> {
+
+}

+ 20 - 0
src/main/java/com/diagbot/service/impl/TcmDiseaseServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.TcmDisease;
+import com.diagbot.mapper.TcmDiseaseMapper;
+import com.diagbot.service.TcmDiseaseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 中医疾病表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+@Service
+public class TcmDiseaseServiceImpl extends ServiceImpl<TcmDiseaseMapper, TcmDisease> implements TcmDiseaseService {
+
+}

+ 20 - 0
src/main/java/com/diagbot/service/impl/TcmSyndromeServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.TcmSyndrome;
+import com.diagbot.mapper.TcmSyndromeMapper;
+import com.diagbot.service.TcmSyndromeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 中医证候表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-06-07
+ */
+@Service
+public class TcmSyndromeServiceImpl extends ServiceImpl<TcmSyndromeMapper, TcmSyndrome> implements TcmSyndromeService {
+
+}

+ 4 - 3
src/main/java/com/diagbot/web/RetrievalController.java

@@ -1,5 +1,6 @@
 package com.diagbot.web;
 
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
@@ -59,11 +60,11 @@ public class RetrievalController {
     }
 
     @ApiOperation(value = "术语批量查询[zhaops]",
-            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理<br>" +
+            notes = "type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候<br>" +
                     "names: 术语列表<br>")
     @PostMapping("/getConceptNames")
-    public RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
-        List<String> data = klConceptFacade.getConceptNames(conceptVO);
+    public RespDTO<List<IndexBatchDTO>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
+        List<IndexBatchDTO> data = klConceptFacade.getConceptNames(conceptVO);
         return RespDTO.onSuc(data);
     }
 

+ 18 - 0
src/main/resources/mapper/TcmDiseaseMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.TcmDiseaseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.TcmDisease">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="concept_id" property="conceptId" />
+        <result column="code" property="code" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>

+ 18 - 0
src/main/resources/mapper/TcmSyndromeMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.TcmSyndromeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.TcmSyndrome">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="concept_id" property="conceptId" />
+        <result column="code" property="code" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>