Procházet zdrojové kódy

Merge branch 'dev/mapping20210603' into debug

kongwz před 4 roky
rodič
revize
37966a2b76
100 změnil soubory, kde provedl 6116 přidání a 3982 odebrání
  1. 13 2
      cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java
  2. 162 0
      cdssman-service/src/main/java/com/diagbot/client/CdssClient.java
  3. 18 12
      cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java
  4. 17 3
      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. 4 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. 18 0
      cdssman-service/src/main/java/com/diagbot/dto/ExportConceptAllDTO.java
  11. 27 0
      cdssman-service/src/main/java/com/diagbot/dto/ExportConceptModeDTO.java
  12. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/IndexBatchDTO.java
  13. 27 8
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptAllDTO.java
  14. 107 0
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptScaleDTO.java
  15. 35 0
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptSimDTO.java
  16. 4 0
      cdssman-service/src/main/java/com/diagbot/dto/KlConceptStaticDTO.java
  17. 4 2
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseByIdDTO.java
  18. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseLibNameDTO.java
  19. 151 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDiseaseDTO.java
  20. 26 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugDTO.java
  21. 26 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugExportDTO.java
  22. 95 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugMappingDTO.java
  23. 135 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDrugRegisterDTO.java
  24. 78 0
      cdssman-service/src/main/java/com/diagbot/dto/KlLisDTO.java
  25. 33 0
      cdssman-service/src/main/java/com/diagbot/dto/KlOperationDTO.java
  26. 63 0
      cdssman-service/src/main/java/com/diagbot/dto/KlPacsDTO.java
  27. 48 0
      cdssman-service/src/main/java/com/diagbot/dto/KlScaleByIdDTO.java
  28. 89 0
      cdssman-service/src/main/java/com/diagbot/dto/KlSymptomDTO.java
  29. 27 0
      cdssman-service/src/main/java/com/diagbot/dto/KlTcmDiseaseDTO.java
  30. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/KlTcmSyndromeDTO.java
  31. 40 0
      cdssman-service/src/main/java/com/diagbot/dto/KlVitalResultDTO.java
  32. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/LisDetailDTO.java
  33. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/NurseInfoDTO.java
  34. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/OperationInfoDTO.java
  35. 27 0
      cdssman-service/src/main/java/com/diagbot/dto/RegulationIndexDTO.java
  36. 17 0
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalConceptDTO.java
  37. 52 22
      cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java
  38. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/ScaleInfoDTO.java
  39. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java
  40. 23 0
      cdssman-service/src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java
  41. 19 0
      cdssman-service/src/main/java/com/diagbot/dto/TermConceptDTO.java
  42. 47 0
      cdssman-service/src/main/java/com/diagbot/entity/AnesthesiaConfig.java
  43. 20 0
      cdssman-service/src/main/java/com/diagbot/entity/CommonParam.java
  44. 34 109
      cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java
  45. 34 94
      cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java
  46. 33 104
      cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java
  47. 19 0
      cdssman-service/src/main/java/com/diagbot/entity/Ex.java
  48. 153 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDiagnoseBaseRelation.java
  49. 119 89
      cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java
  50. 73 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDrugMapping.java
  51. 301 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDrugRegister.java
  52. 34 78
      cdssman-service/src/main/java/com/diagbot/entity/KlLis.java
  53. 75 0
      cdssman-service/src/main/java/com/diagbot/entity/KlOperation.java
  54. 128 0
      cdssman-service/src/main/java/com/diagbot/entity/KlPacs.java
  55. 118 0
      cdssman-service/src/main/java/com/diagbot/entity/KlSymptom.java
  56. 69 0
      cdssman-service/src/main/java/com/diagbot/entity/KlTcmDisease.java
  57. 68 0
      cdssman-service/src/main/java/com/diagbot/entity/KlTcmSyndrome.java
  58. 75 0
      cdssman-service/src/main/java/com/diagbot/entity/KlVitalResult.java
  59. 33 104
      cdssman-service/src/main/java/com/diagbot/entity/LisConfig.java
  60. 300 0
      cdssman-service/src/main/java/com/diagbot/entity/MappingConfig.java
  61. 134 0
      cdssman-service/src/main/java/com/diagbot/entity/NurseConfig.java
  62. 33 94
      cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java
  63. 31 91
      cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java
  64. 28 91
      cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java
  65. 135 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmdiseaseConfig.java
  66. 135 0
      cdssman-service/src/main/java/com/diagbot/entity/TcmsyndromeConfig.java
  67. 32 94
      cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java
  68. 19 0
      cdssman-service/src/main/java/com/diagbot/entity/wrapper/KlScaleDetailWrapper.java
  69. 49 0
      cdssman-service/src/main/java/com/diagbot/entity/wrapper/MappingConfigWrapper.java
  70. 8 1
      cdssman-service/src/main/java/com/diagbot/enums/ConceptTypeEnum.java
  71. 50 0
      cdssman-service/src/main/java/com/diagbot/enums/InsertOrUpdateEnum.java
  72. 5 0
      cdssman-service/src/main/java/com/diagbot/enums/LexiconEnum.java
  73. 66 0
      cdssman-service/src/main/java/com/diagbot/enums/MatchSourceEnum.java
  74. 6 1
      cdssman-service/src/main/java/com/diagbot/enums/RelationLibTypeEnum.java
  75. 0 577
      cdssman-service/src/main/java/com/diagbot/facade/DeptConfigFacade.java
  76. 0 588
      cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java
  77. 0 847
      cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java
  78. 8 73
      cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java
  79. 191 37
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java
  80. 16 0
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptStaticFacade.java
  81. 13 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDiagnoseBaseRelationFacade.java
  82. 64 53
      cdssman-service/src/main/java/com/diagbot/facade/KlDiseaseFacade.java
  83. 47 49
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugFacade.java
  84. 51 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugMappingFacade.java
  85. 284 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDrugRegisterFacade.java
  86. 5 0
      cdssman-service/src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java
  87. 44 1
      cdssman-service/src/main/java/com/diagbot/facade/KlLisFacade.java
  88. 62 0
      cdssman-service/src/main/java/com/diagbot/facade/KlOperationFacade.java
  89. 70 0
      cdssman-service/src/main/java/com/diagbot/facade/KlPacsFacade.java
  90. 29 0
      cdssman-service/src/main/java/com/diagbot/facade/KlRegulationFacade.java
  91. 216 26
      cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java
  92. 95 0
      cdssman-service/src/main/java/com/diagbot/facade/KlSymptomFacade.java
  93. 57 0
      cdssman-service/src/main/java/com/diagbot/facade/KlTcmDiseaseFacade.java
  94. 57 0
      cdssman-service/src/main/java/com/diagbot/facade/KlTcmSyndromeFacade.java
  95. 63 0
      cdssman-service/src/main/java/com/diagbot/facade/KlVitalResFacade.java
  96. 0 705
      cdssman-service/src/main/java/com/diagbot/facade/LisConfigFacade.java
  97. 627 0
      cdssman-service/src/main/java/com/diagbot/facade/MappingConfigFacade.java
  98. 25 26
      cdssman-service/src/main/java/com/diagbot/facade/MedRuleConvertFacade.java
  99. 1 1
      cdssman-service/src/main/java/com/diagbot/facade/MedSearchDataFacade.java
  100. 0 0
      cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java

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

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

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

+ 18 - 12
cdssman-service/src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -1,30 +1,27 @@
 package com.diagbot.client;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.diagbot.annotation.SysLogger;
 import com.diagbot.client.hystrix.CdssCoreHystrix;
 import com.diagbot.dto.DiagnosesFindDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
 import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.dto.KlRuleByIdParDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
+import com.diagbot.dto.RegulationIndexDTO;
 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.enums.StatusEnum;
 import com.diagbot.vo.*;
-import io.swagger.annotations.ApiOperation;
 import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -62,7 +59,7 @@ public interface CdssCoreClient {
      * @return
      */
     @PostMapping("/retrieval/getConceptNames")
-    RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
+    RespDTO<List<IndexBatchDTO>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO);
 
     /**
      * 化验大项、化验小项、辅检、诊断、药品、手术等检索
@@ -137,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);
 
@@ -165,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);
 
@@ -186,13 +184,14 @@ public interface CdssCoreClient {
 
     /**
      * 重新加载医学知识库中的所有去重的基础诊断依据
+     *
      * @return
      */
     @PostMapping("/cache/reloadDiagnose")
     RespDTO<Boolean> reloadDiagnose();
 
 
-   //分页获取诊断依据维护列表
+    //分页获取诊断依据维护列表
     @PostMapping("/klDiagnose/getKlDiagnosePage")
     public RespDTO<Page<KlDiagnoseInfoDTO>> getDiagnosePages(@RequestBody KlDiagnoseInfoVO klRuleInfoVO);
 
@@ -202,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")
@@ -218,4 +217,11 @@ 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);
+
 }

+ 17 - 3
cdssman-service/src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -1,20 +1,22 @@
 package com.diagbot.client.hystrix;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.dto.DiagnosesFindDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
 import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.dto.KlRuleByIdParDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
+import com.diagbot.dto.RegulationIndexDTO;
 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;
@@ -64,7 +66,7 @@ public class CdssCoreHystrix implements CdssCoreClient {
      * @return
      */
     @Override
-    public RespDTO<List<String>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
+    public RespDTO<List<IndexBatchDTO>> getConceptNames(@Valid @RequestBody ConceptVO conceptVO) {
         log.error("【hystrix】调用{}异常", "getConceptNames");
         return null;
     }
@@ -284,4 +286,16 @@ public class CdssCoreHystrix implements CdssCoreClient {
         log.error("【hystrix】调用{}异常", "findDiaNameAll");
         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();
+    }
+}*/

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

@@ -22,4 +22,8 @@ public class ConceptMappingDTO {
     private Integer operationNum = 0;
     private Integer transfusionNum = 0;
     private Integer scaleNum = 0;
+    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;
     /**
      * 药品名称
      */

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

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

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

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

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

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

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

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

+ 107 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlConceptScaleDTO.java

@@ -0,0 +1,107 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-25 10:00
+ */
+@Setter
+@Getter
+public class KlConceptScaleDTO {
+
+    private Long id;
+
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * -1:表示顶级,其他值表示上级菜单的id
+     */
+    private Long parentId;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 编码
+     */
+    private String ruleCode;
+
+    /**
+     * 扣分
+     */
+    private BigDecimal score;
+
+    /**
+     * 系数
+     */
+    private BigDecimal factor;
+
+    /**
+     * 常数
+     */
+    private BigDecimal constant;
+
+    /**
+     * 11表格;12文本;21标题;31算分;32显示选择结果
+     */
+    private Integer textType;
+    /**
+     * 结果类型(1算分;2显示选择结果)
+     */
+    private Integer resultType;
+    /**
+     * 选择类型(1单选2多选)
+     */
+    private Integer selectType;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNo;
+
+    /**
+     * 1:显示,0:不显示,2隐藏
+     */
+    private Integer status;
+
+    /**
+     * 组别互斥(同组互斥)
+     */
+    private Integer groupNum;
+
+    /**
+     * 结果
+     */
+    private String result;
+
+    /**
+     * 推送信息
+     */
+    private String pushInfo;
+
+    private String remark;
+
+}

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

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

+ 4 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlConceptStaticDTO.java

@@ -60,4 +60,8 @@ public class KlConceptStaticDTO {
      * 明细
      */
     List<KlConceptDetailDTO> details;
+    /**
+     * 量表结构
+     */
+    private KlScaleByIdDTO scale;
 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 48 - 0
cdssman-service/src/main/java/com/diagbot/dto/KlScaleByIdDTO.java

@@ -0,0 +1,48 @@
+package com.diagbot.dto;
+
+import com.diagbot.entity.wrapper.KlScaleDetailWrapper;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-10 10:36
+ */
+@Setter
+@Getter
+public class KlScaleByIdDTO {
+
+    private Long id;
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    private String conceptName;
+
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+
+    /**
+     * 量表明细
+     */
+    private List<KlScaleDetailWrapper> klScaleDetail ;
+}

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

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

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

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

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

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

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

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

+ 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;
     /**
      * 大项(套餐)
      */

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

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/4/23 10:55
+ */
+@Getter
+@Setter
+public class NurseInfoDTO {
+    private Long id;
+    /**
+     * 护理名称
+     */
+    private String name;
+}

+ 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;
     /**
      * 手术或操作名称
      */

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

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2020/8/17 11:28
+ */
+@Data
+public class RegulationIndexDTO {
+
+    /**
+     * 规则名称
+     */
+    private String name;
+
+    /**
+     * 规则编码
+     */
+    private Long code;
+
+    /**
+     * 规则类型:(1:量表)
+     */
+    private Integer type;
+}

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

+ 52 - 22
cdssman-service/src/main/java/com/diagbot/dto/RetrievalDTO.java

@@ -14,39 +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<RetrievalConceptDTO> nursenames;
+    *//**
+     * 中医诊断
+     *//*
+    private List<RetrievalConceptDTO> tcmdiseaseNames;
+    *//**
+     * 中医证候
+     *//*
+    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;
     /**
      * 量表名称
      */

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

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

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

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

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

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

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

+ 34 - 109
cdssman-service/src/main/java/com/diagbot/entity/DeptConfig.java

@@ -1,19 +1,13 @@
 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 org.bouncycastle.math.ec.custom.sec.SecT113Field;
+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;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
-import java.util.function.Predicate;
 
 /**
  * <p>
@@ -23,15 +17,12 @@ import java.util.function.Predicate;
  * @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;
 
     /**
@@ -87,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;
-    }
-
-    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;
-    }
+    private String code;
 
-    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() {
@@ -191,28 +105,39 @@ public class DeptConfig implements Serializable {
                 ", hisName=" + hisName +
                 ", hisCode=" + hisCode +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DeptConfig deptConfig = (DeptConfig) o;
         return Objects.equals(id, deptConfig.id)
                 && Objects.equals(isDeleted, deptConfig.isDeleted)
                 && 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.code)));
     }
 }

+ 34 - 94
cdssman-service/src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -1,12 +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;
 
@@ -18,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;
 
     /**
@@ -77,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;
-    }
-
-    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;
-    }
+    private String code;
 
-    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() {
@@ -171,27 +99,39 @@ public class DiseaseConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", icdCode=" + icdCode +
+                ", code=" + code +
+                ", isMatch=" + isMatch +
+                ", source=" + source +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DiseaseConfig diseaseConfig = (DiseaseConfig) o;
         return Objects.equals(id, diseaseConfig.id)
                 && Objects.equals(isDeleted, diseaseConfig.isDeleted)
                 && 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 33 - 104
cdssman-service/src/main/java/com/diagbot/entity/DrugConfig.java

@@ -2,13 +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;
 
@@ -20,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;
 
     /**
@@ -66,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;
 
     /**
@@ -74,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;
 
     /**
      * 剂型
@@ -90,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() {
@@ -190,17 +108,19 @@ public class DrugConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 ", form=" + form +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         DrugConfig drugConfig = (DrugConfig) o;
         return Objects.equals(id, drugConfig.id)
                 && Objects.equals(isDeleted, drugConfig.isDeleted)
@@ -208,11 +128,20 @@ 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)
+                && StringUtil.isBlank(o.form)));
     }
 }

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

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

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

+ 119 - 89
cdssman-service/src/main/java/com/diagbot/entity/KlDisease.java

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

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

@@ -0,0 +1,73 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 药品通用名和注册名映射表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+@Data
+public class KlDrugMapping implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 药品通用名conceptId
+     */
+    private Long drugConcept;
+
+    /**
+     * 药品注册名Id
+     */
+    private Long registerId;
+
+    /**
+     * 顺序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

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

@@ -0,0 +1,301 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 药品注册表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-11
+ */
+public class KlDrugRegister implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 药品代码
+     */
+    private String drugCode;
+
+    /**
+     * 注册名称
+     */
+    private String name;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 商品名称
+     */
+    private String tradeName;
+
+    /**
+     * 药品剂型
+     */
+    private String form;
+
+    /**
+     * 注册规格
+     */
+    private String specification;
+
+    /**
+     * 最小包装数量
+     */
+    private String minPackQuantity;
+
+    /**
+     * 最小包装单位
+     */
+    private String minPackUnit;
+
+    /**
+     * 药品企业
+     */
+    private String company;
+
+    /**
+     * 批准文号
+     */
+    private String approval;
+
+    /**
+     * 药品本位码
+     */
+    private String standardCode;
+
+    /**
+     * 医保类型
+     */
+    private String insuranceType;
+
+    /**
+     * 医保备注
+     */
+    private String insuranceRemrk;
+
+    /**
+     * 药品类别
+     */
+    private String drugType;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public String getIsDeleted() {
+        return isDeleted;
+    }
+
+    public void setIsDeleted(String isDeleted) {
+        this.isDeleted = isDeleted;
+    }
+    public Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+    public String getDrugCode() {
+        return drugCode;
+    }
+
+    public void setDrugCode(String drugCode) {
+        this.drugCode = drugCode;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getEnName() {
+        return enName;
+    }
+
+    public void setEnName(String enName) {
+        this.enName = enName;
+    }
+    public String getTradeName() {
+        return tradeName;
+    }
+
+    public void setTradeName(String tradeName) {
+        this.tradeName = tradeName;
+    }
+    public String getForm() {
+        return form;
+    }
+
+    public void setForm(String form) {
+        this.form = form;
+    }
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+    public String getMinPackQuantity() {
+        return minPackQuantity;
+    }
+
+    public void setMinPackQuantity(String minPackQuantity) {
+        this.minPackQuantity = minPackQuantity;
+    }
+    public String getMinPackUnit() {
+        return minPackUnit;
+    }
+
+    public void setMinPackUnit(String minPackUnit) {
+        this.minPackUnit = minPackUnit;
+    }
+    public String getCompany() {
+        return company;
+    }
+
+    public void setCompany(String company) {
+        this.company = company;
+    }
+    public String getApproval() {
+        return approval;
+    }
+
+    public void setApproval(String approval) {
+        this.approval = approval;
+    }
+    public String getStandardCode() {
+        return standardCode;
+    }
+
+    public void setStandardCode(String standardCode) {
+        this.standardCode = standardCode;
+    }
+    public String getInsuranceType() {
+        return insuranceType;
+    }
+
+    public void setInsuranceType(String insuranceType) {
+        this.insuranceType = insuranceType;
+    }
+    public String getInsuranceRemrk() {
+        return insuranceRemrk;
+    }
+
+    public void setInsuranceRemrk(String insuranceRemrk) {
+        this.insuranceRemrk = insuranceRemrk;
+    }
+    public String getDrugType() {
+        return drugType;
+    }
+
+    public void setDrugType(String drugType) {
+        this.drugType = drugType;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDrugRegister{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", drugCode=" + drugCode +
+            ", name=" + name +
+            ", enName=" + enName +
+            ", tradeName=" + tradeName +
+            ", form=" + form +
+            ", specification=" + specification +
+            ", minPackQuantity=" + minPackQuantity +
+            ", minPackUnit=" + minPackUnit +
+            ", company=" + company +
+            ", approval=" + approval +
+            ", standardCode=" + standardCode +
+            ", insuranceType=" + insuranceType +
+            ", insuranceRemrk=" + insuranceRemrk +
+            ", drugType=" + drugType +
+            ", remark=" + remark +
+        "}";
+    }
+}

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

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

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

@@ -0,0 +1,75 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 手术扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlOperation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 手术级别(0,1,2,3,4)
+     */
+    private Integer operationLevel;
+
+    /**
+     * 手术操作码
+     */
+    private String operationCode;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

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

@@ -0,0 +1,128 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 辅检扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlPacs implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 检查方法
+     */
+    private String checkMethod;
+
+    /**
+     * 项目定义
+     */
+    private String definition;
+
+    /**
+     * 检查目的
+     */
+    private String checkObjective;
+
+    /**
+     * 检查技术
+     */
+    private String checkSkillful;
+
+    /**
+     * 禁忌症和局限性
+     */
+    private String condLimit;
+
+    /**
+     * 适应症
+     */
+    private String interventional;
+
+    /**
+     * 危急标识(0:不危急,1:危急)
+     */
+    private Integer emergencySign;
+
+    /**
+     * 检查前准备
+     */
+    private String checkPrepare;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+
+
+    @Override
+    public String toString() {
+        return "KlPacs{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", checkMethod=" + checkMethod +
+            ", definition=" + definition +
+            ", checkObjective=" + checkObjective +
+            ", checkSkillful=" + checkSkillful +
+            ", condLimit=" + condLimit +
+            ", interventional=" + interventional +
+            ", emergencySign=" + emergencySign +
+            ", checkPrepare=" + checkPrepare +
+            ", remark=" + remark +
+        "}";
+    }
+}

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

@@ -0,0 +1,118 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 症状扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlSymptom implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 阳性症状(0:否,1:是)
+     */
+    private Integer isPositive;
+
+    /**
+     * 英文名称
+     */
+    private String enName;
+
+    /**
+     * 定义
+     */
+    private String definition;
+
+    /**
+     * 中西医症状(0:通用,1:西,2:中)
+     */
+    private Integer chWestern;
+
+    /**
+     * 缓解因素
+     */
+    private String mitigatingFac;
+
+    /**
+     * 加重因素
+     */
+    private String aggravateFac;
+
+    /**
+     * 症状起因
+     */
+    private String cause;
+
+    /**
+     * 常见疾病
+     */
+    private String commonDis;
+
+    /**
+     * 预防措施
+     */
+    private String preMeasures;
+
+    /**
+     * 饮食禁忌
+     */
+    private String foodProhibition;
+
+    /**
+     * 通俗解释
+     */
+    private String commonExplain;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

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

@@ -0,0 +1,69 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 中医疾病表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-28
+ */
+@Data
+public class KlTcmDisease implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

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

@@ -0,0 +1,68 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 中医证候表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-28
+ */
+@Data
+public class KlTcmSyndrome implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 编码
+     */
+    private String code;
+
+    /**
+     * 备注
+     */
+    private String remark;
+}

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

@@ -0,0 +1,75 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 体征结果扩展表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2021-05-12
+ */
+@Data
+public class KlVitalResult implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 不适宜人群
+     */
+    private String suitablePopNo;
+
+    /**
+     * 操作方法
+     */
+    private String checkMethod;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 33 - 104
cdssman-service/src/main/java/com/diagbot/entity/LisConfig.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 lombok.Data;
+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,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;
 
     /**
@@ -88,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;
-    }
-
-    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;
-    }
+    private String code;
 
-    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() {
@@ -191,16 +109,18 @@ public class LisConfig implements Serializable {
                 ", hisName=" + hisName +
                 ", hisDetailName=" + hisDetailName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         LisConfig lisConfig = (LisConfig) o;
         return Objects.equals(id, lisConfig.id)
                 && Objects.equals(isDeleted, lisConfig.isDeleted)
@@ -208,11 +128,20 @@ 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.hisDetailName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

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

@@ -0,0 +1,300 @@
+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 java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 医学术语映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+@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
+     */
+    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));
+    }
+}

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

@@ -0,0 +1,134 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 护理映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-04-26
+ */
+@Getter
+@Setter
+public class NurseConfig{
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name = "医院护理名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院护理名称")
+    private String hisName;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准护理名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准护理名称")
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    private String code;
+
+    /**
+     * 是否匹配(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;
+
+    @Override
+    public String toString() {
+        return "NurseConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", code=" + code +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        NurseConfig nurseConfig = (NurseConfig) o;
+        return Objects.equals(id, nurseConfig.id)
+                && Objects.equals(isDeleted, nurseConfig.isDeleted)
+                && Objects.equals(hospitalId, nurseConfig.hospitalId)
+                && Objects.equals(hisName, nurseConfig.hisName)
+                && Objects.equals(uniqueName, nurseConfig.uniqueName)
+                && Objects.equals(code, nurseConfig.code);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
+    }
+
+    public static boolean nonNull(NurseConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
+    }
+}

+ 33 - 94
cdssman-service/src/main/java/com/diagbot/entity/OperationConfig.java

@@ -1,12 +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;
 
@@ -18,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;
 
     /**
@@ -76,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;
-    }
+    @Excel(name = "手术和操作代码", width = 40, orderNum = "2", isImportField = "true")
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(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,27 +100,37 @@ public class OperationConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         OperationConfig operationConfig = (OperationConfig) o;
         return Objects.equals(id, operationConfig.id)
                 && Objects.equals(isDeleted, operationConfig.isDeleted)
                 && 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 31 - 91
cdssman-service/src/main/java/com/diagbot/entity/PacsConfig.java

@@ -1,9 +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;
@@ -18,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;
 
     /**
@@ -77,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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(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,27 +101,37 @@ public class PacsConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         PacsConfig pacsConfig = (PacsConfig) o;
         return Objects.equals(id, pacsConfig.id)
                 && Objects.equals(isDeleted, pacsConfig.isDeleted)
                 && 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

+ 28 - 91
cdssman-service/src/main/java/com/diagbot/entity/ScaleConfig.java

@@ -1,12 +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;
 
@@ -18,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;
 
     /**
@@ -76,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;
-    }
+    private String code;
 
-    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;
-    }
+    /**
+     * 是否匹配(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() {
@@ -170,7 +99,7 @@ public class ScaleConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
@@ -188,11 +117,19 @@ 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

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

@@ -0,0 +1,135 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 中医疾病映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@Getter
+@Setter
+public class TcmdiseaseConfig{
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name = "中医疾病名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院中医疾病名称")
+    private String hisName;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准中医疾病名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准中医疾病名称")
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    @Excel(name = "中医疾病代码", width = 40, orderNum = "2", isImportField = "true")
+    private String code;
+
+    /**
+     * 是否匹配(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;
+
+    @Override
+    public String toString() {
+        return "TcmdiseaseConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", code=" + code +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        TcmdiseaseConfig tcmdiseaseConfig = (TcmdiseaseConfig) o;
+        return Objects.equals(id, tcmdiseaseConfig.id)
+                && Objects.equals(isDeleted, tcmdiseaseConfig.isDeleted)
+                && Objects.equals(hospitalId, tcmdiseaseConfig.hospitalId)
+                && Objects.equals(hisName, tcmdiseaseConfig.hisName)
+                && Objects.equals(uniqueName, tcmdiseaseConfig.uniqueName)
+                && Objects.equals(code, tcmdiseaseConfig.code);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
+    }
+
+    public static boolean nonNull(TcmdiseaseConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
+    }
+}

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

@@ -0,0 +1,135 @@
+package com.diagbot.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.diagbot.util.StringUtil;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * <p>
+ * 中医证候映射表
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-05-13
+ */
+@Getter
+@Setter
+public class TcmsyndromeConfig {
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 医院id
+     */
+    private Long hospitalId;
+
+    /**
+     * 医院项目名称
+     */
+    @Excel(name = "医院中医证候名称", width = 40, orderNum = "1", isImportField = "true")
+    @NotBlank(message = "请输入医院中医证候名称")
+    private String hisName;
+
+    /**
+     * 标准名称
+     */
+    @Excel(name = "标准中医证候名称", width = 40, orderNum = "3", isImportField = "true")
+    @NotBlank(message = "请输入标准中医证候名称")
+    private String uniqueName;
+
+    /**
+     * 标准编码
+     */
+    @Excel(name = "中医证候代码", width = 40, orderNum = "2", isImportField = "true")
+    private String code;
+
+    /**
+     * 是否匹配(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;
+
+    @Override
+    public String toString() {
+        return "TcmsyndromeConfig{" +
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", hospitalId=" + hospitalId +
+                ", hisName=" + hisName +
+                ", uniqueName=" + uniqueName +
+                ", code=" + code +
+                "}";
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        TcmsyndromeConfig tcmsyndromeConfig = (TcmsyndromeConfig) o;
+        return Objects.equals(id, tcmsyndromeConfig.id)
+                && Objects.equals(isDeleted, tcmsyndromeConfig.isDeleted)
+                && Objects.equals(hospitalId, tcmsyndromeConfig.hospitalId)
+                && Objects.equals(hisName, tcmsyndromeConfig.hisName)
+                && Objects.equals(uniqueName, tcmsyndromeConfig.uniqueName)
+                && Objects.equals(code, tcmsyndromeConfig.code);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, isDeleted, hospitalId, hisName, uniqueName, code);
+    }
+
+    public static boolean nonNull(TcmsyndromeConfig o) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
+    }
+}

+ 32 - 94
cdssman-service/src/main/java/com/diagbot/entity/TransfusionConfig.java

@@ -1,12 +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;
 
@@ -18,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;
 
     /**
@@ -77,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;
-    }
-
-    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;
-    }
+    private String code;
 
-    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,27 +99,37 @@ public class TransfusionConfig implements Serializable {
                 ", hospitalId=" + hospitalId +
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
-                ", uniqueCode=" + uniqueCode +
+                ", code=" + code +
                 "}";
     }
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o == null || getClass() != o.getClass())
+        }
+        if (o == null || getClass() != o.getClass()) {
             return false;
+        }
         TransfusionConfig transfusionConfig = (TransfusionConfig) o;
         return Objects.equals(id, transfusionConfig.id)
                 && Objects.equals(isDeleted, transfusionConfig.isDeleted)
                 && 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) {
+        return !(o == null
+                || (o.hospitalId == null
+                && StringUtil.isBlank(o.hisName)
+                && StringUtil.isBlank(o.uniqueName)
+                && StringUtil.isBlank(o.code)));
     }
 }

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

@@ -0,0 +1,19 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.dto.KlConceptScaleDTO;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-05-10 11:32
+ */
+@Setter
+@Getter
+public class KlScaleDetailWrapper extends KlConceptScaleDTO {
+    private List<KlScaleDetailWrapper> subMenuList = new ArrayList<>();
+}

+ 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.Getter;
+import lombok.Setter;
+
+import java.util.Objects;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/10 19:27
+ */
+@Getter
+@Setter
+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);
+    }
+}

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

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

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

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

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

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

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

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

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

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

@@ -1,577 +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.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)) {
-            deptConfigList.forEach(deptConfig -> {
-                deptConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
-            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(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getHisCode())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(deptConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < deptConfigList.size(); i++) {
-            if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
-                    || StringUtil.isBlank(deptConfigList.get(i).getUniqueName())) {
-                emptyNumList.add(String.valueOf(i + 2));
-            }
-            if (StringUtil.isNotBlank(deptConfigList.get(i).getHisName())) {
-                deptConfigList.get(i).setHisName(deptConfigList.get(i).getHisName().trim());
-            }
-            if (StringUtil.isNotBlank(deptConfigList.get(i).getHisCode())) {
-                deptConfigList.get(i).setHisCode(deptConfigList.get(i).getHisCode().trim());
-            }
-            if (StringUtil.isNotBlank(deptConfigList.get(i).getUniqueName())) {
-                deptConfigList.get(i).setUniqueName(deptConfigList.get(i).getUniqueName().trim());
-            }
-            if (StringUtil.isNotBlank(deptConfigList.get(i).getUniqueCode())) {
-                deptConfigList.get(i).setUniqueCode(deptConfigList.get(i).getUniqueCode().trim());
-            } else {
-                deptConfigList.get(i).setUniqueCode(null);
-            }
-        }
-
-        if (ListUtil.isNotEmpty(emptyNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
-                    + emptyNumList.stream().collect(Collectors.joining("、"))
-                    + "。导入取消,请修改后再试。\n");
-        }
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, 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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < deptConfigList.size(); i++) {
-            if (!names.contains(deptConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
-            }
-        }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
-
-        //重复数据过滤
-        deptConfigList = deptConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        deptConfigService.saveOrUpdateBatch(deptConfigList);
-        return true;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @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);
-
-        //去除空格
-        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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
-        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 - 588
cdssman-service/src/main/java/com/diagbot/facade/DiseaseConfigFacade.java

@@ -1,588 +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.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)) {
-            diseaseConfigList.forEach(diseaseConfig -> {
-                diseaseConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
-            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(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getIcdCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(diseaseConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < diseaseConfigList.size(); i++) {
-            if (StringUtil.isBlank(diseaseConfigList.get(i).getHisName())
-                    || StringUtil.isBlank(diseaseConfigList.get(i).getUniqueName())) {
-                emptyNumList.add(String.valueOf(i + 2));
-            }
-            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getHisName())) {
-                diseaseConfigList.get(i).setHisName(diseaseConfigList.get(i).getHisName().trim());
-            }
-            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getUniqueName())) {
-                diseaseConfigList.get(i).setUniqueName(diseaseConfigList.get(i).getUniqueName().trim());
-            }
-            if (StringUtil.isNotBlank(diseaseConfigList.get(i).getIcdCode())) {
-                diseaseConfigList.get(i).setIcdCode(diseaseConfigList.get(i).getIcdCode().trim());
-            } else {
-                diseaseConfigList.get(i).setIcdCode(null);
-            }
-        }
-
-        if (ListUtil.isNotEmpty(emptyNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
-                    + emptyNumList.stream().collect(Collectors.joining("、"))
-                    + "。导入取消,请修改后再试。\n");
-        }
-
-
-        // 验证数据是否已存在,已存在的先删除
-        // 没id的删除重新插入,有id的更新
-        List<Long> deleteIds = Lists.newLinkedList();
-        Map<String, Map<String, 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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < diseaseConfigList.size(); i++) {
-            if (!names.contains(diseaseConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
-            }
-        }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
-
-        //重复数据过滤
-        diseaseConfigList = diseaseConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        diseaseConfigService.saveOrUpdateBatch(diseaseConfigList);
-        return true;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @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);
-
-        //去除空格
-        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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
-        if (ListUtil.isNotEmpty(originList)) {
-            for (DiseaseConfig originItem : originList) {
-                if (allMap.containsKey(originItem.getHisName())) {
-                    List<DiseaseConfig> items = allMap.get(originItem.getHisName());
-                    boolean flag = false;
-                    for (DiseaseConfig item : items) {
-                        if (uniqueNames.contains(item.getUniqueName())) {
-                            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 - 847
cdssman-service/src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -1,847 +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.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)) {
-            drugConfigList.forEach(drugConfig -> {
-                drugConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
-            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(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getForm())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(drugConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        List<String> emptyNumList = Lists.newLinkedList();
-        //药品剂型
-        List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
-        List<String> formList = dicTypeMappingList.stream()
-                .filter(i -> StringUtil.isNotBlank(i.getName()))
-                .map(i -> i.getName())
-                .distinct()
-                .collect(Collectors.toList());
-        List<String> formErrNumList = Lists.newLinkedList();
-        for (int i = 0; i < drugConfigList.size(); i++) {
-            if (StringUtil.isBlank(drugConfigList.get(i).getHisName())
-                    || StringUtil.isBlank(drugConfigList.get(i).getUniqueName())) {
-                emptyNumList.add(String.valueOf(i + 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的更新
-        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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> names = respDTO.data;
-        for (int i = 0; i < drugConfigList.size(); i++) {
-            if (!names.contains(drugConfigList.get(i).getUniqueName())) {
-                errorNumList.add(String.valueOf(i + 2));
-            }
-        }
-        if (ListUtil.isNotEmpty(errorNumList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
-                    "以下行数(不计空行)标准术语在数据库中不存在:"
-                            + errorNumList.stream().collect(Collectors.joining("、"))
-                            + "。导入取消,请修改后再试。");
-        }
-
-        //重复数据过滤
-        drugConfigList = drugConfigList
-                .stream()
-                .distinct()
-                .collect(Collectors.toList());
-
-        //删除已存在映射关系
-        IdListVO idListVO = new IdListVO();
-        idListVO.setIds(deleteIds);
-        deleteRecords(idListVO);
-        drugConfigService.saveOrUpdateBatch(drugConfigList);
-        return true;
-    }
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return Map<hisName,Map<form,Map<uniqueName,id>>>
-     */
-    public Map<String, Map<String,Map<String, 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());
-
-        //去除空格
-        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<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
-        List<String> uniqueNames = respDTO.data;
-        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);
-    }
-}

+ 8 - 73
cdssman-service/src/main/java/com/diagbot/facade/HospitalInfoFacade.java

@@ -4,26 +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.OperationConfig;
-import com.diagbot.entity.PacsConfig;
+import com.diagbot.entity.MappingConfig;
 import com.diagbot.entity.Plan;
-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.OperationConfigService;
-import com.diagbot.service.PacsConfigService;
-import com.diagbot.service.TransfusionConfigService;
 import com.diagbot.service.impl.HospitalInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.Cn2SpellUtil;
@@ -58,19 +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;
+    private MappingConfigFacade mappingConfigFacade;
     @Autowired
     private PlanFacade planFacade;
 
@@ -182,56 +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>()
+        List<MappingConfig> mappingConfigList
+                = mappingConfigFacade.list(new QueryWrapper<MappingConfig>()
                 .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>()
-                .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)) {
+        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())
@@ -281,6 +215,7 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
      * @param hospitalInfoPageVO
      * @return
      */
+    @Override
     public IPage<DiseaseConfig> getPage(HospitalInfoPageVO hospitalInfoPageVO) {
         return hospitalInfoService.getPage(hospitalInfoPageVO);
     }
@@ -330,4 +265,4 @@ public class HospitalInfoFacade extends HospitalInfoServiceImpl {
         this.update(updateWrapper);
         return true;
     }
-}
+}

+ 191 - 37
cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -0,0 +1,29 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.CdssCoreClient;
+import com.diagbot.dto.RegulationIndexDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.util.RespDTOUtil;
+import com.diagbot.vo.RegulationIndexVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2021/3/15 10:58
+ */
+@Component
+public class KlRegulationFacade {
+
+    @Autowired
+    CdssCoreClient cdssCoreClient;
+
+    public RespDTO<List<RegulationIndexDTO>> index(RegulationIndexVO regulationIndexVO) {
+        RespDTO<List<RegulationIndexDTO>> respDTO = cdssCoreClient.index(regulationIndexVO);
+        RespDTOUtil.respNGDealCover(respDTO, "远程调用【cdss-core】,检索规则编码失败");
+        return respDTO;
+    }
+}

+ 216 - 26
cdssman-service/src/main/java/com/diagbot/facade/KlRelationFacade.java

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

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

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

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

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

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

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

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

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

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

@@ -1,705 +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.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)) {
-            lisConfigList.forEach(lisConfig -> {
-                lisConfig.setHospitalId(hospitalIdVO.getHospitalId());
-            });
-            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(i -> StringUtil.isNotBlank(i.getHisName())
-                        || StringUtil.isNotBlank(i.getHisDetailName())
-                        || StringUtil.isNotBlank(i.getUniqueCode())
-                        || StringUtil.isNotBlank(i.getUniqueName()))
-                .collect(Collectors.toList());
-        if (ListUtil.isEmpty(lisConfigList)) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
-        }
-        List<String> emptyNumList = Lists.newLinkedList();
-        for (int i = 0; i < lisConfigList.size(); i++) {
-            if (StringUtil.isBlank(lisConfigList.get(i).getHisName())
-                    || StringUtil.isBlank(lisConfigList.get(i).getUniqueName())) {
-                emptyNumList.add(String.valueOf(i + 2));
-            }
-            if (StringUtil.isNotBlank(lisConfigList.get(i).getHisName())) {
-                lisConfigList.get(i).setHisName(lisConfigList.get(i).getHisName().trim());
-            }
-            if (StringUtil.isNotBlank(lisConfigList.get(i).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的更新
-        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<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-        List<String> lisPackNames = respLisPackDTO.data;
-        conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-        List<String> lisNames = respLisDTO.data;
-        for (int i = 0; i < lisConfigList.size(); i++) {
-            if (StringUtil.isBlank(lisConfigList.get(i).getHisDetailName())) {
-                //检验套餐对应套餐
-                if (!lisPackNames.contains(lisConfigList.get(i).getUniqueName())) {
-                    errorNumList.add(String.valueOf(i + 2));
-                }
-            } 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);
-
-        //去除空格
-        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<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
-        List<String> lisPackNames = respLisPackDTO.data;
-        conceptVO.setType(ConceptTypeEnum.Lis.getKey());
-        RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
-        List<String> lisNames = respLisDTO.data;
-
-        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 - 0
cdssman-service/src/main/java/com/diagbot/facade/OperationConfigFacade.java


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů