Browse Source

Merge branch 'master' into innerDevelop

gaodm 4 years ago
parent
commit
343c9c5644
100 changed files with 4746 additions and 560 deletions
  1. 2 0
      doc/001.00000000初始化脚本/cdss_init.sql
  2. BIN
      doc/基础数据映射导入模板/化验映射导入模板.xlsx
  3. BIN
      doc/基础数据映射导入模板/手术映射导入模板.xlsx
  4. BIN
      doc/基础数据映射导入模板/科室映射导入模板.xlsx
  5. BIN
      doc/基础数据映射导入模板/药品映射导入模板.xlsx
  6. BIN
      doc/基础数据映射导入模板/诊断映射导入模板.xlsx
  7. BIN
      doc/基础数据映射导入模板/辅检映射导入模板.xlsx
  8. 17 0
      pom.xml
  9. 170 10
      src/main/java/com/diagbot/aggregate/AssembleAggregate.java
  10. 2 3
      src/main/java/com/diagbot/aggregate/AssemblePushAggregate.java
  11. 28 0
      src/main/java/com/diagbot/client/CdssCoreClient.java
  12. 6 0
      src/main/java/com/diagbot/client/MrqcClient.java
  13. 37 0
      src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java
  14. 8 0
      src/main/java/com/diagbot/client/hystrix/MrqcHystrix.java
  15. 81 53
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  16. 77 49
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  17. 43 0
      src/main/java/com/diagbot/dto/ConceptDetailDTO.java
  18. 61 0
      src/main/java/com/diagbot/dto/ConceptInfoDTO.java
  19. 23 0
      src/main/java/com/diagbot/dto/DiseaseInfoDTO.java
  20. 28 0
      src/main/java/com/diagbot/dto/FileDTO.java
  21. 17 0
      src/main/java/com/diagbot/dto/FileDeleteDTO.java
  22. 25 0
      src/main/java/com/diagbot/dto/FileUploadDTO.java
  23. 2 0
      src/main/java/com/diagbot/dto/IndicationDTO.java
  24. 5 0
      src/main/java/com/diagbot/dto/PlanInfoPageDTO.java
  25. 4 0
      src/main/java/com/diagbot/dto/PushBaseDTO.java
  26. 6 0
      src/main/java/com/diagbot/dto/PushDTO.java
  27. 18 0
      src/main/java/com/diagbot/dto/PushPlanDTO.java
  28. 28 0
      src/main/java/com/diagbot/dto/PushPlanDetailDTO.java
  29. 20 0
      src/main/java/com/diagbot/dto/PushPlansDTO.java
  30. 5 1
      src/main/java/com/diagbot/dto/RetrievalDTO.java
  31. 6 1
      src/main/java/com/diagbot/dto/StaticKnowledgeDTO.java
  32. 1 1
      src/main/java/com/diagbot/dto/StaticKnowledgeDetailDTO.java
  33. 10 2
      src/main/java/com/diagbot/dto/StaticKnowledgeIndexDTO.java
  34. 1 2
      src/main/java/com/diagbot/dto/TemplateInfoDTO.java
  35. 1 1
      src/main/java/com/diagbot/dto/TemplateInfoPageDTO.java
  36. 19 0
      src/main/java/com/diagbot/dto/TreatDTO.java
  37. 29 0
      src/main/java/com/diagbot/dto/TreatDetailDTO.java
  38. 1 1
      src/main/java/com/diagbot/entity/ConceptDetail.java
  39. 57 22
      src/main/java/com/diagbot/entity/DeptConfig.java
  40. 52 19
      src/main/java/com/diagbot/entity/DiseaseConfig.java
  41. 70 18
      src/main/java/com/diagbot/entity/DrugConfig.java
  42. 56 24
      src/main/java/com/diagbot/entity/LisConfig.java
  43. 52 19
      src/main/java/com/diagbot/entity/OperationConfig.java
  44. 50 17
      src/main/java/com/diagbot/entity/PacsConfig.java
  45. 197 0
      src/main/java/com/diagbot/entity/TransfusionConfig.java
  46. 23 8
      src/main/java/com/diagbot/enums/ConceptTypeEnum.java
  47. 68 0
      src/main/java/com/diagbot/enums/StaticTypeEnum.java
  48. 1 1
      src/main/java/com/diagbot/enums/StatusEnum.java
  49. 2 0
      src/main/java/com/diagbot/facade/AssembleFacade.java
  50. 439 69
      src/main/java/com/diagbot/facade/ConceptInfoFacade.java
  51. 163 17
      src/main/java/com/diagbot/facade/DeptConfigFacade.java
  52. 15 0
      src/main/java/com/diagbot/facade/DictionaryFacade.java
  53. 161 19
      src/main/java/com/diagbot/facade/DiseaseConfigFacade.java
  54. 329 29
      src/main/java/com/diagbot/facade/DrugConfigFacade.java
  55. 198 26
      src/main/java/com/diagbot/facade/LisConfigFacade.java
  56. 8 0
      src/main/java/com/diagbot/facade/MrqcFacade.java
  57. 159 18
      src/main/java/com/diagbot/facade/OperationConfigFacade.java
  58. 159 18
      src/main/java/com/diagbot/facade/PacsConfigFacade.java
  59. 18 14
      src/main/java/com/diagbot/facade/PlanDetailFacade.java
  60. 111 21
      src/main/java/com/diagbot/facade/PlanFacade.java
  61. 327 54
      src/main/java/com/diagbot/facade/PushFacade.java
  62. 433 0
      src/main/java/com/diagbot/facade/TransfusionConfigFacade.java
  63. 13 0
      src/main/java/com/diagbot/facade/UploadFacade.java
  64. 13 3
      src/main/java/com/diagbot/mapper/ConceptInfoMapper.java
  65. 25 0
      src/main/java/com/diagbot/mapper/TransfusionConfigMapper.java
  66. 11 1
      src/main/java/com/diagbot/service/ConceptInfoService.java
  67. 25 0
      src/main/java/com/diagbot/service/TransfusionConfigService.java
  68. 13 0
      src/main/java/com/diagbot/service/UploadService.java
  69. 15 2
      src/main/java/com/diagbot/service/impl/ConceptInfoServiceImpl.java
  70. 6 0
      src/main/java/com/diagbot/service/impl/MrServiceImpl.java
  71. 33 0
      src/main/java/com/diagbot/service/impl/TransfusionConfigServiceImpl.java
  72. 134 0
      src/main/java/com/diagbot/service/impl/UploadServiceImpl.java
  73. 36 2
      src/main/java/com/diagbot/util/ExcelUtils.java
  74. 14 0
      src/main/java/com/diagbot/vo/AnalyzeCdsVO.java
  75. 16 0
      src/main/java/com/diagbot/vo/ChangeStatusVO.java
  76. 47 0
      src/main/java/com/diagbot/vo/ConceptDetailVO.java
  77. 33 0
      src/main/java/com/diagbot/vo/ConceptInfoPageVO.java
  78. 45 0
      src/main/java/com/diagbot/vo/ConceptInfoVO.java
  79. 20 0
      src/main/java/com/diagbot/vo/ConceptVO.java
  80. 2 1
      src/main/java/com/diagbot/vo/DiseaseConfigPageVO.java
  81. 17 0
      src/main/java/com/diagbot/vo/Drug.java
  82. 7 1
      src/main/java/com/diagbot/vo/DrugConfigPageVO.java
  83. 32 0
      src/main/java/com/diagbot/vo/HasStaticKnowledgeVO.java
  84. 20 0
      src/main/java/com/diagbot/vo/HospitalPlanIdVO.java
  85. 1 0
      src/main/java/com/diagbot/vo/HospitalPlanSaveVO.java
  86. 1 1
      src/main/java/com/diagbot/vo/IndicationPushVO.java
  87. 17 0
      src/main/java/com/diagbot/vo/ItemExt.java
  88. 20 3
      src/main/java/com/diagbot/vo/PushJoinVO.java
  89. 14 0
      src/main/java/com/diagbot/vo/PushPlanVO.java
  90. 6 0
      src/main/java/com/diagbot/vo/PushVO.java
  91. 19 3
      src/main/java/com/diagbot/vo/SearchData.java
  92. 1 1
      src/main/java/com/diagbot/vo/StaticKnowledgeVO.java
  93. 1 1
      src/main/java/com/diagbot/vo/TemplateIdVO.java
  94. 1 1
      src/main/java/com/diagbot/vo/TemplateInfoPageVO.java
  95. 18 0
      src/main/java/com/diagbot/vo/TransfusionConfigListVO.java
  96. 36 0
      src/main/java/com/diagbot/vo/TransfusionConfigPageVO.java
  97. 4 0
      src/main/java/com/diagbot/web/ConceptDetailController.java
  98. 81 3
      src/main/java/com/diagbot/web/ConceptInfoController.java
  99. 20 0
      src/main/java/com/diagbot/web/DeptConfigController.java
  100. 0 0
      src/main/java/com/diagbot/web/DictionaryInfoController.java

+ 2 - 0
doc/001.00000000初始化脚本/cdss_init.sql

@@ -317,3 +317,5 @@ CREATE TABLE `tran_dept_config` (
   `unique_code` varchar(255) DEFAULT NULL COMMENT '标准编码',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='科室映射表';
+
+ALTER TABLE `graph_concept_info`  MODIFY   `name` varchar(255) CHARACTER SET utf8mb4 NOT NULL COMMENT '标准术语';

BIN
doc/基础数据映射导入模板/化验映射导入模板.xlsx


BIN
doc/基础数据映射导入模板/手术映射导入模板.xlsx


BIN
doc/基础数据映射导入模板/科室映射导入模板.xlsx


BIN
doc/基础数据映射导入模板/药品映射导入模板.xlsx


BIN
doc/基础数据映射导入模板/诊断映射导入模板.xlsx


BIN
doc/基础数据映射导入模板/辅检映射导入模板.xlsx


+ 17 - 0
pom.xml

@@ -188,6 +188,23 @@
             <artifactId>commons-pool2</artifactId>
         </dependency>
 
+        <!-- 文件上传相关架包 -->
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>io.github.lvyahui8</groupId>
             <artifactId>spring-boot-data-aggregator-starter</artifactId>

+ 170 - 10
src/main/java/com/diagbot/aggregate/AssembleAggregate.java

@@ -9,9 +9,12 @@ import com.diagbot.facade.DrugConfigFacade;
 import com.diagbot.facade.LisConfigFacade;
 import com.diagbot.facade.OperationConfigFacade;
 import com.diagbot.facade.PacsConfigFacade;
+import com.diagbot.facade.TransfusionConfigFacade;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
+import com.diagbot.vo.Drug;
+import com.diagbot.vo.ItemExt;
 import com.diagbot.vo.SearchData;
 import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.annotation.DataConsumer;
@@ -45,6 +48,8 @@ public class AssembleAggregate {
     private OperationConfigFacade operationConfigFacade;
     @Autowired
     private DeptConfigFacade deptConfigFacade;
+    @Autowired
+    private TransfusionConfigFacade transfusionConfigFacade;
 
     @DataProvider("assembleDataAll")
     public SearchData assembleDataAll(
@@ -52,9 +57,10 @@ public class AssembleAggregate {
             @DataConsumer("lisConfigMap") Map<String, Map<String, Map<String, Long>>> lisConfigMap,
             @DataConsumer("pacsConfigMap") Map<String, Map<String, Long>> pacsConfigMap,
             @DataConsumer("diagConfigMap") Map<String, Map<String, Long>> diagConfigMap,
-            @DataConsumer("drugConfigMap") Map<String, Map<String, Long>> drugConfigMap,
+            @DataConsumer("drugConfigMap") Map<String, Map<String, Map<String, Long>>> drugConfigMap,
             @DataConsumer("operationConfigMap") Map<String, Map<String, Long>> operationConfigMap,
-            @DataConsumer("deptConfigMap") Map<String, Map<String, Long>> deptConfigMap) {
+            @DataConsumer("deptConfigMap") Map<String, Map<String, Long>> deptConfigMap,
+            @DataConsumer("transfusionConfigMap") Map<String, Map<String, Long>> transfusionConfigMap) {
         //检验
         if (MapUtils.isNotEmpty(lisConfigMap)) {
             if (ListUtil.isNotEmpty(searchData.getLis())) {
@@ -87,24 +93,38 @@ public class AssembleAggregate {
                 List<Item> convertItem = itemConvert(searchData.getDiagOrder(), diagConfigMap);
                 searchData.setDiagOrder(convertItem);
             }
+            if (searchData.getDiseaseName() != null
+                    && StringUtil.isNotBlank(searchData.getDiseaseName().getName())) {
+                List<Item> convertItem = itemConvert(Lists.newArrayList(searchData.getDiseaseName()), diagConfigMap);
+                searchData.setDiseaseName(convertItem.get(0));
+            }
         }
         //药品
         if (MapUtils.isNotEmpty(drugConfigMap)) {
             if (ListUtil.isNotEmpty(searchData.getDrug())) {
-                List<Item> convertItem = itemConvert(searchData.getDrug(), drugConfigMap);
+                List<Drug> convertItem = drugConvert(searchData.getDrug(), drugConfigMap);
                 searchData.setDrug(convertItem);
             }
             if (ListUtil.isNotEmpty(searchData.getDrugOrder())) {
-                List<Item> convertItem = itemConvert(searchData.getDrugOrder(), drugConfigMap);
+                List<Drug> convertItem = drugConvert(searchData.getDrugOrder(), drugConfigMap);
                 searchData.setDrugOrder(convertItem);
             }
         }
         //手术
         if (MapUtils.isNotEmpty(operationConfigMap)) {
+            if (ListUtil.isNotEmpty(searchData.getOperation())) {
+                List<Item> convertItem = itemConvert(searchData.getOperation(), operationConfigMap);
+                searchData.setOperation(convertItem);
+            }
             if (ListUtil.isNotEmpty(searchData.getOperationOrder())) {
                 List<Item> convertItem = itemConvert(searchData.getOperationOrder(), operationConfigMap);
                 searchData.setOperationOrder(convertItem);
             }
+            if (searchData.getOperationName() != null
+                    && StringUtil.isNotBlank(searchData.getOperationName().getName())) {
+                List<Item> convertItem = itemConvert(Lists.newArrayList(searchData.getOperationName()), operationConfigMap);
+                searchData.setOperationName(convertItem.get(0));
+            }
         }
         //科室
         if (MapUtils.isNotEmpty(deptConfigMap)) {
@@ -113,8 +133,17 @@ public class AssembleAggregate {
                 searchData.setDept(convertItem);
             }
         }
-
-
+        //输血
+        if (MapUtils.isNotEmpty(transfusionConfigMap)) {
+            if (ListUtil.isNotEmpty(searchData.getTransfusion())) {
+                List<ItemExt> convertItem = itemExtConvert(searchData.getTransfusion(), transfusionConfigMap);
+                searchData.setTransfusion(convertItem);
+            }
+            if (ListUtil.isNotEmpty(searchData.getTransfusionOrder())) {
+                List<ItemExt> convertItem = itemExtConvert(searchData.getTransfusionOrder(), transfusionConfigMap);
+                searchData.setTransfusionOrder(convertItem);
+            }
+        }
         return searchData;
     }
 
@@ -204,6 +233,11 @@ public class AssembleAggregate {
                     .map(i -> i.getName())
                     .collect(Collectors.toList()));
         }
+        //diseaseName
+        if (searchData.getDiseaseName() != null
+                && StringUtil.isNotBlank(searchData.getDiseaseName().getName())) {
+            diagHisNameList.add(searchData.getDiseaseName().getName());
+        }
         diagHisNameList = diagHisNameList
                 .stream()
                 .distinct()
@@ -218,7 +252,7 @@ public class AssembleAggregate {
     }
 
     @DataProvider("drugConfigMap")
-    public Map<String, Map<String, Long>> drugConfigMap(@InvokeParameter("searchData") SearchData searchData) {
+    public Map<String, Map<String, Map<String, Long>>> drugConfigMap(@InvokeParameter("searchData") SearchData searchData) {
         //药品公表转换
         List<String> drugHisNameList = Lists.newArrayList();
         //drug
@@ -242,7 +276,7 @@ public class AssembleAggregate {
                 .distinct()
                 .collect(Collectors.toList());
 
-        Map<String, Map<String, Long>> configMap = new HashMap<>();
+        Map<String, Map<String, Map<String, Long>>> configMap = new HashMap<>();
         if (ListUtil.isNotEmpty(drugHisNameList)) {
             configMap
                     = drugConfigFacade.getConfigMap(searchData.getHospitalId(), drugHisNameList, null);
@@ -254,6 +288,14 @@ public class AssembleAggregate {
     public Map<String, Map<String, Long>> operationConfigMap(@InvokeParameter("searchData") SearchData searchData) {
         //手术公表转换
         List<String> operationHisNameList = Lists.newArrayList();
+        //operation
+        if (ListUtil.isNotEmpty(searchData.getOperation())) {
+            operationHisNameList.addAll(searchData.getOperation()
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getName()) || StringUtil.isNotBlank(i.getUniqueName()))
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList()));
+        }
         //operationOrder
         if (ListUtil.isNotEmpty(searchData.getOperationOrder())) {
             operationHisNameList.addAll(searchData.getOperationOrder()
@@ -262,6 +304,11 @@ public class AssembleAggregate {
                     .map(i -> i.getName())
                     .collect(Collectors.toList()));
         }
+        //operationName
+        if (searchData.getOperationName() != null
+                && StringUtil.isNotBlank(searchData.getOperationName().getName())) {
+            operationHisNameList.add(searchData.getDiseaseName().getName());
+        }
         operationHisNameList = operationHisNameList
                 .stream()
                 .distinct()
@@ -301,6 +348,40 @@ public class AssembleAggregate {
         return configMap;
     }
 
+    @DataProvider("transfusionConfigMap")
+    public Map<String, Map<String, Long>> transfusionConfigMap(@InvokeParameter("searchData") SearchData searchData) {
+        //输血公表转换
+        List<String> transfusionHisNameList = Lists.newArrayList();
+        //transfusion
+        if (ListUtil.isNotEmpty(searchData.getTransfusion())) {
+            transfusionHisNameList.addAll(searchData.getTransfusion()
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getName()) || StringUtil.isNotBlank(i.getUniqueName()))
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList()));
+        }
+        //transfusionOrder
+        if (ListUtil.isNotEmpty(searchData.getTransfusionOrder())) {
+            transfusionHisNameList.addAll(searchData.getTransfusionOrder()
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getName()) || StringUtil.isNotBlank(i.getUniqueName()))
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList()));
+        }
+        transfusionHisNameList = transfusionHisNameList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
+
+        Map<String, Map<String, Long>> configMap = new HashMap<>();
+
+        if (ListUtil.isNotEmpty(transfusionHisNameList)) {
+            configMap
+                    = transfusionConfigFacade.getConfigMap(searchData.getHospitalId(), transfusionHisNameList, null);
+        }
+        return configMap;
+    }
+
     /**
      * 化验公表转换
      *
@@ -382,7 +463,49 @@ public class AssembleAggregate {
     }
 
     /**
-     * 药品、手术、诊断、科室转换
+     * 药品公表转换
+     *
+     * @param drug
+     * @param configMap
+     * @return
+     */
+    public List<Drug> drugConvert(List<Drug> drug, Map<String, Map<String, Map<String, Long>>> configMap) {
+        if (ListUtil.isEmpty(drug)) {
+            return drug;
+        }
+        if (configMap == null || configMap.size() == 0) {
+            return drug;
+        }
+        List<Drug> convertDrug = Lists.newLinkedList();
+
+        drug.forEach(drugRecord -> {
+            if (StringUtil.isBlank(drugRecord.getName())
+                    || StringUtil.isNotBlank(drugRecord.getUniqueName())) {
+                convertDrug.add(drugRecord);
+            } else {
+                Map<String, Long> uniqueNameMap = new HashMap<>();
+                if (StringUtil.isBlank(drugRecord.getForm())) {
+                    drugRecord.setForm("");
+                }
+                if (configMap.get(drugRecord.getName()) != null
+                        && configMap.get(drugRecord.getName()).get(drugRecord.getForm()) != null) {
+                    uniqueNameMap = configMap.get(drugRecord.getName()).get(drugRecord.getForm());
+                }
+                if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
+                    for (String uniqueName : uniqueNameMap.keySet()) {
+                        Drug convertDrugRecord = new Drug();
+                        BeanUtil.copyProperties(drugRecord, convertDrugRecord);
+                        convertDrugRecord.setUniqueName(uniqueName);
+                        convertDrug.add(convertDrugRecord);
+                    }
+                }
+            }
+        });
+        return convertDrug;
+    }
+
+    /**
+     * 手术、诊断、科室转换
      *
      * @param items
      * @param configMap
@@ -417,4 +540,41 @@ public class AssembleAggregate {
         });
         return convertItem;
     }
-}
+
+    /**
+     * 输血转换
+     *
+     * @param items
+     * @param configMap
+     * @return
+     */
+    public List<ItemExt> itemExtConvert(List<ItemExt> items, Map<String, Map<String, Long>> configMap) {
+        if (ListUtil.isEmpty(items)) {
+            return items;
+        }
+        if (configMap == null || configMap.size() == 0) {
+            return items;
+        }
+        List<ItemExt> convertItem = Lists.newLinkedList();
+        items.forEach(item -> {
+            if (StringUtil.isBlank(item.getName())
+                    || StringUtil.isNotBlank(item.getUniqueName())) {
+                convertItem.add(item);
+            } else {
+                Map<String, Long> uniqueNameMap = new HashMap<>();
+                if (configMap.get(item.getName()) != null) {
+                    uniqueNameMap = configMap.get(item.getName());
+                }
+                if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
+                    for (String uniqueName : uniqueNameMap.keySet()) {
+                        ItemExt convertItemRecord = new ItemExt();
+                        BeanUtil.copyProperties(item, convertItemRecord);
+                        convertItemRecord.setUniqueName(uniqueName);
+                        convertItem.add(convertItemRecord);
+                    }
+                }
+            }
+        });
+        return convertItem;
+    }
+}

+ 2 - 3
src/main/java/com/diagbot/aggregate/AssemblePushAggregate.java

@@ -70,7 +70,6 @@ public class AssemblePushAggregate {
         if (ListUtil.isNotEmpty(retDrug)) {
             data.setMedicines(retDrug);
         }
-
         return data;
     }
 
@@ -186,7 +185,7 @@ public class AssemblePushAggregate {
                     .map(i -> i.getName())
                     .collect(Collectors.toList());
             Map<String, Map<String, Long>> uniqueNameMap
-                    = drugConfigFacade.getUniqueNameConfigMap(hospitalId, null, uniqueNameList);
+                    = drugConfigFacade.getUniqueNameConfigMapWithoutForm(hospitalId, null, uniqueNameList);
             if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
                 retDrug.forEach(item -> {
                     if (uniqueNameMap.get(item.getName()) != null) {
@@ -197,4 +196,4 @@ public class AssemblePushAggregate {
         }
         return retDrug;
     }
-}
+}

+ 28 - 0
src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -3,10 +3,14 @@ package com.diagbot.client;
 import com.diagbot.client.hystrix.CdssCoreHystrix;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.IndicationPushVO;
+import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
@@ -31,6 +35,12 @@ public interface CdssCoreClient {
     @PostMapping("/core/push")
     RespDTO<PushDTO> push(@RequestBody @Valid PushVO pushVo);
 
+    /**
+     * 推送持续检验检查计划
+     */
+    @PostMapping("/core/pushPlan")
+    RespDTO<PushPlanDTO> pushPlan(@RequestBody PushPlanVO pushPlanVO);
+
     /**
      * 化验大项、化验小项、辅检、诊断、药品、手术等检索
      *
@@ -48,6 +58,24 @@ public interface CdssCoreClient {
      */
     @PostMapping("/retrieval/staticKnowledgeIndex")
     RespDTO<List<StaticKnowledgeIndexDTO>> staticKnowledgeIndex(@RequestBody @Valid StaticKnowledgeIndexVO staticKnowledgeIndexVO);
+
+    /**
+     * 更新是否有静态知识状态
+     *
+     * @param hasStaticKnowledgeVO
+     * @return
+     */
+    @PostMapping("/staticKnowledge/updateHasInfoStatus")
+    RespDTO<Boolean> updateHasInfoStatus(@Valid @RequestBody HasStaticKnowledgeVO hasStaticKnowledgeVO);
+
+    /**
+     * 术语批量校验
+     *
+     * @param conceptVO
+     * @return
+     */
+    @PostMapping("/retrieval/getConceptNames")
+    RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
 }
 
 

+ 6 - 0
src/main/java/com/diagbot/client/MrqcClient.java

@@ -3,12 +3,14 @@ package com.diagbot.client;
 import com.diagbot.client.hystrix.MrqcHystrix;
 import com.diagbot.dto.AnalyzeRunDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.AnalyzeCdsVO;
 import com.diagbot.vo.AnalyzeRunVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.validation.Valid;
+import java.util.Map;
 
 /**
  * @Description: 病历质控客户端
@@ -19,6 +21,10 @@ import javax.validation.Valid;
 public interface MrqcClient {
     @PostMapping("/qc/behospitalInfo/analyze_run")
     RespDTO<AnalyzeRunDTO> analyzeRun(@Valid @RequestBody AnalyzeRunVO analyzeRunVO);
+
+    @PostMapping("/qc/behospitalInfo/analyzeCds")
+    RespDTO<Map<String, String>> caseWritingPrompt(@Valid @RequestBody AnalyzeCdsVO analyzeCdsVO);
+
 }
 
 

+ 37 - 0
src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -3,10 +3,14 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
 import com.diagbot.vo.IndicationPushVO;
+import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.RetrievalVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
@@ -38,6 +42,15 @@ public class CdssCoreHystrix implements CdssCoreClient {
         return null;
     }
 
+    /**
+     * 推送持续检验检查计划
+     */
+    @Override
+    public RespDTO<PushPlanDTO> pushPlan(@RequestBody PushPlanVO pushPlanVO) {
+        log.error("【hystrix】调用{}异常", "pushPlan");
+        return null;
+    }
+
     /**
      * 化验大项、化验小项、辅检、诊断、药品、手术等检索
      *
@@ -61,4 +74,28 @@ public class CdssCoreHystrix implements CdssCoreClient {
         log.error("【hystrix】调用{}异常", "staticKnowledgeIndex");
         return null;
     }
+
+    /**
+     * 更新是否有静态知识状态
+     *
+     * @param hasStaticKnowledgeVO
+     * @return
+     */
+    @Override
+    public RespDTO<Boolean> updateHasInfoStatus(@Valid @RequestBody HasStaticKnowledgeVO hasStaticKnowledgeVO) {
+        log.error("【hystrix】调用{}异常", "updateHasInfoStatus");
+        return null;
+    }
+
+    /**
+     * 术语批量校验
+     *
+     * @param conceptVO
+     * @return
+     */
+    @Override
+    public RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
+        log.error("【hystrix】调用{}异常", "getConceptNames");
+        return null;
+    }
 }

+ 8 - 0
src/main/java/com/diagbot/client/hystrix/MrqcHystrix.java

@@ -3,12 +3,14 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.MrqcClient;
 import com.diagbot.dto.AnalyzeRunDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.AnalyzeCdsVO;
 import com.diagbot.vo.AnalyzeRunVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.validation.Valid;
+import java.util.Map;
 
 /**
  * @Description: 病历质控客户端(请求失败熔断)
@@ -24,4 +26,10 @@ public class MrqcHystrix implements MrqcClient {
         log.error("【hystrix】调用{}异常", "analyzeRun");
         return null;
     }
+
+    @Override
+    public RespDTO<Map<String, String>> caseWritingPrompt(@Valid AnalyzeCdsVO analyzeCdsVO) {
+        log.error("【hystrix】调用{}异常", "caseWritingPrompt");
+        return null;
+    }
 }

+ 81 - 53
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -40,58 +40,73 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/sys/user/getJwt").permitAll()
                 .antMatchers("/sys/user/refreshJwt").permitAll()
                 .antMatchers("/sys/user/checkToken").permitAll()
-                .antMatchers("/sys/user/getUserOrgMenu").permitAll()
+                //.antMatchers("/sys/user/getUserOrgMenu").permitAll()
                 .antMatchers("/oauth/token").permitAll()
                 .antMatchers("/oauth/check_token").permitAll()
-                .antMatchers("/tran/lisConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/lisConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/lisConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/lisConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/lisConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/lisConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/lisConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/lisConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/lisConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/lisConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/lisConfig/getPage").permitAll()
-                .antMatchers("/tran/lisConfig/importExcel").permitAll()
-                .antMatchers("/tran/lisConfig/exportExcel").permitAll()
-                .antMatchers("/tran/pacsConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/pacsConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/pacsConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/pacsConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/pacsConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/lisConfig/importExcel").permitAll()
+                //.antMatchers("/tran/lisConfig/exportExcel").permitAll()
+                .antMatchers("/tran/lisConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/pacsConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/pacsConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/pacsConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/pacsConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/pacsConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/pacsConfig/getPage").permitAll()
-                .antMatchers("/tran/pacsConfig/importExcel").permitAll()
-                .antMatchers("/tran/pacsConfig/exportExcel").permitAll()
-                .antMatchers("/tran/diseaseConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/diseaseConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/diseaseConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/diseaseConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/diseaseConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/pacsConfig/importExcel").permitAll()
+                //.antMatchers("/tran/pacsConfig/exportExcel").permitAll()
+                .antMatchers("/tran/pacsConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/diseaseConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/diseaseConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/diseaseConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/diseaseConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/diseaseConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/diseaseConfig/getPage").permitAll()
-                .antMatchers("/tran/diseaseConfig/importExcel").permitAll()
-                .antMatchers("/tran/diseaseConfig/exportExcel").permitAll()
-                .antMatchers("/tran/drugConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/drugConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/drugConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/drugConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/drugConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/diseaseConfig/importExcel").permitAll()
+                //.antMatchers("/tran/diseaseConfig/exportExcel").permitAll()
+                .antMatchers("/tran/diseaseConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/drugConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/drugConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/drugConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/drugConfig/deleteRecord").permitAll()
+                // .antMatchers("/tran/drugConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/drugConfig/getPage").permitAll()
-                .antMatchers("/tran/drugConfig/importExcel").permitAll()
-                .antMatchers("/tran/drugConfig/exportExcel").permitAll()
-                .antMatchers("/tran/operationConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/operationConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/operationConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/operationConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/operationConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/drugConfig/importExcel").permitAll()
+                // .antMatchers("/tran/drugConfig/exportExcel").permitAll()
+                .antMatchers("/tran/drugConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/operationConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/operationConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/operationConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/operationConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/operationConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/operationConfig/getPage").permitAll()
-                .antMatchers("/tran/operationConfig/importExcel").permitAll()
-                .antMatchers("/tran/operationConfig/exportExcel").permitAll()
-                .antMatchers("/tran/deptConfig/isExistRecord").permitAll()
-                .antMatchers("/tran/deptConfig/saveOrUpdateRecord").permitAll()
-                .antMatchers("/tran/deptConfig/saveOrUpdateRecords").permitAll()
-                .antMatchers("/tran/deptConfig/deleteRecord").permitAll()
-                .antMatchers("/tran/deptConfig/deleteRecords").permitAll()
+                //.antMatchers("/tran/operationConfig/importExcel").permitAll()
+                //.antMatchers("/tran/operationConfig/exportExcel").permitAll()
+                .antMatchers("/tran/operationConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/deptConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/deptConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/deptConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/deptConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/deptConfig/deleteRecords").permitAll()
                 .antMatchers("/tran/deptConfig/getPage").permitAll()
-                .antMatchers("/tran/deptConfig/importExcel").permitAll()
-                .antMatchers("/tran/deptConfig/exportExcel").permitAll()
-                .antMatchers("/tran/hospitalInfo/saveRecord").permitAll()
+                //.antMatchers("/tran/deptConfig/importExcel").permitAll()
+                //.antMatchers("/tran/deptConfig/exportExcel").permitAll()
+                .antMatchers("/tran/deptConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/transfusionConfig/isExistRecord").permitAll()
+                //.antMatchers("/tran/transfusionConfig/saveOrUpdateRecord").permitAll()
+                //.antMatchers("/tran/transfusionConfig/saveOrUpdateRecords").permitAll()
+                //.antMatchers("/tran/transfusionConfig/deleteRecord").permitAll()
+                //.antMatchers("/tran/transfusionConfig/deleteRecords").permitAll()
+                .antMatchers("/tran/transfusionConfig/getPage").permitAll()
+                //.antMatchers("/tran/transfusionConfig/importExcel").permitAll()
+                //.antMatchers("/tran/transfusionConfig/exportExcel").permitAll()
+                .antMatchers("/tran/transfusionConfig/exportExcelModule").permitAll()
+                //.antMatchers("/tran/hospitalInfo/saveRecord").permitAll()
                 .antMatchers("/tran/hospitalInfo/getHospitalInfo").permitAll()
                 .antMatchers("/tran/hospitalInfo/getHospitalInfoById").permitAll()
                 .antMatchers("/sys/versionInfo/getVersionInfoAlls").permitAll()
@@ -103,29 +118,42 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/sys/tokenPermission/delPermission").permitAll()
                 .antMatchers("/sys/tokenPermission/getPermission").permitAll()
                 .antMatchers("/sys/push/push").permitAll()
+                .antMatchers("/sys/push/pushApi").permitAll()
                 .antMatchers("/sys/push/indicationPush").permitAll()
+                .antMatchers("/sys/push/pushPlan").permitAll()
                 .antMatchers("/demo/templateInfo/updateByIdUsNames").permitAll()
                 .antMatchers("/demo/templateInfo/saveTemplateInfo").permitAll()
                 .antMatchers("/demo/templateInfo/cancelTemplateInfos").permitAll()
                 .antMatchers("/demo/templateInfo/getTemplatePageAlls").permitAll()
                 .antMatchers("/demo/templateInfo/getTemplatebyId").permitAll()
                 .antMatchers("/sys/tokenPermission/getPermission").permitAll()
-                .antMatchers("/sys/plan/getPlanInfoPages").permitAll()
-                .antMatchers("/sys/plan/savePlanInfoDatas").permitAll()
-                .antMatchers("/sys/plan/getSysPlanInfoDatas").permitAll()
-                .antMatchers("/sys/plan/cancelPlanDatas").permitAll()
-                .antMatchers("/sys/plan/revStopPlans").permitAll()
+                //.antMatchers("/sys/plan/getPlanInfoPages").permitAll()
+                //.antMatchers("/sys/plan/savePlanInfoDatas").permitAll()
+                //.antMatchers("/sys/plan/getSysPlanInfoDatas").permitAll()
+                //.antMatchers("/sys/plan/cancelPlanDatas").permitAll()
+                //.antMatchers("/sys/plan/revStopPlans").permitAll()
                 .antMatchers("/sys/tokenHospital/getTokenHospital").permitAll()
                 .antMatchers("/demo/retrieval/index").permitAll()
                 .antMatchers("/graph/conceptInfo/staticKnowledgeIndex").permitAll()
+                .antMatchers("/graph/conceptInfo/staticKnowledgeIndexWithoutInfo").permitAll()
                 .antMatchers("/graph/conceptInfo/getStaticKnowledge").permitAll()
                 .antMatchers("/graph/conceptInfo/getStaticKnowledgeForHIS").permitAll()
+                .antMatchers("/graph/conceptInfo/getPage").permitAll()
+                .antMatchers("/graph/conceptInfo/saveOrUpdateRecord").permitAll()
+                .antMatchers("/graph/conceptInfo/changeStatus").permitAll()
+                .antMatchers("/graph/conceptInfo/isExist").permitAll()
+                .antMatchers("/graph/conceptInfo/getRecordById").permitAll()
                 .antMatchers("/sys/planDetail/getPlanDetailDatas").permitAll()
-                .antMatchers("/sys/planDetail/savePlanDetails").permitAll()
-                .antMatchers("/sys/planDetail/cancelPlanDetails").permitAll()
-                .antMatchers("/sys/planDetail/revStopPlanDetails").permitAll()
-                .antMatchers("/sys/plan/getDefaultPlans").permitAll()
+                //.antMatchers("/sys/planDetail/savePlanDetails").permitAll()
+                //.antMatchers("/sys/planDetail/cancelPlanDetails").permitAll()
+                //.antMatchers("/sys/planDetail/revStopPlanDetails").permitAll()
+                //.antMatchers("/sys/plan/getDefaultPlans").permitAll()
                 .antMatchers("/sys/dictionaryInfo/getList").permitAll()
+                .antMatchers("/sys/dictionaryInfo/getListBack").permitAll()
+                .antMatchers("/sys/plan/getPlanInfoIds").permitAll()
+                .antMatchers("/sys/file/uploadImage").permitAll()
+                .antMatchers("/sys/file/deleteRemoteFile").permitAll()
+                .antMatchers("/sys/mrqc/caseWritingPrompt").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

+ 77 - 49
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -83,58 +83,73 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/sys/user/getJwt", request)
                 || matchers("/sys/user/refreshJwt", request)
                 || matchers("/sys/user/checkToken", request)
-                || matchers("/sys/user/getUserOrgMenu", request)
+                //|| matchers("/sys/user/getUserOrgMenu", request)
                 || matchers("/oauth/token", request)
                 || matchers("/oauth/check_token", request)
-                || matchers("/tran/lisConfig/isExistRecord", request)
-                || matchers("/tran/lisConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/lisConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/lisConfig/deleteRecord", request)
-                || matchers("/tran/lisConfig/deleteRecords", request)
+                //|| matchers("/tran/lisConfig/isExistRecord", request)
+                //|| matchers("/tran/lisConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/lisConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/lisConfig/deleteRecord", request)
+                //|| matchers("/tran/lisConfig/deleteRecords", request)
                 || matchers("/tran/lisConfig/getPage", request)
-                || matchers("/tran/lisConfig/importExcel", request)
-                || matchers("/tran/lisConfig/exportExcel", request)
-                || matchers("/tran/pacsConfig/isExistRecord", request)
-                || matchers("/tran/pacsConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/pacsConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/pacsConfig/deleteRecord", request)
-                || matchers("/tran/pacsConfig/deleteRecords", request)
+                // || matchers("/tran/lisConfig/importExcel", request)
+                // || matchers("/tran/lisConfig/exportExcel", request)
+                || matchers("/tran/lisConfig/exportExcelModule", request)
+                // || matchers("/tran/pacsConfig/isExistRecord", request)
+                //|| matchers("/tran/pacsConfig/saveOrUpdateRecord", request)
+                // || matchers("/tran/pacsConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/pacsConfig/deleteRecord", request)
+                //|| matchers("/tran/pacsConfig/deleteRecords", request)
                 || matchers("/tran/pacsConfig/getPage", request)
-                || matchers("/tran/pacsConfig/importExcel", request)
-                || matchers("/tran/pacsConfig/exportExcel", request)
-                || matchers("/tran/diseaseConfig/isExistRecord", request)
-                || matchers("/tran/diseaseConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/diseaseConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/diseaseConfig/deleteRecord", request)
-                || matchers("/tran/diseaseConfig/deleteRecords", request)
+                // || matchers("/tran/pacsConfig/importExcel", request)
+                //|| matchers("/tran/pacsConfig/exportExcel", request)
+                || matchers("/tran/pacsConfig/exportExcelModule", request)
+                //|| matchers("/tran/diseaseConfig/isExistRecord", request)
+                //|| matchers("/tran/diseaseConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/diseaseConfig/saveOrUpdateRecords", request)
+                //|| matchers("/tran/diseaseConfig/deleteRecord", request)
+                //|| matchers("/tran/diseaseConfig/deleteRecords", request)
                 || matchers("/tran/diseaseConfig/getPage", request)
-                || matchers("/tran/diseaseConfig/importExcel", request)
-                || matchers("/tran/diseaseConfig/exportExcel", request)
-                || matchers("/tran/drugConfig/isExistRecord", request)
-                || matchers("/tran/drugConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/drugConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/drugConfig/deleteRecord", request)
-                || matchers("/tran/drugConfig/deleteRecords", request)
+                //|| matchers("/tran/diseaseConfig/importExcel", request)
+                //|| matchers("/tran/diseaseConfig/exportExcel", request)
+                || matchers("/tran/diseaseConfig/exportExcelModule", request)
+                //|| matchers("/tran/drugConfig/isExistRecord", request)
+                //|| matchers("/tran/drugConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/drugConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/drugConfig/deleteRecord", request)
+                //|| matchers("/tran/drugConfig/deleteRecords", request)
                 || matchers("/tran/drugConfig/getPage", request)
-                || matchers("/tran/drugConfig/importExcel", request)
-                || matchers("/tran/drugConfig/exportExcel", request)
-                || matchers("/tran/operationConfig/isExistRecord", request)
-                || matchers("/tran/operationConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/operationConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/operationConfig/deleteRecord", request)
-                || matchers("/tran/operationConfig/deleteRecords", request)
+                //|| matchers("/tran/drugConfig/importExcel", request)
+                //|| matchers("/tran/drugConfig/exportExcel", request)
+                || matchers("/tran/drugConfig/exportExcelModule", request)
+                // || matchers("/tran/operationConfig/isExistRecord", request)
+                // || matchers("/tran/operationConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/operationConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/operationConfig/deleteRecord", request)
+                //|| matchers("/tran/operationConfig/deleteRecords", request)
                 || matchers("/tran/operationConfig/getPage", request)
-                || matchers("/tran/operationConfig/importExcel", request)
-                || matchers("/tran/operationConfig/exportExcel", request)
-                || matchers("/tran/deptConfig/isExistRecord", request)
-                || matchers("/tran/deptConfig/saveOrUpdateRecord", request)
-                || matchers("/tran/deptConfig/saveOrUpdateRecords", request)
-                || matchers("/tran/deptConfig/deleteRecord", request)
-                || matchers("/tran/deptConfig/deleteRecords", request)
+                //|| matchers("/tran/operationConfig/importExcel", request)
+                //|| matchers("/tran/operationConfig/exportExcel", request)
+                || matchers("/tran/operationConfig/exportExcelModule", request)
+                // || matchers("/tran/deptConfig/isExistRecord", request)
+                // || matchers("/tran/deptConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/deptConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/deptConfig/deleteRecord", request)
+                //|| matchers("/tran/deptConfig/deleteRecords", request)
                 || matchers("/tran/deptConfig/getPage", request)
-                || matchers("/tran/deptConfig/importExcel", request)
-                || matchers("/tran/deptConfig/exportExcel", request)
-                || matchers("/tran/hospitalInfo/saveRecord", request)
+                // || matchers("/tran/deptConfig/importExcel", request)
+                // || matchers("/tran/deptConfig/exportExcel", request)
+                || matchers("/tran/deptConfig/exportExcelModule", request)
+                // || matchers("/tran/transfusionConfig/isExistRecord", request)
+                // || matchers("/tran/transfusionConfig/saveOrUpdateRecord", request)
+                //|| matchers("/tran/transfusionConfig/saveOrUpdateRecords", request)
+                // || matchers("/tran/transfusionConfig/deleteRecord", request)
+                //|| matchers("/tran/transfusionConfig/deleteRecords", request)
+                || matchers("/tran/transfusionConfig/getPage", request)
+                // || matchers("/tran/transfusionConfig/importExcel", request)
+                // || matchers("/tran/transfusionConfig/exportExcel", request)
+                || matchers("/tran/transfusionConfig/exportExcelModule", request)
+                //|| matchers("/tran/hospitalInfo/saveRecord", request)
                 || matchers("/tran/hospitalInfo/getHospitalInfo", request)
                 || matchers("/tran/hospitalInfo/getHospitalInfoById", request)
                 || matchers("/sys/versionInfo/getVersionInfoAlls", request)
@@ -146,28 +161,41 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/sys/tokenPermission/delPermission", request)
                 || matchers("/sys/tokenPermission/getPermission", request)
                 || matchers("/sys/push/push", request)
+                || matchers("/sys/push/pushApi", request)
                 || matchers("/sys/push/indicationPush", request)
+                || matchers("/sys/push/pushPlan", request)
                 || matchers("/demo/templateInfo/updateByIdUsNames", request)
                 || matchers("/demo/templateInfo/saveTemplateInfo", request)
                 || matchers("/demo/templateInfo/cancelTemplateInfos", request)
                 || matchers("/demo/templateInfo/getTemplatePageAlls", request)
                 || matchers("/demo/templateInfo/getTemplatebyId", request)
                 || matchers("/sys/plan/getPlanInfoPages", request)
-                || matchers("/sys/plan/savePlanInfoDatas", request)
+                /*|| matchers("/sys/plan/savePlanInfoDatas", request)
                 || matchers("/sys/plan/getSysPlanInfoDatas", request)
-                || matchers("/sys/plan/cancelPlanDatas", request)
-                || matchers("/sys/plan/revStopPlans", request)
+                || matchers("/sys/plan/cancelPlanDatas", request)*/
+                //|| matchers("/sys/plan/revStopPlans", request)
                 || matchers("/sys/tokenHospital/getTokenHospital", request)
                 || matchers("/demo/retrieval/index", request)
                 || matchers("/graph/conceptInfo/staticKnowledgeIndex", request)
+                || matchers("/graph/conceptInfo/staticKnowledgeIndexWithoutInfo", request)
                 || matchers("/graph/conceptInfo/getStaticKnowledge", request)
                 || matchers("/graph/conceptInfo/getStaticKnowledgeForHIS", request)
+                || matchers("/graph/conceptInfo/getPage", request)
+                || matchers("/graph/conceptInfo/saveOrUpdateRecord", request)
+                || matchers("/graph/conceptInfo/changeStatus", request)
+                || matchers("/graph/conceptInfo/isExist", request)
+                || matchers("/graph/conceptInfo/getRecordById", request)
                 || matchers("/sys/planDetail/getPlanDetailDatas", request)
-                || matchers("/sys/planDetail/savePlanDetails", request)
+                /*|| matchers("/sys/planDetail/savePlanDetails", request)
                 || matchers("/sys/planDetail/cancelPlanDetails", request)
                 || matchers("/sys/planDetail/revStopPlanDetails", request)
-                || matchers("/sys/plan/getDefaultPlans", request)
+                || matchers("/sys/plan/getDefaultPlans", request)*/
                 || matchers("/sys/dictionaryInfo/getList", request)
+                || matchers("/sys/dictionaryInfo/getListBack", request)
+                || matchers("/sys/plan/getPlanInfoIds", request)
+                || matchers("/sys/file/uploadImage", request)
+                || matchers("/sys/file/deleteRemoteFile", request)
+                || matchers("/sys/mrqc/caseWritingPrompt", request)
                 || matchers("/", request)) {
             return true;
         }

+ 43 - 0
src/main/java/com/diagbot/dto/ConceptDetailDTO.java

@@ -0,0 +1,43 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/21 10:28
+ */
+@Getter
+@Setter
+public class ConceptDetailDTO {
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+    /**
+     * 提示明细序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径,4-治疗方案
+     */
+    private String contentType;
+}

+ 61 - 0
src/main/java/com/diagbot/dto/ConceptInfoDTO.java

@@ -0,0 +1,61 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/21 10:33
+ */
+@Getter
+@Setter
+public class ConceptInfoDTO {
+    /**
+     * 术语id
+     */
+    private Long id;
+    /**
+     * 术语名称
+     */
+    private String name;
+    /**
+     * 关联标题
+     */
+    private String title;
+    /**
+     * 术语类型(词性)
+     */
+    private String type;
+    /**
+     * 术语类型(词性)
+     */
+    private String typeName;
+    /**
+     * 临床路径名称
+     */
+    private String clinicalPathwayName;
+    /**
+     * 注意事项名称
+     */
+    private String noticeName;
+    /**
+     * 修改时间
+     */
+    private Date gmtModified;
+    /**
+     * 修改人
+     */
+    private String modifier;
+    /**
+     * 启用状态
+     */
+    private String isDeleted;
+    /**
+     * 明细
+     */
+    List<ConceptDetailDTO> details;
+}

+ 23 - 0
src/main/java/com/diagbot/dto/DiseaseInfoDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/9/15 10:07
+ */
+@Getter
+@Setter
+public class DiseaseInfoDTO {
+    /**
+     * 疾病名称
+     */
+    private String name;
+
+    /**
+     * ICD10编码
+     */
+    private String icd10Code;
+}

+ 28 - 0
src/main/java/com/diagbot/dto/FileDTO.java

@@ -0,0 +1,28 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/12/18 17:08
+ */
+@Getter
+@Setter
+public class FileDTO {
+    private String state;
+    private String original;
+    private String title;
+    private String url;
+    private String md5;
+    private String info;
+
+    public FileDTO(String state, String info) {
+        this.state = state;
+        this.info = info;
+    }
+    public FileDTO(){
+
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/11/4 11:09
+ */
+@Getter
+@Setter
+public class FileDeleteDTO {
+    private Object data;
+    private String message;
+    private String status;
+}

+ 25 - 0
src/main/java/com/diagbot/dto/FileUploadDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2019/11/4 10:55
+ */
+@Getter
+@Setter
+public class FileUploadDTO {
+    private String url;
+    private String md5;
+    private String path;
+    private String domain;
+    private String scene;
+    private int size;
+    private int mtime;
+    private String scenes;
+    private String retmsg;
+    private int retcode;
+    private String src;
+}

+ 2 - 0
src/main/java/com/diagbot/dto/IndicationDTO.java

@@ -20,6 +20,8 @@ public class IndicationDTO {
     private List<BillMsg> billMsgList = new ArrayList<>();
     // 高危药品、手术
     private List<BillMsg> highRiskList = new ArrayList<>();
+    // 其他提醒
+    private List<BillMsg> otherList = new ArrayList<>();
     // 记录调试信息
     private Map<String, Object> debug = new LinkedHashMap<>();
 }

+ 5 - 0
src/main/java/com/diagbot/dto/PlanInfoPageDTO.java

@@ -3,6 +3,7 @@ package com.diagbot.dto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -27,6 +28,10 @@ public class PlanInfoPageDTO {
     private String planCode;
 
     private Integer planStatus;
+
+    private Date gmtCreate;
+
+    private String planDetail;
     /**
      * 备注
      */

+ 4 - 0
src/main/java/com/diagbot/dto/PushBaseDTO.java

@@ -17,4 +17,8 @@ public class PushBaseDTO {
     private String name;
     //医院端名称
     private List<String> hisNameList;
+    /**
+     * 是否有静态知识
+     */
+    private Integer hasInfo = 0;
 }

+ 6 - 0
src/main/java/com/diagbot/dto/PushDTO.java

@@ -4,6 +4,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -31,4 +32,9 @@ public class PushDTO {
     private List<PushBaseDTO> complications = new ArrayList<>();
     //诊断
     private Map<String, List<PushBaseDTO>> dis;
+    //一般治疗
+    private List<TreatDTO> treat = new ArrayList<>();
+
+    // 记录调试信息
+    private Map<String, Object> debug = new LinkedHashMap<>();
 }

+ 18 - 0
src/main/java/com/diagbot/dto/PushPlanDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 检验检查计划出参
+ * @author: gaodm
+ * @time: 2020/8/31 9:39
+ */
+@Getter
+@Setter
+public class PushPlanDTO {
+    private List<PushPlansDTO> pushPlans = new ArrayList<>();
+}

+ 28 - 0
src/main/java/com/diagbot/dto/PushPlanDetailDTO.java

@@ -0,0 +1,28 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 检验检查计划明细
+ * @author: gaodm
+ * @time: 2020/8/31 9:41
+ */
+@Getter
+@Setter
+public class PushPlanDetailDTO {
+    //检查时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date examineDate;
+    //描述
+    private String description;
+    //检验
+    private List<String> lis = new ArrayList<>();
+    //检查
+    private List<String> pacs = new ArrayList<>();
+}

+ 20 - 0
src/main/java/com/diagbot/dto/PushPlansDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import com.diagbot.biz.push.entity.Item;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 检验检查计划针对单个项目
+ * @author: gaodm
+ * @time: 2020/8/31 9:49
+ */
+@Getter
+@Setter
+public class PushPlansDTO {
+    private Item item;
+    private List<PushPlanDetailDTO> pushPlanDetails = new ArrayList<>();
+}

+ 5 - 1
src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -28,7 +28,7 @@ public class RetrievalDTO {
     /**
      * 诊断
      */
-    private List<String> diseaseNames;
+    private List<DiseaseInfoDTO> diseaseNames;
     /**
      * 药品
      */
@@ -41,4 +41,8 @@ public class RetrievalDTO {
      * 科室
      */
     private List<String> deptNames;
+    /**
+     * 输血
+     */
+    private List<String> transfusionNames;
 }

+ 6 - 1
src/main/java/com/diagbot/dto/StaticKnowledgeDTO.java

@@ -42,4 +42,9 @@ public class StaticKnowledgeDTO {
      * 静态知识明细
      */
     private Map<String, List<StaticKnowledgeDetailDTO>> details;
-}
+
+    /**
+     * 剂型
+     */
+    private String form;
+}

+ 1 - 1
src/main/java/com/diagbot/dto/StaticKnowledgeDetailDTO.java

@@ -37,7 +37,7 @@ public class StaticKnowledgeDetailDTO {
     private Integer orderNo;
 
     /**
-     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径
+     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径,4-治疗方案
      */
     private String contentType;
 }

+ 10 - 2
src/main/java/com/diagbot/dto/StaticKnowledgeIndexDTO.java

@@ -34,7 +34,11 @@ public class StaticKnowledgeIndexDTO {
     /**
      * 是否有静态知识
      */
-    private Integer hasInfomation = 0;
+    private Integer hasInfo = 0;
+    /**
+     * 是否有基本静态知识
+     */
+    private Integer hasStaticKnowledge = 0;
     /**
      * 是否有临床路径
      */
@@ -43,4 +47,8 @@ public class StaticKnowledgeIndexDTO {
      * 是否有注意事项
      */
     private Integer hasNotice = 0;
-}
+    /**
+     * 是否有治疗方案静态知识
+     */
+    private Integer hasTreatInfo = 0;
+}

+ 1 - 2
src/main/java/com/diagbot/dto/TemplateInfoDTO.java

@@ -1,6 +1,5 @@
 package com.diagbot.dto;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -24,7 +23,7 @@ public class TemplateInfoDTO {
     private String inquiryCode;//门诊号
     private String cardNo;//卡号
     private String deptName;//科室名称
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    //    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date inquiryDate;//就诊时间
     private String preview;//预览文字
     private String dataJson;//模板数据

+ 1 - 1
src/main/java/com/diagbot/dto/TemplateInfoPageDTO.java

@@ -8,7 +8,7 @@ import java.util.Date;
 
 /**
  * @author wangfeng
- * @Description: TODO
+ * @Description:
  * @date 2019年7月24日 上午11:07:57
  */
 @Getter

+ 19 - 0
src/main/java/com/diagbot/dto/TreatDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import com.diagbot.biz.push.entity.Item;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/8/28 16:21
+ */
+@Getter
+@Setter
+public class TreatDTO extends Item {
+    //一般治疗
+    private String generaTreat;
+}

+ 29 - 0
src/main/java/com/diagbot/dto/TreatDetailDTO.java

@@ -0,0 +1,29 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/8/28 16:22
+ */
+@Getter
+@Setter
+public class TreatDetailDTO {
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+}

+ 1 - 1
src/main/java/com/diagbot/entity/ConceptDetail.java

@@ -77,7 +77,7 @@ public class ConceptDetail implements Serializable {
     private Integer orderNo;
 
     /**
-     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径
+     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径,4-治疗方案
      */
     private String contentType;
 

+ 57 - 22
src/main/java/com/diagbot/entity/DeptConfig.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -58,27 +60,29 @@ public class DeptConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * 医院项目名称
+     * 医院科室名称
      */
-    @Excel(name="HIS名称", width = 40)
+    @Excel(name = "医院科室名称", width = 40, orderNum = "2", isImportField = "true")
+    @NotBlank(message = "请输入医院科室名称")
     private String hisName;
 
     /**
-     * 医院项目编码
+     * 医院科室编码
      */
-    @Excel(name = "HIS编码", width = 40)
+    @Excel(name = "医院科室编码", width = 40, orderNum = "1", isImportField = "true")
     private String hisCode;
 
     /**
-     * 标准名称
+     * 标准科室名称
      */
-    @Excel(name = "标准名称", width = 40)
+    @Excel(name = "标准科室名称", width = 40, orderNum = "4", isImportField = "true")
+    @NotBlank(message = "请输入标准科室名称")
     private String uniqueName;
 
     /**
-     * 标准编码
+     * 对应项编码
      */
-    @Excel(name="标准编码", width = 40)
+    //@Excel(name = "对应项编码", width = 40, orderNum = "3")
     private String uniqueCode;
 
     public Long getId() {
@@ -88,6 +92,7 @@ public class DeptConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -95,6 +100,7 @@ public class DeptConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -102,6 +108,7 @@ public class DeptConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -109,6 +116,7 @@ public class DeptConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -116,6 +124,7 @@ public class DeptConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -123,6 +132,7 @@ public class DeptConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -130,6 +140,7 @@ public class DeptConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -137,6 +148,7 @@ public class DeptConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getHisCode() {
         return hisCode;
     }
@@ -144,6 +156,7 @@ public class DeptConfig implements Serializable {
     public void setHisCode(String hisCode) {
         this.hisCode = hisCode;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -151,6 +164,7 @@ public class DeptConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getUniqueCode() {
         return uniqueCode;
     }
@@ -162,17 +176,38 @@ public class DeptConfig implements Serializable {
     @Override
     public String toString() {
         return "DeptConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", hisCode=" + hisCode +
-            ", uniqueName=" + uniqueName +
-            ", uniqueCode=" + uniqueCode +
-        "}";
-    }
-}
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", hisCode=" + hisCode +
+                ", uniqueName=" + uniqueName +
+                ", uniqueCode=" + uniqueCode +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        DeptConfig deptConfig = (DeptConfig) o;
+        return Objects.equals(id, deptConfig.id)
+                && Objects.equals(isDeleted, deptConfig.isDeleted)
+                && Objects.equals(hospitalId, deptConfig.hospitalId)
+                && Objects.equals(hisName, deptConfig.hisName)
+                && Objects.equals(hisCode, deptConfig.hisCode)
+                && Objects.equals(uniqueName, deptConfig.uniqueName)
+                && Objects.equals(uniqueCode, deptConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, hisCode, uniqueName, uniqueCode);
+    }
+}

+ 52 - 19
src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -58,21 +60,23 @@ public class DiseaseConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * his名称
+     * 医院诊断名称
      */
-    @Excel(name="HIS名称", width = 40)
+    @Excel(name = "医院诊断名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院诊断名称")
     private String hisName;
 
     /**
-     * 标准名
+     * 标准诊断
      */
-    @Excel(name = "标准名称", width = 40)
+    @Excel(name = "标准诊断名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准诊断名称")
     private String uniqueName;
 
     /**
-     * ICD编码
+     * ICD-10编码
      */
-    @Excel(name="ICD编码", width = 40)
+    @Excel(name = "ICD-10编码", width = 40, orderNum = "2", isImportField = "true")
     private String icdCode;
 
     public Long getId() {
@@ -82,6 +86,7 @@ public class DiseaseConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -89,6 +94,7 @@ public class DiseaseConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -96,6 +102,7 @@ public class DiseaseConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -103,6 +110,7 @@ public class DiseaseConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -110,6 +118,7 @@ public class DiseaseConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -117,6 +126,7 @@ public class DiseaseConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -124,6 +134,7 @@ public class DiseaseConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -131,6 +142,7 @@ public class DiseaseConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -138,6 +150,7 @@ public class DiseaseConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getIcdCode() {
         return icdCode;
     }
@@ -149,16 +162,36 @@ public class DiseaseConfig implements Serializable {
     @Override
     public String toString() {
         return "DiseaseConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", uniqueName=" + uniqueName +
-            ", icdCode=" + icdCode +
-        "}";
-    }
-}
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", icdCode=" + icdCode +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        DiseaseConfig diseaseConfig = (DiseaseConfig) o;
+        return Objects.equals(id, diseaseConfig.id)
+                && Objects.equals(isDeleted, diseaseConfig.isDeleted)
+                && Objects.equals(hospitalId, diseaseConfig.hospitalId)
+                && Objects.equals(hisName, diseaseConfig.hisName)
+                && Objects.equals(uniqueName, diseaseConfig.uniqueName)
+                && Objects.equals(icdCode, diseaseConfig.icdCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, icdCode);
+    }
+}

+ 70 - 18
src/main/java/com/diagbot/entity/DrugConfig.java

@@ -5,8 +5,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -58,23 +61,33 @@ public class DrugConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * his名称
+     * 医院药品名称
      */
-    @Excel(name="HIS名称", width = 40)
+    @Excel(name = "医院药品名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院药品名称")
+    //@Size(max = 80, min = 1,message = "医院药品名称长度需要在1-80字符长度之间")
     private String hisName;
 
     /**
-     * 标准名
+     * 标准药品
      */
-    @Excel(name = "标准名称", width = 40)
+    @Excel(name = "标准药品名称", width = 40, orderNum = "2", isImportField = "true")
+    @NotBlank(message = "请输入标准药品名称")
+    //@Size(max = 80, min = 1,message = "标准药品名称长度需要在1-80字符长度之间")
     private String uniqueName;
 
     /**
      * 标准编码
      */
-    @Excel(name="标准编码", width = 40)
+    //@Excel(name = "对应项编码", width = 40, orderNum = "3")
     private String uniqueCode;
 
+    /**
+     * 剂型
+     */
+    @Excel(name = "药品剂型(不填、注射剂、片剂、缓释片、胶囊剂、滴丸剂)", width = 60, orderNum = "3", isImportField = "true")
+    private String form;
+
     public Long getId() {
         return id;
     }
@@ -82,6 +95,7 @@ public class DrugConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -89,6 +103,7 @@ public class DrugConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -96,6 +111,7 @@ public class DrugConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -103,6 +119,7 @@ public class DrugConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -110,6 +127,7 @@ public class DrugConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -117,6 +135,7 @@ public class DrugConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -124,6 +143,7 @@ public class DrugConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -131,6 +151,7 @@ public class DrugConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -138,6 +159,7 @@ public class DrugConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getUniqueCode() {
         return uniqueCode;
     }
@@ -146,19 +168,49 @@ public class DrugConfig implements Serializable {
         this.uniqueCode = uniqueCode;
     }
 
+    public String getForm() {
+        return form;
+    }
+
+    public void setForm(String form) {
+        this.form = form;
+    }
+
     @Override
     public String toString() {
         return "DrugConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", uniqueName=" + uniqueName +
-            ", uniqueCode=" + uniqueCode +
-        "}";
-    }
-}
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", uniqueCode=" + uniqueCode +
+                ", form=" + form +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        DrugConfig drugConfig = (DrugConfig) o;
+        return Objects.equals(id, drugConfig.id)
+                && Objects.equals(isDeleted, drugConfig.isDeleted)
+                && Objects.equals(hospitalId, drugConfig.hospitalId)
+                && Objects.equals(hisName, drugConfig.hisName)
+                && Objects.equals(form, drugConfig.form)
+                && Objects.equals(uniqueName, drugConfig.uniqueName)
+                && Objects.equals(uniqueCode, drugConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, form, uniqueName, uniqueCode);
+    }
+}

+ 56 - 24
src/main/java/com/diagbot/entity/LisConfig.java

@@ -9,6 +9,7 @@ import lombok.Data;
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -61,29 +62,29 @@ public class LisConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * his大项名称
+     * 检验套餐
      */
-    @Excel(name = "his大项名称", width = 40)
-    @NotBlank(message = "请输入大项名称")
+    @Excel(name = "检验套餐", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入检验套餐")
     private String hisName;
 
     /**
-     * his小项名称
+     * 检验细项
      */
-    @Excel(name = "his小项名称", width = 40)
+    @Excel(name = "检验细项", width = 40, orderNum = "2", isImportField = "true")
     private String hisDetailName;
 
     /**
-     * 标准
+     * 标准检验项目
      */
-    @Excel(name = "标准名", width = 40)
-    @NotBlank(message = "请输入公表名称")
+    @Excel(name = "标准检验项目", width = 40, orderNum = "4", isImportField = "true")
+    @NotBlank(message = "请输入标准检验项目")
     private String uniqueName;
 
     /**
-     * 标准编码
+     * 对应项目编码
      */
-    @Excel(name = "标准编码", width = 40)
+    //@Excel(name = "对应项目编码", width = 40, orderNum = "3")
     private String uniqueCode;
 
     public Long getId() {
@@ -93,6 +94,7 @@ public class LisConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -100,6 +102,7 @@ public class LisConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -107,6 +110,7 @@ public class LisConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -114,6 +118,7 @@ public class LisConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -121,6 +126,7 @@ public class LisConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -128,6 +134,7 @@ public class LisConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -135,6 +142,7 @@ public class LisConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -142,6 +150,7 @@ public class LisConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getHisDetailName() {
         return hisDetailName;
     }
@@ -149,6 +158,7 @@ public class LisConfig implements Serializable {
     public void setHisDetailName(String hisDetailName) {
         this.hisDetailName = hisDetailName;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -156,6 +166,7 @@ public class LisConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getUniqueCode() {
         return uniqueCode;
     }
@@ -167,17 +178,38 @@ public class LisConfig implements Serializable {
     @Override
     public String toString() {
         return "LisConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", hisDetailName=" + hisDetailName +
-            ", uniqueName=" + uniqueName +
-            ", uniqueCode=" + uniqueCode +
-        "}";
-    }
-}
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", hisDetailName=" + hisDetailName +
+                ", uniqueName=" + uniqueName +
+                ", uniqueCode=" + uniqueCode +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+        LisConfig lisConfig = (LisConfig) o;
+        return Objects.equals(id, lisConfig.id)
+                && Objects.equals(isDeleted, lisConfig.isDeleted)
+                && Objects.equals(hospitalId, lisConfig.hospitalId)
+                && Objects.equals(hisName, lisConfig.hisName)
+                && Objects.equals(hisDetailName, lisConfig.hisDetailName)
+                && Objects.equals(uniqueName, lisConfig.uniqueName)
+                && Objects.equals(uniqueCode, lisConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, hisDetailName, uniqueName, uniqueCode);
+    }
+}

+ 52 - 19
src/main/java/com/diagbot/entity/OperationConfig.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -58,21 +60,23 @@ public class OperationConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * his名称
+     * 医院手术/操作名称
      */
-    @Excel(name="HIS名称", width = 40)
+    @Excel(name = "医院手术/操作名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院手术/操作名称")
     private String hisName;
 
     /**
-     * 标准名
+     * 标准手术/操作
      */
-    @Excel(name = "标准名称", width = 40)
+    @Excel(name = "标准手术/操作名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准手术/操作名称")
     private String uniqueName;
 
     /**
-     * 标准编码
+     * 对应项编码
      */
-    @Excel(name="标准编码", width = 40)
+    //@Excel(name = "对应项编码", width = 40, orderNum = "2")
     private String uniqueCode;
 
     public Long getId() {
@@ -82,6 +86,7 @@ public class OperationConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -89,6 +94,7 @@ public class OperationConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -96,6 +102,7 @@ public class OperationConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -103,6 +110,7 @@ public class OperationConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -110,6 +118,7 @@ public class OperationConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -117,6 +126,7 @@ public class OperationConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -124,6 +134,7 @@ public class OperationConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -131,6 +142,7 @@ public class OperationConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -138,6 +150,7 @@ public class OperationConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getUniqueCode() {
         return uniqueCode;
     }
@@ -149,16 +162,36 @@ public class OperationConfig implements Serializable {
     @Override
     public String toString() {
         return "OperationConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", uniqueName=" + uniqueName +
-            ", uniqueCode=" + uniqueCode +
-        "}";
-    }
-}
+                "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;
+        OperationConfig operationConfig = (OperationConfig) o;
+        return Objects.equals(id, operationConfig.id)
+                && Objects.equals(isDeleted, operationConfig.isDeleted)
+                && Objects.equals(hospitalId, operationConfig.hospitalId)
+                && Objects.equals(hisName, operationConfig.hisName)
+                && Objects.equals(uniqueName, operationConfig.uniqueName)
+                && Objects.equals(uniqueCode, operationConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+    }
+}

+ 50 - 17
src/main/java/com/diagbot/entity/PacsConfig.java

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
+import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 import java.util.Date;
+import java.util.Objects;
 
 /**
  * <p>
@@ -58,21 +60,23 @@ public class PacsConfig implements Serializable {
     private Long hospitalId;
 
     /**
-     * his名称
+     * 医院检查项目
      */
-    @Excel(name="HIS名称", width = 40)
+    @Excel(name = "医院检查项目", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院检查项目")
     private String hisName;
 
     /**
-     * 标准
+     * 标准检查项目
      */
-    @Excel(name = "标准名称", width = 40)
+    @Excel(name = "标准检查项目", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准检查项目")
     private String uniqueName;
 
     /**
-     * 标准编码
+     * 对应项编码
      */
-    @Excel(name="标准编码", width = 40)
+    //@Excel(name = "对应项编码", width = 40, orderNum = "2")
     private String uniqueCode;
 
     public Long getId() {
@@ -82,6 +86,7 @@ public class PacsConfig implements Serializable {
     public void setId(Long id) {
         this.id = id;
     }
+
     public String getIsDeleted() {
         return isDeleted;
     }
@@ -89,6 +94,7 @@ public class PacsConfig implements Serializable {
     public void setIsDeleted(String isDeleted) {
         this.isDeleted = isDeleted;
     }
+
     public Date getGmtCreate() {
         return gmtCreate;
     }
@@ -96,6 +102,7 @@ public class PacsConfig implements Serializable {
     public void setGmtCreate(Date gmtCreate) {
         this.gmtCreate = gmtCreate;
     }
+
     public Date getGmtModified() {
         return gmtModified;
     }
@@ -103,6 +110,7 @@ public class PacsConfig implements Serializable {
     public void setGmtModified(Date gmtModified) {
         this.gmtModified = gmtModified;
     }
+
     public String getCreator() {
         return creator;
     }
@@ -110,6 +118,7 @@ public class PacsConfig implements Serializable {
     public void setCreator(String creator) {
         this.creator = creator;
     }
+
     public String getModifier() {
         return modifier;
     }
@@ -117,6 +126,7 @@ public class PacsConfig implements Serializable {
     public void setModifier(String modifier) {
         this.modifier = modifier;
     }
+
     public Long getHospitalId() {
         return hospitalId;
     }
@@ -124,6 +134,7 @@ public class PacsConfig implements Serializable {
     public void setHospitalId(Long hospitalId) {
         this.hospitalId = hospitalId;
     }
+
     public String getHisName() {
         return hisName;
     }
@@ -131,6 +142,7 @@ public class PacsConfig implements Serializable {
     public void setHisName(String hisName) {
         this.hisName = hisName;
     }
+
     public String getUniqueName() {
         return uniqueName;
     }
@@ -138,6 +150,7 @@ public class PacsConfig implements Serializable {
     public void setUniqueName(String uniqueName) {
         this.uniqueName = uniqueName;
     }
+
     public String getUniqueCode() {
         return uniqueCode;
     }
@@ -149,16 +162,36 @@ public class PacsConfig implements Serializable {
     @Override
     public String toString() {
         return "PacsConfig{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", hospitalId=" + hospitalId +
-            ", hisName=" + hisName +
-            ", uniqueName=" + uniqueName +
-            ", uniqueCode=" + uniqueCode +
-        "}";
+                "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;
+        PacsConfig pacsConfig = (PacsConfig) o;
+        return Objects.equals(id, pacsConfig.id)
+                && Objects.equals(isDeleted, pacsConfig.isDeleted)
+                && Objects.equals(hospitalId, pacsConfig.hospitalId)
+                && Objects.equals(hisName, pacsConfig.hisName)
+                && Objects.equals(uniqueName, pacsConfig.uniqueName)
+                && Objects.equals(uniqueCode, pacsConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
     }
 }

+ 197 - 0
src/main/java/com/diagbot/entity/TransfusionConfig.java

@@ -0,0 +1,197 @@
+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 javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 输血映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-31
+ */
+@TableName("tran_transfusion_config")
+public class TransfusionConfig 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")
+    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 "TransfusionConfig{" +
+                "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;
+        TransfusionConfig transfusionConfig = (TransfusionConfig) o;
+        return Objects.equals(id, transfusionConfig.id)
+                && Objects.equals(isDeleted, transfusionConfig.isDeleted)
+                && Objects.equals(hospitalId, transfusionConfig.hospitalId)
+                && Objects.equals(hisName, transfusionConfig.hisName)
+                && Objects.equals(uniqueName, transfusionConfig.uniqueName)
+                && Objects.equals(uniqueCode, transfusionConfig.uniqueCode);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+    }
+}

+ 23 - 8
src/main/java/com/diagbot/enums/ConceptTypeEnum.java

@@ -6,16 +6,17 @@ import lombok.Setter;
 /**
  * @Description:
  * @Author:zhaops
- * @time: 2020/8/18 16:30
+ * @time: 2020/9/10 15:51
  */
 public enum ConceptTypeEnum implements KeyedNamed {
-    All(0, "全部"),
-    Disease(1, "诊断"),
-    Drug(2, "药品"),
-    Lis(3, "检验套餐"),
-    LisPack(4, "检验明细"),
-    Pacs(5, "检查"),
-    Opeartion(6, "手术和操作");
+    LisPack(1, "检验套餐"),
+    Lis(2, "检验细项"),
+    Pacs(3, "检查"),
+    Disease(4, "诊断"),
+    Drug(5, "药品"),
+    Opeartion(6, "手术和操作"),
+    Dept(7, "科室"),
+    Transfusion(8, "输血");
 
     @Setter
     private int key;
@@ -37,11 +38,25 @@ public enum ConceptTypeEnum implements KeyedNamed {
         return null;
     }
 
+    public static ConceptTypeEnum getEnum(String name) {
+        for (ConceptTypeEnum item : ConceptTypeEnum.values()) {
+            if (item.name.equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
     public static String getName(int key) {
         ConceptTypeEnum item = getEnum(key);
         return item != null ? item.name : null;
     }
 
+    public static Integer getKey(String name) {
+        ConceptTypeEnum item = getEnum(name);
+        return item != null ? item.key : null;
+    }
+
     @Override
     public int getKey() {
         return key;

+ 68 - 0
src/main/java/com/diagbot/enums/StaticTypeEnum.java

@@ -0,0 +1,68 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/18 16:30
+ */
+public enum StaticTypeEnum implements KeyedNamed {
+    All(0, "全部"),
+    Disease(1, "诊断"),
+    Drug(2, "药品"),
+    LisPack(3, "检验套餐"),
+    Lis(4, "检验细项"),
+    Pacs(5, "检查"),
+    Opeartion(6, "手术和操作");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    StaticTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static StaticTypeEnum getEnum(int key) {
+        for (StaticTypeEnum item : StaticTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static StaticTypeEnum getEnum(String name) {
+        for (StaticTypeEnum item : StaticTypeEnum.values()) {
+            if (item.name.equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        StaticTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    public static Integer getKey(String name) {
+        StaticTypeEnum item = getEnum(name);
+        return item != null ? item.key : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 1 - 1
src/main/java/com/diagbot/enums/StatusEnum.java

@@ -5,7 +5,7 @@ import lombok.Setter;
 
 /**
  * @author wangfeng
- * @Description: TODO
+ * @Description:
  * @date 2018年11月21日 下午2:31:42
  */
 public enum StatusEnum implements KeyedNamed {

+ 2 - 0
src/main/java/com/diagbot/facade/AssembleFacade.java

@@ -72,4 +72,6 @@ public class AssembleFacade {
         }
         return data;
     }
+
+
 }

+ 439 - 69
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -1,7 +1,11 @@
 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.CdssCoreClient;
+import com.diagbot.dto.ConceptDetailDTO;
+import com.diagbot.dto.ConceptInfoDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
@@ -9,26 +13,36 @@ import com.diagbot.dto.StaticKnowledgeDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.entity.ConceptDetail;
 import com.diagbot.entity.ConceptInfo;
-import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.StaticTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.service.ConceptDetailService;
 import com.diagbot.service.impl.ConceptInfoServiceImpl;
 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.SysUserUtils;
+import com.diagbot.vo.ChangeStatusVO;
+import com.diagbot.vo.ConceptDetailVO;
+import com.diagbot.vo.ConceptInfoPageVO;
+import com.diagbot.vo.ConceptInfoVO;
+import com.diagbot.vo.HasStaticKnowledgeVO;
+import com.diagbot.vo.IdVO;
 import com.diagbot.vo.StaticKnowledgeHISVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
 import com.diagbot.vo.StaticKnowledgeVO;
 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.Arrays;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -48,6 +62,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
     @Autowired
     private ConceptDetailFacade conceptDetailFacade;
     @Autowired
+    @Qualifier("conceptDetailServiceImpl")
+    private ConceptDetailService conceptDetailService;
+    @Autowired
     private LisConfigFacade lisConfigFacade;
     @Autowired
     private PacsConfigFacade pacsConfigFacade;
@@ -58,16 +75,59 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
     @Autowired
     private OperationConfigFacade operationConfigFacade;
 
+    /**
+     * 返回带静态知识的检索结果
+     *
+     * @param staticKnowledgeIndexVO
+     * @return
+     */
+    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndexWithInfo(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
+        List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = staticKnowledgeIndex(staticKnowledgeIndexVO,0);
+        //过滤没有静态知识的检索结果
+        staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList
+                .stream()
+                .filter(i -> i.getHasInfo().equals(1))
+                .collect(Collectors.toList());
+        if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)
+                && staticKnowledgeIndexDTOList.size() > 100) {
+            staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, 100);
+        }
+        return staticKnowledgeIndexDTOList;
+    }
+
+    /**
+     * 返回不带静态知识的检索结果
+     *
+     * @param staticKnowledgeIndexVO
+     * @return
+     */
+    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndexWithoutInfo(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
+        List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = staticKnowledgeIndex(staticKnowledgeIndexVO,1);
+        //过滤没有静态知识的检索结果
+        staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList
+                .stream()
+                .filter(i -> i.getHasInfo().equals(0))
+                .collect(Collectors.toList());
+        if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)
+                && staticKnowledgeIndexDTOList.size() > 100) {
+            staticKnowledgeIndexDTOList = staticKnowledgeIndexDTOList.subList(0, 100);
+        }
+        return staticKnowledgeIndexDTOList;
+    }
+
     /**
      * 医学知识(静态信息)检索
      *
      * @param staticKnowledgeIndexVO
+     * @param type 0:过滤逻辑删除数据,1:不过滤逻辑删除数据
      * @return
      */
-    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
+    public List<StaticKnowledgeIndexDTO> staticKnowledgeIndex(StaticKnowledgeIndexVO staticKnowledgeIndexVO,Integer type) {
         List<StaticKnowledgeIndexDTO> retList = Lists.newLinkedList();
         //静态知识检索顺序
         List<DictionaryInfoDTO> dicStaticIndexList = dictionaryFacade.getListByGroupType(7);
+        //页面术语类型和图谱映射
+        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(8);
 
         List<StaticKnowledgeIndexDTO> staticKnowledgeIndexDTOList = Lists.newLinkedList();
         RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
@@ -76,7 +136,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         if (ListUtil.isNotEmpty(staticKnowledgeIndexDTOList)) {
             //typeName转换
             staticKnowledgeIndexDTOList.forEach(item -> {
-                item.setTypeName(convertTypeName(item.getTypeName(), 2));
+                item.setTypeName(convertTypeName(item.getTypeName(), 2, dicTypeMappingList));
             });
             //是否有静态知识
             List<String> conNameList = staticKnowledgeIndexDTOList
@@ -84,44 +144,58 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                     .map(i -> i.getName())
                     .collect(Collectors.toList());
             QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
-            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("name", conNameList);
+            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+            conceptInfoQueryWrapper.in("name", conNameList);
             List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
-            Map<String, ConceptInfo> infoMap
-                    = EntityUtil.makeEntityMapByKeys(conceptInfoList, "_", "name", "type");
-            for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
-                if (infoMap.containsKey(item.getName() + "_" + item.getTypeName())) {
-                    item.setId(infoMap.get(item.getName() + "_" + item.getTypeName()).getId());
-                }
-            }
-            List<Long> conceptIdList = conceptInfoList.stream()
-                    .map(i -> i.getId())
-                    .collect(Collectors.toList());
-            if (ListUtil.isNotEmpty(conceptIdList)) {
-                QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-                conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .in("concept_id", conceptIdList);
-                List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
-                Map<Long, List<ConceptDetail>> detailMap
-                        = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
+            if (ListUtil.isNotEmpty(conceptInfoList)) {
+                //typeName转换
+                conceptInfoList.forEach(item -> {
+                    item.setType(convertTypeName(item.getType(), 2, dicTypeMappingList));
+                });
+                Map<String, ConceptInfo> infoMap
+                        = EntityUtil.makeEntityMapByKeys(conceptInfoList, "_", "name", "type");
                 for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
-                    if (item.getId() == null
-                            || !detailMap.containsKey(item.getId())) {
-                        item.setHasInfomation(0);
-                        item.setHasClinicalPathway(0);
-                        item.setHasNotice((0));
-                        continue;
+                    if (infoMap.containsKey(item.getName() + "_" + item.getTypeName())) {
+                        item.setId(infoMap.get(item.getName() + "_" + item.getTypeName()).getId());
                     }
-                    for (ConceptDetail detail : detailMap.get(item.getId())) {
-                        List<String> contentTypeList = Arrays.asList(detail.getContentType().split(","));
-                        if (contentTypeList.contains(1)) {
-                            item.setHasInfomation(1);
-                        }
-                        if (contentTypeList.contains(2)) {
-                            item.setHasNotice(1);
+                }
+                List<Long> conceptIdList = conceptInfoList.stream()
+                        .map(i -> i.getId())
+                        .collect(Collectors.toList());
+                if (ListUtil.isNotEmpty(conceptIdList)) {
+                    QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
+                    if (type.equals(0)) {
+                        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+                    }
+                    conceptDetailQueryWrapper.in("concept_id", conceptIdList);
+                    List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
+                    Map<Long, List<ConceptDetail>> detailMap
+                            = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
+                    for (StaticKnowledgeIndexDTO item : staticKnowledgeIndexDTOList) {
+                        if (item.getId() == null
+                                || !detailMap.containsKey(item.getId())) {
+                            item.setHasInfo(0);
+                            item.setHasStaticKnowledge(0);
+                            item.setHasClinicalPathway(0);
+                            item.setHasNotice((0));
+                            item.setHasTreatInfo(0);
+                            continue;
                         }
-                        if (contentTypeList.contains(3)) {
-                            item.setHasClinicalPathway(1);
+                        for (ConceptDetail detail : detailMap.get(item.getId())) {
+                            item.setHasInfo(1);
+                            List<String> contentTypeList = Arrays.asList(detail.getContentType().split(","));
+                            if (contentTypeList.contains("1")) {
+                                item.setHasStaticKnowledge(1);
+                            }
+                            if (contentTypeList.contains("2")) {
+                                item.setHasNotice(1);
+                            }
+                            if (contentTypeList.contains("3")) {
+                                item.setHasClinicalPathway(1);
+                            }
+                            if (contentTypeList.contains("4")) {
+                                item.setHasTreatInfo(1);
+                            }
                         }
                     }
                 }
@@ -132,11 +206,11 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                     = EntityUtil.makeEntityListMap(staticKnowledgeIndexDTOList, "typeName");
             for (DictionaryInfoDTO dic : dicStaticIndexList) {
                 if (dic.getName().equals("检验")) {
-                    if (map.containsKey("检验套餐")) {
-                        retList.addAll(map.get("检验套餐"));
+                    if (map.containsKey(StaticTypeEnum.LisPack.getName())) {
+                        retList.addAll(map.get(StaticTypeEnum.LisPack.getName()));
                     }
-                    if (map.containsKey("检验明细")) {
-                        retList.addAll(map.get("检验明细"));
+                    if (map.containsKey(StaticTypeEnum.Lis.getName())) {
+                        retList.addAll(map.get(StaticTypeEnum.Lis.getName()));
                     }
                 } else if (map.containsKey(dic.getName())) {
                     retList.addAll(map.get(dic.getName()));
@@ -155,14 +229,15 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
      */
     public StaticKnowledgeDTO getStaticKnowledge(StaticKnowledgeVO staticKnowledgeVO) {
         StaticKnowledgeDTO staticKnowledgeDTO = new StaticKnowledgeDTO();
-        String typeName = ConceptTypeEnum.getName(staticKnowledgeVO.getType());
-        typeName = convertTypeName(typeName, 1);
+        String typeName = StaticTypeEnum.getName(staticKnowledgeVO.getType());
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        typeName = convertTypeName(typeName, 1, dicList);
 
         QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
         conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("name", staticKnowledgeVO.getName())
                 .eq("type", typeName);
-        ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper);
+        ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
 
         if (conceptInfo == null) {
             throw new CommonException(CommonErrorCode.IS_EXISTS, "缺少静态信息");
@@ -176,13 +251,19 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
             String sql = "";
             for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
+                if (contentType.equals(0)) {
+                    sql = "";
+                    break;
+                }
                 if (StringUtil.isNotBlank(sql)) {
                     sql += " or ";
                 }
                 sql += "find_in_set(" + contentType + ",content_type)";
             }
-            sql = "(" + sql + ")";
-            conceptDetailQueryWrapper.apply(sql);
+            if (StringUtil.isNotBlank(sql)) {
+                sql = "(" + sql + ")";
+                conceptDetailQueryWrapper.apply(sql);
+            }
         }
         conceptDetailQueryWrapper.orderByAsc("order_no");
         List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
@@ -200,15 +281,37 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 .stream()
                 .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
                 .collect(Collectors.toList());
+        List<StaticKnowledgeDetailDTO> treatInfoList = detailList
+                .stream()
+                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
+                .collect(Collectors.toList());
         Map<String, List<StaticKnowledgeDetailDTO>> detailMap = new HashMap<>();
-        if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeVO.getContentTypes().contains(1)) {
-            detailMap.put("静态知识", introduceList);
-        }
-        if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeVO.getContentTypes().contains(2)) {
-            detailMap.put("注意事项", noticeList);
-        }
-        if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeVO.getContentTypes().contains(3)) {
-            detailMap.put("临床路径", clinicalPathwayList);
+        if (ListUtil.isEmpty(staticKnowledgeVO.getContentTypes()) || staticKnowledgeVO.getContentTypes().contains(0)) {
+            if (ListUtil.isNotEmpty(introduceList)) {
+                detailMap.put("静态知识", introduceList);
+            }
+            if (ListUtil.isNotEmpty(noticeList)) {
+                detailMap.put("注意事项", noticeList);
+            }
+            if (ListUtil.isNotEmpty(clinicalPathwayList)) {
+                detailMap.put("临床路径", clinicalPathwayList);
+            }
+            if (ListUtil.isNotEmpty(treatInfoList)) {
+                detailMap.put("治疗方案", treatInfoList);
+            }
+        } else {
+            if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeVO.getContentTypes().contains(1)) {
+                detailMap.put("静态知识", introduceList);
+            }
+            if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeVO.getContentTypes().contains(2)) {
+                detailMap.put("注意事项", noticeList);
+            }
+            if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeVO.getContentTypes().contains(3)) {
+                detailMap.put("临床路径", clinicalPathwayList);
+            }
+            if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeVO.getContentTypes().contains(4)) {
+                detailMap.put("治疗方案", treatInfoList);
+            }
         }
         staticKnowledgeDTO.setDetails(detailMap);
         return staticKnowledgeDTO;
@@ -223,9 +326,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
     public List<StaticKnowledgeDTO> getStaticKnowledgeForHIS(StaticKnowledgeHISVO staticKnowledgeHISVO) {
 
         List<StaticKnowledgeDTO> retList = Lists.newArrayList();
-        //StaticKnowledgeDTO staticKnowledgeDTO = new StaticKnowledgeDTO();
-        String typeName = ConceptTypeEnum.getName(staticKnowledgeHISVO.getType());
-        typeName = convertTypeName(typeName, 1);
+        String typeName = StaticTypeEnum.getName(staticKnowledgeHISVO.getType());
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        typeName = convertTypeName(typeName, 1, dicList);
 
         //术语映射
         List<String> uniqueNameList = getUniqueNames(staticKnowledgeHISVO);
@@ -251,12 +354,18 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         if (ListUtil.isNotEmpty(staticKnowledgeHISVO.getContentTypes())) {
             String sql = "";
             for (Integer contentType : staticKnowledgeHISVO.getContentTypes()) {
+                if (contentType.equals(0)) {
+                    sql = "";
+                    break;
+                }
                 if (StringUtil.isNotBlank(sql)) {
                     sql += " or ";
                 }
                 sql += "find_in_set(" + contentType + ",content_type)";
             }
-            sql = "(" + sql + ")";
+            if (StringUtil.isNotBlank(sql)) {
+                sql = "(" + sql + ")";
+            }
             conceptDetailQueryWrapper.apply(sql);
         }
         conceptDetailQueryWrapper.orderByAsc("concept_id", "order_no");
@@ -280,15 +389,37 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                         .stream()
                         .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
                         .collect(Collectors.toList());
+                List<StaticKnowledgeDetailDTO> treatInfoList = subDetailList
+                        .stream()
+                        .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
+                        .collect(Collectors.toList());
                 Map<String, List<StaticKnowledgeDetailDTO>> subDetailMap = new HashMap<>();
-                if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeHISVO.getContentTypes().contains(1)) {
-                    subDetailMap.put("静态知识", introduceList);
-                }
-                if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeHISVO.getContentTypes().contains(2)) {
-                    subDetailMap.put("注意事项", noticeList);
-                }
-                if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeHISVO.getContentTypes().contains(3)) {
-                    subDetailMap.put("临床路径", clinicalPathwayList);
+                if (ListUtil.isEmpty(staticKnowledgeHISVO.getContentTypes()) || staticKnowledgeHISVO.getContentTypes().contains(0)) {
+                    if (ListUtil.isNotEmpty(introduceList)) {
+                        subDetailMap.put("静态知识", introduceList);
+                    }
+                    if (ListUtil.isNotEmpty(noticeList)) {
+                        subDetailMap.put("注意事项", noticeList);
+                    }
+                    if (ListUtil.isNotEmpty(clinicalPathwayList)) {
+                        subDetailMap.put("临床路径", clinicalPathwayList);
+                    }
+                    if (ListUtil.isNotEmpty(treatInfoList)) {
+                        subDetailMap.put("治疗方案", treatInfoList);
+                    }
+                } else {
+                    if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeHISVO.getContentTypes().contains(1)) {
+                        subDetailMap.put("静态知识", introduceList);
+                    }
+                    if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeHISVO.getContentTypes().contains(2)) {
+                        subDetailMap.put("注意事项", noticeList);
+                    }
+                    if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeHISVO.getContentTypes().contains(3)) {
+                        subDetailMap.put("临床路径", clinicalPathwayList);
+                    }
+                    if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeHISVO.getContentTypes().contains(4)) {
+                        subDetailMap.put("治疗方案", treatInfoList);
+                    }
                 }
                 staticKnowledgeDTO.setDetails(subDetailMap);
             }
@@ -301,10 +432,10 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
      *
      * @param typeName
      * @param flag     1-页面术语类型转图谱标签名称,2- 图谱标签名称转页面术语类型
+     * @param dicList
      * @return
      */
-    public String convertTypeName(String typeName, Integer flag) {
-        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+    public String convertTypeName(String typeName, Integer flag, List<DictionaryInfoDTO> dicList) {
         if (ListUtil.isNotEmpty(dicList)) {
             Map<String, String> nameValMap = new HashMap<>();
             if (flag.equals(1)) {
@@ -337,7 +468,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 break;
             case 2:
                 Map<String, Map<String, Long>> drugConfigMap
-                        = drugConfigFacade.getConfigMap(Long.valueOf(hospitalId),
+                        = drugConfigFacade.getConfigMapWithoutForm(Long.valueOf(hospitalId),
                         ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }), null);
                 if (drugConfigMap != null) {
                     nameList = new ArrayList<>(drugConfigMap.get(staticKnowledgeHISVO.getHisName()).keySet());
@@ -380,6 +511,245 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 break;
 
         }
+        nameList = nameList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
         return nameList;
     }
+
+    /**
+     * 列表
+     *
+     * @param conceptInfoPageVO
+     * @return
+     */
+    public IPage<ConceptInfoDTO> getPage(ConceptInfoPageVO conceptInfoPageVO) {
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        if (StringUtil.isNotBlank(conceptInfoPageVO.getType())) {
+            String typeName
+                    = convertTypeName(StaticTypeEnum.getName(Integer.valueOf(conceptInfoPageVO.getType())), 1, dicList);
+            conceptInfoPageVO.setTypeName(typeName);
+        }
+        IPage<ConceptInfoDTO> page = super.getPage(conceptInfoPageVO);
+        List<ConceptInfoDTO> records = page.getRecords();
+        if (ListUtil.isNotEmpty(records)) {
+            records.forEach(record -> {
+                String typeName = convertTypeName(record.getType(), 2, dicList);
+                record.setTypeName(typeName);
+                record.setType(String.valueOf(StaticTypeEnum.getKey(typeName)));
+            });
+        }
+        page.setRecords(records);
+        return page;
+    }
+
+    /**
+     * 保存记录(新增or修改)
+     *
+     * @param conceptInfoVO
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(ConceptInfoVO conceptInfoVO) {
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        //术语类型转换
+        String typeName = convertTypeName(StaticTypeEnum.getName(Integer.valueOf(conceptInfoVO.getType())), 1, dicList);
+        conceptInfoVO.setTypeName(typeName);
+        ConceptInfo conceptInfo = new ConceptInfo();
+
+        if (conceptInfoVO.getId() != null) {
+            conceptInfo = this.getById(conceptInfoVO.getId());
+            if (conceptInfo != null
+                    && !conceptInfo.getName().equals(conceptInfoVO.getName())) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语名称不允许修改");
+            }
+        } else {
+            QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
+            conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("name", conceptInfoVO.getName())
+                    .eq("type", typeName);
+            conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
+            //术语不存在,保存术语信息
+            if (conceptInfo == null) {
+                conceptInfo = new ConceptInfo();
+                conceptInfo.setCreator(userId);
+                conceptInfo.setGmtCreate(now);
+            }
+        }
+        conceptInfo.setName(conceptInfoVO.getName());
+        conceptInfo.setClinicalPathwayName(conceptInfoVO.getClinicalPathwayName());
+        conceptInfo.setNoticeName(conceptInfoVO.getNoticeName());
+        conceptInfo.setType(typeName);
+        conceptInfo.setModifier(userId);
+        conceptInfo.setGmtModified(now);
+
+        //是否包含静态信息,包含启用和禁用
+        List<ConceptDetail> oldDetails = null;
+        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
+        if (conceptInfo.getId() != null) {
+            conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
+            oldDetails = conceptDetailFacade.list(conceptDetailQueryWrapper);
+        }
+        if (conceptInfoVO.getId() == null
+                && ListUtil.isNotEmpty(oldDetails)) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "静态信息已添加,不允许重复添加");
+        }
+        if (ListUtil.isEmpty(oldDetails)
+                && ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
+            //TODO 更新图谱是否有静态信息
+            HasStaticKnowledgeVO hasStaticKnowledgeVO = new HasStaticKnowledgeVO();
+            hasStaticKnowledgeVO.setName(conceptInfoVO.getName());
+            hasStaticKnowledgeVO.setType(typeName);
+            hasStaticKnowledgeVO.setHasInfo(1);
+            RespDTO<Boolean> respDTO = cdssCoreClient.updateHasInfoStatus(hasStaticKnowledgeVO);
+            //更新失败
+            if (RespDTOUtil.respIsNG(respDTO)) {
+
+            }
+        }
+
+        //删除已有静态信息
+        if (conceptInfo.getId() != null) {
+            conceptDetailFacade.remove(conceptDetailQueryWrapper);
+        }
+
+        //更新术语信息
+        this.saveOrUpdate(conceptInfo);
+
+        //插入新的静态信息
+        List<ConceptDetail> conceptDetailList = Lists.newLinkedList();
+        if (ListUtil.isNotEmpty(conceptInfoVO.getDetails())) {
+            for (ConceptDetailVO detailVO : conceptInfoVO.getDetails()) {
+                ConceptDetail conceptDetail = new ConceptDetail();
+                BeanUtil.copyProperties(detailVO, conceptDetail);
+                conceptDetail.setConceptId(conceptInfo.getId());
+                conceptDetail.setCreator(userId);
+                conceptDetail.setGmtCreate(now);
+                conceptDetail.setModifier(userId);
+                conceptDetail.setGmtModified(now);
+                conceptDetailList.add(conceptDetail);
+            }
+            conceptDetailService.saveBatch(conceptDetailList);
+        }
+        return true;
+    }
+
+    /**
+     * 启用禁用
+     *
+     * @param changeStatusVO
+     * @return
+     */
+    public Boolean changeStatus(ChangeStatusVO changeStatusVO) {
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        UpdateWrapper<ConceptDetail> conceptDetailUpdateWrapper = new UpdateWrapper<>();
+        conceptDetailUpdateWrapper.eq("concept_id", changeStatusVO.getId())
+                .set("gmt_modified", now)
+                .set("modifier", userId)
+                .set("is_deleted", changeStatusVO.getIsDeleted());
+        conceptDetailService.update(conceptDetailUpdateWrapper);
+        return true;
+    }
+
+    /**
+     * 是否已存在
+     *
+     * @param conceptInfoVO
+     * @return
+     */
+    public Boolean isExist(ConceptInfoVO conceptInfoVO) {
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        //术语类型转换
+        String typeName = convertTypeName(StaticTypeEnum.getName(Integer.valueOf(conceptInfoVO.getType())), 1, dicList);
+        conceptInfoVO.setTypeName(typeName);
+        QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
+        conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("name", conceptInfoVO.getName())
+                .eq("type", typeName);
+        ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
+        if (conceptInfo == null) {
+            return false;
+        }
+        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
+        conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
+        List<ConceptDetail> conceptDetailList = conceptDetailService.list(conceptDetailQueryWrapper);
+        if (ListUtil.isEmpty(conceptDetailList)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 根据术语id获取静态信息
+     *
+     * @param idVO
+     * @return
+     */
+    public ConceptInfoDTO getRecordById(IdVO idVO) {
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        ConceptInfoDTO conceptInfoDTO = new ConceptInfoDTO();
+        ConceptInfo conceptInfo = this.getById(idVO.getId());
+        if (conceptInfo == null) {
+            return null;
+        }
+        BeanUtil.copyProperties(conceptInfo, conceptInfoDTO);
+        QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
+        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", idVO.getId())
+                .orderByAsc("order_no");
+        List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
+        if (ListUtil.isNotEmpty(conceptDetailList)) {
+            List<ConceptDetailDTO> details = BeanUtil.listCopyTo(conceptDetailList, ConceptDetailDTO.class);
+            conceptInfoDTO.setDetails(details);
+            //启用状态、修改人、修改时间为明细的内容
+            String typeName = convertTypeName(conceptInfoDTO.getType(), 2, dicList);
+            conceptInfoDTO.setTypeName(typeName);
+            conceptInfoDTO.setType(String.valueOf(StaticTypeEnum.getKey(typeName)));
+            conceptInfoDTO.setModifier(conceptDetailList.get(0).getModifier());
+            conceptInfoDTO.setGmtModified(conceptDetailList.get(0).getGmtModified());
+            conceptInfoDTO.setIsDeleted(conceptDetailList.get(0).getIsDeleted());
+        }
+        return conceptInfoDTO;
+    }
+
+    /**
+     * 获取静态知识map Map<name_type,List<ConceptDetail>>
+     *
+     * @param nameList
+     * @return
+     */
+    public Map<String, List<ConceptDetail>> getDetailByConcept(List<String> nameList) {
+        Map<String, List<ConceptDetail>> retMap = new HashMap<>();
+        List<DictionaryInfoDTO> dicList = dictionaryFacade.getListByGroupType(8);
+        QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
+        conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        if (ListUtil.isNotEmpty(nameList)) {
+            conceptInfoQueryWrapper.in("name", nameList);
+        }
+        List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
+        Map<Long, ConceptInfo> conceptMap = EntityUtil.makeEntityMap(conceptInfoList, "id");
+
+        if (ListUtil.isNotEmpty(conceptInfoList)) {
+            List<Long> conceptIds = conceptInfoList.stream()
+                    .map(i -> i.getId())
+                    .collect(Collectors.toList());
+
+            QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
+            conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("concept_id", conceptIds);
+            List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
+            Map<Long, List<ConceptDetail>> detailMap
+                    = EntityUtil.makeEntityListMap(conceptDetailList, "conceptId");
+
+            for (Map.Entry<Long, ConceptInfo> entry : conceptMap.entrySet()) {
+                if (detailMap.containsKey(entry.getKey())) {
+                    retMap.put(entry.getValue().getName() + "_" + convertTypeName(entry.getValue().getType(), 2, dicList), detailMap.get(entry.getKey()));
+                }
+            }
+        }
+        return retMap;
+    }
 }

+ 163 - 17
src/main/java/com/diagbot/facade/DeptConfigFacade.java

@@ -3,15 +3,22 @@ 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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DeptConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.DeptConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.DeptConfigListVO;
 import com.diagbot.vo.DeptConfigPageVO;
 import com.diagbot.vo.IdListVO;
@@ -22,6 +29,7 @@ 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;
@@ -37,6 +45,8 @@ import java.util.stream.Collectors;
 public class DeptConfigFacade {
     @Autowired
     private DeptConfigService deptConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
 
     /**
      * 判断是否已存在
@@ -47,22 +57,19 @@ public class DeptConfigFacade {
     public Boolean isExistRecord(DeptConfig deptConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        DeptConfig oldRecord = new DeptConfig();
-        if (deptConfig.getId() != null) {
-            oldRecord = deptConfigService.getById(deptConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", deptConfig.getHisName())
+                .eq("unique_name", deptConfig.getUniqueName());
+        DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
+        if (deptConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
-        if (StringUtil.isNotBlank(deptConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", deptConfig.getHisName())
-                    .eq("unique_name", deptConfig.getUniqueName());
-            oldRecord = deptConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        if (deptConfig.getId() != null
+                && oldRecord != null
+                && !deptConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -80,6 +87,21 @@ public class DeptConfigFacade {
         deptConfig.setHospitalId(Long.valueOf(hospitalId));
         deptConfig.setModifier(userId);
         deptConfig.setGmtModified(now);
+        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", deptConfig.getHisName())
+                .eq("unique_name", deptConfig.getUniqueName());
+        DeptConfig oldRecord = deptConfigService.getOne(queryWrapper, false);
+        if (deptConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (deptConfig.getId() != null
+                && oldRecord != null
+                && !deptConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (deptConfig.getId() == null) {
             deptConfig.setCreator(userId);
@@ -206,10 +228,123 @@ public class DeptConfigFacade {
     public void importExcel(MultipartFile file) {
         List<DeptConfig> deptConfigList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
         if (ListUtil.isNotEmpty(deptConfigList)) {
-            saveOrUpdateRecords(deptConfigList);
+            importExcelRecords(deptConfigList);
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param deptConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<DeptConfig> deptConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        deptConfigList = deptConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getHisCode())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(deptConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < deptConfigList.size(); i++) {
+            if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(deptConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(deptConfigList.get(i).getHisName())) {
+                deptConfigList.get(i).setHisName(deptConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(deptConfigList.get(i).getHisCode())) {
+                deptConfigList.get(i).setHisCode(deptConfigList.get(i).getHisCode().trim());
+            }
+            if (StringUtil.isNotBlank(deptConfigList.get(i).getUniqueName())) {
+                deptConfigList.get(i).setUniqueName(deptConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(deptConfigList.get(i).getUniqueCode())) {
+                deptConfigList.get(i).setUniqueCode(deptConfigList.get(i).getUniqueCode().trim());
+            } else {
+                deptConfigList.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, Long>> configMap
+                = getConfigMap(Long.valueOf(hospitalId), null, null);
+        deptConfigList.forEach(deptConfig -> {
+            deptConfig.setHospitalId(Long.valueOf(hospitalId));
+            deptConfig.setModifier(userId);
+            deptConfig.setGmtModified(now);
+            if (deptConfig.getId() == null) {
+                if (configMap.containsKey(deptConfig.getHisName())) {
+                    deleteIds.add(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<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));
+            }
+        }
+        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;
+    }
+
     /**
      * 获取映射关系-公表名
      *
@@ -284,9 +419,20 @@ public class DeptConfigFacade {
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<DeptConfig> records = deptConfigService.list(queryWrapper);
         String fileName = "科室映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "科室映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
+    }
 }

+ 15 - 0
src/main/java/com/diagbot/facade/DictionaryFacade.java

@@ -35,6 +35,21 @@ public class DictionaryFacade extends DictionaryInfoServiceImpl {
         return EntityUtil.makeEntityListMap(listRes, "groupType");
     }
 
+    /**
+     * 返回字典信息
+     *
+     * @return
+     */
+    public Map<Long, List<DictionaryInfoDTO>> getListBack() {
+        List<DictionaryInfo> list = this.list(new QueryWrapper<DictionaryInfo>()
+                .in("return_type", ListUtil.arrayToList(new Long[] { 0L, 1L }))
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("group_type", "order_no"));
+        List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
+        return EntityUtil.makeEntityListMap(listRes, "groupType");
+    }
+
+
     /**
      * 返回指定字典信息
      *

+ 161 - 19
src/main/java/com/diagbot/facade/DiseaseConfigFacade.java

@@ -3,15 +3,22 @@ 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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DiseaseConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.DiseaseConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.DiseaseConfigListVO;
 import com.diagbot.vo.DiseaseConfigPageVO;
 import com.diagbot.vo.IdListVO;
@@ -22,6 +29,7 @@ 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;
@@ -37,6 +45,8 @@ import java.util.stream.Collectors;
 public class DiseaseConfigFacade {
     @Autowired
     private DiseaseConfigService diseaseConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
 
     /**
      * 判断是否已存在
@@ -47,23 +57,19 @@ public class DiseaseConfigFacade {
     public Boolean isExistRecord(DiseaseConfig diseaseConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<DiseaseConfig> queryWrapper = new QueryWrapper<>();
-        DiseaseConfig oldRecord = new DiseaseConfig();
-        if (diseaseConfig.getId() != null) {
-            oldRecord = diseaseConfigService.getById(diseaseConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", diseaseConfig.getHisName())
+                .eq("unique_name", diseaseConfig.getUniqueName());
+        DiseaseConfig oldRecord = diseaseConfigService.getOne(queryWrapper, false);
+        if (diseaseConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法添加");
         }
-        //hisName:uniqueName 1:n
-        if (StringUtil.isNotBlank(diseaseConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", diseaseConfig.getHisName())
-                    .eq("unique_name", diseaseConfig.getUniqueName());
-            oldRecord = diseaseConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        if (diseaseConfig.getId() != null
+                && oldRecord != null
+                && !diseaseConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -81,6 +87,21 @@ public class DiseaseConfigFacade {
         diseaseConfig.setHospitalId(Long.valueOf(hospitalId));
         diseaseConfig.setModifier(userId);
         diseaseConfig.setGmtModified(now);
+        QueryWrapper<DiseaseConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", diseaseConfig.getHisName())
+                .eq("unique_name", diseaseConfig.getUniqueName());
+        DiseaseConfig oldRecord = diseaseConfigService.getOne(queryWrapper, false);
+        if (diseaseConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法添加");
+        }
+        if (diseaseConfig.getId() != null
+                && oldRecord != null
+                && !diseaseConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (diseaseConfig.getId() == null) {
             diseaseConfig.setCreator(userId);
@@ -207,10 +228,120 @@ public class DiseaseConfigFacade {
     public void importExcel(MultipartFile file) {
         List<DiseaseConfig> diseaseConfigList = ExcelUtils.importExcel(file, 0, 1, DiseaseConfig.class);
         if (ListUtil.isNotEmpty(diseaseConfigList)) {
-            saveOrUpdateRecords(diseaseConfigList);
+            importExcelRecords(diseaseConfigList);
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param diseaseConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<DiseaseConfig> diseaseConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        diseaseConfigList = diseaseConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getIcdCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(diseaseConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < diseaseConfigList.size(); i++) {
+            if (StringUtil.isBlank(diseaseConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(diseaseConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getHisName())) {
+                diseaseConfigList.get(i).setHisName(diseaseConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getUniqueName())) {
+                diseaseConfigList.get(i).setUniqueName(diseaseConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getIcdCode())) {
+                diseaseConfigList.get(i).setIcdCode(diseaseConfigList.get(i).getIcdCode().trim());
+            } else {
+                diseaseConfigList.get(i).setIcdCode(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, 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())) {
+                    deleteIds.add(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<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));
+            }
+        }
+        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;
+    }
+
     /**
      * 获取映射关系-公表名
      *
@@ -252,7 +383,7 @@ public class DiseaseConfigFacade {
      * @param uniqueNames
      * @return
      */
-    public Map<String,Map<String,Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+    public Map<String, Map<String, Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
         Map<String, Map<String, Long>> retMap = new HashMap<>();
         QueryWrapper<DiseaseConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -285,9 +416,20 @@ public class DiseaseConfigFacade {
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<DiseaseConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<DiseaseConfig> records = diseaseConfigService.list(queryWrapper);
         String fileName = "疾病映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "疾病映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
+    }
 }

+ 329 - 29
src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -3,15 +3,23 @@ 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.CdssCoreClient;
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.DrugConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.DrugConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.DrugConfigListVO;
 import com.diagbot.vo.DrugConfigPageVO;
 import com.diagbot.vo.IdListVO;
@@ -22,6 +30,7 @@ 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;
@@ -37,6 +46,10 @@ import java.util.stream.Collectors;
 public class DrugConfigFacade {
     @Autowired
     private DrugConfigService drugConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+    @Autowired
+    private DictionaryFacade dictionaryFacade;
 
     /**
      * 判断是否已存在
@@ -47,22 +60,26 @@ public class DrugConfigFacade {
     public Boolean isExistRecord(DrugConfig drugConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        DrugConfig oldRecord = new DrugConfig();
-        if (drugConfig.getId() != null) {
-            oldRecord = drugConfigService.getById(drugConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", drugConfig.getHisName())
+                .eq("unique_name", drugConfig.getUniqueName());
+        if (StringUtil.isBlank(drugConfig.getForm())) {
+            queryWrapper.and(i -> i.isNull("form")
+                    .or()
+                    .eq("form", ""));
+        } else {
+            queryWrapper.eq("form", drugConfig.getForm());
         }
-        if (StringUtil.isNotBlank(drugConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", drugConfig.getHisName())
-                    .eq("unique_name", drugConfig.getUniqueName());
-            oldRecord = drugConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        DrugConfig oldRecord = drugConfigService.getOne(queryWrapper, false);
+        if (drugConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (drugConfig.getId() != null
+                && oldRecord != null
+                && !drugConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -80,6 +97,28 @@ public class DrugConfigFacade {
         drugConfig.setHospitalId(Long.valueOf(hospitalId));
         drugConfig.setModifier(userId);
         drugConfig.setGmtModified(now);
+        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", drugConfig.getHisName())
+                .eq("unique_name", drugConfig.getUniqueName());
+        if (StringUtil.isBlank(drugConfig.getForm())) {
+            queryWrapper.and(i -> i.isNull("form")
+                    .or()
+                    .eq("form", ""));
+        } else {
+            queryWrapper.eq("form", drugConfig.getForm());
+        }
+        DrugConfig oldRecord = drugConfigService.getOne(queryWrapper, false);
+        if (drugConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (drugConfig.getId() != null
+                && oldRecord != null
+                && !drugConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (drugConfig.getId() == null) {
             drugConfig.setCreator(userId);
@@ -126,19 +165,30 @@ public class DrugConfigFacade {
                 .filter(i -> StringUtil.isNotBlank(i.getHisName()))
                 .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
+        List<String> hisNames = drugConfigList
+                .stream()
+                .map(i -> i.getHisName())
+                .collect(Collectors.toList());
+        List<String> uniqueNames = drugConfigList
+                .stream()
+                .map(i -> i.getUniqueName())
+                .collect(Collectors.toList());
 
         // 验证数据是否已存在,已存在的先删除
         // 没id的删除重新插入,有id的更新
         List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Long>> configMap
-                = getConfigMap(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, 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.containsKey(drugConfig.getHisName())) {
-                    deleteIds.add(configMap.get(drugConfig.getHisName()).get(drugConfig.getUniqueName()));
+                if (configMap.get(drugConfig.getHisName()) != null
+                        && configMap.get(drugConfig.getHisName()).get(form) != null
+                        && configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()) != null) {
+                    deleteIds.add(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
                 }
                 drugConfig.setCreator(userId);
                 drugConfig.setGmtCreate(now);
@@ -147,6 +197,7 @@ public class DrugConfigFacade {
                 drugConfig.setIsDeleted(IsDeleteEnum.N.getKey());
             }
         });
+
         //删除已存在映射关系
         IdListVO idListVO = new IdListVO();
         idListVO.setIds(deleteIds);
@@ -206,19 +257,249 @@ public class DrugConfigFacade {
     public void importExcel(MultipartFile file) {
         List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 0, 1, DrugConfig.class);
         if (ListUtil.isNotEmpty(drugConfigList)) {
-            saveOrUpdateRecords(drugConfigList);
+            importExcelRecords(drugConfigList);
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param drugConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<DrugConfig> drugConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        drugConfigList = drugConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getForm())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(drugConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        //药品剂型
+        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
+        List<String> formList = dicTypeMappingList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getName()))
+                .map(i -> i.getName())
+                .distinct()
+                .collect(Collectors.toList());
+        List<String> formErrNumList = Lists.newLinkedList();
+        for (int i = 0; i < drugConfigList.size(); i++) {
+            if (StringUtil.isBlank(drugConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(drugConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(drugConfigList.get(i).getHisName())) {
+                drugConfigList.get(i).setHisName(drugConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(drugConfigList.get(i).getUniqueName())) {
+                drugConfigList.get(i).setUniqueName(drugConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(drugConfigList.get(i).getForm())) {
+                if (!formList.contains(drugConfigList.get(i).getForm())) {
+                    formErrNumList.add(String.valueOf(i + 2));
+                } else {
+                    drugConfigList.get(i).setForm(drugConfigList.get(i).getForm().trim());
+                }
+            }
+            if (StringUtil.isNotBlank(drugConfigList.get(i).getUniqueCode())) {
+                drugConfigList.get(i).setUniqueCode(drugConfigList.get(i).getUniqueCode().trim());
+            } else {
+                drugConfigList.get(i).setUniqueCode(null);
+            }
+        }
+
+        if (ListUtil.isNotEmpty(emptyNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
+                    + emptyNumList.stream().collect(Collectors.joining("、"))
+                    + "。导入取消,请修改后再试。\n");
+        }
+        if (ListUtil.isNotEmpty(formErrNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)药品剂型与数据库药品剂型不匹配:"
+                    + formErrNumList.stream().collect(Collectors.joining("、"))
+                    + "。导入取消,请修改后再试。\n");
+        }
+
+        List<String> hisNames = drugConfigList
+                .stream()
+                .map(i -> i.getHisName())
+                .collect(Collectors.toList());
+        List<String> uniqueNames = drugConfigList
+                .stream()
+                .map(i -> i.getUniqueName())
+                .collect(Collectors.toList());
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, Map<String, 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
+                        && configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()) != null) {
+                    deleteIds.add(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
+                }
+                drugConfig.setCreator(userId);
+                drugConfig.setGmtCreate(now);
+            }
+            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));
+            }
+        }
+        if (ListUtil.isNotEmpty(errorNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                    "以下行数(不计入空行)标准术语与数据库术语不匹配:"
+                            + errorNumList.stream().collect(Collectors.joining("、"))
+                            + "。导入取消,请修改后再试。");
+        }
+
+        //重复数据过滤
+        drugConfigList = drugConfigList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
+
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        drugConfigService.saveOrUpdateBatch(drugConfigList);
+        return true;
+    }
+
     /**
      * 获取映射关系-公表名
      *
      * @param hospitalId
      * @param hisNames
      * @param uniqueNames
+     * @return Map<hisName , Map < form , Map < uniqueName , id>>>
+     */
+    public Map<String, Map<String, Map<String, Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Map<String, Long>>> retMap = new HashMap<>();
+        QueryWrapper<DrugConfig> 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<DrugConfig> records = drugConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<DrugConfig>> hisNameMap = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<DrugConfig>> entry : hisNameMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, Map<String, Long>> formMap = new HashMap<>();
+                entry.getValue().forEach(i -> {
+                    if (StringUtil.isBlank(i.getForm())) {
+                        i.setForm("");
+                    }
+                });
+                Map<String, List<DrugConfig>> subMap
+                        = EntityUtil.makeEntityListMap(entry.getValue(), "form");
+                for (Map.Entry<String, List<DrugConfig>> subEntry : subMap.entrySet()) {
+                    if (ListUtil.isNotEmpty(subEntry.getValue())) {
+                        formMap.put(subEntry.getKey(),
+                                EntityUtil.makeMapWithKeyValue(subEntry.getValue(), "uniqueName", "id"));
+                    }
+                }
+                retMap.put(entry.getKey(), formMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系
+     * Map<uniqueName,Map<form,Map<hisName,id>>>
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
      * @return
      */
-    public Map<String, Map<String, Long>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+    public Map<String, Map<String, Map<String, Long>>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Map<String, Long>>> retMap = new HashMap<>();
+        QueryWrapper<DrugConfig> 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<DrugConfig> records = drugConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        records.forEach(i -> {
+            if (StringUtil.isBlank(i.getForm())) {
+                i.setForm("");
+            }
+        });
+        Map<String, List<DrugConfig>> uniqueNameMap = EntityUtil.makeEntityListMap(records, "uniqueName");
+        for (Map.Entry<String, List<DrugConfig>> entry : uniqueNameMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                Map<String, Map<String, Long>> formMap = new HashMap<>();
+                Map<String, List<DrugConfig>> subMap
+                        = EntityUtil.makeEntityListMap(entry.getValue(), "form");
+                for (Map.Entry<String, List<DrugConfig>> subEntry : subMap.entrySet()) {
+                    if (ListUtil.isNotEmpty(subEntry.getValue())) {
+                        formMap.put(subEntry.getKey(),
+                                EntityUtil.makeMapWithKeyValue(subEntry.getValue(), "hisName", "id"));
+                    }
+                }
+                retMap.put(entry.getKey(), formMap);
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return Map<hisName , Map < uniqueName , id>>
+     */
+    public Map<String, Map<String, Long>> getConfigMapWithoutForm(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
         Map<String, Map<String, Long>> retMap = new HashMap<>();
         QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -233,10 +514,12 @@ public class DrugConfigFacade {
         if (ListUtil.isEmpty(records)) {
             return retMap;
         }
-        Map<String, List<DrugConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<DrugConfig>> entry : configMap.entrySet()) {
+        Map<String, List<DrugConfig>> hisNameMap
+                = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<DrugConfig>> entry : hisNameMap.entrySet()) {
             if (ListUtil.isNotEmpty(entry.getValue())) {
-                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "uniqueName", "id"));
+                retMap.put(entry.getKey(),
+                        EntityUtil.makeMapWithKeyValue(records, "uniqueName", "id"));
             }
         }
         return retMap;
@@ -251,7 +534,7 @@ public class DrugConfigFacade {
      * @param uniqueNames
      * @return
      */
-    public Map<String,Map<String,Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+    public Map<String, Map<String, Long>> getUniqueNameConfigMapWithoutForm(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
         Map<String, Map<String, Long>> retMap = new HashMap<>();
         QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -266,11 +549,17 @@ public class DrugConfigFacade {
         if (ListUtil.isEmpty(records)) {
             return retMap;
         }
-
-        Map<String, List<DrugConfig>> uniqueNameMap = EntityUtil.makeEntityListMap(records, "uniqueName");
+        records.forEach(i -> {
+            if (StringUtil.isBlank(i.getForm())) {
+                i.setForm("");
+            }
+        });
+        Map<String, List<DrugConfig>> uniqueNameMap
+                = EntityUtil.makeEntityListMap(records, "uniqueName");
         for (Map.Entry<String, List<DrugConfig>> entry : uniqueNameMap.entrySet()) {
             if (ListUtil.isNotEmpty(entry.getValue())) {
-                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "hisName", "id"));
+                retMap.put(entry.getKey(),
+                        EntityUtil.makeMapWithKeyValue(records, "hisName", "id"));
             }
         }
         return retMap;
@@ -284,9 +573,20 @@ public class DrugConfigFacade {
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<DrugConfig> records = drugConfigService.list(queryWrapper);
         String fileName = "药品映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", DrugConfig.class, fileName, response, 12.8f);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "药品映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", DrugConfig.class, fileName, response, 12.8f);
+    }
 }

+ 198 - 26
src/main/java/com/diagbot/facade/LisConfigFacade.java

@@ -3,15 +3,22 @@ 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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.LisConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.LisConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.IdListVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.LisConfigListVO;
@@ -22,6 +29,7 @@ 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;
@@ -37,6 +45,8 @@ import java.util.stream.Collectors;
 public class LisConfigFacade{
     @Autowired
     private LisConfigService lisConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
 
     /**
      * 判断是否已存在
@@ -47,30 +57,27 @@ public class LisConfigFacade{
     public Boolean isExistRecord(LisConfig lisConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        LisConfig oldRecord = new LisConfig();
-        if (lisConfig.getId() != null) {
-            oldRecord = lisConfigService.getById(lisConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
-        } else if (StringUtil.isNotBlank(lisConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", lisConfig.getHisName())
-                    .eq("unique_name", lisConfig.getUniqueName());
-            if (StringUtil.isBlank(lisConfig.getHisDetailName())) {
-                queryWrapper
-                        .isNull("his_detail_name")
-                        .or()
-                        .eq("his_detail_name", "");
-            } else {
-                queryWrapper
-                        .eq("his_detail_name", lisConfig.getHisDetailName());
-            }
-            oldRecord = lisConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", lisConfig.getHisName())
+                .eq("unique_name", lisConfig.getUniqueName());
+        if (StringUtil.isBlank(lisConfig.getHisDetailName())) {
+            queryWrapper.and(i -> i.isNull("his_detail_name")
+                    .or()
+                    .eq("his_detail_name", ""));
+        } else {
+            queryWrapper
+                    .eq("his_detail_name", lisConfig.getHisDetailName());
+        }
+        LisConfig oldRecord = lisConfigService.getOne(queryWrapper, false);
+        if (lisConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (lisConfig.getId() != null
+                && oldRecord != null
+                && !lisConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -88,6 +95,29 @@ public class LisConfigFacade{
         lisConfig.setHospitalId(Long.valueOf(hospitalId));
         lisConfig.setModifier(userId);
         lisConfig.setGmtModified(now);
+        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", lisConfig.getHisName())
+                .eq("unique_name", lisConfig.getUniqueName());
+        if (StringUtil.isBlank(lisConfig.getHisDetailName())) {
+            queryWrapper.and(i -> i.isNull("his_detail_name")
+                    .or()
+                    .eq("his_detail_name", ""));
+        } else {
+            queryWrapper
+                    .eq("his_detail_name", lisConfig.getHisDetailName());
+        }
+        LisConfig oldRecord = lisConfigService.getOne(queryWrapper, false);
+        if (lisConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (lisConfig.getId() != null
+                && oldRecord != null
+                && !lisConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (lisConfig.getId() == null) {
             lisConfig.setCreator(userId);
@@ -228,10 +258,141 @@ public class LisConfigFacade{
         //从Excel读取数据
         List<LisConfig> lisConfigList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
         if (ListUtil.isNotEmpty(lisConfigList)) {
-            saveOrUpdateRecords(lisConfigList);
+            importExcelRecords(lisConfigList);
+        }else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param lisConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<LisConfig> lisConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        lisConfigList = lisConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getHisDetailName())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(lisConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < lisConfigList.size(); i++) {
+            if (StringUtil.isBlank(lisConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(lisConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(lisConfigList.get(i).getHisName())) {
+                lisConfigList.get(i).setHisName(lisConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(lisConfigList.get(i).getUniqueName())) {
+                lisConfigList.get(i).setUniqueName(lisConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(lisConfigList.get(i).getUniqueCode())) {
+                lisConfigList.get(i).setUniqueCode(lisConfigList.get(i).getUniqueCode().trim());
+            } else {
+                lisConfigList.get(i).setUniqueCode(null);
+            }
+        }
+
+        if (ListUtil.isNotEmpty(emptyNumList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
+                    + emptyNumList.stream().collect(Collectors.joining("、"))
+                    + "。导入取消,请修改后再试。\n");
+        }
+
+        List<String> hisNames = lisConfigList
+                .stream()
+                .map(i -> i.getHisName())
+                .collect(Collectors.toList());
+        List<String> uniqueNames = lisConfigList
+                .stream()
+                .map(i -> i.getUniqueName())
+                .collect(Collectors.toList());
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, Map<String, 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 (configMap.get(lisConfig.getHisName()).get("").containsKey(lisConfig.getUniqueName())) {
+                            deleteIds.add(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()));
+                        }
+                    } else if (configMap.get(lisConfig.getHisName()).containsKey(lisConfig.getHisDetailName())) {
+                        if (configMap.get(lisConfig.getHisName()).get(lisConfig.getHisDetailName()).containsKey(lisConfig.getUniqueName())) {
+                            deleteIds.add(configMap
+                                    .get(lisConfig.getHisName())
+                                    .get(lisConfig.getHisDetailName())
+                                    .get(lisConfig.getUniqueName()));
+                        }
+                    }
+                }
+                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 (!lisPackNames.contains(lisConfigList.get(i).getUniqueName())
+                    && !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("、"))
+                            + "。导入取消,请修改后再试。");
+        }
+
+        //重复数据过滤
+        lisConfigList = lisConfigList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
+
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        lisConfigService.saveOrUpdateBatch(lisConfigList);
+        return true;
+    }
+
 
     /**
      * 获取映射关系-id
@@ -333,9 +494,20 @@ public class LisConfigFacade{
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<LisConfig> records = lisConfigService.list(queryWrapper);
         String fileName = "检验映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "检验映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", LisConfig.class, fileName, response, 12.8f);
+    }
 }

+ 8 - 0
src/main/java/com/diagbot/facade/MrqcFacade.java

@@ -4,12 +4,14 @@ import com.diagbot.client.MrqcClient;
 import com.diagbot.dto.AnalyzeRunDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.AnalyzeCdsVO;
 import com.diagbot.vo.AnalyzeRunVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.validation.Valid;
+import java.util.Map;
 
 /**
  * @Description:
@@ -26,4 +28,10 @@ public class MrqcFacade {
         RespDTOUtil.respNGDealCover(analyzeRunDTO, "远程调用病历质控接口失败");
         return analyzeRunDTO.data;
     }
+
+    public Map<String, String> caseWritingPrompt(AnalyzeCdsVO analyzeCdsVO) {
+        RespDTO<Map<String, String>> caseWritingDTO = mrqcClient.caseWritingPrompt(analyzeCdsVO);
+        RespDTOUtil.respNGDealCover(caseWritingDTO, "远程调用病历质控接口失败");
+        return caseWritingDTO.data;
+    }
 }

+ 159 - 18
src/main/java/com/diagbot/facade/OperationConfigFacade.java

@@ -3,15 +3,22 @@ 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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.OperationConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.OperationConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.IdListVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.OperationConfigListVO;
@@ -22,6 +29,7 @@ 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;
@@ -37,6 +45,8 @@ import java.util.stream.Collectors;
 public class OperationConfigFacade {
     @Autowired
     private OperationConfigService operationConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
 
     /**
      * 判断是否已存在
@@ -47,22 +57,19 @@ public class OperationConfigFacade {
     public Boolean isExistRecord(OperationConfig operationConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        OperationConfig oldRecord = new OperationConfig();
-        if (operationConfig.getId() != null) {
-            oldRecord = operationConfigService.getById(operationConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", operationConfig.getHisName())
+                .eq("unique_name", operationConfig.getUniqueName());
+        OperationConfig oldRecord = operationConfigService.getOne(queryWrapper, false);
+        if (operationConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
-        if (StringUtil.isNotBlank(operationConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", operationConfig.getHisName())
-                    .eq("unique_name", operationConfig.getUniqueName());
-            oldRecord = operationConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        if (operationConfig.getId() != null
+                && oldRecord != null
+                && !operationConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -80,6 +87,21 @@ public class OperationConfigFacade {
         operationConfig.setHospitalId(Long.valueOf(hospitalId));
         operationConfig.setModifier(userId);
         operationConfig.setGmtModified(now);
+        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", operationConfig.getHisName())
+                .eq("unique_name", operationConfig.getUniqueName());
+        OperationConfig oldRecord = operationConfigService.getOne(queryWrapper, false);
+        if (operationConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (operationConfig.getId() != null
+                && oldRecord != null
+                && !operationConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (operationConfig.getId() == null) {
             operationConfig.setCreator(userId);
@@ -206,10 +228,118 @@ public class OperationConfigFacade {
     public void importExcel(MultipartFile file) {
         List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
         if (ListUtil.isNotEmpty(operationConfigList)) {
-            saveOrUpdateRecords(operationConfigList);
+            importExcelRecords(operationConfigList);
+        }else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param operationConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<OperationConfig> operationConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        operationConfigList = operationConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(operationConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < operationConfigList.size(); i++) {
+            if (StringUtil.isBlank(operationConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(operationConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(operationConfigList.get(i).getHisName())) {
+                operationConfigList.get(i).setHisName(operationConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(operationConfigList.get(i).getUniqueName())) {
+                operationConfigList.get(i).setUniqueName(operationConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(operationConfigList.get(i).getUniqueCode())) {
+                operationConfigList.get(i).setUniqueCode(operationConfigList.get(i).getUniqueCode().trim());
+            } else {
+                operationConfigList.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, 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())) {
+                    deleteIds.add(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.Opeartion.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);
+        return true;
+    }
+
     /**
      * 获取映射关系-公表名
      *
@@ -251,7 +381,7 @@ public class OperationConfigFacade {
      * @param uniqueNames
      * @return
      */
-    public Map<String,Map<String,Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+    public Map<String, Map<String, Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
         Map<String, Map<String, Long>> retMap = new HashMap<>();
         QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -284,9 +414,20 @@ public class OperationConfigFacade {
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<OperationConfig> records = operationConfigService.list(queryWrapper);
         String fileName = "手术映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "手术映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
+    }
 }

+ 159 - 18
src/main/java/com/diagbot/facade/PacsConfigFacade.java

@@ -3,15 +3,22 @@ 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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.PacsConfig;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.PacsConfigService;
 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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.IdListVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.PacsConfigListVO;
@@ -22,6 +29,7 @@ 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;
@@ -37,6 +45,8 @@ import java.util.stream.Collectors;
 public class PacsConfigFacade {
     @Autowired
     private PacsConfigService pacsConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
 
     /**
      * 判断是否已存在
@@ -47,22 +57,19 @@ public class PacsConfigFacade {
     public Boolean isExistRecord(PacsConfig pacsConfig) {
         String hospitalId = SysUserUtils.getCurrentHospitalID();
         QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        PacsConfig oldRecord = new PacsConfig();
-        if (pacsConfig.getId() != null) {
-            oldRecord = pacsConfigService.getById(pacsConfig.getId());
-            if (oldRecord != null && oldRecord.getIsDeleted().equals(IsDeleteEnum.N.getKey())) {
-                return true;
-            }
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", pacsConfig.getHisName())
+                .eq("unique_name", pacsConfig.getUniqueName());
+        PacsConfig oldRecord = pacsConfigService.getOne(queryWrapper, false);
+        if (pacsConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
-        if (StringUtil.isNotBlank(pacsConfig.getHisName())) {
-            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id", Long.valueOf(hospitalId))
-                    .eq("his_name", pacsConfig.getHisName())
-                    .eq("unique_name", pacsConfig.getUniqueName());
-            oldRecord = pacsConfigService.getOne(queryWrapper);
-            if (oldRecord != null) {
-                return true;
-            }
+        if (pacsConfig.getId() != null
+                && oldRecord != null
+                && !pacsConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
         }
         return false;
     }
@@ -80,6 +87,21 @@ public class PacsConfigFacade {
         pacsConfig.setHospitalId(Long.valueOf(hospitalId));
         pacsConfig.setModifier(userId);
         pacsConfig.setGmtModified(now);
+        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", pacsConfig.getHisName())
+                .eq("unique_name", pacsConfig.getUniqueName());
+        PacsConfig oldRecord = pacsConfigService.getOne(queryWrapper, false);
+        if (pacsConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (pacsConfig.getId() != null
+                && oldRecord != null
+                && !pacsConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
         //新增数据
         if (pacsConfig.getId() == null) {
             pacsConfig.setCreator(userId);
@@ -206,10 +228,118 @@ public class PacsConfigFacade {
     public void importExcel(MultipartFile file) {
         List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
         if (ListUtil.isNotEmpty(pacsConfigList)) {
-            saveOrUpdateRecords(pacsConfigList);
+            importExcelRecords(pacsConfigList);
+        }else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
     }
 
+    /**
+     * 数据导入
+     *
+     * @param pacsConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<PacsConfig> pacsConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        pacsConfigList = pacsConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(pacsConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < pacsConfigList.size(); i++) {
+            if (StringUtil.isBlank(pacsConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(pacsConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(pacsConfigList.get(i).getHisName())) {
+                pacsConfigList.get(i).setHisName(pacsConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(pacsConfigList.get(i).getUniqueName())) {
+                pacsConfigList.get(i).setUniqueName(pacsConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(pacsConfigList.get(i).getUniqueCode())) {
+                pacsConfigList.get(i).setUniqueCode(pacsConfigList.get(i).getUniqueCode().trim());
+            } else {
+                pacsConfigList.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, 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())) {
+                    deleteIds.add(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<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);
+        return true;
+    }
+
     /**
      * 获取映射关系-公表名
      *
@@ -284,9 +414,20 @@ public class PacsConfigFacade {
     public void exportExcel(HttpServletResponse response) {
         QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", SysUserUtils.getCurrentHospitalID());
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
         List<PacsConfig> records = pacsConfigService.list(queryWrapper);
         String fileName = "检查映射.xls";
         ExcelUtils.exportExcel(records, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
     }
-}
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "检查映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
+    }
+}

+ 18 - 14
src/main/java/com/diagbot/facade/PlanDetailFacade.java

@@ -110,22 +110,26 @@ public class PlanDetailFacade extends PlanDetailServiceImpl {
             planDetails.setCreator(SysUserUtils.getCurrentPrincipleID());
             planDetails.setModifier(SysUserUtils.getCurrentPrincipleID());
             planDetails.setGmtModified(now);
-            List<PlanDetailSubSaveVO> data = planDetailSave.getPlanDetailSub();
             planDetailService.save(planDetails);
-            List<PlanDetail> planDetailList = new ArrayList<>();
-            //再保存子类
-            for (PlanDetailSubSaveVO planDetailVO : data) {
-                PlanDetail planDetail = new PlanDetail();
-                BeanUtil.copyProperties(planDetailVO, planDetail);
-                planDetail.setPlanId(planDetailSaveVO.getPlanId());
-                planDetail.setParentId(planDetails.getId());
-                planDetail.setGmtCreate(now);
-                planDetail.setCreator(SysUserUtils.getCurrentPrincipleID());
-                planDetail.setModifier(SysUserUtils.getCurrentPrincipleID());
-                planDetail.setGmtModified(now);
-                planDetailList.add(planDetail);
+            List<PlanDetailSubSaveVO> data = planDetailSave.getPlanDetailSub();
+            if(ListUtil.isNotEmpty(data)){
+                List<PlanDetail> planDetailList = new ArrayList<>();
+                //再保存子类
+                for (PlanDetailSubSaveVO planDetailVO : data) {
+                    if(planDetailVO.getCode()!=null){
+                        PlanDetail planDetail = new PlanDetail();
+                        BeanUtil.copyProperties(planDetailVO, planDetail);
+                        planDetail.setPlanId(planDetailSaveVO.getPlanId());
+                        planDetail.setParentId(planDetails.getId());
+                        planDetail.setGmtCreate(now);
+                        planDetail.setCreator(SysUserUtils.getCurrentPrincipleID());
+                        planDetail.setModifier(SysUserUtils.getCurrentPrincipleID());
+                        planDetail.setGmtModified(now);
+                        planDetailList.add(planDetail);
+                    }
+                }
+                res = planDetailService.saveBatch(planDetailList);
             }
-            res = planDetailService.saveBatch(planDetailList);
         }
 
         return res;

+ 111 - 21
src/main/java/com/diagbot/facade/PlanFacade.java

@@ -21,11 +21,15 @@ import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.HospitalPlanCancelVO;
+import com.diagbot.vo.HospitalPlanDetailSaveVO;
+import com.diagbot.vo.HospitalPlanIdVO;
 import com.diagbot.vo.HospitalPlanPageVO;
 import com.diagbot.vo.HospitalPlanSaveVO;
 import com.diagbot.vo.HospitalPlanVO;
 import com.diagbot.vo.HospitalSetVO;
 import com.diagbot.vo.PlanDetailCancelVO;
+import com.diagbot.vo.PlanDetailSaveVO;
+import com.diagbot.vo.PlanDetailSubSaveVO;
 import com.diagbot.vo.PlanRevStopVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -49,7 +53,7 @@ public class PlanFacade extends PlanServiceImpl {
     PlanDetailFacade sysSetFacade;
 
     public List<SysPlanInfoDTO> getSysPlanInfoData(HospitalPlanVO hospitalPlanVO) {
-        //查询该医院有没有相关方案配置, 要是没有取默认的
+        //查询该医院有没有相关方案配置
         List<SysPlanInfoDTO> sysPlanInfoDTO = new ArrayList<>();
         QueryWrapper<Plan> sysPlanInfo = new QueryWrapper<>();
         sysPlanInfo.eq("is_deleted", IsDeleteEnum.N.getKey());
@@ -64,20 +68,9 @@ public class PlanFacade extends PlanServiceImpl {
             for (SysPlanInfoDTO data : sysPlanInfoDTO) {
                 planId.add(data.getId());
             }
-        } else {
-            QueryWrapper<Plan> sysPlandefault = new QueryWrapper<>();
-            sysPlandefault.eq("is_deleted", IsDeleteEnum.N.getKey());
-            sysPlandefault.eq("hospital_id", -1);
-            sysPlandefault.eq(StringUtil.isNotBlank(hospitalPlanVO.getPlanCode()), "plan_code", hospitalPlanVO.getPlanCode());
-            sysPlandefault.eq("plan_status", StatusEnum.Enable.getKey());
-            List<Plan> sysPlandefaultData = list(sysPlandefault);
-            if (ListUtil.isNotEmpty(sysPlandefaultData)) {
-                sysPlanInfoDTO = BeanUtil.listCopyTo(sysPlandefaultData, SysPlanInfoDTO.class);
-                for (SysPlanInfoDTO data : sysPlanInfoDTO) {
-                    planId.add(data.getId());
-                }
-            }
-            hospitalId = -1L;
+        }
+        if(ListUtil.isEmpty(planId)){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "该医院没有配置方案,请先配置方案!");
         }
         HospitalSetVO hospitalSetVO = new HospitalSetVO();
         hospitalSetVO.setHospitalId(hospitalId);
@@ -101,6 +94,7 @@ public class PlanFacade extends PlanServiceImpl {
      * @return
      */
     public boolean savePlanInfoDatas(HospitalPlanSaveVO hospitalPlanSaveVO) {
+        Long planId = hospitalPlanSaveVO.getId();
         Date now = DateUtil.now();
         boolean res = false;
         // 校验名称是否相同
@@ -108,10 +102,17 @@ public class PlanFacade extends PlanServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", hospitalPlanSaveVO.getHospitalId())
                 .eq("plan_name", hospitalPlanSaveVO.getPlanName())
-                .eq("plan_code", hospitalPlanSaveVO.getPlanCode())
                 .ne("id", hospitalPlanSaveVO.getId() == null ? -1 : hospitalPlanSaveVO.getId()));
         if (count > 0) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "相同【医院】下,方案名称已存在");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该方案名称已存在");
+        }
+        int countTow = this.count(new QueryWrapper<Plan>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalPlanSaveVO.getHospitalId())
+                .eq("plan_code", hospitalPlanSaveVO.getPlanCode())
+                .ne("id", hospitalPlanSaveVO.getId() == null ? -1 : hospitalPlanSaveVO.getId()));
+        if (countTow > 0) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该方案编码已存在");
         }
         if (hospitalPlanSaveVO.getId() != null) {
             UpdateWrapper<Plan> planQuery = new UpdateWrapper<>();
@@ -132,11 +133,40 @@ public class PlanFacade extends PlanServiceImpl {
             plan.setCreator(SysUserUtils.getCurrentPrincipleID());
             plan.setModifier(SysUserUtils.getCurrentPrincipleID());
             res = this.save(plan);
+            planId = plan.getId();
+        }
+        PlanDetailSaveVO planDetailSaveVO = new PlanDetailSaveVO();
+        planDetailSaveVO.setPlanId(planId);
+        planDetailSaveVO.setHospitalId(hospitalPlanSaveVO.getHospitalId());
+        List<HospitalPlanDetailSaveVO> planDetailParentNew = new ArrayList<>();
+        List<HospitalPlanDetailSaveVO> planDetailParent = hospitalPlanSaveVO.getPlanDetailParent();
+        if (ListUtil.isNotEmpty(planDetailParent)) {
+            for (HospitalPlanDetailSaveVO data : planDetailParent) {
+                HospitalPlanDetailSaveVO dataNew = new HospitalPlanDetailSaveVO();
+                BeanUtil.copyProperties(data, dataNew);
+                dataNew.setPlanId(planId);
+                List<PlanDetailSubSaveVO> planDetailSubNew = new ArrayList<>();
+                List<PlanDetailSubSaveVO> planDetailSub = data.getPlanDetailSub();
+                if (ListUtil.isNotEmpty(planDetailSub)) {
+                    for (PlanDetailSubSaveVO dataSub : planDetailSub) {
+                        PlanDetailSubSaveVO dataSubNew = new PlanDetailSubSaveVO();
+                        BeanUtil.copyProperties(dataSub, dataSubNew);
+                        dataSubNew.setPlanId(planId);
+                        planDetailSubNew.add(dataSubNew);
+                    }
+                    dataNew.setPlanDetailSub(planDetailSubNew);
+                    planDetailParentNew.add(dataNew);
+                }
+            }
         }
+
+        planDetailSaveVO.setPlanDetailParent(planDetailParentNew);
+        res = sysSetFacade.savePlanDetail(planDetailSaveVO);
         return res;
     }
 
     public IPage<PlanInfoPageDTO> getPlanInfoPage(HospitalPlanPageVO hospitalPlanPageVO) {
+        hospitalPlanPageVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
         IPage<PlanInfoPageDTO> data = getPlanInfoPageAll(hospitalPlanPageVO);
         List<PlanInfoPageDTO> planInfos = data.getRecords();
         // 取版本id查明细
@@ -148,9 +178,30 @@ public class PlanFacade extends PlanServiceImpl {
             }
             // 获取明细信息
             List<PlanDetailDTO> PlanDetailDatas = sysSetFacade.getByPlanIds(ids);
+            List<PlanDetailDTO> sysSetInfoData = BeanUtil.listCopyTo(PlanDetailDatas, PlanDetailDTO.class);
+            List<PlanDetailDTO> planDetailParent = new ArrayList<>();//父级数据
+            List<PlanDetailDTO> planDetailSub = new ArrayList<>();//子级数据
+            //分离数据,-1分父级菜单
+            for (PlanDetailDTO dataDeta : sysSetInfoData) {
+                if (dataDeta.getParentId() == (-1)) {
+                    planDetailParent.add(dataDeta);
+                } else {
+                    planDetailSub.add(dataDeta);
+                }
+            }
+            //把子级数据,放在父级下
+            Map<Long, List<PlanDetailDTO>> mapParentId = planDetailSub.stream().collect(Collectors.groupingBy(PlanDetailDTO::getParentId));
+            for (Long key : mapParentId.keySet()) {
+                for (PlanDetailDTO sysPlanInfos : planDetailParent) {
+                    if (sysPlanInfos.getId().equals(key)) {
+                        sysPlanInfos.setPlanDetails(mapParentId.get(key));
+                    }
+                }
+            }
+
             Map<Long, List<PlanDetailDTO>> map = new HashMap<>();
             // 获取所有用户开通的产品信息
-            map = EntityUtil.makeEntityListMap(PlanDetailDatas, "planId");
+            map = EntityUtil.makeEntityListMap(planDetailParent, "planId");
             if (map.size() > 0) {
                 for (PlanInfoPageDTO planInfo : planInfos) {
                     List<PlanDetailDTO> planDetails = map.get(planInfo.getId());
@@ -169,7 +220,10 @@ public class PlanFacade extends PlanServiceImpl {
         planDetailCancelVO.setPlanId(hospitalPlanCancelVO.getPlanId());
         boolean res = false;
         // 1.先判断数据是否存在有效
-        checkPlan(hospitalPlanCancelVO.getPlanId());
+        Plan plan = checkPlan(hospitalPlanCancelVO.getPlanId());
+        if (plan.getPlanStatus() == 1) {
+            throw new CommonException(CommonErrorCode.FAIL, "该方案启用中,不能删除!");
+        }
         UpdateWrapper<Plan> planNew = new UpdateWrapper<>();
         planNew
                 .eq("id", hospitalPlanCancelVO.getPlanId())
@@ -219,16 +273,52 @@ public class PlanFacade extends PlanServiceImpl {
         QueryWrapper<Plan> planFand = new QueryWrapper<>();
         planFand.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("plan_code", "plan_default")
-                .eq("hospital_id", 0L);
+                .eq("hospital_id", -1L);
         Plan plan = getOne(planFand, false);
         BeanUtil.copyProperties(plan, data);
         List<Long> planId = new ArrayList<>();
         planId.add(plan.getId());
         HospitalSetVO hospitalSetVO = new HospitalSetVO();
-        hospitalSetVO.setHospitalId(0L);
+        hospitalSetVO.setHospitalId(-1L);
         hospitalSetVO.setPlanId(planId);
         List<PlanDetailDTO> sysSetInfoData = sysSetFacade.getSysSetInfoData(hospitalSetVO);
         data.setPlanDetailDefault(sysSetInfoData);
         return data;
     }
+
+    public List<SysPlanInfoDTO> getPlanInfoIds(HospitalPlanIdVO hospitalPlanIdVO) {
+        //查询该医院有没有相关方案配置
+        List<SysPlanInfoDTO> sysPlanInfoDTO = new ArrayList<>();
+        QueryWrapper<Plan> sysPlanInfo = new QueryWrapper<>();
+        sysPlanInfo.eq("is_deleted", IsDeleteEnum.N.getKey());
+        sysPlanInfo.eq("hospital_id", hospitalPlanIdVO.getHospitalId());
+        sysPlanInfo.eq("id", hospitalPlanIdVO.getId());
+        List<Plan> sysPlanInfoData = list(sysPlanInfo);
+        List<Long> planId = new ArrayList<>();
+        Long hospitalId = hospitalPlanIdVO.getHospitalId();
+        if (ListUtil.isNotEmpty(sysPlanInfoData)) {
+            sysPlanInfoDTO = BeanUtil.listCopyTo(sysPlanInfoData, SysPlanInfoDTO.class);
+            for (SysPlanInfoDTO data : sysPlanInfoDTO) {
+                planId.add(data.getId());
+            }
+        }
+        if(ListUtil.isEmpty(planId)){
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据不存在!");
+        }
+        HospitalSetVO hospitalSetVO = new HospitalSetVO();
+        hospitalSetVO.setHospitalId(hospitalId);
+        hospitalSetVO.setPlanId(planId);
+        List<PlanDetailDTO> sysSetInfoData = sysSetFacade.getSysSetInfoData(hospitalSetVO);
+        //把父级和子级数据sysSetInfoData放在方案下
+        Map<Long, List<PlanDetailDTO>> dataMap = sysSetInfoData.stream().collect(Collectors.groupingBy(PlanDetailDTO::getPlanId));
+        for (Long key : dataMap.keySet()) {
+            for (SysPlanInfoDTO sysPlanInfos : sysPlanInfoDTO) {
+                if (sysPlanInfos.getId().equals(key)) {
+                    sysPlanInfos.setSysSetInfo(dataMap.get(key));
+                }
+            }
+        }
+
+        return sysPlanInfoDTO;
+    }
 }

+ 327 - 54
src/main/java/com/diagbot/facade/PushFacade.java

@@ -5,19 +5,30 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.TreatDTO;
+import com.diagbot.entity.ConceptDetail;
+import com.diagbot.enums.StaticTypeEnum;
 import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.IndicationPushVO;
+import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.SearchData;
 import com.google.common.collect.Lists;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -30,6 +41,8 @@ public class PushFacade {
     private AssembleFacade assembleFacade;
     @Autowired
     private CdssCoreClient cdssCoreClient;
+    @Autowired
+    private ConceptInfoFacade conceptInfoFacade;
 
     /**
      * 基础推理-症状、查体、化验、辅检、诊断
@@ -37,35 +50,33 @@ public class PushFacade {
      * @param pushVO
      */
     public PushDTO push(PushVO pushVO) {
+        if (pushVO.getDiseaseName() != null
+                && StringUtil.isBlank(pushVO.getDiseaseName().getName())
+                && StringUtil.isBlank(pushVO.getDiseaseName().getUniqueName())) {
+            pushVO.setDiseaseName(null);
+        }
         SearchData searchData = new SearchData();
         BeanUtil.copyProperties(pushVO, searchData);
-        //TODO 入参映射
+        //入参映射
         searchData = assembleFacade.assembleData(searchData);
         BeanUtil.copyProperties(searchData, pushVO);
         RespDTO<PushDTO> resp = cdssCoreClient.push(pushVO);
-        //RespDTOUtil.respNGDealCover(resp, "远程调用推理接口失败");
-        //PushDTO data = resp.data;
-        PushDTO data = new PushDTO();
-        List<PushBaseDTO> symptom = Lists.newArrayList();
-        PushBaseDTO sympItem1 = new PushBaseDTO();
-        sympItem1.setName("发热");
-        symptom.add(sympItem1);
-        PushBaseDTO sympItem2 = new PushBaseDTO();
-        sympItem2.setName("咳嗽");
-        symptom.add(sympItem2);
-        data.setSymptom(symptom);
-        List<PushBaseDTO> dis = Lists.newArrayList();
-        PushBaseDTO disItem1 = new PushBaseDTO();
-        disItem1.setName("急性胰腺炎");
-        dis.add(disItem1);
-        PushBaseDTO disItem2 = new PushBaseDTO();
-        disItem2.setName("咳嗽");
-        dis.add(disItem2);
-        Map<String, List<PushBaseDTO>> disMap = new HashMap<>();
-        disMap.put("可能诊断", dis);
-        data.setDis(disMap);
-        //TODO 出参映射
+        RespDTOUtil.respNGDeal(resp, "远程调用推理接口失败");
+        PushDTO data = resp.data;
+        //------------------测试数据开始------------------
+        //        PushDTO data = testDataPush();
+        //------------------测试数据结束------------------
+        //出参映射
         data = assembleFacade.assemblePushDTO(data, pushVO.getHospitalId());
+        //是否有静态信息
+        if (pushVO.getGetStaticKnowledge() != null
+                && pushVO.getGetStaticKnowledge().equals(1)) {
+            data = getStaticKnoledge(data);
+        }
+        //一般治疗
+        if (data != null) {
+            data.setTreat(retGeneraTreat(data, pushVO.getHospitalId()));
+        }
         return data;
     }
 
@@ -77,40 +88,302 @@ public class PushFacade {
     public IndicationDTO indicationPush(IndicationPushVO indicationPushVO) {
         SearchData searchData = new SearchData();
         BeanUtil.copyProperties(indicationPushVO, searchData);
-        //TODO 入参映射
+        //入参映射
         searchData = assembleFacade.assembleData(searchData);
         BeanUtil.copyProperties(searchData, indicationPushVO);
-//        IndicationDTO indicationDTO = new IndicationDTO();
-//        List<BillMsg> billMsgList = Lists.newArrayList();
-//        BillMsg item1 = new BillMsg();
-//        item1.setMsg("该患者年龄15,不宜开左氧氟沙星");
-//        item1.setOrderName("左氧氟沙星");
-//        item1.setOrderStandName("左氧氟沙星");
-//        item1.setContent("年龄15");
-//        item1.setType("禁忌年龄");
-//        billMsgList.add(item1);
-//        indicationDTO.setBillMsgList(billMsgList);
-//        List<BillMsg> criticalValList = Lists.newArrayList();
-//        BillMsg item2 = new BillMsg();
-//        item2.setMsg("该患者血常规血小板计数30,请留意");
-//        item2.setOrderName("");
-//        item2.setOrderStandName("");
-//        item2.setContent("血常规血小板计数30");
-//        item2.setType("血常规血小板计数30");
-//        criticalValList.add(item2);
-//        indicationDTO.setCriticalValList(criticalValList);
-//        List<BillMsg> highRiskList = Lists.newArrayList();
-//        BillMsg item3 = new BillMsg();
-//        item3.setMsg("盐酸肾上腺素注射液为高风险药品,请留意");
-//        item3.setOrderName("盐酸肾上腺素注射液");
-//        item3.setOrderStandName("盐酸肾上腺素注射液");
-//        item3.setContent("");
-//        item3.setType("药品");
-//        highRiskList.add(item3);
-//        indicationDTO.setHighRiskList(highRiskList);
         RespDTO<IndicationDTO> resp = cdssCoreClient.indication(indicationPushVO);
-        RespDTOUtil.respNGDealCover(resp, "远程调用推理接口失败");
-        IndicationDTO indicationDTO=resp.data;
+        RespDTOUtil.respNGDeal(resp, "远程调用推理接口失败");
+        IndicationDTO indicationDTO = resp.data;
+        return indicationDTO;
+    }
+
+    /**
+     * 推理持续检验检查计划
+     *
+     * @param pushPlanVO
+     * @return
+     */
+    public PushPlanDTO pushPlan(PushPlanVO pushPlanVO) {
+        SearchData searchData = new SearchData();
+        BeanUtil.copyProperties(pushPlanVO, searchData);
+        //入参映射
+        searchData = assembleFacade.assembleData(searchData);
+        BeanUtil.copyProperties(searchData, pushPlanVO);
+        RespDTO<PushPlanDTO> resp = cdssCoreClient.pushPlan(pushPlanVO);
+        RespDTOUtil.respNGDeal(resp, "远程调用推理接口失败");
+        PushPlanDTO pushPlanDTO = resp.data;
+        return pushPlanDTO;
+    }
+
+    /**
+     * 推理结果标志是否包含静态知识
+     *
+     * @param pushDTO
+     * @return
+     */
+    public PushDTO getStaticKnoledge(PushDTO pushDTO) {
+        List<String> conceptNameList = Lists.newLinkedList();
+        List<PushBaseDTO> conceptBaseList = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(pushDTO.getLis())) {
+            conceptBaseList.addAll(pushDTO.getLis());
+        }
+        if (ListUtil.isNotEmpty(pushDTO.getPacs())) {
+            conceptBaseList.addAll(pushDTO.getPacs());
+        }
+        if (pushDTO.getDis() != null) {
+            for (Map.Entry<String, List<PushBaseDTO>> entry : pushDTO.getDis().entrySet()) {
+                if (ListUtil.isNotEmpty(entry.getValue())) {
+                    conceptBaseList.addAll(entry.getValue());
+                }
+            }
+        }
+        if (ListUtil.isNotEmpty(pushDTO.getMedicines())) {
+            conceptBaseList.addAll(pushDTO.getMedicines());
+        }
+        if (ListUtil.isNotEmpty(pushDTO.getOperations())) {
+            conceptBaseList.addAll(pushDTO.getOperations());
+        }
+        if (ListUtil.isNotEmpty(conceptBaseList)) {
+            conceptNameList = conceptBaseList.stream()
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList());
+
+            Map<String, List<ConceptDetail>> conceptDetailMap = conceptInfoFacade.getDetailByConcept(conceptNameList);
+            if (pushDTO.getDis() != null) {
+                for (Map.Entry<String, List<PushBaseDTO>> entry : pushDTO.getDis().entrySet()) {
+                    if (ListUtil.isNotEmpty(entry.getValue())) {
+                        entry.getValue().forEach(item -> {
+                            if (conceptDetailMap.containsKey(item.getName() + "_" + StaticTypeEnum.getName(1))) {
+                                item.setHasInfo(1);
+                            }
+                        });
+                    }
+                }
+            }
+            if (ListUtil.isNotEmpty(pushDTO.getLis())) {
+                pushDTO.getLis().forEach(item -> {
+                    if (conceptDetailMap.containsKey(item.getName() + "_" + StaticTypeEnum.getName(3))) {
+                        item.setHasInfo(1);
+                    }
+                });
+            }
+            if (ListUtil.isNotEmpty(pushDTO.getPacs())) {
+                pushDTO.getPacs().forEach(item -> {
+                    if (conceptDetailMap.containsKey(item.getName() + "_" + StaticTypeEnum.getName(5))) {
+                        item.setHasInfo(1);
+                    }
+                });
+            }
+            if (ListUtil.isNotEmpty(pushDTO.getMedicines())) {
+                pushDTO.getMedicines().forEach(item -> {
+                    if (conceptDetailMap.containsKey(item.getName() + "_" + StaticTypeEnum.getName(2))) {
+                        item.setHasInfo(1);
+                    }
+                });
+            }
+            if (ListUtil.isNotEmpty(pushDTO.getOperations())) {
+                pushDTO.getOperations().forEach(item -> {
+                    if (conceptDetailMap.containsKey(item.getName() + "_" + StaticTypeEnum.getName(6))) {
+                        item.setHasInfo(1);
+                    }
+                });
+            }
+        }
+        return pushDTO;
+    }
+
+    /**
+     * 查找一般治疗
+     *
+     * @param pushDTO
+     * @param hospitalId
+     * @return
+     */
+    public List<TreatDTO> retGeneraTreat(PushDTO pushDTO, Long hospitalId) {
+        List<TreatDTO> retGeneraTreat = pushDTO.getTreat();
+        if (ListUtil.isNotEmpty(retGeneraTreat)) {
+            List<String> conceptNameList = retGeneraTreat.stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                    .map(i -> i.getUniqueName())
+                    .collect(Collectors.toList());
+            Map<String, List<ConceptDetail>> conceptDetailMap = conceptInfoFacade.getDetailByConcept(conceptNameList);
+            if (conceptDetailMap == null || conceptDetailMap.size() == 0) {
+                return retGeneraTreat;
+            }
+            for (TreatDTO treatDTO : retGeneraTreat) {
+                if (StringUtil.isNotBlank(treatDTO.getUniqueName())) {
+                    String key = treatDTO.getUniqueName() + "_" + StaticTypeEnum.getName(1);
+                    if (conceptDetailMap.containsKey(key)) {
+                        List<ConceptDetail> conceptDetailList = conceptDetailMap.get(key);
+                        treatDTO.setGeneraTreat(conceptDetailList
+                                .stream()
+                                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
+                                .collect(Collectors.toList())
+                                .get(0).getContent());
+                    }
+                }
+            }
+        }
+        return retGeneraTreat;
+    }
+
+
+    /**
+     * 推理测试数据设置
+     *
+     * @return 推理测试数据
+     */
+    private PushDTO testDataPush() {
+        PushDTO data = new PushDTO();
+        //症状
+        if (ListUtil.isEmpty(data.getSymptom())) {
+            List<PushBaseDTO> symptom = Lists.newArrayList();
+            PushBaseDTO sympItem1 = new PushBaseDTO();
+            sympItem1.setName("发热");
+            symptom.add(sympItem1);
+            PushBaseDTO sympItem2 = new PushBaseDTO();
+            sympItem2.setName("咳嗽");
+            symptom.add(sympItem2);
+            data.setSymptom(symptom);
+        }
+        //体格检查
+        if (ListUtil.isEmpty(data.getVital())) {
+            List<PushBaseDTO> vital = Lists.newArrayList();
+            PushBaseDTO vital1 = new PushBaseDTO();
+            vital1.setName("肾区叩痛阳性");
+            vital.add(vital1);
+            PushBaseDTO vital2 = new PushBaseDTO();
+            vital2.setName("血压升高");
+            vital.add(vital2);
+            data.setVital(vital);
+        }
+        //检验
+        if (ListUtil.isEmpty(data.getLis())) {
+            List<PushBaseDTO> lis = Lists.newArrayList();
+            PushBaseDTO lis1 = new PushBaseDTO();
+            lis1.setName("血常规");
+            lis.add(lis1);
+            PushBaseDTO lis2 = new PushBaseDTO();
+            lis2.setName("尿常规");
+            lis.add(lis2);
+            PushBaseDTO lis3 = new PushBaseDTO();
+            lis3.setName("幽门螺杆菌抗体测定");
+            lis.add(lis3);
+            data.setLis(lis);
+        }
+        //检查
+        if (ListUtil.isEmpty(data.getPacs())) {
+            List<PushBaseDTO> pacs = Lists.newArrayList();
+            PushBaseDTO pacs1 = new PushBaseDTO();
+            pacs1.setName("普通胃镜检查");
+            pacs.add(pacs1);
+            PushBaseDTO pacs2 = new PushBaseDTO();
+            pacs2.setName("经直肠前列腺彩超检查");
+            pacs.add(pacs2);
+            data.setPacs(pacs);
+        }
+        //药品
+        if (ListUtil.isEmpty(data.getMedicines())) {
+            List<PushBaseDTO> medicines = Lists.newArrayList();
+            PushBaseDTO medicines1 = new PushBaseDTO();
+            medicines1.setName("钙通道阻滞剂");
+            medicines.add(medicines1);
+            PushBaseDTO medicines2 = new PushBaseDTO();
+            medicines2.setName("盐酸肾上腺素注射液");
+            medicines.add(medicines2);
+            data.setMedicines(medicines);
+        }
+        //手术和操作
+        if (ListUtil.isEmpty(data.getOperations())) {
+            List<PushBaseDTO> operations = Lists.newArrayList();
+            PushBaseDTO operations1 = new PushBaseDTO();
+            operations1.setName("前列腺按摩");
+            operations.add(operations1);
+            PushBaseDTO operations2 = new PushBaseDTO();
+            operations2.setName("经皮冠状动脉介入治疗(PCI)");
+            operations.add(operations2);
+            data.setOperations(operations);
+        }
+        //诊断
+        if (MapUtils.isEmpty(data.getDis())) {
+            List<PushBaseDTO> dis = Lists.newArrayList();
+            PushBaseDTO disItem1 = new PushBaseDTO();
+            disItem1.setName("急性胰腺炎");
+            dis.add(disItem1);
+            PushBaseDTO disItem2 = new PushBaseDTO();
+            disItem2.setName("无晶状体眼");
+            dis.add(disItem2);
+            Map<String, List<PushBaseDTO>> disMap = new HashMap<>();
+            disMap.put("可能诊断", dis);
+            List<PushBaseDTO> dis2 = Lists.newArrayList();
+            dis2.addAll(dis);
+            PushBaseDTO disItem3 = new PushBaseDTO();
+            disItem3.setName("糖尿病");
+            dis2.add(disItem3);
+            disMap.put("鉴别诊断", dis2);
+            data.setDis(disMap);
+        }
+        //一般治疗
+        if (ListUtil.isEmpty(data.getTreat())) {
+            List<TreatDTO> treat = new ArrayList<>();
+            TreatDTO treatDTO1 = new TreatDTO();
+            treatDTO1.setName("无晶状体眼");
+            treatDTO1.setUniqueName("无晶状体眼");
+            treat.add(treatDTO1);
+            data.setTreat(treat);
+        }
+        return data;
+    }
+
+    /**
+     * 提醒测试数据
+     *
+     * @return 提醒测试数据
+     */
+    private IndicationDTO indicationTestData() {
+        IndicationDTO indicationDTO = new IndicationDTO();
+        List<BillMsg> billMsgList = Lists.newArrayList();
+        BillMsg item1 = new BillMsg();
+        item1.setMsg("该患者年龄15,不宜开左氧氟沙星");
+        item1.setOrderName("左氧氟沙星");
+        item1.setOrderStandName("左氧氟沙星");
+        item1.setContent("年龄15");
+        item1.setType("禁忌年龄");
+        billMsgList.add(item1);
+        indicationDTO.setBillMsgList(billMsgList);
+        List<BillMsg> criticalValList = Lists.newArrayList();
+        BillMsg item2 = new BillMsg();
+        item2.setMsg("该患者血常规血小板计数30,请留意");
+        item2.setOrderName("");
+        item2.setOrderStandName("");
+        item2.setContent("血常规血小板计数30");
+        item2.setType("血常规血小板计数30");
+        criticalValList.add(item2);
+        indicationDTO.setCriticalValList(criticalValList);
+        //加入高危假数据
+        if (ListUtil.isEmpty(indicationDTO.getHighRiskList())) {
+            List<BillMsg> highRiskList = Lists.newArrayList();
+            BillMsg item3 = new BillMsg();
+            item3.setMsg("盐酸肾上腺素注射液为高风险药品,请留意(假数据)");
+            item3.setOrderName("盐酸肾上腺素注射液");
+            item3.setOrderStandName("盐酸肾上腺素注射液");
+            item3.setContent("");
+            item3.setType("药品");
+            highRiskList.add(item3);
+            indicationDTO.setHighRiskList(highRiskList);
+        }
+        //加入其他提醒假数据
+        if (ListUtil.isEmpty(indicationDTO.getOtherList())) {
+            List<BillMsg> otherList = new ArrayList<>();
+            BillMsg other = new BillMsg();
+            other.setMsg("该患者血小板计数<10×10^9/L,建议输注血小板。(假数据)");
+            other.setOrderName("血小板");
+            other.setOrderStandName("血小板");
+            other.setContent("");
+            other.setType("输血");
+            otherList.add(other);
+            indicationDTO.setOtherList(otherList);
+        }
         return indicationDTO;
     }
 }

+ 433 - 0
src/main/java/com/diagbot/facade/TransfusionConfigFacade.java

@@ -0,0 +1,433 @@
+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.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.enums.ConceptTypeEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.TransfusionConfigService;
+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.SysUserUtils;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.TransfusionConfigListVO;
+import com.diagbot.vo.TransfusionConfigPageVO;
+import com.google.common.collect.Lists;
+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: 2020/8/31 11:03
+ */
+@Component
+public class TransfusionConfigFacade {
+    @Autowired
+    private TransfusionConfigService transfusionConfigService;
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+
+    /**
+     * 判断是否已存在
+     *
+     * @param transfusionConfig
+     * @return
+     */
+    public Boolean isExistRecord(TransfusionConfig transfusionConfig) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", transfusionConfig.getHisName())
+                .eq("unique_name", transfusionConfig.getUniqueName());
+        TransfusionConfig oldRecord = transfusionConfigService.getOne(queryWrapper, false);
+        if (transfusionConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (transfusionConfig.getId() != null
+                && oldRecord != null
+                && !transfusionConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        return false;
+    }
+
+    /**
+     * 保存记录-单条
+     *
+     * @param transfusionConfig
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(TransfusionConfig transfusionConfig) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+        transfusionConfig.setHospitalId(Long.valueOf(hospitalId));
+        transfusionConfig.setModifier(userId);
+        transfusionConfig.setGmtModified(now);
+        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", Long.valueOf(hospitalId))
+                .eq("his_name", transfusionConfig.getHisName())
+                .eq("unique_name", transfusionConfig.getUniqueName());
+        TransfusionConfig oldRecord = transfusionConfigService.getOne(queryWrapper, false);
+        if (transfusionConfig.getId() == null
+                && oldRecord != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        if (transfusionConfig.getId() != null
+                && oldRecord != null
+                && !transfusionConfig.getId().equals(oldRecord.getId())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
+        }
+        //新增数据
+        if (transfusionConfig.getId() == null) {
+            transfusionConfig.setCreator(userId);
+            transfusionConfig.setGmtCreate(now);
+        }
+        if (transfusionConfig.getIsDeleted() == null) {
+            transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+        }
+        transfusionConfigService.saveOrUpdate(transfusionConfig);
+        return true;
+    }
+
+    /**
+     * 保存记录-批量
+     *
+     * @param transfusionConfigListVO
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(TransfusionConfigListVO transfusionConfigListVO) {
+        if (ListUtil.isEmpty(transfusionConfigListVO.getTransfusionConfigList())) {
+            return false;
+        }
+        return saveOrUpdateRecords(transfusionConfigListVO.getTransfusionConfigList());
+    }
+
+    /**
+     * 批量保存
+     *
+     * @param transfusionConfigList
+     * @return
+     */
+    public Boolean saveOrUpdateRecords(List<TransfusionConfig> transfusionConfigList) {
+        if (ListUtil.isEmpty(transfusionConfigList)) {
+            return false;
+        }
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //数据不完整的不保存
+        //过滤外部名称或公表名为空的数据
+        transfusionConfigList = transfusionConfigList
+                .stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+
+        // 验证数据是否已存在,已存在的先删除
+        // 没id的删除重新插入,有id的更新
+        List<Long> deleteIds = Lists.newLinkedList();
+        Map<String, Map<String, 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())) {
+                    deleteIds.add(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()));
+                }
+                transfusionConfig.setCreator(userId);
+                transfusionConfig.setGmtCreate(now);
+            }
+            if (transfusionConfig.getIsDeleted() == null) {
+                transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
+            }
+        });
+        //删除已存在映射关系
+        IdListVO idListVO = new IdListVO();
+        idListVO.setIds(deleteIds);
+        deleteRecords(idListVO);
+        transfusionConfigService.saveOrUpdateBatch(transfusionConfigList);
+        return true;
+    }
+
+    /**
+     * 删除记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public Boolean deleteRecord(IdVO idVO) {
+        UpdateWrapper<TransfusionConfig> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.eq("id", idVO.getId())
+                .set("is_deleted", IsDeleteEnum.Y.getKey());
+        transfusionConfigService.removeById(idVO.getId());
+        return true;
+    }
+
+    /**
+     * 删除记录-批量
+     *
+     * @param idListVO
+     * @return
+     */
+    public Boolean deleteRecords(IdListVO idListVO) {
+        if (ListUtil.isEmpty(idListVO.getIds())) {
+            return false;
+        }
+        UpdateWrapper<TransfusionConfig> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", idListVO.getIds())
+                .set("is_deleted", IsDeleteEnum.Y.getKey());
+        transfusionConfigService.removeByIds(idListVO.getIds());
+        return true;
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param transfusionConfigPageVO
+     * @return
+     */
+    public IPage<TransfusionConfig> getPage(TransfusionConfigPageVO transfusionConfigPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        transfusionConfigPageVO.setHospitalId(Long.valueOf(hospitalId));
+        return transfusionConfigService.getPage(transfusionConfigPageVO);
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     */
+    public void importExcel(MultipartFile file) {
+        List<TransfusionConfig> transfusionConfigList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
+        if (ListUtil.isNotEmpty(transfusionConfigList)) {
+            importExcelRecords(transfusionConfigList);
+        }else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param transfusionConfigList
+     * @return
+     */
+    public Boolean importExcelRecords(List<TransfusionConfig> transfusionConfigList) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        Date now = DateUtil.now();
+
+        //1、数据完整性校验
+        //2、去除前后空格
+        //过滤空数据,保留重复数据,方便计行
+        transfusionConfigList = transfusionConfigList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName())
+                        || StringUtil.isNotBlank(i.getUniqueCode())
+                        || StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(transfusionConfigList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<String> emptyNumList = Lists.newLinkedList();
+        for (int i = 0; i < transfusionConfigList.size(); i++) {
+            if (StringUtil.isBlank(transfusionConfigList.get(i).getHisName())
+                    || StringUtil.isBlank(transfusionConfigList.get(i).getUniqueName())) {
+                emptyNumList.add(String.valueOf(i + 2));
+            }
+            if (StringUtil.isNotBlank(transfusionConfigList.get(i).getHisName())) {
+                transfusionConfigList.get(i).setHisName(transfusionConfigList.get(i).getHisName().trim());
+            }
+            if (StringUtil.isNotBlank(transfusionConfigList.get(i).getUniqueName())) {
+                transfusionConfigList.get(i).setUniqueName(transfusionConfigList.get(i).getUniqueName().trim());
+            }
+            if (StringUtil.isNotBlank(transfusionConfigList.get(i).getUniqueCode())) {
+                transfusionConfigList.get(i).setUniqueCode(transfusionConfigList.get(i).getUniqueCode().trim());
+            } else {
+                transfusionConfigList.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, 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())) {
+                    deleteIds.add(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<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);
+        return true;
+    }
+
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String, Map<String, Long>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Long>> retMap = new HashMap<>();
+        QueryWrapper<TransfusionConfig> 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<TransfusionConfig> records = transfusionConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<TransfusionConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<TransfusionConfig>> entry : configMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "uniqueName", "id"));
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系
+     * Map<uniqueName,Map<hisName,id>>
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String,Map<String,Long>> getUniqueNameConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Long>> retMap = new HashMap<>();
+        QueryWrapper<TransfusionConfig> 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<TransfusionConfig> records = transfusionConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+
+        Map<String, List<TransfusionConfig>> uniqueNameMap = EntityUtil.makeEntityListMap(records, "uniqueName");
+        for (Map.Entry<String, List<TransfusionConfig>> entry : uniqueNameMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "hisName", "id"));
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     */
+    public void exportExcel(HttpServletResponse response) {
+        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .orderByDesc("gmt_modified");
+        List<TransfusionConfig> records = transfusionConfigService.list(queryWrapper);
+        String fileName = "输血映射.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
+    }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response) {
+        String fileName = "输血映射模板.xls";
+        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
+    }
+}

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

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.UploadServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description: 文件上传装饰层
+ * @author: gaodm
+ * @time: 2018/11/13 13:19
+ */
+@Component
+public class UploadFacade extends UploadServiceImpl {
+}

+ 13 - 3
src/main/java/com/diagbot/mapper/ConceptInfoMapper.java

@@ -1,7 +1,11 @@
 package com.diagbot.mapper;
 
-import com.diagbot.entity.ConceptInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.ConceptInfoDTO;
+import com.diagbot.entity.ConceptInfo;
+import com.diagbot.vo.ConceptInfoPageVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -12,5 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2020-08-18
  */
 public interface ConceptInfoMapper extends BaseMapper<ConceptInfo> {
-
-}
+    /**
+     * 列表
+     *
+     * @param conceptInfoPageVO
+     * @return
+     */
+    IPage<ConceptInfoDTO> getPage(@Param("conceptInfoPageVO") ConceptInfoPageVO conceptInfoPageVO);
+}

+ 25 - 0
src/main/java/com/diagbot/mapper/TransfusionConfigMapper.java

@@ -0,0 +1,25 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.vo.TransfusionConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 输血映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-31
+ */
+public interface TransfusionConfigMapper extends BaseMapper<TransfusionConfig> {
+    /**
+     * 分页查询
+     *
+     * @param transfusionConfigPageVO
+     * @return
+     */
+    IPage<TransfusionConfig> getPage(@Param("transfusionConfigPageVO") TransfusionConfigPageVO transfusionConfigPageVO);
+}

+ 11 - 1
src/main/java/com/diagbot/service/ConceptInfoService.java

@@ -1,7 +1,11 @@
 package com.diagbot.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.ConceptInfoDTO;
 import com.diagbot.entity.ConceptInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.ConceptInfoPageVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -12,5 +16,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2020-08-18
  */
 public interface ConceptInfoService extends IService<ConceptInfo> {
-
+    /**
+     * 列表
+     *
+     * @param conceptInfoPageVO
+     * @return
+     */
+    IPage<ConceptInfoDTO> getPage(@Param("conceptInfoPageVO") ConceptInfoPageVO conceptInfoPageVO);
 }

+ 25 - 0
src/main/java/com/diagbot/service/TransfusionConfigService.java

@@ -0,0 +1,25 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.vo.TransfusionConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 输血映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-31
+ */
+public interface TransfusionConfigService extends IService<TransfusionConfig> {
+    /**
+     * 分页查询
+     *
+     * @param transfusionConfigPageVO
+     * @return
+     */
+    IPage<TransfusionConfig> getPage(@Param("transfusionConfigPageVO") TransfusionConfigPageVO transfusionConfigPageVO);
+}

+ 13 - 0
src/main/java/com/diagbot/service/UploadService.java

@@ -0,0 +1,13 @@
+package com.diagbot.service;
+
+import com.diagbot.dto.FileDTO;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * @Description: 文件上传服务接口
+ * @author: gaodm
+ * @time: 2018/11/13 13:50
+ */
+public interface UploadService {
+    FileDTO singleFileUpload(MultipartFile file);
+}

+ 15 - 2
src/main/java/com/diagbot/service/impl/ConceptInfoServiceImpl.java

@@ -1,9 +1,13 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.ConceptInfoDTO;
 import com.diagbot.entity.ConceptInfo;
 import com.diagbot.mapper.ConceptInfoMapper;
 import com.diagbot.service.ConceptInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.ConceptInfoPageVO;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
 
 /**
@@ -16,5 +20,14 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class ConceptInfoServiceImpl extends ServiceImpl<ConceptInfoMapper, ConceptInfo> implements ConceptInfoService {
-
+    /**
+     * 列表
+     *
+     * @param conceptInfoPageVO
+     * @return
+     */
+    @Override
+    public IPage<ConceptInfoDTO> getPage(@Param("conceptInfoPageVO") ConceptInfoPageVO conceptInfoPageVO) {
+        return baseMapper.getPage(conceptInfoPageVO);
+    }
 }

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

@@ -3,6 +3,7 @@ package com.diagbot.service.impl;
 import com.diagbot.idc.VisibleIdCreater;
 import com.diagbot.service.MrService;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.PushJoinVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +54,11 @@ public class MrServiceImpl implements MrService {
      */
     @Override
     public String createMr(PushJoinVO pushJoinVO) {
+        if (pushJoinVO.getDiseaseName() != null
+                && StringUtil.isBlank(pushJoinVO.getDiseaseName().getName())
+                && StringUtil.isBlank(pushJoinVO.getDiseaseName().getUniqueName())) {
+            pushJoinVO.setDiseaseName(null);
+        }
         Date now = DateUtil.now();
         final Date expireDate = DateUtil.addMinutes(now, 15);
         pushJoinVO.setCreateTime(now);

+ 33 - 0
src/main/java/com/diagbot/service/impl/TransfusionConfigServiceImpl.java

@@ -0,0 +1,33 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.mapper.TransfusionConfigMapper;
+import com.diagbot.service.TransfusionConfigService;
+import com.diagbot.vo.TransfusionConfigPageVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 输血映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2020-08-31
+ */
+@Service
+public class TransfusionConfigServiceImpl extends ServiceImpl<TransfusionConfigMapper, TransfusionConfig> implements TransfusionConfigService {
+
+    /**
+     * 分页查询
+     *
+     * @param transfusionConfigPageVO
+     * @return
+     */
+    @Override
+    public IPage<TransfusionConfig> getPage(@Param("transfusionConfigPageVO") TransfusionConfigPageVO transfusionConfigPageVO) {
+        return baseMapper.getPage(transfusionConfigPageVO);
+    }
+}

+ 134 - 0
src/main/java/com/diagbot/service/impl/UploadServiceImpl.java

@@ -0,0 +1,134 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.FileDTO;
+import com.diagbot.dto.FileDeleteDTO;
+import com.diagbot.dto.FileUploadDTO;
+import com.diagbot.service.UploadService;
+import com.diagbot.util.GsonUtil;
+import com.diagbot.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.FormBody;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+import okhttp3.ResponseBody;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Description: 文件上传服务接口实现
+ * @author: gaodm
+ * @time: 2018/11/13 13:50
+ */
+@Slf4j
+@Service
+public class UploadServiceImpl implements UploadService {
+    @Value("${imageUrl.prefix}")
+    private String imagerUrl;
+
+    @Override
+    public FileDTO singleFileUpload(MultipartFile file) {
+        if (file.isEmpty()) {
+            return new FileDTO("FAILURE", "文件不能为空");
+        }
+        //文件大小上限500M
+        if (file.getSize() > 1024 * 1024 * 500) {
+            return new FileDTO("FAILURE", "文件上传失败,超出大小限制500MB");
+        }
+
+        String result = "";
+        try {
+            OkHttpClient httpClient = new OkHttpClient.Builder()
+                    .connectTimeout(500, TimeUnit.SECONDS)
+                    .readTimeout(500, TimeUnit.SECONDS)
+                    .build();
+            MultipartBody multipartBody = new MultipartBody.Builder().
+                    setType(MultipartBody.FORM)
+                    .addFormDataPart("file", file.getOriginalFilename(),
+                            RequestBody.create(MediaType.parse("multipart/form-data;charset=utf-8"),
+                                    file.getBytes()))
+                    .addFormDataPart("scene", "M05")
+                    .addFormDataPart("output", "json")
+                    .build();
+
+            Request request = new Request.Builder()
+                    .url(imagerUrl + "/group1/upload")
+                    .post(multipartBody)
+                    .build();
+
+            Response response = httpClient.newCall(request).execute();
+            if (response.isSuccessful()) {
+                ResponseBody body = response.body();
+                if (body != null) {
+                    result = body.string();
+                    //System.out.println(result);
+                }
+            }
+
+            if (StringUtil.isBlank(result)) {
+                return new FileDTO("FAILURE", "文件上传失败,请重新上传");
+            }
+        } catch (Exception e) {
+            log.error("文件上传失败", e);
+            return new FileDTO("FAILURE", "文件上传失败,请重新上传");
+        }
+
+        FileUploadDTO fileUploadDTO = GsonUtil.toObject(result, FileUploadDTO.class);
+        FileDTO fileDTO = new FileDTO("SUCCESS", "文件上传成功");
+        fileDTO.setUrl(fileUploadDTO.getPath());
+        fileDTO.setMd5(fileUploadDTO.getMd5());
+        fileDTO.setOriginal(file.getOriginalFilename());
+        fileDTO.setTitle(file.getOriginalFilename());
+        return fileDTO;
+    }
+
+    /**
+     * 删除服务端文件
+     *
+     * @param md5
+     * @return
+     */
+    public FileDTO deleteRemoteFile(String md5) {
+        String result = "";
+        try {
+            OkHttpClient httpClient = new OkHttpClient();
+            RequestBody formBody = new FormBody.Builder()
+                    .add("md5", md5)
+                    .build();
+
+            Request request = new Request.Builder()
+                    .url(imagerUrl + "/group1/delete")
+                    .post(formBody)
+                    .build();
+
+            Response response = httpClient.newCall(request).execute();
+            if (response.isSuccessful()) {
+                ResponseBody body = response.body();
+                if (body != null) {
+                    result = body.string();
+                    //System.out.println(result);
+                }
+            }
+
+            if (StringUtil.isBlank(result)) {
+                return new FileDTO("FAILURE", "文件删除失败");
+            }
+
+        } catch (Exception e) {
+            log.error("", e);
+            return new FileDTO("FAILURE", "文件删除失败");
+        }
+
+        FileDeleteDTO fileDeleteDTO = GsonUtil.toObject(result, FileDeleteDTO.class);
+        if (fileDeleteDTO.getStatus().equals("fail")) {
+            return new FileDTO("FAILURE", fileDeleteDTO.getMessage());
+        }
+        return new FileDTO("SUCCESS", "文件删除成功");
+    }
+}

+ 36 - 2
src/main/java/com/diagbot/util/ExcelUtils.java

@@ -7,6 +7,8 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.ImportParams;
 import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
+import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import cn.afterturn.easypoi.exception.excel.ExcelImportException;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import org.apache.commons.lang3.StringUtils;
@@ -38,7 +40,7 @@ public class ExcelUtils {
     }
 
     public static void exportExcelDynamicCol(List<ExcelExportEntity> entityList, Collection<?> dataSet, String title, String sheetName, String fileName,
-                                    HttpServletResponse response) {
+                                             HttpServletResponse response) {
         ExportParams exportParams = new ExportParams(title, sheetName);
         dynamicColExport(entityList, dataSet, fileName, response, exportParams);
     }
@@ -72,7 +74,7 @@ public class ExcelUtils {
 
     private static void dynamicColExport(List<ExcelExportEntity> entityList, Collection<?> dataSet, String fileName, HttpServletResponse response,
                                          ExportParams exportParams) {
-        Workbook workbook = ExcelExportUtil.exportExcel(exportParams,entityList,dataSet);
+        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, dataSet);
         if (workbook != null) {
             ;
         }
@@ -148,9 +150,13 @@ public class ExcelUtils {
             list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
         } catch (NoSuchElementException e) {
             // throw new NormalException("模板不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "模板不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
         } catch (Exception e) {
             e.printStackTrace();
             // throw new NormalException(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
         }
         return list;
     }
@@ -168,11 +174,39 @@ public class ExcelUtils {
             list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params);
         } catch (NoSuchElementException e) {
             // throw new NormalException("excel文件不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "excel文件不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
         } catch (Exception e) {
             // throw new NormalException(e.getMessage());
             System.out.println(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
         }
         return list;
     }
 
+
+    public static <T> ExcelImportResult<T> importExcelMore(MultipartFile file, Integer titleRows, Integer headerRows,
+                                                           Class<T> pojoClass) {
+        if (file == null) {
+            return null;
+        }
+        ImportParams params = new ImportParams();
+        params.setTitleRows(titleRows);
+        params.setHeadRows(headerRows);
+        ExcelImportResult<T> result = null;
+        try {
+            result = ExcelImportUtil.importExcelMore(file.getInputStream(), pojoClass, params);
+        } catch (NoSuchElementException e) {
+            // throw new NormalException("excel文件不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "excel文件不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
+        } catch (Exception e) {
+            // throw new NormalException(e.getMessage());
+            System.out.println(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
+        }
+        return result;
+    }
 }

+ 14 - 0
src/main/java/com/diagbot/vo/AnalyzeCdsVO.java

@@ -0,0 +1,14 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-08-31 10:06
+ */
+@Setter
+@Getter
+public class AnalyzeCdsVO extends SearchData{
+}

+ 16 - 0
src/main/java/com/diagbot/vo/ChangeStatusVO.java

@@ -0,0 +1,16 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/24 17:23
+ */
+@Getter
+@Setter
+public class ChangeStatusVO {
+    private Long id;
+    private String isDeleted;
+}

+ 47 - 0
src/main/java/com/diagbot/vo/ConceptDetailVO.java

@@ -0,0 +1,47 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/24 16:06
+ */
+@Getter
+@Setter
+public class ConceptDetailVO {
+    /**
+     * 明细id
+     */
+    private Long id;
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 提示明细标题
+     */
+    private String title;
+
+    /**
+     * 提示明细内容
+     */
+    private String content;
+
+    /**
+     * 纯文本
+     */
+    private String text;
+
+    /**
+     * 提示明细序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 内容类型(多选):1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径,4-治疗方案
+     */
+    private String contentType;
+}

+ 33 - 0
src/main/java/com/diagbot/vo/ConceptInfoPageVO.java

@@ -0,0 +1,33 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/21 14:53
+ */
+@Getter
+@Setter
+public class ConceptInfoPageVO extends Page {
+    /**
+     * 标准术语
+     */
+    private String name;
+    /**
+     * 术语类型
+     */
+    private String type;
+    /**
+     * 术语类型
+     */
+    @ApiModelProperty(hidden = true)
+    private String typeName;
+    /**
+     * 启用状态
+     */
+    private String isDeleted;
+}

+ 45 - 0
src/main/java/com/diagbot/vo/ConceptInfoVO.java

@@ -0,0 +1,45 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/24 16:04
+ */
+@Getter
+@Setter
+public class ConceptInfoVO {
+    private Long id;
+    /**
+     * 标准术语
+     */
+    private String name;
+    /**
+     * 术语类型
+     */
+    private String type;
+    /**
+     * 术语类型
+     */
+    @ApiModelProperty(hidden = true)
+    private String typeName;
+    /**
+     * 临床路径名称
+     */
+    private String clinicalPathwayName;
+
+    /**
+     * 注意事项名称
+     */
+    private String noticeName;
+
+    /**
+     * 静态知识明细
+     */
+    private List<ConceptDetailVO> details;
+}

+ 20 - 0
src/main/java/com/diagbot/vo/ConceptVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/9/10 14:48
+ */
+@Getter
+@Setter
+public class ConceptVO {
+    List<String> names;
+    @NotNull(message = "请输入术语类型")
+    Integer type;
+}

+ 2 - 1
src/main/java/com/diagbot/vo/DiseaseConfigPageVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
@@ -11,7 +12,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class DiseaseConfigPageVO {
+public class DiseaseConfigPageVO extends Page {
     /**
      * 医院id
      */

+ 17 - 0
src/main/java/com/diagbot/vo/Drug.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import com.diagbot.biz.push.entity.Item;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/9/7 20:09
+ */
+@Getter
+@Setter
+public class Drug extends Item {
+    // 剂型
+    private String form;
+}

+ 7 - 1
src/main/java/com/diagbot/vo/DrugConfigPageVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
@@ -11,7 +12,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class DrugConfigPageVO {
+public class DrugConfigPageVO extends Page {
     /**
      * 医院id
      */
@@ -32,4 +33,9 @@ public class DrugConfigPageVO {
      * 标准编码
      */
     private String uniqueCode;
+
+    /**
+     * 剂型
+     */
+    private String form;
 }

+ 32 - 0
src/main/java/com/diagbot/vo/HasStaticKnowledgeVO.java

@@ -0,0 +1,32 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/25 14:02
+ */
+@Getter
+@Setter
+public class HasStaticKnowledgeVO {
+    /**
+     * 标准术语名称
+     */
+    @NotBlank(message = "请输入标准术语名称")
+    private String name;
+    /**
+     * 术语类型
+     */
+    @NotBlank(message = "请输入术语类型")
+    private String type;
+    /**
+     * 是否有静态知识:0-无,1-有
+     */
+    @NotNull(message = "请输入是否有静态信息(0-无,1-有)")
+    private Integer hasInfo;
+}

+ 20 - 0
src/main/java/com/diagbot/vo/HospitalPlanIdVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-08-26 11:34
+ */
+@Setter
+@Getter
+public class HospitalPlanIdVO {
+    @NotNull(message = "请输入id")
+    private Long id;
+    @NotNull(message = "请输入医院id")
+    private Long hospitalId;
+}

+ 1 - 0
src/main/java/com/diagbot/vo/HospitalPlanSaveVO.java

@@ -46,4 +46,5 @@ public class HospitalPlanSaveVO {
      */
     private String remark;
 
+    private List<HospitalPlanDetailSaveVO> planDetailParent;
 }

+ 1 - 1
src/main/java/com/diagbot/vo/IndicationPushVO.java

@@ -14,7 +14,7 @@ import javax.validation.constraints.NotBlank;
 @Setter
 public class IndicationPushVO extends SearchData {
     /**
-     * 规则类型(1:危急值提醒,2:开单合理项,3:高危药品、手术
+     * 规则类型(1:危急值提醒,2:开单合理项,3:高危药品、手术,4:其他提醒
      */
     @NotBlank(message = "ruleType不能为空")
     private String ruleType = "";

+ 17 - 0
src/main/java/com/diagbot/vo/ItemExt.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import com.diagbot.biz.push.entity.Item;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/8/27 19:09
+ */
+@Getter
+@Setter
+public class ItemExt extends Item {
+    // 备注内容
+    private String remark;
+}

+ 20 - 3
src/main/java/com/diagbot/vo/PushJoinVO.java

@@ -8,6 +8,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import javax.validation.constraints.NotNull;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -62,7 +63,7 @@ public class PushJoinVO {
     /**
      * 手术外伤史
      */
-    private String operation;
+    private String surgical;
     /**
      * 过敏史
      */
@@ -130,7 +131,15 @@ public class PushJoinVO {
     /**
      * 药品
      */
-    private List<Item> drug;
+    private List<Drug> drug;
+    /**
+     * 手术级操作
+     */
+    private List<Item> operation;
+    /**
+     * 输血记录
+     */
+    private List<ItemExt> transfusion;
     /**
      * 当前化验开单项
      */
@@ -146,11 +155,15 @@ public class PushJoinVO {
     /**
      * 当前药品开单项
      */
-    private List<Item> drugOrder;
+    private List<Drug> drugOrder;
     /**
      * 当前手术开单项
      */
     private List<Item> operationOrder;
+    /**
+     * 当前输血开单项
+     */
+    private List<ItemExt> transfusionOrder;
     /**
      * 其他开单项
      */
@@ -159,6 +172,10 @@ public class PushJoinVO {
      * 选中诊断
      */
     private Item diseaseName;
+    /**
+     * 选中手术
+     */
+    private Item operationName;
 
     //创建时间
     @ApiModelProperty(hidden = true)

+ 14 - 0
src/main/java/com/diagbot/vo/PushPlanVO.java

@@ -0,0 +1,14 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 检验检查计划入参
+ * @author: gaodm
+ * @time: 2020/8/31 9:38
+ */
+@Getter
+@Setter
+public class PushPlanVO extends SearchData {
+}

+ 6 - 0
src/main/java/com/diagbot/vo/PushVO.java

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -15,4 +16,9 @@ public class PushVO extends SearchData {
      * 推理类型(1:症状,4:查体结果,5:检验,6:检查,7:诊断,8:药品,9:手术)
      */
     private String featureType = "";
+    /**
+     * 是否获取静态知识(0:不获取,1:获取)
+     */
+    @ApiModelProperty(hidden = true)
+    private Integer getStaticKnowledge = 0;
 }

+ 19 - 3
src/main/java/com/diagbot/vo/SearchData.java

@@ -56,7 +56,7 @@ public class SearchData extends HospitalBaseVO {
     /**
      * 手术外伤史
      */
-    private String operation = "";
+    private String surgical = "";
     /**
      * 过敏史
      */
@@ -120,7 +120,15 @@ public class SearchData extends HospitalBaseVO {
     /**
      * 药品
      */
-    private List<Item> drug = new ArrayList<>();
+    private List<Drug> drug = new ArrayList<>();
+    /**
+     * 手术及操作
+     */
+    private List<Item> operation = new ArrayList<>();
+    /**
+     * 输血记录
+     */
+    private List<ItemExt> transfusion = new ArrayList<>();
     /**
      * 当前化验开单项
      */
@@ -136,11 +144,15 @@ public class SearchData extends HospitalBaseVO {
     /**
      * 当前药品开单项
      */
-    private List<Item> drugOrder = new ArrayList<>();
+    private List<Drug> drugOrder = new ArrayList<>();
     /**
      * 当前手术开单项
      */
     private List<Item> operationOrder = new ArrayList<>();
+    /**
+     * 当前输血开单项
+     */
+    private List<ItemExt> transfusionOrder = new ArrayList<>();
     /**
      * 其他开单项
      */
@@ -149,4 +161,8 @@ public class SearchData extends HospitalBaseVO {
      * 选中诊断
      */
     private Item diseaseName;
+    /**
+     * 选中手术
+     */
+    private Item operationName;
 }

+ 1 - 1
src/main/java/com/diagbot/vo/StaticKnowledgeVO.java

@@ -25,7 +25,7 @@ public class StaticKnowledgeVO {
     @NotNull(message = "请输入术语类型")
     private Integer type;
     /**
-     * 内容类型
+     * 内容类型:1-化验、辅检、手术和操作、诊断、药品静态信息,2-注意事项,3-临床路径,4-治疗方案
      */
     private List<Integer> contentTypes;
 }

+ 1 - 1
src/main/java/com/diagbot/vo/TemplateIdVO.java

@@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
 
 /**
  * @author wangfeng
- * @Description: TODO
+ * @Description:
  * @date 2019年7月24日 下午1:20:52
  */
 @Getter

+ 1 - 1
src/main/java/com/diagbot/vo/TemplateInfoPageVO.java

@@ -10,7 +10,7 @@ import java.util.List;
 
 /**
  * @author wangfeng
- * @Description: TODO
+ * @Description:
  * @date 2019年7月24日 上午11:06:33
  */
 @Getter

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

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.TransfusionConfig;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/31 11:26
+ */
+@Getter
+@Setter
+public class TransfusionConfigListVO {
+    private List<TransfusionConfig> transfusionConfigList;
+}

+ 36 - 0
src/main/java/com/diagbot/vo/TransfusionConfigPageVO.java

@@ -0,0 +1,36 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/8/31 11:25
+ */
+@Getter
+@Setter
+public class TransfusionConfigPageVO extends Page {
+    /**
+     * 医院id
+     */
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+
+    /**
+     * his项目名称
+     */
+    private String hisName;
+
+    /**
+     * 标准名
+     */
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    private String uniqueCode;
+}

+ 4 - 0
src/main/java/com/diagbot/web/ConceptDetailController.java

@@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * <p>
@@ -18,6 +19,9 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/conceptDetail")
 @Api(value = "静态知识内容相关API", tags = { "静态知识内容相关API" })
+@SuppressWarnings("unchecked")
+@ApiIgnore
+@Deprecated
 public class ConceptDetailController {
 
 }

+ 81 - 3
src/main/java/com/diagbot/web/ConceptInfoController.java

@@ -1,16 +1,24 @@
 package com.diagbot.web;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.ConceptInfoDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.facade.ConceptInfoFacade;
+import com.diagbot.vo.ChangeStatusVO;
+import com.diagbot.vo.ConceptInfoPageVO;
+import com.diagbot.vo.ConceptInfoVO;
+import com.diagbot.vo.IdVO;
 import com.diagbot.vo.StaticKnowledgeHISVO;
 import com.diagbot.vo.StaticKnowledgeIndexVO;
 import com.diagbot.vo.StaticKnowledgeVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,6 +38,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/graph/conceptInfo")
 @Api(value = "静态知识标准术语相关API", tags = { "静态知识标准术语相关API" })
+@SuppressWarnings("unchecked")
 public class ConceptInfoController {
 
     @Autowired
@@ -39,17 +48,29 @@ public class ConceptInfoController {
             notes = "types: 类型(多选):0-全部、1-诊断、2-药品、3-检验、5-检查、6-手术和操作 <br>" +
                     "inputStr: 检索内容<br>")
     @PostMapping("/staticKnowledgeIndex")
+    @SysLogger("staticKnowledgeIndex")
     public RespDTO<List<StaticKnowledgeIndexDTO>> staticKnowledgeIndex(@Valid @RequestBody StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
-        List<StaticKnowledgeIndexDTO> data = conceptInfoFacade.staticKnowledgeIndex(staticKnowledgeIndexVO);
+        List<StaticKnowledgeIndexDTO> data = conceptInfoFacade.staticKnowledgeIndexWithInfo(staticKnowledgeIndexVO);
         return RespDTO.onSuc(data);
     }
 
+    @ApiOperation(value = "医学术语检索-新增静态知识[zhaops]",
+            notes = "types: 类型(多选):0-全部、1-诊断、2-药品、3-检验、5-检查、6-手术和操作 <br>" +
+                    "inputStr: 检索内容<br>")
+    @PostMapping("/staticKnowledgeIndexWithoutInfo")
+    @SysLogger("staticKnowledgeIndexWithoutInfo")
+    @Transactional
+    public RespDTO<List<StaticKnowledgeIndexDTO>> staticKnowledgeIndexWithoutInfo(@Valid @RequestBody StaticKnowledgeIndexVO staticKnowledgeIndexVO) {
+        List<StaticKnowledgeIndexDTO> data = conceptInfoFacade.staticKnowledgeIndexWithoutInfo(staticKnowledgeIndexVO);
+        return RespDTO.onSuc(data);
+    }
 
     @ApiOperation(value = "页面获取静态知识[zhaops]",
             notes = "type: 类型:1-诊断、2-药品、3-检验套餐、4-检验明细、5-检查、6-手术和操作 <br>" +
-                    "contentTypes: 内容类型(多选):1-静态信息、2-注意事项、3-临床路径 <br>" +
+                    "contentTypes: 内容类型(多选):1-静态信息、2-注意事项、3-临床路径、4-治疗方案<br>" +
                     "name: 标准术语名称<br>")
     @PostMapping("/getStaticKnowledge")
+    @SysLogger("getStaticKnowledge")
     public RespDTO<StaticKnowledgeDTO> getStaticKnowledge(@Valid @RequestBody StaticKnowledgeVO staticKnowledgeVO) {
         StaticKnowledgeDTO data = conceptInfoFacade.getStaticKnowledge(staticKnowledgeVO);
         return RespDTO.onSuc(data);
@@ -57,12 +78,69 @@ public class ConceptInfoController {
 
     @ApiOperation(value = "对接获取静态知识[zhaops]",
             notes = "type: 类型:1-诊断、2-药品、3-检验套餐、4-检验明细、5-检查、6-手术和操作 <br>" +
-                    "contentTypes: 内容类型(多选):1-静态信息、2-注意事项、3-临床路径 <br>" +
+                    "contentTypes: 内容类型(多选):1-静态信息、2-注意事项、3-临床路径、4-治疗方案 <br>" +
                     "hisName: HIS大项名称<br>" +
                     "hisDetailName: HIS小项名称<br>")
     @PostMapping("/getStaticKnowledgeForHIS")
+    @SysLogger("getStaticKnowledgeForHIS")
     public RespDTO<List<StaticKnowledgeDTO>> getStaticKnowledgeForHIS(@Valid @RequestBody StaticKnowledgeHISVO staticKnowledgeHISVO) {
         List<StaticKnowledgeDTO> data = conceptInfoFacade.getStaticKnowledgeForHIS(staticKnowledgeHISVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "获取静态知识列表[zhaops]",
+            notes = "type: 类型:1-诊断、2-药品、3-检验套餐、4-检验明细、5-检查、6-手术和操作 <br>" +
+                    "name: 术语名称<br>" +
+                    "isDeleted: 启用状态:N-启用中、Y-已删除<br>")
+    @PostMapping("/getPage")
+    @SysLogger("getPage")
+    public RespDTO<IPage<ConceptInfoDTO>> getPage(@Valid @RequestBody ConceptInfoPageVO conceptInfoPageVO) {
+        IPage<ConceptInfoDTO> data = conceptInfoFacade.getPage(conceptInfoPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "保存静态知识-新增或修改[zhaops]",
+            notes = "id: id <br>" +
+                    "name: 术语名称 <br>" +
+                    "type: 类型:1-诊断、2-药品、3-检验套餐、4-检验明细、5-检查、6-手术和操作 <br>" +
+                    "clinicalPathwayName: 临床路径名称<br>" +
+                    "noticeName: 注意事项名称<br>" +
+                    "details: 明细<br>")
+    @PostMapping("/saveOrUpdateRecord")
+    @SysLogger("saveOrUpdateRecord")
+    @Transactional
+    public RespDTO<Boolean> saveOrUpdateRecord(@Valid @RequestBody ConceptInfoVO conceptInfoVO) {
+        Boolean data = conceptInfoFacade.saveOrUpdateRecord(conceptInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "静态知识启用禁用[zhaops]",
+            notes = "id: 术语id <br>" +
+                    "isDeleted: 启用状态:N-启用中、Y-已删除<br>")
+    @PostMapping("/changeStatus")
+    @SysLogger("changeStatus")
+    @Transactional
+    public RespDTO<Boolean> changeStatus(@Valid @RequestBody ChangeStatusVO changeStatusVO) {
+        Boolean data = conceptInfoFacade.changeStatus(changeStatusVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "静态知识是否存在[zhaops]",
+            notes = "name: 术语名称 <br>" +
+                    "type: 类型:1-诊断、2-药品、3-检验套餐、4-检验明细、5-检查、6-手术和操作 <br>")
+    @PostMapping("/isExist")
+    @SysLogger("isExist")
+    public RespDTO<Boolean> isExist(@Valid @RequestBody ConceptInfoVO conceptInfoVO) {
+        Boolean data = conceptInfoFacade.isExist(conceptInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "根据术语id获取静态信息[zhaops]",
+            notes = "id: 术语id <br>")
+    @PostMapping("/getRecordById")
+    @SysLogger("getRecordById")
+    public RespDTO<ConceptInfoDTO> getRecordById(@Valid @RequestBody IdVO idVO) {
+        ConceptInfoDTO data = conceptInfoFacade.getRecordById(idVO);
+        return RespDTO.onSuc(data);
+    }
 }

+ 20 - 0
src/main/java/com/diagbot/web/DeptConfigController.java

@@ -13,6 +13,7 @@ import com.diagbot.vo.IdVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,6 +35,7 @@ import javax.validation.Valid;
 @RestController
 @RequestMapping("/tran/deptConfig")
 @Api(value = "科室公表映射API", tags = { "科室公表映射API" })
+@SuppressWarnings("unchecked")
 public class DeptConfigController {
     @Autowired
     private DeptConfigFacade deptConfigFacade;
@@ -61,6 +63,7 @@ public class DeptConfigController {
     @ApiOperation(value = "保存或修改映射关系[by:zhaops]", notes = "")
     @PostMapping("/saveOrUpdateRecord")
     @SysLogger("saveOrUpdateRecord")
+    @Transactional
     public RespDTO<Boolean> saveOrUpdateRecord(@RequestBody @Valid DeptConfig deptConfig) {
         Boolean data = deptConfigFacade.saveOrUpdateRecord(deptConfig);
         return RespDTO.onSuc(data);
@@ -75,6 +78,7 @@ public class DeptConfigController {
     @ApiOperation(value = "批量保存或修改映射关系[by:zhaops]", notes = "")
     @PostMapping("/saveOrUpdateRecords")
     @SysLogger("saveOrUpdateRecords")
+    @Transactional
     public RespDTO<Boolean> saveOrUpdateRecords(@RequestBody @Valid DeptConfigListVO deptConfigListVO) {
         Boolean data = deptConfigFacade.saveOrUpdateRecords(deptConfigListVO);
         return RespDTO.onSuc(data);
@@ -89,6 +93,7 @@ public class DeptConfigController {
     @ApiOperation(value = "删除映射关系[by:zhaops]", notes = "")
     @PostMapping("/deleteRecord")
     @SysLogger("deleteRecord")
+    @Transactional
     public RespDTO<Boolean> deleteRecord(@RequestBody @Valid IdVO idVO) {
         Boolean data = deptConfigFacade.deleteRecord(idVO);
         return RespDTO.onSuc(data);
@@ -103,6 +108,7 @@ public class DeptConfigController {
     @ApiOperation(value = "批量删除映射关系[by:zhaops]", notes = "")
     @PostMapping("/deleteRecords")
     @SysLogger("deleteRecords")
+    @Transactional
     public RespDTO<Boolean> deleteRecords(@RequestBody @Valid IdListVO idListVO) {
         Boolean data = deptConfigFacade.deleteRecords(idListVO);
         return RespDTO.onSuc(data);
@@ -132,6 +138,7 @@ public class DeptConfigController {
             notes = "")
     @PostMapping("/importExcel")
     @SysLogger("importExcel")
+    @Transactional
     public void importExcel(@RequestParam("file") MultipartFile file) {
         deptConfigFacade.importExcel(file);
     }
@@ -148,4 +155,17 @@ public class DeptConfigController {
     public void exportExcel(HttpServletResponse response) {
         deptConfigFacade.exportExcel(response);
     }
+
+    /**
+     * 数据导入模板导出
+     *
+     * @return
+     */
+    @ApiOperation(value = "数据导入模板导出[by:zhaops]",
+            notes = "")
+    @PostMapping("/exportExcelModule")
+    @SysLogger("exportExcelModule")
+    public void exportExcelModule(HttpServletResponse response) {
+        deptConfigFacade.exportExcelModule(response);
+    }
 }

+ 0 - 0
src/main/java/com/diagbot/web/DictionaryInfoController.java


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