Browse Source

Merge branch 'dev/diagnose20210315' into debug

wangfeng 4 years ago
parent
commit
c82ea7b31c
23 changed files with 982 additions and 161 deletions
  1. 10 4
      cdssman-service/doc/002.20210325自动化测试脚本/cdss_init.sql
  2. 7 4
      cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java
  3. 1 1
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseGroupDTO.java
  4. 1 0
      cdssman-service/src/main/java/com/diagbot/dto/KlDiagnoseTypeDTO.java
  5. 144 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDiagnose.java
  6. 274 0
      cdssman-service/src/main/java/com/diagbot/entity/KlDiagnoseBase.java
  7. 12 12
      cdssman-service/src/main/java/com/diagbot/entity/ResultRule.java
  8. 13 0
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptDetailFacade.java
  9. 22 1
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java
  10. 40 0
      cdssman-service/src/main/java/com/diagbot/facade/KlConceptStaticFacade.java
  11. 15 0
      cdssman-service/src/main/java/com/diagbot/facade/KlDiagnoseBaseFacade.java
  12. 3 1
      cdssman-service/src/main/java/com/diagbot/facade/KlDiagnoseFacade.java
  13. 266 113
      cdssman-service/src/main/java/com/diagbot/facade/MedRuleConvertFacade.java
  14. 19 24
      cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java
  15. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlDiagnoseBaseMapper.java
  16. 16 0
      cdssman-service/src/main/java/com/diagbot/mapper/KlDiagnoseMapper.java
  17. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlDiagnoseBaseService.java
  18. 16 0
      cdssman-service/src/main/java/com/diagbot/service/KlDiagnoseService.java
  19. 22 0
      cdssman-service/src/main/java/com/diagbot/service/impl/KlDiagnoseBaseServiceImpl.java
  20. 22 0
      cdssman-service/src/main/java/com/diagbot/service/impl/KlDiagnoseServiceImpl.java
  21. 1 1
      cdssman-service/src/main/resources/mapper/KlConceptMapper.xml
  22. 28 0
      cdssman-service/src/main/resources/mapper/KlDiagnoseBaseMapper.xml
  23. 18 0
      cdssman-service/src/main/resources/mapper/KlDiagnoseMapper.xml

+ 10 - 4
cdssman-service/doc/002.20210325自动化测试脚本/cdss_init.sql

@@ -40,9 +40,9 @@ CREATE TABLE `test_case_info`  (
 -- Records of test_case_info
 -- Records of test_case_info
 -- ----------------------------
 -- ----------------------------
 INSERT INTO `test_case_info` VALUES (1, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '开单合理性提醒_通用规则', 1, 1);
 INSERT INTO `test_case_info` VALUES (1, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '开单合理性提醒_通用规则', 1, 1);
-INSERT INTO `test_case_info` VALUES (2, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '开单类型提醒_输血规则', 1, 2);
-INSERT INTO `test_case_info` VALUES (3, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '危值提醒_实验室检查规则', 1, 3);
-INSERT INTO `test_case_info` VALUES (4, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '危值提醒_辅助检查规则', 1, 4);
+INSERT INTO `test_case_info` VALUES (2, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '开单合理性提醒_输血规则', 1, 2);
+INSERT INTO `test_case_info` VALUES (3, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '危值提醒_实验室检查规则', 1, 3);
+INSERT INTO `test_case_info` VALUES (4, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '危值提醒_辅助检查规则', 1, 4);
 INSERT INTO `test_case_info` VALUES (5, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '高风险提醒_高危药品规则', 1, 5);
 INSERT INTO `test_case_info` VALUES (5, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '高风险提醒_高危药品规则', 1, 5);
 INSERT INTO `test_case_info` VALUES (6, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '高风险提醒_高危手术规则', 1, 6);
 INSERT INTO `test_case_info` VALUES (6, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '高风险提醒_高危手术规则', 1, 6);
 INSERT INTO `test_case_info` VALUES (7, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '其他提醒_化验规则', 1, 7);
 INSERT INTO `test_case_info` VALUES (7, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '其他提醒_化验规则', 1, 7);
@@ -130,7 +130,7 @@ CREATE TABLE `test_result_rule`  (
   `modifier` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `modifier` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
   `result_id` bigint(20) NOT NULL COMMENT '测试结果id',
   `result_id` bigint(20) NOT NULL COMMENT '测试结果id',
   `rule_order_no` bigint(20) NULL DEFAULT NULL COMMENT '规则序号',
   `rule_order_no` bigint(20) NULL DEFAULT NULL COMMENT '规则序号',
-  `rule_type` int(4) NOT NULL COMMENT '规则类型(1:开单-通用,2:开单-输血,3:危急值-检验,4:危急值-检查,5:高危药品,6:高危手术,7:其他值提醒-检验,8-其他值提醒-检查,9-其他值提醒-输血,10:正常项目重复开立)',
+  `rule_type` int(4) NOT NULL COMMENT '规则类型(1:开单合理性;2:高危;3:危急值;4:其他值提醒;5:其他值提醒输血;6:正常项目重复开立)',
   `rule_id` bigint(20) NULL DEFAULT NULL COMMENT '规则id',
   `rule_id` bigint(20) NULL DEFAULT NULL COMMENT '规则id',
   `rule_lib_type` int(4) NULL DEFAULT NULL COMMENT '规则术语类型编码',
   `rule_lib_type` int(4) NULL DEFAULT NULL COMMENT '规则术语类型编码',
   `rule_lib_type_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规则术语类型',
   `rule_lib_type_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规则术语类型',
@@ -173,3 +173,9 @@ DROP TABLE IF EXISTS `test_result_highrisk_operation`;
 DROP TABLE IF EXISTS `test_result_other_lis`;
 DROP TABLE IF EXISTS `test_result_other_lis`;
 DROP TABLE IF EXISTS `test_result_other_pacs`;
 DROP TABLE IF EXISTS `test_result_other_pacs`;
 DROP TABLE IF EXISTS `test_result_other_transfusion`;
 DROP TABLE IF EXISTS `test_result_other_transfusion`;
+
+
+use `sys-user`;
+
+UPDATE `sys-user`.`sys_menu` SET `id`='91', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `name`='规则测试', `parent_id`='90', `code`='LT-YYSYZDHCS-ZSTPGZCS', `order_no`='10', `remark`='朗通-医院术语自动化测试-规则测试' WHERE (`id`='91');
+

+ 7 - 4
cdssman-service/src/main/java/com/diagbot/aggregate/CallIndicationAggregate.java

@@ -174,10 +174,13 @@ public class CallIndicationAggregate {
                     for (ResultRule result : entry.getValue()) {
                     for (ResultRule result : entry.getValue()) {
                         Integer count = 1;
                         Integer count = 1;
                         result.setSuccess(0);
                         result.setSuccess(0);
-                        result.setMessage(result.getMessage() + "提示内容("
-                                + (count++) + "、"
-                                + msgList.stream().map(i -> i.getMsg()).collect(Collectors.joining(";" + (count++) + "、"))
-                                + ")与预期不符");
+                        String message = result.getMessage() + "提示内容(";
+                        for (BillMsg msg : msgList) {
+                            message += (count++) + "、";
+                            message += msg.getMsg() + ";";
+                        }
+                        message += ")与预期不符";
+                        result.setMessage(message);
                         retList.add(result);
                         retList.add(result);
                     }
                     }
                 }
                 }

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

@@ -24,7 +24,7 @@ public class KlDiagnoseGroupDTO {
     /**
     /**
      * 上一级的组别
      * 上一级的组别
      */
      */
-    private Integer conditionGroup;
+
     /**
     /**
      * 组别里的明细
      * 组别里的明细
      */
      */

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

@@ -22,6 +22,7 @@ public class KlDiagnoseTypeDTO {
      * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
      * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
      */
      */
     private Integer conditionType;
     private Integer conditionType;
+    private Integer conditionGroup;
 
 
     List<KlDiagnoseGroupDTO> byIdDTO;
     List<KlDiagnoseGroupDTO> byIdDTO;
 }
 }

+ 144 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlDiagnose.java

@@ -0,0 +1,144 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 诊断依据信息表
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public class KlDiagnose implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 疾病概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    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 LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime 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 getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnose{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", description=" + description +
+            ", status=" + status +
+        "}";
+    }
+}

+ 274 - 0
cdssman-service/src/main/java/com/diagbot/entity/KlDiagnoseBase.java

@@ -0,0 +1,274 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 诊断依据基础表
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public class KlDiagnoseBase implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:主诉现病史正则;4:既往史正则)
+     */
+    private Integer type;
+
+    /**
+     * 最小域比较符
+     */
+    private String minOperator;
+
+    /**
+     * 最小域值
+     */
+    private String minValue;
+
+    /**
+     * 最小域单位
+     */
+    private String minUnit;
+
+    /**
+     * 最大域比较符
+     */
+    private String maxOperator;
+
+    /**
+     * 最大域值
+     */
+    private String maxValue;
+
+    /**
+     * 最大域单位
+     */
+    private String maxUnit;
+
+    /**
+     * 等于域比较符
+     */
+    private String eqOperator;
+
+    /**
+     * 等于域值
+     */
+    private String eqValue;
+
+    /**
+     * 等于域单位
+     */
+    private String eqUnit;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    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 LocalDateTime getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(LocalDateTime gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+    public LocalDateTime getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(LocalDateTime 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 getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+    public String getMinOperator() {
+        return minOperator;
+    }
+
+    public void setMinOperator(String minOperator) {
+        this.minOperator = minOperator;
+    }
+    public String getMinValue() {
+        return minValue;
+    }
+
+    public void setMinValue(String minValue) {
+        this.minValue = minValue;
+    }
+    public String getMinUnit() {
+        return minUnit;
+    }
+
+    public void setMinUnit(String minUnit) {
+        this.minUnit = minUnit;
+    }
+    public String getMaxOperator() {
+        return maxOperator;
+    }
+
+    public void setMaxOperator(String maxOperator) {
+        this.maxOperator = maxOperator;
+    }
+    public String getMaxValue() {
+        return maxValue;
+    }
+
+    public void setMaxValue(String maxValue) {
+        this.maxValue = maxValue;
+    }
+    public String getMaxUnit() {
+        return maxUnit;
+    }
+
+    public void setMaxUnit(String maxUnit) {
+        this.maxUnit = maxUnit;
+    }
+    public String getEqOperator() {
+        return eqOperator;
+    }
+
+    public void setEqOperator(String eqOperator) {
+        this.eqOperator = eqOperator;
+    }
+    public String getEqValue() {
+        return eqValue;
+    }
+
+    public void setEqValue(String eqValue) {
+        this.eqValue = eqValue;
+    }
+    public String getEqUnit() {
+        return eqUnit;
+    }
+
+    public void setEqUnit(String eqUnit) {
+        this.eqUnit = eqUnit;
+    }
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String toString() {
+        return "KlDiagnoseBase{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", description=" + description +
+            ", type=" + type +
+            ", minOperator=" + minOperator +
+            ", minValue=" + minValue +
+            ", minUnit=" + minUnit +
+            ", maxOperator=" + maxOperator +
+            ", maxValue=" + maxValue +
+            ", maxUnit=" + maxUnit +
+            ", eqOperator=" + eqOperator +
+            ", eqValue=" + eqValue +
+            ", eqUnit=" + eqUnit +
+            ", status=" + status +
+        "}";
+    }
+}

+ 12 - 12
cdssman-service/src/main/java/com/diagbot/entity/ResultRule.java

@@ -1,13 +1,13 @@
 package com.diagbot.entity;
 package com.diagbot.entity;
 
 
-import java.math.BigDecimal;
-
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.util.Date;
+import com.baomidou.mybatisplus.annotation.TableName;
+
 import java.io.Serializable;
 import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -116,7 +116,7 @@ public class ResultRule implements Serializable {
     /**
     /**
      * 基础规则类型(1:开单外等于术语本身;2:开单外存在比较;3:开单外不等于术语本身;4:过敏原;5:开单项;6:检查结果正则表达式)
      * 基础规则类型(1:开单外等于术语本身;2:开单外存在比较;3:开单外不等于术语本身;4:过敏原;5:开单项;6:检查结果正则表达式)
      */
      */
-    @Excel(name = "基础规则类型", width = 40, orderNum = "1",replace = {"开单外等于术语本身_1","开单外存在比较_2","开单外不等于术语本身_3","过敏原_4","开单项_5","检查结果正则表达式_6"})
+    @Excel(name = "基础规则类型", width = 40, orderNum = "1", replace = { "_null", "开单外等于术语本身_1", "开单外存在比较_2", "开单外不等于术语本身_3", "过敏原_4", "开单项_5", "检查结果正则表达式_6" })
     private Integer ruleBaseType;
     private Integer ruleBaseType;
 
 
     /**
     /**
@@ -127,25 +127,25 @@ public class ResultRule implements Serializable {
     /**
     /**
      * 禁忌项类型(名称)
      * 禁忌项类型(名称)
      */
      */
-    @Excel(name = "基础规则术语类型", width = 40, orderNum = "2")
+    @Excel(name = "基础规则术语类型", width = 40, replace = { "_null" }, orderNum = "2")
     private String ruleBaseLibTypeName;
     private String ruleBaseLibTypeName;
 
 
     /**
     /**
      * 禁忌项名称
      * 禁忌项名称
      */
      */
-    @Excel(name = "基础规则医学标准术语", width = 40, orderNum = "3")
+    @Excel(name = "基础规则医学标准术语", width = 40, replace = { "_null" }, orderNum = "3")
     private String ruleBaseLibName;
     private String ruleBaseLibName;
 
 
     /**
     /**
      * 禁忌项名称(医院端)
      * 禁忌项名称(医院端)
      */
      */
-    @Excel(name = "基础规则医院术语", width = 40, orderNum = "4")
+    @Excel(name = "基础规则医院术语", width = 40, replace = { "_null" }, orderNum = "4")
     private String ruleBaseHisName;
     private String ruleBaseHisName;
 
 
     /**
     /**
      * 禁忌项名称-细项(医院端)
      * 禁忌项名称-细项(医院端)
      */
      */
-    @Excel(name = "基础规则医院术语细则", width = 40, orderNum = "5")
+    @Excel(name = "基础规则医院术语细则", width = 40, replace = { "_null" }, orderNum = "5")
     private String ruleBaseHisDetailName;
     private String ruleBaseHisDetailName;
 
 
     /**
     /**
@@ -166,13 +166,13 @@ public class ResultRule implements Serializable {
     /**
     /**
      * 禁忌项输入值(文本/数值)
      * 禁忌项输入值(文本/数值)
      */
      */
-    @Excel(name = "基础规则输入值", width = 40, orderNum = "6")
+    @Excel(name = "基础规则输入值", width = 40, replace = { "_null" }, orderNum = "6")
     private String ruleBaseInputValue;
     private String ruleBaseInputValue;
 
 
     /**
     /**
      * 参考值(参考范围拼接/药品分类保存)
      * 参考值(参考范围拼接/药品分类保存)
      */
      */
-    @Excel(name = "基础规则参考值", width = 40, orderNum = "7")
+    @Excel(name = "基础规则参考值", width = 40, replace = { "_null" }, orderNum = "7")
     private String referenceValue;
     private String referenceValue;
 
 
     /**
     /**
@@ -539,4 +539,4 @@ public class ResultRule implements Serializable {
                 ", ruleMsg=" + ruleMsg +
                 ", ruleMsg=" + ruleMsg +
                 "}";
                 "}";
     }
     }
-}
+}

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

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.KlConceptDetailServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/3/29 10:48
+ */
+@Component
+public class KlConceptDetailFacade extends KlConceptDetailServiceImpl {
+}

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

@@ -12,6 +12,8 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.entity.KlConceptCommon;
 import com.diagbot.entity.KlConceptStatic;
 import com.diagbot.entity.KlConceptStatic;
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.entity.KlDiagnoseBase;
 import com.diagbot.entity.KlLexicon;
 import com.diagbot.entity.KlLexicon;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.entity.KlRelation;
 import com.diagbot.entity.KlRelation;
@@ -75,6 +77,10 @@ public class KlConceptFacade extends KlConceptServiceImpl {
     KlRuleFacade klRuleFacade;
     KlRuleFacade klRuleFacade;
     @Autowired
     @Autowired
     KlRuleBaseFacade klRuleBaseFacade;
     KlRuleBaseFacade klRuleBaseFacade;
+    @Autowired
+    KlDiagnoseFacade klDiagnoseFacade;
+    @Autowired
+    KlDiagnoseBaseFacade klDiagnoseBaseFacade;
 
 
 
 
     /**
     /**
@@ -297,6 +303,7 @@ public class KlConceptFacade extends KlConceptServiceImpl {
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .like(StringUtil.isNotBlank(getAllForRelationVO.getName()), "lib_name", getAllForRelationVO.getName().trim())
                     .like(StringUtil.isNotBlank(getAllForRelationVO.getName()), "lib_name", getAllForRelationVO.getName().trim())
                     .eq(getAllForRelationVO.getTypeId() != null, "lib_type", getAllForRelationVO.getTypeId())
                     .eq(getAllForRelationVO.getTypeId() != null, "lib_type", getAllForRelationVO.getTypeId())
+                    .eq("status", StatusEnum.Enable.getKey())
                     .notIn(ListUtil.isNotEmpty(getAllForRelationVO.getExcludedConceptIds()), "id", getAllForRelationVO.getExcludedConceptIds())
                     .notIn(ListUtil.isNotEmpty(getAllForRelationVO.getExcludedConceptIds()), "id", getAllForRelationVO.getExcludedConceptIds())
             );
             );
             //            retList = BeanUtil.listCopyTo(conceptList, GetAllForRelationDTO.class);
             //            retList = BeanUtil.listCopyTo(conceptList, GetAllForRelationDTO.class);
@@ -405,10 +412,24 @@ public class KlConceptFacade extends KlConceptServiceImpl {
             if (ruleBasesum > 0) {
             if (ruleBasesum > 0) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与规则维护明细存在关系!");
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与规则维护明细存在关系!");
             }
             }
+            //kl_diagnose
+            int diagnosesum = klDiagnoseFacade.count(new QueryWrapper<KlDiagnose>().eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("concept_id", klConceptSatarOrdisaVO.getConceptId()));
+            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())
+                    .eq("concept_id", klConceptSatarOrdisaVO.getConceptId()));
+            if (diagnoseBasesum > 0) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该医学标准术语与诊断依据维护明细存在关系!");
+            }
         }
         }
         UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
         UpdateWrapper<KlConcept> klLibraryUpdate = new UpdateWrapper<>();
         klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
         klLibraryUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("id", klConceptSatarOrdisaVO.getConceptId()).set("status", status).set("gmt_modified", now);
+                .eq("id", klConceptSatarOrdisaVO.getConceptId())
+                .set("status", status).set("gmt_modified", now)
+                .set("modifier", UserUtils.getCurrentPrincipleID());
         return this.update(klLibraryUpdate);
         return this.update(klLibraryUpdate);
 
 
     }
     }

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

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 package com.diagbot.facade;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.CdssCoreClient;
 import com.diagbot.client.CdssCoreClient;
@@ -8,7 +9,13 @@ import com.diagbot.dto.KlConceptStaticDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
+import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlConceptDetail;
+import com.diagbot.entity.KlConceptStatic;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.StatusEnum;
 import com.diagbot.service.impl.KlConceptStaticServiceImpl;
 import com.diagbot.service.impl.KlConceptStaticServiceImpl;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.ChangeStatusVO;
 import com.diagbot.vo.ChangeStatusVO;
@@ -37,6 +44,10 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
     private CdssCoreClient cdssCoreClient;
     private CdssCoreClient cdssCoreClient;
     @Autowired
     @Autowired
     private UserServiceClient userServiceClient;
     private UserServiceClient userServiceClient;
+    @Autowired
+    private KlConceptDetailFacade klConceptDetailFacade;
+    @Autowired
+    private KlConceptFacade klConceptFacade;
 
 
     /**
     /**
      * 静态知识检索
      * 静态知识检索
@@ -172,4 +183,33 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         }
         }
         return exist;
         return exist;
     }
     }
+
+    /**
+     * 获取全静态知识
+     *
+     * @return
+     */
+    public List<KlConcept> getAllConcept() {
+        List<KlConcept> retList = Lists.newLinkedList();
+        QueryWrapper<KlConceptStatic> staticQueryWrapper = new QueryWrapper<>();
+        staticQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("status", StatusEnum.Enable.getKey());
+        List<KlConceptStatic> staticList = this.list(staticQueryWrapper);
+
+        if (ListUtil.isNotEmpty(staticList)) {
+            List<Long> conceptIds = staticList.stream().map(i -> i.getConceptId()).distinct().collect(Collectors.toList());
+            QueryWrapper<KlConceptDetail> detailQueryWrapper = new QueryWrapper<>();
+            detailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .in("concept_id", conceptIds);
+            List<KlConceptDetail> detailsList = klConceptDetailFacade.list(detailQueryWrapper);
+            if (ListUtil.isNotEmpty(detailsList)) {
+                conceptIds = detailsList.stream().map(i -> i.getConceptId()).distinct().collect(Collectors.toList());
+                retList = klConceptFacade.list(new QueryWrapper<KlConcept>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("status", StatusEnum.Enable.getKey())
+                        .in("id", conceptIds));
+            }
+        }
+        return retList;
+    }
 }
 }

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

@@ -0,0 +1,15 @@
+package com.diagbot.facade;
+
+import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.service.impl.KlDiagnoseBaseServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-31 15:36
+ */
+@Component
+public class KlDiagnoseBaseFacade extends KlDiagnoseBaseServiceImpl {
+
+}

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

@@ -7,6 +7,8 @@ import com.diagbot.dto.DiagnosesFindDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
 import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.service.impl.KlDiagnoseServiceImpl;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.DiagnosesFindVO;
 import com.diagbot.vo.DiagnosesFindVO;
@@ -28,7 +30,7 @@ import java.util.stream.Collectors;
  * @date 2021-03-23 16:54
  * @date 2021-03-23 16:54
  */
  */
 @Component
 @Component
-public class KlDiagnoseFacade {
+public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
     @Autowired
     @Autowired
     CdssCoreClient cdssCoreClient;
     CdssCoreClient cdssCoreClient;
     @Autowired
     @Autowired

+ 266 - 113
cdssman-service/src/main/java/com/diagbot/facade/MedRuleConvertFacade.java

@@ -6,11 +6,13 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.MedClassMedDTO;
 import com.diagbot.dto.MedClassMedDTO;
 import com.diagbot.dto.RuleDTO;
 import com.diagbot.dto.RuleDTO;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConcept;
+import com.diagbot.entity.KlRuleBase;
 import com.diagbot.entity.ResultRule;
 import com.diagbot.entity.ResultRule;
 import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleBaseTypeEnum;
 import com.diagbot.enums.RuleBaseTypeEnum;
+import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.BeanUtil;
@@ -47,6 +49,8 @@ public class MedRuleConvertFacade {
     private KlRuleFacade klRuleFacade;
     private KlRuleFacade klRuleFacade;
     @Autowired
     @Autowired
     private KlRelationFacade klRelationFacade;
     private KlRelationFacade klRelationFacade;
+    @Autowired
+    private KlRuleBaseFacade klRuleBaseFacade;
 
 
     @Autowired
     @Autowired
     private LisConfigFacade lisConfigFacade;
     private LisConfigFacade lisConfigFacade;
@@ -197,7 +201,7 @@ public class MedRuleConvertFacade {
                                 result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
                                 result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
                                 break;
                                 break;
                             case "儿童":
                             case "儿童":
-                                result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
+                                result.setRuleBaseInputValue(random_int(6, 18, true, false).toString());
                                 break;
                                 break;
                             case "成人":
                             case "成人":
                                 result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
                                 result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
@@ -216,18 +220,18 @@ public class MedRuleConvertFacade {
                 result.setRuleMsg(record.getRuleMsg());
                 result.setRuleMsg(record.getRuleMsg());
 
 
                 //其他值提醒辅检
                 //其他值提醒辅检
-                if (result.getRuleType().equals(4)) {
+                if (result.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
                     result.setExpectedOutput(record.getRuleMsg());
                     result.setExpectedOutput(record.getRuleMsg());
                 }
                 }
 
 
                 //高危药品
                 //高危药品
-                if (result.getRuleType().equals(2)
+                if (result.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())
                         && result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
                         && result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
                     result.setReferenceValue(record.getRuleMsg());
                     result.setReferenceValue(record.getRuleMsg());
                 }
                 }
 
 
                 //输血其他值提醒
                 //输血其他值提醒
-                if (result.getRuleType().equals(5)) {
+                if (result.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
                     result.setReferenceValue(record.getRuleMsg());
                     result.setReferenceValue(record.getRuleMsg());
                 }
                 }
                 //比较关系
                 //比较关系
@@ -394,7 +398,8 @@ public class MedRuleConvertFacade {
                     if (result.getRuleBaseLibType() != null
                     if (result.getRuleBaseLibType() != null
                             && (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
                             && (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
                             || result.getRuleBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
                             || result.getRuleBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
-                            || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey()))) {
+                            || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())
+                            || result.getRuleBaseLibType().equals(LexiconEnum.MedJiePouClass.getKey()))) {
                         List<String> medicines = medClassMedMap.get(result.getRuleBaseLibName());
                         List<String> medicines = medClassMedMap.get(result.getRuleBaseLibName());
                         if (ListUtil.isNotEmpty(medicines)) {
                         if (ListUtil.isNotEmpty(medicines)) {
                             for (String med : medicines) {
                             for (String med : medicines) {
@@ -431,7 +436,7 @@ public class MedRuleConvertFacade {
             Integer num = 1;
             Integer num = 1;
             for (ResultRule result : entry.getValue()) {
             for (ResultRule result : entry.getValue()) {
                 List<ResultRule> tempList = Lists.newLinkedList();
                 List<ResultRule> tempList = Lists.newLinkedList();
-                if (result.getRuleType().equals(4)) {
+                if (result.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
                     if (StringUtil.isNotBlank(result.getRuleBaseLibName())
                     if (StringUtil.isNotBlank(result.getRuleBaseLibName())
                             && result.getRuleBaseLibName().equals("流产")) {
                             && result.getRuleBaseLibName().equals("流产")) {
                         List<String> conflictDiseases = Lists.newLinkedList();
                         List<String> conflictDiseases = Lists.newLinkedList();
@@ -451,7 +456,7 @@ public class MedRuleConvertFacade {
                         for (String conflictDisease : conflictDiseases) {
                         for (String conflictDisease : conflictDiseases) {
                             ResultRule convertResult = new ResultRule();
                             ResultRule convertResult = new ResultRule();
                             BeanUtil.copyProperties(result, convertResult);
                             BeanUtil.copyProperties(result, convertResult);
-                            convertResult.setReferenceValue(convertResult.getRuleBaseLibType() + "_" + convertResult.getRuleBaseLibName() + "_" + convertResult.getRuleBaseLibName());
+                            convertResult.setReferenceValue(convertResult.getRuleBaseLibType() + "_" + convertResult.getRuleBaseLibTypeName() + "_" + convertResult.getRuleBaseLibName());
                             convertResult.setRuleBaseLibName(conflictDisease);
                             convertResult.setRuleBaseLibName(conflictDisease);
                             convertResult.setRuleBaseLibType(LexiconEnum.Disease.getKey());
                             convertResult.setRuleBaseLibType(LexiconEnum.Disease.getKey());
                             convertResult.setRuleBaseLibTypeName(LexiconEnum.Disease.getName());
                             convertResult.setRuleBaseLibTypeName(LexiconEnum.Disease.getName());
@@ -477,7 +482,7 @@ public class MedRuleConvertFacade {
             Integer num = 1;
             Integer num = 1;
             for (ResultRule result : entry.getValue()) {
             for (ResultRule result : entry.getValue()) {
                 List<ResultRule> tempList = Lists.newLinkedList();
                 List<ResultRule> tempList = Lists.newLinkedList();
-                if (result.getRuleType().equals(6)) {
+                if (result.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
                     if (StringUtil.isNotBlank(result.getRuleBaseInputValue())) {
                     if (StringUtil.isNotBlank(result.getRuleBaseInputValue())) {
                         List<String> pacsResultArr = Arrays.asList(result.getRuleBaseInputValue().split("\\|"));
                         List<String> pacsResultArr = Arrays.asList(result.getRuleBaseInputValue().split("\\|"));
                         for (String pacsResult : pacsResultArr) {
                         for (String pacsResult : pacsResultArr) {
@@ -507,76 +512,84 @@ public class MedRuleConvertFacade {
             for (Map.Entry<Long, List<ResultRule>> entry : billMappingMap.entrySet()) {
             for (Map.Entry<Long, List<ResultRule>> entry : billMappingMap.entrySet()) {
                 Map<Integer, List<ResultRule>> tempMap = new HashMap<>();
                 Map<Integer, List<ResultRule>> tempMap = new HashMap<>();
                 Integer num = 1;
                 Integer num = 1;
-                for (ResultRule result : entry.getValue()) {
+                for (int i = 0; i < entry.getValue().size(); i++) {
+                    //for (ResultRule result : entry.getValue()) {
+                    ResultRule result = entry.getValue().get(i);
                     List<ResultRule> tempList = Lists.newLinkedList();
                     List<ResultRule> tempList = Lists.newLinkedList();
-                    if (result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.Operation.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult(result, operationConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.LisName.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                                item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                                item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.PacsName.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.PacsSubName.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                            });
-                        }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.Transfusion.getKey())) {
-                        List<ResultRule> mappingList = getMappingResult(result, transfusionConfigMap, 1);
-                        if (result.getRuleLibType().equals(result.getRuleBaseLibType())
-                                && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
-                            mappingList.forEach(item -> {
-                                item.setRuleBaseHisName(item.getRuleHisName());
-                            });
+                    if (i == 0) {
+                        if (result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 1, result.getRuleType());
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.Operation.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult(result, operationConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.LisName.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                    item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                    item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.PacsName.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.PacsSubName.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.Transfusion.getKey())) {
+                            List<ResultRule> mappingList = getMappingResult(result, transfusionConfigMap, 1);
+                            if (result.getRuleLibType().equals(result.getRuleBaseLibType())
+                                    && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
+                                mappingList.forEach(item -> {
+                                    item.setRuleBaseHisName(item.getRuleHisName());
+                                });
+                            }
+                            tempList.addAll(mappingList);
+                        } else if (result.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
+                            tempList.add(result);
+                        } else {
+                            tempList.add(result);
                         }
                         }
-                        tempList.addAll(mappingList);
-                    } else if (result.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
-                        tempList.add(result);
                     } else {
                     } else {
+                        result.setRuleHisName(entry.getValue().get(0).getRuleHisName());
+                        result.setRuleHisDetailName(entry.getValue().get(0).getRuleHisDetailName());
                         tempList.add(result);
                         tempList.add(result);
                     }
                     }
                     tempMap.put(num++, tempList);
                     tempMap.put(num++, tempList);
@@ -602,7 +615,7 @@ public class MedRuleConvertFacade {
                                 List<ResultRule> mappingList = getMappingResult(result, diseaseConfigMap, 2);
                                 List<ResultRule> mappingList = getMappingResult(result, diseaseConfigMap, 2);
                                 tempList.addAll(mappingList);
                                 tempList.addAll(mappingList);
                             } else if (result.getRuleBaseLibType().equals(LexiconEnum.Medicine.getKey())) {
                             } else if (result.getRuleBaseLibType().equals(LexiconEnum.Medicine.getKey())) {
-                                List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 2);
+                                List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 2, result.getRuleType());
                                 tempList.addAll(mappingList);
                                 tempList.addAll(mappingList);
                             } else if (result.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                             } else if (result.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                                 List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 2);
                                 List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 2);
@@ -727,10 +740,87 @@ public class MedRuleConvertFacade {
                 .collect(Collectors.toList()));
                 .collect(Collectors.toList()));
 
 
         //带子条件的规则
         //带子条件的规则
-        Map<Long, List<RuleDTO>> ruleIdMap = list.stream()
+        List<RuleDTO> listWithCond = list.stream()
                 .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1))
                 .filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1))
+                .collect(Collectors.toList());
+        if (ListUtil.isEmpty(listWithCond)) {
+            return retList;
+        }
+        List<Long> ruleBaseIds = listWithCond.stream()
+                .map(i -> i.getRuleBaseId())
+                .distinct()
+                .collect(Collectors.toList());
+        List<KlRuleBase> ruleBaseList = klRuleBaseFacade.list(new QueryWrapper<KlRuleBase>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("status", StatusEnum.Enable.getKey()));
+        //.in("id", ruleBaseIds));
+        Map<Long, String> ruleBaseMap = ruleBaseList.stream()
+                .collect(Collectors.toMap(k -> k.getId(), v -> v.getConceptId() + "_"
+                        + v.getType() + "_"
+                        + v.getMaxOperator() + "_"
+                        + v.getMaxValue() + "_"
+                        + v.getMaxUnit() + "_"
+                        + v.getMinOperator() + "_"
+                        + v.getMinValue() + "_"
+                        + v.getMinUnit() + "_"
+                        + v.getEqOperator() + "_"
+                        + v.getEqValue() + "_"
+                        + v.getEqUnit()));
+        /*Map<String, String> sameCondMap = ruleBaseList.stream()
+                .collect(Collectors.groupingBy(k -> k.getConceptId() + "_"
+                                + k.getType() + "_"
+                                + k.getMaxOperator() + "_"
+                                + k.getMaxValue() + "_"
+                                + k.getMaxUnit() + "_"
+                                + k.getMinOperator() + "_"
+                                + k.getMinValue() + "_"
+                                + k.getMinUnit() + "_"
+                                + k.getEqOperator() + "_"
+                                + k.getEqValue() + "_"
+                                + k.getEqUnit(),
+                        Collectors.mapping(v -> v.getId().toString(), Collectors.joining("|"))));
+        Map<String, Boolean> usedCondMap = new HashMap<>();
+        for (Map.Entry<String, String> entry : sameCondMap.entrySet()) {
+            usedCondMap.put(entry.getValue(), false);
+        }*/
+
+        Map<Long, List<RuleDTO>> ruleIdMap = listWithCond.stream()
                 .collect(Collectors.groupingBy(RuleDTO::getRuleId));
                 .collect(Collectors.groupingBy(RuleDTO::getRuleId));
-        //Map<ruleId,Map<groupType_ruleBaseId,RuleDTO>>
+        Map<Long, Map<String, RuleDTO>> baseNestMap = new HashMap<>();
+        Map<Long, String> baseCondMap = new HashMap<>();
+        for (Map.Entry<Long, List<RuleDTO>> entry : ruleIdMap.entrySet()) {
+            Map<String, RuleDTO> subMap = new HashMap<>();
+            for (RuleDTO result : entry.getValue()) {
+                subMap.put(ruleBaseMap.get(result.getRuleBaseId()), result);
+            }
+            baseNestMap.put(entry.getKey(), subMap);
+            baseCondMap.put(entry.getKey(), subMap.keySet().stream().sorted().collect(Collectors.joining("|")));
+        }
+        Map<String, List<Long>> baseReversedMap = new HashMap<>();
+        for (Map.Entry<Long, String> entry : baseCondMap.entrySet()) {
+            List<Long> ruleIds = Lists.newLinkedList();
+            if (baseReversedMap.containsKey(entry.getValue())) {
+                ruleIds = baseReversedMap.get(entry.getValue());
+            }
+            ruleIds.add(entry.getKey());
+            baseReversedMap.put(entry.getValue(), ruleIds);
+        }
+
+        for (Map.Entry<String, List<Long>> entry : baseReversedMap.entrySet()) {
+            if (ListUtil.isEmpty(entry.getValue())) {
+                continue;
+            }
+            Integer num = 0;
+            List<String> baseIdList = Arrays.asList(entry.getKey().split("\\|"));
+            for (Long ruleId : entry.getValue()) {
+                retList.add(baseNestMap.get(ruleId).get(baseIdList.get(num++)));
+                if (num == baseIdList.size()) {
+                    num = 0;
+                }
+            }
+        }
+
+        /*//Map<ruleId,Map<groupType_ruleBaseId,RuleDTO>>
         Map<Long, Map<String, RuleDTO>> nestMap = new HashMap<>();
         Map<Long, Map<String, RuleDTO>> nestMap = new HashMap<>();
         //Map<ruleId,groupType_ruleBaseId|groupType_ruleBaseId|groupType_ruleBaseId……>
         //Map<ruleId,groupType_ruleBaseId|groupType_ruleBaseId|groupType_ruleBaseId……>
         Map<Long, String> conditionMap = new HashMap<>();
         Map<Long, String> conditionMap = new HashMap<>();
@@ -743,6 +833,7 @@ public class MedRuleConvertFacade {
                             .map(i -> i.getGroupType() + "_" + i.getRuleBaseId())
                             .map(i -> i.getGroupType() + "_" + i.getRuleBaseId())
                             .collect(Collectors.joining("|")));
                             .collect(Collectors.joining("|")));
         }
         }
+
         //Map<groupType_ruleBaseId,List<ruleId>
         //Map<groupType_ruleBaseId,List<ruleId>
         Map<String, List<Long>> reversedMap = new HashMap<>();
         Map<String, List<Long>> reversedMap = new HashMap<>();
         for (Map.Entry<Long, String> entry : conditionMap.entrySet()) {
         for (Map.Entry<Long, String> entry : conditionMap.entrySet()) {
@@ -766,7 +857,7 @@ public class MedRuleConvertFacade {
                     num = 0;
                     num = 0;
                 }
                 }
             }
             }
-        }
+        }*/
 
 
         return retList;
         return retList;
     }
     }
@@ -828,7 +919,8 @@ public class MedRuleConvertFacade {
      * @param type
      * @param type
      * @return
      * @return
      */
      */
-    public List<ResultRule> getMappingResult_medicine(ResultRule result, Map<String, Map<String, Map<String, List<Long>>>> configMap, Integer type) {
+    public List<ResultRule> getMappingResult_medicine(ResultRule result, Map<String, Map<String,
+            Map<String, List<Long>>>> configMap, Integer type, Integer ruleType) {
         List<ResultRule> retList = Lists.newLinkedList();
         List<ResultRule> retList = Lists.newLinkedList();
         if (configMap == null || configMap.size() == 0) {
         if (configMap == null || configMap.size() == 0) {
             result.setSuccess(0);
             result.setSuccess(0);
@@ -847,29 +939,90 @@ public class MedRuleConvertFacade {
             keyName = result.getRuleBaseLibName();
             keyName = result.getRuleBaseLibName();
         }
         }
 
 
-        List<String> hisNames = configMap.containsKey(keyName)
-                //? configMap.get(keyName).values().stream().map(i -> i.keySet()).flatMap(Collection::stream).distinct().collect(Collectors.toList())
-                ? new ArrayList<>(configMap.get(keyName).keySet())
-                : new ArrayList<>();
-        if (ListUtil.isNotEmpty(hisNames)) {
-            for (String hisName : hisNames) {
-                ResultRule bmResult = new ResultRule();
-                BeanUtil.copyProperties(result, bmResult);
+        if (ruleType.equals(RuleTypeEnum.HighRisk.getKey())) {
+            Map<String, Map<String, List<Long>>> hisMap = configMap.containsKey(keyName)
+                    ? configMap.get(keyName)
+                    : new HashMap<>();
+            if (hisMap.size() > 0) {
+                for (Map.Entry<String, Map<String, List<Long>>> hisEntry : hisMap.entrySet()) {
+                    if (result.getRuleBaseLibType().equals(LexiconEnum.Form.getKey())
+                            && StringUtil.isNotBlank(result.getRuleBaseLibName())) {
+                        if (hisEntry.getValue() == null || hisEntry.getValue().size() == 0) {
+                            ResultRule bmResult = new ResultRule();
+                            BeanUtil.copyProperties(result, bmResult);
+                            bmResult.setSuccess(0);
+                            if (type.equals(1)) {
+                                bmResult.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName()
+                                        + ")+" + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+                            } else if (type.equals(2)) {
+                                bmResult.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+                            }
+                            retList.add(bmResult);
+                        } else {
+                            ResultRule bmResult = new ResultRule();
+                            BeanUtil.copyProperties(result, bmResult);
+                            if (hisEntry.getValue().containsKey(result.getRuleBaseLibName())) {
+                                if (type.equals(1)) {
+                                    bmResult.setRuleHisName(hisEntry.getKey());
+                                } else if (type.equals(2)) {
+                                    bmResult.setRuleBaseHisName(hisEntry.getKey());
+                                }
+                            } else {
+                                bmResult.setSuccess(0);
+                                if (type.equals(1)) {
+                                    bmResult.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName()
+                                            + ")+" + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+                                } else if (type.equals(2)) {
+                                    bmResult.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+                                }
+                            }
+                            retList.add(bmResult);
+                        }
+                    } else {
+                        ResultRule bmResult = new ResultRule();
+                        BeanUtil.copyProperties(result, bmResult);
+                        if (type.equals(1)) {
+                            bmResult.setRuleHisName(hisEntry.getKey());
+                        } else if (type.equals(2)) {
+                            bmResult.setRuleBaseHisName(hisEntry.getKey());
+                        }
+                        retList.add(bmResult);
+                    }
+                }
+            } else {
+                result.setSuccess(0);
                 if (type.equals(1)) {
                 if (type.equals(1)) {
-                    bmResult.setRuleHisName(hisName);
+                    result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
                 } else if (type.equals(2)) {
                 } else if (type.equals(2)) {
-                    bmResult.setRuleBaseHisName(hisName);
+                    result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
                 }
                 }
-                retList.add(bmResult);
+                retList.add(result);
             }
             }
         } else {
         } else {
-            result.setSuccess(0);
-            if (type.equals(1)) {
-                result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
-            } else if (type.equals(2)) {
-                result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+            List<String> hisNames = configMap.containsKey(keyName)
+                    //? configMap.get(keyName).values().stream().map(i -> i.keySet()).flatMap(Collection::stream).distinct().collect(Collectors.toList())
+                    ? new ArrayList<>(configMap.get(keyName).keySet())
+                    : new ArrayList<>();
+            if (ListUtil.isNotEmpty(hisNames)) {
+                for (String hisName : hisNames) {
+                    ResultRule bmResult = new ResultRule();
+                    BeanUtil.copyProperties(result, bmResult);
+                    if (type.equals(1)) {
+                        bmResult.setRuleHisName(hisName);
+                    } else if (type.equals(2)) {
+                        bmResult.setRuleBaseHisName(hisName);
+                    }
+                    retList.add(bmResult);
+                }
+            } else {
+                result.setSuccess(0);
+                if (type.equals(1)) {
+                    result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
+                } else if (type.equals(2)) {
+                    result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
+                }
+                retList.add(result);
             }
             }
-            retList.add(result);
         }
         }
         return retList;
         return retList;
     }
     }
@@ -945,7 +1098,7 @@ public class MedRuleConvertFacade {
                 conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
                 conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
             }
             }
             //开单合理性
             //开单合理性
-            if (resultRule.getRuleType().equals(1)) {
+            if (resultRule.getRuleType().equals(RuleTypeEnum.Rationality.getKey())) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                         //禁忌疾病
                         //禁忌疾病
@@ -1075,14 +1228,14 @@ public class MedRuleConvertFacade {
                         if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
                         if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
                             content += trimZero(resultRule.getRuleBaseInputValue());
                             content += trimZero(resultRule.getRuleBaseInputValue());
                         }
                         }
-                        billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(),
+                        /*billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(),
                                 resultRule.getRuleLibName(),
                                 resultRule.getRuleLibName(),
                                 content,
                                 content,
                                 conType,
                                 conType,
-                                orderType);
+                                orderType);*/
                     }
                     }
                 }
                 }
-            } else if (resultRule.getRuleType().equals(2)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                         billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseHisName(), resultRule.getRuleHisName(), orderType);
                         billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseHisName(), resultRule.getRuleHisName(), orderType);
@@ -1130,7 +1283,7 @@ public class MedRuleConvertFacade {
                 } else {
                 } else {
                     billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleHisName(), orderType);
                     billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleHisName(), orderType);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(3)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Critical.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     String content = "";
                     String content = "";
                     if (StringUtil.isNotBlank(resultRule.getRuleBaseHisName())) {
                     if (StringUtil.isNotBlank(resultRule.getRuleBaseHisName())) {
@@ -1147,7 +1300,7 @@ public class MedRuleConvertFacade {
                 } else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
                 } else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
                     billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
                     billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(4)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     Lis lis = new Lis();
                     Lis lis = new Lis();
                     lis.setName(resultRule.getRuleHisName());
                     lis.setName(resultRule.getRuleHisName());
@@ -1182,7 +1335,7 @@ public class MedRuleConvertFacade {
                         billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
                         billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
                     }
                     }
                 }
                 }
-            } else if (resultRule.getRuleType().equals(5)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
                 if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     String content = "";
                     String content = "";
                     content += resultRule.getRuleHisName();
                     content += resultRule.getRuleHisName();
@@ -1195,7 +1348,7 @@ public class MedRuleConvertFacade {
                     }
                     }
                     billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
                     billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(6)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
                 billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(), resultRule.getRuleLibName(), resultRule.getRuleBaseHisName(), conType, orderType);
                 billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(), resultRule.getRuleLibName(), resultRule.getRuleBaseHisName(), conType, orderType);
             }
             }
         } else if (list.size() > 1) {
         } else if (list.size() > 1) {
@@ -1322,7 +1475,7 @@ public class MedRuleConvertFacade {
                 conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
                 conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
             }
             }
             //开单合理性
             //开单合理性
-            if (resultRule.getRuleType().equals(1)) {
+            if (resultRule.getRuleType().equals(RuleTypeEnum.Rationality.getKey())) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                         //禁忌疾病
                         //禁忌疾病
@@ -1448,14 +1601,14 @@ public class MedRuleConvertFacade {
                         if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
                         if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
                             content += trimZero(resultRule.getRuleBaseInputValue());
                             content += trimZero(resultRule.getRuleBaseInputValue());
                         }
                         }
-                        billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(),
+                        /*billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(),
                                 resultRule.getRuleLibName(),
                                 resultRule.getRuleLibName(),
                                 content,
                                 content,
                                 conType,
                                 conType,
-                                orderType);
+                                orderType);*/
                     }
                     }
                 }
                 }
-            } else if (resultRule.getRuleType().equals(2)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                 if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                     if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
                         billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseLibName(), resultRule.getRuleLibName(), orderType);
                         billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseLibName(), resultRule.getRuleLibName(), orderType);
@@ -1499,7 +1652,7 @@ public class MedRuleConvertFacade {
                 } else {
                 } else {
                     billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleLibName(), orderType);
                     billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleLibName(), orderType);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(3)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Critical.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     String content = "";
                     String content = "";
                     if (StringUtil.isNotBlank(resultRule.getRuleBaseLibName())) {
                     if (StringUtil.isNotBlank(resultRule.getRuleBaseLibName())) {
@@ -1512,7 +1665,7 @@ public class MedRuleConvertFacade {
                 } else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
                 } else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
                     billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
                     billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(4)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     Lis lis = new Lis();
                     Lis lis = new Lis();
                     lis.setUniqueName(resultRule.getRuleLibName());
                     lis.setUniqueName(resultRule.getRuleLibName());
@@ -1541,7 +1694,7 @@ public class MedRuleConvertFacade {
                         billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
                         billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
                     }
                     }
                 }
                 }
-            } else if (resultRule.getRuleType().equals(5)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
                 if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                 if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
                     String content = "";
                     String content = "";
                     content += resultRule.getRuleLibName();
                     content += resultRule.getRuleLibName();
@@ -1550,7 +1703,7 @@ public class MedRuleConvertFacade {
                     }
                     }
                     billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
                     billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
                 }
                 }
-            } else if (resultRule.getRuleType().equals(6)) {
+            } else if (resultRule.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
                 billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(), resultRule.getRuleLibName(), resultRule.getRuleBaseLibName(), conType, orderType);
                 billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(), resultRule.getRuleLibName(), resultRule.getRuleBaseLibName(), conType, orderType);
             }
             }
         } else if (list.size() > 1) {
         } else if (list.size() > 1) {

+ 19 - 24
cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java

@@ -9,7 +9,6 @@ import com.diagbot.dto.ExportCommonTestDTO;
 import com.diagbot.dto.ExportLisStaticTestDTO;
 import com.diagbot.dto.ExportLisStaticTestDTO;
 import com.diagbot.dto.ExportLisTestDTO;
 import com.diagbot.dto.ExportLisTestDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.ConceptInfo;
 import com.diagbot.entity.DiseaseConfig;
 import com.diagbot.entity.DiseaseConfig;
 import com.diagbot.entity.DrugConfig;
 import com.diagbot.entity.DrugConfig;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlConcept;
@@ -21,7 +20,6 @@ import com.diagbot.entity.PacsConfig;
 import com.diagbot.entity.ResultStaticInfo;
 import com.diagbot.entity.ResultStaticInfo;
 import com.diagbot.entity.ResultStaticKnowledge;
 import com.diagbot.entity.ResultStaticKnowledge;
 import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.ConceptTypeEnum;
-import com.diagbot.enums.GraphLabelEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.enums.StatusEnum;
@@ -64,9 +62,6 @@ import java.util.stream.Collectors;
 public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImpl {
 public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImpl {
     @Autowired
     @Autowired
     private CdssCoreClient cdssCoreClient;
     private CdssCoreClient cdssCoreClient;
-    @Autowired
-    private ConceptInfoFacade conceptInfoFacade;
-
     @Autowired
     @Autowired
     private KlConceptFacade klConceptFacade;
     private KlConceptFacade klConceptFacade;
     @Autowired
     @Autowired
@@ -229,18 +224,18 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
         }
 
 
         //验证静态知识
         //验证静态知识
-        List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
+        List<KlConcept> infoList = klConceptStaticFacade.getAllConcept();
         if (ListUtil.isEmpty(infoList)) {
         if (ListUtil.isEmpty(infoList)) {
             infoList = Lists.newLinkedList();
             infoList = Lists.newLinkedList();
         }
         }
         List<String> lisStaticNames = infoList.stream()
         List<String> lisStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.LisName.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.LisSubName.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
         List<String> lisPackStaticNames = infoList.stream()
         List<String> lisPackStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.LisSet.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.LisName.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 
@@ -419,18 +414,18 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
         }
 
 
         //静态知识
         //静态知识
-        List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
+        List<KlConcept> infoList = klConceptStaticFacade.getAllConcept();
         if (ListUtil.isEmpty(infoList)) {
         if (ListUtil.isEmpty(infoList)) {
             infoList = Lists.newLinkedList();
             infoList = Lists.newLinkedList();
         }
         }
         List<String> pacsStaticNames = infoList.stream()
         List<String> pacsStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.PacsName.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.PacsName.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
         List<String> subPacsPackStaticNames = infoList.stream()
         List<String> subPacsPackStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.PacsSubName.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.PacsSubName.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 
@@ -610,13 +605,13 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
         }
 
 
         //验证静态知识
         //验证静态知识
-        List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
+        List<KlConcept> infoList = klConceptStaticFacade.getAllConcept();
         if (ListUtil.isEmpty(infoList)) {
         if (ListUtil.isEmpty(infoList)) {
             infoList = Lists.newLinkedList();
             infoList = Lists.newLinkedList();
         }
         }
         List<String> drugStaticNames = infoList.stream()
         List<String> drugStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.Medicine.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.Medicine.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 
@@ -766,13 +761,13 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
         }
 
 
         //验证静态知识
         //验证静态知识
-        List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
+        List<KlConcept> infoList = klConceptStaticFacade.getAllConcept();
         if (ListUtil.isEmpty(infoList)) {
         if (ListUtil.isEmpty(infoList)) {
             infoList = Lists.newLinkedList();
             infoList = Lists.newLinkedList();
         }
         }
         List<String> diseaseStaticNames = infoList.stream()
         List<String> diseaseStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.YiBaoDiseaseName.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibName().equals(LexiconEnum.Disease.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 
@@ -922,13 +917,13 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
         }
 
 
         //验证静态知识
         //验证静态知识
-        List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
+        List<KlConcept> infoList = klConceptStaticFacade.getAllConcept();
         if (ListUtil.isEmpty(infoList)) {
         if (ListUtil.isEmpty(infoList)) {
             infoList = Lists.newLinkedList();
             infoList = Lists.newLinkedList();
         }
         }
         List<String> diseaseStaticNames = infoList.stream()
         List<String> diseaseStaticNames = infoList.stream()
-                .filter(i -> i.getType().equals(GraphLabelEnum.YiBaoOperationName.getName()))
-                .map(i -> i.getName())
+                .filter(i -> i.getLibType().equals(LexiconEnum.Operation.getKey()))
+                .map(i -> i.getLibName())
                 .distinct()
                 .distinct()
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnoseBase;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 诊断依据基础表 Mapper 接口
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public interface KlDiagnoseBaseMapper extends BaseMapper<KlDiagnoseBase> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 诊断依据信息表 Mapper 接口
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public interface KlDiagnoseMapper extends BaseMapper<KlDiagnose> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnoseBase;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public interface KlDiagnoseBaseService extends IService<KlDiagnoseBase> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+public interface KlDiagnoseService extends IService<KlDiagnose> {
+
+}

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

@@ -0,0 +1,22 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.mapper.KlDiagnoseBaseMapper;
+import com.diagbot.service.KlDiagnoseBaseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务实现类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+@Service
+@DS("med")
+public class KlDiagnoseBaseServiceImpl extends ServiceImpl<KlDiagnoseBaseMapper, KlDiagnoseBase> implements KlDiagnoseBaseService {
+
+}

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

@@ -0,0 +1,22 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.mapper.KlDiagnoseMapper;
+import com.diagbot.service.KlDiagnoseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务实现类
+ * </p>
+ *
+ * @author wangfeng
+ * @since 2021-03-31
+ */
+@Service
+@DS("med")
+public class KlDiagnoseServiceImpl extends ServiceImpl<KlDiagnoseMapper, KlDiagnose> implements KlDiagnoseService {
+
+}

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

@@ -25,7 +25,7 @@
         GROUP_CONCAT(
         GROUP_CONCAT(
         a.name
         a.name
         ORDER BY
         ORDER BY
-        a.concept_id ASC
+        a.is_concept DESC,a.concept_id ASC
         ) AS synonymName,
         ) AS synonymName,
         b.status,
         b.status,
         b.modifier AS modifierId,
         b.modifier AS modifierId,

+ 28 - 0
cdssman-service/src/main/resources/mapper/KlDiagnoseBaseMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.KlDiagnoseBaseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnoseBase">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="concept_id" property="conceptId" />
+        <result column="description" property="description" />
+        <result column="type" property="type" />
+        <result column="min_operator" property="minOperator" />
+        <result column="min_value" property="minValue" />
+        <result column="min_unit" property="minUnit" />
+        <result column="max_operator" property="maxOperator" />
+        <result column="max_value" property="maxValue" />
+        <result column="max_unit" property="maxUnit" />
+        <result column="eq_operator" property="eqOperator" />
+        <result column="eq_value" property="eqValue" />
+        <result column="eq_unit" property="eqUnit" />
+        <result column="status" property="status" />
+    </resultMap>
+
+</mapper>

+ 18 - 0
cdssman-service/src/main/resources/mapper/KlDiagnoseMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.KlDiagnoseMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.KlDiagnose">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="concept_id" property="conceptId" />
+        <result column="description" property="description" />
+        <result column="status" property="status" />
+    </resultMap>
+
+</mapper>