Browse Source

Merge branch 'master' into 122run

gaodm 4 years ago
parent
commit
e35d812e76
100 changed files with 2388 additions and 9494 deletions
  1. 6 1
      cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java
  2. 162 0
      cdssman-service/src/main/java/com/diagbot/client/CdssClient.java
  3. 11 5
      cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java
  4. 8 1
      cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java
  5. 112 0
      cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssHystrix.java
  6. 22 0
      cdssman-service/src/main/java/com/diagbot/config/FeignMultipartSupportConfig.java
  7. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/ConceptMappingDTO.java
  8. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/DiseaseInfoDTO.java
  9. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/DrugInfoDTO.java
  10. 2 0
      cdssman-service/src/main/java/com/diagbot/dto/IndexBatchDTO.java
  11. 4 2
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseByIdDTO.java
  12. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseLibNameDTO.java
  13. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/LisDetailDTO.java
  14. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/NurseInfoDTO.java
  15. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/OperationInfoDTO.java
  16. 17 0
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalConceptDTO.java
  17. 49 31
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java
  18. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/ScaleInfoDTO.java
  19. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/TermConceptDTO.java
  20. 47 0
      cdssman-service/src/main/java/com/diagbot/entity/AnesthesiaConfig.java
  21. 22 103
      cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java
  22. 22 93
      cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java
  23. 20 103
      cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java
  24. 153 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDiagnoseBaseRelation.java
  25. 20 103
      cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java
  26. 304 0
      cdssman-service/src/main/java/com/diagbot/entity/MappingConfig.java
  27. 20 93
      cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java
  28. 21 93
      cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java
  29. 19 90
      cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java
  30. 20 92
      cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java
  31. 20 93
      cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java
  32. 20 93
      cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java
  33. 20 93
      cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java
  34. 49 0
      cdssman-service/src/main/java/com/diagbot/entity/wrapper/MappingConfigWrapper.java
  35. 5 1
      cdssman-service/src/main/java/com/diagbot/enums/ConceptTypeEnum.java
  36. 66 0
      cdssman-service/src/main/java/com/diagbot/enums/MatchSourceEnum.java
  37. 0 584
      cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java
  38. 0 601
      cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java
  39. 0 858
      cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java
  40. 6 116
      cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java
  41. 7 3
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java
  42. 16 0
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptStaticFacade.java
  43. 13 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDiagnoseBaseRelationFacade.java
  44. 16 12
      cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java
  45. 0 712
      cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java
  46. 627 0
      cdssman-service/src/main/java/com/diagbot/facade/MappingConfigFacade.java
  47. 25 26
      cdssman-service/src/main/java/com/diagbot/facade/MedRuleConvertFacade.java
  48. 1 1
      cdssman-service/src/main/java/com/diagbot/facade/MedSearchDataFacade.java
  49. 0 605
      cdssman-service/src/main/java/com/diagbot/facade/NurseConfigFacade.java
  50. 0 605
      cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java
  51. 0 603
      cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.java
  52. 6 3
      cdssman-service/src/main/java/com/diagbot/facade/RelationContactFacade.java
  53. 25 20
      cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java
  54. 87 31
      cdssman-service/src/main/java/com/diagbot/facade/RuleTestFacade.java
  55. 29 0
      cdssman-service/src/main/java/com/diagbot/facade/RunningInfoFacade.java
  56. 0 605
      cdssman-service/src/main/java/com/diagbot/facade/ScaleConfigFacade.java
  57. 0 597
      cdssman-service/src/main/java/com/diagbot/facade/TcmdiseaseConfigFacade.java
  58. 0 597
      cdssman-service/src/main/java/com/diagbot/facade/TcmsyndromeConfigFacade.java
  59. 28 0
      cdssman-service/src/main/java/com/diagbot/facade/TermMatchingFacade.java
  60. 0 604
      cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.java
  61. 115 6
      cdssman-service/src/main/java/com/diagbot/facade/UnUsedMappingFacade.java
  62. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/DeptConfigMapper.java
  63. 0 36
      cdssman-service/src/main/java/com/diagbot/mapper/DiseaseConfigMapper.java
  64. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/DrugConfigMapper.java
  65. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlDiagnoseBaseRelationMapper.java
  66. 0 36
      cdssman-service/src/main/java/com/diagbot/mapper/LisConfigMapper.java
  67. 15 0
      cdssman-service/src/main/java/com/diagbot/mapper/MappingConfigMapper.java
  68. 0 36
      cdssman-service/src/main/java/com/diagbot/mapper/NurseConfigMapper.java
  69. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/OperationConfigMapper.java
  70. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/PacsConfigMapper.java
  71. 0 37
      cdssman-service/src/main/java/com/diagbot/mapper/ScaleConfigMapper.java
  72. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/TcmdiseaseConfigMapper.java
  73. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/TcmsyndromeConfigMapper.java
  74. 0 35
      cdssman-service/src/main/java/com/diagbot/mapper/TransfusionConfigMapper.java
  75. 0 35
      cdssman-service/src/main/java/com/diagbot/service/DeptConfigService.java
  76. 0 35
      cdssman-service/src/main/java/com/diagbot/service/DiseaseConfigService.java
  77. 0 35
      cdssman-service/src/main/java/com/diagbot/service/DrugConfigService.java
  78. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlDiagnoseBaseRelationService.java
  79. 0 36
      cdssman-service/src/main/java/com/diagbot/service/LisConfigService.java
  80. 15 0
      cdssman-service/src/main/java/com/diagbot/service/MappingConfigService.java
  81. 0 35
      cdssman-service/src/main/java/com/diagbot/service/NurseConfigService.java
  82. 0 35
      cdssman-service/src/main/java/com/diagbot/service/OperationConfigService.java
  83. 0 35
      cdssman-service/src/main/java/com/diagbot/service/PacsConfigService.java
  84. 0 35
      cdssman-service/src/main/java/com/diagbot/service/ScaleConfigService.java
  85. 0 35
      cdssman-service/src/main/java/com/diagbot/service/TcmdiseaseConfigService.java
  86. 0 35
      cdssman-service/src/main/java/com/diagbot/service/TcmsyndromeConfigService.java
  87. 0 35
      cdssman-service/src/main/java/com/diagbot/service/TransfusionConfigService.java
  88. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/DeptConfigServiceImpl.java
  89. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/DiseaseConfigServiceImpl.java
  90. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/DrugConfigServiceImpl.java
  91. 20 0
      cdssman-service/src/main/java/com/diagbot/service/impl/KlDiagnoseBaseRelationServiceImpl.java
  92. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/LisConfigServiceImpl.java
  93. 19 0
      cdssman-service/src/main/java/com/diagbot/service/impl/MappingConfigServiceImpl.java
  94. 0 45
      cdssman-service/src/main/java/com/diagbot/service/impl/NurseConfigServiceImpl.java
  95. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/OperationConfigServiceImpl.java
  96. 0 43
      cdssman-service/src/main/java/com/diagbot/service/impl/PacsConfigServiceImpl.java
  97. 0 45
      cdssman-service/src/main/java/com/diagbot/service/impl/ScaleConfigServiceImpl.java
  98. 0 46
      cdssman-service/src/main/java/com/diagbot/service/impl/TcmdiseaseConfigServiceImpl.java
  99. 0 45
      cdssman-service/src/main/java/com/diagbot/service/impl/TcmsyndromeConfigServiceImpl.java
  100. 0 0
      cdssman-service/src/main/java/com/diagbot/service/impl/TransfusionConfigServiceImpl.java

+ 6 - 1
cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java

@@ -116,7 +116,12 @@ public class CallIndicationAggregate {
 
             RespDTO<IndicationDTO> respDTO = cdssCoreClient.indication(indicationPushVO);
             Integer callCount = 0;
-            while (callCount <= 3 && RespDTOUtil.respIsNG(respDTO)) {
+            while (callCount <= 3
+                    && (RespDTOUtil.respIsNG(respDTO)
+                    || (ListUtil.isEmpty(respDTO.data.getBillMsgList())
+                    && ListUtil.isEmpty(respDTO.data.getHighRiskList())
+                    && ListUtil.isEmpty(respDTO.data.getCriticalValList())
+                    && ListUtil.isEmpty(respDTO.data.getOtherList())))) {
                 respDTO = cdssCoreClient.indication(indicationPushVO);
                 callCount++;
             }

+ 162 - 0
cdssman-service/src/main/java/com/diagbot/client/CdssClient.java

@@ -0,0 +1,162 @@
+package com.diagbot.client;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.hystrix.CdssHystrix;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.MappingConfigVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/21 15:33
+ */
+@FeignClient(name = "cdss", url = "${cdss.url}", fallback = CdssHystrix.class)
+public interface CdssClient {
+    /**
+     * 数据导入模板导出
+     *
+     * @param mappingConfigVO
+     */
+    @PostMapping("/tran/mappingConfig/exportExcelModule")
+    void exportExcelModule(@RequestBody @Valid MappingConfigVO mappingConfigVO);
+
+    /**
+     * 预匹配导入术语校验
+     *
+     * @param file
+     * @param type
+     */
+    @PostMapping(value = "/tran/mappingConfig/dataVerify", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    RespDTO<Boolean> dataVerify(@RequestPart("file") MultipartFile file,
+                                @RequestParam("type") Integer type);
+
+    /**
+     * 预匹配
+     *
+     * @param file
+     * @param response
+     * @param type
+     */
+    @PostMapping(value = "/tran/mappingConfig/precDataMatch", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    void precDataMatch(@RequestParam("file") MultipartFile file,
+                       HttpServletResponse response,
+                       @RequestParam("type") Integer type);
+
+    /**
+     * 预匹配_远程调用
+     *
+     * @param file
+     * @param type
+     * @return
+     */
+    @PostMapping(value = "/tran/mappingConfig/precDataMatch_remote", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    RespDTO<List<MappingConfigWrapper>> precDataMatch_remote(@RequestPart("file") MultipartFile file,
+                                                             @RequestParam("type") Integer type);
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalId
+     * @param type
+     * @param userId
+     */
+    @PostMapping(value = "/tran/mappingConfig/importExcel", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    RespDTO<Boolean> importExcel(@RequestPart("file") MultipartFile file,
+                                 @RequestParam("hospitalId") Long hospitalId,
+                                 @RequestParam("type") Integer type,
+                                 @RequestParam("uesrId") String userId);
+
+
+    /**
+     * 数据导出_远程调用
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/exportExcel_remote")
+    RespDTO<List<MappingConfigWrapper>> exportExcel_remote(@RequestBody @Valid MappingConfigPageVO mappingConfigPageVO);
+
+    /**
+     * 分页查询
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/getPage")
+    RespDTO<Page<MappingConfigWrapper>> getPage(@RequestBody @Valid MappingConfigPageVO mappingConfigPageVO);
+
+
+    /**
+     * 获取映射关系
+     *
+     * @param idVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/getRecord")
+    @Transactional
+    RespDTO<MappingConfigWrapper> getRecord(@RequestBody @Valid IdVO idVO);
+
+    /**
+     * 映射关系是否已存在
+     *
+     * @param mappingConfig
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/isExistRecord")
+    RespDTO<Boolean> isExistRecord(@RequestBody @Valid MappingConfig mappingConfig);
+
+    /**
+     * 查询已映射关系
+     *
+     * @param mappingConfigVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/getRelatedMapping")
+    RespDTO<List<MappingConfigWrapper>> getRelatedMapping(@RequestBody @Valid MappingConfigVO mappingConfigVO);
+
+
+    /**
+     * 保存或修改映射关系
+     *
+     * @param mappingConfig
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/saveOrUpdateRecord")
+    RespDTO<Boolean> saveOrUpdateRecord(@RequestBody @Valid MappingConfig mappingConfig);
+
+    /**
+     * 删除映射关系
+     *
+     * @param idVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/deleteRecord")
+    RespDTO<Boolean> deleteRecord(@RequestBody @Valid IdVO idVO);
+
+    /**
+     * 批量删除映射关系
+     *
+     * @param idListVO
+     * @return
+     */
+    @PostMapping("/tran/mappingConfig/deleteRecords")
+    RespDTO<Boolean> deleteRecords(@RequestBody @Valid IdListVO idListVO);
+}

+ 11 - 5
cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -16,6 +16,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlRuleMenuWrapper;
 import com.diagbot.vo.*;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -133,14 +134,15 @@ public interface CdssCoreClient {
     RespDTO<Boolean> isExist(@Valid @RequestBody KlConceptStaticVO klConceptStaticVO);
 
     /**
-     *获取规则下拉菜单信息
+     * 获取规则下拉菜单信息
+     *
      * @param klRuleMenuVO
      * @return
      */
     @PostMapping("/klRulePlan/getMenu")
     RespDTO<List<KlRuleMenuWrapper>> getMenus(@RequestBody KlRuleMenuVO klRuleMenuVO);
 
-   //"分页获取规则维护列表
+    //"分页获取规则维护列表
     @PostMapping("/klRule/getKlRuleInfoPage")
     RespDTO<Page<KlRuleInfoDTO>> getKlRuleInfoPages(@RequestBody KlRuleInfoVO klRuleInfoVO);
 
@@ -161,7 +163,7 @@ public interface CdssCoreClient {
     @PostMapping("/klRule/disableRuleInfo")
     RespDTO<Boolean> disableRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
 
-   //启用规则
+    //启用规则
     @PostMapping("/klRule/startRuleInfo")
     RespDTO<Boolean> startRuleInfos(@RequestBody @Valid KlRuleSatartOrdisaVO klRuleSatartOrdisaVO);
 
@@ -182,13 +184,14 @@ public interface CdssCoreClient {
 
     /**
      * 重新加载医学知识库中的所有去重的基础诊断依据
+     *
      * @return
      */
     @PostMapping("/cache/reloadDiagnose")
     RespDTO<Boolean> reloadDiagnose();
 
 
-   //分页获取诊断依据维护列表
+    //分页获取诊断依据维护列表
     @PostMapping("/klDiagnose/getKlDiagnosePage")
     public RespDTO<Page<KlDiagnoseInfoDTO>> getDiagnosePages(@RequestBody KlDiagnoseInfoVO klRuleInfoVO);
 
@@ -198,7 +201,7 @@ public interface CdssCoreClient {
 
     //保存诊断依据详情[by:wangfeng]")
     @PostMapping("/klDiagnose/saveDiagnose")
-    public RespDTO<Boolean> saveDiagnoseAll(@RequestBody @Valid KlDiagnoseSaveVO klDiagnoseSaveVO) ;
+    public RespDTO<Boolean> saveDiagnoseAll(@RequestBody @Valid KlDiagnoseSaveVO klDiagnoseSaveVO);
 
     //刪除诊断依据详情[by:wangfeng]")
     @PostMapping("/klDiagnose/clearDiagnose")
@@ -215,6 +218,9 @@ public interface CdssCoreClient {
     @PostMapping("/klDiagnose/findDiaName")
     public RespDTO<List<DiagnosesFindDTO>> findDiaNameAll(@Valid @RequestBody DiagnosesFindVO diagnosesFindVO);
 
+    @PostMapping("/term/termMatching")
+    public RespDTO<List<TermConceptDTO>> getTermMatching(@Valid @RequestBody TermMatchingVO termMatchingVO);
+
     @PostMapping("/klRegulation/index")
     public RespDTO<List<RegulationIndexDTO>> index(@RequestBody RegulationIndexVO regulationIndexVO);
 

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

@@ -16,6 +16,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlRuleMenuWrapper;
 import com.diagbot.vo.*;
 import lombok.extern.slf4j.Slf4j;
@@ -286,9 +287,15 @@ public class CdssCoreHystrix implements CdssCoreClient {
         return null;
     }
 
+    @Override
+    public RespDTO<List<TermConceptDTO>> getTermMatching(@Valid TermMatchingVO termMatchingVO) {
+        log.error("【hystrix】调用{}异常", "getTermMatching");
+        return null;
+    }
+
     @Override
     public RespDTO<List<RegulationIndexDTO>> index(RegulationIndexVO regulationIndexVO) {
         log.error("【hystrix】调用{}异常", "index");
         return null;
     }
-}
+}

+ 112 - 0
cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssHystrix.java

@@ -0,0 +1,112 @@
+package com.diagbot.client.hystrix;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.CdssClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.MappingConfigVO;
+import feign.FeignException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RequestPart;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/21 15:33
+ */
+@Component
+@Slf4j
+public class CdssHystrix implements CdssClient {
+    @Override
+    public void exportExcelModule(@Valid MappingConfigVO mappingConfigVO) {
+        log.error("【hystrix】调用{}异常", "exportExcelModule");
+    }
+
+    @Override
+    public RespDTO<Boolean> dataVerify(@RequestParam("file") MultipartFile file,
+                                       @RequestParam("type") Integer type) {
+        log.error("【hystrix】调用{}异常", "dataVerify");
+        return null;
+    }
+
+    @Override
+    public void precDataMatch(MultipartFile file, HttpServletResponse response, Integer type) {
+        log.error("【hystrix】调用{}异常", "precDataMatch");
+    }
+
+    @Override
+    public RespDTO<List<MappingConfigWrapper>> precDataMatch_remote(@RequestPart("file") MultipartFile file,
+                                                                    @RequestParam("type") Integer type) throws FeignException {
+        log.error("【hystrix】调用{}异常", "precDataMatch_remote");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> importExcel(@RequestPart("file") MultipartFile file,
+                                        @RequestParam("hospitalId") Long hospitalId,
+                                        @RequestParam("type") Integer type,
+                                        @RequestParam("uesrId") String userId) {
+        log.error("【hystrix】调用{}异常", "importExcel");
+        return null;
+    }
+
+    @Override
+    public RespDTO<List<MappingConfigWrapper>> exportExcel_remote(@RequestBody @Valid MappingConfigPageVO mappingConfigPageVO) {
+        log.error("【hystrix】调用{}异常", "exportExcel_remote");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Page<MappingConfigWrapper>> getPage(@Valid MappingConfigPageVO mappingConfigPageVO) {
+        log.error("【hystrix】调用{}异常", "getPage");
+        return null;
+    }
+
+    @Override
+    public RespDTO<MappingConfigWrapper> getRecord(@Valid IdVO idVO) {
+        log.error("【hystrix】调用{}异常", "getRecord");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> isExistRecord(@Valid MappingConfig mappingConfig) {
+        log.error("【hystrix】调用{}异常", "isExistRecord");
+        return null;
+    }
+
+    @Override
+    public RespDTO<List<MappingConfigWrapper>> getRelatedMapping(@Valid MappingConfigVO mappingConfigVO) {
+        log.error("【hystrix】调用{}异常", "getRelatedMapping");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> saveOrUpdateRecord(@Valid MappingConfig mappingConfig) {
+        log.error("【hystrix】调用{}异常", "saveOrUpdateRecord");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> deleteRecord(@Valid IdVO idVO) {
+        log.error("【hystrix】调用{}异常", "deleteRecord");
+        return null;
+    }
+
+    @Override
+    public RespDTO<Boolean> deleteRecords(@Valid IdListVO idListVO) {
+        log.error("【hystrix】调用{}异常", "deleteRecords");
+        return null;
+    }
+}

+ 22 - 0
cdssman-service/src/main/java/com/diagbot/config/FeignMultipartSupportConfig.java

@@ -0,0 +1,22 @@
+/*
+package com.diagbot.config;
+
+import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+*/
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/22 15:26
+ *//*
+
+@Configuration
+public class FeignMultipartSupportConfig {
+    @Bean
+    public Encoder feignFormEncoder() {
+        return new SpringFormEncoder();
+    }
+}*/

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

@@ -25,4 +25,5 @@ public class ConceptMappingDTO {
     private Integer nurseNum = 0;
     private Integer tcmdiseaseNum = 0;
     private Integer tcmsyndromeNum = 0;
+    private Integer anesthesiaNum = 0;
 }

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

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class DiseaseInfoDTO {
+    private Long id;
     /**
      * 疾病名称
      */

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

@@ -13,6 +13,7 @@ import java.util.List;
 @Getter
 @Setter
 public class DrugInfoDTO {
+    private Long id;
     /**
      * 药品名称
      */

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

@@ -14,4 +14,6 @@ public class IndexBatchDTO {
     private Long id;
     private String name;
     private String code;
+    private String synonyms;
+    private Integer type;
 }

+ 4 - 2
cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseByIdDTO.java

@@ -3,6 +3,7 @@ package com.diagbot.dto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
 /**
  * @author wangfeng
  * @Description:
@@ -40,8 +41,9 @@ public class KlDiagnoseByIdDTO {
      * 描述
      */
     private String basDescription;
-    private Long basConceptId;
-    private String basLibName;
+    /*    private Long basConceptId;
+        private String basLibName;*/
+    private List<KlDiagnoseLibNameDTO> libNameList;
     private Integer basLibType;
     private String basLename;
     /**

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseLibNameDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-07-01 10:20
+ */
+@Setter
+@Getter
+public class KlDiagnoseLibNameDTO {
+    private Long basId;
+    private Long basConceptId;
+    private String basLibName;
+    private Integer basLibType;
+    private String basLename;
+}

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

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class LisDetailDTO {
+    private Long id;
     /**
      * 大项(套餐)
      */

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

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class NurseInfoDTO {
+    private Long id;
     /**
      * 护理名称
      */

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

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class OperationInfoDTO {
+    private Long id;
     /**
      * 手术或操作名称
      */

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

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-15 19:07
+ */
+@Setter
+@Getter
+public class RetrievalConceptDTO {
+    private Long id;
+    private String name;
+    private String code;
+}

+ 49 - 31
cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

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

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

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class ScaleInfoDTO {
+    private Long id;
     /**
      * 量表名称
      */

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/dto/TermConceptDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-15 19:10
+ */
+@Setter
+@Getter
+public class TermConceptDTO {
+    private Long id;
+    private String name;
+    private String code;
+    //数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+    private Integer source;
+}

+ 47 - 0
cdssman-service/src/main/java/com/diagbot/entity/AnesthesiaConfig.java

@@ -0,0 +1,47 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/10 19:16
+ */
+@Getter
+@Setter
+public class AnesthesiaConfig {
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院科室名称
+     */
+    @Excel(name = "医院麻醉名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院麻醉名称")
+    private String hisName;
+
+    /**
+     * 标准科室名称
+     */
+    @Excel(name = "标准麻醉名称", width = 40, orderNum = "2", isImportField = "true")
+    @NotBlank(message = "请输入标准麻醉名称")
+    private String uniqueName;
+
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
+
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
+}

+ 22 - 103
cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-08-12
  */
-@TableName("tran_dept_config")
-public class DeptConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class DeptConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -83,96 +78,19 @@ public class DeptConfig implements Serializable {
     /**
      * 对应项编码
      */
-    //@Excel(name = "对应项编码", width = 40, orderNum = "3")
-    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;
-    }
+    private String code;
 
-    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 getHisCode() {
-        return hisCode;
-    }
-
-    public void setHisCode(String hisCode) {
-        this.hisCode = hisCode;
-    }
-
-    public String getUniqueName() {
-        return uniqueName;
-    }
-
-    public void setUniqueName(String uniqueName) {
-        this.uniqueName = uniqueName;
-    }
-
-    public String getUniqueCode() {
-        return uniqueCode;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -187,7 +105,7 @@ public class DeptConfig implements Serializable {
                 ", hisName=" + hisName +
                 ", hisCode=" + hisCode +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -204,21 +122,22 @@ public class DeptConfig implements Serializable {
                 && Objects.equals(isDeleted, deptConfig.isDeleted)
                 && Objects.equals(hospitalId, deptConfig.hospitalId)
                 && Objects.equals(hisName, deptConfig.hisName)
-                //&& Objects.equals(hisCode, deptConfig.hisCode)
+                && Objects.equals(hisCode, deptConfig.hisCode)
                 && Objects.equals(uniqueName, deptConfig.uniqueName)
-                && Objects.equals(uniqueCode, deptConfig.uniqueCode);
+                && Objects.equals(code, deptConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, hisCode, uniqueName, code);
     }
 
     public static boolean nonNull(DeptConfig o) {
         return !(o == null
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.hisCode)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 22 - 93
cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-07-28
  */
-@TableName("tran_disease_config")
-public class DiseaseConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class DiseaseConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -78,87 +73,19 @@ public class DiseaseConfig implements Serializable {
      * ICD-10编码
      */
     @Excel(name = "ICD-10编码", width = 40, orderNum = "2", isImportField = "true")
-    private String icdCode;
-
-    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;
-    }
+    private String code;
 
-    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 getIcdCode() {
-        return icdCode;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setIcdCode(String icdCode) {
-        this.icdCode = icdCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -172,7 +99,9 @@ public class DiseaseConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", icdCode=" + icdCode +
+                ", code=" + code +
+                ", isMatch=" + isMatch +
+                ", source=" + source +
                 "}";
     }
 
@@ -190,12 +119,12 @@ public class DiseaseConfig implements Serializable {
                 && Objects.equals(hospitalId, diseaseConfig.hospitalId)
                 && Objects.equals(hisName, diseaseConfig.hisName)
                 && Objects.equals(uniqueName, diseaseConfig.uniqueName)
-                && Objects.equals(icdCode, diseaseConfig.icdCode);
+                && Objects.equals(code, diseaseConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, icdCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(DiseaseConfig o) {
@@ -203,6 +132,6 @@ public class DiseaseConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.icdCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 20 - 103
cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java

@@ -2,14 +2,12 @@ package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -21,15 +19,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-07-28
  */
-@TableName("tran_drug_config")
-public class DrugConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class DrugConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -67,7 +62,6 @@ public class DrugConfig implements Serializable {
      */
     @Excel(name = "医院药品名称", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院药品名称")
-    //@Size(max = 80, min = 1,message = "医院药品名称长度需要在1-80字符长度之间")
     private String hisName;
 
     /**
@@ -75,14 +69,12 @@ public class DrugConfig implements Serializable {
      */
     @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, orderNum = "3")
-    private String uniqueCode;
+    private String code;
 
     /**
      * 剂型
@@ -91,93 +83,18 @@ public class DrugConfig implements Serializable {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String form;
 
-    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;
-    }
-
-    public String getForm() {
-        return form;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setForm(String form) {
-        this.form = form;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -191,7 +108,7 @@ public class DrugConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 ", form=" + form +
                 "}";
     }
@@ -211,12 +128,12 @@ public class DrugConfig implements Serializable {
                 && Objects.equals(hisName, drugConfig.hisName)
                 && Objects.equals(form, drugConfig.form)
                 && Objects.equals(uniqueName, drugConfig.uniqueName)
-                && Objects.equals(uniqueCode, drugConfig.uniqueCode);
+                && Objects.equals(code, drugConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, form, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, form, uniqueName, code);
     }
 
     public static boolean nonNull(DrugConfig o) {
@@ -224,7 +141,7 @@ public class DrugConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)
+                && StringUtil.isBlank(o.code)
                 && StringUtil.isBlank(o.form)));
     }
 }

+ 153 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlDiagnoseBaseRelation.java

@@ -0,0 +1,153 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 基础规则关联表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-07-15
+ */
+public class KlDiagnoseBaseRelation 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;
+
+    /**
+     * diagnose_base_id
+     */
+    private Long diagnoseBaseId;
+
+    /**
+     * concept_id
+     */
+    private Long conceptId;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    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 getDiagnoseBaseId() {
+        return diagnoseBaseId;
+    }
+
+    public void setDiagnoseBaseId(Long diagnoseBaseId) {
+        this.diagnoseBaseId = diagnoseBaseId;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public Integer getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(Integer orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnoseBaseRelation{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", diagnoseBaseId=" + diagnoseBaseId +
+                ", conceptId=" + conceptId +
+                ", orderNo=" + orderNo +
+                "}";
+    }
+}

+ 20 - 103
cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java

@@ -2,15 +2,12 @@ package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -22,16 +19,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-07-28
  */
-@Data
-@TableName("tran_lis_config")
-public class LisConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class LisConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -89,95 +82,19 @@ public class LisConfig implements Serializable {
      * 对应项目编码
      */
     //@Excel(name = "对应项目编码", width = 40, orderNum = "3")
-    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;
-    }
+    private String code;
 
-    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 getHisDetailName() {
-        return hisDetailName;
-    }
-
-    public void setHisDetailName(String hisDetailName) {
-        this.hisDetailName = hisDetailName;
-    }
-
-    public String getUniqueName() {
-        return uniqueName;
-    }
-
-    public void setUniqueName(String uniqueName) {
-        this.uniqueName = uniqueName;
-    }
-
-    public String getUniqueCode() {
-        return uniqueCode;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -192,7 +109,7 @@ public class LisConfig implements Serializable {
                 ", hisName=" + hisName +
                 ", hisDetailName=" + hisDetailName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -211,12 +128,12 @@ public class LisConfig implements Serializable {
                 && Objects.equals(hisName, lisConfig.hisName)
                 && Objects.equals(hisDetailName, lisConfig.hisDetailName)
                 && Objects.equals(uniqueName, lisConfig.uniqueName)
-                && Objects.equals(uniqueCode, lisConfig.uniqueCode);
+                && Objects.equals(code, lisConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, hisDetailName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, hisDetailName, uniqueName, code);
     }
 
     public static boolean nonNull(LisConfig o) {
@@ -225,6 +142,6 @@ public class LisConfig implements Serializable {
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.hisDetailName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 304 - 0
cdssman-service/src/main/java/com/diagbot/entity/MappingConfig.java

@@ -0,0 +1,304 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.diagbot.util.StringUtil;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 医学术语映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+@EqualsAndHashCode
+@TableName("tran_mapping_config")
+public class MappingConfig 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;
+
+    /**
+     * 医学术语类型( 1-检验套餐、2-检验细项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医疾病、13-中医证候、14-麻醉)
+     */
+    private Integer type;
+
+    /**
+     * 医院术语名称
+     */
+    private String hisName;
+
+    /**
+     * 医院术语编码
+     */
+    private String hisCode;
+
+    /**
+     * 医院术语细项名称(检验细项)
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private String hisDetailName;
+
+    /**
+     * 医学标准术语id
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Long conceptId;
+
+    /**
+     * 药品剂型id
+     */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    private Long formConceptId;
+
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    private Integer isMatch;
+
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    private Integer source;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public Long getHospitalId() {
+        return hospitalId;
+    }
+
+    public void setHospitalId(Long hospitalId) {
+        this.hospitalId = hospitalId;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getHisName() {
+        return hisName;
+    }
+
+    public void setHisName(String hisName) {
+        this.hisName = hisName;
+    }
+
+    public String getHisCode() {
+        return hisCode;
+    }
+
+    public void setHisCode(String hisCode) {
+        this.hisCode = hisCode;
+    }
+
+    public String getHisDetailName() {
+        return hisDetailName;
+    }
+
+    public void setHisDetailName(String hisDetailName) {
+        this.hisDetailName = hisDetailName;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public Long getFormConceptId() {
+        return formConceptId;
+    }
+
+    public void setFormConceptId(Long formConceptId) {
+        this.formConceptId = formConceptId;
+    }
+
+    public Integer getIsMatch() {
+        return isMatch;
+    }
+
+    public void setIsMatch(Integer isMatch) {
+        this.isMatch = isMatch;
+    }
+
+    public Integer getSource() {
+        return source;
+    }
+
+    public void setSource(Integer source) {
+        this.source = source;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "MappingConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", type=" + type +
+                ", hisName=" + hisName +
+                ", hisCode=" + hisCode +
+                ", hisDetailName=" + hisDetailName +
+                ", conceptId=" + conceptId +
+                ", formConceptId=" + formConceptId +
+                ", isMatch=" + isMatch +
+                ", source=" + source +
+                ", remark=" + remark +
+                "}";
+    }
+
+    /*@Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        MappingConfig mappingConfig = (MappingConfig) o;
+        return Objects.equals(id, mappingConfig.id)
+                && Objects.equals(isDeleted, mappingConfig.isDeleted)
+                && Objects.equals(hospitalId, mappingConfig.hospitalId)
+                && Objects.equals(type, mappingConfig.type)
+                && Objects.equals(hisName, mappingConfig.hisName)
+                && Objects.equals(hisCode, mappingConfig.hisCode)
+                && Objects.equals(hisDetailName, mappingConfig.hisDetailName)
+                && Objects.equals(conceptId, mappingConfig.conceptId)
+                && Objects.equals(formConceptId, mappingConfig.formConceptId)
+                && Objects.equals(isMatch, mappingConfig.isMatch)
+                //&& Objects.equals(source, mappingConfig.source)
+                ;
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, type, hisName, hisCode, hisDetailName, conceptId, formConceptId, isMatch);
+    }*/
+
+    public static boolean nonNull(MappingConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && o.type == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.hisCode)
+                && StringUtil.isBlank(o.hisDetailName)
+                && o.conceptId == null
+                && o.formConceptId == null
+                && o.isMatch == null
+                && o.source == null));
+    }
+}

+ 20 - 93
cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2021-04-26
  */
-@TableName("tran_nurse_config")
-public class NurseConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class NurseConfig{
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
@@ -77,87 +72,19 @@ public class NurseConfig implements Serializable {
     /**
      * 标准编码
      */
-    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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -171,7 +98,7 @@ public class NurseConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -189,12 +116,12 @@ public class NurseConfig implements Serializable {
                 && Objects.equals(hospitalId, nurseConfig.hospitalId)
                 && Objects.equals(hisName, nurseConfig.hisName)
                 && Objects.equals(uniqueName, nurseConfig.uniqueName)
-                && Objects.equals(uniqueCode, nurseConfig.uniqueCode);
+                && Objects.equals(code, nurseConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(NurseConfig o) {
@@ -202,6 +129,6 @@ public class NurseConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 21 - 93
cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-07-28
  */
-@TableName("tran_operation_config")
-public class OperationConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class OperationConfig{
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -77,88 +72,21 @@ public class OperationConfig implements Serializable {
     /**
      * 对应项编码
      */
-    //@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;
-    }
+    @Excel(name = "手术和操作代码", width = 40, orderNum = "2", isImportField = "true")
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public String getUniqueCode() {
-        return uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
 
     @Override
     public String toString() {
@@ -172,7 +100,7 @@ public class OperationConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -190,12 +118,12 @@ public class OperationConfig implements Serializable {
                 && Objects.equals(hospitalId, operationConfig.hospitalId)
                 && Objects.equals(hisName, operationConfig.hisName)
                 && Objects.equals(uniqueName, operationConfig.uniqueName)
-                && Objects.equals(uniqueCode, operationConfig.uniqueCode);
+                && Objects.equals(code, operationConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(OperationConfig o) {
@@ -203,6 +131,6 @@ public class OperationConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 19 - 90
cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java

@@ -1,10 +1,9 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
@@ -19,15 +18,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-07-28
  */
-@TableName("tran_pacs_config")
+@Getter
+@Setter
 public class PacsConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -78,87 +74,20 @@ public class PacsConfig implements Serializable {
      * 对应项编码
      */
     //@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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public String getUniqueCode() {
-        return uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
 
     @Override
     public String toString() {
@@ -172,7 +101,7 @@ public class PacsConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -190,12 +119,12 @@ public class PacsConfig implements Serializable {
                 && Objects.equals(hospitalId, pacsConfig.hospitalId)
                 && Objects.equals(hisName, pacsConfig.hisName)
                 && Objects.equals(uniqueName, pacsConfig.uniqueName)
-                && Objects.equals(uniqueCode, pacsConfig.uniqueCode);
+                && Objects.equals(code, pacsConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(PacsConfig o) {
@@ -203,6 +132,6 @@ public class PacsConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 20 - 92
cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2021-04-13
  */
-@TableName("tran_scale_config")
-public class ScaleConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class ScaleConfig{
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
@@ -77,87 +72,20 @@ public class ScaleConfig implements Serializable {
     /**
      * 标准编码
      */
-    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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public String getUniqueCode() {
-        return uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
 
     @Override
     public String toString() {
@@ -171,7 +99,7 @@ public class ScaleConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -189,12 +117,12 @@ public class ScaleConfig implements Serializable {
                 && Objects.equals(hospitalId, scaleConfig.hospitalId)
                 && Objects.equals(hisName, scaleConfig.hisName)
                 && Objects.equals(uniqueName, scaleConfig.uniqueName)
-                && Objects.equals(uniqueCode, scaleConfig.uniqueCode);
+                && Objects.equals(code, scaleConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(ScaleConfig o) {
@@ -202,6 +130,6 @@ public class ScaleConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 20 - 93
cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2021-05-13
  */
-@TableName("tran_tcmdisease_config")
-public class TcmdiseaseConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class TcmdiseaseConfig{
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
@@ -78,87 +73,19 @@ public class TcmdiseaseConfig implements Serializable {
      * 标准编码
      */
     @Excel(name = "中医疾病代码", width = 40, orderNum = "2", isImportField = "true")
-    private String uniqueCode;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -172,7 +99,7 @@ public class TcmdiseaseConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -190,12 +117,12 @@ public class TcmdiseaseConfig implements Serializable {
                 && Objects.equals(hospitalId, tcmdiseaseConfig.hospitalId)
                 && Objects.equals(hisName, tcmdiseaseConfig.hisName)
                 && Objects.equals(uniqueName, tcmdiseaseConfig.uniqueName)
-                && Objects.equals(uniqueCode, tcmdiseaseConfig.uniqueCode);
+                && Objects.equals(code, tcmdiseaseConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(TcmdiseaseConfig o) {
@@ -203,6 +130,6 @@ public class TcmdiseaseConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 20 - 93
cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2021-05-13
  */
-@TableName("tran_tcmsyndrome_config")
-public class TcmsyndromeConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class TcmsyndromeConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.AUTO)
     private Long id;
 
     /**
@@ -78,87 +73,19 @@ public class TcmsyndromeConfig implements Serializable {
      * 标准编码
      */
     @Excel(name = "中医证候代码", width = 40, orderNum = "2", isImportField = "true")
-    private String uniqueCode;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-
-    public String getCreator() {
-        return creator;
-    }
-
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -172,7 +99,7 @@ public class TcmsyndromeConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -190,12 +117,12 @@ public class TcmsyndromeConfig implements Serializable {
                 && Objects.equals(hospitalId, tcmsyndromeConfig.hospitalId)
                 && Objects.equals(hisName, tcmsyndromeConfig.hisName)
                 && Objects.equals(uniqueName, tcmsyndromeConfig.uniqueName)
-                && Objects.equals(uniqueCode, tcmsyndromeConfig.uniqueCode);
+                && Objects.equals(code, tcmsyndromeConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(TcmsyndromeConfig o) {
@@ -203,6 +130,6 @@ public class TcmsyndromeConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 20 - 93
cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java

@@ -1,13 +1,11 @@
 package com.diagbot.entity;
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
 
 import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
 
@@ -19,15 +17,12 @@ import java.util.Objects;
  * @author zhaops
  * @since 2020-08-31
  */
-@TableName("tran_transfusion_config")
-public class TransfusionConfig implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
+@Getter
+@Setter
+public class TransfusionConfig {
     /**
      * 主键
      */
-    @TableId(value = "id", type = IdType.INPUT)
     private Long id;
 
     /**
@@ -78,87 +73,19 @@ public class TransfusionConfig implements Serializable {
      * 对应项编码
      */
     //@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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配【未匹配、已匹配】", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1" }, isImportField = "true")
+    private Integer isMatch;
 
-    public void setUniqueCode(String uniqueCode) {
-        this.uniqueCode = uniqueCode;
-    }
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源【不填、标准词、同义词、编码、历史数据、相似词】", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" }, isImportField = "true")
+    private Integer source;
 
     @Override
     public String toString() {
@@ -172,7 +99,7 @@ public class TransfusionConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -190,12 +117,12 @@ public class TransfusionConfig implements Serializable {
                 && Objects.equals(hospitalId, transfusionConfig.hospitalId)
                 && Objects.equals(hisName, transfusionConfig.hisName)
                 && Objects.equals(uniqueName, transfusionConfig.uniqueName)
-                && Objects.equals(uniqueCode, transfusionConfig.uniqueCode);
+                && Objects.equals(code, transfusionConfig.code);
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, uniqueCode);
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
     }
 
     public static boolean nonNull(TransfusionConfig o) {
@@ -203,6 +130,6 @@ public class TransfusionConfig implements Serializable {
                 || (o.hospitalId == null
                 && StringUtil.isBlank(o.hisName)
                 && StringUtil.isBlank(o.uniqueName)
-                && StringUtil.isBlank(o.uniqueCode)));
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 49 - 0
cdssman-service/src/main/java/com/diagbot/entity/wrapper/MappingConfigWrapper.java

@@ -0,0 +1,49 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.util.StringUtil;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/10 19:27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class MappingConfigWrapper extends MappingConfig {
+    private String uniqueName;
+    private String form;
+    private String code;
+
+   /* @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        MappingConfigWrapper mappingConfigWrapper = (MappingConfigWrapper) o;
+        return super.equals(o)
+                && Objects.equals(uniqueName, mappingConfigWrapper.uniqueName)
+                && Objects.equals(form, mappingConfigWrapper.form)
+                && Objects.equals(code, mappingConfigWrapper.code);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(uniqueName, form, code) + super.hashCode();
+    }*/
+
+    public static boolean nonNull(MappingConfigWrapper o) {
+        return !(o == null
+                || (StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.form)
+                && StringUtil.isBlank(o.code)))
+                || MappingConfig.nonNull(o);
+    }
+}

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

@@ -17,10 +17,14 @@ public enum ConceptTypeEnum implements KeyedNamed {
     Operation(6, "手术和操作"),
     Dept(7, "科室"),
     Transfusion(8, "输血"),
+    Symptom(9,"症状"),
+    //PacsSubName(9, "检查子项"),
     Scale(10, "量表"),
     Nurse(11, "护理"),
     Tcmdisease(12,"中医疾病"),
-    Tcmsyndrome(13,"中医证候");
+    Tcmsyndrome(13,"中医证候"),
+    Anesthesia(14, "麻醉"),
+    Form(15, "药品剂型");
 
     @Setter
     private int key;

+ 66 - 0
cdssman-service/src/main/java/com/diagbot/enums/MatchSourceEnum.java

@@ -0,0 +1,66 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/15 13:20
+ */
+public enum MatchSourceEnum implements KeyedNamed {
+    StandWord(1, "标准词"),
+    SynonymsWord(2, "同义词"),
+    Code(3,"编码"),
+    History(4,"历史数据"),
+    SimilarWord(5,"相似词");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    MatchSourceEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static MatchSourceEnum getEnum(int key) {
+        for (MatchSourceEnum item : MatchSourceEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static MatchSourceEnum getEnum(String name) {
+        for (MatchSourceEnum item : MatchSourceEnum.values()) {
+            if (item.name.equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        MatchSourceEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    public static Integer getKey(String name) {
+        MatchSourceEnum item = getEnum(name);
+        return item != null ? item.key : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 0 - 584
cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java

@@ -1,584 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.DeptConfigListVO;
-import com.diagbot.vo.DeptConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/8/12 14:25
- */
-@Component
-public class DeptConfigFacade {
-    @Autowired
-    private DeptConfigService deptConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param deptConfig
-     * @return
-     */
-    public Boolean isExistRecord(DeptConfig deptConfig) {
-        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", deptConfig.getHospitalId())
-                .eq("his_name", deptConfig.getHisName())
-                .eq("unique_name", deptConfig.getUniqueName());
-       /* if (StringUtil.isNotBlank(deptConfig.getHisCode())) {
-            queryWrapper.eq("his_code", deptConfig.getHisCode());
-        } else {
-            queryWrapper.and(i -> i.isNull("his_code")
-                    .or()
-                    .eq("his_code", ""));
-        }*/
-        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, "该条关联已存在,无法保存");
-        }
-        return false;
-    }
-
-    /**
-     * 保存记录-单条
-     *
-     * @param deptConfig
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(DeptConfig deptConfig) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        deptConfig.setModifier(userId);
-        deptConfig.setGmtModified(now);
-        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", deptConfig.getHospitalId())
-                .eq("his_name", deptConfig.getHisName())
-                .eq("unique_name", deptConfig.getUniqueName());
-        /*if (StringUtil.isNotBlank(deptConfig.getHisCode())) {
-            queryWrapper.eq("his_code", deptConfig.getHisCode());
-        } else {
-            queryWrapper.and(i -> i.isNull("his_code")
-                    .or()
-                    .eq("his_code", ""));
-        }*/
-        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);
-            deptConfig.setGmtCreate(now);
-        }
-        if (deptConfig.getIsDeleted() == null) {
-            deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-        }
-        deptConfigService.saveOrUpdate(deptConfig);
-        return true;
-    }
-
-    /**
-     * 保存记录-批量
-     *
-     * @param deptConfigListVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(DeptConfigListVO deptConfigListVO) {
-        if (ListUtil.isEmpty(deptConfigListVO.getDeptConfigList())) {
-            return false;
-        }
-        return saveOrUpdateRecords(deptConfigListVO.getDeptConfigList());
-    }
-
-    /**
-     * 批量保存
-     *
-     * @param deptConfigList
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(List<DeptConfig> deptConfigList) {
-        if (ListUtil.isEmpty(deptConfigList)) {
-            return false;
-        }
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤外部名称或公表名为空的数据
-        deptConfigList = deptConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(deptConfigList)) {
-            return false;
-        }
-
-        Long hospitalId = deptConfigList.get(0).getHospitalId();
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(hospitalId, null, null);
-        deptConfigList.forEach(deptConfig -> {
-            deptConfig.setModifier(userId);
-            deptConfig.setGmtModified(now);
-            if (deptConfig.getId() == null) {
-                if (configMap.containsKey(deptConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
-                }
-                deptConfig.setCreator(userId);
-                deptConfig.setGmtCreate(now);
-            }
-            if (deptConfig.getIsDeleted() == null) {
-                deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        deptConfigService.saveOrUpdateBatch(deptConfigList);
-        return true;
-    }
-
-    /**
-     * 删除记录-单条
-     *
-     * @param idVO
-     * @return
-     */
-    public Boolean deleteRecord(IdVO idVO) {
-        UpdateWrapper<DeptConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", idVO.getId())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        deptConfigService.removeById(idVO.getId());
-        return true;
-    }
-
-    /**
-     * 删除记录-批量
-     *
-     * @param idListVO
-     * @return
-     */
-    public Boolean deleteRecords(IdListVO idListVO) {
-        if (ListUtil.isEmpty(idListVO.getIds())) {
-            return false;
-        }
-        UpdateWrapper<DeptConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("id", idListVO.getIds())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        deptConfigService.removeByIds(idListVO.getIds());
-        return true;
-    }
-
-    /**
-     * 分页查询
-     *
-     * @param deptConfigPageVO
-     * @return
-     */
-    public IPage<DeptConfig> getPage(DeptConfigPageVO deptConfigPageVO) {
-        return deptConfigService.getPage(deptConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        List<DeptConfig> deptConfigList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
-        if (ListUtil.isNotEmpty(deptConfigList)) {
-            importExcelRecords(deptConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param deptConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<DeptConfig> deptConfigList, HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        deptConfigList = deptConfigList.stream()
-                .filter(DeptConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(deptConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        deptConfigList.forEach(deptConfig -> {
-            deptConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < deptConfigList.size(); i++) {
-            if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
-                    || 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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, List<Long>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), null, null);
-            deptConfigList.forEach(deptConfig -> {
-                deptConfig.setHospitalId(hospitalId);
-                deptConfig.setModifier(userId);
-                deptConfig.setGmtModified(now);
-                if (deptConfig.getId() == null) {
-                    if (configMap.containsKey(deptConfig.getHisName())
-                            && ListUtil.isNotEmpty(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()))) {
-                        deleteIds.addAll(configMap.get(deptConfig.getHisName()).get(deptConfig.getUniqueName()));
-                    }
-                    deptConfig.setCreator(userId);
-                    deptConfig.setGmtCreate(now);
-                }
-                if (deptConfig.getIsDeleted() == null) {
-                    deptConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-                }
-            });
-
-            //标准术语校验
-            List<String> errorNumList = Lists.newLinkedList();
-            List<String> uniqueNames = deptConfigList.stream()
-                    .map(i -> i.getUniqueName())
-                    .distinct()
-                    .collect(Collectors.toList());
-            ConceptVO conceptVO = new ConceptVO();
-            conceptVO.setNames(uniqueNames);
-            conceptVO.setType(ConceptTypeEnum.Dept.getKey());
-            RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-            List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < deptConfigList.size(); i++) {
-                if (!names.contains(deptConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            }
-            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;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<DeptConfig> 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<DeptConfig> records = deptConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<DeptConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<DeptConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<DeptConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<DeptConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<DeptConfig> records = deptConfigService.list(queryWrapper);
-        String fileName = "科室映射.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return deptConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "科室映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据预匹配
-     *
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
-        List<DeptConfig> originList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
-        List<DeptConfig> retList = dataProcess(originList);
-        String fileName = "科室关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<DeptConfig> originList = ExcelUtils.importExcel(file, 0, 1, DeptConfig.class);
-        List<DeptConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<DeptConfig> dataProcess(List<DeptConfig> originList) {
-        List<DeptConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, List<DeptConfig>> allMap = getAll(hisNameList);
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(DeptConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-        });
-
-        //获取标准术语
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, List<DeptConfig>> entry : allMap.entrySet()) {
-                if (ListUtil.isNotEmpty(entry.getValue())) {
-                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.Dept.getKey());
-        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(originList)) {
-            for (DeptConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<DeptConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (DeptConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            item.setHisCode(originItem.getHisCode());
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     *
-     * @return
-     */
-    public Map<String, List<DeptConfig>> getAll(List<String> hisNameList) {
-        Map<String, List<DeptConfig>> retMap = new HashMap<>();
-        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<DeptConfig> records = deptConfigService.list(queryWrapper);
-
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        retMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        return retMap;
-    }
-
-    /**
-     * 查找指定医院映射关系
-     *
-     * @param hospitalId
-     * @return
-     */
-    public List<DeptConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<DeptConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return deptConfigService.list(queryWrapper);
-    }
-}

+ 0 - 601
cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java

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

+ 0 - 858
cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -1,858 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.DrugConfigListVO;
-import com.diagbot.vo.DrugConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:04
- */
-@Component
-public class DrugConfigFacade {
-    @Autowired
-    private DrugConfigService drugConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-    @Autowired
-    private DictionaryFacade dictionaryFacade;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param drugConfig
-     * @return
-     */
-    public Boolean isExistRecord(DrugConfig drugConfig) {
-        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", drugConfig.getHospitalId())
-                .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, "该条关联已存在,无法保存");
-        }
-        return false;
-    }
-
-    /**
-     * 保存记录-单条
-     *
-     * @param drugConfig
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(DrugConfig drugConfig) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        drugConfig.setModifier(userId);
-        drugConfig.setGmtModified(now);
-        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", drugConfig.getHospitalId())
-                .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);
-            drugConfig.setGmtCreate(now);
-        }
-        if (drugConfig.getIsDeleted() == null) {
-            drugConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-        }
-        drugConfigService.saveOrUpdate(drugConfig);
-        return true;
-    }
-
-    /**
-     * 保存记录-批量
-     *
-     * @param drugConfigListVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(DrugConfigListVO drugConfigListVO) {
-        if (ListUtil.isEmpty(drugConfigListVO.getDrugConfigList())) {
-            return false;
-        }
-        return saveOrUpdateRecords(drugConfigListVO.getDrugConfigList());
-    }
-
-    /**
-     * 批量保存
-     *
-     * @param drugConfigList
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(List<DrugConfig> drugConfigList) {
-        if (ListUtil.isEmpty(drugConfigList)) {
-            return false;
-        }
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤外部名称或公表名为空的数据
-        drugConfigList = drugConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-
-        if (ListUtil.isEmpty(drugConfigList)) {
-            return false;
-        }
-
-        Long hospitalId = drugConfigList.get(0).getHospitalId();
-
-        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, List<Long>>>> configMap
-                = getConfigMap(hospitalId, hisNames, uniqueNames);
-        drugConfigList.forEach(drugConfig -> {
-            drugConfig.setHospitalId(Long.valueOf(hospitalId));
-            drugConfig.setModifier(userId);
-            drugConfig.setGmtModified(now);
-            String form = StringUtil.isBlank(drugConfig.getForm()) ? "" : drugConfig.getForm();
-            if (drugConfig.getId() == null) {
-                if (configMap.get(drugConfig.getHisName()) != null
-                        && configMap.get(drugConfig.getHisName()).get(form) != null
-                        && ListUtil.isNotEmpty(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
-                }
-                drugConfig.setCreator(userId);
-                drugConfig.setGmtCreate(now);
-            }
-            if (drugConfig.getIsDeleted() == null) {
-                drugConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        drugConfigService.saveOrUpdateBatch(drugConfigList);
-        return true;
-    }
-
-    /**
-     * 删除记录-单条
-     *
-     * @param idVO
-     * @return
-     */
-    public Boolean deleteRecord(IdVO idVO) {
-        UpdateWrapper<DrugConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", idVO.getId())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        drugConfigService.removeById(idVO.getId());
-        return true;
-    }
-
-    /**
-     * 删除记录-批量
-     *
-     * @param idListVO
-     * @return
-     */
-    public Boolean deleteRecords(IdListVO idListVO) {
-        if (ListUtil.isEmpty(idListVO.getIds())) {
-            return false;
-        }
-        UpdateWrapper<DrugConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("id", idListVO.getIds())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        drugConfigService.removeByIds(idListVO.getIds());
-        return true;
-    }
-
-    /**
-     * 分页查询
-     *
-     * @param drugConfigPageVO
-     * @return
-     */
-    public IPage<DrugConfig> getPage(DrugConfigPageVO drugConfigPageVO) {
-        return drugConfigService.getPage(drugConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
-        if (ListUtil.isNotEmpty(drugConfigList)) {
-            importExcelRecords(drugConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param drugConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<DrugConfig> drugConfigList,HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        drugConfigList = drugConfigList.stream()
-                .filter(DrugConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(drugConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        drugConfigList.forEach(drugConfig -> {
-            drugConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        //药品剂型
-        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
-        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 + 3));
-            }
-            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 + 3));
-                } 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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, Map<String, List<Long>>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
-            drugConfigList.forEach(drugConfig -> {
-                drugConfig.setHospitalId(Long.valueOf(hospitalId));
-                drugConfig.setModifier(userId);
-                drugConfig.setGmtModified(now);
-                String form = StringUtil.isBlank(drugConfig.getForm()) ? "" : drugConfig.getForm();
-                if (drugConfig.getId() == null) {
-                    if (configMap.get(drugConfig.getHisName()) != null
-                            && configMap.get(drugConfig.getHisName()).get(form) != null
-                            && ListUtil.isNotEmpty(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()))) {
-                        deleteIds.addAll(configMap.get(drugConfig.getHisName()).get(form).get(drugConfig.getUniqueName()));
-                    }
-                    drugConfig.setCreator(userId);
-                    drugConfig.setGmtCreate(now);
-                }
-                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<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-            List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < drugConfigList.size(); i++) {
-                if (!names.contains(drugConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            }
-            if (ListUtil.isNotEmpty(errorNumList)) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                        "以下行数(不计空行)标准术语在数据库中不存在:"
-                                + errorNumList.stream().collect(Collectors.joining("、"))
-                                + "。导入取消,请修改后再试。");
-            }
-
-            //重复数据过滤
-            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, List<Long>>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, List<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, List<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())) {
-                        Map<String, List<DrugConfig>> thirdMap = EntityUtil.makeEntityListMap(subEntry.getValue(), "uniqueName");
-                        Map<String, List<Long>> idMap = new HashMap<>();
-                        for (Map.Entry<String, List<DrugConfig>> thirdEntry : thirdMap.entrySet()) {
-                            idMap.put(thirdEntry.getKey(), thirdEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                        }
-                        formMap.put(subEntry.getKey(), idMap);
-                    }
-                }
-                retMap.put(entry.getKey(), formMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return Map<uniqueName,Map<form,Map<hisName,List<id>>>>
-     */
-    public Map<String, Map<String,Map<String, List<Long>>>> getUniqueFormConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, List<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(record -> {
-            if (StringUtil.isBlank(record.getForm())) {
-                record.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, List<Long>>> subMap = new HashMap<>();
-                Map<String, List<DrugConfig>> hisNameMap
-                        = EntityUtil.makeEntityListMap(entry.getValue(), "form");
-                for (Map.Entry<String, List<DrugConfig>> hisEntry : hisNameMap.entrySet()) {
-                    if (ListUtil.isNotEmpty(hisEntry.getValue())) {
-                        Map<String, List<DrugConfig>> thirdMap = EntityUtil.makeEntityListMap(hisEntry.getValue(), "hisName");
-                        Map<String, List<Long>> idMap = new HashMap<>();
-                        for (Map.Entry<String, List<DrugConfig>> thirdEntry : thirdMap.entrySet()) {
-                            idMap.put(thirdEntry.getKey(), thirdEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                        }
-                        subMap.put(hisEntry.getKey(), idMap);
-                    }
-                }
-                retMap.put(entry.getKey(), subMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return Map<uniqueName,Map<hisName,Map<form,List<id>>>>
-     */
-    public Map<String, Map<String,Map<String, List<Long>>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, List<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(record -> {
-            if (StringUtil.isBlank(record.getForm())) {
-                record.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, List<Long>>> subMap = new HashMap<>();
-                Map<String, List<DrugConfig>> hisNameMap
-                        = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
-                for (Map.Entry<String, List<DrugConfig>> hisEntry : hisNameMap.entrySet()) {
-                    if (ListUtil.isNotEmpty(hisEntry.getValue())) {
-                        Map<String, List<DrugConfig>> thirdMap = EntityUtil.makeEntityListMap(hisEntry.getValue(), "form");
-                        Map<String, List<Long>> idMap = new HashMap<>();
-                        for (Map.Entry<String, List<DrugConfig>> thirdEntry : thirdMap.entrySet()) {
-                            idMap.put(thirdEntry.getKey(), thirdEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                        }
-                        subMap.put(hisEntry.getKey(), idMap);
-                    }
-                }
-                retMap.put(entry.getKey(), subMap);
-            }
-        }
-        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())
-                .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())) {
-                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>> 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())
-                .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())) {
-                retMap.put(entry.getKey(),
-                        EntityUtil.makeMapWithKeyValue(entry.getValue(), "hisName", "id"));
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<DrugConfig> records = drugConfigService.list(queryWrapper);
-        String fileName = "药品映射.xls";
-        ExcelUtils.exportExcel(records, getFrom(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return drugConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "药品映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), getFrom(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 剂型说明
-     *
-     * @return
-     */
-    private String getFrom() {
-        String from = "药品模板——药品剂型填写说明[不填";
-        //药品剂型
-        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());
-        if (ListUtil.isNotEmpty(formList)) {
-            for (String s : formList) {
-                if (StringUtil.isNotBlank(s)) {
-                    from += "、" + s;
-                }
-            }
-        }
-        from += "]";
-        return from;
-    }
-
-    /**
-     * 导入数据预匹配
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file,HttpServletResponse response) {
-        List<DrugConfig> originList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
-        List<DrugConfig> retList = dataProcess(originList);
-
-        String fileName = "药品关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, getFrom(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<DrugConfig> originList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
-        List<DrugConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<DrugConfig> dataProcess(List<DrugConfig> originList) {
-        List<DrugConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, List<DrugConfig>> allMap = getAll(hisNameList);
-
-        //药品剂型
-        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());
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(DrugConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-        });
-
-        //获取标准术语
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, List<DrugConfig>> entry : allMap.entrySet()) {
-                if (ListUtil.isNotEmpty(entry.getValue())) {
-                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.Drug.getKey());
-        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(originList)) {
-            for (DrugConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<DrugConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (DrugConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            if (!formList.contains(item.getForm())) {
-                                item.setForm("");
-                            }
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        if (!formList.contains(originItem.getForm())) {
-                            originItem.setForm("");
-                        }
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     * @return
-     */
-    public Map<String,List<DrugConfig>> getAll(List<String> hisNameList) {
-        Map<String, List<DrugConfig>> retMap = new HashMap<>();
-        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<DrugConfig> records = drugConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-            record.setForm(StringUtils.isBlank(record.getForm()) ? null : record.getForm());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        retMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        return retMap;
-    }
-
-    /**
-     * 查找指定医院映射关系
-     *
-     * @param hospitalId
-     * @return
-     */
-    public List<DrugConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return drugConfigService.list(queryWrapper);
-    }
-}

+ 6 - 116
cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java

@@ -4,34 +4,14 @@ 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.dto.HospitalInfoDTO;
-import com.diagbot.entity.DeptConfig;
 import com.diagbot.entity.DiseaseConfig;
-import com.diagbot.entity.DrugConfig;
 import com.diagbot.entity.HospitalInfo;
-import com.diagbot.entity.LisConfig;
-import com.diagbot.entity.NurseConfig;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.entity.PacsConfig;
+import com.diagbot.entity.MappingConfig;
 import com.diagbot.entity.Plan;
-import com.diagbot.entity.ScaleConfig;
-import com.diagbot.entity.TcmdiseaseConfig;
-import com.diagbot.entity.TcmsyndromeConfig;
-import com.diagbot.entity.TransfusionConfig;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.service.DeptConfigService;
-import com.diagbot.service.DiseaseConfigService;
-import com.diagbot.service.DrugConfigService;
 import com.diagbot.service.HospitalInfoService;
-import com.diagbot.service.LisConfigService;
-import com.diagbot.service.NurseConfigService;
-import com.diagbot.service.OperationConfigService;
-import com.diagbot.service.PacsConfigService;
-import com.diagbot.service.ScaleConfigService;
-import com.diagbot.service.TcmdiseaseConfigService;
-import com.diagbot.service.TcmsyndromeConfigService;
-import com.diagbot.service.TransfusionConfigService;
 import com.diagbot.service.impl.HospitalInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.Cn2SpellUtil;
@@ -66,27 +46,7 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
     @Qualifier("hospitalInfoServiceImpl")
     private HospitalInfoService hospitalInfoService;
     @Autowired
-    private DeptConfigService deptConfigService;
-    @Autowired
-    private DiseaseConfigService diseaseConfigService;
-    @Autowired
-    private DrugConfigService drugConfigService;
-    @Autowired
-    private LisConfigService lisConfigService;
-    @Autowired
-    private OperationConfigService operationConfigService;
-    @Autowired
-    private PacsConfigService pacsConfigService;
-    @Autowired
-    private TransfusionConfigService transfusionConfigService;
-    @Autowired
-    private ScaleConfigService scaleConfigService;
-    @Autowired
-    private NurseConfigService nurseConfigService;
-    @Autowired
-    private TcmdiseaseConfigService tcmdiseaseConfigService;
-    @Autowired
-    private TcmsyndromeConfigService tcmsyndromeConfigService;
+    private MappingConfigFacade mappingConfigFacade;
     @Autowired
     private PlanFacade planFacade;
 
@@ -198,84 +158,14 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "数据已删除");
         }
 
-        //校验关联数据
-        List<DeptConfig> deptConfigList
-                = deptConfigService.list(new QueryWrapper<DeptConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(deptConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<DiseaseConfig> diseaseConfigList
-                = diseaseConfigService.list(new QueryWrapper<DiseaseConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(diseaseConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<DrugConfig> drugConfigList
-                = drugConfigService.list(new QueryWrapper<DrugConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(drugConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<LisConfig> lisConfigList
-                = lisConfigService.list(new QueryWrapper<LisConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(lisConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<OperationConfig> operationConfigList
-                = operationConfigService.list(new QueryWrapper<OperationConfig>()
+        List<MappingConfig> mappingConfigList
+                = mappingConfigFacade.list(new QueryWrapper<MappingConfig>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(operationConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<PacsConfig> pacsConfigList
-                = pacsConfigService.list(new QueryWrapper<PacsConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(pacsConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<TransfusionConfig> transfusionConfigList
-                = transfusionConfigService.list(new QueryWrapper<TransfusionConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(transfusionConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<ScaleConfig> scaleConfigList
-                = scaleConfigService.list(new QueryWrapper<ScaleConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(scaleConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<NurseConfig> nurseConfigList
-                = nurseConfigService.list(new QueryWrapper<NurseConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(nurseConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<TcmdiseaseConfig> tcmdiseaseConfigList
-                = tcmdiseaseConfigService.list(new QueryWrapper<TcmdiseaseConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(tcmdiseaseConfigList)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
-        }
-        List<TcmsyndromeConfig> tcmsyndromeConfigList
-                = tcmsyndromeConfigService.list(new QueryWrapper<TcmsyndromeConfig>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", idVO.getId()));
-        if (ListUtil.isNotEmpty(tcmsyndromeConfigList)) {
+        if (ListUtil.isNotEmpty(mappingConfigList)) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医院存在关联数据,无法删除");
         }
+
         List<Plan> planList
                 = planFacade.list(new QueryWrapper<Plan>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())

+ 7 - 3
cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -16,6 +16,7 @@ import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.entity.KlConceptStatic;
 import com.diagbot.entity.KlDiagnose;
 import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.entity.KlDiagnoseBaseRelation;
 import com.diagbot.entity.KlDrugMapping;
 import com.diagbot.entity.KlLexicon;
 import com.diagbot.entity.KlLibraryInfo;
@@ -92,6 +93,8 @@ public class KlConceptFacade extends KlConceptServiceImpl {
     @Autowired
     KlDiagnoseBaseFacade klDiagnoseBaseFacade;
     @Autowired
+    KlDiagnoseBaseRelationFacade klDiagnoseBaseRelationFacade;
+    @Autowired
     KlDrugFacade klDrugFacade;
     @Autowired
     KlSymptomFacade klSymptomFacade;
@@ -579,10 +582,11 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             if (diagnosesum > 0) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护存在关系!");
             }
-            //kl_diagnose_base
-            int diagnoseBasesum = klDiagnoseBaseFacade.count(new QueryWrapper<KlDiagnoseBase>().eq("is_deleted", IsDeleteEnum.N.getKey())
+            //kl_diagnose_base_relation
+            int diagnoseBaseRelationsum = klDiagnoseBaseRelationFacade.count(new QueryWrapper<KlDiagnoseBaseRelation>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("concept_id", klConceptSatarOrdisaVO.getConceptId()));
-            if (diagnoseBasesum > 0) {
+            if (diagnoseBaseRelationsum > 0) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
             }
             //kl_drug_mapping

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

@@ -14,6 +14,8 @@ import com.diagbot.entity.KlConceptDetail;
 import com.diagbot.entity.KlConceptStatic;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.StatusEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.KlConceptStaticServiceImpl;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
@@ -61,6 +63,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<List<StaticKnowledgeIndexDTO>> respDTO = cdssCoreClient.staticKnowledgeIndex(staticKnowledgeIndexVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             retList = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
 
         if (staticKnowledgeIndexVO.getHasInfo() != null && staticKnowledgeIndexVO.getHasInfo().equals(1)) {
@@ -82,6 +86,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<StaticKnowledgeDTO> respDTO = cdssCoreClient.getStaticKnowledge(staticKnowledgeVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             staticKnowledgeDTO = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         return staticKnowledgeDTO;
     }
@@ -97,6 +103,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<Page<KlConceptStaticDTO>> respDTO = cdssCoreClient.getPage(klConceptStaticPageVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             page = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         List<KlConceptStaticDTO> records = page.getRecords();
         List<String> userIds = records.stream().map(KlConceptStaticDTO::getModifier)
@@ -132,6 +140,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<Boolean> respDTO = cdssCoreClient.saveOrUpdateRecord(klConceptStaticVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             success = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         return success;
     }
@@ -150,6 +160,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<Boolean> respDTO = cdssCoreClient.changeStatus(changeStatusVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             success = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         return success;
     }
@@ -165,6 +177,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<KlConceptStaticDTO> respDTO = cdssCoreClient.getRecordById(idVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             klConceptStaticDTO = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         return klConceptStaticDTO;
     }
@@ -180,6 +194,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         RespDTO<Boolean> respDTO = cdssCoreClient.isExist(klConceptStaticVO);
         if (RespDTOUtil.respIsOK(respDTO)) {
             exist = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
         }
         return exist;
     }

+ 13 - 0
cdssman-service/src/main/java/com/diagbot/facade/KlDiagnoseBaseRelationFacade.java

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.KlDiagnoseBaseRelationServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/7/15 13:50
+ */
+@Component
+public class KlDiagnoseBaseRelationFacade extends KlDiagnoseBaseRelationServiceImpl {
+}

+ 16 - 12
cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java

@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.RelationDTO;
 import com.diagbot.dto.TreeAllDTO;
 import com.diagbot.dto.TreeDTO;
-import com.diagbot.entity.CommonParam;
-import com.diagbot.entity.KlRelation;
-import com.diagbot.entity.KlRelationOrder;
-import com.diagbot.entity.KlVitalResult;
+import com.diagbot.entity.*;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.RelationLibTypeEnum;
 import com.diagbot.service.KlRelationOrderService;
 import com.diagbot.service.KlRelationService;
@@ -16,11 +14,7 @@ import com.diagbot.service.impl.KlRelationServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.vo.KlDiseaseVO;
-import com.diagbot.vo.KlSymptomVO;
-import com.diagbot.vo.KlVitalResultVO;
-import com.diagbot.vo.RelationVO;
-import com.diagbot.vo.TreeVO;
+import com.diagbot.vo.*;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -80,7 +74,7 @@ public class KlRelationFacade extends KlRelationServiceImpl {
         List<RelationDTO> root = this.getRelations(relationVO);
         TreeAllDTO treeAllDTO = new TreeAllDTO();
         treeAllDTO.setTypes(types);
-
+        TreeDTO treeDTO = new TreeDTO();
         if (ListUtil.isNotEmpty(root)) {
             RelationVO relationVO2 = new RelationVO();
             relationVO2.setSType(pList.get(index)[2]);
@@ -89,7 +83,7 @@ public class KlRelationFacade extends KlRelationServiceImpl {
             List<RelationDTO> sub = this.getRelations(relationVO2);
             Map<Long, List<RelationDTO>> map = EntityUtil.makeEntityListMap(sub, "sId");
 
-            TreeDTO treeDTO = new TreeDTO();
+
             treeDTO.setId(root.get(0).getSId());
             treeDTO.setName(root.get(0).getSName());
             for (RelationDTO relationDTO : root) {
@@ -107,8 +101,18 @@ public class KlRelationFacade extends KlRelationServiceImpl {
                 }
                 treeDTO.getNextTree().add(treeDTO2);
             }
-            treeAllDTO.setTreeDTO(treeDTO);
+
+        }else {
+            List<KlConcept> klConcepts = klConceptFacade.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("lib_type", types.get(0)));
+            if(ListUtil.isNotEmpty(klConcepts)){
+                treeDTO.setId(klConcepts.get(0).getId());
+                treeDTO.setName(klConcepts.get(0).getLibName());
+            }
+
         }
+        treeAllDTO.setTreeDTO(treeDTO);
         return treeAllDTO;
     }
 

+ 0 - 712
cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java

@@ -1,712 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.diagbot.vo.LisConfigListVO;
-import com.diagbot.vo.LisConfigPageVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:03
- */
-@Component
-public class LisConfigFacade{
-    @Autowired
-    private LisConfigService lisConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param lisConfig
-     * @return
-     */
-    public Boolean isExistRecord(LisConfig lisConfig) {
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", lisConfig.getHospitalId())
-                .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;
-    }
-
-    /**
-     * 保存记录-单条
-     *
-     * @param lisConfig
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(LisConfig lisConfig) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        lisConfig.setModifier(userId);
-        lisConfig.setGmtModified(now);
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", lisConfig.getHospitalId())
-                .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);
-            lisConfig.setGmtCreate(now);
-        }
-        if (lisConfig.getIsDeleted() == null) {
-            lisConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-        }
-        lisConfigService.saveOrUpdate(lisConfig);
-        return true;
-    }
-
-    /**
-     * 保存记录-批量
-     *
-     * @param lisConfigListVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(LisConfigListVO lisConfigListVO) {
-        if (ListUtil.isEmpty(lisConfigListVO.getLisConfigList())) {
-            return false;
-        }
-        return saveOrUpdateRecords(lisConfigListVO.getLisConfigList());
-    }
-
-    /**
-     * 批量保存
-     *
-     * @param lisConfigList
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(List<LisConfig> lisConfigList) {
-        if (ListUtil.isEmpty(lisConfigList)) {
-            return false;
-        }
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤套餐或公表名为空的数据,hospitalId不允许为空
-        lisConfigList = lisConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(lisConfigList)) {
-            return false;
-        }
-        Long hosptialId = lisConfigList.get(0).getHospitalId();
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, Map<String, List<Long>>>> configMap
-                = getConfigMap(hosptialId, null, null);
-        lisConfigList.forEach(lisConfig -> {
-            lisConfig.setModifier(userId);
-            lisConfig.setGmtModified(now);
-            if (lisConfig.getId() == null) {
-                if (configMap.containsKey(lisConfig.getHisName())) {
-                    if (lisConfig.getHisDetailName() == null
-                            && configMap.get(lisConfig.getHisName()).containsKey("")) {
-                        if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()))) {
-                            deleteIds.addAll(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()));
-                        }
-                    } else if (configMap.get(lisConfig.getHisName()).containsKey(lisConfig.getHisDetailName())) {
-                        if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get(lisConfig.getHisDetailName()).get(lisConfig.getUniqueName()))) {
-                            deleteIds.addAll(configMap
-                                    .get(lisConfig.getHisName())
-                                    .get(lisConfig.getHisDetailName())
-                                    .get(lisConfig.getUniqueName()));
-                        }
-                    }
-                }
-                lisConfig.setCreator(userId);
-                lisConfig.setGmtCreate(now);
-            }
-            if (lisConfig.getIsDeleted() == null) {
-                lisConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        lisConfigService.saveOrUpdateBatch(lisConfigList);
-        return true;
-    }
-
-    /**
-     * 删除记录-单条
-     *
-     * @param idVO
-     * @return
-     */
-    public Boolean deleteRecord(IdVO idVO) {
-        UpdateWrapper<LisConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", idVO.getId())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        lisConfigService.removeById(idVO.getId());
-        return true;
-    }
-
-    /**
-     * 删除记录-批量
-     *
-     * @param idListVO
-     * @return
-     */
-    public Boolean deleteRecords(IdListVO idListVO) {
-        if (ListUtil.isEmpty(idListVO.getIds())) {
-            return false;
-        }
-        UpdateWrapper<LisConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("id", idListVO.getIds())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        lisConfigService.removeByIds(idListVO.getIds());
-        return true;
-    }
-
-    /**
-     * 分页查询
-     *
-     * @param lisConfigPageVO
-     * @return
-     */
-    public IPage<LisConfig> getPage(LisConfigPageVO lisConfigPageVO) {
-        return lisConfigService.getPage(lisConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        //从Excel读取数据
-        List<LisConfig> lisConfigList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
-        if (ListUtil.isNotEmpty(lisConfigList)) {
-            importExcelRecords(lisConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param lisConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<LisConfig> lisConfigList,HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        lisConfigList = lisConfigList.stream()
-                .filter(LisConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(lisConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        lisConfigList.forEach(lisConfig -> {
-            lisConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < lisConfigList.size(); i++) {
-            if (StringUtil.isBlank(lisConfigList.get(i).getHisName())
-                    || 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).getHisDetailName())) {
-                lisConfigList.get(i).setHisDetailName(lisConfigList.get(i).getHisDetailName().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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, Map<String, List<Long>>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), hisNames, uniqueNames);
-            lisConfigList.forEach(lisConfig -> {
-                lisConfig.setHospitalId(Long.valueOf(hospitalId));
-                lisConfig.setModifier(userId);
-                lisConfig.setGmtModified(now);
-                if (lisConfig.getId() == null) {
-                    if (configMap.containsKey(lisConfig.getHisName())) {
-                        if (lisConfig.getHisDetailName() == null
-                                && configMap.get(lisConfig.getHisName()).containsKey("")) {
-                            if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()))) {
-                                deleteIds.addAll(configMap.get(lisConfig.getHisName()).get("").get(lisConfig.getUniqueName()));
-                            }
-                        } else if (configMap.get(lisConfig.getHisName()).containsKey(lisConfig.getHisDetailName())) {
-                            if (ListUtil.isNotEmpty(configMap.get(lisConfig.getHisName()).get(lisConfig.getHisDetailName()).get(lisConfig.getUniqueName()))) {
-                                deleteIds.addAll(configMap
-                                        .get(lisConfig.getHisName())
-                                        .get(lisConfig.getHisDetailName())
-                                        .get(lisConfig.getUniqueName()));
-                            }
-                        }
-                    }
-                    lisConfig.setCreator(userId);
-                    lisConfig.setGmtCreate(now);
-                }
-                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<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-            List<String> lisPackNames = respLisPackDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-            RespDTO<List<IndexBatchDTO>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-            List<String> lisNames = respLisDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < lisConfigList.size(); i++) {
-                if (StringUtil.isBlank(lisConfigList.get(i).getHisDetailName())) {
-                    //检验套餐对应套餐
-                    if (!lisPackNames.contains(lisConfigList.get(i).getUniqueName())) {
-                        errorNumList.add(String.valueOf(i + 2));
-                    }
-                } else {
-                    //检验细项对应细项
-                    if (!lisNames.contains(lisConfigList.get(i).getUniqueName())) {
-                        errorNumList.add(String.valueOf(i + 2));
-                    }
-                }
-            }
-            if (ListUtil.isNotEmpty(errorNumList)) {
-                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                        "以下行数(不计空行)标准术语在数据库中不存在:"
-                                + errorNumList.stream().collect(Collectors.joining("、"))
-                                + "。导入取消,请修改后再试。");
-            }
-
-            //重复数据过滤
-            lisConfigList = lisConfigList
-                    .stream()
-                    .distinct()
-                    .collect(Collectors.toList());
-
-            //删除已存在映射关系
-            IdListVO idListVO = new IdListVO();
-            idListVO.setIds(deleteIds);
-            deleteRecords(idListVO);
-            lisConfigService.saveOrUpdateBatch(lisConfigList);
-        }
-        return true;
-    }
-
-    /**
-     * 获取映射关系-id
-     * Map<hisName,Map<hisDetailName,Map<uniqueName,List<id>>>>
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, Map<String, List<Long>>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, List<Long>>>> retMap = new HashMap<>();
-        QueryWrapper<LisConfig> 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<LisConfig> records = lisConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        records.forEach(lisConfig -> {
-            if (lisConfig.getHisDetailName() == null) {
-                lisConfig.setHisDetailName("");
-            }
-        });
-
-        Map<String, List<LisConfig>> hisNameMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<LisConfig>> entry : hisNameMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, Map<String, List<Long>>> detailNameMap = new HashMap<>();
-                //his名称映射到标准词,1:n
-                Map<String, List<LisConfig>> hisDetailNameMap
-                        = EntityUtil.makeEntityListMap(entry.getValue(), "hisDetailName");
-                for (Map.Entry<String, List<LisConfig>> detailEntry : hisDetailNameMap.entrySet()) {
-                    if (ListUtil.isNotEmpty(detailEntry.getValue())) {
-                        Map<String, List<LisConfig>> thirdMap = EntityUtil.makeEntityListMap(detailEntry.getValue(), "uniqueName");
-                        Map<String, List<Long>> idMap = new HashMap<>();
-                        for (Map.Entry<String, List<LisConfig>> thirdEntry : thirdMap.entrySet()) {
-                            idMap.put(thirdEntry.getKey(), thirdEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                        }
-                        detailNameMap.put(detailEntry.getKey(), idMap);
-                    }
-                }
-                retMap.put(entry.getKey(), detailNameMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-id
-     * Map<uniqueName,Map<hisName,Map<hisDetailName,List<id>>>>
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, Map<String, List<Long>>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, List<Long>>>> retMap = new HashMap<>();
-        QueryWrapper<LisConfig> 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<LisConfig> records = lisConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        records.forEach(lisConfig -> {
-            if (lisConfig.getHisDetailName() == null) {
-                lisConfig.setHisDetailName("");
-            }
-        });
-
-        Map<String, List<LisConfig>> uniqueNameMap = EntityUtil.makeEntityListMap(records, "uniqueName");
-        for (Map.Entry<String, List<LisConfig>> entry : uniqueNameMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, Map<String, List<Long>>> subMap = new HashMap<>();
-                Map<String, List<LisConfig>> hisName
-                        = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
-                for (Map.Entry<String, List<LisConfig>> hisEntry : hisName.entrySet()) {
-                    if (ListUtil.isNotEmpty(hisEntry.getValue())) {
-                        Map<String, List<LisConfig>> thirdMap = EntityUtil.makeEntityListMap(hisEntry.getValue(), "hisDetailName");
-                        Map<String, List<Long>> idMap = new HashMap<>();
-                        for (Map.Entry<String, List<LisConfig>> thirdEntry : thirdMap.entrySet()) {
-                            idMap.put(thirdEntry.getKey(), thirdEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                        }
-                        subMap.put(hisEntry.getKey(), idMap);
-                    }
-                }
-                retMap.put(entry.getKey(), subMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<LisConfig> records = lisConfigService.list(queryWrapper);
-        String fileName = "检验映射.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return lisConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "检验映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", LisConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据预匹配
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file,HttpServletResponse response) {
-        List<LisConfig> originList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
-        List<LisConfig> retList = dataProcess(originList);
-
-        String fileName = "检验关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<LisConfig> originList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
-        List<LisConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<LisConfig> dataProcess(List<LisConfig> originList) {
-        List<LisConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, Map<String, List<LisConfig>>> allMap = getAll(hisNameList);
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(LisConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-            if(StringUtil.isNotBlank(item.getHisDetailName())) {
-                item.setHisDetailName(item.getHisDetailName().trim());
-            }
-        });
-
-        //标准术语校验
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, Map<String, List<LisConfig>>> entry : allMap.entrySet()) {
-                for (Map.Entry<String, List<LisConfig>> subEntry : entry.getValue().entrySet()) {
-                    if (ListUtil.isNotEmpty(subEntry.getValue())) {
-                        precUniqueName.addAll(subEntry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                    }
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
-        RespDTO<List<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-        List<String> lisPackNames = respLisPackDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<IndexBatchDTO>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-        List<String> lisNames = respLisDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-
-        if (ListUtil.isNotEmpty(originList)) {
-            for (LisConfig originItem : originList) {
-                if (StringUtils.isBlank(originItem.getHisDetailName())) {
-                    originItem.setHisDetailName("");
-                }
-                if (allMap.containsKey(originItem.getHisName())
-                        && allMap.get(originItem.getHisName()).containsKey(originItem.getHisDetailName())) {
-                    List<LisConfig> items = allMap.get(originItem.getHisName()).get(originItem.getHisDetailName());
-                    boolean flag = false;
-                    for (LisConfig item : items) {
-                        if (lisPackNames.contains(item.getUniqueName())
-                                || lisNames.contains(item.getUniqueName())) {
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     * @return
-     */
-    public Map<String,Map<String,List<LisConfig>>>  getAll(List<String> hisNameList) {
-        Map<String, Map<String, List<LisConfig>>> retMap = new HashMap<>();
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<LisConfig> records = lisConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setHisDetailName(StringUtils.isBlank(record.getHisDetailName()) ? "" : record.getHisDetailName());
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<LisConfig>> hisNameMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        for (Map.Entry<String, List<LisConfig>> entry : hisNameMap.entrySet()) {
-            retMap.put(entry.getKey(),
-                    EntityUtil.makeEntityListMap(entry.getValue(), "hisDetailName"));
-        }
-        return retMap;
-    }
-
-
-    /**
-     * 查找指定医院映射关系
-     * @param hospitalId
-     * @return
-     */
-    public List<LisConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return lisConfigService.list(queryWrapper);
-    }
-}

+ 627 - 0
cdssman-service/src/main/java/com/diagbot/facade/MappingConfigFacade.java

@@ -0,0 +1,627 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.CdssClient;
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.AnesthesiaConfig;
+import com.diagbot.entity.DeptConfig;
+import com.diagbot.entity.DiseaseConfig;
+import com.diagbot.entity.DrugConfig;
+import com.diagbot.entity.LisConfig;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.NurseConfig;
+import com.diagbot.entity.OperationConfig;
+import com.diagbot.entity.PacsConfig;
+import com.diagbot.entity.ScaleConfig;
+import com.diagbot.entity.TcmdiseaseConfig;
+import com.diagbot.entity.TcmsyndromeConfig;
+import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.enums.ConceptTypeEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.MatchSourceEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.MappingConfigServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.UserUtils;
+import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.IdListVO;
+import com.diagbot.vo.IdVO;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.MappingConfigVO;
+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.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/9 14:19
+ */
+@Component
+public class MappingConfigFacade extends MappingConfigServiceImpl {
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
+    @Autowired
+    private CdssClient cdssClient;
+    @Autowired
+    private DictionaryFacade dictionaryFacade;
+
+    /**
+     * 导出文件
+     *
+     * @param response
+     * @param type
+     * @param extFileName
+     */
+    public void exportExcel(HttpServletResponse response, List<?> list, Integer type, String extFileName) {
+        String fileName = extFileName + ".xls";
+        switch (type) {
+            case 1:
+                fileName = "检验" + fileName;
+                List<LisConfig> lisConfigList = BeanUtil.listCopyTo(list, LisConfig.class);
+                ExcelUtils.exportExcel(lisConfigList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
+                break;
+            case 3:
+                fileName = "检查" + fileName;
+                List<PacsConfig> pacsConfigList = BeanUtil.listCopyTo(list, PacsConfig.class);
+                ExcelUtils.exportExcel(pacsConfigList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
+                break;
+            case 4:
+                fileName = "诊断" + fileName;
+                List<DiseaseConfig> diseaseConfigList = BeanUtil.listCopyTo(list, DiseaseConfig.class);
+                ExcelUtils.exportExcel(diseaseConfigList, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
+                break;
+            case 5:
+                fileName = "药品" + fileName;
+                List<DrugConfig> drugConfigList = BeanUtil.listCopyTo(list, DrugConfig.class);
+                ExcelUtils.exportExcel(drugConfigList, getForm(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
+                break;
+            case 6:
+                fileName = "手术和操作" + fileName;
+                List<OperationConfig> operationConfigList = BeanUtil.listCopyTo(list, OperationConfig.class);
+                ExcelUtils.exportExcel(operationConfigList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
+                break;
+            case 7:
+                fileName = "科室" + fileName;
+                List<DeptConfig> deptConfigList = BeanUtil.listCopyTo(list, DeptConfig.class);
+                ExcelUtils.exportExcel(deptConfigList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
+                break;
+            case 8:
+                fileName = "输血" + fileName;
+                List<TransfusionConfig> transfusionConfigList = BeanUtil.listCopyTo(list, TransfusionConfig.class);
+                ExcelUtils.exportExcel(transfusionConfigList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
+                break;
+            case 10:
+                fileName = "量表" + fileName;
+                List<ScaleConfig> scaleConfigList = BeanUtil.listCopyTo(list, ScaleConfig.class);
+                ExcelUtils.exportExcel(scaleConfigList, null, "sheet1", ScaleConfig.class, fileName, response, 12.8f);
+                break;
+            case 11:
+                fileName = "护理" + fileName;
+                List<NurseConfig> nurseConfigList = BeanUtil.listCopyTo(list, NurseConfig.class);
+                ExcelUtils.exportExcel(nurseConfigList, null, "sheet1", NurseConfig.class, fileName, response, 12.8f);
+                break;
+            case 12:
+                fileName = "中医疾病" + fileName;
+                List<TcmdiseaseConfig> tcmdiseaseConfigList = BeanUtil.listCopyTo(list, TcmdiseaseConfig.class);
+                ExcelUtils.exportExcel(tcmdiseaseConfigList, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
+                break;
+            case 13:
+                fileName = "中医证候" + fileName;
+                List<TcmsyndromeConfig> tcmsyndromeConfigList = BeanUtil.listCopyTo(list, TcmsyndromeConfig.class);
+                ExcelUtils.exportExcel(tcmsyndromeConfigList, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
+                break;
+            case 14:
+                fileName = "麻醉" + fileName;
+                List<AnesthesiaConfig> anesthesiaConfigList = BeanUtil.listCopyTo(list, AnesthesiaConfig.class);
+                ExcelUtils.exportExcel(anesthesiaConfigList, null, "sheet1", AnesthesiaConfig.class, fileName, response, 12.8f);
+                break;
+            default:
+                break;
+        }
+    }
+
+
+    /**
+     * 剂型说明
+     *
+     * @return
+     */
+    private String getForm() {
+        String form = "药品模板——药品剂型填写说明[不填";
+        //药品剂型
+        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
+        if (ListUtil.isNotEmpty(dicTypeMappingList)) {
+            String formList = dicTypeMappingList.stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getName()))
+                    .map(i -> i.getName())
+                    .distinct()
+                    .collect(Collectors.joining("、"));
+            if (StringUtil.isNotBlank(formList)) {
+                form += "、" + formList;
+            }
+        }
+        form += "]";
+        return form;
+    }
+
+
+    /**
+     * 分页查询
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    public IPage<MappingConfigWrapper> getPage(MappingConfigPageVO mappingConfigPageVO) {
+        Page<MappingConfigWrapper> page = null;
+        RespDTO<Page<MappingConfigWrapper>> respDTO = cdssClient.getPage(mappingConfigPageVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            page = respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+        return page;
+    }
+
+    /**
+     * 导入模板下载
+     *
+     * @param response
+     */
+    public void exportExcelModule(HttpServletResponse response, MappingConfigVO mappingConfigVO) {
+        exportExcel(response, new ArrayList<>(), mappingConfigVO.getType(), "导入模板");
+    }
+
+    /**
+     * 数据导出
+     *
+     * @param response
+     */
+    public void exportExcel(HttpServletResponse response, MappingConfigPageVO mappingConfigPageVO) {
+        RespDTO<List<MappingConfigWrapper>> respDTO = cdssClient.exportExcel_remote(mappingConfigPageVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            exportExcel(response, respDTO.data, mappingConfigPageVO.getType(), "映射");
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 导入数据预匹配校验
+     *
+     * @param file
+     * @param type
+     */
+    public Boolean dataVerify(MultipartFile file, Integer type) {
+        RespDTO<Boolean> respDTO = cdssClient.dataVerify(file, type);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 导入数据预匹配
+     *
+     * @param file
+     * @param type
+     * @param response
+     */
+    public void precDataMatch(MultipartFile file, Integer type, HttpServletResponse response) {
+
+        RespDTO<List<MappingConfigWrapper>> respDTO = cdssClient.precDataMatch_remote(file, type);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            exportExcel(response, respDTO.data, type, "关联数据(预匹配)");
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalId
+     * @param type
+     */
+    public Boolean importExcel(MultipartFile file, Long hospitalId, Integer type, String userId) {
+        if (StringUtil.isBlank(userId)) {
+            userId = UserUtils.getCurrentPrincipleID();
+        }
+        RespDTO<Boolean> respDTO = cdssClient.importExcel(file, hospitalId, type, userId);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+
+    /**
+     * 删除记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public Boolean deleteRecord(IdVO idVO) {
+        RespDTO<Boolean> respDTO = cdssClient.deleteRecord(idVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 删除记录-批量
+     *
+     * @param idListVO
+     * @return
+     */
+    public Boolean deleteRecords(IdListVO idListVO) {
+        RespDTO<Boolean> respDTO = cdssClient.deleteRecords(idListVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 获取记录-单条
+     *
+     * @param idVO
+     * @return
+     */
+    public MappingConfigWrapper getRecord(IdVO idVO) {
+        RespDTO<MappingConfigWrapper> respDTO = cdssClient.getRecord(idVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 查询已关联关系
+     *
+     * @param mappingConfigVO
+     * @return
+     */
+    public List<MappingConfigWrapper> getRelatedMapping(MappingConfigVO mappingConfigVO) {
+        RespDTO<List<MappingConfigWrapper>> respDTO = cdssClient.getRelatedMapping(mappingConfigVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 判断是否已存在
+     *
+     * @param mappingConfig
+     * @return
+     */
+    public Boolean isExistRecord(MappingConfig mappingConfig) {
+        RespDTO<Boolean> respDTO = cdssClient.isExistRecord(mappingConfig);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+    /**
+     * 保存记录-单条
+     *
+     * @param mappingConfig
+     * @return
+     */
+    public Boolean saveOrUpdateRecord(MappingConfig mappingConfig) {
+        String userId = UserUtils.getCurrentPrincipleID();
+        mappingConfig.setModifier(userId);
+        mappingConfig.setCreator(userId);
+        RespDTO<Boolean> respDTO = cdssClient.saveOrUpdateRecord(mappingConfig);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            return respDTO.data;
+        } else {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, respDTO.msg);
+        }
+    }
+
+
+    /**
+     * 根据医院名称分组-返回id
+     *
+     * @param hisNames
+     * @param type
+     * @return
+     */
+    public Map<String, Map<String, Map<Long, List<Long>>>> groupByHisNameWithId(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<Long, List<Long>>>> retMap = new HashMap<>();
+        QueryWrapper<MappingConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("is_match", 1)
+                .eq("type", type);
+        if (hospitalId != null) {
+            queryWrapper.eq("hospital_id", hospitalId);
+        }
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        List<MappingConfig> list = this.list(queryWrapper);
+
+        if (ListUtil.isEmpty(list)) {
+            return retMap;
+        }
+
+        for (MappingConfig item : list) {
+            if (StringUtil.isBlank(item.getHisDetailName())) {
+                item.setHisDetailName("");
+            }
+            item.setId(null);
+            item.setHospitalId(null);
+        }
+
+        list = list.stream().distinct().collect(Collectors.toList());
+
+        Map<String, List<MappingConfig>> hisMap = list.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
+                .collect(Collectors.groupingBy(MappingConfig::getHisName));
+        for (Map.Entry<String, List<MappingConfig>> entry : hisMap.entrySet()) {
+            Map<String, Map<Long, List<Long>>> subMap = new HashMap<>();
+            Map<String, List<MappingConfig>> detailMap = entry.getValue().stream()
+                    .collect(Collectors.groupingBy(MappingConfig::getHisDetailName));
+            for (Map.Entry<String, List<MappingConfig>> subEntry : detailMap.entrySet()) {
+                subMap.put(subEntry.getKey(),
+                        subEntry.getValue()
+                                .stream()
+                                .collect(Collectors.groupingBy(MappingConfig::getConceptId,
+                                        Collectors.mapping(MappingConfig::getFormConceptId, Collectors.toList()))));
+            }
+            retMap.put(entry.getKey(), subMap);
+        }
+        return retMap;
+    }
+
+    /**
+     * 根据医院名称分组-返回名称
+     *
+     * @param hisNames
+     * @param type
+     * @param hospitalId
+     * @return
+     */
+    public Map<String, Map<String, Map<String, List<String>>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
+        Map<String, Map<String, Map<Long, List<Long>>>> idMap = groupByHisNameWithId(hisNames, type, hospitalId);
+
+        //conceptIds
+        List<Long> ids = idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
+                .map(i -> i.keySet())
+                .flatMap(Collection::stream)
+                .filter(i -> i != null)
+                .distinct()
+                .collect(Collectors.toList());
+
+        //formConceptId
+        ids.addAll(idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
+                .flatMap(i -> i.values().stream())
+                .flatMap(Collection::stream)
+                .filter(i -> i != null)
+                .distinct()
+                .collect(Collectors.toList()));
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(-1);
+        conceptVO.setType(type);
+        conceptVO.setIds(ids);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        List<IndexBatchDTO> indexList = respDTO.data;
+        if (ListUtil.isNotEmpty(indexList)) {
+            Map<Long, String> idNameMap
+                    = indexList.stream().collect(Collectors.toMap(IndexBatchDTO::getId, IndexBatchDTO::getName));
+            for (Map.Entry<String, Map<String, Map<Long, List<Long>>>> entry : idMap.entrySet()) {
+                Map<String, Map<String, List<String>>> subMap = new HashMap<>();
+                for (Map.Entry<String, Map<Long, List<Long>>> subEntry : entry.getValue().entrySet()) {
+                    Map<String, List<String>> thirdMap = new HashMap<>();
+                    for (Map.Entry<Long, List<Long>> thirdEntry : subEntry.getValue().entrySet()) {
+                        List<Long> formConceptIds = thirdEntry.getValue();
+                        List<String> forms = Lists.newArrayList();
+                        if (ListUtil.isNotEmpty(formConceptIds)) {
+                            for (Long formConceptId : formConceptIds) {
+                                if (formConceptId == null) {
+                                    forms.add("");
+                                } else {
+                                    forms.add(idNameMap.get(formConceptId));
+                                }
+                            }
+                            forms = forms.stream().distinct().collect(Collectors.toList());
+                            thirdMap.put(idNameMap.get(thirdEntry.getKey()), forms);
+                        }
+                    }
+                    subMap.put(subEntry.getKey(), thirdMap);
+                }
+                if (subMap != null && subMap.size() > 0) {
+                    retMap.put(entry.getKey(), subMap);
+                }
+            }
+        }
+        return retMap;
+    }
+
+
+    /**
+     * 根据标准名称分组-返回名称
+     *
+     * @param uniqueNames
+     * @param type
+     * @param hospitalId
+     * @return uniqueName, form, hisName, hisDetailName
+     */
+    public Map<String, Map<String, Map<String, List<String>>>> groupByUniqueNameWithName(List<String> uniqueNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
+
+        List<Long> conceptIds = Lists.newArrayList();
+
+        ConceptVO conceptVO = new ConceptVO();
+        RespDTO<List<IndexBatchDTO>> respDTO = null;
+        List<IndexBatchDTO> indexList = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            conceptVO.setType(type);
+            conceptVO.setNames(uniqueNames);
+            conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
+            respDTO = cdssCoreClient.getConceptNames(conceptVO);
+            if (RespDTOUtil.respIsOK(respDTO)) {
+                indexList.addAll(respDTO.data);
+            }
+
+            if (type.equals(ConceptTypeEnum.LisPack.getKey())) {
+                conceptVO.setType(ConceptTypeEnum.Lis.getKey());
+                respDTO = cdssCoreClient.getConceptNames(conceptVO);
+                if (RespDTOUtil.respIsOK(respDTO)) {
+                    indexList.addAll(respDTO.data);
+                }
+            }
+        }
+        if (ListUtil.isNotEmpty(indexList)) {
+            conceptIds = indexList.stream().map(IndexBatchDTO::getId).distinct().collect(Collectors.toList());
+        }
+
+        QueryWrapper<MappingConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("is_match", 1)
+                .eq("type", type);
+        if (hospitalId != null) {
+            queryWrapper.eq("hospital_id", hospitalId);
+        }
+        if (ListUtil.isNotEmpty(conceptIds)) {
+            queryWrapper.in("concept_id", conceptIds);
+        }
+        List<MappingConfig> list = this.list(queryWrapper);
+
+        if (ListUtil.isEmpty(list)) {
+            return retMap;
+        }
+
+        List<MappingConfigWrapper> wrapperList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
+        wrapperList = addNames(wrapperList);
+        wrapperList.forEach(item -> {
+            if (StringUtil.isBlank(item.getForm())) {
+                item.setForm("");
+            }
+            if (StringUtil.isBlank(item.getHisDetailName())) {
+                item.setHisDetailName("");
+            }
+        });
+
+
+        Map<String, List<MappingConfigWrapper>> map = wrapperList.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .collect(Collectors.groupingBy(MappingConfigWrapper::getUniqueName));
+
+        for (Map.Entry<String, List<MappingConfigWrapper>> entry : map.entrySet()) {
+            Map<String, Map<String, List<String>>> subMap = new HashMap<>();
+            Map<String, List<MappingConfigWrapper>> formMap
+                    = entry.getValue().stream().collect(Collectors.groupingBy(MappingConfigWrapper::getForm));
+            for (Map.Entry<String, List<MappingConfigWrapper>> subEntry : formMap.entrySet()) {
+                subMap.put(subEntry.getKey(), subEntry.getValue().stream().collect(Collectors.groupingBy(MappingConfigWrapper::getHisName,
+                        Collectors.mapping(MappingConfigWrapper::getHisDetailName, Collectors.toList()))));
+            }
+            retMap.put(entry.getKey(), subMap);
+        }
+
+        return retMap;
+    }
+
+    /**
+     * 返回结果添加标准术语,药品剂型
+     *
+     * @param list
+     * @return
+     */
+    public List<MappingConfigWrapper> addNames(List<MappingConfigWrapper> list) {
+        if (ListUtil.isEmpty(list)) {
+            return list;
+        }
+
+        List<Long> ids = Lists.newArrayList();
+        ids.addAll(list.stream()
+                .filter(i -> i.getConceptId() != null)
+                .map(MappingConfigWrapper::getConceptId)
+                .collect(Collectors.toList()));
+        ids.addAll(list.stream()
+                .filter(i -> i.getFormConceptId() != null)
+                .map(MappingConfigWrapper::getFormConceptId)
+                .collect(Collectors.toList()));
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(-1);
+        conceptVO.setIds(ids);
+        System.out.println(ids.stream().map(i -> String.valueOf(i)).collect(Collectors.joining(",")));
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            Map<Long, IndexBatchDTO> conceptMap
+                    = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getId, v -> v));
+            for (MappingConfigWrapper record : list) {
+                if (record.getConceptId() != null && conceptMap.containsKey(record.getConceptId())) {
+                    record.setUniqueName(conceptMap.get(record.getConceptId()).getName());
+                    record.setCode(conceptMap.get(record.getConceptId()).getCode());
+                }
+                if (record.getFormConceptId() != null && conceptMap.containsKey(record.getFormConceptId())) {
+                    record.setForm(conceptMap.get(record.getFormConceptId()).getName());
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 查找指定医院映射关系
+     *
+     * @param hospitalId
+     * @return
+     */
+    public List<MappingConfigWrapper> getListByHospitalIdAndType(Long hospitalId, Integer type) {
+        QueryWrapper<MappingConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId)
+                .eq("is_match", 1)
+                .eq("type", type);
+        List<MappingConfig> list = this.list(queryWrapper);
+        if (ListUtil.isEmpty(list)) {
+            return null;
+        }
+        List<MappingConfigWrapper> retList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
+        addNames(retList);
+        return retList;
+    }
+}

+ 25 - 26
cdssman-service/src/main/java/com/diagbot/facade/MedRuleConvertFacade.java

@@ -9,6 +9,7 @@ import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlRuleBase;
 import com.diagbot.entity.ResultRule;
 import com.diagbot.enums.ConEnum;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleBaseTypeEnum;
@@ -56,17 +57,7 @@ public class MedRuleConvertFacade {
     private KlRuleBaseFacade klRuleBaseFacade;
 
     @Autowired
-    private LisConfigFacade lisConfigFacade;
-    @Autowired
-    private PacsConfigFacade pacsConfigFacade;
-    @Autowired
-    private DrugConfigFacade drugConfigFacade;
-    @Autowired
-    private DiseaseConfigFacade diseaseConfigFacade;
-    @Autowired
-    private OperationConfigFacade operationConfigFacade;
-    @Autowired
-    private TransfusionConfigFacade transfusionConfigFacade;
+    private MappingConfigFacade mappingConfigFacade;
 
     /**
      * 开单规则处理
@@ -133,12 +124,18 @@ public class MedRuleConvertFacade {
             return retList;
         }
 
-        Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
-        Map<String, Map<String, List<Long>>> pacsConfigMap = pacsConfigFacade.getUniqueConfigMap(hospitalId, null, null);
-        Map<String, Map<String, Map<String, List<Long>>>> drugConfigMap = drugConfigFacade.getUniqueFormConfigMap(hospitalId, null, null);
-        Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
-        Map<String, Map<String, List<Long>>> operationConfigMap = operationConfigFacade.getUniqueConfigMap(hospitalId, null, null);
-        Map<String, Map<String, List<Long>>> transfusionConfigMap = transfusionConfigFacade.getUniqueConfigMap(hospitalId, null, null);
+        Map<String, Map<String, Map<String, List<String>>>> lisConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.LisPack.getKey(), hospitalId);
+        Map<String, Map<String, Map<String, List<String>>>> pacsConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Pacs.getKey(), hospitalId);
+        Map<String, Map<String, Map<String, List<String>>>> drugConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Drug.getKey(), hospitalId);
+        Map<String, Map<String, Map<String, List<String>>>> diseaseConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Disease.getKey(), hospitalId);
+        Map<String, Map<String, Map<String, List<String>>>> operationConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Operation.getKey(), hospitalId);
+        Map<String, Map<String, Map<String, List<String>>>> transfusionConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Transfusion.getKey(), hospitalId);
 
         //高危手术结果去重
         if (caseId.equals(6L)) {
@@ -925,7 +922,9 @@ public class MedRuleConvertFacade {
      * @param type
      * @return
      */
-    public List<ResultRule> getMappingResult(ResultRule result, Map<String, Map<String, List<Long>>> configMap, Integer type) {
+    public List<ResultRule> getMappingResult(ResultRule result,
+                                             Map<String, Map<String, Map<String, List<String>>>> configMap,
+                                             Integer type) {
         List<ResultRule> retList = Lists.newLinkedList();
         if (configMap == null || configMap.size() == 0) {
             result.setSuccess(0);
@@ -945,7 +944,7 @@ public class MedRuleConvertFacade {
         }
 
         List<String> hisNames = configMap.containsKey(keyName)
-                ? new ArrayList<>(configMap.get(keyName).keySet())
+                ? configMap.get(keyName).get("").keySet().stream().collect(Collectors.toList())
                 : new ArrayList<>();
         if (ListUtil.isNotEmpty(hisNames)) {
             for (String hisName : hisNames) {
@@ -977,7 +976,7 @@ public class MedRuleConvertFacade {
      * @return
      */
     public List<ResultRule> getMappingResult_medicine(ResultRule result,
-                                                      Map<String, Map<String, Map<String, List<Long>>>> configMap,
+                                                      Map<String, Map<String, Map<String, List<String>>>> configMap,
                                                       Integer type, Integer ruleType) {
         List<ResultRule> retList = Lists.newLinkedList();
         if (configMap == null || configMap.size() == 0) {
@@ -998,7 +997,7 @@ public class MedRuleConvertFacade {
         }
 
         if (ruleType.equals(RuleTypeEnum.HighRisk.getKey())) {
-            Map<String, Map<String, List<Long>>> formMap = configMap.containsKey(keyName)
+            Map<String, Map<String, List<String>>> formMap = configMap.containsKey(keyName)
                     ? configMap.get(keyName)
                     : new HashMap<>();
             if (formMap.size() > 0) {
@@ -1072,7 +1071,7 @@ public class MedRuleConvertFacade {
      * @param type
      * @return
      */
-    public List<ResultRule> getMappingResult_lis(ResultRule result, Map<String, Map<String, Map<String, List<Long>>>> configMap, Integer type) {
+    public List<ResultRule> getMappingResult_lis(ResultRule result, Map<String, Map<String, Map<String, List<String>>>> configMap, Integer type) {
         List<ResultRule> retList = Lists.newLinkedList();
         if (configMap == null || configMap.size() == 0) {
             result.setSuccess(0);
@@ -1091,7 +1090,7 @@ public class MedRuleConvertFacade {
             keyName = result.getRuleBaseLibName();
         }
 
-        Map<String, Map<String, List<Long>>> subConfigMap = configMap.get(keyName);
+        Map<String, Map<String, List<String>>> subConfigMap = configMap.get(keyName);
         if (subConfigMap == null || subConfigMap.size() == 0) {
             result.setSuccess(0);
             if (type.equals(1)) {
@@ -1103,8 +1102,8 @@ public class MedRuleConvertFacade {
             return retList;
         }
 
-        for (Map.Entry<String, Map<String, List<Long>>> subEntry : subConfigMap.entrySet()) {
-            subEntry.getValue().keySet().forEach(detailName -> {
+        for (Map.Entry<String, List<String>> subEntry : subConfigMap.get("").entrySet()) {
+            subEntry.getValue().forEach(detailName -> {
                 ResultRule bmResult = new ResultRule();
                 BeanUtil.copyProperties(result, bmResult);
                 if (type.equals(1)) {
@@ -1863,7 +1862,7 @@ public class MedRuleConvertFacade {
      * @param max
      * @return
      */
-    public BigDecimal random(BigDecimal min, BigDecimal max, Boolean minBoundary, Boolean maxBoundary,Integer accuracy) {
+    public BigDecimal random(BigDecimal min, BigDecimal max, Boolean minBoundary, Boolean maxBoundary, Integer accuracy) {
         if (min == null) {
             min = BigDecimal.ZERO;
         }

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

@@ -267,7 +267,7 @@ public class MedSearchDataFacade {
                         Lis lis = new Lis();
                         if (hospitalId < 0) {
                             lis.setName(result.getRuleBaseLibName());
-                            lis.setDetailName("");
+                            lis.setDetailName(result.getRuleBaseLibName());
                         } else {
                             lis.setName(result.getRuleBaseHisName());
                             lis.setDetailName(result.getRuleBaseHisDetailName());

+ 0 - 605
cdssman-service/src/main/java/com/diagbot/facade/NurseConfigFacade.java

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

+ 0 - 605
cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java

@@ -1,605 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.diagbot.vo.OperationConfigListVO;
-import com.diagbot.vo.OperationConfigPageVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:05
- */
-@Component
-public class OperationConfigFacade {
-    @Autowired
-    private OperationConfigService operationConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param operationConfig
-     * @return
-     */
-    public Boolean isExistRecord(OperationConfig operationConfig) {
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", operationConfig.getHospitalId())
-                .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, "该条关联已存在,无法保存");
-        }
-        return false;
-    }
-
-    /**
-     * 保存记录-单条
-     *
-     * @param operationConfig
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(OperationConfig operationConfig) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        operationConfig.setModifier(userId);
-        operationConfig.setGmtModified(now);
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", operationConfig.getHospitalId())
-                .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);
-            operationConfig.setGmtCreate(now);
-        }
-        if (operationConfig.getIsDeleted() == null) {
-            operationConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-        }
-        operationConfigService.saveOrUpdate(operationConfig);
-        return true;
-    }
-
-    /**
-     * 保存记录-批量
-     *
-     * @param operationConfigListVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(OperationConfigListVO operationConfigListVO) {
-        if (ListUtil.isEmpty(operationConfigListVO.getOperationConfigList())) {
-            return false;
-        }
-        return saveOrUpdateRecords(operationConfigListVO.getOperationConfigList());
-    }
-
-    /**
-     * 批量保存
-     *
-     * @param operationConfigList
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(List<OperationConfig> operationConfigList) {
-        if (ListUtil.isEmpty(operationConfigList)) {
-            return false;
-        }
-
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤外部名称或公表名为空的数据
-        operationConfigList = operationConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-
-        if (ListUtil.isEmpty(operationConfigList)) {
-            return false;
-        }
-
-        Long hospitalId = operationConfigList.get(0).getHospitalId();
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(hospitalId, null, null);
-        operationConfigList.forEach(operationConfig -> {
-            operationConfig.setModifier(userId);
-            operationConfig.setGmtModified(now);
-            if (operationConfig.getId() == null) {
-                if (configMap.containsKey(operationConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()));
-                }
-                operationConfig.setCreator(userId);
-                operationConfig.setGmtCreate(now);
-            }
-            if (operationConfig.getIsDeleted() == null) {
-                operationConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        operationConfigService.saveOrUpdateBatch(operationConfigList);
-        return true;
-    }
-
-    /**
-     * 删除记录-单条
-     *
-     * @param idVO
-     * @return
-     */
-    public Boolean deleteRecord(IdVO idVO) {
-        UpdateWrapper<OperationConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", idVO.getId())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        operationConfigService.removeById(idVO.getId());
-        return true;
-    }
-
-    /**
-     * 删除记录-批量
-     *
-     * @param idListVO
-     * @return
-     */
-    public Boolean deleteRecords(IdListVO idListVO) {
-        if (ListUtil.isEmpty(idListVO.getIds())) {
-            return false;
-        }
-        UpdateWrapper<OperationConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("id", idListVO.getIds())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        operationConfigService.removeByIds(idListVO.getIds());
-        return true;
-    }
-
-    /**
-     * 分页查询
-     *
-     * @param operationConfigPageVO
-     * @return
-     */
-    public IPage<OperationConfig> getPage(OperationConfigPageVO operationConfigPageVO) {
-        return operationConfigService.getPage(operationConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
-        if (ListUtil.isNotEmpty(operationConfigList)) {
-            importExcelRecords(operationConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param operationConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<OperationConfig> operationConfigList, HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        operationConfigList = operationConfigList.stream()
-                .filter(OperationConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(operationConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        operationConfigList.forEach(operationConfig -> {
-            operationConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < operationConfigList.size(); i++) {
-            if (StringUtil.isBlank(operationConfigList.get(i).getHisName())
-                    || 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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, List<Long>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), null, null);
-            operationConfigList.forEach(operationConfig -> {
-                operationConfig.setHospitalId(Long.valueOf(hospitalId));
-                operationConfig.setModifier(userId);
-                operationConfig.setGmtModified(now);
-                if (operationConfig.getId() == null) {
-                    if (configMap.containsKey(operationConfig.getHisName())
-                            && ListUtil.isNotEmpty(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()))) {
-                        deleteIds.addAll(configMap.get(operationConfig.getHisName()).get(operationConfig.getUniqueName()));
-                    }
-                    operationConfig.setCreator(userId);
-                    operationConfig.setGmtCreate(now);
-                }
-                if (operationConfig.getIsDeleted() == null) {
-                    operationConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-                }
-            });
-
-            //标准术语校验
-            List<String> errorNumList = Lists.newLinkedList();
-            List<String> uniqueNames = operationConfigList.stream()
-                    .map(i -> i.getUniqueName())
-                    .distinct()
-                    .collect(Collectors.toList());
-            ConceptVO conceptVO = new ConceptVO();
-            conceptVO.setNames(uniqueNames);
-            conceptVO.setType(ConceptTypeEnum.Operation.getKey());
-            RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-            List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < operationConfigList.size(); i++) {
-                if (!names.contains(operationConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            }
-            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;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<OperationConfig> 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<OperationConfig> records = operationConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<OperationConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<OperationConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<OperationConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<OperationConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<OperationConfig> 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<OperationConfig> records = operationConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<OperationConfig>> configMap = EntityUtil.makeEntityListMap(records, "uniqueName");
-        for (Map.Entry<String, List<OperationConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<OperationConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<OperationConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<OperationConfig> records = operationConfigService.list(queryWrapper);
-        String fileName = "手术映射.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return operationConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "手术映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据预匹配
-     *
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
-        List<OperationConfig> originList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
-        List<OperationConfig> retList = dataProcess(originList);
-
-        String fileName = "手术和操作关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<OperationConfig> originList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
-        List<OperationConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<OperationConfig> dataProcess(List<OperationConfig> originList) {
-        List<OperationConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, List<OperationConfig>> allMap = getAll(hisNameList);
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(OperationConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-        });
-
-        //获取标准术语
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, List<OperationConfig>> entry : allMap.entrySet()) {
-                if (ListUtil.isNotEmpty(entry.getValue())) {
-                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.Operation.getKey());
-        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(originList)) {
-            for (OperationConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<OperationConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (OperationConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     *
-     * @return
-     */
-    public Map<String, List<OperationConfig>> getAll(List<String> hisNameList) {
-        Map<String, List<OperationConfig>> retMap = new HashMap<>();
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<OperationConfig> records = operationConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        retMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        return retMap;
-    }
-
-    /**
-     * 查找指定医院映射关系
-     *
-     * @param hospitalId
-     * @return
-     */
-    public List<OperationConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return operationConfigService.list(queryWrapper);
-    }
-}

+ 0 - 603
cdssman-service/src/main/java/com/diagbot/facade/PacsConfigFacade.java

@@ -1,603 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.diagbot.vo.PacsConfigListVO;
-import com.diagbot.vo.PacsConfigPageVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:03
- */
-@Component
-public class PacsConfigFacade {
-    @Autowired
-    private PacsConfigService pacsConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param pacsConfig
-     * @return
-     */
-    public Boolean isExistRecord(PacsConfig pacsConfig) {
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", pacsConfig.getHospitalId())
-                .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, "该条关联已存在,无法保存");
-        }
-        return false;
-    }
-
-    /**
-     * 保存记录-单条
-     *
-     * @param pacsConfig
-     * @return
-     */
-    public Boolean saveOrUpdateRecord(PacsConfig pacsConfig) {
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        pacsConfig.setModifier(userId);
-        pacsConfig.setGmtModified(now);
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", pacsConfig.getHospitalId())
-                .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);
-            pacsConfig.setGmtCreate(now);
-        }
-        if (pacsConfig.getIsDeleted() == null) {
-            pacsConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-        }
-        pacsConfigService.saveOrUpdate(pacsConfig);
-        return true;
-    }
-
-    /**
-     * 保存记录-批量
-     *
-     * @param pacsConfigListVO
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(PacsConfigListVO pacsConfigListVO) {
-        if (ListUtil.isEmpty(pacsConfigListVO.getPacsConfigList())) {
-            return false;
-        }
-        return saveOrUpdateRecords(pacsConfigListVO.getPacsConfigList());
-    }
-
-    /**
-     * 批量保存
-     *
-     * @param pacsConfigList
-     * @return
-     */
-    public Boolean saveOrUpdateRecords(List<PacsConfig> pacsConfigList) {
-        if (ListUtil.isEmpty(pacsConfigList)) {
-            return false;
-        }
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤外部名称或公表名为空的数据
-        pacsConfigList = pacsConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(pacsConfigList)) {
-            return false;
-        }
-
-        Long hospitalId = pacsConfigList.get(0).getHospitalId();
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(hospitalId, null, null);
-        pacsConfigList.forEach(pacsConfig -> {
-            pacsConfig.setModifier(userId);
-            pacsConfig.setGmtModified(now);
-            if (pacsConfig.getId() == null) {
-                if (configMap.containsKey(pacsConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()));
-                }
-                pacsConfig.setCreator(userId);
-                pacsConfig.setGmtCreate(now);
-            }
-            if (pacsConfig.getIsDeleted() == null) {
-                pacsConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        pacsConfigService.saveOrUpdateBatch(pacsConfigList);
-        return true;
-    }
-
-    /**
-     * 删除记录-单条
-     *
-     * @param idVO
-     * @return
-     */
-    public Boolean deleteRecord(IdVO idVO) {
-        UpdateWrapper<PacsConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", idVO.getId())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        pacsConfigService.removeById(idVO.getId());
-        return true;
-    }
-
-    /**
-     * 删除记录-批量
-     *
-     * @param idListVO
-     * @return
-     */
-    public Boolean deleteRecords(IdListVO idListVO) {
-        if (ListUtil.isEmpty(idListVO.getIds())) {
-            return false;
-        }
-        UpdateWrapper<PacsConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.in("id", idListVO.getIds())
-                .set("is_deleted", IsDeleteEnum.Y.getKey());
-        pacsConfigService.removeByIds(idListVO.getIds());
-        return true;
-    }
-
-    /**
-     * 分页查询
-     *
-     * @param pacsConfigPageVO
-     * @return
-     */
-    public IPage<PacsConfig> getPage(PacsConfigPageVO pacsConfigPageVO) {
-        return pacsConfigService.getPage(pacsConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
-        if (ListUtil.isNotEmpty(pacsConfigList)) {
-            importExcelRecords(pacsConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param pacsConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<PacsConfig> pacsConfigList, HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        pacsConfigList = pacsConfigList.stream()
-                .filter(PacsConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(pacsConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        pacsConfigList.forEach(pacsConfig -> {
-            pacsConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < pacsConfigList.size(); i++) {
-            if (StringUtil.isBlank(pacsConfigList.get(i).getHisName())
-                    || 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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, List<Long>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), null, null);
-            pacsConfigList.forEach(pacsConfig -> {
-                pacsConfig.setHospitalId(Long.valueOf(hospitalId));
-                pacsConfig.setModifier(userId);
-                pacsConfig.setGmtModified(now);
-                if (pacsConfig.getId() == null) {
-                    if (configMap.containsKey(pacsConfig.getHisName())
-                            && ListUtil.isNotEmpty(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()))) {
-                        deleteIds.addAll(configMap.get(pacsConfig.getHisName()).get(pacsConfig.getUniqueName()));
-                    }
-                    pacsConfig.setCreator(userId);
-                    pacsConfig.setGmtCreate(now);
-                }
-                if (pacsConfig.getIsDeleted() == null) {
-                    pacsConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-                }
-            });
-
-            //标准术语校验
-            List<String> errorNumList = Lists.newLinkedList();
-            List<String> uniqueNames = pacsConfigList.stream()
-                    .map(i -> i.getUniqueName())
-                    .distinct()
-                    .collect(Collectors.toList());
-            ConceptVO conceptVO = new ConceptVO();
-            conceptVO.setNames(uniqueNames);
-            conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
-            RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-            List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < pacsConfigList.size(); i++) {
-                if (!names.contains(pacsConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            }
-            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;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<PacsConfig> 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<PacsConfig> records = pacsConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<PacsConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<PacsConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<PacsConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<PacsConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<PacsConfig> 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<PacsConfig> records = pacsConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<PacsConfig>> configMap = EntityUtil.makeEntityListMap(records, "uniqueName");
-        for (Map.Entry<String, List<PacsConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<PacsConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<PacsConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<PacsConfig> records = pacsConfigService.list(queryWrapper);
-        String fileName = "检查映射.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return pacsConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "检查映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据预匹配
-     *
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
-        List<PacsConfig> originList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
-        List<PacsConfig> retList = dataProcess(originList);
-
-        String fileName = "检查关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<PacsConfig> originList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
-        List<PacsConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<PacsConfig> dataProcess(List<PacsConfig> originList) {
-        List<PacsConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, List<PacsConfig>> allMap = getAll(hisNameList);
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(PacsConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-        });
-
-        //获取标准术语
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, List<PacsConfig>> entry : allMap.entrySet()) {
-                if (ListUtil.isNotEmpty(entry.getValue())) {
-                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
-        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(originList)) {
-            for (PacsConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<PacsConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (PacsConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     *
-     * @return
-     */
-    public Map<String, List<PacsConfig>> getAll(List<String> hisNameList) {
-        Map<String, List<PacsConfig>> retMap = new HashMap<>();
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<PacsConfig> records = pacsConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        retMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        return retMap;
-    }
-
-    /**
-     * 查找指定医院映射关系
-     *
-     * @param hospitalId
-     * @return
-     */
-    public List<PacsConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return pacsConfigService.list(queryWrapper);
-    }
-}

+ 6 - 3
cdssman-service/src/main/java/com/diagbot/facade/RelationContactFacade.java

@@ -80,9 +80,12 @@ public class RelationContactFacade extends KlRelationServiceImpl {
                     }
                 }
             }
-            List<KlRelation> relationList = this.list(new QueryWrapper<KlRelation>()
-                    .in("start_id", sids)
-                    .eq("relation_id", rid));
+            List<KlRelation> relationList = Lists.newArrayList();
+            if(ListUtil.isNotEmpty(sids)){
+                relationList = this.list(new QueryWrapper<KlRelation>()
+                        .in("start_id", sids)
+                        .eq("relation_id", rid));
+            }
             List<Long> ids = relationList.stream().map(x -> x.getId()).collect(Collectors.toList());
             //先删除
             if (ListUtil.isNotEmpty(ids)) {

+ 25 - 20
cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java

@@ -23,6 +23,7 @@ import com.diagbot.entity.ResultStaticKnowledge;
 import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.MatchSourceEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -71,15 +72,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
     private KlConceptStaticFacade klConceptStaticFacade;
 
     @Autowired
-    private LisConfigFacade lisConfigFacade;
-    @Autowired
-    private PacsConfigFacade pacsConfigFacade;
-    @Autowired
-    private DrugConfigFacade drugConfigFacade;
-    @Autowired
-    private DiseaseConfigFacade diseaseConfigFacade;
-    @Autowired
-    private OperationConfigFacade operationConfigFacade;
+    private MappingConfigFacade mappingConfigFacade;
     @Autowired
     private RunningInfoFacade runningInfoFacade;
 
@@ -150,7 +143,8 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         // 已存在数据
-        Map<String, Map<String, Map<String, List<Long>>>> hisConfigMap = lisConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, List<String>>>> hisConfigMap
+                = mappingConfigFacade.groupByHisNameWithName(null, ConceptTypeEnum.LisPack.getKey(), Long.valueOf(hospitalId));
 
         //术语映射
         for (LisConfig config : lisConfigList) {
@@ -168,7 +162,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             result.setHisDetailName(config.getHisDetailName());
             if (hisConfigMap.containsKey(result.getHisName())
                     && hisConfigMap.get(result.getHisName()).containsKey(result.getHisDetailName())) {
-                Map<String, List<Long>> subMap = hisConfigMap.get(result.getHisName()).get(result.getHisDetailName());
+                Map<String, List<String>> subMap = hisConfigMap.get(result.getHisName()).get(result.getHisDetailName());
                 if (subMap != null && subMap.size() > 0) {
                     for (String subKey : subMap.keySet()) {
                         ResultStaticKnowledge subResult = new ResultStaticKnowledge();
@@ -196,6 +190,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .map(i -> i.getName())
                 .collect(Collectors.toList());
         ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
         RespDTO<List<IndexBatchDTO>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
@@ -350,7 +345,8 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
 
 
         // 已存在数据
-        Map<String, Map<String, List<Long>>> hisConfigMap = pacsConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, List<String>>>> hisConfigMap
+                = mappingConfigFacade.groupByHisNameWithName(null, ConceptTypeEnum.Pacs.getKey(), Long.valueOf(hospitalId));
         //术语映射
         for (PacsConfig config : pacsConfigList) {
             ResultStaticKnowledge result = new ResultStaticKnowledge();
@@ -366,7 +362,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             result.setHisName(config.getHisName());
 
             if (hisConfigMap.containsKey(result.getHisName())) {
-                Map<String, List<Long>> subMap = hisConfigMap.get(result.getHisName());
+                Map<String, List<String>> subMap = hisConfigMap.get(result.getHisName()).get("");
                 if (subMap != null && subMap.size() > 0) {
                     for (String subKey : subMap.keySet()) {
                         ResultStaticKnowledge subResult = new ResultStaticKnowledge();
@@ -394,6 +390,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
         RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
@@ -540,7 +537,8 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
 
 
         // 已存在数据
-        Map<String, Map<String, Long>> hisConfigMap = drugConfigFacade.getConfigMapWithoutForm(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, List<String>>>> hisConfigMap
+                = mappingConfigFacade.groupByHisNameWithName(null, ConceptTypeEnum.Drug.getKey(), Long.valueOf(hospitalId));
 
         //术语映射
         for (DrugConfig config : drugConfigList) {
@@ -557,7 +555,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             result.setHisName(config.getHisName());
 
             if (hisConfigMap.containsKey(result.getHisName())) {
-                Map<String, Long> subMap = hisConfigMap.get(result.getHisName());
+                Map<String, List<String>> subMap = hisConfigMap.get(result.getHisName()).get("");
                 if (subMap != null && subMap.size() > 0) {
                     for (String subKey : subMap.keySet()) {
                         ResultStaticKnowledge subResult = new ResultStaticKnowledge();
@@ -585,6 +583,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Drug.getKey());
         RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
@@ -696,7 +695,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
 
 
         // 已存在数据
-        Map<String, Map<String, List<Long>>> hisConfigMap = diseaseConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, List<String>>>> hisConfigMap
+                = mappingConfigFacade.groupByHisNameWithName(null, ConceptTypeEnum.Disease.getKey(), Long.valueOf(hospitalId));
+        //Map<String, Map<String, List<Long>>> hisConfigMap = diseaseConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
 
         //术语映射
         for (DiseaseConfig config : diseaseConfigList) {
@@ -713,7 +714,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             result.setHisName(config.getHisName());
 
             if (hisConfigMap.containsKey(result.getHisName())) {
-                Map<String, List<Long>> subMap = hisConfigMap.get(result.getHisName());
+                Map<String, List<String>> subMap = hisConfigMap.get(result.getHisName()).get("");
                 if (subMap != null && subMap.size() > 0) {
                     for (String subKey : subMap.keySet()) {
                         ResultStaticKnowledge subResult = new ResultStaticKnowledge();
@@ -741,6 +742,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Disease.getKey());
         RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
@@ -767,7 +769,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             infoList = Lists.newLinkedList();
         }
         List<String> diseaseStaticNames = infoList.stream()
-                .filter(i -> i.getLibName().equals(LexiconEnum.Disease.getKey()))
+                .filter(i -> i.getLibType().equals(LexiconEnum.Disease.getKey()))
                 .map(i -> i.getLibName())
                 .distinct()
                 .collect(Collectors.toList());
@@ -852,7 +854,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
 
 
         // 已存在数据
-        Map<String, Map<String, List<Long>>> hisConfigMap = operationConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
+        Map<String, Map<String, Map<String, List<String>>>> hisConfigMap
+                = mappingConfigFacade.groupByHisNameWithName(null, ConceptTypeEnum.Operation.getKey(), Long.valueOf(hospitalId));
+        //Map<String, Map<String, List<Long>>> hisConfigMap = operationConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
 
         //术语映射
         for (OperationConfig config : operationConfigList) {
@@ -869,7 +873,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
             result.setHisName(config.getHisName());
 
             if (hisConfigMap.containsKey(result.getHisName())) {
-                Map<String, List<Long>> subMap = hisConfigMap.get(result.getHisName());
+                Map<String, List<String>> subMap = hisConfigMap.get(result.getHisName()).get("");
                 if (subMap != null && subMap.size() > 0) {
                     for (String subKey : subMap.keySet()) {
                         ResultStaticKnowledge subResult = new ResultStaticKnowledge();
@@ -897,6 +901,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Operation.getKey());
         RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);

+ 87 - 31
cdssman-service/src/main/java/com/diagbot/facade/RuleTestFacade.java

@@ -1,6 +1,9 @@
 package com.diagbot.facade;
 
 import com.diagbot.aggregate.RuleTestAggregate;
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RuleDTO;
 import com.diagbot.entity.DiseaseConfig;
 import com.diagbot.entity.DrugConfig;
@@ -8,12 +11,18 @@ import com.diagbot.entity.LisConfig;
 import com.diagbot.entity.OperationConfig;
 import com.diagbot.entity.PacsConfig;
 import com.diagbot.entity.TransfusionConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.ConceptVO;
 import com.diagbot.vo.HospitalIdVO;
 import com.diagbot.vo.RuleTestVO;
 import com.diagbot.vo.RuleVO;
+import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -31,23 +40,15 @@ import java.util.stream.Collectors;
  */
 @Component
 public class RuleTestFacade {
+    @Autowired
+    private CdssCoreClient cdssCoreClient;
     @Autowired
     private RuleTestAggregate ruleTestAggregate;
     @Autowired
     private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
 
     @Autowired
-    private LisConfigFacade lisConfigFacade;
-    @Autowired
-    private PacsConfigFacade pacsConfigFacade;
-    @Autowired
-    private DrugConfigFacade drugConfigFacade;
-    @Autowired
-    private DiseaseConfigFacade diseaseConfigFacade;
-    @Autowired
-    private OperationConfigFacade operationConfigFacade;
-    @Autowired
-    private TransfusionConfigFacade transfusionConfigFacade;
+    private MappingConfigFacade mappingConfigFacade;
 
     @Autowired
     private KlRuleFacade klRuleFacade;
@@ -242,33 +243,88 @@ public class RuleTestFacade {
 
         List<RuleDTO> list = klRuleFacade.getRules(new RuleVO());
 
-        List<LisConfig> lisConfigList = lisConfigFacade.getListByHospitalId(hospitalId);
-        List<PacsConfig> pacsConfigList = pacsConfigFacade.getListByHospitalId(hospitalId);
-        List<DrugConfig> drugConfigList = drugConfigFacade.getListByHospitalId(hospitalId);
-        List<DiseaseConfig> diseaseConfigList = diseaseConfigFacade.getListByHospitalId(hospitalId);
-        List<OperationConfig> operationConfigList = operationConfigFacade.getListByHospitalId(hospitalId);
-        List<TransfusionConfig> transfusionConfigList = transfusionConfigFacade.getListByHospitalId(hospitalId);
+        List<MappingConfigWrapper> lisConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.LisPack.getKey());
+        List<MappingConfigWrapper> pacsConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.Pacs.getKey());
+        List<MappingConfigWrapper> drugConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.Drug.getKey());
+        List<MappingConfigWrapper> diseaseConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.Disease.getKey());
+        List<MappingConfigWrapper> operationConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.Operation.getKey());
+        List<MappingConfigWrapper> transfusionConfigList = mappingConfigFacade.getListByHospitalIdAndType(hospitalId, ConceptTypeEnum.Transfusion.getKey());
+
 
         //诊断映射关系
-        Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
+        Map<String, Map<String, Map<String, List<String>>>> diseaseConfigMap
+                = mappingConfigFacade.groupByUniqueNameWithName(null, ConceptTypeEnum.Disease.getKey(), hospitalId);
+        //Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
+
+        Map<String, List<Long>> usedMap = unUsedMappingFacade.usedConceptIds(list);
+
+        List<Long> lisIds = usedMap.get("lis");
+        List<Long> pacsIds = usedMap.get("pacs");
+        List<Long> diseaseIds = usedMap.get("disease");
+        List<Long> drugIds = usedMap.get("drug");
+        List<Long> operationIds = usedMap.get("operation");
+        List<Long> transfusionIds = usedMap.get("transfusion");
 
-        Map<String, List<String>> usedMap = unUsedMappingFacade.usedNames(list);
+        List<String> lisNames = Lists.newLinkedList();
+        List<String> pacsNames = Lists.newLinkedList();
+        List<String> diseaseNames = Lists.newLinkedList();
+        List<String> drugNames = Lists.newLinkedList();
+        List<String> operationNames = Lists.newLinkedList();
+        List<String> transfusionNames = Lists.newLinkedList();
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(-1);
+        conceptVO.setIds(lisIds);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            lisNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(pacsIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            pacsNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(diseaseIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            diseaseNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(drugIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            drugNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(pacsIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            pacsNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(operationIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            operationNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
+        conceptVO.setIds(transfusionIds);
+        respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (ListUtil.isNotEmpty(respDTO.data)) {
+            transfusionNames = respDTO.data.stream().map(IndexBatchDTO::getName).distinct().collect(Collectors.toList());
+        }
 
-        List<String> lisNames = usedMap.get("lis");
-        List<String> pacsNames = usedMap.get("pacs");
-        List<String> diseaseNames = usedMap.get("disease");
-        List<String> drugNames = usedMap.get("drug");
-        List<String> operationNames = usedMap.get("operation");
-        List<String> transfusionNames = usedMap.get("transfusion");
 
         diseaseNames.addAll(diseaseConfigMap.keySet().stream().filter(i -> i.contains("流产")).collect(Collectors.toList()));
 
-        List<LisConfig> unUsedLisConfigs = unUsedMappingFacade.unUsedMapping(lisConfigList, lisNames);
-        List<PacsConfig> unUsedPacsConfigs = unUsedMappingFacade.unUsedMapping(pacsConfigList, pacsNames);
-        List<DiseaseConfig> unUsedDiseaseConfigs = unUsedMappingFacade.unUsedMapping(diseaseConfigList, diseaseNames);
-        List<DrugConfig> unUsedDrugConfigs = unUsedMappingFacade.unUsedMapping(drugConfigList, drugNames);
-        List<OperationConfig> unUsedOperationConfig = unUsedMappingFacade.unUsedMapping(operationConfigList, operationNames);
-        List<TransfusionConfig> unUsedTransfusionConfigs = unUsedMappingFacade.unUsedMapping(transfusionConfigList, transfusionNames);
+        List<LisConfig> unUsedLisConfigs
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(lisConfigList, lisNames), LisConfig.class);
+        List<PacsConfig> unUsedPacsConfigs
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(pacsConfigList, pacsNames), PacsConfig.class);
+        List<DiseaseConfig> unUsedDiseaseConfigs
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(diseaseConfigList, diseaseNames), DiseaseConfig.class);
+        List<DrugConfig> unUsedDrugConfigs
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(drugConfigList, drugNames), DrugConfig.class);
+        List<OperationConfig> unUsedOperationConfig
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(operationConfigList, operationNames), OperationConfig.class);
+        List<TransfusionConfig> unUsedTransfusionConfigs
+                = BeanUtil.listCopyTo(unUsedMappingFacade.unUsedMapping(transfusionConfigList, transfusionNames), TransfusionConfig.class);
 
         String fileName = "规则未使用的映射关系.xls";
         Map<String, Map<Class<?>, List<?>>> map = new HashMap<>();

+ 29 - 0
cdssman-service/src/main/java/com/diagbot/facade/RunningInfoFacade.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.CaseInfo;
 import com.diagbot.entity.RunningInfo;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.StatusEnum;
 import com.diagbot.service.CaseInfoService;
 import com.diagbot.service.RunningInfoService;
 import com.diagbot.service.impl.RunningInfoServiceImpl;
@@ -12,6 +13,7 @@ import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.HospitalIdVO;
 import com.diagbot.vo.RunningInfoVO;
+import com.diagbot.vo.RunningStatusVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -21,6 +23,7 @@ import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -122,4 +125,30 @@ public class RunningInfoFacade extends RunningInfoServiceImpl {
         });
         return retMap;
     }
+
+
+    /**
+     * 自动化测试执行状态
+     *
+     * @param runningStatusVO
+     * @return
+     */
+    public Boolean getRunningStatus(RunningStatusVO runningStatusVO) {
+        List<CaseInfo> caseList = caseInfoService.list(new QueryWrapper<CaseInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("case_group", runningStatusVO.getCaseGroup()));
+        if (ListUtil.isEmpty(caseList)) {
+            return true;
+        }
+        List<Long> caseIds = caseList.stream().map(CaseInfo::getId).distinct().collect(Collectors.toList());
+        List<RunningInfo> list = runningInfoService.list(new QueryWrapper<RunningInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("case_id", caseIds)
+                .eq("status", StatusEnum.Enable.getKey()));
+        if (ListUtil.isEmpty(list)) {
+            return false;
+        } else {
+            return true;
+        }
+    }
 }

+ 0 - 605
cdssman-service/src/main/java/com/diagbot/facade/ScaleConfigFacade.java

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

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

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

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

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

+ 28 - 0
cdssman-service/src/main/java/com/diagbot/facade/TermMatchingFacade.java

@@ -0,0 +1,28 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.TermConceptDTO;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.TermMatchingVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-15 16:46
+ */
+@Component
+public class TermMatchingFacade {
+    @Autowired
+    CdssCoreClient cdssCoreClient;
+
+    public List<TermConceptDTO> getTermMatchingAll(TermMatchingVO termMatchingVO) {
+        RespDTO<List<TermConceptDTO>> termMatching = cdssCoreClient.getTermMatching(termMatchingVO);
+        RespDTOUtil.respNGDealCover(termMatching, "术语匹配搜索失败");
+        return termMatching.data;
+    }
+}

+ 0 - 604
cdssman-service/src/main/java/com/diagbot/facade/TransfusionConfigFacade.java

@@ -1,604 +0,0 @@
-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.HosRelationNumDTO;
-import com.diagbot.dto.IndexBatchDTO;
-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.UserUtils;
-import com.diagbot.vo.ConceptVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.HospitalIdVO;
-import com.diagbot.vo.IdListVO;
-import com.diagbot.vo.IdVO;
-import com.diagbot.vo.TransfusionConfigListVO;
-import com.diagbot.vo.TransfusionConfigPageVO;
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/9/1 11:03
- */
-@Component
-public class TransfusionConfigFacade {
-    @Autowired
-    private TransfusionConfigService transfusionConfigService;
-    @Autowired
-    private CdssCoreClient cdssCoreClient;
-
-    /**
-     * 判断是否已存在
-     *
-     * @param transfusionConfig
-     * @return
-     */
-    public Boolean isExistRecord(TransfusionConfig transfusionConfig) {
-        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", transfusionConfig.getHospitalId())
-                .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 userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-        transfusionConfig.setModifier(userId);
-        transfusionConfig.setGmtModified(now);
-        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", transfusionConfig.getHospitalId())
-                .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 userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //数据不完整的不保存
-        //过滤外部名称或公表名为空的数据
-        transfusionConfigList = transfusionConfigList
-                .stream()
-                .filter(i -> i.getHospitalId() != null)
-                .filter(i -> StringUtil.isNotBlank(i.getHisName()))
-                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(transfusionConfigList)) {
-            return false;
-        }
-
-        Long hospitalId = transfusionConfigList.get(0).getHospitalId();
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, List<Long>>> configMap
-                = getConfigMap(hospitalId, null, null);
-        transfusionConfigList.forEach(transfusionConfig -> {
-            transfusionConfig.setModifier(userId);
-            transfusionConfig.setGmtModified(now);
-            if (transfusionConfig.getId() == null) {
-                if (configMap.containsKey(transfusionConfig.getHisName())
-                        && ListUtil.isNotEmpty(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()))) {
-                    deleteIds.addAll(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()));
-                }
-                transfusionConfig.setCreator(userId);
-                transfusionConfig.setGmtCreate(now);
-            }
-            if (transfusionConfig.getIsDeleted() == null) {
-                transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-            }
-        });
-        //删除已存在映射关系
-        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) {
-        return transfusionConfigService.getPage(transfusionConfigPageVO);
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param file
-     * @param hospitalIdVO
-     */
-    public void importExcel(MultipartFile file, HospitalIdVO hospitalIdVO) {
-        List<TransfusionConfig> transfusionConfigList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
-        if (ListUtil.isNotEmpty(transfusionConfigList)) {
-            importExcelRecords(transfusionConfigList, hospitalIdVO);
-        } else {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-    }
-
-    /**
-     * 数据导入
-     *
-     * @param transfusionConfigList
-     * @return
-     */
-    public Boolean importExcelRecords(List<TransfusionConfig> transfusionConfigList, HospitalIdVO hospitalIdVO) {
-        Long hospitalId = hospitalIdVO.getHospitalId();
-        String userId = UserUtils.getCurrentPrincipleID();
-        Date now = DateUtil.now();
-
-        //1、数据完整性校验
-        //2、去除前后空格
-        //过滤空数据,保留重复数据,方便计行
-        transfusionConfigList = transfusionConfigList.stream()
-                .filter(TransfusionConfig::nonNull)
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(transfusionConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        transfusionConfigList.forEach(transfusionConfig -> {
-            transfusionConfig.setHospitalId(hospitalIdVO.getHospitalId());
-        });
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < transfusionConfigList.size(); i++) {
-            if (StringUtil.isBlank(transfusionConfigList.get(i).getHisName())
-                    || 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的更新
-        synchronized (this) {
-            List<Long> deleteIds = Lists.newLinkedList();
-            Map<String, Map<String, List<Long>>> configMap
-                    = getConfigMap(Long.valueOf(hospitalId), null, null);
-            transfusionConfigList.forEach(transfusionConfig -> {
-                transfusionConfig.setHospitalId(Long.valueOf(hospitalId));
-                transfusionConfig.setModifier(userId);
-                transfusionConfig.setGmtModified(now);
-                if (transfusionConfig.getId() == null) {
-                    if (configMap.containsKey(transfusionConfig.getHisName())
-                            && ListUtil.isNotEmpty(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()))) {
-                        deleteIds.addAll(configMap.get(transfusionConfig.getHisName()).get(transfusionConfig.getUniqueName()));
-                    }
-                    transfusionConfig.setCreator(userId);
-                    transfusionConfig.setGmtCreate(now);
-                }
-                if (transfusionConfig.getIsDeleted() == null) {
-                    transfusionConfig.setIsDeleted(IsDeleteEnum.N.getKey());
-                }
-            });
-
-            //标准术语校验
-            List<String> errorNumList = Lists.newLinkedList();
-            List<String> uniqueNames = transfusionConfigList.stream()
-                    .map(i -> i.getUniqueName())
-                    .distinct()
-                    .collect(Collectors.toList());
-            ConceptVO conceptVO = new ConceptVO();
-            conceptVO.setNames(uniqueNames);
-            conceptVO.setType(ConceptTypeEnum.Transfusion.getKey());
-            RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-            List<String> names = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-            for (int i = 0; i < transfusionConfigList.size(); i++) {
-                if (!names.contains(transfusionConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            }
-            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, List<Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<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())) {
-                Map<String, List<TransfusionConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "uniqueName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<TransfusionConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, List<Long>>> getUniqueConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
-        QueryWrapper<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, "uniqueName");
-        for (Map.Entry<String, List<TransfusionConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, List<TransfusionConfig>> subMap = EntityUtil.makeEntityListMap(entry.getValue(), "hisName");
-                Map<String, List<Long>> subIdMap = new HashMap<>();
-                for (Map.Entry<String, List<TransfusionConfig>> subEntry : subMap.entrySet()) {
-                    subIdMap.put(subEntry.getKey(), subEntry.getValue().stream().map(i -> i.getId()).distinct().collect(Collectors.toList()));
-                }
-                retMap.put(entry.getKey(), subIdMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 数据导出
-     *
-     * @param response
-     * @param hospitalIdVO
-     */
-    public void exportExcel(HttpServletResponse response, HospitalIdVO hospitalIdVO) {
-        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalIdVO.getHospitalId())
-                .orderByDesc("gmt_modified");
-        List<TransfusionConfig> records = transfusionConfigService.list(queryWrapper);
-        String fileName = "输血映射.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(HosRelationNumPageVO hosRelationNumPageVO) {
-        return transfusionConfigService.getRelationNumPage(hosRelationNumPageVO);
-    }
-
-    /**
-     * 数据导入模板导出
-     *
-     * @param response
-     */
-    public void exportExcelModule(HttpServletResponse response) {
-        String fileName = "输血映射模板.xls";
-        ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据预匹配
-     *
-     * @param file
-     * @param response
-     */
-    public void precDataMatch(MultipartFile file, HttpServletResponse response) {
-        List<TransfusionConfig> originList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
-        List<TransfusionConfig> retList = dataProcess(originList);
-
-        String fileName = "输血关联数据(预匹配).xls";
-        ExcelUtils.exportExcel(retList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
-    }
-
-    /**
-     * 导入数据验证
-     *
-     * @param file
-     * @return
-     */
-    public Boolean dataVerify(MultipartFile file) {
-        List<TransfusionConfig> originList = ExcelUtils.importExcel(file, 0, 1, TransfusionConfig.class);
-        List<TransfusionConfig> retList = dataProcess(originList);
-        return true;
-    }
-
-    /**
-     * 数据处理
-     *
-     * @param originList
-     * @return
-     */
-    public List<TransfusionConfig> dataProcess(List<TransfusionConfig> originList) {
-        List<TransfusionConfig> retList = Lists.newLinkedList();
-        List<String> hisNameList = originList.stream().map(i -> i.getHisName()).distinct().collect(Collectors.toList());
-        Map<String, List<TransfusionConfig>> allMap = getAll(hisNameList);
-
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空行
-        originList = originList.stream().filter(TransfusionConfig::nonNull).collect(Collectors.toList());
-        if (ListUtil.isEmpty(originList)) {
-            return retList;
-        }
-        //去除空格
-        originList.forEach(item -> {
-            item.setHisName(item.getHisName().trim());
-        });
-
-        //获取标准术语
-        List<String> precUniqueName = Lists.newArrayList();
-        if (allMap != null) {
-            for (Map.Entry<String, List<TransfusionConfig>> entry : allMap.entrySet()) {
-                if (ListUtil.isNotEmpty(entry.getValue())) {
-                    precUniqueName.addAll(entry.getValue().stream().map(i -> i.getUniqueName()).collect(Collectors.toList()));
-                }
-            }
-        }
-        precUniqueName = precUniqueName.stream().distinct().collect(Collectors.toList());
-
-        ConceptVO conceptVO = new ConceptVO();
-        conceptVO.setNames(precUniqueName);
-        conceptVO.setType(ConceptTypeEnum.Transfusion.getKey());
-        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data.stream().map(IndexBatchDTO::getName).collect(Collectors.toList());
-        if (ListUtil.isNotEmpty(originList)) {
-            for (TransfusionConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<TransfusionConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (TransfusionConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            retList.add(item);
-                            flag = true;
-                        }
-                    }
-                    if (!flag) {
-                        retList.add(originItem);
-                    }
-                } else {
-                    retList.add(originItem);
-                }
-            }
-        }
-
-        retList = retList.stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        return retList;
-    }
-
-    /**
-     * 获取所有医院映射数据
-     *
-     * @return
-     */
-    public Map<String, List<TransfusionConfig>> getAll(List<String> hisNameList) {
-        Map<String, List<TransfusionConfig>> retMap = new HashMap<>();
-        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
-        if (ListUtil.isNotEmpty(hisNameList)) {
-            queryWrapper.in("his_name", hisNameList);
-        }
-        List<TransfusionConfig> records = transfusionConfigService.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        records.forEach(record -> {
-            record.setHospitalId(null);
-            record.setId(null);
-            record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
-        });
-
-        records = records
-                .stream()
-                .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
-                .distinct()
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        retMap = EntityUtil.makeEntityListMap(records, "hisName");
-
-        return retMap;
-    }
-
-    /**
-     * 查找指定医院映射关系
-     *
-     * @param hospitalId
-     * @return
-     */
-    public List<TransfusionConfig> getListByHospitalId(Long hospitalId) {
-        QueryWrapper<TransfusionConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        return transfusionConfigService.list(queryWrapper);
-    }
-}

+ 115 - 6
cdssman-service/src/main/java/com/diagbot/facade/UnUsedMappingFacade.java

@@ -1,17 +1,12 @@
 
 package com.diagbot.facade;
 
-import com.alibaba.fastjson.JSONObject;
 import com.diagbot.dto.MedClassMedDTO;
 import com.diagbot.dto.RuleDTO;
-import com.diagbot.entity.ResultRule;
-import com.diagbot.enums.GraphLabelEnum;
 import com.diagbot.enums.LexiconEnum;
-import com.diagbot.enums.StatusEnum;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.util.StringUtil;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -19,7 +14,6 @@ import org.springframework.stereotype.Component;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.stream.Collectors;
 
 
@@ -59,6 +53,7 @@ public class UnUsedMappingFacade {
 
     /**
      * 规则包含术语
+     *
      * @param list
      * @return
      */
@@ -169,4 +164,118 @@ public class UnUsedMappingFacade {
         retMap.put("transfusion", transfusionNames);
         return retMap;
     }
+
+    /**
+     * 规则包含术语
+     *
+     * @param list
+     * @return
+     */
+    public Map<String, List<Long>> usedConceptIds(List<RuleDTO> list) {
+        Map<String, List<Long>> retMap = new HashMap<>();
+
+        if (ListUtil.isEmpty(list)) {
+            return retMap;
+        }
+        List<Long> lisIds = list.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.LisName.getKey()) || i.getRuleLibType().equals(LexiconEnum.LisSubName.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        lisIds.addAll(list.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.LisName.getKey()) || i.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        lisIds = lisIds.stream().distinct().collect(Collectors.toList());
+
+        List<Long> pacsIds = list.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.PacsName.getKey()) || i.getRuleLibType().equals(LexiconEnum.PacsSubName.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        pacsIds.addAll(list.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.PacsName.getKey()) || i.getRuleBaseLibType().equals(LexiconEnum.PacsSubName.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        pacsIds = pacsIds.stream().distinct().collect(Collectors.toList());
+
+        List<Long> diseaseIds = list.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.Disease.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        diseaseIds.addAll(list.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        diseaseIds = diseaseIds.stream().distinct().collect(Collectors.toList());
+
+        //药品分类转换
+        List<MedClassMedDTO> medClassMedList = klRelationFacade.getMedClassMedList();
+        Map<String, List<String>> medClassMedMap =
+                medClassMedList.stream().collect(Collectors.groupingBy(MedClassMedDTO::getMedClassLibName,
+                        HashMap::new,
+                        Collectors.mapping(MedClassMedDTO::getMedLibName, Collectors.toList())));
+        List<RuleDTO> medList = Lists.newLinkedList();
+        for (RuleDTO result : list) {
+            if (result.getHasSubCond() != null && result.getHasSubCond().equals(1)) {
+                if (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
+                        || result.getRuleBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
+                        || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())) {
+                    List<String> medicines = medClassMedMap.get(result.getRuleBaseLibName());
+                    if (ListUtil.isNotEmpty(medicines)) {
+                        for (String med : medicines) {
+                            RuleDTO medResult = new RuleDTO();
+                            BeanUtil.copyProperties(result, medResult);
+                            medResult.setRuleBaseLibName(med);
+                            medResult.setRuleBaseLibType(LexiconEnum.Medicine.getKey());
+                            medResult.setRuleBaseLibTypeName(LexiconEnum.Medicine.getName());
+                            medList.add(medResult);
+                        }
+                    } else {
+                        medList.add(result);
+                    }
+                } else {
+                    medList.add(result);
+                }
+            } else {
+                medList.add(result);
+            }
+        }
+
+        List<Long> drugIds = medList.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.Medicine.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        drugIds.addAll(medList.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.Medicine.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        drugIds = drugIds.stream().distinct().collect(Collectors.toList());
+
+        List<Long> operationIds = list.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.Operation.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        operationIds.addAll(list.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.Operation.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        operationIds = operationIds.stream().distinct().collect(Collectors.toList());
+
+        List<Long> transfusionIds = list.stream()
+                .filter(i -> i.getRuleLibType().equals(LexiconEnum.Transfusion.getKey()))
+                .map(RuleDTO::getRuleConceptId)
+                .collect(Collectors.toList());
+        transfusionIds.addAll(list.stream()
+                .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1) && (i.getRuleBaseLibType().equals(LexiconEnum.Transfusion.getKey())))
+                .map(RuleDTO::getRuleBaseConceptId)
+                .collect(Collectors.toList()));
+        transfusionIds = transfusionIds.stream().distinct().collect(Collectors.toList());
+
+        retMap.put("lis", lisIds);
+        retMap.put("pacs", pacsIds);
+        retMap.put("disease", diseaseIds);
+        retMap.put("drug", drugIds);
+        retMap.put("operation", operationIds);
+        retMap.put("transfusion", transfusionIds);
+        return retMap;
+    }
 }

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

@@ -1,35 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DeptConfig;
-import com.diagbot.vo.DeptConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 科室映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-08-12
- */
-public interface DeptConfigMapper extends BaseMapper<DeptConfig> {
-    /**
-     * 分页查询
-     *
-     * @param deptConfigPageVO
-     * @return
-     */
-    IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

+ 0 - 36
cdssman-service/src/main/java/com/diagbot/mapper/DiseaseConfigMapper.java

@@ -1,36 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DiseaseConfig;
-import com.diagbot.vo.DiseaseConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 诊断映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface DiseaseConfigMapper extends BaseMapper<DiseaseConfig> {
-
-    /**
-     * 分页查询
-     *
-     * @param diseaseConfigPageVO
-     * @return
-     */
-    IPage<DiseaseConfig> getPage(@Param("diseaseConfigPageVO") DiseaseConfigPageVO diseaseConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DrugConfig;
-import com.diagbot.vo.DrugConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 药品映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface DrugConfigMapper extends BaseMapper<DrugConfig> {
-    /**
-     * 分页查询
-     *
-     * @param drugConfigPageVO
-     * @return
-     */
-    IPage<DrugConfig> getPage(@Param("drugConfigPageVO") DrugConfigPageVO drugConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnoseBaseRelation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 基础规则关联表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-07-15
+ */
+public interface KlDiagnoseBaseRelationMapper extends BaseMapper<KlDiagnoseBaseRelation> {
+
+}

+ 0 - 36
cdssman-service/src/main/java/com/diagbot/mapper/LisConfigMapper.java

@@ -1,36 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.LisConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.LisConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 化验公表映射 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface LisConfigMapper extends BaseMapper<LisConfig> {
-
-    /**
-     * 分页查询
-     *
-     * @param lisConfigPageVO
-     * @return
-     */
-    IPage<LisConfig> getPage(@Param("lisConfigPageVO") LisConfigPageVO lisConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

+ 15 - 0
cdssman-service/src/main/java/com/diagbot/mapper/MappingConfigMapper.java

@@ -0,0 +1,15 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.MappingConfig;
+
+/**
+ * <p>
+ * 医学术语映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+public interface MappingConfigMapper extends BaseMapper<MappingConfig> {
+}

+ 0 - 36
cdssman-service/src/main/java/com/diagbot/mapper/NurseConfigMapper.java

@@ -1,36 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.NurseConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.NurseConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 护理映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2021-04-26
- */
-public interface NurseConfigMapper extends BaseMapper<NurseConfig> {
-    /**
-     * 分页查询
-     *
-     * @param nurseConfigPageVO
-     * @return
-     */
-    IPage<NurseConfig> getPage(@Param("nurseConfigPageVO") NurseConfigPageVO nurseConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.OperationConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 手术映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface OperationConfigMapper extends BaseMapper<OperationConfig> {
-    /**
-     * 分页查询
-     *
-     * @param operationConfigPageVO
-     * @return
-     */
-    IPage<OperationConfig> getPage(@Param("operationConfigPageVO") OperationConfigPageVO operationConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.PacsConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.PacsConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 检查公表映射 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface PacsConfigMapper extends BaseMapper<PacsConfig> {
-    /**
-     * 分页查询
-     *
-     * @param pacsConfigPageVO
-     * @return
-     */
-    IPage<PacsConfig> getPage(@Param("pacsConfigPageVO") PacsConfigPageVO pacsConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

+ 0 - 37
cdssman-service/src/main/java/com/diagbot/mapper/ScaleConfigMapper.java

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

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

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

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

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

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

@@ -1,35 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.TransfusionConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-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);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DeptConfig;
-import com.diagbot.vo.DeptConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 科室映射表 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-08-12
- */
-public interface DeptConfigService extends IService<DeptConfig> {
-    /**
-     * 分页查询
-     *
-     * @param deptConfigPageVO
-     * @return
-     */
-    IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DiseaseConfig;
-import com.diagbot.vo.DiseaseConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 诊断映射表 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface DiseaseConfigService extends IService<DiseaseConfig> {
-    /**
-     * 分页查询
-     *
-     * @param diseaseConfigPageVO
-     * @return
-     */
-    IPage<DiseaseConfig> getPage(@Param("diseaseConfigPageVO") DiseaseConfigPageVO diseaseConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DrugConfig;
-import com.diagbot.vo.DrugConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 药品映射表 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface DrugConfigService extends IService<DrugConfig> {
-    /**
-     * 分页查询
-     *
-     * @param drugConfigPageVO
-     * @return
-     */
-    IPage<DrugConfig> getPage(@Param("drugConfigPageVO") DrugConfigPageVO drugConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnoseBaseRelation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 基础规则关联表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-07-15
+ */
+public interface KlDiagnoseBaseRelationService extends IService<KlDiagnoseBaseRelation> {
+
+}

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

@@ -1,36 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.LisConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.LisConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 化验公表映射 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface LisConfigService extends IService<LisConfig> {
-
-    /**
-     * 分页查询
-     *
-     * @param lisConfigPageVO
-     * @return
-     */
-    IPage<LisConfig> getPage(@Param("lisConfigPageVO") LisConfigPageVO lisConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -0,0 +1,15 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.MappingConfig;
+
+/**
+ * <p>
+ * 医学术语映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+public interface MappingConfigService extends IService<MappingConfig> {
+}

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

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

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.OperationConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 手术映射表 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface OperationConfigService extends IService<OperationConfig> {
-    /**
-     * 分页查询
-     *
-     * @param operationConfigPageVO
-     * @return
-     */
-    IPage<OperationConfig> getPage(@Param("operationConfigPageVO") OperationConfigPageVO operationConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.PacsConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.PacsConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * <p>
- * 检查公表映射 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface PacsConfigService extends IService<PacsConfig> {
-    /**
-     * 分页查询
-     *
-     * @param pacsConfigPageVO
-     * @return
-     */
-    IPage<PacsConfig> getPage(@Param("pacsConfigPageVO") PacsConfigPageVO pacsConfigPageVO);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

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

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

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

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

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

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

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

@@ -1,35 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.TransfusionConfig;
-import com.diagbot.vo.HosRelationNumPageVO;
-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);
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO);
-}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/DeptConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DeptConfig;
-import com.diagbot.mapper.DeptConfigMapper;
-import com.diagbot.service.DeptConfigService;
-import com.diagbot.vo.DeptConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 科室映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-08-12
- */
-@Service
-public class DeptConfigServiceImpl extends ServiceImpl<DeptConfigMapper, DeptConfig> implements DeptConfigService {
-    /**
-     * 分页查询
-     *
-     * @param deptConfigPageVO
-     * @return
-     */
-    public IPage<DeptConfig> getPage(@Param("deptConfigPageVO") DeptConfigPageVO deptConfigPageVO) {
-        return baseMapper.getPage(deptConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/DiseaseConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DiseaseConfig;
-import com.diagbot.mapper.DiseaseConfigMapper;
-import com.diagbot.service.DiseaseConfigService;
-import com.diagbot.vo.DiseaseConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 诊断映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-public class DiseaseConfigServiceImpl extends ServiceImpl<DiseaseConfigMapper, DiseaseConfig> implements DiseaseConfigService {
-    /**
-     * 分页查询
-     *
-     * @param diseaseConfigPageVO
-     * @return
-     */
-    public IPage<DiseaseConfig> getPage(@Param("diseaseConfigPageVO") DiseaseConfigPageVO diseaseConfigPageVO){
-        return baseMapper.getPage(diseaseConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/DrugConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.DrugConfig;
-import com.diagbot.mapper.DrugConfigMapper;
-import com.diagbot.service.DrugConfigService;
-import com.diagbot.vo.DrugConfigPageVO;
-import com.diagbot.vo.HosRelationNumPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 药品映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-public class DrugConfigServiceImpl extends ServiceImpl<DrugConfigMapper, DrugConfig> implements DrugConfigService {
-    /**
-     * 分页查询
-     *
-     * @param drugConfigPageVO
-     * @return
-     */
-    public IPage<DrugConfig> getPage(@Param("drugConfigPageVO") DrugConfigPageVO drugConfigPageVO){
-        return baseMapper.getPage(drugConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlDiagnoseBaseRelation;
+import com.diagbot.mapper.KlDiagnoseBaseRelationMapper;
+import com.diagbot.service.KlDiagnoseBaseRelationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 基础规则关联表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-07-15
+ */
+@Service
+public class KlDiagnoseBaseRelationServiceImpl extends ServiceImpl<KlDiagnoseBaseRelationMapper, KlDiagnoseBaseRelation> implements KlDiagnoseBaseRelationService {
+
+}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/LisConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.LisConfig;
-import com.diagbot.mapper.LisConfigMapper;
-import com.diagbot.service.LisConfigService;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.LisConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 化验公表映射 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-public class LisConfigServiceImpl extends ServiceImpl<LisConfigMapper, LisConfig> implements LisConfigService {
-    /**
-     * 分页查询
-     *
-     * @param lisConfigPageVO
-     * @return
-     */
-    public IPage<LisConfig> getPage(@Param("lisConfigPageVO") LisConfigPageVO lisConfigPageVO) {
-        return baseMapper.getPage(lisConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

+ 19 - 0
cdssman-service/src/main/java/com/diagbot/service/impl/MappingConfigServiceImpl.java

@@ -0,0 +1,19 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.mapper.MappingConfigMapper;
+import com.diagbot.service.MappingConfigService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 医学术语映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+@Service
+public class MappingConfigServiceImpl extends ServiceImpl<MappingConfigMapper, MappingConfig> implements MappingConfigService {
+}

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

@@ -1,45 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.NurseConfig;
-import com.diagbot.mapper.NurseConfigMapper;
-import com.diagbot.service.NurseConfigService;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.NurseConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 护理映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2021-04-26
- */
-@Service
-public class NurseConfigServiceImpl extends ServiceImpl<NurseConfigMapper, NurseConfig> implements NurseConfigService {
-    /**
-     * 分页查询
-     *
-     * @param nurseConfigPageVO
-     * @return
-     */
-    @Override
-    public IPage<NurseConfig> getPage(@Param("nurseConfigPageVO") NurseConfigPageVO nurseConfigPageVO) {
-        return baseMapper.getPage(nurseConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    @Override
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/OperationConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.mapper.OperationConfigMapper;
-import com.diagbot.service.OperationConfigService;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.OperationConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 手术映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-public class OperationConfigServiceImpl extends ServiceImpl<OperationConfigMapper, OperationConfig> implements OperationConfigService {
-    /**
-     * 分页查询
-     *
-     * @param operationConfigPageVO
-     * @return
-     */
-    public IPage<OperationConfig> getPage(@Param("operationConfigPageVO") OperationConfigPageVO operationConfigPageVO){
-        return baseMapper.getPage(operationConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

+ 0 - 43
cdssman-service/src/main/java/com/diagbot/service/impl/PacsConfigServiceImpl.java

@@ -1,43 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.dto.HosRelationNumDTO;
-import com.diagbot.entity.PacsConfig;
-import com.diagbot.mapper.PacsConfigMapper;
-import com.diagbot.service.PacsConfigService;
-import com.diagbot.vo.HosRelationNumPageVO;
-import com.diagbot.vo.PacsConfigPageVO;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 检查公表映射 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-public class PacsConfigServiceImpl extends ServiceImpl<PacsConfigMapper, PacsConfig> implements PacsConfigService {
-    /**
-     * 分页查询
-     *
-     * @param pacsConfigPageVO
-     * @return
-     */
-    public IPage<PacsConfig> getPage(@Param("pacsConfigPageVO") PacsConfigPageVO pacsConfigPageVO) {
-        return baseMapper.getPage(pacsConfigPageVO);
-    }
-
-    /**
-     * 各医院映射关系数列表
-     *
-     * @param hosRelationNumPageVO
-     * @return
-     */
-    public IPage<HosRelationNumDTO> getRelationNumPage(@Param("hosRelationNumPageVO") HosRelationNumPageVO hosRelationNumPageVO) {
-        return baseMapper.getRelationNumPage(hosRelationNumPageVO);
-    }
-}

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

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

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

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

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

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

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


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