فهرست منبع

Merge branch 'dev/ruleNew20210727' into dev/ruleClass20210821

gaodm 3 سال پیش
والد
کامیت
7ed3e6fdde

+ 20 - 28
doc/20210727提示规则新需求/med2021_init.sql

@@ -23,7 +23,7 @@ SELECT
 /*
 Navicat MySQL Data Transfer
 
-Source Server         : 192.168.2.236
+Source Server         : 朗通mysql 236联调服务器
 Source Server Version : 50731
 Source Host           : 192.168.2.236:3306
 Source Database       : med_2021
@@ -32,7 +32,7 @@ Target Server Type    : MYSQL
 Target Server Version : 50731
 File Encoding         : 65001
 
-Date: 2021-08-02 16:04:16
+Date: 2021-08-04 11:45:21
 */
 
 SET FOREIGN_KEY_CHECKS=0;
@@ -55,7 +55,7 @@ CREATE TABLE `kl_dictionary_info` (
   `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
   `remark` varchar(300) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=241 DEFAULT CHARSET=utf8 COMMENT='字典表';
+) ENGINE=InnoDB AUTO_INCREMENT=244 DEFAULT CHARSET=utf8 COMMENT='字典表';
 
 -- ----------------------------
 -- Records of kl_dictionary_info
@@ -206,10 +206,10 @@ INSERT INTO `kl_dictionary_info` VALUES ('217', 'N', '1970-01-01 12:00:00', '197
 INSERT INTO `kl_dictionary_info` VALUES ('218', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌人群', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('219', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌性别', '[匹配内容]性患者,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('220', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌疾病', '[匹配内容]患者,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
-INSERT INTO `kl_dictionary_info` VALUES ('221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌医疗器械及物品', '该患者具有[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌医疗器械及物品', '该患者具有[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('222', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌服用药品', '该患者可能正在用药[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('223', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌临床表现', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
-INSERT INTO `kl_dictionary_info` VALUES ('224', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌检查结果', '该患者检查提示[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('224', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌检查结果', '该患者检查提示[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('225', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌查体结果', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('226', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌手术', '该患者有[匹配内容]史,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
 INSERT INTO `kl_dictionary_info` VALUES ('227', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌年龄', '该患者年龄[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
@@ -226,23 +226,9 @@ INSERT INTO `kl_dictionary_info` VALUES ('237', 'N', '1970-01-01 12:00:00', '197
 INSERT INTO `kl_dictionary_info` VALUES ('238', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-辅助检查子项目', '1-110-0', '1', '0', '附加信息特殊处理(非必填)');
 INSERT INTO `kl_dictionary_info` VALUES ('239', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-手术和操作', '1-106-0', '1', '0', '附加信息特殊处理(非必填)');
 INSERT INTO `kl_dictionary_info` VALUES ('240', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-输血类型', '1-113-0', '1', '0', '附加信息特殊处理(非必填)');
-
-/*
-Navicat MySQL Data Transfer
-
-Source Server         : 192.168.2.236
-Source Server Version : 50731
-Source Host           : 192.168.2.236:3306
-Source Database       : med_2021
-
-Target Server Type    : MYSQL
-Target Server Version : 50731
-File Encoding         : 65001
-
-Date: 2021-08-02 16:04:50
-*/
-
-SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO `kl_dictionary_info` VALUES ('241', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-辅助检查项目', '6-109-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('242', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-辅助检查子项目', '6-110-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('243', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-实验室检查套餐', '6-107-0', '1', '0', '附加信息特殊处理(非必填)');
 
 -- ----------------------------
 -- Table structure for kl_rule_plan
@@ -295,7 +281,7 @@ INSERT INTO `kl_rule_plan` VALUES ('62', 'N', '1970-01-01 12:00:00', '1970-01-01
 INSERT INTO `kl_rule_plan` VALUES ('70', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单外等于术语本身', '1', null, '', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('71', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单外存在比较', '2', null, '', '2', '');
 INSERT INTO `kl_rule_plan` VALUES ('72', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '过敏原', '4', null, '', '3', '');
-INSERT INTO `kl_rule_plan` VALUES ('73', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单项', '5', null, '', '4', '');
+INSERT INTO `kl_rule_plan` VALUES ('73', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单项', '5', null, '', '4', '');
 INSERT INTO `kl_rule_plan` VALUES ('74', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '人群', null, null, '117', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('75', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '性别', null, null, '116', '2', '');
 INSERT INTO `kl_rule_plan` VALUES ('76', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '疾病', null, null, '100', '3', '');
@@ -390,7 +376,7 @@ INSERT INTO `kl_rule_plan` VALUES ('323', 'N', '1970-01-01 12:00:00', '1970-01-0
 INSERT INTO `kl_rule_plan` VALUES ('400', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单外等于术语本身', '1', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('401', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单外存在比较', '2', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('402', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '过敏原', '4', null, '', null, '');
-INSERT INTO `kl_rule_plan` VALUES ('403', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单项', '5', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('403', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单项', '5', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('404', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '人群', null, null, '117', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('405', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '性别', null, null, '116', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('406', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '疾病', null, null, '100', null, '');
@@ -414,7 +400,7 @@ INSERT INTO `kl_rule_plan` VALUES ('423', 'N', '1970-01-01 12:00:00', '1970-01-0
 INSERT INTO `kl_rule_plan` VALUES ('500', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单外等于术语本身', '1', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('501', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单外存在比较', '2', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('502', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '过敏原', '4', null, '', null, '');
-INSERT INTO `kl_rule_plan` VALUES ('503', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单项', '5', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('503', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单项', '5', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('504', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '人群', null, null, '117', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('505', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '性别', null, null, '116', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('506', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '疾病', null, null, '100', null, '');
@@ -436,7 +422,7 @@ INSERT INTO `kl_rule_plan` VALUES ('521', 'N', '1970-01-01 12:00:00', '1970-01-0
 INSERT INTO `kl_rule_plan` VALUES ('522', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查项目', null, null, '109', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('523', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查子项目', null, null, '110', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('600', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '20', '开单外等于术语本身', '1', null, '', null, '');
-INSERT INTO `kl_rule_plan` VALUES ('601', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '无子条件', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('601', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '无子条件', null, null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('602', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '开单外等于术语本身', '1', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('603', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '开单外存在比较', '2', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('604', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '600', '药品剂型', null, null, '102', null, '');
@@ -448,7 +434,7 @@ INSERT INTO `kl_rule_plan` VALUES ('609', 'N', '1970-01-01 12:00:00', '1970-01-0
 INSERT INTO `kl_rule_plan` VALUES ('610', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '603', '实验室检查子项目', null, null, '108', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('700', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '30', '开单外等于术语本身', '1', null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('701', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '30', '开单外存在比较', '2', null, '', null, '');
-INSERT INTO `kl_rule_plan` VALUES ('702', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '31', '无子条件', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('702', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '31', '无子条件', null, null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('703', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '700', '人群', null, null, '117', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('704', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '701', '实验室检查子项目', null, null, '108', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('800', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '40', '开单外等于术语本身', '1', null, '', null, '');
@@ -476,7 +462,7 @@ INSERT INTO `kl_rule_plan` VALUES ('903', 'N', '1970-01-01 12:00:00', '1970-01-0
 INSERT INTO `kl_rule_plan` VALUES ('904', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '901', '实验室检查子项目', null, null, '108', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('1000', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '60', '检查结果正则表达式', '6', null, '', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('1001', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '61', '检查结果正则表达式', '6', null, '', '2', '');
-INSERT INTO `kl_rule_plan` VALUES ('1002', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '62', '开单外存在比较', '6', null, '', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('1002', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '62', '开单外存在比较', '2', null, '', '3', '');
 INSERT INTO `kl_rule_plan` VALUES ('1003', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1000', '辅助检查项目', null, null, '109', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('1004', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1001', '辅助检查子项目', null, null, '110', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('1005', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1002', '实验室检查子项目', null, null, '108', null, '');
@@ -537,3 +523,9 @@ INSERT INTO `kl_rule_plan` VALUES ('2424', 'N', '1970-01-01 12:00:00', '1970-01-
 INSERT INTO `kl_rule_plan` VALUES ('2425', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2413', '既往史正则', null, null, '', '1', '');
 INSERT INTO `kl_rule_plan` VALUES ('2426', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2414', '查体正则', null, null, '', null, '');
 INSERT INTO `kl_rule_plan` VALUES ('2427', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2415', '辅检结果正则', null, null, '', null, '');
+
+
+
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='177', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='41', `name`='化验_禁忌性别', `val`='[匹配内容]性患者,不宜开[开单名称],[开单名称]为针对[性别取反]性患者的检验项目', `return_type`='1', `order_no`='0', `remark`='提示语' WHERE (`id`='177');
+
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='192', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='41', `name`='辅检_禁忌性别', `val`='[匹配内容]性患者,不宜开[开单名称],[开单名称]为针对[性别取反]性患者的检查项目', `return_type`='1', `order_no`='0', `remark`='提示语' WHERE (`id`='192');

+ 11 - 8
src/main/java/com/diagbot/dto/IndicationExportDTO.java

@@ -6,12 +6,9 @@ import lombok.Data;
 import java.io.Serializable;
 
 /**
- * <p>
- * 诊断依据导出
- * </p>
- *
- * @author kongwz
- * @since 2020-07-28
+ * @description: 开单导出
+ * @author: zhoutg
+ * @date: 2021/8/2 13:40
  */
 @Data
 public class IndicationExportDTO implements Serializable {
@@ -26,8 +23,8 @@ public class IndicationExportDTO implements Serializable {
     private String baseName = "";
     @Excel(name="规则类型", width = 15, orderNum = "35")
     private String baseType;
-    @Excel(name="其他条件", width = 10, orderNum = "40")
-    private String otherType;
+    @Excel(name="禁忌类型", width = 15, orderNum = "40")
+    private String tabooType;
     @Excel(name="最大值", width = 10, orderNum = "50")
     private String maxValue;
     @Excel(name="最大值符号", width = 10, orderNum = "60")
@@ -36,4 +33,10 @@ public class IndicationExportDTO implements Serializable {
     private String minValue;
     @Excel(name="最小值符号", width = 10, orderNum = "80")
     private String minOperator;
+    @Excel(name="原因及建议", width = 15, orderNum = "90")
+    private String msg;
+    @Excel(name="ruleId", width = 10, orderNum = "100")
+    private Long ruleId;
+    @Excel(name="condId", width = 10, orderNum = "110")
+    private Long condId;
 }

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

@@ -18,7 +18,7 @@ public class KlRuleByIdDTO {
     private Long parConceptId;//提示概念id
     private String parlibName;
     private Integer parHasSub;//是否有子条件(0:无,1:有)
-    //private String parMsg;//附加信息
+    private String parMsg;//附加信息
     private Integer parStatus;//启用状态(0:禁用,1:启用)
     private String parLenName;
     private String parLenCode;

+ 3 - 1
src/main/java/com/diagbot/dto/WordCrfDTO.java

@@ -36,7 +36,7 @@ public class WordCrfDTO {
     private Double ageNum;
     // 性别(1:男,2:女)
     private Integer sex;
-    //科室
+    // 科室
     private List<Item> dept = new ArrayList<>();
     // 化验项目和结果
     private List<Lis> lis = new ArrayList<>();
@@ -112,6 +112,8 @@ public class WordCrfDTO {
     private String family = "";
     // 查体
     private String vital = "";
+    // 婚姻
+    private String marriage = "";
 
     // 【诊断数据来源】
     private List<Item> diagSource = new ArrayList<>();

+ 6 - 6
src/main/java/com/diagbot/enums/ConEnum.java

@@ -17,14 +17,14 @@ public enum ConEnum implements KeyedNamed {
     oralmeds(4, "禁忌服用药品"),
     allergicmeds(5, "禁忌过敏药品"),
     operations(6, "禁忌手术"),
-    procedures(7, "禁忌操作"),
-    lis(8, "禁忌实验室检查"),
-    pacs(9, "禁忌辅助检查"),
+    procedures(7, "禁忌操作"), // 未使用
+    lis(8, "禁忌检验结果"),
+    pacs(9, "禁忌检查项目"), // 未使用
     disease(10, "禁忌疾病"),
     group(11, "禁忌人群"),
-    conflictmeds(12, "配伍禁忌"),
-    vitals(13, "禁忌查体"),
-    pacsDesc(14, "禁忌辅助检查描述"),
+    conflictmeds(12, "配伍禁忌"), // 未使用
+    vitals(13, "禁忌查体结果"),
+    pacsDesc(14, "禁忌检查结果"),
     medEqu(15, "禁忌医疗器械及物品"),
     exclusion(16, "开单项互斥"),
     otherAllergy(17, "禁忌其他过敏原"),

+ 9 - 0
src/main/java/com/diagbot/facade/BillFacade.java

@@ -108,6 +108,15 @@ public class BillFacade {
                 ruleVO.setLibTypeName(TypeEnum.lis.getName());
                 ruleVO.setDateValue(lis.getDateValue());
                 ruleVOList.add(ruleVO);
+
+                RuleVO ruleVO1 = new RuleVO();
+                ruleVO1.setInputName(lis.getName());
+                ruleVO1.setLibName(lis.getUniqueName());
+                ruleVO1.setLibType(LexiconEnum.LisName.getKey());
+                ruleVO1.setLibTypeName(TypeEnum.lis.getName());
+                ruleVO1.setSuffix(String.valueOf(RuleTypeEnum.repeat.getKey()));
+                ruleVO1.setDateValue(lis.getDateValue());
+                ruleVOList.add(ruleVO1);
             }
         }
 

+ 5 - 2
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -153,6 +153,9 @@ public class CommonFacade {
         if (StringUtil.isNotBlank(searchData.getMarital())) {
             wordCrfDTO.setMarital(searchData.getMarital());
         }
+        if (StringUtil.isNotBlank(searchData.getMarriage())) {
+            wordCrfDTO.setMarriage(searchData.getMarriage());
+        }
         if (StringUtil.isNotBlank(searchData.getPersonal())) {
             wordCrfDTO.setPersonal(searchData.getPersonal());
         }
@@ -160,13 +163,13 @@ public class CommonFacade {
             wordCrfDTO.setVital(searchData.getVital());
         }
 
-        //模型处理数据
+        // 模型处理数据
         aiAnalyze.aiProcess(searchData, wordCrfDTO);
 
         // 统一处理化验、辅检、诊断,放入结构化
         processLisPacsDiag(wordCrfDTO);
 
-        // 现病史体征内容放入体征标签
+        // 现病史体征内容放入体征标签
         processPresentVital(wordCrfDTO);
 
         // 加入分词

+ 3 - 3
src/main/java/com/diagbot/facade/KlRuleFacade.java

@@ -65,7 +65,7 @@ public class KlRuleFacade extends KlRuleServiceImpl {
             klRuleByIdPar.setParConceptId(byIdRuleInfo.get(0).getParConceptId());
             klRuleByIdPar.setParlibName(byIdRuleInfo.get(0).getParlibName());
             klRuleByIdPar.setParHasSub(byIdRuleInfo.get(0).getParHasSub());//是否有子条件(0:无,1:有)
-            //klRuleByIdPar.setParMsg(byIdRuleInfo.get(0).getParMsg());//附加信息
+            klRuleByIdPar.setParMsg(byIdRuleInfo.get(0).getParMsg());//附加信息
             klRuleByIdPar.setParStatus(byIdRuleInfo.get(0).getParStatus());//启用状态(0:禁用,1:启用)
             klRuleByIdPar.setParLenName(byIdRuleInfo.get(0).getParLenName());
             klRuleByIdPar.setParLenCode(byIdRuleInfo.get(0).getParLenCode());
@@ -107,7 +107,7 @@ public class KlRuleFacade extends KlRuleServiceImpl {
                     .set(StringUtil.isNotBlank(klRuleInfoSaveVO.getParRuleType().toString()), "rule_type", klRuleInfoSaveVO.getParRuleType())
                     .set(StringUtil.isNotBlank(klRuleInfoSaveVO.getParHasSub().toString()), "has_sub_cond", klRuleInfoSaveVO.getParHasSub())
                     .set(StringUtil.isNotBlank(klRuleInfoSaveVO.getParStatus().toString()), "status", klRuleInfoSaveVO.getParStatus())
-                    //.set(StringUtil.isNotBlank(klRuleInfoSaveVO.getParMsg()), "msg", klRuleInfoSaveVO.getParMsg())
+                    .set(StringUtil.isNotBlank(klRuleInfoSaveVO.getParMsg()), "msg", klRuleInfoSaveVO.getParMsg())
                     .set("modifier", klRuleInfoSaveVO.getModifier())
                     .set("gmt_modified", now);
             res = this.update(klRuleUpdate);
@@ -127,7 +127,7 @@ public class KlRuleFacade extends KlRuleServiceImpl {
             klRule.setDescription(klRuleInfoSaveVO.getParDescription());
             klRule.setHasSubCond(klRuleInfoSaveVO.getParHasSub());
             klRule.setRuleType(klRuleInfoSaveVO.getParRuleType());
-            //klRule.setMsg(klRuleInfoSaveVO.getParMsg());
+            klRule.setMsg(klRuleInfoSaveVO.getParMsg());
             klRule.setStatus(klRuleInfoSaveVO.getParStatus());
             klRule.setGmtCreate(now);
             klRule.setGmtModified(now);

+ 16 - 4
src/main/java/com/diagbot/process/BillProcess.java

@@ -117,7 +117,10 @@ public class BillProcess {
                                     case Disease: // 诊断
                                         commonRule.compareItemWithBill(diags, ruleBaseDTO, billMsgList, ConEnum.disease.getName(), ruleSimpleDTO);
                                         break;
-                                    case LisSubName: // 化验
+                                    case LisName: // 化验开单互斥
+                                        commonRule.exclusionBill(wordCrfDTO.getLisOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                        break;
+                                    case LisSubName: // 化验结果
                                         lisRule.bill(wordCrfDTO.getLis(), ruleBaseDTO, billMsgList, ConEnum.lis.getName(), ruleSimpleDTO);
                                         break;
                                     case VitalResult: //体格检查结果
@@ -128,7 +131,7 @@ public class BillProcess {
                                     case PacsSubName: // 辅助检查子项目
                                         if (ruleBaseDTO.getBaseType() != null && ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B5.getKey())) {
                                             // 开单项互斥
-                                            commonRule.exclusionBill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                            commonRule.exclusionBill(wordCrfDTO.getPacsOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
                                         } else {
                                             // 辅检项目,暂无数据
                                             pacsRule.bill(wordCrfDTO.getPacs(), ruleBaseDTO, billMsgList, ConEnum.pacs.getName(), ruleSimpleDTO);
@@ -173,8 +176,17 @@ public class BillProcess {
                         break;
                     case repeat:  // redis 数据以 _6结尾
                         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-                            // 无需重复开单项
-                            commonRule.needlessRepeatOrder(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                            switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                                case PacsName: // 辅助检查项目
+                                case PacsSubName: // 辅助检查子项目
+                                    // 辅检正常值,无需重复开单项
+                                    commonRule.needlessRepeatOrderPacs(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                                    break;
+                                case LisSubName: // 化验结果
+                                    // 化验正常值,无需重复开单项
+                                    commonRule.needlessRepeatOrderLis(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                                    break;
+                            }
                         }
                         break;
                     default:

+ 94 - 31
src/main/java/com/diagbot/rule/CommonRule.java

@@ -1,5 +1,6 @@
 package com.diagbot.rule;
 
+import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BaseDiagnoseDTO;
 import com.diagbot.dto.BillMsg;
@@ -233,15 +234,16 @@ public class CommonRule {
         }
     }
 
+
     /**
-     * 无需重复开单项
+     * 正常结果,无需重复开单项——辅检
      *
      * @param wordCrfDTO
      * @param ruleBaseDTO
      * @param billMsgList
      * @param ruleSimpleDTO
      */
-    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
+    public void needlessRepeatOrderPacs(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         String orderStandName = ruleBaseDTO.getBaseLibName();
         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
         List<Pacs> pacsList = map.get(orderStandName);
@@ -253,17 +255,42 @@ public class CommonRule {
                     && RegexUtil.getRegexRes(result, ruleBaseDTO.getBaseEqValue())) {
                 String dateValue = pacs.getDateValue(); // 结果日期
                 String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
-                if (StringUtil.isNotBlank(dateValue) && StringUtil.isNotBlank(orderDateValue)) {
-                    Date dateValueDate = CatalogueUtil.parseStringDate(dateValue);
-                    Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
-                    if (dateValueDate != null && orderDateValueDate != null) {
-                        if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7, false)) {
-                            ruleSimpleDTO.setContent(pacs.getName());
-                            ruleSimpleDTO.setConType(conType);
-                            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
-                            CoreUtil.addBeanToList(billMsgList, billMsg);
-                        }
-                    }
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                if (flag == 1) {
+                    ruleSimpleDTO.setContent(result);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
+                }
+            }
+        }
+    }
+
+    /**
+     * 正常结果,无需重复开单项——化验
+     *
+     * @param wordCrfDTO
+     * @param ruleBaseDTO
+     * @param billMsgList
+     * @param ruleSimpleDTO
+     */
+    public void needlessRepeatOrderLis(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
+        String orderStandName = ruleBaseDTO.getBaseLibName();
+        Map<String, List<Lis>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getLis(), "uniqueName");
+        List<Lis> lisList = map.get(orderStandName);
+        if (ListUtil.isNotEmpty(lisList)) {
+            sortByProperty(lisList, "dateValue");
+            Lis lis = lisList.get(lisList.size() - 1); // 按时间排序,取最后一条
+            Map<String, Object> lisMap = CoreUtil.compareLis(ruleBaseDTO, lis);
+            if (CoreUtil.getMapFlag(lisMap)) {
+                String dateValue = lis.getDateValue(); // 结果日期
+                String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                if (flag == 1) { // 有效期范围内
+                    ruleSimpleDTO.setContent(CoreUtil.getMapMsg(lisMap));
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }
@@ -325,33 +352,69 @@ public class CommonRule {
         // repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName(), ConEnum.repeat24.getName()); // 输血重复开单
     }
 
+    // /**
+    //  * 互斥开单项——辅检
+    //  *
+    //  * @param wordCrfDTO
+    //  * @param ruleBaseDTO
+    //  * @param billMsgList
+    //  * @param ruleSimpleDTO
+    //  * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+    //  */
+    // public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+    //     // 辅检开单项互斥
+    //     List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
+    //     if (ListUtil.isNotEmpty(pacsOrder) && pacsOrder.size() > 1) {
+    //         // 不同的辅检项目可能对应同一个uniqueName,提示显示多条
+    //         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(pacsOrder, "uniqueName");
+    //         List<Pacs> orginNameList = map.get(ruleBaseDTO.getBaseLibName()); // 互斥名称
+    //         if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
+    //             for (Pacs pacs : orginNameList) {
+    //                 String orginName = pacs.getName();
+    //                 // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+    //                 if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
+    //                     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
+    //                     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
+    //                     ruleSimpleDTO.setContent(orginName);
+    //                     ruleSimpleDTO.setConType(conType);
+    //                     BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+    //                     CoreUtil.addBeanToList(billMsgList, billMsg);
+    //                 }
+    //             }
+    //         }
+    //     }
+    // }
+
     /**
      * 互斥开单项
      *
-     * @param wordCrfDTO
+     * @param orderList      开单列表
      * @param ruleBaseDTO
      * @param billMsgList
      * @param ruleSimpleDTO
      * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
      */
-    public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
-        // 辅检开单项互斥
-        List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
-        if (ListUtil.isNotEmpty(pacsOrder) && pacsOrder.size() > 1) {
-            // 不同的辅检项目可能对应同一个uniqueName,提示显示多条
-            Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(pacsOrder, "uniqueName");
-            List<Pacs> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
+    public <T> void exclusionBill(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+        if (ListUtil.isNotEmpty(orderList) && orderList.size() > 1) {
+            // 不同的项目可能对应同一个uniqueName,提示显示多条
+            Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
+            List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
             if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
-                for (Pacs pacs : orginNameList) {
-                    String orginName = pacs.getName();
-                    // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-                    if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
-                        set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
-                        set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-                        ruleSimpleDTO.setContent(orginName);
-                        ruleSimpleDTO.setConType(conType);
-                        BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
-                        CoreUtil.addBeanToList(billMsgList, billMsg);
+                for (T bean : orginNameList) {
+                    String orderDateValue = ReflectUtil.getProperty(ruleSimpleDTO, "dateValue");
+                    String beanDateValue = ReflectUtil.getProperty(bean, "dateValue");
+                    int dateFlag = CoreUtil.compareTime(beanDateValue, orderDateValue);
+                    if (dateFlag == 1) {
+                        String orginName = ReflectUtil.getProperty(bean, "name");
+                        // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+                        // if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
+                        //     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
+                        //     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
+                            ruleSimpleDTO.setContent(orginName);
+                            ruleSimpleDTO.setConType(conType);
+                            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                            CoreUtil.addBeanToList(billMsgList, billMsg);
+                        // }
                     }
                 }
             }

+ 36 - 2
src/main/java/com/diagbot/rule/GroupRule.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RegexUtil;
+import com.diagbot.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -73,10 +74,15 @@ public class GroupRule {
     public Map rule(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO) {
         Map res = new LinkedHashMap();
         Double age = wordCrfDTO.getAgeNum();
+        Integer sex = wordCrfDTO.getSex();
         // 妊娠目前从诊断里判断,包含“妊娠”
         String symptom = wordCrfDTO.getSymptom(); // 现病史内容
         String menstrual = wordCrfDTO.getMenstrual(); // 月经史
+        String marriage = wordCrfDTO.getMarriage(); // 婚姻
+        String marital = wordCrfDTO.getMarital();// 婚育史
         boolean flag = false;
+        String regex = "";
+        String regex2 = "";
         List<String> nameList = CoreUtil.getSplit(ruleBaseDTO.getBaseLibName());
         for (String name : nameList) {
             switch (name) {
@@ -90,8 +96,8 @@ public class GroupRule {
                     flag = commonRule.containsItem(wordCrfDTO.getDiag(), name);
                     break;
                 case "月经期":
-                    String regex = "月经第(([零一二三四五六七八九十]{0,3})||([0-9]{0,2}))天";
-                    String regex2 = "(?<!上一次)经期";
+                    regex = "月经第(([零一二三四五六七八九十]{0,3})||([0-9]{0,2}))天";
+                    regex2 = "(?<!上一次)经期";
                     if (RegexUtil.getRegexRes(symptom, regex) || RegexUtil.getRegexRes(menstrual, regex)
                             || RegexUtil.getRegexRes(symptom, regex2) || RegexUtil.getRegexRes(menstrual, regex2)) {
                         flag = true;
@@ -121,6 +127,34 @@ public class GroupRule {
                         flag = true;
                     }
                     break;
+                case "未婚女性":
+                    regex = "未婚";
+                    if (sex == 2 &&
+                            (RegexUtil.getRegexRes(marriage, regex) || "2".equals(marriage) || RegexUtil.getRegexRes(marital, regex))
+                    ) {
+                        flag = true;
+                    }
+                    break;
+                case "未经产妇":
+                    regex = "(\\d+)-(\\d+)-(\\d+)-(\\d+)";
+                    if (sex == 2 && StringUtil.isNotBlank(marital) && RegexUtil.getRegexRes(marital, regex)) {
+                        if (Integer.parseInt(RegexUtil.getRegexData(marital, regex, 1))
+                                + Integer.parseInt(RegexUtil.getRegexData(marital, regex, 2))
+                                + Integer.parseInt(RegexUtil.getRegexData(marital, regex, 3)) == 0) {
+                            flag = true;
+                        }
+                    }
+                    break;
+                case "经产妇":
+                    regex = "(\\d+)-(\\d+)-(\\d+)-(\\d+)";
+                    if (sex == 2 && StringUtil.isNotBlank(marital) && RegexUtil.getRegexRes(marital, regex)) {
+                        if (Integer.parseInt(RegexUtil.getRegexData(marital, regex, 1))
+                                + Integer.parseInt(RegexUtil.getRegexData(marital, regex, 2))
+                                + Integer.parseInt(RegexUtil.getRegexData(marital, regex, 3)) >= 1) {
+                            flag = true;
+                        }
+                    }
+                    break;
                 default:
                     break;
             }

+ 19 - 0
src/main/java/com/diagbot/rule/PacsRule.java

@@ -123,6 +123,25 @@ public class PacsRule {
                             }
                         }
                         break;
+                    case Disease: // 诊断
+                        map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
+                    case LisSubName: // 检验结果
+                        map = CoreUtil.compareLis(ruleBaseDTO, wordCrfDTO.getLis());
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
+                    case VitalResult: //体格检查结果
+                    case Vital: // 体格检查项目
+                        map = CoreUtil.compareVital(ruleBaseDTO, wordCrfDTO.getVitalLabel());
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
                     default:
                         break;
                 }

+ 0 - 33
src/main/java/com/diagbot/util/CatalogueUtil.java

@@ -153,39 +153,6 @@ public class CatalogueUtil {
         return false;
     }
 
-    /**
-     * 比较时间,以分钟为单位
-     * endDate比startDate多diff分钟则返回true
-     *
-     * @param startDate
-     * @param endDate
-     * @param diff
-     * @return
-     */
-    public static boolean compareTime(Date startDate, Date endDate, Long diff) {
-        boolean overtime = false;
-        if (startDate == null || endDate == null) {
-            return false;
-        }
-        Calendar calendar_s = Calendar.getInstance();
-        Calendar calendar_e = Calendar.getInstance();
-        Long time_s, time_e;
-        try {
-            calendar_s.setTime(startDate);
-            calendar_e.setTime(endDate);
-
-            time_s = calendar_s.getTimeInMillis();
-            time_e = calendar_e.getTimeInMillis();
-
-            if ((time_e - time_s) >  diff * 1000 * 60) {
-                overtime = true;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return overtime;
-    }
-
     /**
      * 比较时间,以分钟为单位
      * endDate比startDate多diff分钟则返回true

+ 101 - 16
src/main/java/com/diagbot/util/CoreUtil.java

@@ -23,6 +23,7 @@ import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -264,7 +265,7 @@ public class CoreUtil {
      */
     public static <T> void setUninameFromDetail(List<T> list, String targetProperty) {
         for (T r : list) {
-            String value = (String)getFieldValue(r, "uniqueName");
+            String value = (String) getFieldValue(r, "uniqueName");
             if (StringUtil.isBlank(value)) {
                 String detailName = (String) getFieldValue(r, targetProperty);
                 ReflectUtil.setProperty(r, "uniqueName", detailName);
@@ -338,16 +339,16 @@ public class CoreUtil {
                     if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
                         // 有医院原值就提示医院值
                         if (StringUtil.isNotBlank(lis.getResult())) {
-                            map.put("msg", lis.getDetailName() + lis.getResult());
+                            map.put("msg", lis.getDetailName() + "结果" + lis.getResult());
                         } else {
-                            map.put("msg", lis.getDetailName() + lis.getOtherValue());
+                            map.put("msg", lis.getDetailName() + "结果" + lis.getOtherValue());
                         }
                     } else {
                         // 有医院原值就提示医院值
                         if (StringUtil.isNotBlank(lis.getResult())) {
-                            map.put("msg", lis.getName() + lis.getDetailName() + lis.getResult());
+                            map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getResult());
                         } else {
-                            map.put("msg", lis.getName() + lis.getDetailName() + lis.getOtherValue());
+                            map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getOtherValue());
                         }
                     }
                     flag = true;
@@ -358,15 +359,15 @@ public class CoreUtil {
                 if (flag) {
                     if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
                         if (StringUtil.isNotBlank(lis.getResult())) {
-                            map.put("msg", lis.getDetailName() + lis.getResult());
+                            map.put("msg", lis.getDetailName() + "结果" + lis.getResult());
                         } else {
-                            map.put("msg", lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                            map.put("msg", lis.getDetailName() + "结果" + subZeroAndDot(String.valueOf(lis.getValue())));
                         }
                     } else {
                         if (StringUtil.isNotBlank(lis.getResult())) {
-                            map.put("msg", lis.getName() + lis.getDetailName() + lis.getResult());
+                            map.put("msg", lis.getName() + lis.getDetailName() + "结果" + lis.getResult());
                         } else {
-                            map.put("msg", lis.getName() + lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                            map.put("msg", lis.getName() + lis.getDetailName() + "结果" + subZeroAndDot(String.valueOf(lis.getValue())));
                         }
                     }
                 }
@@ -662,9 +663,9 @@ public class CoreUtil {
                 int indexSui = ageStr.indexOf("岁");
                 ageArr[0] = ageStr.substring(0, indexSui);
                 if (ageStr.indexOf("个月") > -1) { // 3岁7个月
-                    ageArr[1] = ageStr.substring(indexSui + 1,ageStr.indexOf("个月"));
+                    ageArr[1] = ageStr.substring(indexSui + 1, ageStr.indexOf("个月"));
                 } else { // 3岁7月
-                    ageArr[1] = ageStr.substring(indexSui + 1,ageStr.indexOf("月"));
+                    ageArr[1] = ageStr.substring(indexSui + 1, ageStr.indexOf("月"));
                 }
                 return Double.parseDouble(ageArr[0]) + getHalfUp(Double.parseDouble(ageArr[1]) / 12);
             }
@@ -854,6 +855,22 @@ public class CoreUtil {
         return false;
     }
 
+    /**
+     * 获取mapMsg值
+     *
+     * @param map
+     * @return
+     */
+    public static String getMapMsg(Map map) {
+        if (map != null && map.get("flag") != null && (Boolean) map.get("flag") == true) {
+            String msg = (String) map.get("msg");
+            if (StringUtil.isNotBlank(msg)) {
+                return msg;
+            }
+        }
+        return "";
+    }
+
     /**
      * 获取mapMsgList值
      *
@@ -1041,12 +1058,13 @@ public class CoreUtil {
 
     /**
      * 将字符串以“,”分隔,添加到list列表中
+     *
      * @param list
      * @param s
      */
     public static void addSplitString(List<Long> list, String s) {
         if (StringUtil.isBlank(s)) {
-            return ;
+            return;
         }
         list.addAll(Arrays.stream(s.split(",")).map(r -> Long.parseLong(r)).collect(Collectors.toList()));
     }
@@ -1059,7 +1077,7 @@ public class CoreUtil {
      */
     public static void removeRepeat(List<String> orginList, List<String> splitList) {
         if (ListUtil.isEmpty(orginList) || ListUtil.isEmpty(splitList)) {
-            return ;
+            return;
         }
         Iterator<String> iterator = orginList.iterator();
         while (iterator.hasNext()) {
@@ -1084,7 +1102,7 @@ public class CoreUtil {
         }
         for (T t : tList) {
             for (String key : propertyName) {
-                String name = (String)getFieldValue(t, key);
+                String name = (String) getFieldValue(t, key);
                 // 去重
                 if (StringUtil.isNotBlank(name) && !list.contains(name)) {
                     list.add(name);
@@ -1115,13 +1133,13 @@ public class CoreUtil {
      */
     public static <T> void removeRepeat(List<T> source, String property) {
         if (ListUtil.isEmpty(source) || source.size() < 2) {
-            return ;
+            return;
         }
         List<Object> list = Lists.newArrayList();
         Iterator<T> iterator = source.iterator();
         T t = null;
         Object object = null;
-        while(iterator.hasNext()) {
+        while (iterator.hasNext()) {
             t = iterator.next();
             object = getFieldValue(t, property);
             if (object != null) {
@@ -1162,6 +1180,7 @@ public class CoreUtil {
 
     /**
      * 根据分隔符转成list
+     *
      * @param name
      * @return
      */
@@ -1183,6 +1202,72 @@ public class CoreUtil {
         return Lists.newArrayList(name.split(splitSymbol));
     }
 
+    /**
+     * 时间差值(绝对值)和指定分钟数进行比较
+     *
+     * @param startDateStr 开始时间
+     * @param endDateStr   结束时间
+     * @param minute       分钟
+     * @param hasEqual     是否包含等于
+     * @return 返回值:-1:无法比较或出错,0:时间差超出范围,1:时间差在范围内
+     */
+    public static int compareTime(String startDateStr, String endDateStr, Long minute, boolean hasEqual) {
+        int flag = -1;
+        if (StringUtil.isBlank(startDateStr) || StringUtil.isBlank(endDateStr)) {
+            return flag;
+        }
+        try {
+            Date startDate = CatalogueUtil.parseStringDate(startDateStr);
+            Date endDate = CatalogueUtil.parseStringDate(endDateStr);
+            Long timeStart = startDate.getTime();
+            Long timeEnd = endDate.getTime();
+
+            if (hasEqual) {
+                if (Math.abs(timeEnd - timeStart) >= minute * 1000 * 60) {
+                    flag = 0;
+                } else {
+                    flag = 1;
+                }
+            } else {
+                if (Math.abs(timeEnd - timeStart) > minute * 1000 * 60) {
+                    flag = 0;
+                } else {
+                    flag = 1;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 比较时间,endDateStr >= startDateStr
+     * @param startDateStr
+     * @param endDateStr
+     * @return -1:无法比较或出错,0:endDateStr < startDateStr,1:endDateStr >= startDateStr
+     */
+    public static int compareTime(String startDateStr, String endDateStr) {
+        int flag = -1;
+        if (StringUtil.isBlank(startDateStr) || StringUtil.isBlank(endDateStr)) {
+            return flag;
+        }
+        try {
+            Date startDate = CatalogueUtil.parseStringDate(startDateStr);
+            Date endDate = CatalogueUtil.parseStringDate(endDateStr);
+            Long timeStart = startDate.getTime();
+            Long timeEnd = endDate.getTime();
+            if (timeEnd >= timeStart) {
+                flag = 1;
+            } else {
+                flag = 0;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
     public static void main(String[] args) {
         List<PushBaseDTO> pushBaseDTOList = ListUtil.newArrayList();
         PushBaseDTO pushBaseDTO = new PushBaseDTO();

+ 18 - 7
src/main/java/com/diagbot/util/MsgNewUtil.java

@@ -33,21 +33,32 @@ public class MsgNewUtil {
         String unionMsg = ruleSimpleDTO.getMsg(); // 原因及建议
         String msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), orderType + "_" + conType);
         if (StringUtil.isBlank(msg)) {
-            msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), "通用" + "_" + "默认提示语");
+            // msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), "通用" + "_" + "默认提示语");
+            msg = "";
         }
         BillMsg billMsg = new BillMsg();
-        // 去除2个“具有”的提示语
+        // 出现2个“具有”,去除一个为空
         if (ConEnum.medEqu.getName().equals(conType) && StringUtil.isNotBlank(content)
-                && content.startsWith("具有") && msg.endsWith("具有")) {
-            msg.replaceAll("具有", "");
+                && content.startsWith("具有") && msg.startsWith("该患者具有")) {
+            msg = msg.replaceAll("具有", "");
         }
-        msg = msg.replaceAll("\\[匹配内容]", content);
-        msg = msg.replaceAll("\\[开单名称]", orderName);
         if (StringUtil.isNotBlank(unionMsg)) {
-            msg = msg.replaceAll("\\[原因及建议]", unionMsg);
+            msg = msg.replaceAll("\\[原因及建议]", "," + unionMsg);
         } else {
             msg = msg.replaceAll("\\[原因及建议]", "");
         }
+        // [性别取反]标签替换
+        if (ConEnum.gender.getName().equals(conType)) {
+            if ("男".equals(content)) {
+                msg = msg.replaceAll("\\[性别取反]", "女");
+            } else if ("女".equals(content)) {
+                msg = msg.replaceAll("\\[性别取反]", "男");
+            }
+        }
+
+        // 放到最后统一替换【多处匹配】
+        msg = msg.replaceAll("\\[匹配内容]", content);
+        msg = msg.replaceAll("\\[开单名称]", orderName);
         billMsg.setMsg(msg);
         billMsg.setOrderName(orderName);
         billMsg.setOrderStandName(orderStandName);

+ 4 - 0
src/main/java/com/diagbot/vo/KlRuleInfoSaveVO.java

@@ -28,6 +28,10 @@ public class KlRuleInfoSaveVO {
     private Integer parHasSub;//是否有子条件(0:无,1:有)
     @ApiModelProperty(hidden = true)
     private Integer parStatus = 1;//启用状态(0:禁用,1:启用)
+    /**
+     * 附加信息
+     */
+    private String parMsg;
 /*    private String parlibName;
     private String parLenName;
     private String parLenCode;*/

+ 13 - 8
src/main/resources/mapper/KlRuleMapper.xml

@@ -180,6 +180,7 @@
         a.concept_id AS parconceptId,
         b.lib_name AS parlibName,
         a.has_sub_cond AS parHasSub,
+        a.msg AS parMsg,
         a.status AS parStatus,
         c.name AS parLenName,
         c.code AS parLenCode
@@ -233,10 +234,12 @@
             tt1.par_type,
             tt2.lib_name base_name,
             xx2.NAME base_type,
-            CASE tt1.type
-                when '4' then '过敏原'
-                when '5' then '辅检开单互斥'
-                else '' end other_type,
+            CASE
+                when tt1.type = '4' and xx2.`name` in ('药品通用名','药品化学物质类别','药品治疗学类别','药品药理学类别','药品解剖学类别') then '药物过敏原'
+                when tt1.type = '1' and xx2.`name` in ('药品通用名','药品化学物质类别','药品治疗学类别','药品药理学类别','药品解剖学类别') then '服用药品'
+                when tt1.type = '5' then '开单项互斥'
+                else xx2.name
+			end taboo_type,
             tt1.eq_value,
             tt1.min_value,
             tt1.min_operator,
@@ -244,8 +247,10 @@
             tt1.max_value,
             tt1.max_operator,
             tt1.max_unit,
+			tt1.description,
+			tt1.msg,
             tt1.rule_id,
-            tt1.description
+            tt1.cond_id
         FROM
             (
                 SELECT
@@ -256,7 +261,8 @@
                     t1.description,
                     t1.rule_type,
                     t1.has_sub_cond,
-                    t1.msg,
+                    t2.id cond_id,
+					t2.msg,
                     t3.type,
                     t3.concept_id base_id,
                     t3.eq_value,
@@ -289,8 +295,7 @@
         AND tt2.`status` = 1
         AND tt1.base_id = tt2.id
         LEFT JOIN kl_lexicon xx2 ON tt2.lib_type = xx2. CODE
-        ORDER BY
-            rule_id
+        ORDER BY par_name, rule_id
     </select>
 
     <select id="getRuleInitDTO" resultType="com.diagbot.dto.RuleInitDTO">