浏览代码

Merge remote-tracking branch 'origin/dev/mapping20210603' into dev/mapping20210603

# Conflicts:
#	cdssman-service/src/main/java/com/diagbot/dto/IndexBatchDTO.java
#	cdssman-service/src/main/java/com/diagbot/enums/ConceptTypeEnum.java
#	cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/NurseConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/ScaleConfigFacade.java
#	cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.java
zhaops 4 年之前
父节点
当前提交
800dcd3612
共有 56 个文件被更改,包括 3500 次插入70 次删除
  1. 8 2
      cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java
  2. 2 0
      cdssman-service/src/main/java/com/diagbot/dto/ConceptMappingDTO.java
  3. 18 0
      cdssman-service/src/main/java/com/diagbot/dto/ExportConceptAllDTO.java
  4. 27 0
      cdssman-service/src/main/java/com/diagbot/dto/ExportConceptModeDTO.java
  5. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalConceptDTO.java
  6. 32 6
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java
  7. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java
  8. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java
  9. 13 7
      cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java
  10. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java
  11. 14 2
      cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java
  12. 14 2
      cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java
  13. 9 0
      cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java
  14. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java
  15. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java
  16. 9 0
      cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java
  17. 208 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java
  18. 208 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java
  19. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java
  20. 24 23
      cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java
  21. 46 1
      cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java
  22. 5 0
      cdssman-service/src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java
  23. 2 1
      cdssman-service/src/main/java/com/diagbot/facade/PlanFacade.java
  24. 597 0
      cdssman-service/src/main/java/com/diagbot/facade/TcmdiseaseConfigFacade.java
  25. 597 0
      cdssman-service/src/main/java/com/diagbot/facade/TcmsyndromeConfigFacade.java
  26. 406 0
      cdssman-service/src/main/java/com/diagbot/facade/TermImportFacade.java
  27. 3 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlLibraryInfoMapper.java
  28. 35 0
      cdssman-service/src/main/java/com/diagbot/mapper/TcmdiseaseConfigMapper.java
  29. 35 0
      cdssman-service/src/main/java/com/diagbot/mapper/TcmsyndromeConfigMapper.java
  30. 2 0
      cdssman-service/src/main/java/com/diagbot/service/KlLibraryInfoService.java
  31. 35 0
      cdssman-service/src/main/java/com/diagbot/service/TcmdiseaseConfigService.java
  32. 35 0
      cdssman-service/src/main/java/com/diagbot/service/TcmsyndromeConfigService.java
  33. 7 0
      cdssman-service/src/main/java/com/diagbot/service/impl/KlLibraryInfoServiceImpl.java
  34. 46 0
      cdssman-service/src/main/java/com/diagbot/service/impl/TcmdiseaseConfigServiceImpl.java
  35. 45 0
      cdssman-service/src/main/java/com/diagbot/service/impl/TcmsyndromeConfigServiceImpl.java
  36. 57 0
      cdssman-service/src/main/java/com/diagbot/util/ExcelUtils.java
  37. 49 0
      cdssman-service/src/main/java/com/diagbot/vo/ImportConceptAllVO.java
  38. 25 0
      cdssman-service/src/main/java/com/diagbot/vo/ImportConceptSubVO.java
  39. 18 0
      cdssman-service/src/main/java/com/diagbot/vo/TcmdiseaseConfigListVO.java
  40. 38 0
      cdssman-service/src/main/java/com/diagbot/vo/TcmdiseaseConfigPageVO.java
  41. 18 0
      cdssman-service/src/main/java/com/diagbot/vo/TcmsyndromeConfigListVO.java
  42. 38 0
      cdssman-service/src/main/java/com/diagbot/vo/TcmsyndromeConfigPageVO.java
  43. 27 0
      cdssman-service/src/main/java/com/diagbot/vo/TermExcelVO.java
  44. 16 0
      cdssman-service/src/main/java/com/diagbot/vo/TermImportExcalVO.java
  45. 219 0
      cdssman-service/src/main/java/com/diagbot/web/TcmdiseaseConfigController.java
  46. 219 0
      cdssman-service/src/main/java/com/diagbot/web/TcmsyndromeConfigController.java
  47. 48 0
      cdssman-service/src/main/java/com/diagbot/web/TermImportController.java
  48. 5 1
      cdssman-service/src/main/resources/mapper/HospitalInfoMapper.xml
  49. 16 12
      cdssman-service/src/main/resources/mapper/KlLibraryInfoMapper.xml
  50. 55 0
      cdssman-service/src/main/resources/mapper/TcmdiseaseConfigMapper.xml
  51. 55 0
      cdssman-service/src/main/resources/mapper/TcmsyndromeConfigMapper.xml
  52. 3 1
      config-server/src/main/resources/shared/cdssman-service-dev.yml
  53. 4 1
      config-server/src/main/resources/shared/cdssman-service-local.yml
  54. 3 1
      config-server/src/main/resources/shared/cdssman-service-pre.yml
  55. 3 1
      config-server/src/main/resources/shared/cdssman-service-pro.yml
  56. 3 1
      config-server/src/main/resources/shared/cdssman-service-test.yml

+ 8 - 2
cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java

@@ -115,12 +115,17 @@ public class CallIndicationAggregate {
             });
 
             RespDTO<IndicationDTO> respDTO = cdssCoreClient.indication(indicationPushVO);
+            Integer callCount = 0;
+            while (callCount <= 3 && RespDTOUtil.respIsNG(respDTO)) {
+                respDTO = cdssCoreClient.indication(indicationPushVO);
+                callCount++;
+            }
             if (RespDTOUtil.respIsOK(respDTO)) {
                 IndicationDTO data = respDTO.data;
                 //出参
-                entry.getValue().forEach(result -> {
+                for (ResultRule result : entry.getValue()) {
                     result.setOutputParams(FastJsonUtils.getBeanToJson(respDTO.data));
-                });
+                }
                 List<BillMsg> msgList = Lists.newLinkedList();
                 switch (ruleType) {
                     case 1:
@@ -187,6 +192,7 @@ public class CallIndicationAggregate {
             } else {
                 for (ResultRule result : entry.getValue()) {
                     result.setInputParams(FastJsonUtils.getBeanToJson(indicationPushVO));
+                    result.setOutputParams(FastJsonUtils.getBeanToJson(respDTO));
                     result.setSuccess(0);
                     result.setMessage("远程调用推理接口失败");
                     retList.add(result);

+ 2 - 0
cdssman-service/src/main/java/com/diagbot/dto/ConceptMappingDTO.java

@@ -23,4 +23,6 @@ public class ConceptMappingDTO {
     private Integer transfusionNum = 0;
     private Integer scaleNum = 0;
     private Integer nurseNum = 0;
+    private Integer tcmdiseaseNum = 0;
+    private Integer tcmsyndromeNum = 0;
 }

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/dto/ExportConceptAllDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-01 17:21
+ */
+@Setter
+@Getter
+public class ExportConceptAllDTO extends ExportConceptModeDTO {
+
+    @Excel(name = "错误信息", orderNum = "7", isImportField = "true")
+    private String msg;
+}

+ 27 - 0
cdssman-service/src/main/java/com/diagbot/dto/ExportConceptModeDTO.java

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-08 11:24
+ */
+@Setter
+@Getter
+public class ExportConceptModeDTO {
+    @Excel(name = "医学标准术语",width = 40, orderNum = "1", isImportField = "true" )
+    private String libName;
+    @Excel(name = "同义词",width = 40, orderNum = "2", isImportField = "true" )
+    private String synonymName;
+    @Excel(name = "类型",orderNum = "3", isImportField = "true" )
+    private String typeName;
+    @Excel(name = "性别", mergeRely = {1,2,3},orderNum = "4", isImportField = "true" )
+    private Integer sexType;
+    @Excel(name = "最小年龄", orderNum = "5", isImportField = "true" )
+    private Double minAge;
+    @Excel(name = "最大年龄", orderNum = "6", isImportField = "true" )
+    private Double maxAge;
+}

+ 1 - 0
cdssman-service/src/main/java/com/diagbot/dto/RetrievalConceptDTO.java

@@ -13,4 +13,5 @@ import lombok.Setter;
 public class RetrievalConceptDTO {
     private Long id;
     private String name;
+    private String code;
 }

+ 32 - 6
cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -14,7 +14,7 @@ import java.util.List;
 @Setter
 public class RetrievalDTO {
     /**
-     * 化验大项 辅检 诊断 药品 手术或操作 科室 输血 量表 护理
+     * 化验大项 辅检 诊断 药品 手术或操作 科室 输血 症状 体征 量表 护理 中医诊断 中医证候 麻醉 药品剂型
      */
     private List<RetrievalConceptDTO> nameList;
     /**
@@ -28,15 +28,15 @@ public class RetrievalDTO {
     *//**
      * 诊断
      *//*
-    private List<DiseaseInfoDTO> diseaseNames;
+    private List<RetrievalConceptDTO> diseaseNames;
     *//**
      * 药品
      *//*
-    private List<DrugInfoDTO> drugNames;
+    private List<RetrievalConceptDTO> drugNames;
     *//**
      * 手术或操作
      *//*
-    private List<OperationInfoDTO> operationNames;
+    private List<RetrievalConceptDTO> operationNames;
     *//**
      * 科室
      *//*
@@ -45,12 +45,38 @@ public class RetrievalDTO {
      * 输血
      *//*
     private List<RetrievalConceptDTO> transfusionNames;
+    *//**
+     * 症状
+     *//*
+    private List<RetrievalConceptDTO> symptomNames;
+    *//**
+     * 体征
+     *//*
+    private List<RetrievalConceptDTO> vitalNames;
     *//**
      * 量表
      *//*
-    private List<ScaleInfoDTO> scalenames;
+    private List<RetrievalConceptDTO> scalenames;
     *//**
      * 护理
      *//*
-    private List<NurseInfoDTO> nursenames;*/
+    private List<RetrievalConceptDTO> nursenames;
+    *//**
+     * 中医诊断
+     *//*
+    private List<RetrievalConceptDTO> tcmdiseaseNames;
+    *//**
+     * 中医证候
+     *//*
+    private List<RetrievalConceptDTO> tcmsyndromeNames;
+    *//**
+     * 麻醉
+     *//*
+    private List<RetrievalConceptDTO> anesthesiaInfonames;
+
+    *//**
+     * 药品剂型
+     *//*
+    private List<RetrievalConceptDTO> drugDosage;*/
+
 }

+ 23 - 0
cdssman-service/src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/13 15:37
+ */
+@Getter
+@Setter
+public class TcmdiseaseInfoDTO {
+    /**
+     * 疾病名称
+     */
+    private String name;
+
+    /**
+     * 编码
+     */
+    private String code;
+}

+ 23 - 0
cdssman-service/src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/13 15:43
+ */
+@Getter
+@Setter
+public class TcmsyndromeInfoDTO {
+    /**
+     * 疾病名称
+     */
+    private String name;
+
+    /**
+     * 编码
+     */
+    private String code;
+}

+ 13 - 7
cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java

@@ -4,16 +4,12 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import org.bouncycastle.math.ec.custom.sec.SecT113Field;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
-import java.util.function.Predicate;
 
 /**
  * <p>
@@ -197,10 +193,12 @@ public class DeptConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DeptConfig deptConfig = (DeptConfig) o;
         return Objects.equals(id, deptConfig.id)
                 && Objects.equals(isDeleted, deptConfig.isDeleted)
@@ -215,4 +213,12 @@ public class DeptConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(DeptConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 13 - 2
cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -177,10 +178,12 @@ public class DiseaseConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DiseaseConfig diseaseConfig = (DiseaseConfig) o;
         return Objects.equals(id, diseaseConfig.id)
                 && Objects.equals(isDeleted, diseaseConfig.isDeleted)
@@ -194,4 +197,12 @@ public class DiseaseConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, icdCode);
     }
+
+    public static boolean nonNull(DiseaseConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.icdCode)));
+    }
 }

+ 14 - 2
cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -197,10 +198,12 @@ public class DrugConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DrugConfig drugConfig = (DrugConfig) o;
         return Objects.equals(id, drugConfig.id)
                 && Objects.equals(isDeleted, drugConfig.isDeleted)
@@ -215,4 +218,13 @@ public class DrugConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, form, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(DrugConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)
+                && StringUtil.isBlank(o.form)));
+    }
 }

+ 14 - 2
cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
@@ -197,10 +198,12 @@ public class LisConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         LisConfig lisConfig = (LisConfig) o;
         return Objects.equals(id, lisConfig.id)
                 && Objects.equals(isDeleted, lisConfig.isDeleted)
@@ -215,4 +218,13 @@ public class LisConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, hisDetailName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(LisConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.hisDetailName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 9 - 0
cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -195,4 +196,12 @@ public class NurseConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(NurseConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 13 - 2
cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -177,10 +178,12 @@ public class OperationConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         OperationConfig operationConfig = (OperationConfig) o;
         return Objects.equals(id, operationConfig.id)
                 && Objects.equals(isDeleted, operationConfig.isDeleted)
@@ -194,4 +197,12 @@ public class OperationConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(OperationConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 13 - 2
cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -177,10 +178,12 @@ public class PacsConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         PacsConfig pacsConfig = (PacsConfig) o;
         return Objects.equals(id, pacsConfig.id)
                 && Objects.equals(isDeleted, pacsConfig.isDeleted)
@@ -194,4 +197,12 @@ public class PacsConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(PacsConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 9 - 0
cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -195,4 +196,12 @@ public class ScaleConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(ScaleConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 208 - 0
cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java

@@ -0,0 +1,208 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 中医疾病映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@TableName("tran_tcmdisease_config")
+public class TcmdiseaseConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name = "中医疾病名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院中医疾病名称")
+    private String hisName;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准中医疾病名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准中医疾病名称")
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    @Excel(name = "中医疾病代码", width = 40, orderNum = "2", isImportField = "true")
+    private String uniqueCode;
+
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date 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 getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Long hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+
+    public String getHisName() {
+        return hisName;
+    }
+
+    public void setHisName(String hisName) {
+        this.hisName = hisName;
+    }
+
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+
+    public String getUniqueCode() {
+        return uniqueCode;
+    }
+
+    public void setUniqueCode(String uniqueCode) {
+        this.uniqueCode = uniqueCode;
+    }
+
+    @Override
+    public String toString() {
+        return "TcmdiseaseConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", uniqueCode=" + uniqueCode +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        TcmdiseaseConfig tcmdiseaseConfig = (TcmdiseaseConfig) o;
+        return Objects.equals(id, tcmdiseaseConfig.id)
+                && Objects.equals(isDeleted, tcmdiseaseConfig.isDeleted)
+                && Objects.equals(hospitalId, tcmdiseaseConfig.hospitalId)
+                && Objects.equals(hisName, tcmdiseaseConfig.hisName)
+                && Objects.equals(uniqueName, tcmdiseaseConfig.uniqueName)
+                && Objects.equals(uniqueCode, tcmdiseaseConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+    }
+
+    public static boolean nonNull(TcmdiseaseConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
+}

+ 208 - 0
cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java

@@ -0,0 +1,208 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 中医证候映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@TableName("tran_tcmsyndrome_config")
+public class TcmsyndromeConfig implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name = "医院中医证候名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院中医证候名称")
+    private String hisName;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准中医证候名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准中医证候名称")
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    @Excel(name = "中医证候代码", width = 40, orderNum = "2", isImportField = "true")
+    private String uniqueCode;
+
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date 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 getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Long hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+
+    public String getHisName() {
+        return hisName;
+    }
+
+    public void setHisName(String hisName) {
+        this.hisName = hisName;
+    }
+
+    public String getUniqueName() {
+        return uniqueName;
+    }
+
+    public void setUniqueName(String uniqueName) {
+        this.uniqueName = uniqueName;
+    }
+
+    public String getUniqueCode() {
+        return uniqueCode;
+    }
+
+    public void setUniqueCode(String uniqueCode) {
+        this.uniqueCode = uniqueCode;
+    }
+
+    @Override
+    public String toString() {
+        return "TcmsyndromeConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", uniqueCode=" + uniqueCode +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        TcmsyndromeConfig tcmsyndromeConfig = (TcmsyndromeConfig) o;
+        return Objects.equals(id, tcmsyndromeConfig.id)
+                && Objects.equals(isDeleted, tcmsyndromeConfig.isDeleted)
+                && Objects.equals(hospitalId, tcmsyndromeConfig.hospitalId)
+                && Objects.equals(hisName, tcmsyndromeConfig.hisName)
+                && Objects.equals(uniqueName, tcmsyndromeConfig.uniqueName)
+                && Objects.equals(uniqueCode, tcmsyndromeConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+    }
+
+    public static boolean nonNull(TcmsyndromeConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
+}

+ 13 - 2
cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java

@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -177,10 +178,12 @@ public class TransfusionConfig implements Serializable {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         TransfusionConfig transfusionConfig = (TransfusionConfig) o;
         return Objects.equals(id, transfusionConfig.id)
                 && Objects.equals(isDeleted, transfusionConfig.isDeleted)
@@ -194,4 +197,12 @@ public class TransfusionConfig implements Serializable {
     public int hashCode() {
         return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
+
+    public static boolean nonNull(TransfusionConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.uniqueCode)));
+    }
 }

+ 24 - 23
cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DeptConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -271,15 +272,14 @@ public class DeptConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         deptConfigList = deptConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getHisCode())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(DeptConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(deptConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
-
+        deptConfigList.forEach(deptConfig -> {
+            deptConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < deptConfigList.size(); i++) {
             if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
@@ -310,25 +310,26 @@ public class DeptConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        deptConfigList.forEach(deptConfig -> {
-            deptConfig.setHospitalId(hospitalId);
-            deptConfig.setModifier(userId);
-            deptConfig.setGmtModified(now);
-            if (deptConfig.getId() == null) {
-                if (configMap.containsKey(deptConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            deptConfigList.forEach(deptConfig -> {
+                deptConfig.setHospitalId(hospitalId);
+                deptConfig.setModifier(userId);
+                deptConfig.setGmtModified(now);
+                if (deptConfig.getId() == null) {
+                    if (configMap.containsKey(deptConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
+                    }
+                    deptConfig.setCreator(userId);
+                    deptConfig.setGmtCreate(now);
                 }
-                deptConfig.setCreator(userId);
-                deptConfig.setGmtCreate(now);
-            }
-            if (deptConfig.getIsDeleted() == null) {
-                deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
+                if (deptConfig.getIsDeleted() == null) {
+                    deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
 
         //标准术语校验
        /* List<String> errorNumList = Lists.newLinkedList();

+ 46 - 1
cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java

@@ -9,9 +9,13 @@ import com.diagbot.entity.DiseaseConfig;
 import com.diagbot.entity.DrugConfig;
 import com.diagbot.entity.HospitalInfo;
 import com.diagbot.entity.LisConfig;
+import com.diagbot.entity.NurseConfig;
 import com.diagbot.entity.OperationConfig;
 import com.diagbot.entity.PacsConfig;
 import com.diagbot.entity.Plan;
+import com.diagbot.entity.ScaleConfig;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.entity.TcmsyndromeConfig;
 import com.diagbot.entity.TransfusionConfig;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
@@ -21,8 +25,12 @@ import com.diagbot.service.DiseaseConfigService;
 import com.diagbot.service.DrugConfigService;
 import com.diagbot.service.HospitalInfoService;
 import com.diagbot.service.LisConfigService;
+import com.diagbot.service.NurseConfigService;
 import com.diagbot.service.OperationConfigService;
 import com.diagbot.service.PacsConfigService;
+import com.diagbot.service.ScaleConfigService;
+import com.diagbot.service.TcmdiseaseConfigService;
+import com.diagbot.service.TcmsyndromeConfigService;
 import com.diagbot.service.TransfusionConfigService;
 import com.diagbot.service.impl.HospitalInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
@@ -72,6 +80,14 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
     @Autowired
     private TransfusionConfigService transfusionConfigService;
     @Autowired
+    private ScaleConfigService scaleConfigService;
+    @Autowired
+    private NurseConfigService nurseConfigService;
+    @Autowired
+    private TcmdiseaseConfigService tcmdiseaseConfigService;
+    @Autowired
+    private TcmsyndromeConfigService tcmsyndromeConfigService;
+    @Autowired
     private PlanFacade planFacade;
 
     public List<HospitalInfoDTO> getHospitalInfo() {
@@ -232,6 +248,34 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
         if (ListUtil.isNotEmpty(transfusionConfigList)) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
         }
+        List<ScaleConfig> scaleConfigList
+                = scaleConfigService.list(new QueryWrapper<ScaleConfig>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", idVO.getId()));
+        if (ListUtil.isNotEmpty(scaleConfigList)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
+        }
+        List<NurseConfig> nurseConfigList
+                = nurseConfigService.list(new QueryWrapper<NurseConfig>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", idVO.getId()));
+        if (ListUtil.isNotEmpty(nurseConfigList)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
+        }
+        List<TcmdiseaseConfig> tcmdiseaseConfigList
+                = tcmdiseaseConfigService.list(new QueryWrapper<TcmdiseaseConfig>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", idVO.getId()));
+        if (ListUtil.isNotEmpty(tcmdiseaseConfigList)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
+        }
+        List<TcmsyndromeConfig> tcmsyndromeConfigList
+                = tcmsyndromeConfigService.list(new QueryWrapper<TcmsyndromeConfig>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", idVO.getId()));
+        if (ListUtil.isNotEmpty(tcmsyndromeConfigList)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
+        }
         List<Plan> planList
                 = planFacade.list(new QueryWrapper<Plan>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -281,6 +325,7 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
      * @param hospitalInfoPageVO
      * @return
      */
+    @Override
     public IPage<DiseaseConfig> getPage(HospitalInfoPageVO hospitalInfoPageVO) {
         return hospitalInfoService.getPage(hospitalInfoPageVO);
     }
@@ -330,4 +375,4 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
         this.update(updateWrapper);
         return true;
     }
-}
+}

+ 5 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java

@@ -12,6 +12,7 @@ import com.diagbot.vo.KlConceptSaveSubVO;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
+import java.util.Set;
 
 /**
  * @author wangfeng
@@ -57,4 +58,8 @@ public class KlLibraryInfoFacade extends KlLibraryInfoServiceImpl {
         klLibraryInfoSub.setGmtModified(now);
         return this.save(klLibraryInfoSub);
     }
+
+    public Set<String> getLibraryNameAlls() {
+        return getLibraryNameAll();
+    }
 }

+ 2 - 1
cdssman-service/src/main/java/com/diagbot/facade/PlanFacade.java

@@ -119,8 +119,9 @@ public class PlanFacade extends PlanServiceImpl {
                         planDetailSubNew.add(dataSubNew);
                     }
                     dataNew.setPlanDetailSub(planDetailSubNew);
-                    planDetailParentNew.add(dataNew);
+
                 }
+                planDetailParentNew.add(dataNew);
             }
         }
 

+ 597 - 0
cdssman-service/src/main/java/com/diagbot/facade/TcmdiseaseConfigFacade.java

@@ -0,0 +1,597 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.enums.ConceptTypeEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.TcmdiseaseConfigService;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.TcmdiseaseConfigListVO;
+import com.diagbot.vo.TcmdiseaseConfigPageVO;
+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 org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/14 11:04
+ */
+@Component
+public class TcmdiseaseConfigFacade {
+    @Autowired
+    private TcmdiseaseConfigService tcmdiseaseConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+
+    /**
+     * 判断是否已存在
+     *
+     * @param tcmdiseaseConfig
+     * @return
+     */
+    public Boolean isExistRecord(TcmdiseaseConfig tcmdiseaseConfig) {
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", tcmdiseaseConfig.getHospitalId())
+                .eq("his_name", tcmdiseaseConfig.getHisName())
+                .eq("unique_name", tcmdiseaseConfig.getUniqueName());
+        TcmdiseaseConfig oldRecord = tcmdiseaseConfigService.getOne(queryWrapper, false);
+        if (tcmdiseaseConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (tcmdiseaseConfig.getId() != null
+                && oldRecord != null
+                && !tcmdiseaseConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        return false;
+    }
+
+    /**
+     * 保存记录-单条
+     *
+     * @param tcmdiseaseConfig
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(TcmdiseaseConfig tcmdiseaseConfig) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        tcmdiseaseConfig.setModifier(userId);
+        tcmdiseaseConfig.setGmtModified(now);
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", tcmdiseaseConfig.getHospitalId())
+                .eq("his_name", tcmdiseaseConfig.getHisName())
+                .eq("unique_name", tcmdiseaseConfig.getUniqueName());
+        TcmdiseaseConfig oldRecord = tcmdiseaseConfigService.getOne(queryWrapper, false);
+        if (tcmdiseaseConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (tcmdiseaseConfig.getId() != null
+                && oldRecord != null
+                && !tcmdiseaseConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        //新增数据
+        if (tcmdiseaseConfig.getId() == null) {
+            tcmdiseaseConfig.setCreator(userId);
+            tcmdiseaseConfig.setGmtCreate(now);
+        }
+        if (tcmdiseaseConfig.getIsDeleted() == null) {
+            tcmdiseaseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+        }
+        tcmdiseaseConfigService.saveOrUpdate(tcmdiseaseConfig);
+        return true;
+    }
+
+    /**
+     * 保存记录-批量
+     *
+     * @param tcmdiseaseConfigListVO
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(TcmdiseaseConfigListVO tcmdiseaseConfigListVO) {
+        if (ListUtil.isEmpty(tcmdiseaseConfigListVO.getTcmdiseaseConfigList())) {
+            return false;
+        }
+        return saveOrUpdateRecords(tcmdiseaseConfigListVO.getTcmdiseaseConfigList());
+    }
+
+    /**
+     * 批量保存
+     *
+     * @param tcmdiseaseConfigList
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(List<TcmdiseaseConfig> tcmdiseaseConfigList) {
+        if (ListUtil.isEmpty(tcmdiseaseConfigList)) {
+            return false;
+        }
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //数据不完整的不保存
+        //过滤外部名称或公表名为空的数据
+        tcmdiseaseConfigList = tcmdiseaseConfigList
+                .stream()
+                .filter(i -> i.getHospitalId() != null)
+                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(tcmdiseaseConfigList)) {
+            return false;
+        }
+        Long hospitalId = tcmdiseaseConfigList.get(0).getHospitalId();
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, List<Long>>> configMap
+                = getConfigMap(hospitalId, null, null);
+        tcmdiseaseConfigList.forEach(tcmdiseaseConfig -> {
+            tcmdiseaseConfig.setModifier(userId);
+            tcmdiseaseConfig.setGmtModified(now);
+            if (tcmdiseaseConfig.getId() == null) {
+                if (configMap.containsKey(tcmdiseaseConfig.getHisName())
+                        && ListUtil.isNotEmpty(configMap.get(tcmdiseaseConfig.getHisName()).get(tcmdiseaseConfig.getUniqueName()))) {
+                    deleteIds.addAll(configMap.get(tcmdiseaseConfig.getHisName()).get(tcmdiseaseConfig.getUniqueName()));
+                }
+                tcmdiseaseConfig.setCreator(userId);
+                tcmdiseaseConfig.setGmtCreate(now);
+            }
+            if (tcmdiseaseConfig.getIsDeleted() == null) {
+                tcmdiseaseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        tcmdiseaseConfigService.saveOrUpdateBatch(tcmdiseaseConfigList);
+        return true;
+    }
+
+    /**
+     * 删除记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public Boolean deleteRecord(IdVO idVO) {
+        tcmdiseaseConfigService.removeById(idVO.getId());
+        return true;
+    }
+
+    /**
+     * 删除记录-批量
+     *
+     * @param idListVO
+     * @return
+     */
+    public Boolean deleteRecords(IdListVO idListVO) {
+        if (ListUtil.isEmpty(idListVO.getIds())) {
+            return false;
+        }
+        tcmdiseaseConfigService.removeByIds(idListVO.getIds());
+        return true;
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param tcmdiseaseConfigPageVO
+     * @return
+     */
+    public IPage<TcmdiseaseConfig> getPage(TcmdiseaseConfigPageVO tcmdiseaseConfigPageVO) {
+        return tcmdiseaseConfigService.getPage(tcmdiseaseConfigPageVO);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalIdVO
+     */
+    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
+        List<TcmdiseaseConfig> tcmdiseaseConfigList = ExcelUtils.importExcel(file, 0, 1, TcmdiseaseConfig.class);
+        if (ListUtil.isNotEmpty(tcmdiseaseConfigList)) {
+            importExcelRecords(tcmdiseaseConfigList, hospitalIdVO);
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param tcmdiseaseConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<TcmdiseaseConfig> tcmdiseaseConfigList, HospitalIdVO hospitalIdVO) {
+        Long hospitalId = hospitalIdVO.getHospitalId();
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        tcmdiseaseConfigList = tcmdiseaseConfigList.stream()
+                .filter(TcmdiseaseConfig::nonNull)
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(tcmdiseaseConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        tcmdiseaseConfigList.forEach(tcmdiseaseConfig -> {
+            tcmdiseaseConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < tcmdiseaseConfigList.size(); i++) {
+            if (StringUtil.isBlank(tcmdiseaseConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(tcmdiseaseConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(tcmdiseaseConfigList.get(i).getHisName())) {
+                tcmdiseaseConfigList.get(i).setHisName(tcmdiseaseConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(tcmdiseaseConfigList.get(i).getUniqueName())) {
+                tcmdiseaseConfigList.get(i).setUniqueName(tcmdiseaseConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(tcmdiseaseConfigList.get(i).getUniqueCode())) {
+                tcmdiseaseConfigList.get(i).setUniqueCode(tcmdiseaseConfigList.get(i).getUniqueCode().trim());
+            } else {
+                tcmdiseaseConfigList.get(i).setUniqueCode(null);
+            }
+        }
+
+        if (ListUtil.isNotEmpty(emptyNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
+                    + emptyNumList.stream().collect(Collectors.joining("、"))
+                    + "。导入取消,请修改后再试。\n");
+        }
+
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, List<Long>>> configMap
+                = getConfigMap(Long.valueOf(hospitalId), null, null);
+        tcmdiseaseConfigList.forEach(tcmdiseaseConfig -> {
+            tcmdiseaseConfig.setHospitalId(Long.valueOf(hospitalId));
+            tcmdiseaseConfig.setModifier(userId);
+            tcmdiseaseConfig.setGmtModified(now);
+            if (tcmdiseaseConfig.getId() == null) {
+                if (configMap.containsKey(tcmdiseaseConfig.getHisName())
+                        && ListUtil.isNotEmpty(configMap.get(tcmdiseaseConfig.getHisName()).get(tcmdiseaseConfig.getUniqueName()))) {
+                    deleteIds.addAll(configMap.get(tcmdiseaseConfig.getHisName()).get(tcmdiseaseConfig.getUniqueName()));
+                }
+                tcmdiseaseConfig.setCreator(userId);
+                tcmdiseaseConfig.setGmtCreate(now);
+            }
+            if (tcmdiseaseConfig.getIsDeleted() == null) {
+                tcmdiseaseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+
+        //标准术语校验
+        List<String> errorNumList = Lists.newLinkedList();
+        List<String> uniqueNames = tcmdiseaseConfigList.stream()
+                .map(i -> i.getUniqueName())
+                .distinct()
+                .collect(Collectors.toList());
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setNames(uniqueNames);
+        conceptVO.setType(ConceptTypeEnum.Tcmdisease.getKey());
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
+        for (int i = 0; i < tcmdiseaseConfigList.size(); i++) {
+            if (!names.contains(tcmdiseaseConfigList.get(i).getUniqueName())) {
+                errorNumList.add(String.valueOf(i + 2));
+            }
+        }
+        if (ListUtil.isNotEmpty(errorNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                    "以下行数(不计空行)标准术语在数据库中不存在:"
+                            + errorNumList.stream().collect(Collectors.joining("、"))
+                            + "。导入取消,请修改后再试。");
+        }
+
+        //重复数据过滤
+        tcmdiseaseConfigList = tcmdiseaseConfigList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
+
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        tcmdiseaseConfigService.saveOrUpdateBatch(tcmdiseaseConfigList);
+        return true;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<TcmdiseaseConfig> records = tcmdiseaseConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<TcmdiseaseConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<TcmdiseaseConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, List<TcmdiseaseConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
+                Map<String, List<Long>> subIdMap = new HashMap<>();
+                for (Map.Entry<String, List<TcmdiseaseConfig>> subEntry : subMap.entrySet()) {
+                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
+                }
+                retMap.put(entry.getKey(), subIdMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, List<Long>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<TcmdiseaseConfig> records = tcmdiseaseConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<TcmdiseaseConfig>> configMap = EntityUtil.makeEntityListMap(records, "uniqueName");
+        for (Map.Entry<String, List<TcmdiseaseConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, List<TcmdiseaseConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
+                Map<String, List<Long>> subIdMap = new HashMap<>();
+                for (Map.Entry<String, List<TcmdiseaseConfig>> subEntry : subMap.entrySet()) {
+                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
+                }
+                retMap.put(entry.getKey(), subIdMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalIdVO.getHospitalId())
+                .orderByDesc("gmt_modified");
+        List<TcmdiseaseConfig> records = tcmdiseaseConfigService.list(queryWrapper);
+        String fileName = "中医疾病映射.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
+        return tcmdiseaseConfigService.getRelationNumPage(hosRelationNumPageVO);
+    }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "中医疾病映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @param file
+     * @param response
+     */
+    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
+        List<TcmdiseaseConfig> originList = ExcelUtils.importExcel(file, 0, 1, TcmdiseaseConfig.class);
+        List<TcmdiseaseConfig> retList = dataProcess(originList);
+
+        String fileName = "中医疾病关联数据(预匹配).xls";
+        ExcelUtils.exportExcel(retList, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 导入数据验证
+     *
+     * @param file
+     * @return
+     */
+    public Boolean dataVerify(MultipartFile file) {
+        List<TcmdiseaseConfig> originList = ExcelUtils.importExcel(file, 0, 1, TcmdiseaseConfig.class);
+        List<TcmdiseaseConfig> retList = dataProcess(originList);
+        return true;
+    }
+
+    /**
+     * 数据处理
+     *
+     * @param originList
+     * @return
+     */
+    public List<TcmdiseaseConfig> dataProcess(List<TcmdiseaseConfig> originList) {
+        List<TcmdiseaseConfig> retList = Lists.newLinkedList();
+        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
+        Map<String, List<TcmdiseaseConfig>> allMap = getAll(hisNameList);
+
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(TcmdiseaseConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空格
+        originList.forEach(item -> {
+            item.setHisName(item.getHisName().trim());
+        });
+
+        //获取标准术语
+        List<String> precUniqueName = Lists.newArrayList();
+        if (allMap != null) {
+            for (Map.Entry<String, List<TcmdiseaseConfig>> entry : allMap.entrySet()) {
+                if (ListUtil.isNotEmpty(entry.getValue())) {
+                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
+                }
+            }
+        }
+        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setNames(precUniqueName);
+        conceptVO.setType(ConceptTypeEnum.Tcmdisease.getKey());
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        List<IndexBatchDTO> uniqueNameList = respDTO.data;
+        Map<String, IndexBatchDTO> uniqueMap = uniqueNameList.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
+        if (ListUtil.isNotEmpty(originList)) {
+            for (TcmdiseaseConfig originItem : originList) {
+                if (allMap.containsKey(originItem.getHisName())) {
+                    List<TcmdiseaseConfig> items = allMap.get(originItem.getHisName());
+                    boolean flag = false;
+                    for (TcmdiseaseConfig item : items) {
+                        if (uniqueMap.containsKey(item.getUniqueName())) {
+                            item.setUniqueCode(uniqueMap.get(item.getUniqueName()).getCode());
+                            retList.add(item);
+                            flag = true;
+                        }
+                    }
+                    if (!flag) {
+                        retList.add(originItem);
+                    }
+                } else {
+                    retList.add(originItem);
+                }
+            }
+        }
+
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+        return retList;
+    }
+
+    /**
+     * 获取所有医院映射数据
+     *
+     * @return
+     */
+    public Map<String, List<TcmdiseaseConfig>> getAll(List<String> hisNameList) {
+        Map<String, List<TcmdiseaseConfig>> retMap = new HashMap<>();
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        if (ListUtil.isNotEmpty(hisNameList)) {
+            queryWrapper.in("his_name", hisNameList);
+        }
+        List<TcmdiseaseConfig> records = tcmdiseaseConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        records.forEach(record -> {
+            record.setHospitalId(null);
+            record.setId(null);
+            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? null : record.getUniqueName());
+        });
+
+        records = records
+                .stream()
+                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+
+        retMap = EntityUtil.makeEntityListMap(records, "hisName");
+
+        return retMap;
+    }
+
+    /**
+     * 查找指定医院映射关系
+     *
+     * @param hospitalId
+     * @return
+     */
+    public List<TcmdiseaseConfig> getListByHospitalId(Long hospitalId) {
+        QueryWrapper<TcmdiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        return tcmdiseaseConfigService.list(queryWrapper);
+    }
+}

+ 597 - 0
cdssman-service/src/main/java/com/diagbot/facade/TcmsyndromeConfigFacade.java

@@ -0,0 +1,597 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.enums.ConceptTypeEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.TcmsyndromeConfigService;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.TcmsyndromeConfigListVO;
+import com.diagbot.vo.TcmsyndromeConfigPageVO;
+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 org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/14 11:04
+ */
+@Component
+public class TcmsyndromeConfigFacade {
+    @Autowired
+    private TcmsyndromeConfigService tcmsyndromeConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+
+    /**
+     * 判断是否已存在
+     *
+     * @param tcmsyndromeConfig
+     * @return
+     */
+    public Boolean isExistRecord(TcmsyndromeConfig tcmsyndromeConfig) {
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", tcmsyndromeConfig.getHospitalId())
+                .eq("his_name", tcmsyndromeConfig.getHisName())
+                .eq("unique_name", tcmsyndromeConfig.getUniqueName());
+        TcmsyndromeConfig oldRecord = tcmsyndromeConfigService.getOne(queryWrapper, false);
+        if (tcmsyndromeConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (tcmsyndromeConfig.getId() != null
+                && oldRecord != null
+                && !tcmsyndromeConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        return false;
+    }
+
+    /**
+     * 保存记录-单条
+     *
+     * @param tcmsyndromeConfig
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(TcmsyndromeConfig tcmsyndromeConfig) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        tcmsyndromeConfig.setModifier(userId);
+        tcmsyndromeConfig.setGmtModified(now);
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", tcmsyndromeConfig.getHospitalId())
+                .eq("his_name", tcmsyndromeConfig.getHisName())
+                .eq("unique_name", tcmsyndromeConfig.getUniqueName());
+        TcmsyndromeConfig oldRecord = tcmsyndromeConfigService.getOne(queryWrapper, false);
+        if (tcmsyndromeConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (tcmsyndromeConfig.getId() != null
+                && oldRecord != null
+                && !tcmsyndromeConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        //新增数据
+        if (tcmsyndromeConfig.getId() == null) {
+            tcmsyndromeConfig.setCreator(userId);
+            tcmsyndromeConfig.setGmtCreate(now);
+        }
+        if (tcmsyndromeConfig.getIsDeleted() == null) {
+            tcmsyndromeConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+        }
+        tcmsyndromeConfigService.saveOrUpdate(tcmsyndromeConfig);
+        return true;
+    }
+
+    /**
+     * 保存记录-批量
+     *
+     * @param tcmsyndromeConfigListVO
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(TcmsyndromeConfigListVO tcmsyndromeConfigListVO) {
+        if (ListUtil.isEmpty(tcmsyndromeConfigListVO.getTcmsyndromeConfigList())) {
+            return false;
+        }
+        return saveOrUpdateRecords(tcmsyndromeConfigListVO.getTcmsyndromeConfigList());
+    }
+
+    /**
+     * 批量保存
+     *
+     * @param tcmsyndromeConfigList
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(List<TcmsyndromeConfig> tcmsyndromeConfigList) {
+        if (ListUtil.isEmpty(tcmsyndromeConfigList)) {
+            return false;
+        }
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //数据不完整的不保存
+        //过滤外部名称或公表名为空的数据
+        tcmsyndromeConfigList = tcmsyndromeConfigList
+                .stream()
+                .filter(i -> i.getHospitalId() != null)
+                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(tcmsyndromeConfigList)) {
+            return false;
+        }
+        Long hospitalId = tcmsyndromeConfigList.get(0).getHospitalId();
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, List<Long>>> configMap
+                = getConfigMap(hospitalId, null, null);
+        tcmsyndromeConfigList.forEach(tcmsyndromeConfig -> {
+            tcmsyndromeConfig.setModifier(userId);
+            tcmsyndromeConfig.setGmtModified(now);
+            if (tcmsyndromeConfig.getId() == null) {
+                if (configMap.containsKey(tcmsyndromeConfig.getHisName())
+                        && ListUtil.isNotEmpty(configMap.get(tcmsyndromeConfig.getHisName()).get(tcmsyndromeConfig.getUniqueName()))) {
+                    deleteIds.addAll(configMap.get(tcmsyndromeConfig.getHisName()).get(tcmsyndromeConfig.getUniqueName()));
+                }
+                tcmsyndromeConfig.setCreator(userId);
+                tcmsyndromeConfig.setGmtCreate(now);
+            }
+            if (tcmsyndromeConfig.getIsDeleted() == null) {
+                tcmsyndromeConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        tcmsyndromeConfigService.saveOrUpdateBatch(tcmsyndromeConfigList);
+        return true;
+    }
+
+    /**
+     * 删除记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public Boolean deleteRecord(IdVO idVO) {
+        tcmsyndromeConfigService.removeById(idVO.getId());
+        return true;
+    }
+
+    /**
+     * 删除记录-批量
+     *
+     * @param idListVO
+     * @return
+     */
+    public Boolean deleteRecords(IdListVO idListVO) {
+        if (ListUtil.isEmpty(idListVO.getIds())) {
+            return false;
+        }
+        tcmsyndromeConfigService.removeByIds(idListVO.getIds());
+        return true;
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param tcmsyndromeConfigPageVO
+     * @return
+     */
+    public IPage<TcmsyndromeConfig> getPage(TcmsyndromeConfigPageVO tcmsyndromeConfigPageVO) {
+        return tcmsyndromeConfigService.getPage(tcmsyndromeConfigPageVO);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalIdVO
+     */
+    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
+        List<TcmsyndromeConfig> tcmsyndromeConfigList = ExcelUtils.importExcel(file, 0, 1, TcmsyndromeConfig.class);
+        if (ListUtil.isNotEmpty(tcmsyndromeConfigList)) {
+            importExcelRecords(tcmsyndromeConfigList, hospitalIdVO);
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param tcmsyndromeConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<TcmsyndromeConfig> tcmsyndromeConfigList, HospitalIdVO hospitalIdVO) {
+        Long hospitalId = hospitalIdVO.getHospitalId();
+        String userId = UserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        tcmsyndromeConfigList = tcmsyndromeConfigList.stream()
+                .filter(TcmsyndromeConfig::nonNull)
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(tcmsyndromeConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        tcmsyndromeConfigList.forEach(tcmsyndromeConfig -> {
+            tcmsyndromeConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < tcmsyndromeConfigList.size(); i++) {
+            if (StringUtil.isBlank(tcmsyndromeConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(tcmsyndromeConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(tcmsyndromeConfigList.get(i).getHisName())) {
+                tcmsyndromeConfigList.get(i).setHisName(tcmsyndromeConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(tcmsyndromeConfigList.get(i).getUniqueName())) {
+                tcmsyndromeConfigList.get(i).setUniqueName(tcmsyndromeConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(tcmsyndromeConfigList.get(i).getUniqueCode())) {
+                tcmsyndromeConfigList.get(i).setUniqueCode(tcmsyndromeConfigList.get(i).getUniqueCode().trim());
+            } else {
+                tcmsyndromeConfigList.get(i).setUniqueCode(null);
+            }
+        }
+
+        if (ListUtil.isNotEmpty(emptyNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
+                    + emptyNumList.stream().collect(Collectors.joining("、"))
+                    + "。导入取消,请修改后再试。\n");
+        }
+
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, List<Long>>> configMap
+                = getConfigMap(Long.valueOf(hospitalId), null, null);
+        tcmsyndromeConfigList.forEach(tcmsyndromeConfig -> {
+            tcmsyndromeConfig.setHospitalId(Long.valueOf(hospitalId));
+            tcmsyndromeConfig.setModifier(userId);
+            tcmsyndromeConfig.setGmtModified(now);
+            if (tcmsyndromeConfig.getId() == null) {
+                if (configMap.containsKey(tcmsyndromeConfig.getHisName())
+                        && ListUtil.isNotEmpty(configMap.get(tcmsyndromeConfig.getHisName()).get(tcmsyndromeConfig.getUniqueName()))) {
+                    deleteIds.addAll(configMap.get(tcmsyndromeConfig.getHisName()).get(tcmsyndromeConfig.getUniqueName()));
+                }
+                tcmsyndromeConfig.setCreator(userId);
+                tcmsyndromeConfig.setGmtCreate(now);
+            }
+            if (tcmsyndromeConfig.getIsDeleted() == null) {
+                tcmsyndromeConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+
+        //标准术语校验
+        List<String> errorNumList = Lists.newLinkedList();
+        List<String> uniqueNames = tcmsyndromeConfigList.stream()
+                .map(i -> i.getUniqueName())
+                .distinct()
+                .collect(Collectors.toList());
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setNames(uniqueNames);
+        conceptVO.setType(ConceptTypeEnum.Tcmsyndrome.getKey());
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
+        for (int i = 0; i < tcmsyndromeConfigList.size(); i++) {
+            if (!names.contains(tcmsyndromeConfigList.get(i).getUniqueName())) {
+                errorNumList.add(String.valueOf(i + 2));
+            }
+        }
+        if (ListUtil.isNotEmpty(errorNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                    "以下行数(不计空行)标准术语在数据库中不存在:"
+                            + errorNumList.stream().collect(Collectors.joining("、"))
+                            + "。导入取消,请修改后再试。");
+        }
+
+        //重复数据过滤
+        tcmsyndromeConfigList = tcmsyndromeConfigList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
+
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        tcmsyndromeConfigService.saveOrUpdateBatch(tcmsyndromeConfigList);
+        return true;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<TcmsyndromeConfig> records = tcmsyndromeConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<TcmsyndromeConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<TcmsyndromeConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, List<TcmsyndromeConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
+                Map<String, List<Long>> subIdMap = new HashMap<>();
+                for (Map.Entry<String, List<TcmsyndromeConfig>> subEntry : subMap.entrySet()) {
+                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
+                }
+                retMap.put(entry.getKey(), subIdMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, List<Long>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<TcmsyndromeConfig> records = tcmsyndromeConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<TcmsyndromeConfig>> configMap = EntityUtil.makeEntityListMap(records, "uniqueName");
+        for (Map.Entry<String, List<TcmsyndromeConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, List<TcmsyndromeConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
+                Map<String, List<Long>> subIdMap = new HashMap<>();
+                for (Map.Entry<String, List<TcmsyndromeConfig>> subEntry : subMap.entrySet()) {
+                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
+                }
+                retMap.put(entry.getKey(), subIdMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalIdVO.getHospitalId())
+                .orderByDesc("gmt_modified");
+        List<TcmsyndromeConfig> records = tcmsyndromeConfigService.list(queryWrapper);
+        String fileName = "中医证候映射.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
+        return tcmsyndromeConfigService.getRelationNumPage(hosRelationNumPageVO);
+    }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "中医证候映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @param file
+     * @param response
+     */
+    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
+        List<TcmsyndromeConfig> originList = ExcelUtils.importExcel(file, 0, 1, TcmsyndromeConfig.class);
+        List<TcmsyndromeConfig> retList = dataProcess(originList);
+
+        String fileName = "中医证候关联数据(预匹配).xls";
+        ExcelUtils.exportExcel(retList, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 导入数据验证
+     *
+     * @param file
+     * @return
+     */
+    public Boolean dataVerify(MultipartFile file) {
+        List<TcmsyndromeConfig> originList = ExcelUtils.importExcel(file, 0, 1, TcmsyndromeConfig.class);
+        List<TcmsyndromeConfig> retList = dataProcess(originList);
+        return true;
+    }
+
+    /**
+     * 数据处理
+     *
+     * @param originList
+     * @return
+     */
+    public List<TcmsyndromeConfig> dataProcess(List<TcmsyndromeConfig> originList) {
+        List<TcmsyndromeConfig> retList = Lists.newLinkedList();
+        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
+        Map<String, List<TcmsyndromeConfig>> allMap = getAll(hisNameList);
+
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(TcmsyndromeConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空格
+        originList.forEach(item -> {
+            item.setHisName(item.getHisName().trim());
+        });
+
+        //获取标准术语
+        List<String> precUniqueName = Lists.newArrayList();
+        if (allMap != null) {
+            for (Map.Entry<String, List<TcmsyndromeConfig>> entry : allMap.entrySet()) {
+                if (ListUtil.isNotEmpty(entry.getValue())) {
+                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
+                }
+            }
+        }
+        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setNames(precUniqueName);
+        conceptVO.setType(ConceptTypeEnum.Tcmsyndrome.getKey());
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        List<IndexBatchDTO> uniqueNameList = respDTO.data;
+        Map<String, IndexBatchDTO> uniqueMap = uniqueNameList.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
+        if (ListUtil.isNotEmpty(originList)) {
+            for (TcmsyndromeConfig originItem : originList) {
+                if (allMap.containsKey(originItem.getHisName())) {
+                    List<TcmsyndromeConfig> items = allMap.get(originItem.getHisName());
+                    boolean flag = false;
+                    for (TcmsyndromeConfig item : items) {
+                        if (uniqueMap.containsKey(item.getUniqueName())) {
+                            item.setUniqueCode(uniqueMap.get(item.getUniqueName()).getCode());
+                            retList.add(item);
+                            flag = true;
+                        }
+                    }
+                    if (!flag) {
+                        retList.add(originItem);
+                    }
+                } else {
+                    retList.add(originItem);
+                }
+            }
+        }
+
+        retList = retList.stream()
+                .distinct()
+                .collect(Collectors.toList());
+        return retList;
+    }
+
+    /**
+     * 获取所有医院映射数据
+     *
+     * @return
+     */
+    public Map<String, List<TcmsyndromeConfig>> getAll(List<String> hisNameList) {
+        Map<String, List<TcmsyndromeConfig>> retMap = new HashMap<>();
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        if (ListUtil.isNotEmpty(hisNameList)) {
+            queryWrapper.in("his_name", hisNameList);
+        }
+        List<TcmsyndromeConfig> records = tcmsyndromeConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        records.forEach(record -> {
+            record.setHospitalId(null);
+            record.setId(null);
+            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? null : record.getUniqueName());
+        });
+
+        records = records
+                .stream()
+                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+
+        retMap = EntityUtil.makeEntityListMap(records, "hisName");
+
+        return retMap;
+    }
+
+    /**
+     * 查找指定医院映射关系
+     *
+     * @param hospitalId
+     * @return
+     */
+    public List<TcmsyndromeConfig> getListByHospitalId(Long hospitalId) {
+        QueryWrapper<TcmsyndromeConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        return tcmsyndromeConfigService.list(queryWrapper);
+    }
+}

+ 406 - 0
cdssman-service/src/main/java/com/diagbot/facade/TermImportFacade.java

@@ -0,0 +1,406 @@
+package com.diagbot.facade;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.ExportConceptAllDTO;
+import com.diagbot.dto.ExportConceptModeDTO;
+import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlConceptCommon;
+import com.diagbot.entity.KlLexicon;
+import com.diagbot.entity.KlLibraryInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.KlConceptCommonService;
+import com.diagbot.service.KlConceptService;
+import com.diagbot.service.KlDiseaseService;
+import com.diagbot.service.KlDrugService;
+import com.diagbot.service.KlLibraryInfoService;
+import com.diagbot.service.KlLisService;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.Cn2SpellUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ImportConceptAllVO;
+import com.diagbot.vo.ImportConceptSubVO;
+import org.apache.poi.hssf.usermodel.DVConstraint;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDataValidation;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.DataFormat;
+import org.apache.poi.ss.usermodel.Name;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddressList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-31 13:13
+ */
+@Component
+public class TermImportFacade {
+    @Autowired
+    KlLibraryInfoFacade klLibraryInfoFacade;
+    @Autowired
+    KlLexiconFacade klLexiconFacade;
+    @Autowired
+    KlConceptFacade klConceptFacade;
+    @Autowired
+    KlConceptCommonFacade klConceptCommonFacade;
+    @Autowired
+    KlLisFacade klLisFacade;
+    @Autowired
+    KlDiseaseFacade klDiseaseFacade;
+    @Autowired
+    KlDrugFacade klDrugFacade;
+    @Autowired
+    @Qualifier("klConceptServiceImpl")
+    private KlConceptService klConceptService;
+    @Autowired
+    @Qualifier("klLibraryInfoServiceImpl")
+    private KlLibraryInfoService klLibraryInfoService;
+    @Autowired
+    @Qualifier("klConceptCommonServiceImpl")
+    private KlConceptCommonService klConceptCommonService;
+    @Autowired
+    @Qualifier("klDiseaseServiceImpl")
+    private KlDiseaseService klDiseaseService;
+    @Autowired
+    @Qualifier("klDrugServiceImpl")
+    KlDrugService klDrugService;
+    @Autowired
+    @Qualifier("klLisServiceImpl")
+    KlLisService klLisService;
+
+
+    public void exporTermExcelAll(HttpServletResponse response, MultipartFile file) {
+        //导入处理
+        List<ImportConceptAllVO> conceptList = ExcelUtils.importExcelNew(file, 0, 1, ImportConceptAllVO.class);
+        Map<Integer, ImportConceptAllVO> conceptExportMap = conceptList.stream()
+                .collect(Collectors.toMap(ImportConceptAllVO::getRowNum, questionInfo -> questionInfo));
+        //校验数据
+        QueryWrapper<KlLexicon> klLexiconQuer = new QueryWrapper<>();
+        klLexiconQuer.eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<KlLexicon> list = klLexiconFacade.list(klLexiconQuer);
+        Map<String, KlLexicon> lexiconMap = list.stream()
+                .collect(Collectors.toMap(KlLexicon::getName, questionInfo -> questionInfo));
+        //问题数据
+        Map<Integer, String> errMsg = new HashMap<Integer, String>();
+        Map<String, Integer> libNameMap = new HashMap<String, Integer>();
+        List<Integer> sexType = Arrays.asList(1, 2, 3);
+        for (Integer row : conceptExportMap.keySet()) {
+            ImportConceptAllVO data = conceptExportMap.get(row);
+            //校验医学标准术语、类型、性别、最小年龄、最大年龄必填
+            if (StringUtil.isBlank(data.getLibName()) ||
+                    StringUtil.isBlank(data.getTypeName()) ||
+                    null == data.getSexType()
+                    || null == data.getMinAge()
+                    || null == data.getMaxAge()) {
+                errMsg.put(data.getRowNum(), "--医学标准术语、类型、性别、最小年龄、最大年龄必填--");
+            } else {
+                //类型
+                if (lexiconMap.get(data.getTypeName()) == null) {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? "--类型错误--" :
+                            errMsg.get(data.getRowNum()) + "--类型错误--");
+                } else {
+                    data.setLibType(lexiconMap.get(data.getTypeName()).getCode());
+                    data.setIsHasCommon(lexiconMap.get(data.getTypeName()).getIsHasCommon());
+                }
+                //性别123
+                if (!sexType.contains(data.getSexType())) {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? "--性别错误--" :
+                            errMsg.get(data.getRowNum()) + "--性别错误--");
+                }
+                if (data.getMinAge() < 0.0) {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? "--最小年龄错误--" :
+                            errMsg.get(data.getRowNum()) + "--最小年龄错误--");
+                }
+                if (data.getMaxAge() > 200) {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? "--最大年龄错误--" :
+                            errMsg.get(data.getRowNum()) + "--最大年龄错误--");
+                }
+                if (data.getMaxAge() < data.getMinAge()) {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? "--最大年龄小于最小年龄--" :
+                            errMsg.get(data.getRowNum()) + "--最大年龄小于最小年龄--");
+                }
+                //标准词数据重复校验
+                Integer integer = libNameMap.get(data.getLibName() + "_" + data.getLibType());
+                if (null == integer) {
+                    libNameMap.put(data.getLibName() + "_" + data.getLibType(), data.getRowNum());
+                } else {
+                    errMsg.put(data.getRowNum(), errMsg.get(data.getRowNum()) == null ? data.getLibName() + "重复出现----" :
+                            errMsg.get(data.getRowNum()) + data.getLibName() + "重复出现----");
+                }
+
+
+            }
+
+        }
+        //拆同义词
+        for (Integer row : conceptExportMap.keySet()) {
+            ImportConceptAllVO termExcelVO = conceptExportMap.get(row);
+            Integer libType = termExcelVO.getLibType();
+            String libName = termExcelVO.getLibName();
+            String synonymName = termExcelVO.getSynonymName();
+            List<ImportConceptSubVO> synonymsList = new ArrayList<>();
+            if (null != synonymName && !synonymName.equals("")) {
+                String[] result = synonymName.split("[\\$]");
+                for (String r : result) {
+                    ImportConceptSubVO sub = new ImportConceptSubVO();
+                    sub.setLibName(libName);
+                    sub.setIsConcept(0);
+                    sub.setLibType(libType);
+                    sub.setStatus(1);
+                    sub.setSynonymName(r.trim());
+                    //同义词数据重复校验
+                    if (null != r.trim() && null != libType) {
+                        Integer integer = libNameMap.get(r.trim() + "_" + libType);
+                        if (null == integer) {
+                            libNameMap.put(r.trim() + "_" + libType, termExcelVO.getRowNum());
+                        } else {
+                            errMsg.put(termExcelVO.getRowNum(), errMsg.get(termExcelVO.getRowNum()) == null ? r.trim() + "重复出现--" :
+                                    errMsg.get(termExcelVO.getRowNum()) + r.trim() + "重复出现--");
+                        }
+
+                    }
+                    synonymsList.add(sub);
+                }
+            }
+            termExcelVO.setSynonymsList(synonymsList);
+        }
+        Set<String> set = klLibraryInfoFacade.getLibraryNameAlls(); // 加载词库数据
+        for (String libName : libNameMap.keySet()) {
+            Integer integer = libNameMap.get(libName);
+            if (set.contains(libName)) {
+                String str1 = libName.substring(0, libName.indexOf("_"));
+                errMsg.put(integer, errMsg.get(integer) == null ? "--数据库中" + str1 + "已存在--" :
+                        errMsg.get(integer) + "--数据库中" + str1 + "已存在--");
+            }
+        }
+
+        //要导出的数据
+        List<ExportConceptAllDTO> exportConceptAll = new ArrayList<>();
+        List<ImportConceptAllVO> conceptListNew = new ArrayList<>();
+        for (Integer i : errMsg.keySet()) {
+            ImportConceptAllVO importConceptAllVO = conceptExportMap.get(i);
+            ExportConceptAllDTO etx = new ExportConceptAllDTO();
+            BeanUtil.copyProperties(importConceptAllVO, etx);
+            etx.setMsg(errMsg.get(i));
+            exportConceptAll.add(etx);
+            conceptListNew.add(importConceptAllVO);
+        }
+        //要插入数据库的数据
+        List<ImportConceptAllVO> conceptListData = new ArrayList<>();
+        for (Integer row : conceptExportMap.keySet()) {
+            ImportConceptAllVO str1 = conceptExportMap.get(row);
+            if (!conceptListNew.contains(str1)) {
+                conceptListData.add(str1);
+            }
+        }
+        if (ListUtil.isNotEmpty(conceptListData)) {
+            saveAllImport(conceptListData);
+        }
+        String fileName = "错误结果导出.xls";
+        ExcelUtils.exportExcel(exportConceptAll, null, "sheet1", ExportConceptAllDTO.class, fileName, response, 12.8f);
+    }
+
+    private void saveAllImport(List<ImportConceptAllVO> conceptList) {
+        List<KlLibraryInfo> libraryInfos = new ArrayList<>();
+        Date now = DateUtil.now();
+        boolean res = false;
+        for (ImportConceptAllVO data : conceptList) {
+            KlLibraryInfo klLibraryInfo = new KlLibraryInfo();
+            klLibraryInfo.setName(data.getLibName());
+            klLibraryInfo.setModifier(UserUtils.getCurrentPrincipleID());
+            klLibraryInfo.setGmtCreate(now);
+            klLibraryInfo.setGmtModified(now);
+            klLibraryInfo.setIsConcept(1);
+            klLibraryInfo.setTypeId(data.getLibType());
+            String spell = "";
+            if (StringUtil.isNotBlank(data.getLibName())) {
+                spell = data.getLibName().replaceAll("[\\pP‘’“”,,]", "");
+                spell = Cn2SpellUtil.converterToFirstSpell(spell);
+            }
+            klLibraryInfo.setSpell(spell);
+            libraryInfos.add(klLibraryInfo);
+        }
+        res = klLibraryInfoService.saveBatch(libraryInfos);
+        List<KlConcept> klConcepts = new ArrayList<>();
+        for (KlLibraryInfo klLibraryInfo : libraryInfos) {
+            KlConcept klConcept = new KlConcept();
+            klConcept.setGmtCreate(now);
+            klConcept.setGmtModified(now);
+            klConcept.setModifier(UserUtils.getCurrentPrincipleID());
+            klConcept.setLibId(klLibraryInfo.getId());
+            klConcept.setLibName(klLibraryInfo.getName());
+            klConcept.setLibType(klLibraryInfo.getTypeId());
+            klConcepts.add(klConcept);
+        }
+        res = klConceptService.saveBatch(klConcepts);
+        Map<Long, KlConcept> map = EntityUtil.makeEntityMap(klConcepts, "libId");
+        for (KlLibraryInfo klLibraryInfo : libraryInfos) {
+            klLibraryInfo.setConceptId(map.get(klLibraryInfo.getId()).getId());
+        }
+        res = klLibraryInfoService.updateBatchById(libraryInfos);
+
+        //增加同义词
+        Map<String, ImportConceptAllVO> conceptListMap = conceptList.stream().collect(Collectors.toMap(r -> r.getLibName() + r.getLibType(), r -> r));
+
+        Map<String, KlConcept> klConceptsMap = klConcepts.stream().collect(Collectors.toMap(r -> r.getLibName() + r.getLibType(), r -> r));
+
+        List<KlLibraryInfo> libraryInfosSub = new ArrayList<>();
+
+        for (Map.Entry<String, KlConcept> klConData : klConceptsMap.entrySet()) {
+            KlConcept value = klConData.getValue();
+            ImportConceptAllVO importConceptAllVOS = conceptListMap.get(value.getLibName() + value.getLibType());
+            List<ImportConceptSubVO> synonymsList = importConceptAllVOS.getSynonymsList();
+            if (ListUtil.isNotEmpty(synonymsList)) {
+                for (ImportConceptSubVO subVO : synonymsList) {
+                    KlLibraryInfo klLibraryInfo = new KlLibraryInfo();
+                    klLibraryInfo.setName(subVO.getSynonymName());
+                    klLibraryInfo.setModifier(UserUtils.getCurrentPrincipleID());
+                    klLibraryInfo.setIsConcept(0);
+                    klLibraryInfo.setConceptId(value.getId());
+                    klLibraryInfo.setTypeId(value.getLibType());
+                    String spell = "";
+                    if (StringUtil.isNotBlank(subVO.getSynonymName())) {
+                        spell = subVO.getSynonymName().replaceAll("[\\pP‘’“”]", "");
+                        spell = Cn2SpellUtil.converterToFirstSpell(spell);
+                    }
+                    klLibraryInfo.setSpell(spell);
+                    libraryInfosSub.add(klLibraryInfo);
+                }
+            }
+        }
+        res = klLibraryInfoService.saveBatch(libraryInfosSub);
+        //年龄
+        List<KlConceptCommon> conceptCommonList = new ArrayList<>();
+        for (Map.Entry<String, ImportConceptAllVO> entry : conceptListMap.entrySet()) {
+            ImportConceptAllVO value = entry.getValue();
+            KlConcept klConcept = klConceptsMap.get(value.getLibName() + value.getLibType());
+            if (null != klConcept) {
+                if (null != value.getIsHasCommon() && value.getIsHasCommon().equals(1)) {
+                    KlConceptCommon conceptCommon = new KlConceptCommon();
+                    conceptCommon.setSexType(value.getSexType());
+                    conceptCommon.setMaxAge(value.getMaxAge());
+                    conceptCommon.setMinAge(value.getMinAge());
+                    conceptCommon.setConceptId(klConcept.getId());
+                    conceptCommon.setCreator(UserUtils.getCurrentPrincipleID());
+                    conceptCommon.setModifier(UserUtils.getCurrentPrincipleID());
+                    conceptCommon.setGmtCreate(now);
+                    conceptCommon.setGmtModified(now);
+                    conceptCommonList.add(conceptCommon);
+                }
+            }
+
+
+        }
+        res = klConceptCommonService.saveBatch(conceptCommonList);
+    }
+
+    public void exportTemplateAll(HttpServletResponse response) {
+        //类型数据
+        QueryWrapper<KlLexicon> klLexiconQuer = new QueryWrapper<>();
+        klLexiconQuer.eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<KlLexicon> klLexiconList = klLexiconFacade.list(klLexiconQuer);
+        String fileName = "模板.xls";
+        String title = null;
+        // ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", ExportConceptAllDTO.class, fileName, response, 12.8f);
+        float height = 12.8f;
+        Boolean havTitle = false;
+        if (StringUtil.isNotBlank(title)) {
+            havTitle = true;
+        }
+        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(title, "sheet1"), ExportConceptModeDTO.class, new ArrayList<>());
+        if (workbook != null) {
+            //设置第5,6整列只能是数字
+            Sheet sheet = workbook.getSheetAt(0);//创建Excel工作表的行
+            CellStyle cellStyle = workbook.createCellStyle();//创建单元格样式
+            DataFormat df = workbook.createDataFormat();// 此处设置数据格式
+            cellStyle.setDataFormat(df.getFormat("#,##0.0"));//保留1位小数点
+            sheet.setDefaultColumnStyle(4, cellStyle);
+            sheet.setDefaultColumnStyle(5, cellStyle);
+
+            //设置第3整列只能指定类型下拉选
+            List<String> typeNames = new ArrayList<>();
+            typeNames = klLexiconList.stream().map(ac -> ac.getName()).collect(Collectors.toList());
+            String[] typeName = typeNames.toArray(new String[typeNames.size()]);
+            HSSFWorkbook wbook = new HSSFWorkbook();
+            Sheet hidden = workbook.createSheet("hidden");
+            HSSFCell cell = null;
+            for (int i = 0, length = typeNames.size(); i < length; i++) {
+                String name = typeNames.get(i);
+                Row row = hidden.createRow(i);
+                Cell cell1 = row.createCell(0);
+                cell1.setCellValue(name);
+            }
+            Name namedCell = workbook.createName();
+            namedCell.setNameName("hidden");
+            namedCell.setRefersToFormula("hidden!$A$1:$A$" + typeNames.size());
+            //加载数据,将名称为hidden的
+            DVConstraint constraint = DVConstraint.createFormulaListConstraint("hidden");
+            CellRangeAddressList regions = new CellRangeAddressList(1, 50000, 2, 2);
+            //DVConstraint constraint = DVConstraint.createExplicitListConstraint(typeName);
+            HSSFDataValidation data_validation = new HSSFDataValidation(regions, constraint);
+            if (null != data_validation) {
+                sheet.addValidationData(data_validation);
+            }
+
+            //设置第3整列只能下拉选1.2.3
+            String[] strings = { "1", "2", "3" };
+            CellRangeAddressList regions2 = new CellRangeAddressList(1, 50000, 3, 3);
+            DVConstraint constraint2 = DVConstraint.createExplicitListConstraint(strings);
+            HSSFDataValidation data_validation2 = new HSSFDataValidation(regions2, constraint2);
+            sheet.addValidationData(data_validation2);
+
+
+            int rowNum = sheet.getLastRowNum();
+            Row row = sheet.getRow(0);
+            int startRowNum = 1;
+            if (havTitle) {
+                startRowNum = 2;
+            }
+            for (int i = startRowNum; i <= rowNum; i++) {
+                row = sheet.getRow(i);
+                row.setHeightInPoints(height);
+            }
+        }
+        try {
+            response.setCharacterEncoding("UTF-8");
+            response.setHeader("content-Type", "application/vnd.ms-excel");
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
+            workbook.write(response.getOutputStream());
+        } catch (IOException e) {
+            // throw new NormalException(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导出Excel异常");
+        }
+
+    }
+
+
+}

+ 3 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlLibraryInfoMapper.java

@@ -6,6 +6,7 @@ import com.diagbot.vo.KlConceptInfoVO;
 import com.diagbot.vo.KlLibraryInfoVO;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -17,4 +18,6 @@ import java.util.List;
  */
 public interface KlLibraryInfoMapper extends BaseMapper<KlLibraryInfo> {
     List<KlLibraryInfo> getLib(KlLibraryInfoVO klLibraryInfoVO);
+
+    Set<String> getLibraryNameAll();
 }

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/mapper/TcmdiseaseConfigMapper.java

@@ -0,0 +1,35 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmdiseaseConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 中医疾病映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+public interface TcmdiseaseConfigMapper extends BaseMapper<TcmdiseaseConfig> {
+    /**
+     * 分页查询
+     *
+     * @param tcmdiseaseConfigPageVO
+     * @return
+     */
+    IPage<TcmdiseaseConfig> getPage(@Param("tcmdiseaseConfigPageVO") TcmdiseaseConfigPageVO tcmdiseaseConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/mapper/TcmsyndromeConfigMapper.java

@@ -0,0 +1,35 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmsyndromeConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 中医证候映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+public interface TcmsyndromeConfigMapper extends BaseMapper<TcmsyndromeConfig> {
+    /**
+     * 分页查询
+     *
+     * @param tcmsyndromeConfigPageVO
+     * @return
+     */
+    IPage<TcmsyndromeConfig> getPage(@Param("tcmsyndromeConfigPageVO") TcmsyndromeConfigPageVO tcmsyndromeConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 2 - 0
cdssman-service/src/main/java/com/diagbot/service/KlLibraryInfoService.java

@@ -5,6 +5,7 @@ import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.vo.KlLibraryInfoVO;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -16,4 +17,5 @@ import java.util.List;
  */
 public interface KlLibraryInfoService extends IService<KlLibraryInfo> {
     List<KlLibraryInfo> getLib(KlLibraryInfoVO klLibraryInfoVO);
+    Set<String> getLibraryNameAll();
 }

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/service/TcmdiseaseConfigService.java

@@ -0,0 +1,35 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmdiseaseConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 中医疾病映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+public interface TcmdiseaseConfigService extends IService<TcmdiseaseConfig> {
+    /**
+     * 分页查询
+     *
+     * @param tcmdiseaseConfigPageVO
+     * @return
+     */
+    IPage<TcmdiseaseConfig> getPage(@Param("tcmdiseaseConfigPageVO") TcmdiseaseConfigPageVO tcmdiseaseConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 35 - 0
cdssman-service/src/main/java/com/diagbot/service/TcmsyndromeConfigService.java

@@ -0,0 +1,35 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmsyndromeConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 中医证候映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+public interface TcmsyndromeConfigService extends IService<TcmsyndromeConfig> {
+    /**
+     * 分页查询
+     *
+     * @param tcmsyndromeConfigPageVO
+     * @return
+     */
+    IPage<TcmsyndromeConfig> getPage(@Param("tcmsyndromeConfigPageVO") TcmsyndromeConfigPageVO tcmsyndromeConfigPageVO);
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
+}

+ 7 - 0
cdssman-service/src/main/java/com/diagbot/service/impl/KlLibraryInfoServiceImpl.java

@@ -9,6 +9,7 @@ import com.diagbot.vo.KlLibraryInfoVO;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -25,4 +26,10 @@ public class KlLibraryInfoServiceImpl extends ServiceImpl<KlLibraryInfoMapper, K
     public List<KlLibraryInfo> getLib(KlLibraryInfoVO klLibraryInfoVO) {
         return baseMapper.getLib(klLibraryInfoVO);
     }
+
+    @Override
+    public Set<String> getLibraryNameAll() {
+        return baseMapper.getLibraryNameAll() ;
+    }
+
 }

+ 46 - 0
cdssman-service/src/main/java/com/diagbot/service/impl/TcmdiseaseConfigServiceImpl.java

@@ -0,0 +1,46 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.mapper.TcmdiseaseConfigMapper;
+import com.diagbot.service.TcmdiseaseConfigService;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmdiseaseConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 中医疾病映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@Service
+public class TcmdiseaseConfigServiceImpl extends ServiceImpl<TcmdiseaseConfigMapper, TcmdiseaseConfig> implements TcmdiseaseConfigService {
+
+    /**
+     * 分页查询
+     *
+     * @param tcmdiseaseConfigPageVO
+     * @return
+     */
+    @Override
+    public IPage<TcmdiseaseConfig> getPage(@Param("tcmdiseaseConfigPageVO") TcmdiseaseConfigPageVO tcmdiseaseConfigPageVO) {
+        return baseMapper.getPage(tcmdiseaseConfigPageVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    @Override
+    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
+        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
+    }
+}

+ 45 - 0
cdssman-service/src/main/java/com/diagbot/service/impl/TcmsyndromeConfigServiceImpl.java

@@ -0,0 +1,45 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.mapper.TcmsyndromeConfigMapper;
+import com.diagbot.service.TcmsyndromeConfigService;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.TcmsyndromeConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 中医证候映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@Service
+public class TcmsyndromeConfigServiceImpl extends ServiceImpl<TcmsyndromeConfigMapper, TcmsyndromeConfig> implements TcmsyndromeConfigService {
+    /**
+     * 分页查询
+     *
+     * @param tcmsyndromeConfigPageVO
+     * @return
+     */
+    @Override
+    public IPage<TcmsyndromeConfig> getPage(@Param("tcmsyndromeConfigPageVO") TcmsyndromeConfigPageVO tcmsyndromeConfigPageVO) {
+        return baseMapper.getPage(tcmsyndromeConfigPageVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    @Override
+    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
+        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
+    }
+}

+ 57 - 0
cdssman-service/src/main/java/com/diagbot/util/ExcelUtils.java

@@ -12,14 +12,17 @@ import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ExcelExportStylerUserImpl;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -224,4 +227,58 @@ public class ExcelUtils {
         }
         return list;
     }
+    public static <T> List<T> importExcelNew(MultipartFile file, Integer titleRows, Integer headerRows,
+                                             Class<T> pojoClass) {
+        if (file == null) {
+            return null;
+        }
+        InputStream inputStream = null;
+        try {
+            inputStream = file.getInputStream();
+            if (inputStream.available() > 512000) {
+                throw new CommonException(CommonErrorCode.FAIL, "文件最大支持500KB!");
+            }
+            Workbook wb = null;
+            String fileName = file.getOriginalFilename();
+            if (fileName.lastIndexOf(".") != -1) {
+                String type = fileName.substring(fileName.lastIndexOf("."));
+                if (type.equals(".xls")) {
+                    wb = new HSSFWorkbook(inputStream);
+                } else if (type.equals(".xlsx")) {
+                    wb = new XSSFWorkbook(inputStream);
+                }
+            }
+            if (wb != null) {
+                Sheet sheet = wb.getSheetAt(0);
+                int lastRowNum = sheet.getLastRowNum();
+                if (lastRowNum > 5000) {
+                    throw new CommonException(CommonErrorCode.FAIL, "最大支持5000行!");
+                }
+            } else {
+                throw new CommonException(CommonErrorCode.FAIL, "非excel文件无法解析!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, e.getMessage());
+            // return response.failure("化验excel文件解析出错!");
+        }
+
+        ImportParams params = new ImportParams();
+        params.setTitleRows(titleRows);
+        params.setHeadRows(headerRows);
+        List<T> list = null;
+        try {
+            list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params);
+        } catch (NoSuchElementException e) {
+            // throw new NormalException("excel文件不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "excel文件不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
+        } catch (Exception e) {
+            // throw new NormalException(e.getMessage());
+            System.out.println(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
+        }
+        return list;
+    }
 }

+ 49 - 0
cdssman-service/src/main/java/com/diagbot/vo/ImportConceptAllVO.java

@@ -0,0 +1,49 @@
+package com.diagbot.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.handler.inter.IExcelDataModel;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-04-13 14:38
+ */
+@Setter
+@Getter
+public class ImportConceptAllVO implements IExcelDataModel {
+    @Excel(name = "医学标准术语")
+    private String libName;
+    private String spell;
+    private Integer libType;
+    @Excel(name = "类型")
+    private String typeName;
+    @Excel(name = "同义词")
+    private String synonymName;
+    private Integer isConcept;
+    @Excel(name = "性别")
+    private Integer sexType;
+    private Integer isHasCommon;
+    @Excel(name = "最小年龄")
+    private Double minAge;
+    @Excel(name = "最大年龄")
+    private Double maxAge;
+
+    List<ImportConceptSubVO> synonymsList;
+    //行号
+    private Integer rowNum;
+    @Override
+    public Integer getRowNum() {
+        return rowNum;
+    }
+
+    @Override
+    public void setRowNum(Integer rowNum) {
+        this.rowNum=rowNum+1;//表头占一行
+
+    }
+}

+ 25 - 0
cdssman-service/src/main/java/com/diagbot/vo/ImportConceptSubVO.java

@@ -0,0 +1,25 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-04-13 14:51
+ */
+@Setter
+@Getter
+public class ImportConceptSubVO {
+    private Long libId;
+    private String libName;
+    private String spell;
+    private Integer libType;
+    private String typeName;
+    private String synonymName;
+    private Integer status;
+    private Integer isConcept;
+    private Integer sexType;
+    private Integer isHasCommon;
+    private String remark;
+}

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/vo/TcmdiseaseConfigListVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.TcmdiseaseConfig;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/13 15:20
+ */
+@Getter
+@Setter
+public class TcmdiseaseConfigListVO {
+    private List<TcmdiseaseConfig> tcmdiseaseConfigList;
+}

+ 38 - 0
cdssman-service/src/main/java/com/diagbot/vo/TcmdiseaseConfigPageVO.java

@@ -0,0 +1,38 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/13 15:21
+ */
+@Getter
+@Setter
+public class TcmdiseaseConfigPageVO extends Page {
+    /**
+     * 医院id
+     */
+    @NotNull(message = "请输入医院id")
+    private Long hospitalId;
+
+    /**
+     * his大项名称
+     */
+    private String hisName;
+
+    /**
+     * 标准名
+     */
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    private String uniqueCode;
+}

+ 18 - 0
cdssman-service/src/main/java/com/diagbot/vo/TcmsyndromeConfigListVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.TcmsyndromeConfig;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/14 9:28
+ */
+@Getter
+@Setter
+public class TcmsyndromeConfigListVO {
+    private List<TcmsyndromeConfig> tcmsyndromeConfigList;
+}

+ 38 - 0
cdssman-service/src/main/java/com/diagbot/vo/TcmsyndromeConfigPageVO.java

@@ -0,0 +1,38 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/5/14 9:28
+ */
+@Getter
+@Setter
+public class TcmsyndromeConfigPageVO extends Page {
+    /**
+     * 医院id
+     */
+    @NotNull(message = "请输入医院id")
+    private Long hospitalId;
+
+    /**
+     * his大项名称
+     */
+    private String hisName;
+
+    /**
+     * 标准名
+     */
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    private String uniqueCode;
+}

+ 27 - 0
cdssman-service/src/main/java/com/diagbot/vo/TermExcelVO.java

@@ -0,0 +1,27 @@
+package com.diagbot.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-31 13:15
+ */
+@Setter
+@Getter
+public class TermExcelVO {
+    @Excel(name = "医学标准术语")
+    private String libName;
+    @Excel(name = "同义词")
+    private String synonymName;
+    @Excel(name = "类型")
+    private String typeName;
+    @Excel(name = "性别")
+    private Integer sexType;
+    @Excel(name = "最小年龄")
+    private Double minAge;
+    @Excel(name = "最大年龄")
+    private Double maxAge;
+}

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/vo/TermImportExcalVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.messaging.handler.annotation.SendTo;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-31 15:10
+ */
+@Setter
+@Getter
+public class TermImportExcalVO {
+    private int sheetNum = 0;
+}

+ 219 - 0
cdssman-service/src/main/java/com/diagbot/web/TcmdiseaseConfigController.java

@@ -0,0 +1,219 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.facade.TcmdiseaseConfigFacade;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.TcmdiseaseConfigListVO;
+import com.diagbot.vo.TcmdiseaseConfigPageVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 中医疾病映射表 前端控制器
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@RestController
+@RequestMapping("/tran/tcmdiseaseConfig")
+@Api(value = "中医疾病公表映射API", tags = { "中医疾病公表映射API" })
+public class TcmdiseaseConfigController {
+    @Autowired
+    private TcmdiseaseConfigFacade tcmdiseaseConfigFacade;
+
+    /**
+     * 映射关系是否已存在
+     *
+     * @param tcmdiseaseConfig
+     * @return
+     */
+    @ApiOperation(value = "映射关系是否已存在[by:zhaops]", notes = "")
+    @PostMapping("/isExistRecord")
+    @SysLogger("isExistRecord")
+    public RespDTO<Boolean> isExistRecord(@RequestBody @Valid TcmdiseaseConfig tcmdiseaseConfig) {
+        Boolean data = tcmdiseaseConfigFacade.isExistRecord(tcmdiseaseConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 保存或修改映射关系
+     *
+     * @param tcmdiseaseConfig
+     * @return
+     */
+    @ApiOperation(value = "保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecord")
+    @SysLogger("saveOrUpdateRecord")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdateRecord(@RequestBody @Valid TcmdiseaseConfig tcmdiseaseConfig) {
+        Boolean data = tcmdiseaseConfigFacade.saveOrUpdateRecord(tcmdiseaseConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量保存或修改映射关系
+     *
+     * @param tcmdiseaseConfigListVO
+     * @return
+     */
+    @ApiOperation(value = "批量保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecords")
+    @SysLogger("saveOrUpdateRecords")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdateRecords(@RequestBody @Valid TcmdiseaseConfigListVO tcmdiseaseConfigListVO) {
+        Boolean data = tcmdiseaseConfigFacade.saveOrUpdateRecords(tcmdiseaseConfigListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 删除映射关系
+     *
+     * @param idVO
+     * @return
+     */
+    @ApiOperation(value = "删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecord")
+    @SysLogger("deleteRecord")
+    @Transactional
+    public RespDTO<Boolean> deleteRecord(@RequestBody @Valid IdVO idVO) {
+        Boolean data = tcmdiseaseConfigFacade.deleteRecord(idVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量删除映射关系
+     *
+     * @param idListVO
+     * @return
+     */
+    @ApiOperation(value = "批量删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecords")
+    @SysLogger("deleteRecords")
+    @Transactional
+    public RespDTO<Boolean> deleteRecords(@RequestBody @Valid IdListVO idListVO) {
+        Boolean data = tcmdiseaseConfigFacade.deleteRecords(idListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param tcmdiseaseConfigPageVO
+     * @return
+     */
+    @ApiOperation(value = "分页查询[by:zhaops]", notes = "")
+    @PostMapping("/getPage")
+    @SysLogger("getPage")
+    public RespDTO<TcmdiseaseConfig> getPage(@RequestBody @Valid TcmdiseaseConfigPageVO tcmdiseaseConfigPageVO) {
+        IPage<TcmdiseaseConfig> data = tcmdiseaseConfigFacade.getPage(tcmdiseaseConfigPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalId
+     * @return
+     */
+    @ApiOperation(value = "数据导入[by:zhaops]",
+            notes = "")
+    @PostMapping("/importExcel")
+    @SysLogger("importExcel")
+    @Transactional
+    public void importExcel(@RequestParam("file") MultipartFile file, @RequestParam("hospitalId") Long hospitalId) {
+        HospitalIdVO hospitalIdVO = new HospitalIdVO();
+        hospitalIdVO.setHospitalId(hospitalId);
+        tcmdiseaseConfigFacade.importExcel(file, hospitalIdVO);
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    @ApiOperation(value = "数据导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcel")
+    @SysLogger("exportExcel")
+    public void exportExcel(HttpServletResponse response, @RequestBody @Valid HospitalIdVO hospitalIdVO) {
+        tcmdiseaseConfigFacade.exportExcel(response, hospitalIdVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    @ApiOperation(value = "各医院映射关系数列表[by:zhaops]",
+            notes = "")
+    @PostMapping("/getRelationNumPage")
+    @SysLogger("getRelationNumPage")
+    public RespDTO<IPage<HosRelationNumDTO>> getRelationNumPage(@RequestBody @Valid HosRelationNumPageVO hosRelationNumPageVO) {
+        IPage<HosRelationNumDTO> data = tcmdiseaseConfigFacade.getRelationNumPage(hosRelationNumPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @return
+     */
+    @ApiOperation(value = "数据导入模板导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcelModule")
+    @SysLogger("exportExcelModule")
+    public void exportExcelModule(HttpServletResponse response) {
+        tcmdiseaseConfigFacade.exportExcelModule(response);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @return
+     */
+    @ApiOperation(value = "导入数据预匹配[by:zhaops]",
+            notes = "")
+    @PostMapping("/precDataMatch")
+    @SysLogger("precDataMatch")
+    public void precDataMatch(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
+        tcmdiseaseConfigFacade.precDataMatch(file, response);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @return
+     */
+    @ApiOperation(value = "导入数据验证[by:zhaops]",
+            notes = "")
+    @PostMapping("/dataVerify")
+    @SysLogger("dataVerify")
+    public RespDTO<Boolean> dataVerify(@RequestParam("file") MultipartFile file) {
+        Boolean data = tcmdiseaseConfigFacade.dataVerify(file);
+        return RespDTO.onSuc(data);
+    }
+}

+ 219 - 0
cdssman-service/src/main/java/com/diagbot/web/TcmsyndromeConfigController.java

@@ -0,0 +1,219 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.facade.TcmsyndromeConfigFacade;
+import com.diagbot.vo.HosRelationNumPageVO;
+import com.diagbot.vo.HospitalIdVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.TcmsyndromeConfigListVO;
+import com.diagbot.vo.TcmsyndromeConfigPageVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+
+/**
+ * <p>
+ * 中医证候映射表 前端控制器
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@RestController
+@RequestMapping("/tran/tcmsyndromeConfig")
+@Api(value = "中医证候公表映射API", tags = { "中医证候公表映射API" })
+public class TcmsyndromeConfigController {
+    @Autowired
+    private TcmsyndromeConfigFacade tcmsyndromeConfigFacade;
+
+    /**
+     * 映射关系是否已存在
+     *
+     * @param tcmsyndromeConfig
+     * @return
+     */
+    @ApiOperation(value = "映射关系是否已存在[by:zhaops]", notes = "")
+    @PostMapping("/isExistRecord")
+    @SysLogger("isExistRecord")
+    public RespDTO<Boolean> isExistRecord(@RequestBody @Valid TcmsyndromeConfig tcmsyndromeConfig) {
+        Boolean data = tcmsyndromeConfigFacade.isExistRecord(tcmsyndromeConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 保存或修改映射关系
+     *
+     * @param tcmsyndromeConfig
+     * @return
+     */
+    @ApiOperation(value = "保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecord")
+    @SysLogger("saveOrUpdateRecord")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdateRecord(@RequestBody @Valid TcmsyndromeConfig tcmsyndromeConfig) {
+        Boolean data = tcmsyndromeConfigFacade.saveOrUpdateRecord(tcmsyndromeConfig);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量保存或修改映射关系
+     *
+     * @param tcmsyndromeConfigListVO
+     * @return
+     */
+    @ApiOperation(value = "批量保存或修改映射关系[by:zhaops]", notes = "")
+    @PostMapping("/saveOrUpdateRecords")
+    @SysLogger("saveOrUpdateRecords")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdateRecords(@RequestBody @Valid TcmsyndromeConfigListVO tcmsyndromeConfigListVO) {
+        Boolean data = tcmsyndromeConfigFacade.saveOrUpdateRecords(tcmsyndromeConfigListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 删除映射关系
+     *
+     * @param idVO
+     * @return
+     */
+    @ApiOperation(value = "删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecord")
+    @SysLogger("deleteRecord")
+    @Transactional
+    public RespDTO<Boolean> deleteRecord(@RequestBody @Valid IdVO idVO) {
+        Boolean data = tcmsyndromeConfigFacade.deleteRecord(idVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 批量删除映射关系
+     *
+     * @param idListVO
+     * @return
+     */
+    @ApiOperation(value = "批量删除映射关系[by:zhaops]", notes = "")
+    @PostMapping("/deleteRecords")
+    @SysLogger("deleteRecords")
+    @Transactional
+    public RespDTO<Boolean> deleteRecords(@RequestBody @Valid IdListVO idListVO) {
+        Boolean data = tcmsyndromeConfigFacade.deleteRecords(idListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param tcmsyndromeConfigPageVO
+     * @return
+     */
+    @ApiOperation(value = "分页查询[by:zhaops]", notes = "")
+    @PostMapping("/getPage")
+    @SysLogger("getPage")
+    public RespDTO<TcmsyndromeConfig> getPage(@RequestBody @Valid TcmsyndromeConfigPageVO tcmsyndromeConfigPageVO) {
+        IPage<TcmsyndromeConfig> data = tcmsyndromeConfigFacade.getPage(tcmsyndromeConfigPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalId
+     * @return
+     */
+    @ApiOperation(value = "数据导入[by:zhaops]",
+            notes = "")
+    @PostMapping("/importExcel")
+    @SysLogger("importExcel")
+    @Transactional
+    public void importExcel(@RequestParam("file") MultipartFile file, @RequestParam("hospitalId") Long hospitalId) {
+        HospitalIdVO hospitalIdVO = new HospitalIdVO();
+        hospitalIdVO.setHospitalId(hospitalId);
+        tcmsyndromeConfigFacade.importExcel(file, hospitalIdVO);
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     * @param hospitalIdVO
+     */
+    @ApiOperation(value = "数据导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcel")
+    @SysLogger("exportExcel")
+    public void exportExcel(HttpServletResponse response, @RequestBody @Valid HospitalIdVO hospitalIdVO) {
+        tcmsyndromeConfigFacade.exportExcel(response, hospitalIdVO);
+    }
+
+    /**
+     * 各医院映射关系数列表
+     *
+     * @param hosRelationNumPageVO
+     * @return
+     */
+    @ApiOperation(value = "各医院映射关系数列表[by:zhaops]",
+            notes = "")
+    @PostMapping("/getRelationNumPage")
+    @SysLogger("getRelationNumPage")
+    public RespDTO<IPage<HosRelationNumDTO>> getRelationNumPage(@RequestBody @Valid HosRelationNumPageVO hosRelationNumPageVO) {
+        IPage<HosRelationNumDTO> data = tcmsyndromeConfigFacade.getRelationNumPage(hosRelationNumPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @return
+     */
+    @ApiOperation(value = "数据导入模板导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcelModule")
+    @SysLogger("exportExcelModule")
+    public void exportExcelModule(HttpServletResponse response) {
+        tcmsyndromeConfigFacade.exportExcelModule(response);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @return
+     */
+    @ApiOperation(value = "导入数据预匹配[by:zhaops]",
+            notes = "")
+    @PostMapping("/precDataMatch")
+    @SysLogger("precDataMatch")
+    public void precDataMatch(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
+        tcmsyndromeConfigFacade.precDataMatch(file, response);
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @return
+     */
+    @ApiOperation(value = "导入数据验证[by:zhaops]",
+            notes = "")
+    @PostMapping("/dataVerify")
+    @SysLogger("dataVerify")
+    public RespDTO<Boolean> dataVerify(@RequestParam("file") MultipartFile file) {
+        Boolean data = tcmsyndromeConfigFacade.dataVerify(file);
+        return RespDTO.onSuc(data);
+    }
+}

+ 48 - 0
cdssman-service/src/main/java/com/diagbot/web/TermImportController.java

@@ -0,0 +1,48 @@
+package com.diagbot.web;
+
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.facade.TermImportFacade;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ibatis.annotations.TypeDiscriminator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-31 11:47
+ */
+@RestController
+@RequestMapping("/importConcept")
+@Api(value = "医学标准术语导入导出[by:wangfeng]", tags = { "医学标准术语导入导出API" })
+@SuppressWarnings("unchecked")
+public class TermImportController {
+    @Autowired
+    TermImportFacade termImportFacade;
+
+    @ApiOperation(value = "医学标准术语模板导入[by:wangfeng]",
+            notes = "医学标准术语模板导出[by:wangfeng]")
+    @PostMapping("/exportTermExcel")
+    @SysLogger("exporTermExcel")
+    @DSTransactional
+    public void exporTermExcel(HttpServletResponse response, @RequestParam("termfile") MultipartFile file) {
+        termImportFacade.exporTermExcelAll(response, file);
+    }
+    @ApiOperation(value = "导出模板[by:wangfeng]",
+            notes = "导出模板[by:wangfeng]")
+    @PostMapping("/exportExcelTemplates")
+    @SysLogger("exportExcelTemplates")
+    public void exportExcelModule(HttpServletResponse response) {
+        termImportFacade.exportTemplateAll(response);
+    }
+
+}

+ 5 - 1
cdssman-service/src/main/resources/mapper/HospitalInfoMapper.xml

@@ -60,7 +60,9 @@
         g.num AS operationNum,
         h.num AS transfusionNum,
         i.num AS scaleNum,
-        j.num AS nurseNum
+        j.num AS nurseNum,
+        k.num AS tcmdiseaseNum,
+        l.num AS tcmsyndromeNum
         FROM
         tran_hospital_info a
         LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_lis_config WHERE is_deleted = 'N' GROUP BY hospital_id ) b ON a.id = b.hospital_id
@@ -72,6 +74,8 @@
         LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_transfusion_config WHERE is_deleted = 'N' GROUP BY hospital_id ) h ON a.id = h.hospital_id
         LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_scale_config WHERE is_deleted = 'N' GROUP BY hospital_id ) i ON a.id = i.hospital_id
         LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_nurse_config WHERE is_deleted = 'N' GROUP BY hospital_id ) j ON a.id = j.hospital_id
+        LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_tcmdisease_config WHERE is_deleted = 'N' GROUP BY hospital_id ) k ON a.id = k.hospital_id
+        LEFT JOIN ( SELECT hospital_id, count(*) AS num FROM tran_tcmsyndrome_config WHERE is_deleted = 'N' GROUP BY hospital_id ) l ON a.id = l.hospital_id
         WHERE
         a.is_deleted = 'N'
         <if test="hospitalInfoPageVO.name!=null and hospitalInfoPageVO.name!=''">

+ 16 - 12
cdssman-service/src/main/resources/mapper/KlLibraryInfoMapper.xml

@@ -4,18 +4,18 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.KlLibraryInfo">
-        <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="name" property="name" />
-        <result column="concept_id" property="conceptId" />
-        <result column="is_concept" property="isConcept" />
-        <result column="type_id" property="typeId" />
-        <result column="spell" property="spell" />
-        <result column="remark" property="remark" />
+        <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="name" property="name"/>
+        <result column="concept_id" property="conceptId"/>
+        <result column="is_concept" property="isConcept"/>
+        <result column="type_id" property="typeId"/>
+        <result column="spell" property="spell"/>
+        <result column="remark" property="remark"/>
     </resultMap>
 
     <select id="getLib"
@@ -32,4 +32,8 @@
             AND UPPER(a.name) LIKE CONCAT('%', UPPER(trim(#{synonymName})), '%')
         </if>
     </select>
+    <select id="getLibraryNameAll" resultType="java.lang.String">
+        SELECT CONCAT(b.name, '_', b.type_id) FROM kl_library_info b
+        WHERE b.is_deleted = 'N'
+    </select>
 </mapper>

+ 55 - 0
cdssman-service/src/main/resources/mapper/TcmdiseaseConfigMapper.xml

@@ -0,0 +1,55 @@
+<?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.TcmdiseaseConfigMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.TcmdiseaseConfig">
+        <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="hospital_id" property="hospitalId" />
+        <result column="his_name" property="hisName" />
+        <result column="unique_name" property="uniqueName" />
+        <result column="unique_code" property="uniqueCode" />
+    </resultMap>
+
+    <!-- 分页查询 -->
+    <select id="getPage" resultType="com.diagbot.entity.TcmdiseaseConfig">
+        select a.*
+        from tran_tcmdisease_config a
+        where a.is_deleted='N'
+        <if test="tcmdiseaseConfigPageVO.hospitalId!=null">
+            and a.hospital_id=#{tcmdiseaseConfigPageVO.hospitalId}
+        </if>
+        <if test="tcmdiseaseConfigPageVO.hisName!=null and tcmdiseaseConfigPageVO.hisName!=''">
+            and a.his_name like concat("%",#{tcmdiseaseConfigPageVO.hisName},"%")
+        </if>
+        <if test="tcmdiseaseConfigPageVO.uniqueName!=null and tcmdiseaseConfigPageVO.uniqueName!=''">
+            and a.unique_name like concat("%",#{tcmdiseaseConfigPageVO.uniqueName},"%")
+        </if>
+        <if test="tcmdiseaseConfigPageVO.uniqueCode!=null and tcmdiseaseConfigPageVO.uniqueCode!=''">
+            and a.unique_code like concat("%",#{tcmdiseaseConfigPageVO.uniqueCode},"%")
+        </if>
+        order by a.gmt_modified desc
+    </select>
+
+    <!-- 各医院映射关系数列表 -->
+    <select id="getRelationNumPage" resultType="com.diagbot.dto.HosRelationNumDTO">
+        SELECT
+        a.id,
+        a.NAME,
+        sum( b.id IS NOT NULL ) AS num
+        FROM
+        tran_hospital_info a
+        LEFT JOIN tran_tcmdisease_config b ON a.id = b.hospital_id
+        AND b.is_deleted = 'N'
+        WHERE
+        a.is_deleted = 'N'
+        GROUP BY
+        a.id
+    </select>
+
+</mapper>

+ 55 - 0
cdssman-service/src/main/resources/mapper/TcmsyndromeConfigMapper.xml

@@ -0,0 +1,55 @@
+<?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.TcmsyndromeConfigMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.TcmsyndromeConfig">
+        <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="hospital_id" property="hospitalId" />
+        <result column="his_name" property="hisName" />
+        <result column="unique_name" property="uniqueName" />
+        <result column="unique_code" property="uniqueCode" />
+    </resultMap>
+
+    <!-- 分页查询 -->
+    <select id="getPage" resultType="com.diagbot.entity.TcmsyndromeConfig">
+        select a.*
+        from tran_tcmsyndrome_config a
+        where a.is_deleted='N'
+        <if test="tcmsyndromeConfigPageVO.hospitalId!=null">
+            and a.hospital_id=#{tcmsyndromeConfigPageVO.hospitalId}
+        </if>
+        <if test="tcmsyndromeConfigPageVO.hisName!=null and tcmsyndromeConfigPageVO.hisName!=''">
+            and a.his_name like concat("%",#{tcmsyndromeConfigPageVO.hisName},"%")
+        </if>
+        <if test="tcmsyndromeConfigPageVO.uniqueName!=null and tcmsyndromeConfigPageVO.uniqueName!=''">
+            and a.unique_name like concat("%",#{tcmsyndromeConfigPageVO.uniqueName},"%")
+        </if>
+        <if test="tcmsyndromeConfigPageVO.uniqueCode!=null and tcmsyndromeConfigPageVO.uniqueCode!=''">
+            and a.unique_code like concat("%",#{tcmsyndromeConfigPageVO.uniqueCode},"%")
+        </if>
+        order by a.gmt_modified desc
+    </select>
+
+    <!-- 各医院映射关系数列表 -->
+    <select id="getRelationNumPage" resultType="com.diagbot.dto.HosRelationNumDTO">
+        SELECT
+        a.id,
+        a.NAME,
+        sum( b.id IS NOT NULL ) AS num
+        FROM
+        tran_hospital_info a
+        LEFT JOIN tran_tcmsyndrome_config b ON a.id = b.hospital_id
+        AND b.is_deleted = 'N'
+        WHERE
+        a.is_deleted = 'N'
+        GROUP BY
+        a.id
+    </select>
+
+</mapper>

+ 3 - 1
config-server/src/main/resources/shared/cdssman-service-dev.yml

@@ -121,10 +121,12 @@ mybatis-plus:
 hystrix.command.CdssCoreClient#getConceptNames(ConceptVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 #远程调用更新数据接口时间加长
 hystrix.command.CdssCoreClient#clearStandRuleDrugAll().execution.isolation.thread.timeoutInMilliseconds: 3600000
+#远程调用开单合理性接口时间加长
+hystrix.command.CdssCoreClient#indication(IndicationPushVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 imageUrl:
   prefix: http://192.168.2.236:82

+ 4 - 1
config-server/src/main/resources/shared/cdssman-service-local.yml

@@ -120,10 +120,13 @@ mybatis-plus:
 hystrix.command.CdssCoreClient#getConceptNames(ConceptVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 #远程调用更新数据接口时间加长
 hystrix.command.CdssCoreClient#clearStandRuleDrugAll().execution.isolation.thread.timeoutInMilliseconds: 3600000
+#远程调用开单合理性接口时间加长
+hystrix.command.CdssCoreClient#indication(IndicationPushVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
+
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 imageUrl:
   prefix: http://192.168.2.236:82

+ 3 - 1
config-server/src/main/resources/shared/cdssman-service-pre.yml

@@ -121,10 +121,12 @@ mybatis-plus:
 hystrix.command.CdssCoreClient#getConceptNames(ConceptVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 #远程调用更新数据接口时间加长
 hystrix.command.CdssCoreClient#clearStandRuleDrugAll().execution.isolation.thread.timeoutInMilliseconds: 3600000
+#远程调用开单合理性接口时间加长
+hystrix.command.CdssCoreClient#indication(IndicationPushVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 imageUrl:
   prefix: http://192.168.2.121:82

+ 3 - 1
config-server/src/main/resources/shared/cdssman-service-pro.yml

@@ -121,10 +121,12 @@ mybatis-plus:
 hystrix.command.CdssCoreClient#getConceptNames(ConceptVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 #远程调用更新数据接口时间加长
 hystrix.command.CdssCoreClient#clearStandRuleDrugAll().execution.isolation.thread.timeoutInMilliseconds: 3600000
+#远程调用开单合理性接口时间加长
+hystrix.command.CdssCoreClient#indication(IndicationPushVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 imageUrl:
   prefix: http://192.168.2.122:82

+ 3 - 1
config-server/src/main/resources/shared/cdssman-service-test.yml

@@ -121,10 +121,12 @@ mybatis-plus:
 hystrix.command.CdssCoreClient#getConceptNames(ConceptVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 #远程调用更新数据接口时间加长
 hystrix.command.CdssCoreClient#clearStandRuleDrugAll().execution.isolation.thread.timeoutInMilliseconds: 3600000
+#远程调用开单合理性接口时间加长
+hystrix.command.CdssCoreClient#indication(IndicationPushVO).execution.isolation.thread.timeoutInMilliseconds: 3600000
 
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
-  thread-number: 12
+  thread-number: 200
 
 imageUrl:
   prefix: http://192.168.2.241:82