Sfoglia il codice sorgente

Merge branch 'develop' into dev/termImport_20210531

gaodm 4 anni fa
parent
commit
1b2e3ffd2b
100 ha cambiato i file con 6838 aggiunte e 925 eliminazioni
  1. 8 2
      cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java
  2. 2 1
      cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java
  3. 2 1
      cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java
  4. 2 0
      cdssman-service/src/main/java/com/diagbot/dto/ConceptMappingDTO.java
  5. 17 0
      cdssman-service/src/main/java/com/diagbot/dto/IndexBatchDTO.java
  6. 27 10
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptAllDTO.java
  7. 35 0
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptSimDTO.java
  8. 151 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDiseaseDTO.java
  9. 26 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugDTO.java
  10. 26 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugExportDTO.java
  11. 95 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugMappingDTO.java
  12. 135 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugRegisterDTO.java
  13. 78 0
      cdssman-service/src/main/java/com/diagbot/dto/KlLisDTO.java
  14. 33 0
      cdssman-service/src/main/java/com/diagbot/dto/KlOperationDTO.java
  15. 63 0
      cdssman-service/src/main/java/com/diagbot/dto/KlPacsDTO.java
  16. 89 0
      cdssman-service/src/main/java/com/diagbot/dto/KlSymptomDTO.java
  17. 27 0
      cdssman-service/src/main/java/com/diagbot/dto/KlTcmDiseaseDTO.java
  18. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/KlTcmSyndromeDTO.java
  19. 40 0
      cdssman-service/src/main/java/com/diagbot/dto/KlVitalResultDTO.java
  20. 8 0
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java
  21. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java
  22. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java
  23. 20 0
      cdssman-service/src/main/java/com/diagbot/entity/CommonParam.java
  24. 13 7
      cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java
  25. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java
  26. 14 2
      cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java
  27. 19 0
      cdssman-service/src/main/java/com/diagbot/entity/Ex.java
  28. 118 97
      cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java
  29. 73 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDrugMapping.java
  30. 301 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDrugRegister.java
  31. 34 78
      cdssman-service/src/main/java/com/diagbot/entity/KlLis.java
  32. 75 0
      cdssman-service/src/main/java/com/diagbot/entity/KlOperation.java
  33. 128 0
      cdssman-service/src/main/java/com/diagbot/entity/KlPacs.java
  34. 118 0
      cdssman-service/src/main/java/com/diagbot/entity/KlSymptom.java
  35. 69 0
      cdssman-service/src/main/java/com/diagbot/entity/KlTcmDisease.java
  36. 68 0
      cdssman-service/src/main/java/com/diagbot/entity/KlTcmSyndrome.java
  37. 75 0
      cdssman-service/src/main/java/com/diagbot/entity/KlVitalResult.java
  38. 14 2
      cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java
  39. 9 0
      cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java
  40. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java
  41. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java
  42. 9 0
      cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java
  43. 208 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java
  44. 208 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java
  45. 13 2
      cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java
  46. 3 1
      cdssman-service/src/main/java/com/diagbot/enums/ConceptTypeEnum.java
  47. 50 0
      cdssman-service/src/main/java/com/diagbot/enums/InsertOrUpdateEnum.java
  48. 5 0
      cdssman-service/src/main/java/com/diagbot/enums/LexiconEnum.java
  49. 6 1
      cdssman-service/src/main/java/com/diagbot/enums/RelationLibTypeEnum.java
  50. 67 60
      cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java
  51. 72 59
      cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java
  52. 68 57
      cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java
  53. 46 1
      cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java
  54. 183 44
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java
  55. 64 57
      cdssman-service/src/main/java/com/diagbot/facade/KlDiseaseFacade.java
  56. 47 49
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugFacade.java
  57. 51 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugMappingFacade.java
  58. 284 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugRegisterFacade.java
  59. 44 1
      cdssman-service/src/main/java/com/diagbot/facade/KlLisFacade.java
  60. 62 0
      cdssman-service/src/main/java/com/diagbot/facade/KlOperationFacade.java
  61. 70 0
      cdssman-service/src/main/java/com/diagbot/facade/KlPacsFacade.java
  62. 185 0
      cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java
  63. 95 0
      cdssman-service/src/main/java/com/diagbot/facade/KlSymptomFacade.java
  64. 57 0
      cdssman-service/src/main/java/com/diagbot/facade/KlTcmDiseaseFacade.java
  65. 57 0
      cdssman-service/src/main/java/com/diagbot/facade/KlTcmSyndromeFacade.java
  66. 63 0
      cdssman-service/src/main/java/com/diagbot/facade/KlVitalResFacade.java
  67. 88 81
      cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java
  68. 67 58
      cdssman-service/src/main/java/com/diagbot/facade/NurseConfigFacade.java
  69. 67 58
      cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java
  70. 67 58
      cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.java
  71. 2 1
      cdssman-service/src/main/java/com/diagbot/facade/PlanFacade.java
  72. 13 12
      cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java
  73. 67 58
      cdssman-service/src/main/java/com/diagbot/facade/ScaleConfigFacade.java
  74. 597 0
      cdssman-service/src/main/java/com/diagbot/facade/TcmdiseaseConfigFacade.java
  75. 597 0
      cdssman-service/src/main/java/com/diagbot/facade/TcmsyndromeConfigFacade.java
  76. 67 58
      cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.java
  77. 47 0
      cdssman-service/src/main/java/com/diagbot/facade/UserClientFacade.java
  78. 619 0
      cdssman-service/src/main/java/com/diagbot/facade/XLSXCovertCSVReader.java
  79. 5 1
      cdssman-service/src/main/java/com/diagbot/mapper/KlConceptMapper.java
  80. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlDrugMappingMapper.java
  81. 32 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlDrugRegisterMapper.java
  82. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlOperationMapper.java
  83. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlPacsMapper.java
  84. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlSymptomMapper.java
  85. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlTcmDiseaseMapper.java
  86. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlTcmSyndromeMapper.java
  87. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlVitalResultMapper.java
  88. 35 0
      cdssman-service/src/main/java/com/diagbot/mapper/TcmdiseaseConfigMapper.java
  89. 35 0
      cdssman-service/src/main/java/com/diagbot/mapper/TcmsyndromeConfigMapper.java
  90. 5 2
      cdssman-service/src/main/java/com/diagbot/service/KlConceptService.java
  91. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlDrugMappingService.java
  92. 32 0
      cdssman-service/src/main/java/com/diagbot/service/KlDrugRegisterService.java
  93. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlOperationService.java
  94. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlPacsService.java
  95. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlSymptomService.java
  96. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlTcmDiseaseService.java
  97. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlTcmSyndromeService.java
  98. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlVitalResultService.java
  99. 35 0
      cdssman-service/src/main/java/com/diagbot/service/TcmdiseaseConfigService.java
  100. 0 0
      cdssman-service/src/main/java/com/diagbot/service/TcmsyndromeConfigService.java

+ 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 - 1
cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -6,6 +6,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.client.hystrix.CdssCoreHystrix;
 import com.diagbot.dto.DiagnosesFindDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
@@ -62,7 +63,7 @@ public interface CdssCoreClient {
      * @return
      */
     @PostMapping("/retrieval/getConceptNames")
-    RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
+    RespDTO<List<IndexBatchDTO>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
 
     /**
      * 化验大项、化验小项、辅检、诊断、药品、手术等检索

+ 2 - 1
cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.DiagnosesFindDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
@@ -64,7 +65,7 @@ public class CdssCoreHystrix implements CdssCoreClient {
      * @return
      */
     @Override
-    public RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
+    public RespDTO<List<IndexBatchDTO>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
         log.error("【hystrix】调用{}异常", "getConceptNames");
         return null;
     }

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

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

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

+ 27 - 10
cdssman-service/src/main/java/com/diagbot/dto/KlConceptAllDTO.java

@@ -1,7 +1,5 @@
 package com.diagbot.dto;
 
-import com.diagbot.vo.KlConceptSaveSubVO;
-import io.swagger.models.auth.In;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -28,14 +26,33 @@ public class KlConceptAllDTO {
     private Integer isHasCommon;
     private Double minAge;
     private Double maxAge;
-    private Double minVal;
-    private Double maxVal;
-    private String unit;
-    private Integer scopeType;
-    private String  icdCode;
     private String remark;
-    private Integer drug;
-    private Long deptId;
-    private String deptName;
     private List<KlConceptAllSubDTO> klConceptSub;
+
+    // 疾病扩展信息
+    private KlDiseaseDTO klDiseaseDTO;
+
+    // 药品扩展信息
+    private KlDrugDTO klDrugDTO;
+
+    // 症状扩展信息
+    private KlSymptomDTO klSymptomDTO;
+
+    //化验扩展信息
+    private KlLisDTO klLisDTO;
+
+    //辅检扩展信息
+    private KlPacsDTO klPacsDTO;
+
+    //手术扩展信息
+    private KlOperationDTO klOperationDTO;
+
+    //体征结果扩展信息
+    private KlVitalResultDTO klVitalResultDTO;
+
+    // 中医疾病扩展信息
+    private KlTcmDiseaseDTO klTcmDiseaseDTO;
+
+    // 中医证候扩展信息
+    private KlTcmSyndromeDTO klTcmSyndromeDTO;
 }

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

@@ -0,0 +1,35 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 概念表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-03-01
+ */
+@Data
+public class KlConceptSimDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键,概念id
+     */
+    private Long id;
+
+    /**
+     * 概念名称(冗余)
+     */
+    private String libName;
+
+    /**
+     * 概念词性type(冗余)
+     */
+    private Integer libType;
+
+}

+ 151 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDiseaseDTO.java

@@ -0,0 +1,151 @@
+package com.diagbot.dto;
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 疾病表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDiseaseDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 科室概念id
+     */
+    private Long deptId;
+
+    /**
+     * ICD10编号
+     */
+    private String icd10Code;
+
+    /**
+     * 病程
+     */
+    private String course;
+
+    /**
+     * 诱因
+     */
+    private String inducement;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 危险因素
+     */
+    private String hazard;
+
+    /**
+     * 治愈性
+     */
+    private String healing;
+
+    /**
+     * 危害性
+     */
+    private String pernicious;
+
+    /**
+     * 临床分类
+     */
+    private String clinicType;
+
+    /**
+     * 好发地区
+     */
+    private String vulArea;
+
+    /**
+     * 好发人群
+     */
+    private String vulCrowd;
+
+    /**
+     * 发病率
+     */
+    private Double incidence;
+
+    /**
+     * 是否传染(0:否,1:是)
+     */
+    private Integer isInfect;
+
+    /**
+     * 并发症
+     */
+    private String complication;
+
+    /**
+     * 病因
+     */
+    private String pathogeny;
+
+    /**
+     * 疾病分型
+     */
+    private String disType;
+
+    /**
+     * 中西医疾病(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 是否常见病(0:否,1:是)
+     */
+    private Integer isCommonDis;
+
+    /**
+     * 是否遗传(0:否,1:是)
+     */
+    private Integer isHeredity;
+
+    /**
+     * 简称
+     */
+    private String nameSimple;
+
+    /**
+     * 英文简称
+     */
+    private String enNameSimple;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
+    // 科室列表
+    private List<KlConceptSimDTO> deptList = Lists.newLinkedList();
+
+    // 部位列表
+    private List<KlConceptSimDTO> partList = Lists.newLinkedList();
+
+    // 疾病系统分类列表
+    private List<KlConceptSimDTO> systemTypeList = Lists.newLinkedList();
+
+}

+ 26 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDrugDTO.java

@@ -0,0 +1,26 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 药品
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    // 药品类别(0:西药,1:中成药)
+    private Integer drug;
+
+    // 通用药品名关联注册药品
+    // private List<KlDrugMappingDTO> klDrugMappingDTOList = Lists.newLinkedList();
+
+}

+ 26 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDrugExportDTO.java

@@ -0,0 +1,26 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 药品通用名导出
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugExportDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 注册名称
+     */
+    @Excel(name = "药品通用名", orderNum = "1")
+    private String name;
+}

+ 95 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDrugMappingDTO.java

@@ -0,0 +1,95 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 药品注册表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugMappingDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 药品代码
+     */
+    private String drugCode;
+
+    /**
+     * 注册名称
+     */
+    private String name;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 商品名称
+     */
+    private String tradeName;
+
+    /**
+     * 药品剂型
+     */
+    private String form;
+
+    /**
+     * 注册规格
+     */
+    private String specification;
+
+    /**
+     * 最小包装数量
+     */
+    private String minPackQuantity;
+
+    /**
+     * 最小包装单位
+     */
+    private String minPackUnit;
+
+    /**
+     * 药品企业
+     */
+    private String company;
+
+    /**
+     * 批准文号
+     */
+    private String approval;
+
+    /**
+     * 药品本位码
+     */
+    private String standardCode;
+
+    /**
+     * 医保类型
+     */
+    private String insuranceType;
+
+    /**
+     * 医保备注
+     */
+    private String insuranceRemrk;
+
+    /**
+     * 药品类别
+     */
+    private String drugType;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 135 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDrugRegisterDTO.java

@@ -0,0 +1,135 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 药品注册表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugRegisterDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 药品代码
+     */
+    private String drugCode;
+
+    /**
+     * 注册名称
+     */
+    private String name;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 商品名称
+     */
+    private String tradeName;
+
+    /**
+     * 药品剂型
+     */
+    private String form;
+
+    /**
+     * 注册规格
+     */
+    private String specification;
+
+    /**
+     * 最小包装数量
+     */
+    private String minPackQuantity;
+
+    /**
+     * 最小包装单位
+     */
+    private String minPackUnit;
+
+    /**
+     * 药品企业
+     */
+    private String company;
+
+    /**
+     * 批准文号
+     */
+    private String approval;
+
+    /**
+     * 药品本位码
+     */
+    private String standardCode;
+
+    /**
+     * 医保类型
+     */
+    private String insuranceType;
+
+    /**
+     * 医保备注
+     */
+    private String insuranceRemrk;
+
+    /**
+     * 药品类别
+     */
+    private String drugType;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 药品通用名
+     */
+    private Long drugConceptId;
+
+    /**
+     * 药品通用名
+     */
+    private String drugName;
+}

+ 78 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlLisDTO.java

@@ -0,0 +1,78 @@
+package com.diagbot.dto;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+;
+
+/**
+ * <p>
+ * 化验表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlLisDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 最小值
+     */
+    private Double minValue;
+
+    /**
+     * 最大值
+     */
+    private Double maxValue;
+
+    /**
+     * 类型(0:范围内;1:范围外)
+     */
+    private Integer type;
+
+    /**
+     * 单位概念id
+     */
+
+    private String unit;
+
+    /**
+     * 检查标本
+     */
+    private String checkSpecimen;
+
+    /**
+     * 检查方法
+     */
+    private String checkMethod;
+
+    /**
+     * 影响因素
+     */
+    private String influenceFac;
+
+    /**
+     * 临床意义
+     */
+    private String clinicalSig;
+
+    /**
+     * 定性(阴、阳性)
+     */
+    private String qualitative;
+
+    /**
+     * 所属类别
+     */
+    private String category;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+}

+ 33 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlOperationDTO.java

@@ -0,0 +1,33 @@
+package com.diagbot.dto;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+;
+
+/**
+ * <p>
+ * 手术表
+ * </p>
+ *
+ * @author kwz
+ * @since 2021-05-11
+ */
+@Data
+public class KlOperationDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 手术级别(0,1,2,3,4)
+     */
+    private Integer operationLevel;
+
+    /**
+     * 手术操作码
+     */
+    private String operationCode;
+
+}

+ 63 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlPacsDTO.java

@@ -0,0 +1,63 @@
+package com.diagbot.dto;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+;
+
+/**
+ * <p>
+ * 辅检表
+ * </p>
+ *
+ * @author kwz
+ * @since 2021-05-11
+ */
+@Data
+public class KlPacsDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 检查方法
+     */
+    private String checkMethod;
+
+    /**
+     * 项目定义
+     */
+    private String definition;
+
+    /**
+     * 检查目的
+     */
+    private String checkObjective;
+
+    /**
+     * 检查技术
+     */
+    private String checkSkillful;
+
+    /**
+     * 禁忌症和局限性
+     */
+    private String condLimit;
+
+    /**
+     * 适应症
+     */
+    private String interventional;
+
+    /**
+     * 危急标识(0:不危急,1:危急)
+     */
+    private Integer emergencySign;
+
+    /**
+     * 检查前准备
+     */
+    private String checkPrepare;
+
+}

+ 89 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlSymptomDTO.java

@@ -0,0 +1,89 @@
+package com.diagbot.dto;
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 症状扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlSymptomDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 阳性症状(0:否,1:是)
+     */
+    private Integer isPositive;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 定义
+     */
+    private String definition;
+
+    /**
+     * 中西医症状(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 缓解因素
+     */
+    private String mitigatingFac;
+
+    /**
+     * 加重因素
+     */
+    private String aggravateFac;
+
+    /**
+     * 症状起因
+     */
+    private String cause;
+
+    /**
+     * 常见疾病
+     */
+    private String commonDis;
+
+    /**
+     * 预防措施
+     */
+    private String preMeasures;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 通俗解释
+     */
+    private String commonExplain;
+
+    // 科室列表
+    private List<KlConceptSimDTO> deptList = Lists.newLinkedList();
+
+    // 部位列表
+    private List<KlConceptSimDTO> partList = Lists.newLinkedList();
+
+    // 常见伴随症状列表
+    private List<KlConceptSimDTO> conSymptomList = Lists.newLinkedList();
+
+    // 性质列表
+    private List<KlConceptSimDTO> natureList = Lists.newLinkedList();
+
+}

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

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+;
+
+/**
+ * <p>
+ * 中医疾病
+ * </p>
+ *
+ * @author kwz
+ * @since 2021-05-11
+ */
+@Data
+public class KlTcmDiseaseDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编码
+     */
+    private String code;
+}

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

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+/**
+ * <p>
+ * 中医证候
+ * </p>
+ *
+ * @author kwz
+ * @since 2021-05-11
+ */
+@Data
+public class KlTcmSyndromeDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编码
+     */
+    private String code;
+}

+ 40 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlVitalResultDTO.java

@@ -0,0 +1,40 @@
+package com.diagbot.dto;
+
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+;
+
+/**
+ * <p>
+ * 手术表
+ * </p>
+ *
+ * @author kwz
+ * @since 2021-05-11
+ */
+@Data
+public class KlVitalResultDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 不适宜人群
+     */
+    private String suitablePopNo;
+
+    /**
+     * 操作方法
+     */
+    private String checkMethod;
+
+    // 科室列表
+    private List<KlConceptSimDTO> deptList = Lists.newLinkedList();
+
+    // 部位列表
+    private List<KlConceptSimDTO> partList = Lists.newLinkedList();
+}

+ 8 - 0
cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -53,4 +53,12 @@ public class RetrievalDTO {
      * 护理
      */
     private List<NurseInfoDTO> nursenames;
+    /**
+     * 中医诊断
+     */
+    private List<TcmdiseaseInfoDTO> tcmdiseaseNames;
+    /**
+     * 中医证候
+     */
+    private List<TcmsyndromeInfoDTO> tcmsyndromeNames;
 }

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

+ 20 - 0
cdssman-service/src/main/java/com/diagbot/entity/CommonParam.java

@@ -0,0 +1,20 @@
+package com.diagbot.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @Description:
+ * @Author: ztg
+ * @Date: 2018/12/14 14:15
+ */
+@Getter
+@Setter
+public class CommonParam {
+    private String person;     //操作人
+    private Date now;          //当前时间
+    private Long conceptId;    //conceptId
+    private int insertOrUpdate;//更新或新增标识
+}

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

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/entity/Ex.java

@@ -0,0 +1,19 @@
+package com.diagbot.entity;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/5/21 13:49
+ */
+@Target(value = { ElementType.TYPE, ElementType.FIELD })
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Ex {
+    public String name();
+}

+ 118 - 97
cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java

@@ -2,6 +2,7 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -11,9 +12,10 @@ import java.util.Date;
  * 疾病表
  * </p>
  *
- * @author wangfeng
- * @since 2021-03-01
+ * @author zhoutg
+ * @since 2021-05-11
  */
+@Data
 public class KlDisease implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -54,109 +56,128 @@ public class KlDisease implements Serializable {
      */
     private Long conceptId;
 
+    /**
+     * 科室概念id
+     */
     private Long deptId;
+
     /**
      * ICD10编号
      */
     private String icd10Code;
 
+    /**
+     * 病程
+     */
+    private String course;
+
+    /**
+     * 诱因
+     */
+    private String inducement;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 危险因素
+     */
+    private String hazard;
+
+    /**
+     * 治愈性
+     */
+    private String healing;
+
+    /**
+     * 危害性
+     */
+    private String pernicious;
+
+    /**
+     * 临床分类
+     */
+    private String clinicType;
+
+    /**
+     * 好发地区
+     */
+    private String vulArea;
+
+    /**
+     * 好发人群
+     */
+    private String vulCrowd;
+
+    /**
+     * 发病率
+     */
+    private Double incidence;
+
+    /**
+     * 是否传染(0:否,1:是)
+     */
+    private Integer isInfect;
+
+    /**
+     * 并发症
+     */
+    private String complication;
+
+    /**
+     * 病因
+     */
+    private String pathogeny;
+
+    /**
+     * 疾病分型
+     */
+    private String disType;
+
+    /**
+     * 中西医疾病(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 是否常见病(0:否,1:是)
+     */
+    private Integer isCommonDis;
+
+    /**
+     * 是否遗传(0:否,1:是)
+     */
+    private Integer isHeredity;
+
+    /**
+     * 简称
+     */
+    private String nameSimple;
+
+    /**
+     * 英文简称
+     */
+    private String enNameSimple;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 肿瘤细胞类型
+     */
+    private String tumorCellType;
+
+    /**
+     * 形态学分类代码
+     */
+    private String morphology;
+
     /**
      * 备注
      */
     private String remark;
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    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 getConceptId() {
-        return conceptId;
-    }
-
-    public void setConceptId(Long conceptId) {
-        this.conceptId = conceptId;
-    }
-
-    public String getIcd10Code() {
-        return icd10Code;
-    }
-
-    public void setIcd10Code(String icd10Code) {
-        this.icd10Code = icd10Code;
-    }
-
-    public String getRemark() {
-        return remark;
-    }
-
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
-
-    @Override
-    public String toString() {
-        return "KlDisease{" +
-                "id=" + id +
-                ", isDeleted=" + isDeleted +
-                ", gmtCreate=" + gmtCreate +
-                ", gmtModified=" + gmtModified +
-                ", creator=" + creator +
-                ", modifier=" + modifier +
-                ", conceptId=" + conceptId +
-                ", icd10Code=" + icd10Code +
-                ", remark=" + remark +
-                "}";
-    }
 }

+ 73 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlDrugMapping.java

@@ -0,0 +1,73 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 药品通用名和注册名映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugMapping 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;
+
+    /**
+     * 药品通用名conceptId
+     */
+    private Long drugConcept;
+
+    /**
+     * 药品注册名Id
+     */
+    private Long registerId;
+
+    /**
+     * 顺序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 301 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlDrugRegister.java

@@ -0,0 +1,301 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 药品注册表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public class KlDrugRegister 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;
+
+    /**
+     * 药品代码
+     */
+    private String drugCode;
+
+    /**
+     * 注册名称
+     */
+    private String name;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 商品名称
+     */
+    private String tradeName;
+
+    /**
+     * 药品剂型
+     */
+    private String form;
+
+    /**
+     * 注册规格
+     */
+    private String specification;
+
+    /**
+     * 最小包装数量
+     */
+    private String minPackQuantity;
+
+    /**
+     * 最小包装单位
+     */
+    private String minPackUnit;
+
+    /**
+     * 药品企业
+     */
+    private String company;
+
+    /**
+     * 批准文号
+     */
+    private String approval;
+
+    /**
+     * 药品本位码
+     */
+    private String standardCode;
+
+    /**
+     * 医保类型
+     */
+    private String insuranceType;
+
+    /**
+     * 医保备注
+     */
+    private String insuranceRemrk;
+
+    /**
+     * 药品类别
+     */
+    private String drugType;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public 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 String getDrugCode() {
+        return drugCode;
+    }
+
+    public void setDrugCode(String drugCode) {
+        this.drugCode = drugCode;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getEnName() {
+        return enName;
+    }
+
+    public void setEnName(String enName) {
+        this.enName = enName;
+    }
+    public String getTradeName() {
+        return tradeName;
+    }
+
+    public void setTradeName(String tradeName) {
+        this.tradeName = tradeName;
+    }
+    public String getForm() {
+        return form;
+    }
+
+    public void setForm(String form) {
+        this.form = form;
+    }
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+    public String getMinPackQuantity() {
+        return minPackQuantity;
+    }
+
+    public void setMinPackQuantity(String minPackQuantity) {
+        this.minPackQuantity = minPackQuantity;
+    }
+    public String getMinPackUnit() {
+        return minPackUnit;
+    }
+
+    public void setMinPackUnit(String minPackUnit) {
+        this.minPackUnit = minPackUnit;
+    }
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+    public String getApproval() {
+        return approval;
+    }
+
+    public void setApproval(String approval) {
+        this.approval = approval;
+    }
+    public String getStandardCode() {
+        return standardCode;
+    }
+
+    public void setStandardCode(String standardCode) {
+        this.standardCode = standardCode;
+    }
+    public String getInsuranceType() {
+        return insuranceType;
+    }
+
+    public void setInsuranceType(String insuranceType) {
+        this.insuranceType = insuranceType;
+    }
+    public String getInsuranceRemrk() {
+        return insuranceRemrk;
+    }
+
+    public void setInsuranceRemrk(String insuranceRemrk) {
+        this.insuranceRemrk = insuranceRemrk;
+    }
+    public String getDrugType() {
+        return drugType;
+    }
+
+    public void setDrugType(String drugType) {
+        this.drugType = drugType;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDrugRegister{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", drugCode=" + drugCode +
+            ", name=" + name +
+            ", enName=" + enName +
+            ", tradeName=" + tradeName +
+            ", form=" + form +
+            ", specification=" + specification +
+            ", minPackQuantity=" + minPackQuantity +
+            ", minPackUnit=" + minPackUnit +
+            ", company=" + company +
+            ", approval=" + approval +
+            ", standardCode=" + standardCode +
+            ", insuranceType=" + insuranceType +
+            ", insuranceRemrk=" + insuranceRemrk +
+            ", drugType=" + drugType +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 34 - 78
cdssman-service/src/main/java/com/diagbot/entity/KlLis.java

@@ -2,6 +2,8 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -14,6 +16,8 @@ import java.util.Date;
  * @author wangfeng
  * @since 2021-03-01
  */
+@Setter
+@Getter
 public class KlLis implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -76,94 +80,46 @@ public class KlLis implements Serializable {
     private String unit;
 
     /**
-     * 备注
+     * 检查标本
      */
-    private String remark;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
+    private String checkSpecimen;
 
-    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;
-    }
+    /**
+     * 检查方法
+     */
+    private String checkMethod;
 
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
+    /**
+     * 影响因素
+     */
+    private String influenceFac;
 
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public Long getConceptId() {
-        return conceptId;
-    }
+    /**
+     * 临床意义
+     */
+    private String clinicalSig;
 
-    public void setConceptId(Long conceptId) {
-        this.conceptId = conceptId;
-    }
-    public Double getMinValue() {
-        return minValue;
-    }
+    /**
+     * 定性(阴、阳性)
+     */
+    private String qualitative;
 
-    public void setMinValue(Double minValue) {
-        this.minValue = minValue;
-    }
-    public Double getMaxValue() {
-        return maxValue;
-    }
+    /**
+     * 所属类别
+     */
+    private String category;
 
-    public void setMaxValue(Double maxValue) {
-        this.maxValue = maxValue;
-    }
-    public Integer getType() {
-        return type;
-    }
+    /**
+     * 英文名称
+     */
+    private String enName;
 
-    public void setType(Integer type) {
-        this.type = type;
-    }
-    public String getUnit() {
-        return unit;
-    }
+    /**
+     * 备注
+     */
+    private String remark;
 
-    public void setUnit(String unit) {
-        this.unit = unit;
-    }
-    public String getRemark() {
-        return remark;
-    }
 
-    public void setRemark(String remark) {
-        this.remark = remark;
-    }
 
     @Override
     public String toString() {

+ 75 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlOperation.java

@@ -0,0 +1,75 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 手术扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlOperation 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 conceptId;
+
+    /**
+     * 手术级别(0,1,2,3,4)
+     */
+    private Integer operationLevel;
+
+    /**
+     * 手术操作码
+     */
+    private String operationCode;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 128 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlPacs.java

@@ -0,0 +1,128 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 辅检扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlPacs 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 conceptId;
+
+    /**
+     * 检查方法
+     */
+    private String checkMethod;
+
+    /**
+     * 项目定义
+     */
+    private String definition;
+
+    /**
+     * 检查目的
+     */
+    private String checkObjective;
+
+    /**
+     * 检查技术
+     */
+    private String checkSkillful;
+
+    /**
+     * 禁忌症和局限性
+     */
+    private String condLimit;
+
+    /**
+     * 适应症
+     */
+    private String interventional;
+
+    /**
+     * 危急标识(0:不危急,1:危急)
+     */
+    private Integer emergencySign;
+
+    /**
+     * 检查前准备
+     */
+    private String checkPrepare;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+
+    @Override
+    public String toString() {
+        return "KlPacs{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", checkMethod=" + checkMethod +
+            ", definition=" + definition +
+            ", checkObjective=" + checkObjective +
+            ", checkSkillful=" + checkSkillful +
+            ", condLimit=" + condLimit +
+            ", interventional=" + interventional +
+            ", emergencySign=" + emergencySign +
+            ", checkPrepare=" + checkPrepare +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 118 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlSymptom.java

@@ -0,0 +1,118 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 症状扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlSymptom 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 conceptId;
+
+    /**
+     * 阳性症状(0:否,1:是)
+     */
+    private Integer isPositive;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 定义
+     */
+    private String definition;
+
+    /**
+     * 中西医症状(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 缓解因素
+     */
+    private String mitigatingFac;
+
+    /**
+     * 加重因素
+     */
+    private String aggravateFac;
+
+    /**
+     * 症状起因
+     */
+    private String cause;
+
+    /**
+     * 常见疾病
+     */
+    private String commonDis;
+
+    /**
+     * 预防措施
+     */
+    private String preMeasures;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 通俗解释
+     */
+    private String commonExplain;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 69 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlTcmDisease.java

@@ -0,0 +1,69 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 中医疾病表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-28
+ */
+@Data
+public class KlTcmDisease 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 conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 68 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlTcmSyndrome.java

@@ -0,0 +1,68 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 中医证候表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-28
+ */
+@Data
+public class KlTcmSyndrome 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 conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

+ 75 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlVitalResult.java

@@ -0,0 +1,75 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 体征结果扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlVitalResult 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 conceptId;
+
+    /**
+     * 不适宜人群
+     */
+    private String suitablePopNo;
+
+    /**
+     * 操作方法
+     */
+    private String checkMethod;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

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

+ 3 - 1
cdssman-service/src/main/java/com/diagbot/enums/ConceptTypeEnum.java

@@ -18,7 +18,9 @@ public enum ConceptTypeEnum implements KeyedNamed {
     Dept(7, "科室"),
     Transfusion(8, "输血"),
     Scale(10, "量表"),
-    Nurse(11, "护理");
+    Nurse(11, "护理"),
+    Tcmdisease(12,"中医疾病"),
+    Tcmsyndrome(13,"中医证候");
 
     @Setter
     private int key;

+ 50 - 0
cdssman-service/src/main/java/com/diagbot/enums/InsertOrUpdateEnum.java

@@ -0,0 +1,50 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description: TODO
+ * @date 2018年11月21日 下午2:31:42
+ */
+public enum InsertOrUpdateEnum implements KeyedNamed {
+    Insert(1, "新增"),
+    Update(2, "修改");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    InsertOrUpdateEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static InsertOrUpdateEnum getEnum(int key) {
+        for (InsertOrUpdateEnum item : InsertOrUpdateEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        InsertOrUpdateEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

+ 5 - 0
cdssman-service/src/main/java/com/diagbot/enums/LexiconEnum.java

@@ -36,6 +36,10 @@ public enum LexiconEnum implements KeyedNamed {
     Nurse(123,"护理"),
     Scale(124,"量表"),
     Unit(125,"单位"),
+    Nature(126,"性质"),
+    Tcmdisease(127, "中医疾病"),
+    Tcmsyndrome(128, "中医证候"),
+    Inducement(129, "诱因"),
     ICD10Class(300,"ICD10疾病类别"),
     MedChemClass(301,"药品化学物质类别"),
     MedZhiLiaoClass(302,"药品治疗学类别"),
@@ -43,6 +47,7 @@ public enum LexiconEnum implements KeyedNamed {
     MedJiePouClass(304,"药品解剖学类别"),
     SymptomClass(305,"症状类别"),
     OperationClass(306,"手术和操作类别"),
+    DisSysType(307,"疾病系统分类"),
     ICD10ClassNode(400,"ICD10疾病类别根节点"),
     DeptDiseaseNode(401,"科室疾病类别根节点"),
     MedChemClassNode(402,"药品化学物质类别根节点"),

+ 6 - 1
cdssman-service/src/main/java/com/diagbot/enums/RelationLibTypeEnum.java

@@ -20,7 +20,12 @@ public enum RelationLibTypeEnum implements KeyedNamed {
     disOperator(507, "106"),
     disDifferentDis(508, "100"),
     disLiangbiao(509,"124"),
-    disNurse(510,"123");
+    disNurse(510,"123"),
+    relationDept(511,"115"),
+    relationPart(512,"122"),
+    relationSystem(513,"307"),
+    relationAccSymptom(514,"103"),
+    relationNature(515,"126");
 
 
     @Setter

+ 67 - 60
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;
@@ -247,9 +248,6 @@ public class DeptConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<DeptConfig> deptConfigList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
         if (ListUtil.isNotEmpty(deptConfigList)) {
-            deptConfigList.forEach(deptConfig -> {
-                deptConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(deptConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -271,15 +269,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,61 +307,63 @@ 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);
+                }
+                if (deptConfig.getIsDeleted() == null) {
+                    deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = deptConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Dept.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 < deptConfigList.size(); i++) {
+                if (!names.contains(deptConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                deptConfig.setCreator(userId);
-                deptConfig.setGmtCreate(now);
             }
-            if (deptConfig.getIsDeleted() == null) {
-                deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = deptConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Dept.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < deptConfigList.size(); i++) {
-            if (!names.contains(deptConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
-            }
+            //重复数据过滤
+            deptConfigList = deptConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            deptConfigService.saveOrUpdateBatch(deptConfigList);
         }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
-
-        //重复数据过滤
-        deptConfigList = deptConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        deptConfigService.saveOrUpdateBatch(deptConfigList);
         return true;
     }
 
@@ -477,6 +476,14 @@ public class DeptConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<DeptConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(DeptConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -496,9 +503,9 @@ public class DeptConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Dept.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (DeptConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

+ 72 - 59
cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java

@@ -4,6 +4,7 @@ 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.DiseaseConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -224,10 +225,8 @@ public class DiseaseConfigFacade {
      */
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<DiseaseConfig> diseaseConfigList = ExcelUtils.importExcel(file, 0, 1, DiseaseConfig.class);
+
         if (ListUtil.isNotEmpty(diseaseConfigList)) {
-            diseaseConfigList.forEach(diseaseConfig -> {
-                diseaseConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(diseaseConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -249,13 +248,14 @@ public class DiseaseConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         diseaseConfigList = diseaseConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getIcdCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(DiseaseConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(diseaseConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        diseaseConfigList.forEach(diseaseConfig -> {
+            diseaseConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < diseaseConfigList.size(); i++) {
             if (StringUtil.isBlank(diseaseConfigList.get(i).getHisName())
@@ -284,61 +284,63 @@ public class DiseaseConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        diseaseConfigList.forEach(diseaseConfig -> {
-            diseaseConfig.setHospitalId(Long.valueOf(hospitalId));
-            diseaseConfig.setModifier(userId);
-            diseaseConfig.setGmtModified(now);
-            if (diseaseConfig.getId() == null) {
-                if (configMap.containsKey(diseaseConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(diseaseConfig.getHisName()).get(diseaseConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(diseaseConfig.getHisName()).get(diseaseConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            diseaseConfigList.forEach(diseaseConfig -> {
+                diseaseConfig.setHospitalId(Long.valueOf(hospitalId));
+                diseaseConfig.setModifier(userId);
+                diseaseConfig.setGmtModified(now);
+                if (diseaseConfig.getId() == null) {
+                    if (configMap.containsKey(diseaseConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(diseaseConfig.getHisName()).get(diseaseConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(diseaseConfig.getHisName()).get(diseaseConfig.getUniqueName()));
+                    }
+                    diseaseConfig.setCreator(userId);
+                    diseaseConfig.setGmtCreate(now);
+                }
+                if (diseaseConfig.getIsDeleted() == null) {
+                    diseaseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = diseaseConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Disease.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 < diseaseConfigList.size(); i++) {
+                if (!names.contains(diseaseConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                diseaseConfig.setCreator(userId);
-                diseaseConfig.setGmtCreate(now);
             }
-            if (diseaseConfig.getIsDeleted() == null) {
-                diseaseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = diseaseConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Disease.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < diseaseConfigList.size(); i++) {
-            if (!names.contains(diseaseConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
-            }
+            //重复数据过滤
+            diseaseConfigList = diseaseConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            diseaseConfigService.saveOrUpdateBatch(diseaseConfigList);
         }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
-
-        //重复数据过滤
-        diseaseConfigList = diseaseConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        diseaseConfigService.saveOrUpdateBatch(diseaseConfigList);
         return true;
     }
 
@@ -489,6 +491,14 @@ public class DiseaseConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<DiseaseConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(DiseaseConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -508,16 +518,19 @@ public class DiseaseConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Disease.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<IndexBatchDTO> uniqueNameList = respDTO.data;
+        Map<String, IndexBatchDTO> uniqueMap = uniqueNameList.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
+        //List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (DiseaseConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {
                     List<DiseaseConfig> items = allMap.get(originItem.getHisName());
                     boolean flag = false;
                     for (DiseaseConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
+                        if (uniqueMap.containsKey(item.getUniqueName())) {
+                            item.setIcdCode(uniqueMap.get(item.getUniqueName()).getCode());
                             retList.add(item);
                             flag = true;
                         }

+ 68 - 57
cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.HosRelationNumDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DrugConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -264,9 +265,6 @@ public class DrugConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
         if (ListUtil.isNotEmpty(drugConfigList)) {
-            drugConfigList.forEach(drugConfig -> {
-                drugConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(drugConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -288,14 +286,14 @@ public class DrugConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         drugConfigList = drugConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getForm())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(DrugConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(drugConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        drugConfigList.forEach(drugConfig -> {
+            drugConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         //药品剂型
         List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
@@ -352,59 +350,61 @@ public class DrugConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Map<String, List<Long>>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
-        drugConfigList.forEach(drugConfig -> {
-            drugConfig.setHospitalId(Long.valueOf(hospitalId));
-            drugConfig.setModifier(userId);
-            drugConfig.setGmtModified(now);
-            String form = StringUtil.isBlank(drugConfig.getForm()) ? "" : drugConfig.getForm();
-            if (drugConfig.getId() == null) {
-                if (configMap.get(drugConfig.getHisName()) != null
-                        && configMap.get(drugConfig.getHisName()).get(form) != null
-                        && ListUtil.isNotEmpty(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, Map<String, List<Long>>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
+            drugConfigList.forEach(drugConfig -> {
+                drugConfig.setHospitalId(Long.valueOf(hospitalId));
+                drugConfig.setModifier(userId);
+                drugConfig.setGmtModified(now);
+                String form = StringUtil.isBlank(drugConfig.getForm()) ? "" : drugConfig.getForm();
+                if (drugConfig.getId() == null) {
+                    if (configMap.get(drugConfig.getHisName()) != null
+                            && configMap.get(drugConfig.getHisName()).get(form) != null
+                            && ListUtil.isNotEmpty(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
+                    }
+                    drugConfig.setCreator(userId);
+                    drugConfig.setGmtCreate(now);
                 }
-                drugConfig.setCreator(userId);
-                drugConfig.setGmtCreate(now);
-            }
-            if (drugConfig.getIsDeleted() == null) {
-                drugConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
+                if (drugConfig.getIsDeleted() == null) {
+                    drugConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Drug.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < drugConfigList.size(); i++) {
-            if (!names.contains(drugConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Drug.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 < drugConfigList.size(); i++) {
+                if (!names.contains(drugConfigList.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("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
 
-        //重复数据过滤
-        drugConfigList = drugConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
+            //重复数据过滤
+            drugConfigList = drugConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
 
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        drugConfigService.saveOrUpdateBatch(drugConfigList);
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            drugConfigService.saveOrUpdateBatch(drugConfigList);
+        }
         return true;
     }
 
@@ -742,6 +742,17 @@ public class DrugConfigFacade {
                 .distinct()
                 .collect(Collectors.toList());
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(DrugConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -761,9 +772,9 @@ public class DrugConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Drug.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (DrugConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

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

+ 183 - 44
cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -8,12 +8,15 @@ import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.KlConceptAllDTO;
 import com.diagbot.dto.KlConceptAllSubDTO;
 import com.diagbot.dto.KlConceptInfoDTO;
+import com.diagbot.dto.KlConceptSimDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.CommonParam;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.entity.KlConceptStatic;
 import com.diagbot.entity.KlDiagnose;
 import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.entity.KlDrugMapping;
 import com.diagbot.entity.KlLexicon;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.entity.KlRelation;
@@ -21,16 +24,19 @@ import com.diagbot.entity.KlRule;
 import com.diagbot.entity.KlRuleBase;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.RelationLibTypeEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KlConceptServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptRelationVO;
 import com.diagbot.vo.GetAllForRelationVO;
 import com.diagbot.vo.KlConceptAllVO;
 import com.diagbot.vo.KlConceptClearVO;
@@ -40,14 +46,15 @@ import com.diagbot.vo.KlConceptSaveSubVO;
 import com.diagbot.vo.KlConceptSaveVO;
 import com.diagbot.vo.KlLibraryInfoVO;
 import com.diagbot.vo.SearchConceptVO;
+import com.diagbot.vo.SearchVO;
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -86,6 +93,20 @@ public class KlConceptFacade extends KlConceptServiceImpl {
     KlDiagnoseBaseFacade klDiagnoseBaseFacade;
     @Autowired
     KlDrugFacade klDrugFacade;
+    @Autowired
+    KlSymptomFacade klSymptomFacade;
+    @Autowired
+    KlPacsFacade klPacsFacade;
+    @Autowired
+    KlOperationFacade klOperationFacade;
+    @Autowired
+    KlVitalResFacade klVitalResFacade;
+    @Autowired
+    KlDrugMappingFacade klDrugMappingFacade;
+    @Autowired
+    KlTcmDiseaseFacade klTcmDiseaseFacade;
+    @Autowired
+    KlTcmSyndromeFacade klTcmSyndromeFacade;
 
     /**
      * @param klConceptInfoVO
@@ -146,21 +167,14 @@ public class KlConceptFacade extends KlConceptServiceImpl {
      * @return
      */
     public KlConceptAllDTO getConceptAlls(KlConceptAllVO klConceptAllVO) {
-        //获取科室;
-        QueryWrapper<KlConcept> klConceptQuer = new QueryWrapper<>();
-        klConceptQuer.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("lib_type", LexiconEnum.Dept.getKey());
-        List<KlConcept> klConceptsDept = list(klConceptQuer);
-        Map<Long, String> deptMap = klConceptsDept.stream().collect(HashMap::new,
-                (m, v) -> m.put(v.getId(), v.getLibName()), HashMap::putAll);
+        Long conceptId = klConceptAllVO.getConceptId();
         List<KlConceptAllDTO> conceptAll = getConceptAll(klConceptAllVO);
+
         KlConceptAllDTO klConceptAll = new KlConceptAllDTO();
         List<KlConceptAllSubDTO> klConceptSub = new ArrayList<>();
         if (ListUtil.isNotEmpty(conceptAll)) {
             for (KlConceptAllDTO data : conceptAll) {
                 if (data.getIsConcept().equals(1)) {
-                    if (null != data.getDeptId()) {
-                        data.setDeptName(deptMap.get(data.getDeptId()));
-                    }
                     BeanUtil.copyProperties(data, klConceptAll);
                 } else {
                     KlConceptAllSubDTO klConceptAllSubDTO = new KlConceptAllSubDTO();
@@ -170,6 +184,43 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             }
         }
         klConceptAll.setKlConceptSub(klConceptSub);
+
+        LexiconEnum lexiconEnum = LexiconEnum.getEnum(klConceptAllVO.getLibType());
+        if (lexiconEnum != null) {
+            ConceptRelationVO conceptRelationVO = new ConceptRelationVO();
+            conceptRelationVO.setConceptId(conceptId);
+            switch (lexiconEnum) {
+                case Disease: // 疾病扩展 kl_disease, kl_relation,kl_relation_order
+                    klDiseaseFacade.getKlDisease(conceptId, klConceptAll);
+                    break;
+                case Symptom: // 症状扩展 kl_symptom, kl_relation,kl_relation_order
+                    klSymptomFacade.getKlSymptom(conceptId, klConceptAll);
+                    break;
+                case Medicine: // 药品扩展 kl_drug
+                    klDrugFacade.getKlDrug(conceptId, klConceptAll);
+                    break;
+                case LisName:
+                case LisSubName: // 化验扩展 kl_lis
+                    klLisFacade.getKlLis(conceptId, klConceptAll);
+                    break;
+                case PacsName:
+                case PacsSubName: // 辅检扩展 kl_pacs
+                    klPacsFacade.getKlPacs(conceptId, klConceptAll);
+                    break;
+                case Operation: // 手术扩展 kl_operation
+                    klOperationFacade.getKlOperation(conceptId, klConceptAll);
+                    break;
+                case VitalResult: //体征结果扩展 kl_vital_result, kl_relation,kl_relation_order
+                    klVitalResFacade.getKlVitalResult(conceptId, klConceptAll);
+                    break;
+                case Tcmdisease: // 中医疾病
+                    klTcmDiseaseFacade.getKlTcmDisease(conceptId, klConceptAll);
+                    break;
+                case Tcmsyndrome: // 中医证候
+                    klTcmSyndromeFacade.getKlTcmSyndrome(conceptId, klConceptAll);
+                    break;
+            }
+        }
         return klConceptAll;
     }
 
@@ -179,6 +230,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
      */
     public Boolean saveConceptInfo(KlConceptSaveVO klConceptSaveVO) {
         Date now = DateUtil.now();
+
+        CommonParam commonParam = initCommonParam();
         boolean res = false;
         // 校验名称是否相同
         checkConcept(klConceptSaveVO);
@@ -191,6 +244,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         klLibraryInfoFacade.checkLibraryInfoData(paesubVO);
         //先判断是新加的,还是修改
         if (null != klConceptSaveVO.getConceptId() && null != klConceptSaveVO.getLibId()) {
+            commonParam.setConceptId(klConceptSaveVO.getConceptId());
             //更新标准词
             res = updateAll(klConceptSaveVO);
             //更新同义词
@@ -237,11 +291,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             klConceptPare.setGmtCreate(now);
             klConceptPare.setGmtModified(now);
             res = save(klConceptPare);
+            commonParam.setConceptId(klConceptPare.getId()); // 赋值conceptId
             if (res) {
                 //2.再把标准词d的conceptId保存到kl_library_info表 生成libId,
                 Long conceptId = klConceptPare.getId();
                 KlLibraryInfo klLibraryInfoSub = new KlLibraryInfo();
-                klLibraryInfoSub.setConceptId(conceptId);
+                klLibraryInfoSub.setConceptId(commonParam.getConceptId());
                 klLibraryInfoSub.setName(klConceptSaveVO.getLibName());
                 klLibraryInfoSub.setSpell(klConceptSaveVO.getSpell());
                 klLibraryInfoSub.setTypeId(klConceptSaveVO.getLibType());
@@ -274,32 +329,53 @@ public class KlConceptFacade extends KlConceptServiceImpl {
                 conceptCommon.setGmtModified(now);
                 klConceptCommonFacade.save(conceptCommon);
             }
-            //更新kl_disease
-            if (null != klConceptSaveVO.getIcdCode()) {
-                res = klDiseaseFacade.saveAll(klConceptPare, klConceptSaveVO);
-            }
-
-            //更新kl_lis
-            if (null != klConceptSaveVO.getScopeType()) {
-                res = klLisFacade.saveAll(klConceptPare, klConceptSaveVO);
-            }
-            if (null != klConceptSaveVO.getDrug()) {
-                res = klDrugFacade.saveAll(klConceptPare, klConceptSaveVO);
-            }
             //增加同义词
             List<KlConceptSaveSubVO> klConceptSub = klConceptSaveVO.getKlConceptSub();
             if (ListUtil.isNotEmpty(klConceptSub)) {
                 for (KlConceptSaveSubVO subVO : klConceptSub) {
                     if (subVO.getLibId() == null) {
-
                         klLibraryInfoFacade.checkLibraryInfoData(subVO);
-
                         res = klLibraryInfoFacade.savekLibraryInfoData(klConceptPare.getId(), subVO);
                     }
                 }
             }
+        }
 
-
+        LexiconEnum lexiconEnum = LexiconEnum.getEnum(klConceptSaveVO.getLibType().intValue());
+        if (lexiconEnum != null) {
+            switch (lexiconEnum) {
+                case Disease: // 疾病扩展 kl_disease, kl_relation,kl_relation_order
+                    res = klDiseaseFacade.saveAll(commonParam, klConceptSaveVO.getKlDiseaseVO());
+                    klRelationFacade.saveKlDisease(commonParam, klConceptSaveVO.getKlDiseaseVO());
+                    break;
+                case Symptom: // 症状扩展 kl_symptom, kl_relation,kl_relation_order
+                    klSymptomFacade.saveAll(commonParam, klConceptSaveVO.getKlSymptomVO());
+                    klRelationFacade.saveKlSymptom(commonParam, klConceptSaveVO.getKlSymptomVO());
+                    break;
+                case Medicine: //  药品通用名扩展 kl_drug
+                    klDrugFacade.saveKlDrug(commonParam, klConceptSaveVO.getKlDrugVO());
+                    break;
+                case LisName: // 实验室检查套餐
+                case LisSubName: // 实验室检查子项目
+                    klLisFacade.saveAll(commonParam, klConceptSaveVO.getKlLisVO());
+                    break;
+                case PacsSubName: // 辅助检查子项目
+                case PacsName: // 辅助检查项目
+                    klPacsFacade.saveAll(commonParam, klConceptSaveVO.getKlPacsVO());
+                    break;
+                case Operation: // 手术和操作
+                    klOperationFacade.saveAll(commonParam, klConceptSaveVO.getKlOperationVO());
+                    break;
+                case VitalResult: // 体征结果
+                    klRelationFacade.saveKlVitalRes(commonParam, klConceptSaveVO.getKlVitalResultVO());
+                    break;
+                case Tcmdisease: // 中医疾病
+                    klTcmDiseaseFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmDiseaseVO());
+                    break;
+                case Tcmsyndrome: // 中医证候
+                    klTcmSyndromeFacade.saveAll(commonParam, klConceptSaveVO.getKlTcmSyndromeVO());
+                    break;
+            }
         }
         return res;
     }
@@ -330,18 +406,6 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             //当是疾病的时候才保存性别和年龄大小的数据
             res = klConceptCommonFacade.saveOrUpdateAll(klConceptSaveVO);
         }
-        //更新kl_disease
-        if (null != klConceptSaveVO.getIcdCode()) {
-            //当icd10编码不为空
-            res = klDiseaseFacade.saveOrUpdateAll(klConceptSaveVO);
-        }
-        //更新kl_lis
-        if (null != klConceptSaveVO.getScopeType()) {
-            res = klLisFacade.saveOrUpdateAll(klConceptSaveVO);
-        }
-        if (null != klConceptSaveVO.getDrug()) {
-            klDrugFacade.saveOrUpdateAll(klConceptSaveVO);
-        }
         return res;
     }
 
@@ -379,6 +443,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         return retList;
     }
 
+    /**
+     * 根据类型和名称查找术语,名称和类型不能为空
+     *
+     * @param searchConceptVO
+     * @return
+     */
     public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
         List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
         String name = searchConceptVO.getName();
@@ -405,6 +475,34 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         return getAllForRelationDTOS;
     }
 
+    /**
+     * 根据类型和名称查找术语,名称可为空
+     *
+     * @param SearchVO
+     * @return
+     */
+    public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchVO SearchVO) {
+        List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
+        List<Long> excludedConceptIds = SearchVO.getExcludedConceptIds();
+        List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("lib_type", SearchVO.getLibType())
+                .eq("status", StatusEnum.Enable.getKey())
+                .like(StringUtil.isNotBlank(SearchVO.getName()), "lib_name", SearchVO.getName())
+                .notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds));
+        if (ListUtil.isNotEmpty(conceptList)) {
+            getAllForRelationDTOS = conceptList.stream().map(x -> {
+                GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
+                getAllForRelationDTO.setConceptNameType(x.getLibName());
+                getAllForRelationDTO.setConceptName(x.getLibName());
+                getAllForRelationDTO.setConceptId(x.getId());
+                getAllForRelationDTO.setLibType(x.getLibType());
+                return getAllForRelationDTO;
+            }).collect(Collectors.toList());
+        }
+        return getAllForRelationDTOS;
+    }
+
     /**
      * 筛选符合类型的概念id
      *
@@ -451,11 +549,17 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             }
 
             //kl_relation
-            int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>().eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("start_id", klConceptSatarOrdisaVO.getConceptId()).or()
-                    .eq("end_id", klConceptSatarOrdisaVO.getConceptId()));
+            List<Integer> notRelationList = Lists.newArrayList(RelationLibTypeEnum.relationDept.getKey(),
+                    RelationLibTypeEnum.relationPart.getKey(), RelationLibTypeEnum.relationSystem.getKey(),
+                    RelationLibTypeEnum.relationAccSymptom.getKey(), RelationLibTypeEnum.relationNature.getKey());
+            int relationsum = klRelationFacade.count(new QueryWrapper<KlRelation>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .and(r -> r.eq("end_id", klConceptSatarOrdisaVO.getConceptId())
+                            .or(r1 -> r1.eq("start_id", klConceptSatarOrdisaVO.getConceptId()).notIn("relation_id", notRelationList))
+                    )
+            );
             if (relationsum > 0) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关存在关系!");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与树形结构或疾病相关或扩展信息存在关系!");
             }
             //kl_rule
             int rulesum = klRuleFacade.count(new QueryWrapper<KlRule>().eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -481,12 +585,19 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             if (diagnoseBasesum > 0) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
             }
+            //kl_drug_mapping
+            int drugMappingSum = klDrugMappingFacade.count(new QueryWrapper<KlDrugMapping>().eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("drug_concept", klConceptSatarOrdisaVO.getConceptId()));
+            if (drugMappingSum > 0) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与注册药品存在关系!");
+            }
         }
         UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
         klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("id", klConceptSatarOrdisaVO.getConceptId())
-                .set("status", status).set("gmt_modified", now)
-                .set("modifier", UserUtils.getCurrentPrincipleID());
+                .set("status", status).set("gmt_modified", now);
+        // .set("modifier", UserUtils.getCurrentPrincipleID()
+        // );
         return this.update(klLibraryUpdate);
 
     }
@@ -526,4 +637,32 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "医学标准术语名称已存在同义词");
         }
     }
+
+    /**
+     * 根据conceptId和relationId获取关联数据(通用方法)
+     *
+     * @param conceptRelationVO
+     * @return
+     */
+    public Map<Integer, List<KlConceptSimDTO>> getRelationConceptFac(ConceptRelationVO conceptRelationVO) {
+        Map<Integer, List<KlConceptSimDTO>> map = Maps.newLinkedHashMap();
+        List<KlConceptSimDTO> relationConcept = this.getRelationConcept(conceptRelationVO);
+        if (ListUtil.isNotEmpty(relationConcept)) {
+            map = EntityUtil.makeEntityListMap(relationConcept, "libType");
+        }
+        return map;
+    }
+
+    /**
+     * 初始化参数
+     *
+     * @return
+     */
+    public CommonParam initCommonParam() {
+        CommonParam param = new CommonParam();
+        String person = UserUtils.getCurrentPrincipleID();
+        param.setNow(DateUtil.now());
+        param.setPerson(person);
+        return param;
+    }
 }

+ 64 - 57
cdssman-service/src/main/java/com/diagbot/facade/KlDiseaseFacade.java

@@ -1,7 +1,6 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.DiseaseAllDetailDTO;
@@ -9,37 +8,41 @@ import com.diagbot.dto.DiseaseDetailDTO;
 import com.diagbot.dto.DiseasePageDTO;
 import com.diagbot.dto.DiseaseSubDetailDTO;
 import com.diagbot.dto.DiseaseTreeDetailDTO;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlDiseaseDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.CommonParam;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlDisease;
 import com.diagbot.entity.KlLexiconRelationship;
 import com.diagbot.enums.DiseaseRelationTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RelationLibTypeEnum;
 import com.diagbot.service.impl.KlDiseaseServiceImpl;
-import com.diagbot.util.DateUtil;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
-import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptRelationVO;
 import com.diagbot.vo.DiseaseDeleteVO;
 import com.diagbot.vo.DiseasePageVO;
 import com.diagbot.vo.GetDiseaseDetailVO;
-import com.diagbot.vo.KlConceptSaveVO;
+import com.diagbot.vo.KlDiseaseVO;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+
 /**
  * @author wangfeng
  * @Description:
@@ -172,58 +175,62 @@ public class KlDiseaseFacade extends KlDiseaseServiceImpl {
         return diseaseTreeDetailDTO;
     }
 
-
-    public boolean saveOrUpdateAll(KlConceptSaveVO klConceptSaveVO) {
-        Date now = DateUtil.now();
-        boolean res = false;
-        if (null != klConceptSaveVO.getConceptId()) {
-            //校验
-            int countLis = this.count(new QueryWrapper<KlDisease>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("concept_id", klConceptSaveVO.getConceptId()));
-            if (countLis > 0) {
-                UpdateWrapper<KlDisease> klDiseaseQuerySub = new UpdateWrapper<>();
-                klDiseaseQuerySub.eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("concept_id", klConceptSaveVO.getConceptId())
-                        .set("gmt_modified", now)
-                        .set("modifier", UserUtils.getCurrentPrincipleID())
-                        .set("dept_id", klConceptSaveVO.getDeptId())
-                        .set(StringUtil.isNotBlank(klConceptSaveVO.getIcdCode()), "icd10_code", klConceptSaveVO.getIcdCode());
-                res = this.update(new KlDisease(), klDiseaseQuerySub);
-            } else {
-                KlDisease kllDiseaseSub = new KlDisease();
-                kllDiseaseSub.setConceptId(klConceptSaveVO.getConceptId());
-                kllDiseaseSub.setGmtModified(now);
-                kllDiseaseSub.setDeptId(klConceptSaveVO.getDeptId());
-                kllDiseaseSub.setModifier(UserUtils.getCurrentPrincipleID());
-                kllDiseaseSub.setIcd10Code(klConceptSaveVO.getIcdCode());
-                res = this.save(kllDiseaseSub);
-            }
-
-        } else {
-            KlDisease kllDiseaseSub = new KlDisease();
-            kllDiseaseSub.setConceptId(klConceptSaveVO.getConceptId());
-            kllDiseaseSub.setGmtModified(now);
-            kllDiseaseSub.setDeptId(klConceptSaveVO.getDeptId());
-            kllDiseaseSub.setModifier(UserUtils.getCurrentPrincipleID());
-            kllDiseaseSub.setIcd10Code(klConceptSaveVO.getIcdCode());
-            res = this.save(kllDiseaseSub);
-        }
-        return res;
+    /**
+     * 保存疾病扩展表
+     *
+     * @param commonParam
+     * @param klDiseaseVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlDiseaseVO klDiseaseVO) {
+        // 先删除疾病扩展表
+        this.remove(new QueryWrapper<KlDisease>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlDisease klDisease = new KlDisease();
+        BeanUtil.copyProperties(klDiseaseVO, klDisease);
+        klDisease.setConceptId(commonParam.getConceptId());
+        klDisease.setGmtModified(commonParam.getNow());
+        klDisease.setGmtCreate(commonParam.getNow());
+        klDisease.setCreator(commonParam.getPerson());
+        klDisease.setModifier(commonParam.getPerson());
+        return this.save(klDisease);
     }
 
-    public boolean saveAll(KlConcept klConceptPare, KlConceptSaveVO klConceptSaveVO) {
-        Date now = DateUtil.now();
-        KlDisease kllDiseaseSub = new KlDisease();
-        kllDiseaseSub.setConceptId(klConceptPare.getId());
-        kllDiseaseSub.setGmtModified(now);
-        kllDiseaseSub.setDeptId(klConceptSaveVO.getDeptId());
-        kllDiseaseSub.setIcd10Code(klConceptSaveVO.getIcdCode());
-        kllDiseaseSub.setCreator(UserUtils.getCurrentPrincipleID());
-        kllDiseaseSub.setModifier(UserUtils.getCurrentPrincipleID());
-        kllDiseaseSub.setGmtCreate(now);
-        kllDiseaseSub.setGmtModified(now);
-        return this.save(kllDiseaseSub);
+    /**
+     * 疾病扩展获取
+     *
+     * @param conceptId
+     * @param klConceptAllDTO
+     */
+    public void getKlDisease(Long conceptId, KlConceptAllDTO klConceptAllDTO) {
+        KlDisease klDisease = this.getOne(new QueryWrapper<KlDisease>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (klDisease == null) {
+            return;
+        }
+        KlDiseaseDTO klDiseaseDTO = new KlDiseaseDTO();
+        BeanUtil.copyProperties(klDisease, klDiseaseDTO);
+
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey(),
+                RelationLibTypeEnum.relationSystem.getKey()
+        );
+        ConceptRelationVO conceptRelationVO = new ConceptRelationVO();
+        conceptRelationVO.setConceptId(conceptId);
+        conceptRelationVO.setRelationList(relationIdList);
+        Map<Integer, List<KlConceptSimDTO>> map = klConceptFacade.getRelationConceptFac(conceptRelationVO);
+        if (map.get(LexiconEnum.Part.getKey()) != null) { // 关联部位
+            klDiseaseDTO.setPartList(map.get(LexiconEnum.Part.getKey()));
+        }
+        if (map.get(LexiconEnum.Dept.getKey()) != null) { // 关联部位
+            klDiseaseDTO.setDeptList(map.get(LexiconEnum.Dept.getKey()));
+        }
+        if (map.get(LexiconEnum.DisSysType.getKey()) != null) { // 关联诊断系统分类
+            klDiseaseDTO.setSystemTypeList(map.get(LexiconEnum.DisSysType.getKey()));
+        }
+        klConceptAllDTO.setKlDiseaseDTO(klDiseaseDTO);
     }
 }
 

+ 47 - 49
cdssman-service/src/main/java/com/diagbot/facade/KlDrugFacade.java

@@ -1,18 +1,16 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.diagbot.entity.KlConcept;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlDrugDTO;
+import com.diagbot.entity.CommonParam;
 import com.diagbot.entity.KlDrug;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.KlDrugServiceImpl;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.UserUtils;
-import com.diagbot.vo.KlConceptSaveVO;
+import com.diagbot.vo.KlDrugVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  * @author wangfeng
  * @Description:
@@ -21,55 +19,55 @@ import java.util.Date;
 @Component
 public class KlDrugFacade extends KlDrugServiceImpl {
 
+    @Autowired
+    KlDrugRegisterFacade klDrugRegisterFacade;
 
-    public boolean saveOrUpdateAll(KlConceptSaveVO klConceptSaveVO) {
+    /**
+     * 疾病扩展获取
+     *
+     * @param conceptId
+     * @param klConceptAllDTO
+     */
+    public void getKlDrug(Long conceptId, KlConceptAllDTO klConceptAllDTO) {
+        KlDrugDTO klDrugDTO = new KlDrugDTO();
 
-        Date now = DateUtil.now();
-        boolean res = false;
-        if (null != klConceptSaveVO.getConceptId()) {
-            //校验
-            int countLis = this.count(new QueryWrapper<KlDrug>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("concept_id", klConceptSaveVO.getConceptId()));
-            if (countLis > 0) {
-                UpdateWrapper<KlDrug> klDrugUpdate = new UpdateWrapper<>();
-                klDrugUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("concept_id", klConceptSaveVO.getConceptId())
-                        .set("gmt_modified", now)
-                        .set("modifier", UserUtils.getCurrentPrincipleID())
-                        .set("drug", klConceptSaveVO.getDrug());
-                res = this.update(klDrugUpdate);
-            } else {
-                KlDrug klDrug = new KlDrug();
-                klDrug.setConceptId(klConceptSaveVO.getConceptId());
-                klDrug.setDrug(klConceptSaveVO.getDrug());
-                klDrug.setGmtModified(now);
-                klDrug.setModifier(UserUtils.getCurrentPrincipleID());
-                res = this.save(klDrug);
-            }
-        } else {
-            KlDrug klDrug = new KlDrug();
-            klDrug.setConceptId(klConceptSaveVO.getConceptId());
-            klDrug.setDrug(klConceptSaveVO.getDrug());
-            klDrug.setGmtModified(now);
-            klDrug.setModifier(UserUtils.getCurrentPrincipleID());
-            res = this.save(klDrug);
+        // 获取药品类别(0:西药,1:中成药)
+        KlDrug klDrug = this.getOne(new QueryWrapper<KlDrug>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (klDrug != null) {
+            klDrugDTO.setDrug(klDrug.getDrug());
         }
 
-        return res;
+        // 获取关联注册药品信息(这里先不展示关联的注册药品)
+        // KlDrugMappingGetVO klDrugMappingGetVO = new KlDrugMappingGetVO();
+        // klDrugMappingGetVO.setDrugConcept(conceptId);
+        // List<KlDrugMappingDTO> klDrugMappingDTOList = klDrugRegisterFacade.getMappingRegister(klDrugMappingGetVO);
+        // klDrugDTO.setKlDrugMappingDTOList(klDrugMappingDTOList);
 
+        klConceptAllDTO.setKlDrugDTO(klDrugDTO);
     }
 
-    public boolean saveAll(KlConcept klConceptPare, KlConceptSaveVO klConceptSaveVO) {
-        Date now = DateUtil.now();
-        KlDrug klDrug = new KlDrug();
-        klDrug.setConceptId(klConceptPare.getId());
-        klDrug.setDrug(klConceptSaveVO.getDrug());
-        klDrug.setCreator(UserUtils.getCurrentPrincipleID());
-        klDrug.setModifier(UserUtils.getCurrentPrincipleID());
-        klDrug.setGmtCreate(now);
-        klDrug.setGmtModified(now);
-        return this.save(klDrug);
+    /**
+     *
+     * @param commonParam
+     * @param klDrugVO
+     */
+    public void saveKlDrug(CommonParam commonParam, KlDrugVO klDrugVO) {
+        // 先删除
+        this.remove(new QueryWrapper<KlDrug>().eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", commonParam.getConceptId()));
+
+        if (klDrugVO != null) {
+            KlDrug klDrug = new KlDrug();
+            klDrug.setConceptId(commonParam.getConceptId());
+            klDrug.setDrug(klDrugVO.getDrug());
+            klDrug.setCreator(commonParam.getPerson());
+            klDrug.setModifier(commonParam.getPerson());
+            klDrug.setGmtCreate(commonParam.getNow());
+            klDrug.setGmtModified(commonParam.getNow());
+            this.save(klDrug);
+        }
     }
 
 }

+ 51 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlDrugMappingFacade.java

@@ -0,0 +1,51 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.KlDrugMappingService;
+import com.diagbot.service.impl.KlDrugMappingServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-04-13 10:41
+ */
+@Component
+public class KlDrugMappingFacade extends KlDrugMappingServiceImpl {
+
+    @Autowired
+    @Qualifier("klDrugMappingServiceImpl")
+    KlDrugMappingService klDrugMappingService;
+
+    // /**
+    //  * 保存药品通用名称和注册名称扩展表
+    //  *
+    //  * @param commonParam
+    //  * @param klDrugVO
+    //  * @return
+    //  */
+    // public void saveAll(CommonParam commonParam, KlDrugVO klDrugVO) {
+    //     // 先删除药品通用名和注册名关联扩展表
+    //     this.remove(new QueryWrapper<KlDrugMapping>().eq("drug_concept", commonParam.getConceptId()));
+    //
+    //     // 新增关联
+    //     List<KlDrugMapping> klDrugMappingList = Lists.newLinkedList();
+    //     if (klDrugVO != null) {
+    //         int i = 1;
+    //         for (Long registerId : klDrugVO.getRegisterIdList()) {
+    //             KlDrugMapping klDrugMapping = new KlDrugMapping();
+    //             klDrugMapping.setDrugConcept(commonParam.getConceptId());
+    //             klDrugMapping.setRegisterId(registerId);
+    //             klDrugMapping.setOrderNo(i++);
+    //             klDrugMapping.setGmtModified(commonParam.getNow());
+    //             klDrugMapping.setGmtCreate(commonParam.getNow());
+    //             klDrugMapping.setCreator(commonParam.getPerson());
+    //             klDrugMapping.setModifier(commonParam.getPerson());
+    //             klDrugMappingList.add(klDrugMapping);
+    //         }
+    //         klDrugMappingService.saveBatch(klDrugMappingList);
+    //     }
+    // }
+
+}

+ 284 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlDrugRegisterFacade.java

@@ -0,0 +1,284 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlDrugExportDTO;
+import com.diagbot.dto.KlDrugRegisterDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlDrugMapping;
+import com.diagbot.entity.KlDrugRegister;
+import com.diagbot.enums.InsertOrUpdateEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.KlDrugMappingService;
+import com.diagbot.service.KlDrugRegisterService;
+import com.diagbot.service.impl.KlDrugRegisterServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.KlDrugMappingGetVO;
+import com.diagbot.vo.KlDrugRegisterDelVO;
+import com.diagbot.vo.KlDrugRegisterGetVO;
+import com.diagbot.vo.KlDrugRegisterPageVO;
+import com.diagbot.vo.KlDrugRegisterSaveVO;
+import com.diagbot.vo.KlDrugRegisterTestVO;
+import com.diagbot.vo.KlDrugSearchVO;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.commons.lang3.StringUtils;
+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.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-04-13 10:41
+ */
+@Component
+public class KlDrugRegisterFacade extends KlDrugRegisterServiceImpl {
+
+    @Autowired
+    @Qualifier("klDrugMappingServiceImpl")
+    KlDrugMappingService klDrugMappingService;
+    @Autowired
+    KlConceptFacade klConceptFacade;
+    @Autowired
+    @Qualifier("klDrugRegisterServiceImpl")
+    KlDrugRegisterService klDrugRegisterService;
+    @Autowired
+    UserFacade userFacade;
+    @Autowired
+    UserClientFacade userClientFacade;
+
+    /**
+     * 保存或更新
+     *
+     * @param klDrugRegisterSaveVO
+     */
+    public void saveOrUpdate(KlDrugRegisterSaveVO klDrugRegisterSaveVO) {
+        CommonParam param = initCommonParam();
+        KlDrugRegister klDrugRegister = new KlDrugRegister();
+        if (klDrugRegisterSaveVO.getId() != null) {
+            klDrugRegister = this.getOne(new QueryWrapper<KlDrugRegister>()
+                    .eq("id", klDrugRegisterSaveVO.getId())
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()), false);
+            if (klDrugRegister == null) { //校验
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "数据不存在");
+            }
+            param.setInsertOrUpdate(InsertOrUpdateEnum.Update.getKey());
+        }
+        BeanUtil.copyProperties(klDrugRegisterSaveVO, klDrugRegister);
+        // 重复校验
+        // int count = this.count(new QueryWrapper<KlDrugRegister>()
+        //         .eq("is_deleted", IsDeleteEnum.N.getKey())
+        //         .eq("drug_code", klDrugRegisterSaveVO.getDrugCode())
+        //         .ne("id", klDrugRegisterSaveVO.getId() == null ? -1 : klDrugRegisterSaveVO.getId()));
+        // if (count > 0) {
+        //     throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "药品代码已存在");
+        // }
+        if (InsertOrUpdateEnum.Insert.getKey() == param.getInsertOrUpdate()) {
+            klDrugRegister.setCreator(param.getPerson()); //创建人
+            klDrugRegister.setGmtCreate(param.getNow());//创建时间
+        }
+        klDrugRegister.setGmtModified(param.getNow());//修改时间
+        klDrugRegister.setModifier(param.getPerson());//修改人
+        this.saveOrUpdate(klDrugRegister);
+
+        // 保存药品通用名和注册名映射关系
+        klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>()
+                .eq("register_id", klDrugRegister.getId()));
+
+        // 保存药品通用名和注册药品的关联
+        if (klDrugRegister.getId() != null) {
+            KlDrugMapping klDrugMapping = new KlDrugMapping();
+            klDrugMapping.setRegisterId(klDrugRegister.getId());
+            klDrugMapping.setDrugConcept(klDrugRegisterSaveVO.getDrugConceptId());
+            klDrugMapping.setCreator(param.getPerson());
+            klDrugMapping.setModifier(param.getPerson());
+            klDrugMapping.setGmtModified(param.getNow());
+            klDrugMapping.setGmtCreate(param.getNow());
+            klDrugMappingService.save(klDrugMapping);
+        }
+    }
+
+    /**
+     * 初始化参数
+     *
+     * @return
+     */
+    public CommonParam initCommonParam() {
+        CommonParam param = new CommonParam();
+        String person = UserUtils.getCurrentPrincipleID();
+        param.setNow(DateUtil.now());
+        param.setPerson(person);
+        param.setInsertOrUpdate(InsertOrUpdateEnum.Insert.getKey());
+        return param;
+    }
+
+    /**
+     * 分页
+     *
+     * @param klDrugRegisterPageVO
+     * @return
+     */
+    public IPage<KlDrugRegisterDTO> getPageFac(KlDrugRegisterPageVO klDrugRegisterPageVO) {
+        IPage<KlDrugRegisterDTO> res = this.getPage(klDrugRegisterPageVO);
+
+        // 设置操作人姓名
+        userClientFacade.setUserName(res.getRecords());
+        return res;
+    }
+
+    /**
+     * 根据id删除标签
+     *
+     * @param klDrugRegisterDelVO
+     * @return
+     */
+    public void deleteByIdFac(KlDrugRegisterDelVO klDrugRegisterDelVO) {
+        List<KlDrugMapping> klDrugMappingList = klDrugMappingService.list(new QueryWrapper<KlDrugMapping>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("register_id", klDrugRegisterDelVO.getId()));
+        if (ListUtil.isNotEmpty(klDrugMappingList)) {
+            // 校验是否有关联
+            // List<Long> idList = klDrugMappingList.stream().map(r -> r.getDrugConcept()).collect(Collectors.toList());
+            // List<KlConcept> klConceptList = klConceptFacade.list(new QueryWrapper<KlConcept>()
+            //         .eq("is_deleted", IsDeleteEnum.N.getKey()).in("id", idList));
+            // if (ListUtil.isNotEmpty(klConceptList)) {
+            //     String errMsg = klConceptList.stream().map(r -> r.getLibName()).distinct().collect(Collectors.joining(","));
+            //     if (StringUtil.isNotBlank(errMsg)) {
+            //         throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "已关联药品通用名:" + errMsg);
+            //     }
+            // }
+            klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>().in("register_id", klDrugRegisterDelVO.getId()));
+        }
+        this.remove(new QueryWrapper<KlDrugRegister>().eq("id", klDrugRegisterDelVO.getId()));
+    }
+
+    /**
+     * 根据参数返回数据
+     *
+     * @param klDrugRegisterGetVO 获取标签内容参数
+     * @return 标签内容
+     */
+    public KlDrugRegisterDTO getByParam(KlDrugRegisterGetVO klDrugRegisterGetVO) {
+        KlDrugRegisterDTO klDrugRegisterDTO = new KlDrugRegisterDTO();
+        KlDrugRegister klDrugRegister = this.getOne(new QueryWrapper<KlDrugRegister>()
+                .eq("id", klDrugRegisterGetVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey()), false);
+        if (klDrugRegister != null) {
+            BeanUtil.copyProperties(klDrugRegister, klDrugRegisterDTO);
+        }
+
+        // 获取注册对应的药品通用名
+        KlDrugMappingGetVO klDrugMappingGetVO = new KlDrugMappingGetVO();
+        klDrugMappingGetVO.setRegisterId(klDrugRegister.getId());
+        List<KlConceptSimDTO> klConceptSimDTOList = this.getMappingDrug(klDrugMappingGetVO);
+        if (ListUtil.isNotEmpty(klConceptSimDTOList)) {
+            KlConceptSimDTO conceptSimDTO = klConceptSimDTOList.get(0);
+            klDrugRegisterDTO.setDrugName(conceptSimDTO.getLibName());
+            klDrugRegisterDTO.setDrugConceptId(conceptSimDTO.getId());
+        }
+        return klDrugRegisterDTO;
+    }
+
+    /**
+     * 药品注册名检索药品通用名
+     *
+     * @param klDrugSearchVO
+     * @return
+     */
+    public List<KlConceptSimDTO> searchDrugFac(KlDrugSearchVO klDrugSearchVO) {
+        return this.searchDrug(klDrugSearchVO);
+    }
+
+    /**
+     * 注册药品导入
+     *
+     * @param file
+     * @return
+     */
+    public void importRegister(MultipartFile file, HttpServletResponse response) {
+        Map res = new LinkedMap();
+        Long t1 = System.currentTimeMillis();
+        List<KlDrugRegisterTestVO> list = XLSXCovertCSVReader.readData(file, "注册药品",
+                30, KlDrugRegisterTestVO.class);
+        Long t2 = System.currentTimeMillis();
+        res.put("读取sheet耗时:", (t2 - t1) / 1000.0 + "秒");
+        try {
+            List<KlConcept> klConceptList = klConceptFacade.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey()).eq("lib_type", 101));
+            Map<String, Long> druMap = klConceptList.stream().collect(Collectors.toMap(k -> k.getLibName(), v -> v.getId(), (r1, r2) -> (r2)));
+            List<String> errMsg = Lists.newArrayList();
+            List<KlDrugRegister> drugRegisterList = Lists.newLinkedList();
+            // int i = 2;
+            for (KlDrugRegisterTestVO  klDrugRegisterTestVO : list) {
+                KlDrugRegister klDrugRegister = new KlDrugRegister();
+                BeanUtil.copyProperties(klDrugRegisterTestVO, klDrugRegister);
+                String drugName = klDrugRegisterTestVO.getDrugName();
+                klDrugRegister.setRemark(drugName);
+                drugRegisterList.add(klDrugRegister);
+                if (druMap.get(drugName) == null) {
+                    errMsg.add(drugName);
+                }
+                // if (StringUtil.isBlank(drugName)) {
+                //     errMsg.add(String.format("第%s行药品通用名为空", i));
+                // } else if (druMap.get(drugName) == null) {
+                //     errMsg.add(String.format("第%s行【%s】不是标准词", i, drugName));
+                // }
+                // i++;
+            }
+            if (ListUtil.isNotEmpty(errMsg)) {
+                errMsg = errMsg.stream().distinct().collect(Collectors.toList());
+                List<KlDrugExportDTO> klDrugExportDTOList = Lists.newLinkedList();
+                for (String s : errMsg) {
+                    KlDrugExportDTO klDrugExportDTO = new KlDrugExportDTO();
+                    klDrugExportDTO.setName(s);
+                    klDrugExportDTOList.add(klDrugExportDTO);
+                }
+                ExcelUtils.exportExcel(klDrugExportDTOList, null, "药品通用名", KlDrugExportDTO.class,
+                        "未校验通过的药品通用名", response, 12.8f);
+                res.put("错误", StringUtils.join(errMsg, ";"));
+                return;
+            }
+            this.remove(new QueryWrapper<KlDrugRegister>()); // 删除主表
+            Long t3 = System.currentTimeMillis();
+            klDrugRegisterService.saveBatch(drugRegisterList);
+            Long t4 = System.currentTimeMillis();
+            res.put("保存DrugRegister表耗时:", (t4 - t3) / 1000.0 + "秒");
+
+            List<KlDrugMapping> klDrugMappingList = ListUtil.newArrayList();
+            for (KlDrugRegister klDrugRegister : drugRegisterList) {
+                KlDrugMapping klDrugMapping = new KlDrugMapping();
+                klDrugMapping.setRegisterId(klDrugRegister.getId());
+                klDrugMapping.setDrugConcept(druMap.get(klDrugRegister.getRemark()));
+                klDrugMappingList.add(klDrugMapping);
+            }
+            klDrugMappingService.remove(new QueryWrapper<KlDrugMapping>());
+            Long t5 = System.currentTimeMillis();
+            klDrugMappingService.saveBatch(klDrugMappingList);
+            Long t6 = System.currentTimeMillis();
+            res.put("保存mapping表耗时:", (t6 - t5) / 1000.0 + "秒");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Long end = System.currentTimeMillis();
+        res.put("总耗时:", (end - t1) / 1000.0 + "秒");
+    }
+
+    public static void main(String[] args) {
+
+    }
+}

+ 44 - 1
cdssman-service/src/main/java/com/diagbot/facade/KlLisFacade.java

@@ -2,13 +2,20 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlLisDTO;
+import com.diagbot.entity.CommonParam;
 import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlDisease;
 import com.diagbot.entity.KlLis;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.KlLisServiceImpl;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.KlConceptSaveVO;
+import com.diagbot.vo.KlDiseaseVO;
+import com.diagbot.vo.KlLisVO;
 import org.springframework.stereotype.Component;
 
 import java.util.Date;
@@ -21,7 +28,7 @@ import java.util.Date;
 @Component
 public class KlLisFacade extends KlLisServiceImpl {
 
-    public boolean saveOrUpdateAll(KlConceptSaveVO klConceptSaveVO) {
+    /*public boolean saveOrUpdateAll(KlConceptSaveVO klConceptSaveVO) {
         Date now = DateUtil.now();
         boolean res = false;
         if (null != klConceptSaveVO.getConceptId()) {
@@ -79,5 +86,41 @@ public class KlLisFacade extends KlLisServiceImpl {
         klLisSub.setGmtCreate(now);
         klLisSub.setGmtModified(now);
         return this.save(klLisSub);
+    }*/
+
+    /**
+     * 保存化验扩展表
+     *
+     * @param commonParam
+     * @param klLisVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlLisVO klLisVO) {
+        if(klLisVO == null){
+            return false;
+        }
+        // 先删除疾病扩展表
+        this.remove(new QueryWrapper<KlLis>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlLis klLis = new KlLis();
+        BeanUtil.copyProperties(klLisVO, klLis);
+        klLis.setConceptId(commonParam.getConceptId());
+        klLis.setGmtModified(commonParam.getNow());
+        klLis.setGmtCreate(commonParam.getNow());
+        klLis.setCreator(commonParam.getPerson());
+        klLis.setModifier(commonParam.getPerson());
+        return this.save(klLis);
+    }
+
+    public void getKlLis(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlLis klLis = this.getOne(new QueryWrapper<KlLis>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (klLis == null) {
+            return;
+        }
+        KlLisDTO klLisDTO = new KlLisDTO();
+        BeanUtil.copyProperties(klLis,klLisDTO);
+        klConceptAll.setKlLisDTO(klLisDTO);
     }
 }

+ 62 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlOperationFacade.java

@@ -0,0 +1,62 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlOperationDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlOperation;
+import com.diagbot.entity.KlPacs;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.KlOperationServiceImpl;
+import com.diagbot.service.impl.KlPacsServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.vo.KlOperationVO;
+import com.diagbot.vo.KlPacsVO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author kwz
+ * @Description:
+ * @date 2021-03-18 16:38
+ */
+@Component
+public class KlOperationFacade extends KlOperationServiceImpl {
+
+
+
+    /**
+     * 保存手术扩展表
+     *
+     * @param commonParam
+     * @param klOperationVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlOperationVO klOperationVO) {
+        if(klOperationVO == null){
+            return false;
+        }
+        // 先删除手术扩展表
+        this.remove(new QueryWrapper<KlOperation>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlOperation klOperation = new KlOperation();
+        BeanUtil.copyProperties(klOperationVO, klOperation);
+        klOperation.setConceptId(commonParam.getConceptId());
+        klOperation.setGmtModified(commonParam.getNow());
+        klOperation.setGmtCreate(commonParam.getNow());
+        klOperation.setCreator(commonParam.getPerson());
+        klOperation.setModifier(commonParam.getPerson());
+        return this.save(klOperation);
+    }
+
+    public void getKlOperation(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlOperation klOperation = this.getOne(new QueryWrapper<KlOperation>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if(klOperation == null){
+            return;
+        }
+        KlOperationDTO klOperationDTO = new KlOperationDTO();
+        BeanUtil.copyProperties(klOperation,klOperationDTO);
+        klConceptAll.setKlOperationDTO(klOperationDTO);
+    }
+}

+ 70 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlPacsFacade.java

@@ -0,0 +1,70 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlPacsDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlLis;
+import com.diagbot.entity.KlPacs;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.KlLisServiceImpl;
+import com.diagbot.service.impl.KlPacsServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.KlConceptSaveVO;
+import com.diagbot.vo.KlLisVO;
+import com.diagbot.vo.KlPacsVO;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ * @author kwz
+ * @Description:
+ * @date 2021-03-18 16:38
+ */
+@Component
+public class KlPacsFacade extends KlPacsServiceImpl {
+
+
+
+    /**
+     * 保存辅检扩展表
+     *
+     * @param commonParam
+     * @param klPacsVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlPacsVO klPacsVO) {
+        if(klPacsVO == null){
+            return false;
+        }
+        // 先删除辅检扩展表
+        this.remove(new QueryWrapper<KlPacs>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlPacs klPacs = new KlPacs();
+        BeanUtil.copyProperties(klPacsVO, klPacs);
+        klPacs.setConceptId(commonParam.getConceptId());
+        klPacs.setGmtModified(commonParam.getNow());
+        klPacs.setGmtCreate(commonParam.getNow());
+        klPacs.setCreator(commonParam.getPerson());
+        klPacs.setModifier(commonParam.getPerson());
+        return this.save(klPacs);
+    }
+
+    public void getKlPacs(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlPacs klPacs = this.getOne(new QueryWrapper<KlPacs>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if(klPacs == null){
+            return;
+        }
+        KlPacsDTO klPacsDTO = new KlPacsDTO();
+        BeanUtil.copyProperties(klPacs,klPacsDTO);
+        klConceptAll.setKlPacsDTO(klPacsDTO);
+
+    }
+}

+ 185 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java

@@ -1,18 +1,35 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.RelationDTO;
 import com.diagbot.dto.TreeAllDTO;
 import com.diagbot.dto.TreeDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlRelation;
+import com.diagbot.entity.KlRelationOrder;
+import com.diagbot.entity.KlVitalResult;
+import com.diagbot.enums.RelationLibTypeEnum;
+import com.diagbot.service.KlRelationOrderService;
+import com.diagbot.service.KlRelationService;
+import com.diagbot.service.KlVitalResultService;
 import com.diagbot.service.impl.KlRelationServiceImpl;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.vo.KlDiseaseVO;
+import com.diagbot.vo.KlSymptomVO;
+import com.diagbot.vo.KlVitalResultVO;
 import com.diagbot.vo.RelationVO;
 import com.diagbot.vo.TreeVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -21,6 +38,22 @@ import java.util.Map;
  */
 @Component
 public class KlRelationFacade extends KlRelationServiceImpl {
+
+    @Autowired
+    @Qualifier("klRelationOrderServiceImpl")
+    KlRelationOrderService klRelationOrderService;
+
+    @Autowired
+    @Qualifier("klRelationServiceImpl")
+    KlRelationService klRelationService;
+
+    @Autowired
+    KlConceptFacade klConceptFacade;
+
+    @Qualifier("klVitalResultServiceImpl")
+    @Autowired
+    KlVitalResultService klVitalResultService;
+;
     public TreeAllDTO getTree(TreeVO treeVO) {
         List<Long[]> pList = new ArrayList<>();
         pList.add(new Long[] { 402L, 600L, 301L, 600L, 101L });//药品化学物质类别
@@ -78,4 +111,156 @@ public class KlRelationFacade extends KlRelationServiceImpl {
         }
         return treeAllDTO;
     }
+
+    /**
+     * 疾病扩展
+     *
+     * @param commonParam
+     * @param klDiseaseVO
+     */
+    public void saveKlDisease(CommonParam commonParam, KlDiseaseVO klDiseaseVO) {
+        // 疾病关联科室,部位,关联系统统一处理。先查找全部数据,删除关联排序表,再删除关联表
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey(),
+                RelationLibTypeEnum.relationSystem.getKey()
+        );
+        klRelationRemove(commonParam, relationIdList);
+
+        if (klDiseaseVO != null) {
+            // 【科室关联】
+            klRelationSave(commonParam, klDiseaseVO.getDeptList(), RelationLibTypeEnum.relationDept.getKey());
+            // 【部位关联】
+            klRelationSave(commonParam, klDiseaseVO.getPartList(), RelationLibTypeEnum.relationPart.getKey());
+            // 【疾病系统分类关联】
+            klRelationSave(commonParam, klDiseaseVO.getSystemTypeList(), RelationLibTypeEnum.relationSystem.getKey());
+        }
+    }
+
+    /**
+     * 症状扩展
+     *
+     * @param commonParam
+     * @param klSymptomVO
+     */
+    public void saveKlSymptom(CommonParam commonParam, KlSymptomVO klSymptomVO) {
+        // 症状关联科室,部位,伴随症状,性质统一处理。先查找全部数据,删除关联排序表,再删除关联表
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey(),
+                RelationLibTypeEnum.relationAccSymptom.getKey(),
+                RelationLibTypeEnum.relationNature.getKey()
+        );
+        klRelationRemove(commonParam, relationIdList);
+
+        if (klSymptomVO != null) {
+            // 【科室关联】
+            klRelationSave(commonParam, klSymptomVO.getDeptList(), RelationLibTypeEnum.relationDept.getKey());
+            // 【部位关联】
+            klRelationSave(commonParam, klSymptomVO.getPartList(), RelationLibTypeEnum.relationPart.getKey());
+            // 【常见伴随症状关联】
+            klRelationSave(commonParam, klSymptomVO.getConSymptomList(), RelationLibTypeEnum.relationAccSymptom.getKey());
+            // 【性质关联】
+            klRelationSave(commonParam, klSymptomVO.getNatureList(), RelationLibTypeEnum.relationNature.getKey());
+        }
+    }
+
+    /**
+     * 体征结果扩展
+     * @param commonParam
+     * @param klVitalResultVO
+     */
+    public void saveKlVitalRes(CommonParam commonParam, KlVitalResultVO klVitalResultVO) {
+        if(klVitalResultVO == null){
+            return;
+        }
+        // 先删除体征结果扩展表
+        klVitalResultService.remove(new QueryWrapper<KlVitalResult>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlVitalResult klVitalResult = new KlVitalResult();
+        BeanUtil.copyProperties(klVitalResultVO, klVitalResult);
+        klVitalResult.setConceptId(commonParam.getConceptId());
+        klVitalResult.setGmtModified(commonParam.getNow());
+        klVitalResult.setGmtCreate(commonParam.getNow());
+        klVitalResult.setCreator(commonParam.getPerson());
+        klVitalResult.setModifier(commonParam.getPerson());
+        klVitalResultService.save(klVitalResult);
+
+        // 体征结果关联科室,部位统一处理。先查找全部数据,删除关联排序表,再删除关联表
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey()
+        );
+        klRelationRemove(commonParam, relationIdList);
+
+        if (klVitalResultVO != null) {
+            // 【科室关联】
+            klRelationSave(commonParam, klVitalResultVO.getDeptList(), RelationLibTypeEnum.relationDept.getKey());
+            // 【部位关联】
+            klRelationSave(commonParam, klVitalResultVO.getPartList(), RelationLibTypeEnum.relationPart.getKey());
+        }
+    }
+
+    /**
+     * 删除关联表和关联排序表
+     *
+     * @param commonParam 通用参数
+     * @param relationList 关联类型列表
+     */
+    public void klRelationRemove(CommonParam commonParam, List<Integer> relationList) {
+        List<KlRelation> klRelationList = this.list(new QueryWrapper<KlRelation>()
+                .eq("start_id", commonParam.getConceptId())
+                .in("relation_id", relationList)
+        );
+        if (ListUtil.isNotEmpty(klRelationList)) {
+            List<Long> idList = klRelationList.stream().map(r -> r.getId()).collect(Collectors.toList());
+            // 删除关联排序表
+            klRelationOrderService.remove(new QueryWrapper<KlRelationOrder>().in("t_relation_id", idList));
+            // 删除关联表
+            this.remove(new QueryWrapper<KlRelation>().in("id", idList));
+        }
+    }
+
+    /**
+     * 保存关联表和关联排序表
+     *
+     * @param commonParam
+     * @param idList
+     * @param relationId
+     */
+    public void klRelationSave(CommonParam commonParam, List<Long> idList, Integer relationId) {
+        if (ListUtil.isEmpty(idList)) {
+            return;
+        }
+        List<KlRelation> relationSaveList = Lists.newArrayList();
+        for (Long endId : idList) {
+            KlRelation klRelation = new KlRelation();
+            klRelation.setStartId(commonParam.getConceptId());
+            klRelation.setRelationId(relationId);
+            klRelation.setEndId(endId);
+            klRelation.setGmtModified(commonParam.getNow());
+            klRelation.setGmtCreate(commonParam.getNow());
+            klRelation.setCreator(commonParam.getPerson());
+            klRelation.setModifier(commonParam.getPerson());
+            relationSaveList.add(klRelation);
+        }
+        klRelationService.saveBatch(relationSaveList);
+
+        // 【科室关联排序】
+        List<KlRelationOrder> OrderSaveList = Lists.newArrayList();
+        int i = 1;
+        for (KlRelation klRelation : relationSaveList) {
+            KlRelationOrder klRelationOrder = new KlRelationOrder();
+            klRelationOrder.settRelationId(klRelation.getId());
+            klRelationOrder.setOrderNo(i++);
+            klRelation.setGmtModified(commonParam.getNow());
+            klRelation.setGmtCreate(commonParam.getNow());
+            klRelation.setCreator(commonParam.getPerson());
+            klRelation.setModifier(commonParam.getPerson());
+            OrderSaveList.add(klRelationOrder);
+        }
+        klRelationOrderService.saveBatch(OrderSaveList);
+    }
+
+
 }

+ 95 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlSymptomFacade.java

@@ -0,0 +1,95 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlSymptomDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlSymptom;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.RelationLibTypeEnum;
+import com.diagbot.service.impl.KlSymptomServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.vo.ConceptRelationVO;
+import com.diagbot.vo.KlSymptomVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-04-13 10:41
+ */
+@Component
+public class KlSymptomFacade extends KlSymptomServiceImpl {
+
+    @Autowired
+    KlConceptFacade klConceptFacade;
+
+    /**
+     * 保存症状扩展表
+     *
+     * @param commonParam
+     * @param klSymptomVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlSymptomVO klSymptomVO) {
+        // 先删除疾病扩展表
+        this.remove(new QueryWrapper<KlSymptom>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlSymptom klSymptom = new KlSymptom();
+        BeanUtil.copyProperties(klSymptomVO, klSymptom);
+        klSymptom.setConceptId(commonParam.getConceptId());
+        klSymptom.setGmtModified(commonParam.getNow());
+        klSymptom.setGmtCreate(commonParam.getNow());
+        klSymptom.setCreator(commonParam.getPerson());
+        klSymptom.setModifier(commonParam.getPerson());
+        return this.save(klSymptom);
+    }
+
+    /**
+     * 疾病扩展获取
+     *
+     * @param conceptId
+     * @param klConceptAllDTO
+     */
+    public void getKlSymptom(Long conceptId, KlConceptAllDTO klConceptAllDTO) {
+        KlSymptom klSymptom = this.getOne(new QueryWrapper<KlSymptom>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (klSymptom == null) {
+            return;
+        }
+        KlSymptomDTO klSymptomDTO = new KlSymptomDTO();
+        BeanUtil.copyProperties(klSymptom, klSymptomDTO);
+
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey(),
+                RelationLibTypeEnum.relationAccSymptom.getKey(),
+                RelationLibTypeEnum.relationNature.getKey()
+        );
+        ConceptRelationVO conceptRelationVO = new ConceptRelationVO();
+        conceptRelationVO.setConceptId(conceptId);
+        conceptRelationVO.setRelationList(relationIdList);
+        Map<Integer, List<KlConceptSimDTO>> map = klConceptFacade.getRelationConceptFac(conceptRelationVO);
+        if (map.get(LexiconEnum.Part.getKey()) != null) { // 关联部位
+            klSymptomDTO.setPartList(map.get(LexiconEnum.Part.getKey()));
+        }
+        if (map.get(LexiconEnum.Dept.getKey()) != null) { // 关联科室
+            klSymptomDTO.setDeptList(map.get(LexiconEnum.Dept.getKey()));
+        }
+        if (map.get(LexiconEnum.Symptom.getKey()) != null) { // 关联伴随症状
+            klSymptomDTO.setConSymptomList(map.get(LexiconEnum.Symptom.getKey()));
+        }
+        if (map.get(LexiconEnum.Nature.getKey()) != null) { // 关联性质
+            klSymptomDTO.setNatureList(map.get(LexiconEnum.Nature.getKey()));
+        }
+        klConceptAllDTO.setKlSymptomDTO(klSymptomDTO);
+    }
+}

+ 57 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlTcmDiseaseFacade.java

@@ -0,0 +1,57 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlTcmDiseaseDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlTcmDisease;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.KlTcmDiseaseServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.vo.KlTcmDiseaseVO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-03-18 16:38
+ */
+@Component
+public class KlTcmDiseaseFacade extends KlTcmDiseaseServiceImpl {
+
+    /**
+     * 保存中医疾病扩展表
+     *
+     * @param commonParam
+     * @param klTcmDiseaseVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlTcmDiseaseVO klTcmDiseaseVO) {
+        if (klTcmDiseaseVO == null) {
+            return false;
+        }
+        // 先删除扩展表
+        this.remove(new QueryWrapper<KlTcmDisease>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlTcmDisease klTcmDisease = new KlTcmDisease();
+        BeanUtil.copyProperties(klTcmDiseaseVO, klTcmDisease);
+        klTcmDisease.setConceptId(commonParam.getConceptId());
+        klTcmDisease.setGmtModified(commonParam.getNow());
+        klTcmDisease.setGmtCreate(commonParam.getNow());
+        klTcmDisease.setCreator(commonParam.getPerson());
+        klTcmDisease.setModifier(commonParam.getPerson());
+        return this.save(klTcmDisease);
+    }
+
+    public void getKlTcmDisease(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlTcmDisease klTcmDisease = this.getOne(new QueryWrapper<KlTcmDisease>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (klTcmDisease == null) {
+            return;
+        }
+        KlTcmDiseaseDTO klTcmDiseaseDTO = new KlTcmDiseaseDTO();
+        BeanUtil.copyProperties(klTcmDisease, klTcmDiseaseDTO);
+        klConceptAll.setKlTcmDiseaseDTO(klTcmDiseaseDTO);
+    }
+}

+ 57 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlTcmSyndromeFacade.java

@@ -0,0 +1,57 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlTcmSyndromeDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlTcmSyndrome;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.KlTcmSyndromeServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.vo.KlTcmSyndromeVO;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zhoutg
+ * @Description:
+ * @date 2021-03-18 16:38
+ */
+@Component
+public class KlTcmSyndromeFacade extends KlTcmSyndromeServiceImpl {
+
+    /**
+     * 保存中医症候扩展表
+     *
+     * @param commonParam
+     * @param klTcmSyndromeVO
+     * @return
+     */
+    public boolean saveAll(CommonParam commonParam, KlTcmSyndromeVO klTcmSyndromeVO) {
+        if (klTcmSyndromeVO == null) {
+            return false;
+        }
+        // 先删除扩展表
+        this.remove(new QueryWrapper<KlTcmSyndrome>().eq("concept_id", commonParam.getConceptId()));
+        // 重新插入扩展表
+        KlTcmSyndrome klTcmSyndrome = new KlTcmSyndrome();
+        BeanUtil.copyProperties(klTcmSyndromeVO, klTcmSyndrome);
+        klTcmSyndrome.setConceptId(commonParam.getConceptId());
+        klTcmSyndrome.setGmtModified(commonParam.getNow());
+        klTcmSyndrome.setGmtCreate(commonParam.getNow());
+        klTcmSyndrome.setCreator(commonParam.getPerson());
+        klTcmSyndrome.setModifier(commonParam.getPerson());
+        return this.save(klTcmSyndrome);
+    }
+
+    public void getKlTcmSyndrome(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlTcmSyndrome KlTcmSyndrome = this.getOne(new QueryWrapper<KlTcmSyndrome>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if (KlTcmSyndrome == null) {
+            return;
+        }
+        KlTcmSyndromeDTO klTcmSyndromeDTO = new KlTcmSyndromeDTO();
+        BeanUtil.copyProperties(KlTcmSyndrome, klTcmSyndromeDTO);
+        klConceptAll.setKlTcmSyndromeDTO(klTcmSyndromeDTO);
+    }
+}

+ 63 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlVitalResFacade.java

@@ -0,0 +1,63 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.KlConceptAllDTO;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlVitalResultDTO;
+import com.diagbot.entity.CommonParam;
+import com.diagbot.entity.KlOperation;
+import com.diagbot.entity.KlVitalResult;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.RelationLibTypeEnum;
+import com.diagbot.service.impl.KlOperationServiceImpl;
+import com.diagbot.service.impl.KlVitalResultServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.vo.ConceptRelationVO;
+import com.diagbot.vo.KlOperationVO;
+import com.diagbot.vo.KlVitalResultVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author kwz
+ * @Description:
+ * @date 2021-03-18 16:38
+ */
+@Component
+public class KlVitalResFacade extends KlVitalResultServiceImpl {
+
+    @Autowired
+    KlConceptFacade klConceptFacade;
+
+
+    public void getKlVitalResult(Long conceptId, KlConceptAllDTO klConceptAll) {
+        KlVitalResult klVitalResult = this.getOne(new QueryWrapper<KlVitalResult>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", conceptId), false);
+        if(klVitalResult == null){
+            return;
+        }
+        KlVitalResultDTO klVitalResultDTO = new KlVitalResultDTO();
+        BeanUtil.copyProperties(klVitalResult,klVitalResultDTO);
+        List<Integer> relationIdList = Lists.newArrayList(
+                RelationLibTypeEnum.relationDept.getKey(),
+                RelationLibTypeEnum.relationPart.getKey()
+        );
+        ConceptRelationVO conceptRelationVO = new ConceptRelationVO();
+        conceptRelationVO.setConceptId(conceptId);
+        conceptRelationVO.setRelationList(relationIdList);
+        Map<Integer, List<KlConceptSimDTO>> map = klConceptFacade.getRelationConceptFac(conceptRelationVO);
+        if (map.get(LexiconEnum.Part.getKey()) != null) {
+            klVitalResultDTO.setPartList(map.get(LexiconEnum.Part.getKey()));
+        }
+        if (map.get(LexiconEnum.Dept.getKey()) != null) {
+            klVitalResultDTO.setDeptList(map.get(LexiconEnum.Dept.getKey()));
+        }
+        klConceptAll.setKlVitalResultDTO(klVitalResultDTO);
+    }
+}

+ 88 - 81
cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.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.LisConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -161,14 +162,14 @@ public class LisConfigFacade{
         //过滤套餐或公表名为空的数据,hospitalId不允许为空
         lisConfigList = lisConfigList
                 .stream()
-                .filter(i->i.getHospitalId()!=null)
+                .filter(i -> i.getHospitalId() != null)
                 .filter(i -> StringUtil.isNotBlank(i.getHisName()))
                 .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
-        if(ListUtil.isEmpty(lisConfigList)){
+        if (ListUtil.isEmpty(lisConfigList)) {
             return false;
         }
-        Long hosptialId=lisConfigList.get(0).getHospitalId();
+        Long hosptialId = lisConfigList.get(0).getHospitalId();
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
@@ -205,7 +206,6 @@ public class LisConfigFacade{
         IdListVO idListVO = new IdListVO();
         idListVO.setIds(deleteIds);
         deleteRecords(idListVO);
-
         lisConfigService.saveOrUpdateBatch(lisConfigList);
         return true;
     }
@@ -261,9 +261,6 @@ public class LisConfigFacade{
         //从Excel读取数据
         List<LisConfig> lisConfigList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
         if (ListUtil.isNotEmpty(lisConfigList)) {
-            lisConfigList.forEach(lisConfig -> {
-                lisConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(lisConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -285,14 +282,14 @@ public class LisConfigFacade{
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         lisConfigList = lisConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getHisDetailName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(LisConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(lisConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        lisConfigList.forEach(lisConfig -> {
+            lisConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < lisConfigList.size(); i++) {
             if (StringUtil.isBlank(lisConfigList.get(i).getHisName())
@@ -332,80 +329,82 @@ public class LisConfigFacade{
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Map<String, List<Long>>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
-        lisConfigList.forEach(lisConfig -> {
-            lisConfig.setHospitalId(Long.valueOf(hospitalId));
-            lisConfig.setModifier(userId);
-            lisConfig.setGmtModified(now);
-            if (lisConfig.getId() == null) {
-                if (configMap.containsKey(lisConfig.getHisName())) {
-                    if (lisConfig.getHisDetailName() == null
-                            && configMap.get(lisConfig.getHisName()).containsKey("")) {
-                        if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()))) {
-                            deleteIds.addAll(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()));
-                        }
-                    } else if (configMap.get(lisConfig.getHisName()).containsKey(lisConfig.getHisDetailName())) {
-                        if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get(lisConfig.getHisDetailName()).get(lisConfig.getUniqueName()))) {
-                            deleteIds.addAll(configMap
-                                    .get(lisConfig.getHisName())
-                                    .get(lisConfig.getHisDetailName())
-                                    .get(lisConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, Map<String, List<Long>>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
+            lisConfigList.forEach(lisConfig -> {
+                lisConfig.setHospitalId(Long.valueOf(hospitalId));
+                lisConfig.setModifier(userId);
+                lisConfig.setGmtModified(now);
+                if (lisConfig.getId() == null) {
+                    if (configMap.containsKey(lisConfig.getHisName())) {
+                        if (lisConfig.getHisDetailName() == null
+                                && configMap.get(lisConfig.getHisName()).containsKey("")) {
+                            if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()))) {
+                                deleteIds.addAll(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()));
+                            }
+                        } else if (configMap.get(lisConfig.getHisName()).containsKey(lisConfig.getHisDetailName())) {
+                            if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get(lisConfig.getHisDetailName()).get(lisConfig.getUniqueName()))) {
+                                deleteIds.addAll(configMap
+                                        .get(lisConfig.getHisName())
+                                        .get(lisConfig.getHisDetailName())
+                                        .get(lisConfig.getUniqueName()));
+                            }
                         }
                     }
+                    lisConfig.setCreator(userId);
+                    lisConfig.setGmtCreate(now);
                 }
-                lisConfig.setCreator(userId);
-                lisConfig.setGmtCreate(now);
-            }
-            if (lisConfig.getIsDeleted() == null) {
-                lisConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
-        RespDTO<List<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-        List<String> lisPackNames = respLisPackDTO.data;
-        conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-        List<String> lisNames = respLisDTO.data;
-        for (int i = 0; i < lisConfigList.size(); i++) {
-            if (StringUtil.isBlank(lisConfigList.get(i).getHisDetailName())) {
-                //检验套餐对应套餐
-                if (!lisPackNames.contains(lisConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
+                if (lisConfig.getIsDeleted() == null) {
+                    lisConfig.setIsDeleted(IsDeleteEnum.N.getKey());
                 }
-            } else {
-                //检验细项对应细项
-                if (!lisNames.contains(lisConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
+            RespDTO<List<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
+            RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
+            List<String> lisPackNames = respLisPackDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
+            conceptVO.setType(ConceptTypeEnum.Lis.getKey());
+            RespDTO<List<IndexBatchDTO>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
+            RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
+            List<String> lisNames = respLisDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
+            for (int i = 0; i < lisConfigList.size(); i++) {
+                if (StringUtil.isBlank(lisConfigList.get(i).getHisDetailName())) {
+                    //检验套餐对应套餐
+                    if (!lisPackNames.contains(lisConfigList.get(i).getUniqueName())) {
+                        errorNumList.add(String.valueOf(i + 2));
+                    }
+                } else {
+                    //检验细项对应细项
+                    if (!lisNames.contains(lisConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
-        }
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
+            }
 
-        //重复数据过滤
-        lisConfigList = lisConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
+            //重复数据过滤
+            lisConfigList = lisConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
 
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        lisConfigService.saveOrUpdateBatch(lisConfigList);
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            lisConfigService.saveOrUpdateBatch(lisConfigList);
+        }
         return true;
     }
 
@@ -588,6 +587,14 @@ public class LisConfigFacade{
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, Map<String, List<LisConfig>>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(LisConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -612,13 +619,13 @@ public class LisConfigFacade{
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
-        RespDTO<List<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-        List<String> lisPackNames = respLisPackDTO.data;
+        List<String> lisPackNames = respLisPackDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-        List<String> lisNames = respLisDTO.data;
+        List<String> lisNames = respLisDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
 
         if (ListUtil.isNotEmpty(originList)) {
             for (LisConfig originItem : originList) {

+ 67 - 58
cdssman-service/src/main/java/com/diagbot/facade/NurseConfigFacade.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.NurseConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -235,9 +236,6 @@ public class NurseConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<NurseConfig> nurseConfigList = ExcelUtils.importExcel(file, 0, 1, NurseConfig.class);
         if (ListUtil.isNotEmpty(nurseConfigList)) {
-            nurseConfigList.forEach(nurseConfig -> {
-                nurseConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(nurseConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -259,13 +257,14 @@ public class NurseConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         nurseConfigList = nurseConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(NurseConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(nurseConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        nurseConfigList.forEach(nurseConfig -> {
+            nurseConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < nurseConfigList.size(); i++) {
             if (StringUtil.isBlank(nurseConfigList.get(i).getHisName())
@@ -293,61 +292,63 @@ public class NurseConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        nurseConfigList.forEach(nurseConfig -> {
-            nurseConfig.setHospitalId(Long.valueOf(hospitalId));
-            nurseConfig.setModifier(userId);
-            nurseConfig.setGmtModified(now);
-            if (nurseConfig.getId() == null) {
-                if (configMap.containsKey(nurseConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(nurseConfig.getHisName()).get(nurseConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(nurseConfig.getHisName()).get(nurseConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            nurseConfigList.forEach(nurseConfig -> {
+                nurseConfig.setHospitalId(Long.valueOf(hospitalId));
+                nurseConfig.setModifier(userId);
+                nurseConfig.setGmtModified(now);
+                if (nurseConfig.getId() == null) {
+                    if (configMap.containsKey(nurseConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(nurseConfig.getHisName()).get(nurseConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(nurseConfig.getHisName()).get(nurseConfig.getUniqueName()));
+                    }
+                    nurseConfig.setCreator(userId);
+                    nurseConfig.setGmtCreate(now);
+                }
+                if (nurseConfig.getIsDeleted() == null) {
+                    nurseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = nurseConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Nurse.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 < nurseConfigList.size(); i++) {
+                if (!names.contains(nurseConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                nurseConfig.setCreator(userId);
-                nurseConfig.setGmtCreate(now);
             }
-            if (nurseConfig.getIsDeleted() == null) {
-                nurseConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = nurseConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Nurse.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < nurseConfigList.size(); i++) {
-            if (!names.contains(nurseConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
+            //重复数据过滤
+            nurseConfigList = nurseConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            nurseConfigService.saveOrUpdateBatch(nurseConfigList);
         }
-
-        //重复数据过滤
-        nurseConfigList = nurseConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        nurseConfigService.saveOrUpdateBatch(nurseConfigList);
         return true;
     }
 
@@ -498,6 +499,14 @@ public class NurseConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<NurseConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(NurseConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -517,9 +526,9 @@ public class NurseConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Nurse.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (NurseConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

+ 67 - 58
cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.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.OperationConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -235,9 +236,6 @@ public class OperationConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
         if (ListUtil.isNotEmpty(operationConfigList)) {
-            operationConfigList.forEach(operationConfig -> {
-                operationConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(operationConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -259,13 +257,14 @@ public class OperationConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         operationConfigList = operationConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(OperationConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(operationConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        operationConfigList.forEach(operationConfig -> {
+            operationConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < operationConfigList.size(); i++) {
             if (StringUtil.isBlank(operationConfigList.get(i).getHisName())
@@ -293,61 +292,63 @@ public class OperationConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        operationConfigList.forEach(operationConfig -> {
-            operationConfig.setHospitalId(Long.valueOf(hospitalId));
-            operationConfig.setModifier(userId);
-            operationConfig.setGmtModified(now);
-            if (operationConfig.getId() == null) {
-                if (configMap.containsKey(operationConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            operationConfigList.forEach(operationConfig -> {
+                operationConfig.setHospitalId(Long.valueOf(hospitalId));
+                operationConfig.setModifier(userId);
+                operationConfig.setGmtModified(now);
+                if (operationConfig.getId() == null) {
+                    if (configMap.containsKey(operationConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()));
+                    }
+                    operationConfig.setCreator(userId);
+                    operationConfig.setGmtCreate(now);
+                }
+                if (operationConfig.getIsDeleted() == null) {
+                    operationConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = operationConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Operation.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 < operationConfigList.size(); i++) {
+                if (!names.contains(operationConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                operationConfig.setCreator(userId);
-                operationConfig.setGmtCreate(now);
             }
-            if (operationConfig.getIsDeleted() == null) {
-                operationConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = operationConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Operation.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < operationConfigList.size(); i++) {
-            if (!names.contains(operationConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
+            //重复数据过滤
+            operationConfigList = operationConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            operationConfigService.saveOrUpdateBatch(operationConfigList);
         }
-
-        //重复数据过滤
-        operationConfigList = operationConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        operationConfigService.saveOrUpdateBatch(operationConfigList);
         return true;
     }
 
@@ -498,6 +499,14 @@ public class OperationConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<OperationConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(OperationConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -517,9 +526,9 @@ public class OperationConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Operation.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (OperationConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

+ 67 - 58
cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.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.PacsConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -233,9 +234,6 @@ public class PacsConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
         if (ListUtil.isNotEmpty(pacsConfigList)) {
-            pacsConfigList.forEach(pacsConfig -> {
-                pacsConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(pacsConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -257,13 +255,14 @@ public class PacsConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         pacsConfigList = pacsConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(PacsConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(pacsConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        pacsConfigList.forEach(pacsConfig -> {
+            pacsConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < pacsConfigList.size(); i++) {
             if (StringUtil.isBlank(pacsConfigList.get(i).getHisName())
@@ -291,61 +290,63 @@ public class PacsConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        pacsConfigList.forEach(pacsConfig -> {
-            pacsConfig.setHospitalId(Long.valueOf(hospitalId));
-            pacsConfig.setModifier(userId);
-            pacsConfig.setGmtModified(now);
-            if (pacsConfig.getId() == null) {
-                if (configMap.containsKey(pacsConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            pacsConfigList.forEach(pacsConfig -> {
+                pacsConfig.setHospitalId(Long.valueOf(hospitalId));
+                pacsConfig.setModifier(userId);
+                pacsConfig.setGmtModified(now);
+                if (pacsConfig.getId() == null) {
+                    if (configMap.containsKey(pacsConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()));
+                    }
+                    pacsConfig.setCreator(userId);
+                    pacsConfig.setGmtCreate(now);
+                }
+                if (pacsConfig.getIsDeleted() == null) {
+                    pacsConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = pacsConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Pacs.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 < pacsConfigList.size(); i++) {
+                if (!names.contains(pacsConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                pacsConfig.setCreator(userId);
-                pacsConfig.setGmtCreate(now);
             }
-            if (pacsConfig.getIsDeleted() == null) {
-                pacsConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = pacsConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < pacsConfigList.size(); i++) {
-            if (!names.contains(pacsConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
+            //重复数据过滤
+            pacsConfigList = pacsConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            pacsConfigService.saveOrUpdateBatch(pacsConfigList);
         }
-
-        //重复数据过滤
-        pacsConfigList = pacsConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        pacsConfigService.saveOrUpdateBatch(pacsConfigList);
         return true;
     }
 
@@ -496,6 +497,14 @@ public class PacsConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<PacsConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(PacsConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -515,9 +524,9 @@ public class PacsConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (PacsConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

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

+ 13 - 12
cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.ExportCommonStaticTestDTO;
 import com.diagbot.dto.ExportCommonTestDTO;
 import com.diagbot.dto.ExportLisStaticTestDTO;
 import com.diagbot.dto.ExportLisTestDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DiseaseConfig;
 import com.diagbot.entity.DrugConfig;
@@ -197,16 +198,16 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
-        RespDTO<List<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> lisPackNames = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respLisPackDTO)) {
-            lisPackNames = respLisPackDTO.data;
+            lisPackNames = respLisPackDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
         conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> lisNames = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respLisDTO)) {
-            lisNames = respLisDTO.data;
+            lisNames = respLisDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
 
         //判断是否有标准术语
@@ -395,10 +396,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> names = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respDTO)) {
-            names = respDTO.data;
+            names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
         for (ResultStaticKnowledge result : mappingList) {
             if (result.getHasStandName() == null || result.getHasStandName().equals(0)) {
@@ -586,10 +587,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Drug.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> names = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respDTO)) {
-            names = respDTO.data;
+            names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
         for (ResultStaticKnowledge result : mappingList) {
             if (result.getHasStandName() == null || result.getHasStandName().equals(0)) {
@@ -742,10 +743,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Disease.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> names = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respDTO)) {
-            names = respDTO.data;
+            names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
         for (ResultStaticKnowledge result : mappingList) {
             if (result.getHasStandName() == null || result.getHasStandName().equals(0)) {
@@ -898,10 +899,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Operation.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         List<String> names = Lists.newLinkedList();
         if (RespDTOUtil.respIsOK(respDTO)) {
-            names = respDTO.data;
+            names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         }
         for (ResultStaticKnowledge result : mappingList) {
             if (result.getHasStandName() == null || result.getHasStandName().equals(0)) {

+ 67 - 58
cdssman-service/src/main/java/com/diagbot/facade/ScaleConfigFacade.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.ScaleConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -235,9 +236,6 @@ public class ScaleConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<ScaleConfig> scaleConfigList = ExcelUtils.importExcel(file, 0, 1, ScaleConfig.class);
         if (ListUtil.isNotEmpty(scaleConfigList)) {
-            scaleConfigList.forEach(scaleConfig -> {
-                scaleConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(scaleConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -259,13 +257,14 @@ public class ScaleConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         scaleConfigList = scaleConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(ScaleConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(scaleConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        scaleConfigList.forEach(scaleConfig -> {
+            scaleConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < scaleConfigList.size(); i++) {
             if (StringUtil.isBlank(scaleConfigList.get(i).getHisName())
@@ -293,61 +292,63 @@ public class ScaleConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        scaleConfigList.forEach(scaleConfig -> {
-            scaleConfig.setHospitalId(Long.valueOf(hospitalId));
-            scaleConfig.setModifier(userId);
-            scaleConfig.setGmtModified(now);
-            if (scaleConfig.getId() == null) {
-                if (configMap.containsKey(scaleConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(scaleConfig.getHisName()).get(scaleConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(scaleConfig.getHisName()).get(scaleConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            scaleConfigList.forEach(scaleConfig -> {
+                scaleConfig.setHospitalId(Long.valueOf(hospitalId));
+                scaleConfig.setModifier(userId);
+                scaleConfig.setGmtModified(now);
+                if (scaleConfig.getId() == null) {
+                    if (configMap.containsKey(scaleConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(scaleConfig.getHisName()).get(scaleConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(scaleConfig.getHisName()).get(scaleConfig.getUniqueName()));
+                    }
+                    scaleConfig.setCreator(userId);
+                    scaleConfig.setGmtCreate(now);
+                }
+                if (scaleConfig.getIsDeleted() == null) {
+                    scaleConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = scaleConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Scale.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 < scaleConfigList.size(); i++) {
+                if (!names.contains(scaleConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                scaleConfig.setCreator(userId);
-                scaleConfig.setGmtCreate(now);
             }
-            if (scaleConfig.getIsDeleted() == null) {
-                scaleConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = scaleConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Scale.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < scaleConfigList.size(); i++) {
-            if (!names.contains(scaleConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
+            //重复数据过滤
+            scaleConfigList = scaleConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            scaleConfigService.saveOrUpdateBatch(scaleConfigList);
         }
-
-        //重复数据过滤
-        scaleConfigList = scaleConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        scaleConfigService.saveOrUpdateBatch(scaleConfigList);
         return true;
     }
 
@@ -498,6 +499,14 @@ public class ScaleConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<ScaleConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(ScaleConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -517,9 +526,9 @@ public class ScaleConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Scale.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (ScaleConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

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

+ 67 - 58
cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.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.TransfusionConfig;
 import com.diagbot.enums.ConceptTypeEnum;
@@ -233,9 +234,6 @@ public class TransfusionConfigFacade {
     public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
         List<TransfusionConfig> transfusionConfigList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
         if (ListUtil.isNotEmpty(transfusionConfigList)) {
-            transfusionConfigList.forEach(transfusionConfig -> {
-                transfusionConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
             importExcelRecords(transfusionConfigList, hospitalIdVO);
         } else {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
@@ -257,13 +255,14 @@ public class TransfusionConfigFacade {
         //2、去除前后空格
         //过滤空数据,保留重复数据,方便计行
         transfusionConfigList = transfusionConfigList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .filter(TransfusionConfig::nonNull)
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(transfusionConfigList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
+        transfusionConfigList.forEach(transfusionConfig -> {
+            transfusionConfig.setHospitalId(hospitalIdVO.getHospitalId());
+        });
         List<String> emptyNumList = Lists.newLinkedList();
         for (int i = 0; i < transfusionConfigList.size(); i++) {
             if (StringUtil.isBlank(transfusionConfigList.get(i).getHisName())
@@ -291,61 +290,63 @@ public class TransfusionConfigFacade {
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
-        transfusionConfigList.forEach(transfusionConfig -> {
-            transfusionConfig.setHospitalId(Long.valueOf(hospitalId));
-            transfusionConfig.setModifier(userId);
-            transfusionConfig.setGmtModified(now);
-            if (transfusionConfig.getId() == null) {
-                if (configMap.containsKey(transfusionConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()));
+        synchronized (this) {
+            List<Long> deleteIds = Lists.newLinkedList();
+            Map<String, Map<String, List<Long>>> configMap
+                    = getConfigMap(Long.valueOf(hospitalId), null, null);
+            transfusionConfigList.forEach(transfusionConfig -> {
+                transfusionConfig.setHospitalId(Long.valueOf(hospitalId));
+                transfusionConfig.setModifier(userId);
+                transfusionConfig.setGmtModified(now);
+                if (transfusionConfig.getId() == null) {
+                    if (configMap.containsKey(transfusionConfig.getHisName())
+                            && ListUtil.isNotEmpty(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()))) {
+                        deleteIds.addAll(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()));
+                    }
+                    transfusionConfig.setCreator(userId);
+                    transfusionConfig.setGmtCreate(now);
+                }
+                if (transfusionConfig.getIsDeleted() == null) {
+                    transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+                }
+            });
+
+            //标准术语校验
+            List<String> errorNumList = Lists.newLinkedList();
+            List<String> uniqueNames = transfusionConfigList.stream()
+                    .map(i -> i.getUniqueName())
+                    .distinct()
+                    .collect(Collectors.toList());
+            ConceptVO conceptVO = new ConceptVO();
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setType(ConceptTypeEnum.Transfusion.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 < transfusionConfigList.size(); i++) {
+                if (!names.contains(transfusionConfigList.get(i).getUniqueName())) {
+                    errorNumList.add(String.valueOf(i + 2));
                 }
-                transfusionConfig.setCreator(userId);
-                transfusionConfig.setGmtCreate(now);
             }
-            if (transfusionConfig.getIsDeleted() == null) {
-                transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            if (ListUtil.isNotEmpty(errorNumList)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "以下行数(不计空行)标准术语在数据库中不存在:"
+                                + errorNumList.stream().collect(Collectors.joining("、"))
+                                + "。导入取消,请修改后再试。");
             }
-        });
 
-        //标准术语校验
-        List<String> errorNumList = Lists.newLinkedList();
-        List<String> uniqueNames = transfusionConfigList.stream()
-                .map(i -> i.getUniqueName())
-                .distinct()
-                .collect(Collectors.toList());
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(uniqueNames);
-        conceptVO.setType(ConceptTypeEnum.Transfusion.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < transfusionConfigList.size(); i++) {
-            if (!names.contains(transfusionConfigList.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("、"))
-                            + "。导入取消,请修改后再试。");
+            //重复数据过滤
+            transfusionConfigList = transfusionConfigList
+                    .stream()
+                    .distinct()
+                    .collect(Collectors.toList());
+
+            //删除已存在映射关系
+            IdListVO idListVO = new IdListVO();
+            idListVO.setIds(deleteIds);
+            deleteRecords(idListVO);
+            transfusionConfigService.saveOrUpdateBatch(transfusionConfigList);
         }
-
-        //重复数据过滤
-        transfusionConfigList = transfusionConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        transfusionConfigService.saveOrUpdateBatch(transfusionConfigList);
         return true;
     }
 
@@ -496,6 +497,14 @@ public class TransfusionConfigFacade {
         List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
         Map<String, List<TransfusionConfig>> allMap = getAll(hisNameList);
 
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
+        //去除空行
+        originList = originList.stream().filter(TransfusionConfig::nonNull).collect(Collectors.toList());
+        if (ListUtil.isEmpty(originList)) {
+            return retList;
+        }
         //去除空格
         originList.forEach(item -> {
             item.setHisName(item.getHisName().trim());
@@ -515,9 +524,9 @@ public class TransfusionConfigFacade {
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setNames(precUniqueName);
         conceptVO.setType(ConceptTypeEnum.Transfusion.getKey());
-        RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
+        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
         if (ListUtil.isNotEmpty(originList)) {
             for (TransfusionConfig originItem : originList) {
                 if (allMap.containsKey(originItem.getHisName())) {

+ 47 - 0
cdssman-service/src/main/java/com/diagbot/facade/UserClientFacade.java

@@ -0,0 +1,47 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.UserServiceClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.ReflectUtil;
+import com.diagbot.util.RespDTOUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @description: 通用方法
+ * @author: zhoutg
+ * @time: 2021/6/3 18:56
+ */
+@Component
+public class UserClientFacade {
+
+    @Autowired
+    UserServiceClient userServiceClient;
+
+    /**
+     * 设置操作人姓名
+     *
+     * @param tList
+     * @param <T>
+     */
+    public <T> void setUserName(List<T> tList) {
+        if (ListUtil.isEmpty(tList)) {
+            return;
+        }
+        List<String> userIdList = ReflectUtil.getPropertyList(tList, "modifier");
+        if (ListUtil.isNotEmpty(userIdList)) {
+            userIdList = userIdList.stream().distinct().collect(Collectors.toList());
+            RespDTO<Map<String, String>> mapRespDTO = userServiceClient.getUserInfoByIds(userIdList);
+            RespDTOUtil.respNGDealCover(mapRespDTO, "获取操作人失败");
+            Map<String, String> data = mapRespDTO.data;
+            for (T t : tList) {
+                ReflectUtil.setFieldValue(t, "modifier", data.get(ReflectUtil.getProperty(t, "modifier")));
+            }
+        }
+    }
+}

+ 619 - 0
cdssman-service/src/main/java/com/diagbot/facade/XLSXCovertCSVReader.java

@@ -0,0 +1,619 @@
+package com.diagbot.facade;
+
+import com.diagbot.entity.Ex;
+import com.diagbot.util.ReflectUtil;
+import com.diagbot.util.StringUtil;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
+import org.apache.poi.openxml4j.opc.OPCPackage;
+import org.apache.poi.openxml4j.opc.PackageAccess;
+import org.apache.poi.ss.usermodel.BuiltinFormats;
+import org.apache.poi.ss.usermodel.DataFormatter;
+import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
+import org.apache.poi.xssf.eventusermodel.XSSFReader;
+import org.apache.poi.xssf.model.StylesTable;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.springframework.web.multipart.MultipartFile;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/5/19 16:34
+ */
+public class XLSXCovertCSVReader {
+    /**
+     * The type of the data value is indicated by an attribute on the cell. The
+     * value is usually in a "v" element within the cell.
+     */
+    enum xssfDataType {
+        BOOL, ERROR, FORMULA, INLINESTR, SSTINDEX, NUMBER,
+    }
+
+    /**
+     * 使用xssf_sax_API处理Excel,请参考: http://poi.apache.org/spreadsheet/how-to.html#xssf_sax_api
+     * <p/>
+     * Also see Standard ECMA-376, 1st edition, part 4, pages 1928ff, at
+     * http://www.ecma-international.org/publications/standards/Ecma-376.htm
+     * <p/>
+     * A web-friendly version is http://openiso.org/Ecma/376/Part4
+     */
+    class MyXSSFSheetHandler extends DefaultHandler {
+
+        /**
+         * Table with styles
+         */
+        private StylesTable stylesTable;
+
+        /**
+         * Table with unique strings
+         */
+        private ReadOnlySharedStringsTable sharedStringsTable;
+
+        /**
+         * Destination for data
+         */
+        private final PrintStream output;
+
+        /**
+         * Number of columns to read starting with leftmost
+         */
+        private final int minColumnCount;
+
+        // Set when V start element is seen
+        private boolean vIsOpen;
+
+        // Set when cell start element is seen;
+        // used when cell close element is seen.
+        private xssfDataType nextDataType;
+
+        // Used to format numeric cell values.
+        private short formatIndex;
+        private String formatString;
+        private final DataFormatter formatter;
+
+        private int thisColumn = -1;
+        // The last column printed to the output stream
+        private int lastColumnNumber = -1;
+
+        // Gathers characters as they are seen.
+        private StringBuffer value;
+        private String[] record;
+        private List<String[]> rows = new ArrayList<String[]>();
+        private boolean isCellNull = false;
+
+        /**
+         * Accepts objects needed while parsing.
+         *
+         * @param styles  Table of styles
+         * @param strings Table of shared strings
+         * @param cols    Minimum number of columns to show
+         * @param target  Sink for output
+         */
+        public MyXSSFSheetHandler(StylesTable styles,
+                                  ReadOnlySharedStringsTable strings, int cols, PrintStream target) {
+            this.stylesTable = styles;
+            this.sharedStringsTable = strings;
+            this.minColumnCount = cols;
+            this.output = target;
+            this.value = new StringBuffer();
+            this.nextDataType = xssfDataType.NUMBER;
+            this.formatter = new DataFormatter();
+            record = new String[this.minColumnCount];
+            rows.clear();// 每次读取都清空行集合
+        }
+
+        /*
+         * (non-Javadoc)
+         *
+         * @see
+         * org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
+         * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+         */
+        public void startElement(String uri, String localName, String name,
+                                 Attributes attributes) throws SAXException {
+
+            if ("inlineStr".equals(name) || "v".equals(name)) {
+                vIsOpen = true;
+                // Clear contents cache
+                value.setLength(0);
+            }
+            // c => cell
+            else if ("c".equals(name)) {
+                // Get the cell reference
+                String r = attributes.getValue("r");
+                int firstDigit = -1;
+                for (int c = 0; c < r.length(); ++c) {
+                    if (Character.isDigit(r.charAt(c))) {
+                        firstDigit = c;
+                        break;
+                    }
+                }
+                thisColumn = nameToColumn(r.substring(0, firstDigit));
+
+                // Set up defaults.
+                this.nextDataType = xssfDataType.NUMBER;
+                this.formatIndex = -1;
+                this.formatString = null;
+                String cellType = attributes.getValue("t");
+                String cellStyleStr = attributes.getValue("s");
+                if ("b".equals(cellType)) {
+                    nextDataType = xssfDataType.BOOL;
+                } else if ("e".equals(cellType)) {
+                    nextDataType = xssfDataType.ERROR;
+                } else if ("inlineStr".equals(cellType)) {
+                    nextDataType = xssfDataType.INLINESTR;
+                } else if ("s".equals(cellType)) {
+                    nextDataType = xssfDataType.SSTINDEX;
+                } else if ("str".equals(cellType)) {
+                    nextDataType = xssfDataType.FORMULA;
+                } else if (cellStyleStr != null) {
+                    // It's a number, but almost certainly one
+                    // with a special style or format
+                    int styleIndex = Integer.parseInt(cellStyleStr);
+                    XSSFCellStyle style = stylesTable.getStyleAt(styleIndex);
+                    this.formatIndex = style.getDataFormat();
+                    this.formatString = style.getDataFormatString();
+                    if (this.formatString == null) {
+                        this.formatString = BuiltinFormats
+                                .getBuiltinFormat(this.formatIndex);
+                    }
+                }
+            }
+
+        }
+
+        /*
+         * (non-Javadoc)
+         *
+         * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
+         * java.lang.String, java.lang.String)
+         */
+        public void endElement(String uri, String localName, String name)
+                throws SAXException {
+
+            String thisStr = null;
+
+            // v => contents of a cell
+            if ("v".equals(name)) {
+                // Process the value contents as required.
+                // Do now, as characters() may be called more than once
+                switch (nextDataType) {
+
+                    case BOOL:
+                        char first = value.charAt(0);
+                        thisStr = first == '0' ? "FALSE" : "TRUE";
+                        break;
+
+                    case ERROR:
+                        thisStr = "ERROR:" + value.toString();
+                        break;
+
+                    case FORMULA:
+                        // A formula could result in a string value,
+                        // so always add double-quote characters.
+                        thisStr = value.toString();
+                        break;
+
+                    case INLINESTR:
+                        // TODO: have seen an example of this, so it's untested.
+                        XSSFRichTextString rtsi = new XSSFRichTextString(
+                                value.toString());
+                        thisStr = rtsi.toString();
+                        break;
+
+                    case SSTINDEX:
+                        String sstIndex = value.toString();
+                        try {
+                            int idx = Integer.parseInt(sstIndex);
+                            XSSFRichTextString rtss = new XSSFRichTextString(
+                                    sharedStringsTable.getEntryAt(idx));
+                            thisStr = rtss.toString();
+                        } catch (NumberFormatException ex) {
+                            output.println("Failed to parse SST index '" + sstIndex
+                                    + "': " + ex.toString());
+                        }
+                        break;
+
+                    case NUMBER:
+                        String n = value.toString();
+                        // 判断是否是日期格式
+                        if (HSSFDateUtil.isADateFormat(this.formatIndex, n)) {
+                            Double d = Double.parseDouble(n);
+                            Date date = HSSFDateUtil.getJavaDate(d);
+                            thisStr = formateDateToString(date);
+                        } else if (this.formatString != null) {
+                            thisStr = formatter.formatRawCellContents(
+                                    Double.parseDouble(n), this.formatIndex,
+                                    this.formatString);
+                        } else {
+                            thisStr = n;
+                        }
+                        break;
+
+                    default:
+                        thisStr = "(TODO: Unexpected type: " + nextDataType + ")";
+                        break;
+                }
+
+                // Output after we've seen the string contents
+                // Emit commas for any fields that were missing on this row
+                if (lastColumnNumber == -1) {
+                    lastColumnNumber = 0;
+                }
+                //判断单元格的值是否为空
+                if (thisStr == null || "".equals(isCellNull)) {
+                    isCellNull = true;// 设置单元格是否为空值
+                }
+                // trim()
+                if (thisStr != null) {
+                    thisStr = thisStr.trim();
+                }
+                record[thisColumn] = thisStr;
+                // Update column
+                if (thisColumn > -1) {
+                    lastColumnNumber = thisColumn;
+                }
+
+            } else if ("row".equals(name)) {
+                // Print out any missing commas if needed
+                if (minColumns > 0) {
+                    // Columns are 0 based
+                    if (lastColumnNumber == -1) {
+                        lastColumnNumber = 0;
+                    }
+                    if (isCellNull == false && record[0] != null
+                            && record[1] != null)// 判断是否空行
+                    {
+                        rows.add(record.clone());
+                        isCellNull = false;
+                        for (int i = 0; i < record.length; i++) {
+                            record[i] = null;
+                        }
+                    }
+                }
+                lastColumnNumber = -1;
+            }
+
+        }
+
+        public List<String[]> getRows() {
+            return rows;
+        }
+
+        public void setRows(List<String[]> rows) {
+            this.rows = rows;
+        }
+
+        /**
+         * Captures characters only if a suitable element is open. Originally
+         * was just "v"; extended for inlineStr also.
+         */
+        public void characters(char[] ch, int start, int length)
+                throws SAXException {
+            if (vIsOpen) {
+                value.append(ch, start, length);
+            }
+        }
+
+        /**
+         * Converts an Excel column name like "C" to a zero-based index.
+         *
+         * @param name
+         * @return Index corresponding to the specified name
+         */
+        private int nameToColumn(String name) {
+            int column = -1;
+            for (int i = 0; i < name.length(); ++i) {
+                int c = name.charAt(i);
+                column = (column + 1) * 26 + c - 'A';
+            }
+            return column;
+        }
+
+        private String formateDateToString(Date date) {
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//格式化日期
+            return sdf.format(date);
+
+        }
+
+    }
+
+    // /
+
+    private OPCPackage xlsxPackage;
+    private int minColumns;
+    private PrintStream output;
+    private String sheetName;
+
+    /**
+     * Creates a new XLSX -> CSV converter
+     *
+     * @param pkg        The XLSX package to process
+     * @param output     The PrintStream to output the CSV to
+     * @param minColumns The minimum number of columns to output, or -1 for no minimum
+     */
+    public XLSXCovertCSVReader(OPCPackage pkg, PrintStream output,
+                               String sheetName, int minColumns) {
+        this.xlsxPackage = pkg;
+        this.output = output;
+        this.minColumns = minColumns;
+        this.sheetName = sheetName;
+    }
+
+    /**
+     * Parses and shows the content of one sheet using the specified styles and
+     * shared-strings tables.
+     *
+     * @param styles
+     * @param strings
+     * @param sheetInputStream
+     */
+    public List<String[]> processSheet(StylesTable styles,
+                                       ReadOnlySharedStringsTable strings, InputStream sheetInputStream)
+            throws IOException, ParserConfigurationException, SAXException {
+
+        InputSource sheetSource = new InputSource(sheetInputStream);
+        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+        SAXParser saxParser = saxFactory.newSAXParser();
+        XMLReader sheetParser = saxParser.getXMLReader();
+        MyXSSFSheetHandler handler = new MyXSSFSheetHandler(styles, strings,
+                this.minColumns, this.output);
+        sheetParser.setContentHandler(handler);
+        sheetParser.parse(sheetSource);
+        return handler.getRows();
+    }
+
+    /**
+     * 初始化这个处理程序 将
+     *
+     * @throws IOException
+     * @throws OpenXML4JException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    public List<String[]> process() throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+
+        ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(
+                this.xlsxPackage);
+        XSSFReader xssfReader = new XSSFReader(this.xlsxPackage);
+        List<String[]> list = null;
+        StylesTable styles = xssfReader.getStylesTable();
+        XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader
+                .getSheetsData();
+        int index = 0;
+        while (iter.hasNext()) {
+            InputStream stream = iter.next();
+            String sheetNameTemp = iter.getSheetName();
+            if (this.sheetName.equals(sheetNameTemp)) {
+                list = processSheet(styles, strings, stream);
+                stream.close();
+                ++index;
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 读取Excel
+     *
+     * @param path       文件路径
+     * @param sheetName  sheet名称
+     * @param minColumns 列总数
+     * @return
+     * @throws SAXException
+     * @throws ParserConfigurationException
+     * @throws OpenXML4JException
+     * @throws IOException
+     */
+    private static List<String[]> readerExcel(String path, String sheetName,
+                                              int minColumns) throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+        OPCPackage p = OPCPackage.open(path, PackageAccess.READ);
+        XLSXCovertCSVReader xlsx2csv = new XLSXCovertCSVReader(p, System.out,
+                sheetName, minColumns);
+        List<String[]> list = xlsx2csv.process();
+        p.close();
+        return list;
+    }
+
+    /**
+     * 读取Excel
+     *
+     * @param inputStream
+     * @param sheetName
+     * @param minColumns
+     * @return
+     * @throws IOException
+     * @throws OpenXML4JException
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     */
+    private static List<String[]> readerExcel(InputStream inputStream, String sheetName,
+                                              int minColumns) throws IOException, OpenXML4JException,
+            ParserConfigurationException, SAXException {
+        OPCPackage p = OPCPackage.open(inputStream);
+        XLSXCovertCSVReader xlsx2csv = new XLSXCovertCSVReader(p, System.out,
+                sheetName, minColumns);
+        List<String[]> list = xlsx2csv.process();
+        p.close();
+        return list;
+    }
+
+    /**
+     * 读取数据
+     *
+     * @param path
+     * @param sheetName
+     * @param colNum
+     * @param c
+     * @return
+     */
+    public static <T> List<T> readData(String path, String sheetName, int colNum, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            List<String[]> stringList = XLSXCovertCSVReader.readerExcel(path, sheetName, colNum);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 读取数据
+     *
+     * @param file
+     * @param sheetName
+     * @param colNum
+     * @param c
+     * @return
+     */
+    public static <T> List<T> readData(MultipartFile file, String sheetName, int colNum, Class<T> c) {
+        List<T> list = Lists.newArrayList();
+        try {
+            List<String[]> stringList = XLSXCovertCSVReader.readerExcel(file.getInputStream(), sheetName, colNum);
+            return dealData(stringList, c);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return list;
+    }
+
+    /**
+     * 数据处理
+     *
+     * @param list
+     * @param c
+     * @param <T>
+     * @return
+     */
+    public static <T> List<T> dealData(List<String[]> list, Class<T> c) {
+        List<T> res = Lists.newArrayList();
+        try {
+            // 标题
+            String[] titleRow = list.get(0);
+            Map<Integer, String> colMap = new LinkedMap();
+            for (int i = 0; i < titleRow.length; i++) {
+                if (StringUtil.isBlank(titleRow[i])) {
+                    break;
+                }
+                colMap.put(i, titleRow[i]);
+            }
+            // System.out.println(colMap);
+
+            // 字段映射
+            Field[] fields = c.getDeclaredFields();
+            // 属性和表格列对应
+            Map<String, Map<String, String>> classMap = new LinkedHashMap();
+            for (Field field : fields) {
+                if (field.isAnnotationPresent(Ex.class)) {
+                    Ex annotation = field.getAnnotation(Ex.class);
+                    Map<String, String> propertyMap = new LinkedHashMap<>();
+                    propertyMap.put("field", field.getName());
+                    propertyMap.put("convertType", field.getGenericType().toString());
+                    classMap.put(annotation.name(), propertyMap);
+                }
+                field.getClass();
+            }
+            // System.out.println(classMap);
+
+            // 有效数据读取
+            int rowNum = 1;
+            for (String[] row : list) {
+                if (rowNum++ == 1) {
+                    continue;
+                }
+                T obj = c.newInstance();
+                for (int i = 0; i < row.length; i++) {
+                    if (classMap.get(colMap.get(i)) == null) {
+                        continue;
+                    }
+                    String property = classMap.get(colMap.get(i)).get("field");
+                    String convertType = classMap.get(colMap.get(i)).get("convertType");
+                    // System.out.println(property + ":" + row[i]);
+                    if (StringUtil.isNotBlank(property)) {
+                        Object value = convertValue(row[i], convertType);
+                        if (value != null) {
+                            ReflectUtil.setFieldValue(obj, property, value);
+                        }
+                    }
+                }
+                res.add(obj);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return res;
+    }
+
+    /**
+     * 根据反射转成不同的类型
+     *
+     * @param object
+     * @param convertType
+     * @return
+     */
+    public static Object convertValue(String object, String convertType) {
+        Object res = null;
+        if (object == null) {
+            return null;
+        }
+        try {
+            switch (convertType) {
+                case "class java.lang.Integer":
+                case "int":
+                    res = Integer.parseInt(object);
+                    break;
+                case "class java.lang.Long":
+                case "long":
+                    res = Long.parseLong(object);
+                    break;
+                case "class java.lang.Float":
+                case "float":
+                    res = Float.parseFloat(object);
+                    break;
+                case "class java.lang.Double":
+                case "double":
+                    res = Double.parseDouble(object);
+                    break;
+                case "class java.lang.Boolean":
+                case "boolean":
+                    res = Boolean.parseBoolean(object);
+                    break;
+                case "class java.lang.String":
+                    res = object;
+                    break;
+                default:
+                    res = object;
+                    break;
+            }
+        } catch (Exception e) {
+            // e.printStackTrace();
+            return null;
+        }
+        return res;
+    }
+}

+ 5 - 1
cdssman-service/src/main/java/com/diagbot/mapper/KlConceptMapper.java

@@ -1,10 +1,12 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.KlConceptAllDTO;
 import com.diagbot.dto.KlConceptInfoDTO;
+import com.diagbot.dto.KlConceptSimDTO;
 import com.diagbot.entity.KlConcept;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.ConceptRelationVO;
 import com.diagbot.vo.KlConceptAllVO;
 import com.diagbot.vo.KlConceptInfoVO;
 
@@ -25,4 +27,6 @@ public interface KlConceptMapper extends BaseMapper<KlConcept> {
     List<KlConceptAllDTO> getConceptAll(KlConceptAllVO klConceptAllVO);
 
     IPage<KlConceptInfoDTO> getConceptPage2(KlConceptInfoVO klConceptInfoVO);
+
+    List<KlConceptSimDTO> getRelationConcept(ConceptRelationVO conceptRelationVO);
 }

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlDrugMappingMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDrugMapping;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 药品通用名和注册名映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public interface KlDrugMappingMapper extends BaseMapper<KlDrugMapping> {
+
+}

+ 32 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlDrugRegisterMapper.java

@@ -0,0 +1,32 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlDrugMappingDTO;
+import com.diagbot.dto.KlDrugRegisterDTO;
+import com.diagbot.entity.KlDrugRegister;
+import com.diagbot.vo.KlDrugMappingGetVO;
+import com.diagbot.vo.KlDrugRegisterPageVO;
+import com.diagbot.vo.KlDrugSearchVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 药品注册表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public interface KlDrugRegisterMapper extends BaseMapper<KlDrugRegister> {
+
+    IPage<KlDrugRegisterDTO> getPage(KlDrugRegisterPageVO klDrugRegisterPageVO);
+
+    List<KlDrugMappingDTO> getMappingRegister(KlDrugMappingGetVO klDrugMappingGetVO);
+
+    List<KlConceptSimDTO> getMappingDrug(KlDrugMappingGetVO klDrugMappingGetVO);
+
+    List<KlConceptSimDTO> searchDrug(KlDrugSearchVO klDrugSearchVO);
+}

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlOperationMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlOperation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 手术扩展表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlOperationMapper extends BaseMapper<KlOperation> {
+
+}

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlPacsMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlPacs;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 辅检扩展表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlPacsMapper extends BaseMapper<KlPacs> {
+
+}

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlSymptomMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlSymptom;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 症状扩展表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlSymptomMapper extends BaseMapper<KlSymptom> {
+
+}

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlTcmDiseaseMapper.java

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

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlTcmSyndromeMapper.java

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

+ 16 - 0
cdssman-service/src/main/java/com/diagbot/mapper/KlVitalResultMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlVitalResult;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 体征结果扩展表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlVitalResultMapper extends BaseMapper<KlVitalResult> {
+
+}

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

+ 5 - 2
cdssman-service/src/main/java/com/diagbot/service/KlConceptService.java

@@ -1,11 +1,12 @@
 package com.diagbot.service;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.KlConceptAllDTO;
 import com.diagbot.dto.KlConceptInfoDTO;
+import com.diagbot.dto.KlConceptSimDTO;
 import com.diagbot.entity.KlConcept;
-import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.ConceptRelationVO;
 import com.diagbot.vo.KlConceptAllVO;
 import com.diagbot.vo.KlConceptInfoVO;
 
@@ -24,4 +25,6 @@ public interface KlConceptService extends IService<KlConcept> {
     public List<KlConceptAllDTO> getConceptAll(KlConceptAllVO klConceptAllVO);
 
     IPage<KlConceptInfoDTO> getConceptPage2(KlConceptInfoVO klConceptInfoVO);
+
+    List<KlConceptSimDTO> getRelationConcept(ConceptRelationVO conceptRelationVO);
 }

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDrugMapping;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 药品通用名和注册名映射表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public interface KlDrugMappingService extends IService<KlDrugMapping> {
+
+}

+ 32 - 0
cdssman-service/src/main/java/com/diagbot/service/KlDrugRegisterService.java

@@ -0,0 +1,32 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.KlConceptSimDTO;
+import com.diagbot.dto.KlDrugMappingDTO;
+import com.diagbot.dto.KlDrugRegisterDTO;
+import com.diagbot.entity.KlDrugRegister;
+import com.diagbot.vo.KlDrugMappingGetVO;
+import com.diagbot.vo.KlDrugRegisterPageVO;
+import com.diagbot.vo.KlDrugSearchVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 药品注册表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public interface KlDrugRegisterService extends IService<KlDrugRegister> {
+
+    IPage<KlDrugRegisterDTO> getPage(KlDrugRegisterPageVO klDrugRegisterPageVO);
+
+    List<KlDrugMappingDTO> getMappingRegister(KlDrugMappingGetVO klDrugMappingGetVO);
+
+    List<KlConceptSimDTO> getMappingDrug(KlDrugMappingGetVO klDrugMappingGetVO);
+
+    List<KlConceptSimDTO> searchDrug(KlDrugSearchVO klDrugSearchVO);
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlOperation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 手术扩展表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlOperationService extends IService<KlOperation> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlPacs;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 辅检扩展表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlPacsService extends IService<KlPacs> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlSymptom;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 症状扩展表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlSymptomService extends IService<KlSymptom> {
+
+}

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

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

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

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

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlVitalResult;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 体征结果扩展表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+public interface KlVitalResultService extends IService<KlVitalResult> {
+
+}

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

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


Some files were not shown because too many files changed in this diff