소스 검색

Merge branch 'develop' into dev/staticKnowledge20210407

gaodm 4 년 전
부모
커밋
4146cdeccf
100개의 변경된 파일4534개의 추가작업 그리고 770개의 파일을 삭제
  1. 403 0
      doc/005.20210315诊断依据维护脚本/med2021_init.sql
  2. 8 0
      doc/005.20210315诊断依据维护脚本/sys-user_init.sql
  3. 1 2
      src/main/java/com/diagbot/CdssCoreApplication.java
  4. 118 0
      src/main/java/com/diagbot/aggregate/PushNewAggregate.java
  5. 0 23
      src/main/java/com/diagbot/client/ChiefPresentSimilarityServiceClient.java
  6. 27 0
      src/main/java/com/diagbot/client/PushNewServiceClient.java
  7. 1 1
      src/main/java/com/diagbot/client/StandConvertNewServiceClient.java
  8. 0 17
      src/main/java/com/diagbot/client/hystrix/ChiefPresentSimilarityServiceHystrix.java
  9. 25 0
      src/main/java/com/diagbot/client/hystrix/PushNewServiceHystrix.java
  10. 14 2
      src/main/java/com/diagbot/config/CacheDeleteInit.java
  11. 88 0
      src/main/java/com/diagbot/dto/BaseDiagnoseDTO.java
  12. 17 0
      src/main/java/com/diagbot/dto/DiagnoseDTO.java
  13. 18 0
      src/main/java/com/diagbot/dto/DiagnosesFindDTO.java
  14. 2 2
      src/main/java/com/diagbot/dto/IndexDTO.java
  15. 88 0
      src/main/java/com/diagbot/dto/KlDiagnoseByIdDTO.java
  16. 33 0
      src/main/java/com/diagbot/dto/KlDiagnoseGroupDTO.java
  17. 48 0
      src/main/java/com/diagbot/dto/KlDiagnoseInfoDTO.java
  18. 29 0
      src/main/java/com/diagbot/dto/KlDiagnoseTypeDTO.java
  19. 12 10
      src/main/java/com/diagbot/dto/PushDTO.java
  20. 19 0
      src/main/java/com/diagbot/dto/PushDiagnoseDTO.java
  21. 19 0
      src/main/java/com/diagbot/dto/PushNewDTO.java
  22. 14 0
      src/main/java/com/diagbot/dto/PushReloadDTO.java
  23. 16 0
      src/main/java/com/diagbot/dto/ReverseDTO.java
  24. 6 0
      src/main/java/com/diagbot/dto/WordCrfDTO.java
  25. 153 0
      src/main/java/com/diagbot/entity/KlDiagnose.java
  26. 293 0
      src/main/java/com/diagbot/entity/KlDiagnoseBase.java
  27. 85 0
      src/main/java/com/diagbot/entity/KlDiagnoseCondition.java
  28. 21 0
      src/main/java/com/diagbot/entity/wrapper/KlDiagnoseBaseWrapper.java
  29. 63 0
      src/main/java/com/diagbot/enums/BaseDiagnoseTypeEnum.java
  30. 66 0
      src/main/java/com/diagbot/enums/DiagnoseTypeEnum.java
  31. 68 0
      src/main/java/com/diagbot/enums/PushTypeEnum.java
  32. 5 1
      src/main/java/com/diagbot/enums/RedisEnum.java
  33. 66 0
      src/main/java/com/diagbot/enums/RelationshipEnum.java
  34. 71 0
      src/main/java/com/diagbot/facade/CacheFacade.java
  35. 87 4
      src/main/java/com/diagbot/facade/CommonFacade.java
  36. 17 6
      src/main/java/com/diagbot/facade/ConceptInfoFacade.java
  37. 3 6
      src/main/java/com/diagbot/facade/IndicationFacade.java
  38. 13 0
      src/main/java/com/diagbot/facade/KlDiagnoseBaseFacade.java
  39. 13 0
      src/main/java/com/diagbot/facade/KlDiagnoseConditionFacade.java
  40. 282 0
      src/main/java/com/diagbot/facade/KlDiagnoseFacade.java
  41. 15 1
      src/main/java/com/diagbot/facade/KlDictionaryInfoFacade.java
  42. 23 17
      src/main/java/com/diagbot/facade/KlRegularConfigFacade.java
  43. 32 0
      src/main/java/com/diagbot/facade/LisConfigFacade.java
  44. 11 4
      src/main/java/com/diagbot/facade/NeoFacade.java
  45. 167 15
      src/main/java/com/diagbot/facade/PushFacade.java
  46. 17 0
      src/main/java/com/diagbot/facade/TestFacade.java
  47. 6 0
      src/main/java/com/diagbot/mapper/ConceptInfoMapper.java
  48. 20 0
      src/main/java/com/diagbot/mapper/KlDiagnoseBaseMapper.java
  49. 16 0
      src/main/java/com/diagbot/mapper/KlDiagnoseConditionMapper.java
  50. 34 0
      src/main/java/com/diagbot/mapper/KlDiagnoseMapper.java
  51. 38 3
      src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java
  52. 0 44
      src/main/java/com/diagbot/model/ai/ModelAI.java
  53. 1 1
      src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java
  54. 21 47
      src/main/java/com/diagbot/process/BillProcess.java
  55. 460 65
      src/main/java/com/diagbot/process/PushProcess.java
  56. 15 0
      src/main/java/com/diagbot/rule/AgeRule.java
  57. 66 39
      src/main/java/com/diagbot/rule/CommonRule.java
  58. 16 1
      src/main/java/com/diagbot/rule/GroupRule.java
  59. 19 0
      src/main/java/com/diagbot/rule/LisRule.java
  60. 15 0
      src/main/java/com/diagbot/rule/VitalRule.java
  61. 6 0
      src/main/java/com/diagbot/service/ConceptInfoService.java
  62. 20 0
      src/main/java/com/diagbot/service/KlDiagnoseBaseService.java
  63. 16 0
      src/main/java/com/diagbot/service/KlDiagnoseConditionService.java
  64. 34 0
      src/main/java/com/diagbot/service/KlDiagnoseService.java
  65. 8 2
      src/main/java/com/diagbot/service/impl/ConceptInfoServiceImpl.java
  66. 26 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseBaseServiceImpl.java
  67. 20 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseConditionServiceImpl.java
  68. 49 0
      src/main/java/com/diagbot/service/impl/KlDiagnoseServiceImpl.java
  69. 0 1
      src/main/java/com/diagbot/util/CatalogueUtil.java
  70. 159 159
      src/main/java/com/diagbot/util/Constants.java
  71. 176 32
      src/main/java/com/diagbot/util/CoreUtil.java
  72. 0 46
      src/main/java/com/diagbot/util/GenericNode.java
  73. 7 7
      src/main/java/com/diagbot/util/ParamUtil.java
  74. 0 88
      src/main/java/com/diagbot/util/QCCatalogue.java
  75. 54 30
      src/main/java/com/diagbot/util/RedisUtil.java
  76. 28 0
      src/main/java/com/diagbot/vo/DiagnoseVO.java
  77. 20 0
      src/main/java/com/diagbot/vo/DiagnosesFindVO.java
  78. 19 0
      src/main/java/com/diagbot/vo/KlDiagnoseByIdVO.java
  79. 18 0
      src/main/java/com/diagbot/vo/KlDiagnoseClearVO.java
  80. 63 0
      src/main/java/com/diagbot/vo/KlDiagnoseDetailVO.java
  81. 33 0
      src/main/java/com/diagbot/vo/KlDiagnoseGroupVO.java
  82. 26 0
      src/main/java/com/diagbot/vo/KlDiagnoseInfoVO.java
  83. 19 0
      src/main/java/com/diagbot/vo/KlDiagnoseSatarDisVO.java
  84. 31 0
      src/main/java/com/diagbot/vo/KlDiagnoseSaveVO.java
  85. 29 0
      src/main/java/com/diagbot/vo/KlDiagnoseTypeVO.java
  86. 18 0
      src/main/java/com/diagbot/vo/PushNewVO.java
  87. 19 0
      src/main/java/com/diagbot/vo/ReverseVO.java
  88. 14 0
      src/main/java/com/diagbot/vo/TestCrfVO.java
  89. 40 1
      src/main/java/com/diagbot/web/CacheController.java
  90. 2 3
      src/main/java/com/diagbot/web/CoreController.java
  91. 95 0
      src/main/java/com/diagbot/web/KlDiagnoseController.java
  92. 11 1
      src/main/java/com/diagbot/web/KlRegularConfigController.java
  93. 31 7
      src/main/java/com/diagbot/web/TestController.java
  94. 7 6
      src/main/resources/application-dev.yml
  95. 6 9
      src/main/resources/application-local.yml
  96. 46 45
      src/main/resources/application-pre.yml
  97. 7 6
      src/main/resources/application-pro.yml
  98. 7 6
      src/main/resources/application-test.yml
  99. 66 10
      src/main/resources/mapper/ConceptInfoMapper.xml
  100. 0 0
      src/main/resources/mapper/KlDiagnoseBaseMapper.xml

+ 403 - 0
doc/005.20210315诊断依据维护脚本/med2021_init.sql

@@ -0,0 +1,403 @@
+USE `med_2021`;
+/*
+121数据库 已执行
+ALTER TABLE `med_2021`.`kl_lis` CHANGE `min_value` `min_value` DOUBLE(11,5) DEFAULT 0.00000 NULL COMMENT '最小值', CHANGE `max_value` `max_value` DOUBLE(11,5) DEFAULT 0.00000 NULL COMMENT '最大值';
+*/
+
+/*
+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-04-02 10:06:11
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for kl_dictionary_info
+-- ----------------------------
+DROP TABLE IF EXISTS `kl_dictionary_info`;
+CREATE TABLE `kl_dictionary_info` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `group_type` bigint(20) NOT NULL DEFAULT '0' COMMENT '分组(值自定义)',
+  `name` varchar(100) NOT NULL DEFAULT '' COMMENT '内容',
+  `val` varchar(255) NOT NULL DEFAULT '' COMMENT '值',
+  `return_type` int(11) NOT NULL DEFAULT '1' COMMENT '返回类型(0: 都返回,1:后台维护返回 2:界面返回)',
+  `order_no` int(11) NOT NULL DEFAULT '0' COMMENT '排序号',
+  `remark` varchar(300) DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8 COMMENT='字典表';
+
+-- ----------------------------
+-- Records of kl_dictionary_info
+-- ----------------------------
+INSERT INTO `kl_dictionary_info` VALUES ('1', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '全部', '0', '2', '1', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('2', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '诊断', '1', '2', '10', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('3', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '药品', '2', '2', '20', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('4', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '检验', '3', '2', '30', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('5', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '检查', '5', '2', '40', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('6', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '手术和操作', '6', '2', '50', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('80', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '诊断', '疾病', '1', '100', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('81', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品', '药品通用名', '1', '101', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('82', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品剂型', '药品剂型', '1', '102', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('83', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '症状', '症状', '1', '103', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('84', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '体格检查项目', '体格检查项目', '1', '104', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('85', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '体格检查结果', '体格检查结果', '1', '105', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('86', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '手术和操作', '手术和操作', '1', '106', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('87', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '检验套餐', '实验室检查套餐', '1', '107', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('88', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '检验细项', '实验室检查子项目', '1', '108', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('89', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '检查', '辅助检查项目', '1', '109', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('90', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '检查子项', '辅助检查子项目', '1', '110', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('91', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '辅助检查描述', '辅助检查描述', '1', '111', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('92', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '辅助检查结果', '辅助检查结果', '1', '112', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('93', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '输血类型', '输血类型', '1', '113', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('94', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '麻醉', '麻醉', '1', '114', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('95', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '科室', '科室', '1', '115', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('96', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '性别', '性别', '1', '116', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('97', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '人群', '人群', '1', '117', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('98', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '食物', '食物', '1', '118', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('99', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '其他过敏原', '其他过敏原', '1', '119', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('100', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '医疗器械及物品', '医疗器械及物品', '1', '120', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('101', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '给药途径', '给药途径', '1', '121', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('102', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '部位', '部位', '1', '122', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('103', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '护理', '护理', '1', '123', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('104', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '量表', '量表', '1', '124', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('105', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '单位', '单位', '1', '125', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('106', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', 'ICD10疾病类别', 'ICD10疾病类别', '1', '300', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('107', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品化学物质类别', '药品化学物质类别', '1', '301', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('108', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品治疗学类别', '药品治疗学类别', '1', '302', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('109', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品药理学类别', '药品药理学类别', '1', '303', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('110', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品解剖学类别', '药品解剖学类别', '1', '304', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('111', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '症状类别', '症状类别', '1', '305', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('112', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '手术和操作类别', '手术和操作类别', '1', '306', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('113', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', 'ICD10疾病类别根节点', 'ICD10疾病类别根节点', '1', '400', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('114', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '科室疾病类别根节点', '科室疾病类别根节点', '1', '401', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('115', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品化学物质类别根节点', '药品化学物质类别根节点', '1', '402', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('116', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品治疗学类别根节点', '药品治疗学类别根节点', '1', '403', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('117', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品药理学类别根节点', '药品药理学类别根节点', '1', '404', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('118', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '药品解剖学类别根节点', '药品解剖学类别根节点', '1', '405', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('119', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '症状类别根节点', '症状类别根节点', '1', '406', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('120', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '手术和操作类别根节点', '手术和操作类别根节点', '1', '407', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('121', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '实验室检查类别根节点', '实验室检查类别根节点', '1', '408', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('122', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '辅助检查类别根节点', '辅助检查类别根节点', '1', '409', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('123', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '年龄', '年龄', '1', '410', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('124', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '20', '危急值-实验室检查子项目', '3-108-2', '1', '0', '化验规则维护特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('125', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '20', '其他值提醒-实验室检查子项目', '4-108-2', '1', '0', '化验规则维护特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('126', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '20', '其他值提醒输血-实验室检查子项目', '5-108-2', '1', '0', '化验规则维护特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('127', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '高危-药品通用名', '2-101', '1', '0', '附加信息特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('128', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '其他值提醒-辅助检查结果', '4-112', '1', '0', '附加信息特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('129', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '其他值提醒输血-实验室检查子项目', '5-108', '1', '0', '附加信息特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('130', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '20', '正常项目重复开立-辅助检查项目', '6-109-6', '1', '0', '化验规则维护特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('131', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '20', '正常项目重复开立-辅助检查子项目', '6-110-6', '1', '0', '化验规则维护特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('132', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '开单外等于术语本身', '1', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('133', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '开单外存在比较', '2', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('134', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '开单外不等于术语本身', '3', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('135', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '过敏原', '4', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('136', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '开单项', '5', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('137', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '31', '检查结果正则表达式', '6', '1', '0', '基础规则类型');
+INSERT INTO `kl_dictionary_info` VALUES ('138', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '22', '开单合理性-年龄-体格检查项目', '410,104', '1', '0', '开单合理性只有数字没有文本');
+INSERT INTO `kl_dictionary_info` VALUES ('139', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '23', '复杂情况下高风险手术-手术和操作', '2-106', '1', '0', '高危手术存在有无子条件特殊处理');
+INSERT INTO `kl_dictionary_info` VALUES ('140', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '24', '诊断依据存在比较-年龄-体格检查项目', '410,104', '1', '0', '诊断依据存在比较只有数字没有文本');
+INSERT INTO `kl_dictionary_info` VALUES ('141', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '25', '诊断依据存在比较-实验室检查子项目', '108', '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-04-02 10:06:20
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for kl_rule_plan
+-- ----------------------------
+DROP TABLE IF EXISTS `kl_rule_plan`;
+CREATE TABLE `kl_rule_plan` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '资源ID',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `plan_code` varchar(255) DEFAULT NULL COMMENT '方案编码(rule规则dis诊断依据)',
+  `rule_type` bigint(20) DEFAULT NULL COMMENT '规则类型(1:开单合理性;2:高危;3:危急值;4:其他值提醒;5:其他值提醒输血;6:正常项目重复开立)',
+  `parent_id` bigint(20) DEFAULT NULL COMMENT '-1:表示顶级,其他值表示上级菜单的id',
+  `name` varchar(255) DEFAULT NULL COMMENT '基础规则类型',
+  `type` int(2) DEFAULT NULL,
+  `number` int(11) DEFAULT NULL COMMENT '条件数量',
+  `code` varchar(255) DEFAULT NULL COMMENT '类型编码',
+  `order_no` int(11) DEFAULT NULL COMMENT '显示顺序',
+  `remark` varchar(255) DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2429 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+-- Records of kl_rule_plan
+-- ----------------------------
+INSERT INTO `kl_rule_plan` VALUES ('1', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '-1', '开单合理性', '1', null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '-1', '高危', '2', null, '', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('3', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '-1', '危急值', '3', null, '', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('4', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '-1', '其他值提醒', '4', null, '', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('5', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '-1', '其他值提醒输血', '5', null, '', '5', null);
+INSERT INTO `kl_rule_plan` VALUES ('6', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '-1', '正常项目重复开立', '6', null, '', '6', null);
+INSERT INTO `kl_rule_plan` VALUES ('10', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '药品通用名', null, '1', '101', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('11', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '实验室检查套餐', null, '1', '107', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('12', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '辅助检查项目', null, '1', '109', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('13', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '辅助检查子项目', null, '1', '110', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('14', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '手术和操作', null, '1', '106', '5', null);
+INSERT INTO `kl_rule_plan` VALUES ('15', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '1', '输血类型', null, '1', '113', '6', null);
+INSERT INTO `kl_rule_plan` VALUES ('20', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '2', '药品通用名', null, '1', '101', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('21', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '2', '手术和操作', null, '1', '106', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('30', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '3', '实验室检查子项目', null, '2', '108', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('31', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '3', '辅助检查结果', null, '0', '112', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('40', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '4', '实验室检查子项目', null, '2', '108', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('41', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '4', '辅助检查结果', null, '2', '112', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('50', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '5', '实验室检查子项目', null, '2', '108', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('60', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '6', '辅助检查项目', null, '1', '109', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('61', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '6', '辅助检查子项目', null, '1', '110', '2', null);
+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', null);
+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', null);
+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', null);
+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', null);
+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', null);
+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', null);
+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', null);
+INSERT INTO `kl_rule_plan` VALUES ('77', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '医疗器械及物品', null, null, '120', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('78', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '药品通用名', null, null, '101', '5', null);
+INSERT INTO `kl_rule_plan` VALUES ('79', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '症状', null, null, '103', '6', null);
+INSERT INTO `kl_rule_plan` VALUES ('80', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '辅助检查结果', null, null, '112', '7', null);
+INSERT INTO `kl_rule_plan` VALUES ('81', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '体格检查结果', null, null, '105', '8', null);
+INSERT INTO `kl_rule_plan` VALUES ('82', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '手术和操作', null, null, '106', '9', null);
+INSERT INTO `kl_rule_plan` VALUES ('83', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '71', '年龄', null, null, '410', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('84', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '71', '体格检查项目', null, null, '104', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('85', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '71', '实验室检查子项目', null, null, '108', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('86', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '药品通用名', null, null, '101', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('87', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '药品化学物质类别', null, null, '301', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('88', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '药品治疗学类别', null, null, '302', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('89', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '药品药理学类别', null, null, '303', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('90', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '药品解剖学类别', null, null, '304', '5', null);
+INSERT INTO `kl_rule_plan` VALUES ('91', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '72', '其他过敏原', null, null, '119', '6', null);
+INSERT INTO `kl_rule_plan` VALUES ('92', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '73', '辅助检查项目', null, null, '109', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('93', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '73', '辅助检查子项目', null, null, '110', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('100', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '11', '开单外等于术语本身', '1', null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('101', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '11', '开单外存在比较', '2', null, '', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('102', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '11', '过敏原', '4', null, '', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('103', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '11', '开单项', '5', null, '', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('104', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '人群', null, null, '117', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('105', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '性别', null, null, '116', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('106', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('107', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '医疗器械及物品', null, null, '120', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('108', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('109', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '症状', null, null, '103', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('110', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('111', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('112', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '100', '手术和操作', null, null, '106', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('113', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '101', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('114', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '101', '体格检查项目', null, null, '104', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('115', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '101', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('116', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('117', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '药品化学物质类别', null, null, '301', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('118', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '药品治疗学类别', null, null, '302', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('119', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '药品药理学类别', null, null, '303', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('120', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '药品解剖学类别', null, null, '304', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('121', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '102', '其他过敏原', null, null, '119', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('122', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '103', '辅助检查项目', null, null, '109', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('123', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '103', '辅助检查子项目', null, null, '110', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('200', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '12', '开单外等于术语本身', '1', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('201', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '12', '开单外存在比较', '2', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('202', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '12', '过敏原', '4', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('203', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '12', '开单项', '5', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('204', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '人群', null, null, '117', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('205', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '性别', null, null, '116', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('206', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('207', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '医疗器械及物品', null, null, '120', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('208', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('209', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '症状', null, null, '103', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('210', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('211', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('212', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '200', '手术和操作', null, null, '106', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('213', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '201', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('214', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '201', '体格检查项目', null, null, '104', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('215', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '201', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('216', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('217', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '药品化学物质类别', null, null, '301', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('218', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '药品治疗学类别', null, null, '302', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('219', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '药品药理学类别', null, null, '303', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('220', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '药品解剖学类别', null, null, '304', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '202', '其他过敏原', null, null, '119', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('222', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '203', '辅助检查项目', null, null, '109', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('223', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '203', '辅助检查子项目', null, null, '110', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('300', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '13', '开单外等于术语本身', '1', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('301', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '13', '开单外存在比较', '2', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('302', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '13', '过敏原', '4', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('303', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '13', '开单项', '5', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('304', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '人群', null, null, '117', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('305', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '性别', null, null, '116', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('306', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('307', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '医疗器械及物品', null, null, '120', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('308', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('309', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '症状', null, null, '103', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('310', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('311', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('312', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '300', '手术和操作', null, null, '106', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('313', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '301', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('314', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '301', '体格检查项目', null, null, '104', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('315', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '301', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('316', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('317', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '药品化学物质类别', null, null, '301', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('318', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '药品治疗学类别', null, null, '302', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('319', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '药品药理学类别', null, null, '303', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('320', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '药品解剖学类别', null, null, '304', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('321', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '302', '其他过敏原', null, null, '119', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('322', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '303', '辅助检查项目', null, null, '109', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('323', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '303', '辅助检查子项目', null, null, '110', null, null);
+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, 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, 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, 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, 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, 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, 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, null);
+INSERT INTO `kl_rule_plan` VALUES ('407', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '医疗器械及物品', null, null, '120', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('408', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('409', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '症状', null, null, '103', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('410', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('411', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('412', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '手术和操作', null, null, '106', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('413', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '401', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('414', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '401', '体格检查项目', null, null, '104', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('415', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '401', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('416', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('417', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '药品化学物质类别', null, null, '301', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('418', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '药品治疗学类别', null, null, '302', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('419', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '药品药理学类别', null, null, '303', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('420', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '药品解剖学类别', null, null, '304', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('421', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '402', '其他过敏原', null, null, '119', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('422', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '403', '辅助检查项目', null, null, '109', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('423', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '403', '辅助检查子项目', null, null, '110', null, null);
+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, 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, 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, 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, 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, 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, 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, null);
+INSERT INTO `kl_rule_plan` VALUES ('507', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '医疗器械及物品', null, null, '120', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('508', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('509', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '症状', null, null, '103', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('510', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('511', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('512', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '手术和操作', null, null, '106', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('513', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '501', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('514', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '501', '体格检查项目', null, null, '104', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('515', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '501', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('516', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('517', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '药品化学物质类别', null, null, '301', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('518', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '药品治疗学类别', null, null, '302', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('519', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '药品药理学类别', null, null, '303', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('520', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '药品解剖学类别', null, null, '304', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('521', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '502', '其他过敏原', null, null, '119', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('522', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查项目', null, null, '109', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('523', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查子项目', null, null, '110', null, 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, 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, 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, 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, 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, null);
+INSERT INTO `kl_rule_plan` VALUES ('605', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '602', '体格检查结果', null, null, '105', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('606', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '602', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('607', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '602', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('608', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '603', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('609', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '603', '体格检查项目', null, null, '104', null, null);
+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, 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, 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, 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, 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, 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, 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, null);
+INSERT INTO `kl_rule_plan` VALUES ('801', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '40', '开单外存在比较', '2', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('802', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '41', '开单外等于术语本身', '1', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('803', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '41', '开单外存在比较', '2', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('804', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '41', '开单外不等于术语本身', '3', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('805', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '800', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('806', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '800', '药品通用名', null, null, '101', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('807', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '800', '人群', null, null, '117', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('808', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '801', '实验室检查子项目', null, null, '108', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('809', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '802', '人群', null, null, '117', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('810', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '802', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('811', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '802', '性别', null, null, '116', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('812', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '803', '年龄', null, null, '410', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('813', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '804', '辅助检查结果', null, null, '112', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('900', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '50', '开单外等于术语本身', '1', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('901', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '50', '开单外存在比较', '2', null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('902', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '900', '疾病', null, null, '100', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('903', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '900', '手术和操作', null, null, '106', null, null);
+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, 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', null);
+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', null);
+INSERT INTO `kl_rule_plan` VALUES ('1002', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1000', '辅助检查项目', null, null, '109', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('1003', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1001', '辅助检查子项目', null, null, '110', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2200', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '-1', '拟诊', null, null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('2210', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '等于术语本身', '1', null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2211', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '存在比较', '2', null, '', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2212', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '主诉现病史正则', '3', null, '', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2213', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '既往史正则', '4', null, '', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2214', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '症状', null, null, '103', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2215', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '体格检查结果', null, null, '105', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2216', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '疾病', null, null, '100', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2217', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '人群', null, null, '117', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2218', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '年龄', null, null, '410', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2219', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '体格检查项目', null, null, '104', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2220', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '实验室检查子项目', null, null, '108', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2212', '主诉现病史正则', null, null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2222', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2213', '既往史正则', null, null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2300', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '-1', '确诊', null, null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('2310', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '等于术语本身', '1', null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2311', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '存在比较', '2', null, '', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2312', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '主诉现病史正则', '3', null, '', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2313', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '既往史正则', '4', null, '', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2314', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '症状', null, null, '103', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2315', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '体格检查结果', null, null, '105', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2316', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '疾病', null, null, '100', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2317', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '人群', null, null, '117', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2318', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '年龄', null, null, '410', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2319', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '体格检查项目', null, null, '104', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2320', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '实验室检查子项目', null, null, '108', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2321', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2312', '主诉现病史正则', null, null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2322', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2313', '既往史正则', null, null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2400', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '-1', '警惕', null, null, '', null, null);
+INSERT INTO `kl_rule_plan` VALUES ('2410', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '等于术语本身', '1', null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2411', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '存在比较', '2', null, '', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2412', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '主诉现病史正则', '3', null, '', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2413', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '既往史正则', '4', null, '', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2414', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '症状', null, null, '103', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2415', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '体格检查结果', null, null, '105', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2416', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '疾病', null, null, '100', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2417', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '人群', null, null, '117', '4', null);
+INSERT INTO `kl_rule_plan` VALUES ('2418', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '年龄', null, null, '410', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2419', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '体格检查项目', null, null, '104', '2', null);
+INSERT INTO `kl_rule_plan` VALUES ('2420', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '实验室检查子项目', null, null, '108', '3', null);
+INSERT INTO `kl_rule_plan` VALUES ('2421', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2412', '主诉现病史正则', null, null, '', '1', null);
+INSERT INTO `kl_rule_plan` VALUES ('2422', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2413', '既往史正则', null, null, '', '1', null);

+ 8 - 0
doc/005.20210315诊断依据维护脚本/sys-user_init.sql

@@ -0,0 +1,8 @@
+USE `sys-user`;
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `order_no`, `remark`) VALUES('N','1970-01-01 12:00:00','1970-01-01 12:00:00','-1','0','诊断依据维护','97','LT-ZSKKZWH-ZUYJ','5','朗通-知识库扩展维护-诊断依据维护');
+
+
+INSERT INTO sys_role_menu (role_id, menu_id,remark) SELECT c.id, a.id,a.remark  FROM sys_menu a INNER JOIN sys_role c
+  WHERE a.name IN ("诊断依据维护") AND a.is_deleted = "N"  AND a.creator = - 1  AND c.name = "CDSS知识库";
+

+ 1 - 2
src/main/java/com/diagbot/CdssCoreApplication.java

@@ -13,9 +13,8 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
 import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 
-
 /**
- * @Description: 病历质控系统启动文件
+ * @Description: 系统启动文件
  * @author: zhoutg
  * @time: 2018/8/7 9:26
  */

+ 118 - 0
src/main/java/com/diagbot/aggregate/PushNewAggregate.java

@@ -0,0 +1,118 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.PushBaseDTO;
+import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.PushNewDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.enums.DiagnoseTypeEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.process.PushProcess;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.PushNewVO;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 提醒类聚合
+ * @author: zhoutg
+ * @time: 2019/10/16 13:37
+ */
+@Component
+@Slf4j
+public class PushNewAggregate {
+
+    @Autowired
+    PushProcess pushProcess;
+    @Autowired
+    PushNewServiceClient pushNewServiceClient;
+
+    @DataProvider("pushAll")
+    public PushDTO push(
+            @InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
+            @InvokeParameter("pushNewVO") PushNewVO pushNewVO,
+            @DataConsumer("pushBigData") PushDTO pushBigData,
+            @DataConsumer("pushDiagnose") PushDTO pushDiagnose) {
+
+        PushDTO res = new PushDTO();
+        Map<String, Object> debug = new LinkedHashMap<>();
+        Map<String, List<PushBaseDTO>> dis = new LinkedHashMap<>();
+        res.setDis(dis);
+        res.setDebug(debug);
+        if (pushDiagnose != null) {
+            if (pushDiagnose.getDis() != null) {
+                dis.putAll(pushDiagnose.getDis());
+            }
+            debug.putAll(pushDiagnose.getDebug());
+        }
+        if (pushBigData != null) {
+            if (pushBigData.getDis() != null) {
+                dis.putAll(pushBigData.getDis());
+            }
+            debug.putAll(pushBigData.getDebug());
+        }
+        return res;
+    }
+
+    /**
+     * 诊断依据推理
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    @DataProvider("pushDiagnose")
+    public PushDTO pushDiagnose(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO) {
+        PushDTO pushDTO = pushProcess.pushDiagnose(wordCrfDTO);
+        return pushDTO;
+    }
+
+    /**
+     * 大数据推理
+     *
+     * @param pushNewVO
+     * @return
+     */
+    @DataProvider("pushBigData")
+    public PushDTO pushBigData(@InvokeParameter("pushNewVO") PushNewVO pushNewVO,
+                               @InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO) {
+        PushDTO pushDTO = new PushDTO();
+        Map<String, List<PushBaseDTO>> dis = new LinkedHashMap<>();
+        pushDTO.setDis(dis);
+        long start = System.currentTimeMillis();
+        try {
+            PushNewDTO pushNewDTO = pushNewServiceClient.pushNew(pushNewVO);
+            if (pushNewDTO == null || (pushNewDTO != null && pushNewDTO.getStatus().equals(-1))) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "大数据推理出错");
+            }
+            // 根据现有信息,无法推送相关疾病
+            if (pushNewDTO.getStatus().equals(1)) {
+                CoreUtil.getDebugStr("【大数据推理无诊断结果】", "无法推送相关疾病", pushDTO.getDebug());
+            } else if (pushNewDTO.getStatus().equals(0)) {
+                if (ListUtil.isNotEmpty(pushNewDTO.getDisease())) {
+                    List<PushBaseDTO> pushBaseDTOList = pushNewDTO.getDisease().stream().map(r -> {
+                        PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                        pushBaseDTO.setName(r);
+                        return pushBaseDTO;
+                    }).collect(Collectors.toList());
+                    dis.put(DiagnoseTypeEnum.bigDataPush.getName(), pushBaseDTOList);
+                }
+            }
+        } catch (Exception e) {
+            log.error("【大数据推理出错】", e);
+            CoreUtil.getDebugStr("【大数据推理出错】", "大数据推理出错", pushDTO.getDebug());
+        }
+        CoreUtil.getDebugStr(start, "推送诊断耗时_大数据", pushDTO.getDebug());
+        return pushDTO;
+    }
+}

+ 0 - 23
src/main/java/com/diagbot/client/ChiefPresentSimilarityServiceClient.java

@@ -1,23 +0,0 @@
-package com.diagbot.client;
-
-
-import com.diagbot.vo.ChiefPresentSimilarityVo;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
-
-/**
- * @Description: 调用主诉现病史症状相似度服务
- * @author: 胡敬
- * @time: 2020/06/01 15:41
- */
-@FeignClient(value = "ChiefPresentSimilarity-service", url="${ChiefPresentSimilarity.url}")
-public interface ChiefPresentSimilarityServiceClient {
-
-    @PostMapping(value = "/api/mr_info_ex/chief_present_similarity")
-    String getAnnotation(@RequestBody ChiefPresentSimilarityVo chiefPresentSimilarityVo);
-}
-
-
-

+ 27 - 0
src/main/java/com/diagbot/client/PushNewServiceClient.java

@@ -0,0 +1,27 @@
+package com.diagbot.client;
+
+import com.diagbot.client.hystrix.PushNewServiceHystrix;
+import com.diagbot.dto.PushNewDTO;
+import com.diagbot.dto.PushReloadDTO;
+import com.diagbot.vo.PushNewVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @description: CDSS新推送
+ * @author: zhoutg
+ * @date: 2021/3/24 15:24
+ */
+@FeignClient(value = "PushNew-service", url="${PushNew.url}", fallback = PushNewServiceHystrix.class)
+public interface PushNewServiceClient {
+
+    @PostMapping(value = "/api/disease")
+    PushNewDTO pushNew(@RequestBody PushNewVO pushNewVO);
+
+    @PostMapping(value = "/api/reloadPushDB")
+    PushReloadDTO reloadPushDB();
+}
+
+
+

+ 1 - 1
src/main/java/com/diagbot/client/StandConvertNewServiceClient.java

@@ -19,7 +19,7 @@ public interface StandConvertNewServiceClient {
     @PostMapping(value = "/api/similarity")
     StandConvertCrfDTO similarity(StandConvertCrfVO standConvertCrfVO);
 
-    @PostMapping(value = "/api/similarity_batch")
+    @PostMapping(value = "/es/word_type_body")
     StandConvertCrfBatchDTO similarityBatch(List<StandConvertCrfVO> standConvertCrfVOList);
 }
 

+ 0 - 17
src/main/java/com/diagbot/client/hystrix/ChiefPresentSimilarityServiceHystrix.java

@@ -1,17 +0,0 @@
-package com.diagbot.client.hystrix;
-
-import com.diagbot.client.ChiefPresentSimilarityServiceClient;
-import com.diagbot.vo.ChiefPresentSimilarityVo;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-@Component
-@Slf4j
-public class ChiefPresentSimilarityServiceHystrix implements ChiefPresentSimilarityServiceClient {
-
-    @Override
-    public String getAnnotation(ChiefPresentSimilarityVo chiefPresentSimilarityVo) {
-        log.error("【hystrix】调用{}异常", "Similarity-getAnnotation");
-        return null;
-    }
-}

+ 25 - 0
src/main/java/com/diagbot/client/hystrix/PushNewServiceHystrix.java

@@ -0,0 +1,25 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.PushNewDTO;
+import com.diagbot.dto.PushReloadDTO;
+import com.diagbot.vo.PushNewVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Slf4j
+public class PushNewServiceHystrix implements PushNewServiceClient {
+
+    @Override
+    public PushNewDTO pushNew(PushNewVO pushNewVO) {
+        log.error("【hystrix】调用{}异常", "pushNew");
+        return null;
+    }
+
+    @Override
+    public PushReloadDTO reloadPushDB() {
+        log.error("【hystrix】调用{}异常", "reloadDB");
+        return null;
+    }
+}

+ 14 - 2
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -38,8 +38,20 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.getdiseaseFilterCache();
         log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
 
-        cacheFacade.loadAllRuleCache();
-        log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
+         cacheFacade.loadAllRuleCache();
+         log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
+
+        cacheFacade.loadAllBaseDiagnoseCache();
+        log.info("CDSS-CORE服务启动加载诊断依据缓存成功!");
+
+        cacheFacade.loadHostipalPush();
+        log.info("CDSS-CORE服务启动加载医院大数据推送类型成功!");
+
+//        cacheFacade.getDiseaseCorrespondCache();
+//        log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");
+//
+//        cacheFacade.getdiseaseFilterCache();
+//        log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
 
         //无用的缓存
         //

+ 88 - 0
src/main/java/com/diagbot/dto/BaseDiagnoseDTO.java

@@ -0,0 +1,88 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 10:49
+ */
+@Getter
+@Setter
+public class BaseDiagnoseDTO {
+    /**
+     * 联合唯一键
+     */
+    private String baseKey;
+
+    /**
+     * id逗号隔开
+     */
+    private String ids;
+
+    /**
+     * 医学基本术语
+     */
+    private String baseLibName;
+
+    /**
+     * 术语类型
+     */
+    private Integer baseLibType;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    private Integer baseType;
+
+    /**
+     * 最小域比较符
+     */
+    private String baseMinOperator;
+
+    /**
+     * 最小域值
+     */
+    private String baseMinValue;
+
+    /**
+     * 最小域单位
+     */
+    private String baseMinUnit;
+
+    /**
+     * 最大域比较符
+     */
+    private String baseMaxOperator;
+
+    /**
+     * 最大域值
+     */
+    private String baseMaxValue;
+
+    /**
+     * 最大域单位
+     */
+    private String baseMaxUnit;
+
+    /**
+     * 等于域比较符
+     */
+    private String baseEqOperator;
+
+    /**
+     * 等于域值
+     */
+    private String baseEqValue;
+
+    /**
+     * 等于域单位
+     */
+    private String baseEqUnit;
+}

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

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 11:21
+ */
+@Getter
+@Setter
+public class DiagnoseDTO {
+    private Long conceptId;
+    private String libName;
+    private Integer conditionType;
+}

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

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-29 11:06
+ */
+@Setter
+@Getter
+public class DiagnosesFindDTO {
+
+    private Long conceptId;
+
+    private String conceptName;
+}

+ 2 - 2
src/main/java/com/diagbot/dto/IndexDTO.java

@@ -14,8 +14,8 @@ public class IndexDTO {
     private Long id;
     private String name;
     private String icd10Code;
-    private String maxValue;
-    private String minValue;
+    private Double maxValue;
+    private Double minValue;
     private String units;
     private Integer range;
     private Long packId;

+ 88 - 0
src/main/java/com/diagbot/dto/KlDiagnoseByIdDTO.java

@@ -0,0 +1,88 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 15:26
+ */
+@Setter
+@Getter
+public class KlDiagnoseByIdDTO {
+    private Long id;
+    private String description;//规则名称
+    private Long conceptId;//提示概念id
+    private String libName;
+    private Integer libType;
+    private String lename;
+    private Integer status;//启用状态(0:禁用,1:启用)
+    /**
+     * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
+     */
+    private Integer conditionType;
+
+    /**
+     * 规则组别(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer conditionGroup;
+
+    /**
+     * 符合数量(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer fitNo;
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+    /**
+     * 描述
+     */
+    private String basDescription;
+    private Long basConceptId;
+    private String basLibName;
+    private Integer basLibType;
+    private String basLename;
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    private Integer basType;
+    /**
+     * 最小域比较符
+     */
+    private String minOperator;
+    /**
+     * 最小域值
+     */
+    private String minVal;
+
+    /**
+     * 最小域单位
+     */
+    private String minUnit;
+    /**
+     * 最大域比较符
+     */
+    private String maxOperator;
+    /**
+     * 最大域值
+     */
+    private String maxVal;
+    /**
+     * 最大域单位
+     */
+    private String maxUnit;
+    /**
+     * 等于域比较符
+     */
+    private String eqOperator;
+    /**
+     * 等于域值
+     */
+    private String eqValue;
+    /**
+     * 等于域单位
+     */
+    private String eqUnit;
+}

+ 33 - 0
src/main/java/com/diagbot/dto/KlDiagnoseGroupDTO.java

@@ -0,0 +1,33 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-22 10:33
+ */
+@Setter
+@Getter
+public class KlDiagnoseGroupDTO {
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+    /**
+     * 满足的条件
+     */
+    private Integer fitNo;
+    /**
+     * 上一级的组别
+     */
+   // private Integer conditionGroup;
+    /**
+     * 组别里的明细
+     */
+    List<KlDiagnoseByIdDTO>  klDiagnoseByIdDTO;
+
+}

+ 48 - 0
src/main/java/com/diagbot/dto/KlDiagnoseInfoDTO.java

@@ -0,0 +1,48 @@
+package com.diagbot.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 14:58
+ */
+@Setter
+@Getter
+public class KlDiagnoseInfoDTO {
+
+    private Long id;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 疾病概念id
+     */
+    private Long conceptId;
+
+    private String conceptName;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+}

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

@@ -0,0 +1,29 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-22 10:58
+ */
+@Setter
+@Getter
+public class KlDiagnoseTypeDTO {
+
+    /**
+     * 条件类型名
+     */
+    private String conditionTypeName;
+    /**
+     * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
+     */
+    private Integer conditionType;
+
+    private Integer conditionGroup;
+
+    List<KlDiagnoseGroupDTO> byIdDTO;
+}

+ 12 - 10
src/main/java/com/diagbot/dto/PushDTO.java

@@ -1,8 +1,10 @@
 package com.diagbot.dto;
 
+import com.google.common.collect.Lists;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -15,24 +17,24 @@ import java.util.Map;
 @Setter
 public class PushDTO {
     //症状
-    private List<PushBaseDTO> symptom;
+    private List<PushBaseDTO> symptom = Lists.newArrayList();
     //体格检查
-    private List<PushBaseDTO> vital;
+    private List<PushBaseDTO> vital = Lists.newArrayList();
     //检验
-    private List<PushBaseDTO> lis;
+    private List<PushBaseDTO> lis = Lists.newArrayList();
     //检查
-    private List<PushBaseDTO> pacs;
+    private List<PushBaseDTO> pacs = Lists.newArrayList();
     // 手术
-    private List<PushBaseDTO> operations;
+    private List<PushBaseDTO> operations = Lists.newArrayList();
     // 药品
-    private List<PushBaseDTO> medicines;
+    private List<PushBaseDTO> medicines = Lists.newArrayList();
     // 并发症
-    private List<PushBaseDTO> complications;
+    private List<PushBaseDTO> complications = Lists.newArrayList();
     //诊断
-    private Map<String, List<PushBaseDTO>> dis;
+    private Map<String, List<PushBaseDTO>> dis = new LinkedHashMap<>();
     //一般治疗
-    private List<TreatDTO> treat;
+    private List<TreatDTO> treat = Lists.newArrayList();
 
     // 记录调试信息
-    private Map<String, Object> debug;
+    private Map<String, Object> debug = new LinkedHashMap<>();
 }

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

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/3/16 15:17
+ */
+@Data
+public class PushDiagnoseDTO {
+
+    private List<DiagnoseDTO> protocolList = new ArrayList<>(); // 拟诊
+    private List<DiagnoseDTO> definiteList = new ArrayList<>(); // 确诊
+    private List<DiagnoseDTO> vigilantList = new ArrayList<>(); // 警惕
+}

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

@@ -0,0 +1,19 @@
+package com.diagbot.dto;
+
+import com.google.common.collect.Lists;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description: 推理出参
+ * @author: zhoutg
+ * @time: 2020/8/6 9:54
+ */
+@Data
+public class PushNewDTO {
+    // 返回状态
+    private Integer status;
+    // 返回疾病
+    private List<String> Disease = Lists.newArrayList();
+}

+ 14 - 0
src/main/java/com/diagbot/dto/PushReloadDTO.java

@@ -0,0 +1,14 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+/**
+ * @Description: 加载推理数据出参
+ * @author: zhoutg
+ * @time: 2020/8/6 9:54
+ */
+@Data
+public class PushReloadDTO {
+    // 返回状态
+    private Integer status;
+}

+ 16 - 0
src/main/java/com/diagbot/dto/ReverseDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+/**
+ * @Description:基础推理出参
+ * @Author:zhoutg
+ * @time: 2020/7/29 15:34
+ */
+@Data
+public class ReverseDTO {
+    private String libName; // 标准词名称
+    private String sonName; // 子项名称
+    private Long sonId; // 子项conceptId
+    private Integer sonType; // 子项类型
+}

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

@@ -102,6 +102,12 @@ public class WordCrfDTO {
     private String pasts = "";
     // 月经史
     private String menstrual = "";
+    // 个人史
+    private String personal = "";
+    // 婚育史
+    private String marital = "";
+    // 家族史
+    private String family = "";
 
     // 【诊断数据来源】
     private List<Item> diagSource = new ArrayList<>();

+ 153 - 0
src/main/java/com/diagbot/entity/KlDiagnose.java

@@ -0,0 +1,153 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据信息表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+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 Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date 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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public String 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 +
+                "}";
+    }
+}

+ 293 - 0
src/main/java/com/diagbot/entity/KlDiagnoseBase.java

@@ -0,0 +1,293 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据基础表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+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 Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 提示概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    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 Date getGmtCreate() {
+        return gmtCreate;
+    }
+
+    public void setGmtCreate(Date gmtCreate) {
+        this.gmtCreate = gmtCreate;
+    }
+
+    public Date getGmtModified() {
+        return gmtModified;
+    }
+
+    public void setGmtModified(Date gmtModified) {
+        this.gmtModified = gmtModified;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    public String getModifier() {
+        return modifier;
+    }
+
+    public void setModifier(String modifier) {
+        this.modifier = modifier;
+    }
+
+    public Long getConceptId() {
+        return conceptId;
+    }
+
+    public void setConceptId(Long conceptId) {
+        this.conceptId = conceptId;
+    }
+
+    public String 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 +
+                "}";
+    }
+}

+ 85 - 0
src/main/java/com/diagbot/entity/KlDiagnoseCondition.java

@@ -0,0 +1,85 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 诊断依据条件表
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Getter
+@Setter
+public class KlDiagnoseCondition implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 诊断依据主表id
+     */
+    private Long diagnoseId;
+
+    /**
+     * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
+     */
+    private Integer conditionType;
+
+    /**
+     * 规则组别(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer conditionGroup;
+
+    /**
+     * 符合数量(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     */
+    private Integer fitNo;
+
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+
+    /**
+     * 基础规则id(condition_type为1:基础条件有效)
+     */
+    private Long diagnoseBaseId;
+}

+ 21 - 0
src/main/java/com/diagbot/entity/wrapper/KlDiagnoseBaseWrapper.java

@@ -0,0 +1,21 @@
+package com.diagbot.entity.wrapper;
+
+import com.diagbot.entity.KlDiagnoseBase;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-23 11:44
+ */
+@Setter
+@Getter
+public class KlDiagnoseBaseWrapper extends KlDiagnoseBase {
+
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+
+}

+ 63 - 0
src/main/java/com/diagbot/enums/BaseDiagnoseTypeEnum.java

@@ -0,0 +1,63 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+public enum BaseDiagnoseTypeEnum implements KeyedNamed {
+
+    equals(1, "等于术语本身"),
+    compare(2, "存在比较"),
+    regexChiefSymptom(3, "主诉现病史正则"),
+    regexPast(4, "既往史正则");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    BaseDiagnoseTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static BaseDiagnoseTypeEnum getEnum(int key) {
+        for (BaseDiagnoseTypeEnum item : BaseDiagnoseTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static BaseDiagnoseTypeEnum getEnum(String value) {
+        for (BaseDiagnoseTypeEnum item : BaseDiagnoseTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        BaseDiagnoseTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 66 - 0
src/main/java/com/diagbot/enums/DiagnoseTypeEnum.java

@@ -0,0 +1,66 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+
+public enum DiagnoseTypeEnum implements KeyedNamed {
+
+    protocol(2, "拟诊"),
+    definite(3, "确诊"),
+    vigilant(4, "警惕"),
+
+    bigDataPush(99, "大数据推送诊断"),
+    possibleUnion(100, "可能诊断");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    DiagnoseTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static DiagnoseTypeEnum getEnum(int key) {
+        for (DiagnoseTypeEnum item : DiagnoseTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static DiagnoseTypeEnum getEnum(String value) {
+        for (DiagnoseTypeEnum item : DiagnoseTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        DiagnoseTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

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

@@ -0,0 +1,68 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+
+public enum PushTypeEnum implements KeyedNamed {
+
+    symptom(1, "症状"),
+    vital(4, "查体结果"),
+    lis(5, "化验"),
+    pacs(6, "辅检"),
+    disease(7, "诊断"),
+    drug(8, "药品"),
+    operation(9, "手术"),
+    treat(10, "一般治疗");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    PushTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static PushTypeEnum getEnum(int key) {
+        for (PushTypeEnum item : PushTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static PushTypeEnum getEnum(String value) {
+        for (PushTypeEnum item : PushTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        PushTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 5 - 1
src/main/java/com/diagbot/enums/RedisEnum.java

@@ -20,7 +20,11 @@ public enum RedisEnum implements KeyedNamed {
     diseaseCorrespond(8, "diseaseCorrespond:"),
     diseaseFilter(9, "diseaseFilter:"),
     diseaseType(2, "diseaseType:"),
-    allRule(10, "allRule:");
+    allRule(10, "allRule:"),
+    allBaseDiagnose(11, "allBaseDiagnose"),
+    hospitalPushType(12, "hospitalPushType"),
+    pushVersion(13, "pushVersion"),
+    hospitalId_(14, "hospitalId_");
 
     @Setter
     private int key;

+ 66 - 0
src/main/java/com/diagbot/enums/RelationshipEnum.java

@@ -0,0 +1,66 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/2/24 10:46
+ */
+public enum RelationshipEnum implements KeyedNamed {
+
+    R501(501, "疾病相关主症状"),
+    R502(502,"疾病相关次症状"),
+    R503(503,"疾病相关体格检查结果"),
+    R504(504,"疾病相关实验室检查套餐"),
+    R505(505,"疾病相关辅助检查项目"),
+    R506(506,"疾病相关药物治疗"),
+    R507(507,"疾病相关手术治疗"),
+    R508(508,"疾病相关鉴别诊断"),
+    R600(600,"相关子类");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    RelationshipEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static RelationshipEnum getEnum(int key) {
+        for (RelationshipEnum item : RelationshipEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static RelationshipEnum getEnum(String value) {
+        for (RelationshipEnum item : RelationshipEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        RelationshipEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 71 - 0
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -1,12 +1,24 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.PushReloadDTO;
+import com.diagbot.entity.TranHospitalInfo;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
+import com.diagbot.util.StringUtil;
+import org.apache.commons.collections4.map.LinkedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * @Description:
  * @Author:zhoutg
@@ -19,6 +31,14 @@ public class CacheFacade {
     RedisUtil redisUtil;
     @Autowired
     NeoFacade neoFacade;
+    @Autowired
+    private KlDiagnoseBaseFacade klDiagnoseBaseFacade;
+    @Autowired
+    KlDictionaryInfoFacade klDictionaryInfoFacade;
+    @Autowired
+    TranHospitalInfoFacade tranHospitalInfoFacade;
+    @Autowired
+    PushNewServiceClient pushNewServiceClient;
 
     /**
      * 清除缓存信息
@@ -97,7 +117,58 @@ public class CacheFacade {
         neoFacade.allRuleCache();
     }
 
+    /**
+     * 重新加载大数据缓存
+     *
+     * @return
+     */
+    public Boolean reloadPushDB(){
+        PushReloadDTO pushReloadDTO = pushNewServiceClient.reloadPushDB();
+        if (pushReloadDTO == null || !pushReloadDTO.getStatus().equals(0)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 缓存医学知识库中的所有去重的基础诊断依据
+     *
+     * @return
+     */
+    public void loadAllBaseDiagnoseCache(){
+        redisUtil.delete(RedisEnum.allBaseDiagnose.getName());
+        neoFacade.allBaseDiagnose();
+    }
+
     public void clearLoadCache(String str) {
         redisUtil.deleteByPrex(str);
     }
+
+    /**
+     * 加载大数据推送类型【push_mode】和推送版本【remark】【tran_hospital_info】
+     */
+    public void loadHostipalPush() {
+        // 删除
+        redisUtil.delete(RedisEnum.hospitalPushType.getName());
+        redisUtil.delete(RedisEnum.pushVersion.getName());
+
+        // 加载
+        List<TranHospitalInfo> hospitalList = tranHospitalInfoFacade.list(new QueryWrapper<TranHospitalInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+        );
+        if (ListUtil.isNotEmpty(hospitalList)) {
+            // 推送类型
+            redisUtil.putHashMap(RedisEnum.hospitalPushType.getName(),
+                    hospitalList.stream().collect(Collectors.toMap(k -> String.valueOf(k.getId()), v -> String.valueOf(v.getPushMode()), (v1, v2) -> (v2))));
+
+            // 推送版本
+            Map<String, Object> versionMap = new LinkedMap<>();
+            for (TranHospitalInfo hospitalInfo : hospitalList) {
+                if (StringUtil.isNotBlank(hospitalInfo.getRemark()) || "old".equals(hospitalInfo.getRemark())) {
+                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), "old");
+                }
+            }
+            redisUtil.putHashMap(RedisEnum.pushVersion.getName(), versionMap);
+        }
+    }
 }

+ 87 - 4
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -14,6 +14,7 @@ import com.diagbot.model.ai.AIAnalyze;
 import com.diagbot.model.entity.BodyPart;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Modification;
+import com.diagbot.model.entity.Operation;
 import com.diagbot.model.entity.Pacs;
 import com.diagbot.model.entity.Vital;
 import com.diagbot.model.label.ChiefLabel;
@@ -134,6 +135,15 @@ public class CommonFacade {
         if (StringUtil.isNotBlank(searchData.getMenstrual())) {
             wordCrfDTO.setMenstrual(searchData.getMenstrual());
         }
+        if (StringUtil.isNotBlank(searchData.getFamily())) {
+            wordCrfDTO.setFamily(searchData.getFamily());
+        }
+        if (StringUtil.isNotBlank(searchData.getMarital())) {
+            wordCrfDTO.setMarital(searchData.getMarital());
+        }
+        if (StringUtil.isNotBlank(searchData.getPersonal())) {
+            wordCrfDTO.setPersonal(searchData.getPersonal());
+        }
 
         //模型处理数据
         aiAnalyze.aiProcess(searchData, wordCrfDTO);
@@ -258,8 +268,8 @@ public class CommonFacade {
         VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
 
         // 【症状回填】
-        CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
-        CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
+        // CoreUtil.setPropertyList(chiefLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
+        // CoreUtil.setPropertyList(presentLabel.getClinicals(), map.get(StandConvertEnum.symptom.toString()));
 
         // 【诊断回填】
         // 1、主诉诊断
@@ -340,7 +350,7 @@ public class CommonFacade {
         PastLabel pastLabel = wordCrfDTO.getPastLabel();
         List<Lis> lis = wordCrfDTO.getLis();
         //        List<Pacs> pacs = wordCrfDTO.getPacs();
-        // TODO 辅检
+        // 辅检
         PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
         // List<PacsNew> pacsNewList = wordCrfDTO.getPacsLabel().getPacsNewList();
         pushVO.setAge(wordCrfDTO.getAge());
@@ -430,7 +440,7 @@ public class CommonFacade {
             lisPushVo.setLises(lis);
             pushVO.setLisPushVo(lisPushVo);
         }
-        // TODO 辅检
+        // 辅检
         if (pacsLabel != null) {
             PacsPushVo pacsPushVo = new PacsPushVo();
             pacsPushVo.setPacs(pacsLabel.getRes());
@@ -699,5 +709,78 @@ public class CommonFacade {
         }
         return ruleExtDTO;
     }
+
+    /**
+     * 获取【手术数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Operation> getOperationSource(WordCrfDTO wordCrfDTO) {
+        List<Operation> operationSource = new ArrayList<>();
+        List<Item> operation = wordCrfDTO.getOperation();
+        List<Operation> operationsItem = new ArrayList<>();
+        for (Item item : operation) {
+            Operation operaData = new Operation();
+            operaData.setName(item.getName());
+            operaData.setStandName(item.getUniqueName());
+            operationsItem.add(operaData);
+        }
+        CoreUtil.addList(operationSource, wordCrfDTO.getChiefLabel().getOperations()); // 主诉手术
+        CoreUtil.addList(operationSource, wordCrfDTO.getPresentLabel().getOperations()); // 现病史手术
+        CoreUtil.addList(operationSource, wordCrfDTO.getPastLabel().getOperations()); // 既往史手术
+        CoreUtil.addList(operationSource, operationsItem); // 结构化手术
+        return operationSource;
+    }
+
+    /**
+     * 获取【药品过敏数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDrugAllergySource(WordCrfDTO wordCrfDTO) {
+        List<Item> drugAllergyAll = new ArrayList<>();
+        CoreUtil.addAllConvert(drugAllergyAll, wordCrfDTO.getPastLabel().getAllergyMedicines()); // 既往史过敏药品
+        return drugAllergyAll;
+    }
+
+    /**
+     * 获取【临床表现数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Clinical> getClinicalSource(WordCrfDTO wordCrfDTO) {
+        List<Clinical> clinicSource = new ArrayList<>();
+        CoreUtil.addList(clinicSource, wordCrfDTO.getChiefLabel().getClinicals()); // 主诉临床表现
+        CoreUtil.addList(clinicSource, wordCrfDTO.getPresentLabel().getClinicals()); // 现病史临床表现
+        return clinicSource;
+    }
+
+    /**
+     * 获取【诊断数据源】(只留阳性诊断)
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDiseaseSource(WordCrfDTO wordCrfDTO) {
+        List<Item> diags = new ArrayList<>();
+        CoreUtil.addList(diags, wordCrfDTO.getDiag()); // 结构化诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getChiefLabel().getDiags());// 主诉诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getPresentLabel().getDiags()); // 现病史诊断
+        CoreUtil.addAllConvert(diags, wordCrfDTO.getPastLabel().getDiags()); // 既往史诊断
+        return diags;
+    }
+
+    /**
+     * 获取【药品数据源】
+     *
+     * @param wordCrfDTO
+     */
+    public List<Item> getDrugSource(WordCrfDTO wordCrfDTO) {
+        List<Item> drugAll = new ArrayList<>();
+        CoreUtil.addList(drugAll, wordCrfDTO.getDrug());
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getChiefLabel().getMedicines()); // 主诉药品
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPresentLabel().getMedicines());// 现病史药品
+        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPastLabel().getMedicines()); // 既往史药品
+        return drugAll;
+    }
 }
 

+ 17 - 6
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -1,21 +1,22 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.ReverseDTO;
 import com.diagbot.entity.ConceptInfo;
 import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.service.ConceptInfoService;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.diagbot.service.impl.ConceptInfoServiceImpl;
+import com.diagbot.vo.ReverseVO;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * @Description:
  * @Author:zhaops
  * @time: 2020/12/28 11:47
  */
 @Component
-public class ConceptInfoFacade {
-    @Autowired
-    ConceptInfoService conceptInfoService;
+public class ConceptInfoFacade extends ConceptInfoServiceImpl {
 
     /**
      * 标准术语名称修改
@@ -30,7 +31,17 @@ public class ConceptInfoFacade {
                 .eq("name", oldName)
                 .eq("type", labelType)
                 .set("name", newName);
-        conceptInfoService.update(updateWrapper);
+        this.update(updateWrapper);
         return true;
     }
+
+    /**
+     * 根据诊断反推
+     *
+     * @param reverseVO
+     * @return
+     */
+    public List<ReverseDTO> getReverseFac(ReverseVO reverseVO) {
+        return this.getReverse(reverseVO);
+    }
 }

+ 3 - 6
src/main/java/com/diagbot/facade/IndicationFacade.java

@@ -5,7 +5,6 @@ import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.rule.CommonRule;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.vo.IndicationPushVO;
@@ -38,8 +37,6 @@ public class IndicationFacade {
     @Autowired
     StandConvertServiceClient standConvertServiceClient;
     @Autowired
-    CommonRule commonRule;
-    @Autowired
     KlRegularConfigFacade klRegularConfigFacade;
 
     private static final Map<String, List<String>> methodMap;
@@ -54,7 +51,7 @@ public class IndicationFacade {
 
 
     /**
-     * 病情提示总入口
+     * 提示总入口
      *
      * @param
      * @return
@@ -100,8 +97,8 @@ public class IndicationFacade {
         wordCrfDTO = klRegularConfigFacade.getRegularConfigs(wordCrfDTO, indicationPushVO);
         //正则匹配结束
         // 合并【数据来源】
-        wordCrfDTO.setDiagSource(commonRule.getDiseaseSource(wordCrfDTO));
-        wordCrfDTO.setDrugSource(commonRule.getDrugSource(wordCrfDTO));
+        wordCrfDTO.setDiagSource(commonFacade.getDiseaseSource(wordCrfDTO));
+        wordCrfDTO.setDrugSource(commonFacade.getDrugSource(wordCrfDTO));
 
         try {
             Map<String, Object> invokeParams = new HashMap<>();

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

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.KlDiagnoseBaseServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 10:58
+ */
+@Component
+public class KlDiagnoseBaseFacade extends KlDiagnoseBaseServiceImpl {
+}

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

@@ -0,0 +1,13 @@
+package com.diagbot.facade;
+
+import com.diagbot.service.impl.KlDiagnoseConditionServiceImpl;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 17:11
+ */
+@Component
+public class KlDiagnoseConditionFacade extends KlDiagnoseConditionServiceImpl {
+}

+ 282 - 0
src/main/java/com/diagbot/facade/KlDiagnoseFacade.java

@@ -0,0 +1,282 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DiagnosesFindDTO;
+import com.diagbot.dto.KlDiagnoseByIdDTO;
+import com.diagbot.dto.KlDiagnoseGroupDTO;
+import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.dto.KlDiagnoseTypeDTO;
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.entity.KlDiagnoseBase;
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.KlDiagnoseServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.DiagnosesFindVO;
+import com.diagbot.vo.KlDiagnoseByIdVO;
+import com.diagbot.vo.KlDiagnoseClearVO;
+import com.diagbot.vo.KlDiagnoseDetailVO;
+import com.diagbot.vo.KlDiagnoseGroupVO;
+import com.diagbot.vo.KlDiagnoseInfoVO;
+import com.diagbot.vo.KlDiagnoseSatarDisVO;
+import com.diagbot.vo.KlDiagnoseSaveVO;
+import com.diagbot.vo.KlDiagnoseTypeVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 11:42
+ */
+@Component
+public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
+    @Autowired
+    KlDiagnoseConditionFacade klDiagnoseConditionFacade;
+    @Autowired
+    KlDiagnoseBaseFacade klDiagnoseBaseFacade;
+    @Autowired
+    KlDictionaryInfoFacade klDictionaryInfoFacade;
+
+
+    public IPage<KlDiagnoseInfoDTO> getKlDiagnoseInfoPage(KlDiagnoseInfoVO klDiagnoseInfoVO) {
+        return this.getKlDiagnosePages(klDiagnoseInfoVO);
+
+    }
+
+    public List<KlDiagnoseTypeDTO> getByIdDiagnoseAll(KlDiagnoseByIdVO klDiagnoseByIdVO) {
+        List<KlDiagnoseByIdDTO> byIdDiagnoses = this.getByIdDiagnoses(klDiagnoseByIdVO);
+        //基础条件
+        Map<Integer, List<KlDiagnoseByIdDTO>> baseGroupMap = byIdDiagnoses.stream().filter(i -> i.getConditionType().equals(1)).collect(Collectors.groupingBy(KlDiagnoseByIdDTO::getBaseGroup));
+        //根据ConditionType 和 getConditionGroup两个添加分组
+        Map<Integer, Map<Integer, List<KlDiagnoseByIdDTO>>> collect = byIdDiagnoses.stream().filter(i -> !i.getConditionType().equals(1)).collect(Collectors.groupingBy(KlDiagnoseByIdDTO::getConditionGroup, Collectors.groupingBy(KlDiagnoseByIdDTO::getConditionType)));
+        List<KlDiagnoseTypeDTO> klDiagnoseTypeList = new ArrayList<>();
+        for (Map.Entry<Integer, Map<Integer, List<KlDiagnoseByIdDTO>>> entry : collect.entrySet()) {
+            KlDiagnoseTypeDTO klDiagnoseTypeDTO = new KlDiagnoseTypeDTO();
+            klDiagnoseTypeDTO.setConditionGroup(entry.getKey());
+            Map<Integer, List<KlDiagnoseByIdDTO>> value = entry.getValue();
+            List<KlDiagnoseGroupDTO> byIdDTO = new ArrayList<>();
+            for (Map.Entry<Integer, List<KlDiagnoseByIdDTO>> entry2 : value.entrySet()) {
+                klDiagnoseTypeDTO.setConditionType(entry2.getKey());
+                List<KlDiagnoseByIdDTO> value1 = entry2.getValue();
+                for (KlDiagnoseByIdDTO data : value1) {
+                    KlDiagnoseGroupDTO klDiagnoseGroupDTO = new KlDiagnoseGroupDTO();
+                    //  klDiagnoseGroupDTO.setConditionGroup(entry2.getKey());
+                    klDiagnoseGroupDTO.setFitNo(data.getFitNo());
+                    klDiagnoseGroupDTO.setBaseGroup(data.getBaseGroup());
+                    klDiagnoseGroupDTO.setKlDiagnoseByIdDTO(baseGroupMap.get(data.getBaseGroup()));
+                    byIdDTO.add(klDiagnoseGroupDTO);
+                }
+                klDiagnoseTypeDTO.setByIdDTO(byIdDTO);
+            }
+            klDiagnoseTypeList.add(klDiagnoseTypeDTO);
+
+        }
+        return klDiagnoseTypeList;
+    }
+
+    public Boolean clearDiagnoseAll(KlDiagnoseClearVO klDiagnoseClearVO) {
+        boolean res = false;
+        res = clearDiagnoseSub(klDiagnoseClearVO.getId());
+        //最后删除主表rule
+        res = this.removeById(klDiagnoseClearVO.getId());
+        return res;
+    }
+
+    private boolean clearDiagnoseSub(Long id) {
+        boolean res = false;
+        QueryWrapper<KlDiagnoseCondition> klDiagnoseConditionQuery = new QueryWrapper<>();
+        klDiagnoseConditionQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("diagnose_id", id);
+        List<KlDiagnoseCondition> diagnoseConditionList = klDiagnoseConditionFacade.list(klDiagnoseConditionQuery);
+        List<Long> baseId = new ArrayList<>();
+        if (ListUtil.isNotEmpty(diagnoseConditionList)) {
+            for (KlDiagnoseCondition data : diagnoseConditionList) {
+                if (null != data.getDiagnoseBaseId() & 0 != data.getDiagnoseBaseId()) {
+                    baseId.add(data.getDiagnoseBaseId());
+                }
+            }
+        }
+        if (ListUtil.isNotEmpty(baseId)) {
+            //删除kl_diagnose_base表数据
+            res = klDiagnoseBaseFacade.removeByIds(baseId);
+
+        }
+        //删除kl_diagnose_condition表的数据
+        res = klDiagnoseConditionFacade.remove(klDiagnoseConditionQuery);
+        return res;
+    }
+
+    public Boolean disableDiagnose(KlDiagnoseSatarDisVO klDiagnoseSatarDisVO, int start) {
+        boolean res = false;
+        Date now = DateUtil.now();
+        int sum = this.count(new QueryWrapper<KlDiagnose>().eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", klDiagnoseSatarDisVO.getId()));
+        if (sum == 0) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该数据已不存在!");
+        }
+        UpdateWrapper<KlDiagnose> klKlDiagnoseUpdate = new UpdateWrapper<>();
+        klKlDiagnoseUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", klDiagnoseSatarDisVO.getId())
+                .set("status", start)
+                .set("modifier", klDiagnoseSatarDisVO.getModifier())
+                .set("gmt_modified", now);
+        return this.update(new KlDiagnose(), klKlDiagnoseUpdate);
+    }
+
+    public Boolean saveDiagnoseAll(KlDiagnoseSaveVO klDiagnoseSaveVO) {
+        Date now = DateUtil.now();
+        boolean res = false;
+        // 校验名称是否相同
+        int count = this.count(new QueryWrapper<KlDiagnose>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("concept_id", klDiagnoseSaveVO.getConceptId())
+                .ne("id", klDiagnoseSaveVO.getId() == null ? -1 : klDiagnoseSaveVO.getId()));
+        if (count > 0) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该诊断依据已存在!");
+        }
+        //校验数据是否还在
+        if (null != klDiagnoseSaveVO.getId()) {
+            int sum = this.count(new QueryWrapper<KlDiagnose>().eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("id", klDiagnoseSaveVO.getId()));
+            if (sum == 0) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该数据已不存在!");
+            }
+            UpdateWrapper<KlDiagnose> klDiagnoseUpdate = new UpdateWrapper<>();
+            klDiagnoseUpdate.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("id", klDiagnoseSaveVO.getId())
+                    .set(StringUtil.isNotBlank(klDiagnoseSaveVO.getDescription()), "description", klDiagnoseSaveVO.getDescription())
+                    .set(StringUtil.isNotBlank(klDiagnoseSaveVO.getConceptId().toString()), "concept_id", klDiagnoseSaveVO.getConceptId())
+                    .set("modifier", klDiagnoseSaveVO.getModifier())
+                    .set("gmt_modified", now);
+            res = this.update(klDiagnoseUpdate);
+
+            //先删除原有的详情;
+            res = clearDetail(klDiagnoseSaveVO.getId());
+
+            if (ListUtil.isNotEmpty(klDiagnoseSaveVO.getKlDiagnoseTypeVO())) {
+                //再重新传入的详情保存
+                res = saveCommon(klDiagnoseSaveVO);
+            }
+
+        } else {
+            //先保存主表rule
+            KlDiagnose klDiagnose = new KlDiagnose();
+            klDiagnose.setConceptId(klDiagnoseSaveVO.getConceptId());
+            klDiagnose.setDescription(klDiagnoseSaveVO.getDescription());
+            klDiagnose.setStatus(1);
+            klDiagnose.setModifier(klDiagnoseSaveVO.getModifier());
+            klDiagnose.setCreator(klDiagnoseSaveVO.getModifier());
+            klDiagnose.setGmtCreate(now);
+            klDiagnose.setGmtModified(now);
+            res = this.save(klDiagnose);
+            if (res) {
+                //再保存附表
+                klDiagnoseSaveVO.setId(klDiagnose.getId());
+                res = saveCommon(klDiagnoseSaveVO);
+            }
+        }
+        return res;
+
+    }
+
+    public boolean clearDetail(Long id) {
+        boolean res = false;
+        QueryWrapper<KlDiagnoseCondition> klDiagnoseQuery = new QueryWrapper<>();
+        klDiagnoseQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).eq("diagnose_id", id);
+        List<KlDiagnoseCondition> diaConditionList = klDiagnoseConditionFacade.list(klDiagnoseQuery);
+        List<Long> baseId = new ArrayList<>();
+        if (ListUtil.isNotEmpty(diaConditionList)) {
+            for (KlDiagnoseCondition data : diaConditionList) {
+                if (null != data.getDiagnoseBaseId() && 0 != data.getDiagnoseBaseId()) {
+                    baseId.add(data.getDiagnoseBaseId());
+                }
+
+            }
+        }
+        if (ListUtil.isNotEmpty(baseId)) {
+            QueryWrapper<KlDiagnoseBase> klDiagnoseBaseQuery = new QueryWrapper<>();
+            klDiagnoseBaseQuery.eq("is_deleted", IsDeleteEnum.N.getKey()).in("id", baseId);
+            //删除kl_rule_base表数据
+            res = klDiagnoseBaseFacade.remove(klDiagnoseBaseQuery);
+
+        }
+        //删除kl_rule_condition表的数据
+        res = klDiagnoseConditionFacade.remove(klDiagnoseQuery);
+        return res;
+    }
+
+    public Boolean saveCommon(KlDiagnoseSaveVO klDiagnoseSaveVO) {
+        Date now = DateUtil.now();
+        boolean res = false;
+        int sum = 99;
+        int baseGroup = 9;
+        List<KlDiagnoseTypeVO> klDiagnoseTypeVO = klDiagnoseSaveVO.getKlDiagnoseTypeVO();
+        if (ListUtil.isNotEmpty(klDiagnoseTypeVO)) {
+            for (KlDiagnoseTypeVO data : klDiagnoseTypeVO) {
+                KlDiagnoseCondition klDiagnoseCondition = new KlDiagnoseCondition();
+                klDiagnoseCondition.setConditionType(data.getConditionType());//取出诊断的类型,2拟诊,3 确诊
+                sum = sum + 1;
+                klDiagnoseCondition.setConditionGroup(sum);
+                List<KlDiagnoseGroupVO> groupVO = data.getGroupVO();
+                for (KlDiagnoseGroupVO data2 : groupVO) {
+                    baseGroup = baseGroup + 1;
+                    klDiagnoseCondition.setDiagnoseId(klDiagnoseSaveVO.getId());
+                    klDiagnoseCondition.setBaseGroup(baseGroup);//
+                    klDiagnoseCondition.setFitNo(data2.getFitNo());
+                    klDiagnoseConditionFacade.save(klDiagnoseCondition);
+                    //明细
+                    List<KlDiagnoseDetailVO> klDiagnoseDetail = data2.getKlDiagnoseDetail();
+                    if (ListUtil.isNotEmpty(klDiagnoseDetail)) {
+                        for (KlDiagnoseDetailVO detailVO : klDiagnoseDetail) {
+                            if (null != detailVO) {
+                                KlDiagnoseBase klDiagnoseBase = new KlDiagnoseBase();
+                                klDiagnoseBase.setGmtModified(now);
+                                klDiagnoseBase.setConceptId(detailVO.getBasConceptId());
+                                klDiagnoseBase.setType(detailVO.getBasType());
+                                klDiagnoseBase.setDescription(detailVO.getBasDescription());
+                                klDiagnoseBase.setMaxOperator(detailVO.getMaxOperator());
+                                klDiagnoseBase.setMaxValue(detailVO.getMaxVal());
+                                klDiagnoseBase.setMaxUnit(detailVO.getMaxUnit());
+                                klDiagnoseBase.setMinOperator(detailVO.getMinOperator());
+                                klDiagnoseBase.setMinValue(detailVO.getMinVal());
+                                klDiagnoseBase.setMinUnit(detailVO.getMinUnit());
+                                klDiagnoseBase.setStatus(1);
+                                klDiagnoseBase.setEqValue(detailVO.getEqValue());
+                                klDiagnoseBase.setEqOperator(detailVO.getEqOperator());
+                                klDiagnoseBase.setEqUnit(detailVO.getEqUnit());
+                                res = klDiagnoseBaseFacade.save(klDiagnoseBase);
+                                if (res) {
+                                    KlDiagnoseCondition klDiagnoseConditionBase = new KlDiagnoseCondition();
+                                    klDiagnoseConditionBase.setDiagnoseBaseId(klDiagnoseBase.getId());
+                                    klDiagnoseConditionBase.setBaseGroup(baseGroup);
+                                    klDiagnoseConditionBase.setConditionType(1);
+                                    klDiagnoseConditionBase.setDiagnoseId(klDiagnoseSaveVO.getId());
+                                    res = klDiagnoseConditionFacade.save(klDiagnoseConditionBase);
+                                }
+                            }
+                        }
+                    }
+
+                }
+
+            }
+        }
+        return res;
+    }
+
+    public List<DiagnosesFindDTO> findDiaNameAlls(DiagnosesFindVO diagnosesFindVO) {
+        return this.findDiaNameAll(diagnosesFindVO);
+    }
+}

+ 15 - 1
src/main/java/com/diagbot/facade/KlDictionaryInfoFacade.java

@@ -48,7 +48,6 @@ public class KlDictionaryInfoFacade extends KlDictionaryInfoServiceImpl {
         return EntityUtil.makeEntityListMap(listRes, "groupType");
     }
 
-
     /**
      * 返回指定字典信息
      *
@@ -63,4 +62,19 @@ public class KlDictionaryInfoFacade extends KlDictionaryInfoServiceImpl {
         List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
         return listRes;
     }
+
+    /**
+     * 返回指定字典信息
+     *
+     * @param groupType
+     * @return
+     */
+    public List<DictionaryInfoDTO> getListByGroupType(List<Integer> groupType) {
+        List<KlDictionaryInfo> list = this.list(new QueryWrapper<KlDictionaryInfo>()
+                .in("group_type", groupType)
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("group_type", "order_no"));
+        List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
+        return listRes;
+    }
 }

+ 23 - 17
src/main/java/com/diagbot/facade/KlRegularConfigFacade.java

@@ -13,10 +13,12 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.model.entity.AllergyMedicine;
 import com.diagbot.model.label.PastLabel;
 import com.diagbot.service.impl.KlRegularConfigServiceImpl;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.IndicationPushVO;
-import com.diagbot.vo.RegularConfigDataVO;
 import com.diagbot.vo.RegularConfigSaveVO;
+import com.google.common.collect.Lists;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -32,13 +34,11 @@ import java.util.regex.Pattern;
 @Component
 public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
 
-    public List<RegularValueDTO> getRegularConfigDatas(RegularConfigDataVO regularConfigDataVO) {
+    public List<RegularValueDTO> getRegularConfigDatas(String text, List<KlRegularConfig> regularConfigs) {
         List<RegularValueDTO> listData = new ArrayList<>();
-        QueryWrapper<KlRegularConfig> regularQuery = new QueryWrapper<>();
-        regularQuery.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq(regularConfigDataVO.getRulesCode() != null, "rules_code", regularConfigDataVO.getRulesCode())
-                .eq(regularConfigDataVO.getRulesTepy() != null, "rules_tepy", regularConfigDataVO.getRulesTepy());
-        List<KlRegularConfig> regularConfigs = list(regularQuery);
+        if (StringUtil.isBlank(text)) {
+            return Lists.newArrayList();
+        }
         if (ListUtil.isNotEmpty(regularConfigs)) {
             for (KlRegularConfig data : regularConfigs) {
                 String pattern = "";
@@ -52,7 +52,7 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
                 // 创建 Pattern 对象
                 Pattern r = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
                 // 现在创建 matcher 对象
-                Matcher m = r.matcher(regularConfigDataVO.getText());
+                Matcher m = r.matcher(text);
                 int trueMin = 0;
                 while (m.find()) {
                     //System.out.println(m.group());
@@ -77,7 +77,7 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
                 if (data.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
                     Pattern rMax = Pattern.compile(patternMax, Pattern.CASE_INSENSITIVE);
                     // 现在创建 matcher 对象
-                    Matcher mMax = rMax.matcher(regularConfigDataVO.getText());
+                    Matcher mMax = rMax.matcher(text);
                     while (mMax.find()) {
                         if (data.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
                             trueMax++;
@@ -108,9 +108,16 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
     public WordCrfDTO getRegularConfigs(WordCrfDTO wordCrfDTO, IndicationPushVO indicationPushVO) {
         String allergyStr = indicationPushVO.getAllergy();
         String symptom = wordCrfDTO.getSymptom();//现病史
-        RegularConfigDataVO regularConfigData = new RegularConfigDataVO();
-        regularConfigData.setText(symptom);
-        List<RegularValueDTO> regularConfigDatas = getRegularConfigDatas(regularConfigData);
+        String pasts = wordCrfDTO.getPasts();//既往史
+        if (StringUtil.isBlank(symptom) && StringUtil.isBlank(pasts)) {
+            return wordCrfDTO;
+        }
+
+        // 现病史化验和过敏史
+        QueryWrapper<KlRegularConfig> regularQuery = new QueryWrapper<>();
+        regularQuery.eq("is_deleted", IsDeleteEnum.N.getKey());
+        List<KlRegularConfig> regularConfigs = list(regularQuery);
+        List<RegularValueDTO> regularConfigDatas = getRegularConfigDatas(symptom, regularConfigs);
         List<Lis> lisData = wordCrfDTO.getLis();
         PastLabel pastLabel = wordCrfDTO.getPastLabel();//获取过敏史数据
         List<AllergyMedicine> allergies = pastLabel.getAllergyMedicines();
@@ -133,11 +140,10 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
                 }
             }
         }
-        String pasts = wordCrfDTO.getPasts();//既往史
-        RegularConfigDataVO regularConfigPasts = new RegularConfigDataVO();
-        regularConfigData.setText(pasts);
-        regularConfigData.setRulesTepy(RegularConfigEnum.allergy.getKey());
-        List<RegularValueDTO> regularConfigPastss = getRegularConfigDatas(regularConfigData);
+
+        // 既往史过敏史
+        List<RegularValueDTO> regularConfigPastss = getRegularConfigDatas(pasts,
+                EntityUtil.makeEntityListMap(regularConfigs, "rulesTepy").get(RegularConfigEnum.allergy.getKey()));
         if (ListUtil.isNotEmpty(regularConfigPastss)) {
             for (RegularValueDTO dataPasts : regularConfigPastss) {
                 AllergyMedicine allergy = new AllergyMedicine();

+ 32 - 0
src/main/java/com/diagbot/facade/LisConfigFacade.java

@@ -2,16 +2,20 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.entity.LisConfig;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.LisConfigServiceImpl;
+import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.google.common.collect.Lists;
 import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -104,4 +108,32 @@ public class LisConfigFacade extends LisConfigServiceImpl {
         this.update(updateWrapper);
         return true;
     }
+
+    /**
+     * 获取过滤化验套餐名= 映射套餐名称 + 结构化套餐名称
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public List<String> getMappingLisItem(WordCrfDTO wordCrfDTO) {
+        if (ListUtil.isNotEmpty(wordCrfDTO.getLis())) {
+            // 医院化验套餐名
+            List<String> itemList = wordCrfDTO.getLis().stream().map(r -> r.getName()).collect(Collectors.toList());
+            // 获取标准套餐名
+            List<LisConfig> records = this.list(new QueryWrapper<LisConfig>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", wordCrfDTO.getHospitalId())
+                    .in("his_name", itemList)
+                    .apply("(his_detail_name is null or his_detail_name = '')")
+            );
+            // 获取映射套餐名称
+            List<String> uniqueName = records.stream().map(r -> r.getUniqueName()).collect(Collectors.toList());
+            // 追加医院套餐名称
+            uniqueName.addAll(itemList);
+            // 去重
+            uniqueName = CoreUtil.removeRepeat(uniqueName);
+            return uniqueName;
+        }
+        return Lists.newArrayList();
+    }
 }

+ 11 - 4
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -2,8 +2,8 @@ package com.diagbot.facade;
 
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.diagbot.client.ChiefPresentSimilarityServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
+import com.diagbot.dto.BaseDiagnoseDTO;
 import com.diagbot.dto.DrugNameDTO;
 import com.diagbot.dto.DrugTypeCacheDTO;
 import com.diagbot.dto.DrugTypeDTO;
@@ -63,8 +63,6 @@ import static com.diagbot.util.StringUtil.permutationNoRepeat;
  */
 @Component
 public class NeoFacade {
-    @Autowired
-    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
     @Autowired
     NeoFacade self;
     @Autowired
@@ -86,6 +84,8 @@ public class NeoFacade {
     private KlRuleFacade klRuleFacade;
     @Autowired
     private KlRelationFacade klRelationFacade;
+    @Autowired
+    private KlDiagnoseBaseFacade klDiagnoseBaseFacade;
 
     /**
      * 返回药品缓存信息
@@ -491,7 +491,7 @@ public class NeoFacade {
      * 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital"
      *
      * @param standConvert
-     * @return Map<String   ,   Map   <   String   ,   String>> -->Map<类型, Map<原始词, 标准词>>
+     * @return Map<String,Map<String,String>> -->Map<类型, Map<原始词, 标准词>>
      */
     public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
         Map<String, Map<String, String>> map = new LinkedHashMap<>();
@@ -696,4 +696,11 @@ public class NeoFacade {
             redisTemplate.opsForValue().multiSet(map);
         }
     }
+
+    public void allBaseDiagnose() {
+        List<BaseDiagnoseDTO> list = klDiagnoseBaseFacade.getAllBaseDiagnose();
+        if (ListUtil.isNotEmpty(list)) {
+            redisTemplate.opsForValue().set(RedisEnum.allBaseDiagnose.getName(), list);
+        }
+    }
 }

+ 167 - 15
src/main/java/com/diagbot/facade/PushFacade.java

@@ -1,19 +1,35 @@
 package com.diagbot.facade;
 
+import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.PushNewDTO;
 import com.diagbot.dto.PushPlanDTO;
 import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.enums.DiagnoseTypeEnum;
 import com.diagbot.enums.DiseasePushTypeEnum;
+import com.diagbot.enums.RedisEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.process.PushProcess;
 import com.diagbot.util.CoreUtil;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamUtil;
+import com.diagbot.util.RedisUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.PushNewVO;
 import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
 import com.diagbot.vo.StandConvert;
+import com.google.common.collect.Lists;
+import io.github.lvyahui8.spring.facade.DataFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -34,7 +50,34 @@ public class PushFacade {
     FollowupPlanInfoFacade followupPlanInfoFacade;
     @Autowired
     TranHospitalInfoFacade tranHospitalInfoFacade;
+    @Autowired
+    PushNewServiceClient pushNewServiceClient;
+    @Autowired
+    RedisUtil redisUtil;
+
+    /**
+     * 推送fac(兼容新版和5.0)
+     *
+     * @param pushVO
+     * @return
+     */
+    public PushDTO pushFac(PushVO pushVO) {
+        String pushVersion = redisUtil.getByKeyAndField(RedisEnum.pushVersion.getName(),
+                RedisEnum.hospitalId_.getName() + pushVO.getHospitalId());
+        if (StringUtil.isNotBlank(pushVersion) && "old".equals(pushVersion)) {
+            // 使用5.0推送
+            return processAggreate(pushVO);
+        } else {
+            // 使用新版推送
+            return pushNewFac(pushVO);
+        }
+    }
 
+    /**
+     * 5.0 推送总入口
+     * @param pushVo
+     * @return
+     */
     public PushDTO processAggreate(PushVO pushVo) {
         // 年龄容错处理
         if (pushVo.getAgeNum() == null) {
@@ -70,22 +113,20 @@ public class PushFacade {
         return pushDTO;
     }
 
-
     /**
-     * 推送业务
+     * 推送业务6.0
      *
      * @param
      * @return
      */
-    public PushDTO pushFac(PushVO pushVo) {
+    public PushDTO pushNewFac(PushVO pushVo) {
+        PushDTO pushDTO = new PushDTO();
         Map<String, Object> debug = new LinkedHashMap<>();
-        WordCrfDTO wordCrfDTO = new WordCrfDTO();
-        long l1 = System.currentTimeMillis();
 
         // 模型处理数据
-        long crfStart = System.currentTimeMillis();
-        wordCrfDTO = commonFacade.crf_process(pushVo);
-        CoreUtil.getDebugStr(crfStart, "模型处理耗时", debug);
+        long start = System.currentTimeMillis();
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(pushVo);
+        CoreUtil.getDebugStr(start, "模型处理耗时", debug);
 
         // 标准词转换
         long standStart = System.currentTimeMillis();
@@ -95,15 +136,117 @@ public class PushFacade {
         CoreUtil.getDebugStr(standStart, "标准词转换耗时", debug);
         ParamUtil.dealLis(wordCrfDTO.getLis());
 
-        // 推送
-        long pushStart = System.currentTimeMillis();
-        PushDTO process = pushProcess.process(pushVo, standConvertMap, wordCrfDTO);
-        CoreUtil.getDebugStr(pushStart, "推送耗时", debug);
-        process.setDebug(debug);
+        // 是否有界面诊断
+        boolean hasDiseaseFlag = pushProcess.hasDisease(wordCrfDTO);
+        if (hasDiseaseFlag) { // 有界面诊断,走诊断依据推送警惕,不推确诊和拟诊
+            pushDTO = pushProcess.pushDiagnose(wordCrfDTO);
+        } else { // 无界面诊断,诊断依据推送确诊、拟诊、警惕 + 大数据推送可能诊断
+            try {
+                Map<String, Object> invokeParams = new HashMap<>();
+                invokeParams.put("wordCrfDTO", wordCrfDTO);
+                invokeParams.put("pushNewVO", generatePushVo(wordCrfDTO));
+                pushDTO = DataFacade.get("pushAll", invokeParams, PushDTO.class);
+            } catch (Exception e) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "推送服务出错" + e.getMessage());
+            }
+        }
 
-        CoreUtil.getDebugStr(l1, "本次调用总计耗时", debug);
+        // 诊断去重、合并处理、过滤
+        dealDisease(pushDTO, wordCrfDTO, pushVo.getLength(), hasDiseaseFlag);
+
+        // 通过诊断反推
+        long reverseStart = System.currentTimeMillis();
+        pushProcess.process(pushDTO, pushVo, wordCrfDTO);
+        CoreUtil.getDebugStr(reverseStart, "反推业务耗时", debug);
+
+        CoreUtil.getDebugStr(start, "总计耗时", debug);
         CoreUtil.getDebugObject("数据", debug, wordCrfDTO);
-        return process;
+        pushDTO.getDebug().putAll(debug);
+        return pushDTO;
+    }
+
+    /**
+     * 诊断去重、合并处理
+     * @param pushDTO
+     */
+    public void dealDisease(PushDTO pushDTO, WordCrfDTO wordCrfDTO, int length, boolean hasDiseaseFlag) {
+        Map<String, List<PushBaseDTO>> dis = pushDTO.getDis();
+        List<PushBaseDTO> possibleUnion = Lists.newArrayList(); // 可能诊断 = 确诊 + 拟诊 + 大数据推送诊断
+        // 无界面诊断
+        if (!hasDiseaseFlag) {
+            List<PushBaseDTO> definite = dis.get(DiagnoseTypeEnum.definite.getName()); // 确诊
+            List<PushBaseDTO> protocol = dis.get(DiagnoseTypeEnum.protocol.getName()); // 拟诊
+            List<PushBaseDTO> bigDataPush = dis.get(DiagnoseTypeEnum.bigDataPush.getName()); // 大数据推送诊断
+            // 合并可能诊断
+            if (ListUtil.isNotEmpty(definite)) {
+                possibleUnion.addAll(definite);
+            }
+            if (ListUtil.isNotEmpty(protocol)) {
+                possibleUnion.addAll(protocol);
+            }
+            if (ListUtil.isNotEmpty(bigDataPush)) {
+                possibleUnion.addAll(bigDataPush);
+            }
+            // 去重
+            CoreUtil.removeByRepeatProperty(possibleUnion, "name");
+        }
+        // // 获取既往史否定诊断
+        // List<String> negativeDis = CoreUtil.getPropertyWithFilter(wordCrfDTO.getPastLabel().getDiags(),
+        //         "standName", "negative");
+        // if (ListUtil.isNotEmpty(negativeDis)) { // 添加既往史否定诊断
+        //     pushDTO.getDis().put("既往史否定诊断", pushProcess.generatePushBaseDTO(negativeDis, -1));
+        //     // 可能诊断——剔除既往否定诊断
+        //     filterDisease(dis.get(DiagnoseTypeEnum.possibleUnion.getName()), negativeDis);
+        //     // 鉴别诊断——剔除既往否定诊断
+        //     filterDisease(dis.get(DiseaseTypeEnum.identify.getName()), negativeDis);
+        //     // 警惕——剔除既往否定诊断
+        //     filterDisease(dis.get(DiagnoseTypeEnum.vigilant.getName()), negativeDis);
+        // }
+        // 可能诊断根据长度截取
+        if (ListUtil.isNotEmpty(possibleUnion)) {
+            possibleUnion = possibleUnion.size() > length ? possibleUnion.subList(0, length) : possibleUnion;
+        }
+        // 添加可能诊断
+        dis.put(DiagnoseTypeEnum.possibleUnion.getName(), possibleUnion);
+    }
+
+    /**
+     * 剔除既往否定诊断
+     *
+     * @param pushBaseDTOList
+     * @param negativeDis
+     */
+    public void filterDisease(List<PushBaseDTO> pushBaseDTOList, List<String> negativeDis) {
+        if (ListUtil.isEmpty(pushBaseDTOList) || ListUtil.isEmpty(negativeDis)) {
+            return;
+        }
+        Iterator<PushBaseDTO> it = pushBaseDTOList.iterator();
+        while (it.hasNext()) {
+            PushBaseDTO bean = it.next();
+            // 剔除既往否定诊断
+            if (negativeDis.contains(bean.getName())) {
+                it.remove();
+            }
+        }
+    }
+
+    /**
+     * 生成新版推送入参
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public PushNewVO generatePushVo(WordCrfDTO wordCrfDTO) {
+        PushNewVO pushNewVO = new PushNewVO();
+        pushNewVO.setChief(wordCrfDTO.getChief());
+        pushNewVO.setPresent(wordCrfDTO.getSymptom());
+        pushNewVO.setAge(wordCrfDTO.getAgeNum());
+        pushNewVO.setSex(wordCrfDTO.getSex());
+        String pushType = redisUtil.getByKeyAndField(RedisEnum.hospitalPushType.getName(), String.valueOf(wordCrfDTO.getHospitalId()));
+        if (StringUtil.isNotBlank(pushType)) {
+            pushNewVO.setHospitalType(pushType);
+        }
+        return pushNewVO;
     }
 
     /**
@@ -136,4 +279,13 @@ public class PushFacade {
         return pushPlanDTO;
     }
 
+    /**
+     * 测试新版推送
+     *
+     * @param pushNewVO
+     * @return
+     */
+    public PushNewDTO testPushFac(PushNewVO pushNewVO) {
+        return pushNewServiceClient.pushNew(pushNewVO);
+    }
 }

+ 17 - 0
src/main/java/com/diagbot/facade/TestFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
+import com.diagbot.client.CRFServiceClient;
 import com.diagbot.client.StandConvertNewServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
 import com.diagbot.dto.IndicationDTO;
@@ -11,6 +12,7 @@ import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
+import com.diagbot.model.ai.BeHospitalizedAI;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
@@ -21,6 +23,7 @@ import com.diagbot.vo.IndicationPushVO;
 import com.diagbot.vo.ItemExt;
 import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.TestAllVO;
+import com.diagbot.vo.TestCrfVO;
 import com.diagbot.vo.TestExport;
 import com.diagbot.vo.TestIndicationVO;
 import com.diagbot.vo.TestLineVO;
@@ -67,6 +70,10 @@ public class TestFacade {
     RedisUtil redisUtil;
     @Autowired
     CacheFacade cacheFacade;
+    @Autowired
+    CRFServiceClient crfServiceClient;
+    @Autowired
+    BeHospitalizedAI beHospitalizedAI;
 
     /**
      * 测试导出
@@ -1380,4 +1387,14 @@ public class TestFacade {
 
         return res;
     }
+
+    /**
+     * crf解析测试
+     *
+     * @param testCrfVO
+     * @return
+     */
+    public Object testCrf(TestCrfVO testCrfVO) {
+        return beHospitalizedAI.medrec(testCrfVO, crfServiceClient);
+    }
 }

+ 6 - 0
src/main/java/com/diagbot/mapper/ConceptInfoMapper.java

@@ -1,7 +1,11 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.ReverseDTO;
 import com.diagbot.entity.ConceptInfo;
+import com.diagbot.vo.ReverseVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,4 +16,6 @@ import com.diagbot.entity.ConceptInfo;
  * @since 2020-08-18
  */
 public interface ConceptInfoMapper extends BaseMapper<ConceptInfo> {
+
+    public List<ReverseDTO> getReverse(ReverseVO reverseVO);
 }

+ 20 - 0
src/main/java/com/diagbot/mapper/KlDiagnoseBaseMapper.java

@@ -0,0 +1,20 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.entity.KlDiagnoseBase;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseBaseMapper extends BaseMapper<KlDiagnoseBase> {
+    //获取所有去重的基础诊断依据
+    List<BaseDiagnoseDTO> getAllBaseDiagnose();
+}

+ 16 - 0
src/main/java/com/diagbot/mapper/KlDiagnoseConditionMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 诊断依据条件表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseConditionMapper extends BaseMapper<KlDiagnoseCondition> {
+
+}

+ 34 - 0
src/main/java/com/diagbot/mapper/KlDiagnoseMapper.java

@@ -0,0 +1,34 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DiagnoseDTO;
+import com.diagbot.dto.DiagnosesFindDTO;
+import com.diagbot.dto.KlDiagnoseByIdDTO;
+import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.DiagnoseVO;
+import com.diagbot.vo.DiagnosesFindVO;
+import com.diagbot.vo.KlDiagnoseByIdVO;
+import com.diagbot.vo.KlDiagnoseInfoVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据信息表 Mapper 接口
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseMapper extends BaseMapper<KlDiagnose> {
+    //根据匹配的基础规则ID获取确诊、拟诊、警惕的疾病
+    List<DiagnoseDTO> getDiagnoseByIds(DiagnoseVO diagnoseVO);
+
+    IPage<KlDiagnoseInfoDTO> getKlDiagnosePages(KlDiagnoseInfoVO klDiagnoseInfoVO);
+
+    List<KlDiagnoseByIdDTO> getByIdDiagnoses(KlDiagnoseByIdVO klDiagnoseByIdVO);
+
+    List<DiagnosesFindDTO> findDiaNameAll(DiagnosesFindVO diagnosesFindVO);
+}

+ 38 - 3
src/main/java/com/diagbot/model/ai/BeHospitalizedAI.java

@@ -6,13 +6,36 @@ import com.diagbot.client.CRFServiceClient;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
-import com.diagbot.model.ai.process.*;
-import com.diagbot.model.entity.*;
-import com.diagbot.model.label.*;
+import com.diagbot.model.ai.process.EntityProcessClinic;
+import com.diagbot.model.ai.process.EntityProcessDiag;
+import com.diagbot.model.ai.process.EntityProcessFamily;
+import com.diagbot.model.ai.process.EntityProcessLis;
+import com.diagbot.model.ai.process.EntityProcessMarital;
+import com.diagbot.model.ai.process.EntityProcessMenses;
+import com.diagbot.model.ai.process.EntityProcessPacs;
+import com.diagbot.model.ai.process.EntityProcessPast;
+import com.diagbot.model.ai.process.EntityProcessPersonal;
+import com.diagbot.model.ai.process.EntityProcessVital;
+import com.diagbot.model.entity.Diag;
+import com.diagbot.model.entity.Lis;
+import com.diagbot.model.entity.Medicine;
+import com.diagbot.model.entity.Usual;
+import com.diagbot.model.entity.Vital;
+import com.diagbot.model.label.ChiefLabel;
+import com.diagbot.model.label.DiagLabel;
+import com.diagbot.model.label.FamilyLabel;
+import com.diagbot.model.label.MaritalLabel;
+import com.diagbot.model.label.MenstrualLabel;
+import com.diagbot.model.label.PacsLabel;
+import com.diagbot.model.label.PastLabel;
+import com.diagbot.model.label.PersonalLabel;
+import com.diagbot.model.label.PresentLabel;
+import com.diagbot.model.label.VitalLabel;
 import com.diagbot.util.Content;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.SearchData;
+import com.diagbot.vo.TestCrfVO;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
@@ -750,4 +773,16 @@ public class BeHospitalizedAI extends ModelAI {
         return takems;*/
         return medicines;
     }
+
+    public Object medrec(TestCrfVO testCrfVO, CRFServiceClient crfServiceClient) {
+        JSONArray crfContent = new JSONArray();
+        putContent(crfContent, testCrfVO.getModelType(), testCrfVO.getContent(), "内容");
+        JSONObject midData = null;
+        try {
+            midData = loadAI(crfContent, crfServiceClient);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "CRF模型【服务器】挂了!" + e.getMessage());
+        }
+        return midData;
+    }
 }

+ 0 - 44
src/main/java/com/diagbot/model/ai/ModelAI.java

@@ -4,13 +4,10 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.diagbot.client.CRFServiceClient;
-import com.diagbot.client.ChiefPresentSimilarityServiceClient;
 import com.diagbot.model.entity.Annotation;
-import com.diagbot.model.entity.ChiefPresentAnnotation;
 import com.diagbot.util.CatalogueUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.CRFVo;
-import com.diagbot.vo.ChiefPresentSimilarityVo;
 import lombok.extern.slf4j.Slf4j;
 
 import java.util.List;
@@ -175,47 +172,6 @@ public class ModelAI {
         similarContent.put("string2", clinicArr);
     }
 
-    /**
-     * 获取主诉现病史症状相似度返回数据
-     *
-     * @param string1 需要转换的文本
-     * @param string2 模型文本
-     * @return
-     */
-    public JSONArray loadSimilarAI(String string1, List<String> string2, boolean directionCheck
-            , String modelName, ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient) {
-        //存储CRF完整所需结构数据
-        ChiefPresentSimilarityVo similarityVo = new ChiefPresentSimilarityVo();
-        JSONObject data = new JSONObject();
-        putContent(data, string1, string2);
-        similarityVo.setData(data);
-        similarityVo.setDirection_check(directionCheck);
-        similarityVo.setModel_name(modelName);
-        //获取CRF模型返回数据
-        JSONArray predY = getAnnotation(chiefPresentSimilarityServiceClient, similarityVo).getPred_y();
-        return getChiefPresentSimilarOutputs(predY);
-    }
-
-    /**
-     * 主诉现病史相似度接口返回
-     *
-     * @param chiefPresentSimilarityServiceClient
-     * @param chiefPresentSimilarityVo
-     * @return
-     */
-    private ChiefPresentAnnotation getAnnotation(ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient,
-                                                 ChiefPresentSimilarityVo chiefPresentSimilarityVo) {
-        ChiefPresentAnnotation annotation = new ChiefPresentAnnotation();
-        try {
-            String annotation_str = chiefPresentSimilarityServiceClient.getAnnotation(chiefPresentSimilarityVo);
-            annotation = JSON.parseObject(annotation_str, ChiefPresentAnnotation.class);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return annotation;
-        }
-    }
-
     /**
      * 获取主诉现病史文本相似度模型输出并处理
      *

+ 1 - 1
src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java

@@ -116,7 +116,7 @@ public class EntityProcessClinic extends EntityProcess {
 //            List<Pacs> pacses = entityProcessLis.extractEntity(aiOut);
 //            presentLabel.setPacses(pacses);
 
-            // TODO 辅检
+            // 辅检
 //             EntityProcessPacsNew entityProcessPacsNew = new EntityProcessPacsNew();
 //             Map<String, PacsNew> pacsNewMap = entityProcessPacsNew.extractEntity(aiOut);
 //             List<PacsNew> collect = new ArrayList<>();

+ 21 - 47
src/main/java/com/diagbot/process/BillProcess.java

@@ -16,10 +16,6 @@ import com.diagbot.facade.CommonFacade;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Operation;
-import com.diagbot.model.label.ChiefLabel;
-import com.diagbot.model.label.PacsLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
 import com.diagbot.rule.AgeRule;
 import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.DrugRule;
@@ -30,12 +26,10 @@ import com.diagbot.rule.PacsRule;
 import com.diagbot.rule.SexRule;
 import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
-import com.diagbot.util.CoreUtil;
 import com.diagbot.vo.RuleVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
@@ -75,6 +69,25 @@ public class BillProcess {
     public void processRule(List<RuleVO> ruleVOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
         List<BillMsg> billMsgList = indicationDTO.getBillMsgList();
         Set<String> set = new LinkedHashSet<>();    // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+        /**---------------------------数据统一处理开始--------------------------------- */
+        // 【过敏药品数据来源】
+        List<Item> allergyMedicines = commonFacade.getDrugAllergySource(wordCrfDTO);
+
+        // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
+        List<Item> medicineAll = wordCrfDTO.getDrugSource();
+
+        // 【诊断数据来源】
+        List<Item> diags = wordCrfDTO.getDiagSource();
+
+        // 【辅检结果数据来源】
+        List<Item> pacsDescList = wordCrfDTO.getPacsLabel().getRes();
+
+        // 【手术数据来源】
+        List<Operation> operationsSource = commonFacade.getOperationSource(wordCrfDTO);
+
+        // 【临床表现数据来源】(主诉、现病史)
+        List<Clinical> clinicals = commonFacade.getClinicalSource(wordCrfDTO);
+        /**---------------------------数据统一处理结束--------------------------------- */
         for (RuleVO ruleVO : ruleVOList) {
             /** 1、获取开单项相关数据 */
             RuleExtDTO ruleExtDTO = commonFacade.getRuleData(ruleVO);
@@ -86,46 +99,7 @@ public class BillProcess {
             RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
             BeanUtil.copyProperties(ruleExtDTO, ruleSimpleDTO);
 
-            /**---------------------------3、数据统一处理开始--------------------------------- */
-            ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
-            PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
-            PastLabel pastLabel = wordCrfDTO.getPastLabel();
-
-            // 【过敏药品数据来源】
-            List<Item> allergyMedicines = commonRule.getDrugAllergySource(wordCrfDTO);
-
-            // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
-            List<Item> medicineAll = wordCrfDTO.getDrugSource();
-
-            // 【诊断数据来源】
-            List<Item> diags = wordCrfDTO.getDiagSource();
-
-            // 【辅检结果数据来源】
-            PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
-            List<Item> pacsDescList = pacsLabel.getRes();
-
-            // 【手术数据来源】
-            List<Operation> operations_all = new ArrayList<>();
-            List<Item> operation = wordCrfDTO.getOperation();
-            List<Operation> operationsItem = new ArrayList<>();
-            for (Item item : operation) {
-                Operation operaData = new Operation();
-                operaData.setName(item.getName());
-                operaData.setStandName(item.getUniqueName());
-                operationsItem.add(operaData);
-            }
-            CoreUtil.addList(operations_all, chiefLabel.getOperations()); // 主诉手术
-            CoreUtil.addList(operations_all, presentLabel.getOperations()); // 现病史手术
-            CoreUtil.addList(operations_all, pastLabel.getOperations()); // 既往史手术
-            CoreUtil.addList(operations_all, operationsItem); // 结构化手术
-
-            // 【临床表现数据来源】(主诉、现病史)
-            List<Clinical> clinicals = new ArrayList<>();
-            CoreUtil.addList(clinicals, chiefLabel.getClinicals()); // 主诉临床表现
-            CoreUtil.addList(clinicals, presentLabel.getClinicals()); // 现病史临床表现
-            /**---------------------------数据统一处理结束--------------------------------- */
-
-            /** 4、规则处理 */
+            /** 3、规则处理 */
             List<RuleConditionDTO> ruleConditionDTOList = ruleExtDTO.getRuleConditionDTOList();
             for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
                 List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
@@ -163,7 +137,7 @@ public class BillProcess {
                                         commonRule.compareNameWithBill(clinicals, ruleBaseDTO, billMsgList, ConEnum.clinicfindings.getName(), ruleSimpleDTO);
                                         break;
                                     case Operation: // 手术(既往史、现病史、医嘱手术)
-                                        commonRule.compareNameWithBill(operations_all, ruleBaseDTO, billMsgList, ConEnum.operations.getName(), ruleSimpleDTO);
+                                        commonRule.compareNameWithBill(operationsSource, ruleBaseDTO, billMsgList, ConEnum.operations.getName(), ruleSimpleDTO);
                                         break;
                                     case Medicine:
                                     case MedChemClass:

+ 460 - 65
src/main/java/com/diagbot/process/PushProcess.java

@@ -4,45 +4,68 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.client.IcssPushServiceClient;
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.dto.DiagnoseDTO;
 import com.diagbot.dto.NeoPushDTO;
 import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
+import com.diagbot.dto.ReverseDTO;
+import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.TreatDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.dto.icss.FeatureRate;
 import com.diagbot.dto.icss.Response;
 import com.diagbot.dto.icss.ResponseData;
 import com.diagbot.entity.PreResult;
+import com.diagbot.enums.BaseDiagnoseTypeEnum;
+import com.diagbot.enums.DiagnoseTypeEnum;
 import com.diagbot.enums.DiseaseTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.MedicalAdviceEnum;
 import com.diagbot.enums.PushRelationTypeEnum;
 import com.diagbot.enums.RedisEnum;
+import com.diagbot.enums.RelationshipEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.facade.CommonFacade;
+import com.diagbot.facade.ConceptInfoFacade;
+import com.diagbot.facade.KlDiagnoseFacade;
 import com.diagbot.facade.KlRelationFacade;
+import com.diagbot.facade.LisConfigFacade;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.facade.TranLisConfigIcssFacade;
+import com.diagbot.model.entity.Clinical;
+import com.diagbot.rule.AgeRule;
+import com.diagbot.rule.CommonRule;
+import com.diagbot.rule.GroupRule;
+import com.diagbot.rule.LisRule;
+import com.diagbot.rule.VitalRule;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.DiagnoseVO;
 import com.diagbot.vo.DiseaseItemVO;
 import com.diagbot.vo.IcssVo;
 import com.diagbot.vo.NeoPushVO;
 import com.diagbot.vo.PushVO;
+import com.diagbot.vo.ReverseVO;
 import com.diagbot.vo.neoPushEntity.Diag;
 import com.diagbot.vo.neoPushEntity.DiagVo;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -54,6 +77,7 @@ import java.util.stream.Collectors;
  * @time 19:42
  */
 @Component
+@Slf4j
 public class PushProcess {
 
     @Autowired
@@ -67,7 +91,23 @@ public class PushProcess {
     @Autowired
     RedisUtil redisUtil;
     @Autowired
-    private KlRelationFacade klRelationFacade;
+    KlRelationFacade klRelationFacade;
+    @Autowired
+    CommonRule commonRule;
+    @Autowired
+    LisRule lisRule;
+    @Autowired
+    KlDiagnoseFacade klDiagnoseFacade;
+    @Autowired
+    AgeRule ageRule;
+    @Autowired
+    VitalRule vitalRule;
+    @Autowired
+    GroupRule groupRule;
+    @Autowired
+    ConceptInfoFacade conceptInfoFacade;
+    @Autowired
+    LisConfigFacade lisConfigFacade;
 
     public PushDTO processIcss(PushVO pushVo) {
 
@@ -78,7 +118,7 @@ public class PushProcess {
         Map<String, Integer> diag_sign = new LinkedHashMap<>();
         PushDTO pushDTO = new PushDTO();
         IcssVo icssVo = pushVo2IcssVo(pushVo);
-//        String s = JSONObject.toJSONString(icssVo);
+        //        String s = JSONObject.toJSONString(icssVo);
         if ((StringUtils.isNotBlank(icssVo.getChief()) && icssVo.getChief().trim().equals("呼吸困难"))
                 || (StringUtils.isNotBlank(icssVo.getSymptom()) && icssVo.getSymptom().trim().equals("呼吸困难"))) {
             icssVo.setChief("呼吸困难。");
@@ -137,15 +177,15 @@ public class PushProcess {
             DiseaseItemVO diseaseItemVO = new DiseaseItemVO();
             diseaseItemVO.setDiseaseName(uniqueName);
             Map<Long, List<String>> items = klRelationFacade.getItemByDiseaseMap(diseaseItemVO);
-            if (MapUtils.isNotEmpty(items)){
-                if (ruleTypeList.contains("8") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.DRUG.getKey()))){
+            if (MapUtils.isNotEmpty(items)) {
+                if (ruleTypeList.contains("8") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.DRUG.getKey()))) {
                     pushDTO.setMedicines(items.get(PushRelationTypeEnum.DRUG.getKey()).stream().map(x -> {
                         PushBaseDTO pushBaseDTO = new PushBaseDTO();
                         pushBaseDTO.setName(x);
                         return pushBaseDTO;
                     }).collect(Collectors.toList()));
                 }
-                if (ruleTypeList.contains("9") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.OPERATION.getKey()))){
+                if (ruleTypeList.contains("9") && ListUtil.isNotEmpty(items.get(PushRelationTypeEnum.OPERATION.getKey()))) {
                     pushDTO.setOperations(items.get(PushRelationTypeEnum.OPERATION.getKey()).stream().map(x -> {
                         PushBaseDTO pushBaseDTO = new PushBaseDTO();
                         pushBaseDTO.setName(x);
@@ -154,22 +194,22 @@ public class PushProcess {
                 }
             }
         }
-//        if (reverseInfoByDisName != null) {
-//            if (ruleTypeList.contains("8") && reverseInfoByDisName.containsKey(StaticTypeEnum.DRUG.getName())) {
-//                pushDTO.setMedicines(reverseInfoByDisName.get(StaticTypeEnum.DRUG.getName()).stream().map(x -> {
-//                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
-//                    pushBaseDTO.setName(x);
-//                    return pushBaseDTO;
-//                }).collect(Collectors.toList()));
-//            }
-//            if (ruleTypeList.contains("9") && reverseInfoByDisName.containsKey(StaticTypeEnum.OPT.getName())) {
-//                pushDTO.setOperations(reverseInfoByDisName.get(StaticTypeEnum.OPT.getName()).stream().map(x -> {
-//                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
-//                    pushBaseDTO.setName(x);
-//                    return pushBaseDTO;
-//                }).collect(Collectors.toList()));
-//            }
-//        }
+        //        if (reverseInfoByDisName != null) {
+        //            if (ruleTypeList.contains("8") && reverseInfoByDisName.containsKey(StaticTypeEnum.DRUG.getName())) {
+        //                pushDTO.setMedicines(reverseInfoByDisName.get(StaticTypeEnum.DRUG.getName()).stream().map(x -> {
+        //                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
+        //                    pushBaseDTO.setName(x);
+        //                    return pushBaseDTO;
+        //                }).collect(Collectors.toList()));
+        //            }
+        //            if (ruleTypeList.contains("9") && reverseInfoByDisName.containsKey(StaticTypeEnum.OPT.getName())) {
+        //                pushDTO.setOperations(reverseInfoByDisName.get(StaticTypeEnum.OPT.getName()).stream().map(x -> {
+        //                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
+        //                    pushBaseDTO.setName(x);
+        //                    return pushBaseDTO;
+        //                }).collect(Collectors.toList()));
+        //            }
+        //        }
         if (ListUtil.isNotEmpty(icssVo.getDiagOrder())) {
             List<PreResult> diagOrder = icssVo.getDiagOrder();
             //把第一个推送出来的诊断set到diagOrder中,再反推
@@ -179,7 +219,7 @@ public class PushProcess {
                 String name = x.getName();
                 Diag diag = new Diag();
                 Map<String, Object> diag_signs = (Map<String, Object>) redisUtil.get(RedisEnum.diseaseCorrespond.getName() + name);
-                name = MapUtils.isNotEmpty(diag_signs)? (String) diag_signs.get("diag_icd"):name;
+                name = MapUtils.isNotEmpty(diag_signs) ? (String) diag_signs.get("diag_icd") : name;
                 diag.setName(name);
                 return diag;
             }).collect(Collectors.toList()));
@@ -194,9 +234,9 @@ public class PushProcess {
                 if (ListUtil.isNotEmpty(pushDiags)) {
                     //先把所有疾病推出来
                     if (ruleTypeList.contains("7")) {
-                        if(MapUtils.isNotEmpty(diag_sign)){
+                        if (MapUtils.isNotEmpty(diag_sign)) {
                             Map.Entry<String, Integer> first = diag_sign.entrySet().stream().findFirst().get();
-                            if (first.getValue() == 1){
+                            if (first.getValue() == 1) {
                                 List<String> firstdiag = Lists.newArrayList(first.getKey());
                                 List<PushBaseDTO> collect_highrisk = firstdiag.stream().map(x -> {
                                     PushBaseDTO pushBaseDTO = new PushBaseDTO();
@@ -242,7 +282,7 @@ public class PushProcess {
         return pushDTO;
     }
 
-    //判断该对象是否: 返回ture表示所有属性为null  返回false表示不是所有属性都是null
+    //判断该对象是否: 返回true表示所有属性为null  返回false表示不是所有属性都是null
     public static boolean isAllFieldNull(Object obj) throws Exception {
         List<String> params = Lists.newArrayList("operations", "medicines", "treat");
         Class stuCla = (Class) obj.getClass();// 得到类对象
@@ -260,6 +300,19 @@ public class PushProcess {
         return flag;
     }
 
+    //判断该对象是否为空,返回true表示所有属性为null  返回false表示不是所有属性都是null
+    public static boolean isAllFieldNull(PushDTO pushDTO) {
+        if (ListUtil.isNotEmpty(pushDTO.getSymptom())
+                || ListUtil.isNotEmpty(pushDTO.getVital())
+                || ListUtil.isNotEmpty(pushDTO.getLis())
+                || ListUtil.isNotEmpty(pushDTO.getPacs())
+                || (pushDTO.getDis() != null && pushDTO.getDis().size() > 0)
+                || ListUtil.isNotEmpty(pushDTO.getComplications())) {
+            return false;
+        }
+        return true;
+    }
+
     /**
      * pushVo转Icss入参
      *
@@ -319,34 +372,182 @@ public class PushProcess {
         return icssVo;
     }
 
-    public PushDTO process(PushVO pushVo, Map<String, Map<String, String>> standConvertMap, WordCrfDTO wordCrfDTO) {
-        int length = pushVo.getLength();
+    /**
+     * 根据诊断反推(根据性别和年龄过滤,并根据界面已有信息过滤,根据长度截取)
+     *
+     * @param pushDTO
+     * @param pushVo
+     * @param wordCrfDTO
+     * @return
+     */
+    public void process(PushDTO pushDTO, PushVO pushVo, WordCrfDTO wordCrfDTO) {
+        // 一般治疗——界面下的第一个诊断
+        if (wordCrfDTO.getDiseaseName() != null) {
+            TreatDTO treatDTO = new TreatDTO();
+            BeanUtil.copyProperties(wordCrfDTO.getDiseaseName(), treatDTO);
+            pushDTO.getTreat().add(treatDTO);
+        }
+        // 生成反推的入参
+        List<String> ruleTypeList = Lists.newArrayList(pushVo.getFeatureType().split(",")); // 需要获取的类型
+        Map<String, List<PushBaseDTO>> dis = pushDTO.getDis();
+        ReverseVO reverseVO = generateReverseVO(wordCrfDTO, ruleTypeList, dis);
+        if (StringUtil.isBlank(reverseVO.getLibName())) {
+            pushDTO.getDebug().put("反推诊断", "无"); // 调试信息
+            return;
+        } else {
+            pushDTO.getDebug().put("反推诊断", reverseVO.getLibName()); // 调试信息
+        }
+        // 查询数据
+        List<ReverseDTO> reverseDTOList = conceptInfoFacade.getReverseFac(reverseVO);
+        // 获取各个类型的界面过滤元素
+        Map<String, List<String>> filterMap = getFilterMap(wordCrfDTO);
+        // 设置推送信息(过滤已有)
+        setPushItem(pushDTO, ruleTypeList, filterMap, reverseDTOList, pushVo.getLength());
+    }
+
+    /**
+     * 根据诊断依据推送疾病总入口
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public PushDTO pushDiagnose(WordCrfDTO wordCrfDTO) {
+        long start = System.currentTimeMillis();
+        PushDTO pushDTO = null;
+        try {
+            pushDTO = pushDiagnoseProcess(wordCrfDTO);
+        } catch (Exception e) {
+            log.error("【诊断依据推理出错】", e);
+            CoreUtil.getDebugStr("【诊断依据推理出错】", e, pushDTO.getDebug());
+        }
+        CoreUtil.getDebugStr(start, "推送诊断耗时_诊断依据", pushDTO.getDebug());
+        return pushDTO;
+    }
+
+    /**
+     * 根据诊断依据推送疾病
+     *
+     * @param wordCrfDTO
+     */
+    public PushDTO pushDiagnoseProcess(WordCrfDTO wordCrfDTO) {
         PushDTO pushDTO = new PushDTO();
-//        List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
-//        Map<String, List<String>> typeWords = typeWords(standConvertMap);
-//        //生成push入参,供图谱调用
-//        NeoPushVO pushVO = commonFacade.generatePushInput(wordCrfDTO);
-//        Map<String, List<PushBaseDTO>> dis = new HashMap<>();
-//        List<String> push = neoFacade.getPush(pushVO);
-//        if (ListUtil.isNotEmpty(push)) {
-//            //先把所有疾病推出来
-//            if (ruleTypeList.contains("7")) {
-//                List<PushBaseDTO> diseeases = push.stream().map(x -> {
-//                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
-//                    pushBaseDTO.setName(x);
-//                    return pushBaseDTO;
-//                }).collect(Collectors.toList());
-//                diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
-//                dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
-//                pushDTO.setDis(dis);
-//            }
-//            //把第一个推送出来的诊断set到diagOrder中,再反推
-//            setPushVo(pushVO, push);
-//            //调用反推
-//            reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
-//        }
+        // 读取所有的诊断依据规则——已去重
+        List<BaseDiagnoseDTO> diagnoselist = redisUtil.get(RedisEnum.allBaseDiagnose.getName());
+        if (ListUtil.isEmpty(diagnoselist)) {
+            return pushDTO;
+        }
+        // 匹配的诊断依据规则
+        List<Long> baseIdList = new ArrayList<>();
+
+        /**---------------------------数据统一处理开始--------------------------------- */
+        // 【临床表现数据来源】(主诉、现病史)
+        List<Clinical> clinicals = commonFacade.getClinicalSource(wordCrfDTO);
+        /**---------------------------数据统一处理结束--------------------------------- */
+
+        // 规则处理
+        for (BaseDiagnoseDTO base : diagnoselist) {
+            RuleBaseDTO ruleBaseDTO = new RuleBaseDTO();
+            BeanUtil.copyProperties(base, ruleBaseDTO);
+            String baseIds = base.getIds();
+            switch (BaseDiagnoseTypeEnum.getEnum(base.getBaseType())) {
+                case equals: // 等于术语本身
+                    switch (LexiconEnum.getEnum(base.getBaseLibType())) {
+                        case Symptom: // 症状
+                            commonRule.compareNameWithPush(clinicals, ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case Disease: // 疾病【病史】
+                            commonRule.compareNameWithPush(wordCrfDTO.getPastLabel().getDiags(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case VitalResult: // 体格检查结果
+                            vitalRule.push(wordCrfDTO.getVitalLabel(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case Group: // 人群
+                            groupRule.push(wordCrfDTO, ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case PacsResult: // 辅助检查结果
+                            commonRule.compareItemWithPush(wordCrfDTO.getPacsLabel().getRes(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                    }
+                    break;
+                case compare: // 比较
+                    switch (LexiconEnum.getEnum(base.getBaseLibType())) {
+                        case LisSubName: // 化验
+                            lisRule.push(wordCrfDTO.getLis(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case Age: // 年龄
+                            ageRule.push(wordCrfDTO, ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case Vital: // 体格检查项目
+                            vitalRule.push(wordCrfDTO.getVitalLabel(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                    }
+                    break;
+                case regexChiefSymptom: // 主诉现病史正则
+                    commonRule.getRegexResPush(wordCrfDTO.getChief() + wordCrfDTO.getSymptom(),
+                            base.getBaseEqValue(), baseIdList, baseIds);
+                    break;
+                case regexPast: // 既往史正则
+                    commonRule.getRegexResPush(wordCrfDTO.getPasts() + wordCrfDTO.getPersonal() + wordCrfDTO.getMenstrual() + wordCrfDTO.getMarital() + wordCrfDTO.getFamily(),
+                            base.getBaseEqValue(), baseIdList, baseIds);
+                    break;
+            }
+        }
+        // 根据诊断依据推送诊断
+        Collections.sort(baseIdList); // id排序,方便调试查看
+        pushDTO.getDebug().put("诊断依据ID列表", StringUtils.join(baseIdList, ","));
+        Map<String, List<PushBaseDTO>> pushDiagnoseDTO = setPushDiagnose(wordCrfDTO, baseIdList);
+        pushDTO.setDis(pushDiagnoseDTO);
         return pushDTO;
+    }
+
+    /**
+     * 根据诊断依据推送诊断
+     *
+     * @param wordCrfDTO
+     * @param baseIdList
+     */
+    public Map<String, List<PushBaseDTO>> setPushDiagnose(WordCrfDTO wordCrfDTO, List<Long> baseIdList) {
+        Map<String, List<PushBaseDTO>> pushDiagnoseDTO = new LinkedHashMap<>();
+        // 设置诊断
+        if (ListUtil.isNotEmpty(baseIdList)) {
+            DiagnoseVO diagnoseVO = new DiagnoseVO();
+            diagnoseVO.setAge(wordCrfDTO.getAgeNum());
+            diagnoseVO.setSexType(wordCrfDTO.getSex());
+            diagnoseVO.setIds(baseIdList);
+            List<DiagnoseDTO> diagnoseDTOList = klDiagnoseFacade.getDiagnoseByIds(diagnoseVO);
+            List<PushBaseDTO> protocolList = new ArrayList<>(); // 拟诊
+            List<PushBaseDTO> definiteList = new ArrayList<>(); // 确诊
+            List<PushBaseDTO> vigilantList = new ArrayList<>(); // 警惕
 
+            for (DiagnoseDTO diagnoseDTO : diagnoseDTOList) {
+                PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                pushBaseDTO.setName(diagnoseDTO.getLibName());
+                switch (DiagnoseTypeEnum.getEnum(diagnoseDTO.getConditionType())) {
+                    case protocol: // 拟诊
+                        protocolList.add(pushBaseDTO);
+                        break;
+                    case definite: // 确诊
+                        definiteList.add(pushBaseDTO);
+                        break;
+                    case vigilant: // 警惕
+                        vigilantList.add(pushBaseDTO);
+                        break;
+                }
+            }
+            // 无界面诊断,推送拟诊和确诊
+            if (!hasDisease(wordCrfDTO)) {
+                if (ListUtil.isNotEmpty(protocolList)) {
+                    pushDiagnoseDTO.put("拟诊", protocolList);
+                }
+                if (ListUtil.isNotEmpty(definiteList)) {
+                    pushDiagnoseDTO.put("确诊", definiteList);
+                }
+            }
+            if (ListUtil.isNotEmpty(vigilantList)) {
+                pushDiagnoseDTO.put("警惕", vigilantList);
+            }
+        }
+        return pushDiagnoseDTO;
     }
 
     private void setPushVo(NeoPushVO pushVO, List<String> push) {
@@ -360,24 +561,218 @@ public class PushProcess {
         pushVO.setDiagVo(diagVo);
     }
 
-    public Map<String, List<String>> typeWords(Map<String, Map<String, String>> standConvertMap) {
-        Map<String, List<String>> typeWordsMap = new HashMap<>();
-        for (Map.Entry<String, Map<String, String>> s : standConvertMap.entrySet()) {
-            List<String> words = new ArrayList<>();
-            String type = s.getKey();
-            Map<String, String> value = s.getValue();
-            value.forEach((name, standName) -> {
-                words.add(name);
-                words.add(standName);
-            });
-            typeWordsMap.put(type, new ArrayList<>(new HashSet<>(words)));
+    /**
+     * 获取各个类型的界面过滤元素
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public Map<String, List<String>> getFilterMap(WordCrfDTO wordCrfDTO) {
+        Map<String, List<String>> filterMap = new HashMap<>();
+        // 主诉症状
+        dealFilter(filterMap, StandConvertEnum.symptom.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getChiefLabel().getClinicals(), "name", "standName"));
+        // 现病史症状
+        dealFilter(filterMap, StandConvertEnum.symptom.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getPresentLabel().getClinicals(), "name", "standName"));
+        // 查体结果
+        dealFilter(filterMap, StandConvertEnum.vital.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getVitalLabel().getClinicals(), "name", "standName"));
+        // 检查
+        dealFilter(filterMap, StandConvertEnum.pacs.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getPacs(), "name", "uniqueName"));
+        // 药品
+        dealFilter(filterMap, StandConvertEnum.drug.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getDrug(), "name", "uniqueName"));
+        // 手术
+        dealFilter(filterMap, StandConvertEnum.operation.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getOperation(), "name", "uniqueName"));
+        // 诊断
+        dealFilter(filterMap, StandConvertEnum.disease.toString(),
+                CoreUtil.getByPropertyName(wordCrfDTO.getDiag(), "name", "uniqueName"));
+        // 化验——获取过滤化验套餐名
+        dealFilter(filterMap, StandConvertEnum.lis.toString(), lisConfigFacade.getMappingLisItem(wordCrfDTO));
+        return filterMap;
+    }
+
+    /**
+     * 根据类型生成过滤词
+     *
+     * @param map
+     * @param key
+     * @param filteString
+     */
+    public void dealFilter(Map<String, List<String>> map, String key, List<String> filteString) {
+        if (ListUtil.isEmpty(filteString)) {
+            return;
+        }
+        if (ListUtil.isNotEmpty(map.get(key))) { // 有值就追加
+            map.get(key).addAll(filteString);
+        } else { // 无值就初始化
+            map.put(key, filteString);
+        }
+    }
+
+    /**
+     * 设置其他推送信息
+     *
+     * @param pushDTO
+     * @param ruleTypeList
+     * @param filterMap
+     * @param reverseDTOList
+     */
+    public void setPushItem(PushDTO pushDTO, List<String> ruleTypeList, Map<String, List<String>> filterMap, List<ReverseDTO> reverseDTOList, int length) {
+        Map<String, List<PushBaseDTO>> dis = pushDTO.getDis();
+        Map<Integer, List<ReverseDTO>> map = EntityUtil.makeEntityListMap(reverseDTOList, "sonType");
+        // 症状
+        if (ruleTypeList.contains("1")) {
+            if (map.get(LexiconEnum.Symptom.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.Symptom.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.symptom.toString())); // 过滤界面已有
+                pushDTO.setSymptom(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
+        }
+        // 查体结果
+        if (ruleTypeList.contains("4")) {
+            if (map.get(LexiconEnum.VitalResult.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.VitalResult.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.vital.toString())); // 过滤界面已有
+                pushDTO.setVital(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
+        }
+        // 化验套餐
+        if (ruleTypeList.contains("5")) {
+            if (map.get(LexiconEnum.LisName.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.LisName.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.lis.toString())); // 过滤界面已有
+                pushDTO.setLis(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
+        }
+        // 辅检项目
+        if (ruleTypeList.contains("6")) {
+            if (map.get(LexiconEnum.PacsName.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.PacsName.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.pacs.toString())); // 过滤界面已有
+                pushDTO.setPacs(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
+        }
+        // 鉴别诊断, 注意这个类型与其他类型不一样
+        if (ruleTypeList.contains("7")) {
+            if (map.get(LexiconEnum.Disease.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.Disease.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.disease.toString())); // 过滤界面已有
+                List<PushBaseDTO> pushBaseDTO = generatePushBaseDTO(list, length);
+                if (ListUtil.isNotEmpty(pushBaseDTO)) {
+                    dis.put(DiseaseTypeEnum.identify.getName(), pushBaseDTO);
+                }
+            }
+        }
+        // 药品
+        if (ruleTypeList.contains("8")) {
+            if (map.get(LexiconEnum.Medicine.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.Medicine.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.drug.toString())); // 过滤界面已有
+                pushDTO.setMedicines(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
+        }
+        // 手术
+        if (ruleTypeList.contains("9")) {
+            if (map.get(LexiconEnum.Operation.getKey()) != null) {
+                List<String> list = map.get(LexiconEnum.Operation.getKey()).stream().map(r -> r.getSonName()).collect(Collectors.toList());
+                CoreUtil.removeRepeat(list, filterMap.get(StandConvertEnum.operation.toString())); // 过滤界面已有
+                pushDTO.setOperations(generatePushBaseDTO(list, length)); // 放入对象返回
+            }
         }
+    }
 
-        return typeWordsMap;
+    /**
+     * 将名称列表生成推送返回类型
+     *
+     * @param nameList
+     * @param length   最长个数, -1:无限制
+     * @return
+     */
+    public List<PushBaseDTO> generatePushBaseDTO(List<String> nameList, int length) {
+        List<PushBaseDTO> pushBaseDTOList = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(nameList)) {
+            for (int i = 0; i < nameList.size(); i++) {
+                 if (length != -1 && pushBaseDTOList.size() >= length) {
+                    break;
+                }
+                PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                pushBaseDTO.setName(nameList.get(i));
+                pushBaseDTOList.add(pushBaseDTO);
+            }
+        }
+        return pushBaseDTOList;
     }
 
-    private void reversePushPackage(){
+    /**
+     * 生成反推的入参
+     *
+     * @param wordCrfDTO
+     * @param ruleTypeList
+     * @param dis
+     * @return
+     */
+    public ReverseVO generateReverseVO(WordCrfDTO wordCrfDTO, List<String> ruleTypeList, Map<String, List<PushBaseDTO>> dis) {
+        ReverseVO reverseVO = new ReverseVO();
+        String disName = "";
+        // 按以下顺序获取一个诊断: 下的诊断->可能诊断第一个
+        if (ListUtil.isNotEmpty(wordCrfDTO.getDiag())) {
+            disName = wordCrfDTO.getDiag().get(0).getUniqueName();
+        } else if (dis != null) {
+            List<PushBaseDTO> possibleDis = dis.get(DiseaseTypeEnum.possibleDis.getName());
+            if (ListUtil.isNotEmpty(possibleDis)) {
+                disName = possibleDis.get(0).getName(); // 获取可能诊断第一个
+            }
+        }
+        reverseVO.setLibName(disName);
+        // 诊断名称不为空才反推
+        if (StringUtil.isNotBlank(disName)) {
+            reverseVO.setAge(wordCrfDTO.getAgeNum());
+            reverseVO.setSexType(wordCrfDTO.getSex());
+            reverseVO.setLibType(LexiconEnum.Disease.getKey());
+            // 关联类型
+            List<Integer> relationType = new ArrayList<>();
+            if (ruleTypeList.contains("1")) {
+                relationType.add(RelationshipEnum.R501.getKey()); // 主症状
+                relationType.add(RelationshipEnum.R502.getKey()); // 次症状
+            }
+            if (ruleTypeList.contains("4")) {
+                relationType.add(RelationshipEnum.R503.getKey()); // 查体结果
+            }
+            if (ruleTypeList.contains("5")) {
+                relationType.add(RelationshipEnum.R504.getKey()); // 化验套餐
+            }
+            if (ruleTypeList.contains("6")) {
+                relationType.add(RelationshipEnum.R505.getKey()); // 辅助检查项目
+            }
+            if (ruleTypeList.contains("7")) {
+                relationType.add(RelationshipEnum.R508.getKey()); // 鉴别诊断
+            }
+            if (ruleTypeList.contains("8")) {
+                relationType.add(RelationshipEnum.R506.getKey()); // 药品
+            }
+            if (ruleTypeList.contains("9")) {
+                relationType.add(RelationshipEnum.R507.getKey()); // 手术
+            }
+            reverseVO.setRelationType(relationType);
+        }
+        return reverseVO;
+    }
 
+    /**
+     * 是否有界面诊断
+     *
+     * @param wordCrfDTO
+     * @return
+     */
+    public Boolean hasDisease(WordCrfDTO wordCrfDTO) {
+        if (ListUtil.isNotEmpty(wordCrfDTO.getDiag())) {
+            return true;
+        }
+        return false;
     }
 
     private void reversePushPackage(int length, PushDTO pushDTO, List<String> ruleTypeList, Map<String, List<String>> typeWords, NeoPushVO pushVO, Map<String, List<PushBaseDTO>> dis) {

+ 15 - 0
src/main/java/com/diagbot/rule/AgeRule.java

@@ -37,6 +37,21 @@ public class AgeRule {
         }
     }
 
+    /**
+     * 比较年龄——推送
+     *
+     * @param wordCrfDTO
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        Boolean flag = getFlag(wordCrfDTO, ruleBaseDTO);
+        if (flag) {
+            CoreUtil.addSplitString(baseIdList, ids);
+        }
+    }
+
     /**
      * 比较年龄——高危手术
      *

+ 66 - 39
src/main/java/com/diagbot/rule/CommonRule.java

@@ -26,6 +26,8 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -66,6 +68,29 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 比较阳性属性是否匹配
+     *
+     * @param input
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     * @param <T>
+     */
+    public <T> void compareNameWithPush(List<T> input, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        if (ListUtil.isNotEmpty(input)) {
+            for (T d : input) {
+                Negative val = (Negative) CoreUtil.getFieldValue(d, "negative");
+                if (val == null) {
+                    String c = (String) CoreUtil.getFieldValue(d, "standName");
+                    if (StringUtils.isNotBlank(c) && CoreUtil.compareName(ruleBaseDTO, c)) {
+                        CoreUtil.addSplitString(baseIdList, ids);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 比较是否包含
      *
@@ -114,7 +139,7 @@ public class CommonRule {
     }
 
     /**
-     * 比较名称是否匹配
+     * 比较名称是否匹配——开单
      *
      * @param input
      * @param ruleBaseDTO
@@ -139,6 +164,27 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 比较名称是否匹配——推理
+     *
+     * @param input
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     * @param <T>
+     */
+    public <T> void compareItemWithPush(List<T> input, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        if (ListUtil.isNotEmpty(input)) {
+            for (T t : input) {
+                String c = (String) CoreUtil.getFieldValue(t, "uniqueName"); // 标准名称
+                String c_name = (String) CoreUtil.getFieldValue(t, "name"); // 界面名称
+                if (CoreUtil.compareName(ruleBaseDTO, c)) {
+                    CoreUtil.addSplitString(baseIdList, ids);
+                }
+            }
+        }
+    }
+
     /**
      * 比较名称是否匹配
      *
@@ -197,6 +243,21 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 正则匹配——推送
+     *
+     * @param content 文本内容
+     * @param regex   表达式
+     * @return
+     */
+    public void getRegexResPush(String content, String regex, List<Long> baseIdList, String ids) {
+        // 是否有符合的数据
+        boolean flag = getRegexRes(content, regex);
+        if (flag) {
+            CoreUtil.addSplitString(baseIdList, ids);
+        }
+    }
+
     /**
      * 是否有符合的数据(公共方法)
      *
@@ -371,44 +432,9 @@ public class CommonRule {
         highRiskList.add(billMsg);
     }
 
-    /**
-     * 返回诊断数据源(只留阳性诊断)
-     *
-     * @param wordCrfDTO
-     */
-    public List<Item> getDiseaseSource(WordCrfDTO wordCrfDTO) {
-        List<Item> diags = new ArrayList<>();
-        CoreUtil.addList(diags, wordCrfDTO.getDiag()); // 结构化诊断
-        CoreUtil.addAllConvert(diags, wordCrfDTO.getChiefLabel().getDiags());// 主诉诊断
-        CoreUtil.addAllConvert(diags, wordCrfDTO.getPresentLabel().getDiags()); // 现病史诊断
-        CoreUtil.addAllConvert(diags, wordCrfDTO.getPastLabel().getDiags()); // 既往史诊断
-        return diags;
-    }
 
-    /**
-     * 返回药品数据源
-     *
-     * @param wordCrfDTO
-     */
-    public List<Item> getDrugSource(WordCrfDTO wordCrfDTO) {
-        List<Item> drugAll = new ArrayList<>();
-        CoreUtil.addList(drugAll, wordCrfDTO.getDrug());
-        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getChiefLabel().getMedicines()); // 主诉药品
-        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPresentLabel().getMedicines());// 现病史药品
-        CoreUtil.addAllConvert(drugAll, wordCrfDTO.getPastLabel().getMedicines()); // 既往史药品
-        return drugAll;
-    }
 
-    /**
-     * 返回药品过敏数据源
-     *
-     * @param wordCrfDTO
-     */
-    public List<Item> getDrugAllergySource(WordCrfDTO wordCrfDTO) {
-        List<Item> drugAllergyAll = new ArrayList<>();
-        CoreUtil.addAllConvert(drugAllergyAll, wordCrfDTO.getPastLabel().getAllergyMedicines()); // 既往史过敏药品
-        return drugAllergyAll;
-    }
+
 
     public static void main(String[] args) {
         List<Pacs> pacsList = new ArrayList<>();
@@ -431,8 +457,9 @@ public class CommonRule {
         for (Pacs bean : pacsList) {
             System.out.println(bean.getName());
         }
-
-
+        AtomicReference<Integer> integerAtomicReference = new AtomicReference<>(20);
+        integerAtomicReference.set(1020);
+        new ReentrantLock().lock();
     }
 
 }

+ 16 - 1
src/main/java/com/diagbot/rule/GroupRule.java

@@ -39,7 +39,7 @@ public class GroupRule {
      */
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Map map = rule(wordCrfDTO, ruleBaseDTO);
-        if ((Boolean)map.get("flag")) {
+        if (CoreUtil.getMapFlag(map)) {
             BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                     ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
                     ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
@@ -47,6 +47,21 @@ public class GroupRule {
         }
     }
 
+    /**
+     * 人群推送
+     *
+     * @param wordCrfDTO
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        Map map = rule(wordCrfDTO, ruleBaseDTO);
+        if (CoreUtil.getMapFlag(map)) {
+            CoreUtil.addSplitString(baseIdList, ids);
+        }
+    }
+
     /**
      * 人群规则判断
      *

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

@@ -349,4 +349,23 @@ public class LisRule {
             criticalList.add(criticalMsg);
         }
     }
+
+    /**
+     * 比较化验——推理
+     *
+     * @param inputLis
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(List<Lis> inputLis, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        if (ListUtil.isNotEmpty(inputLis) && StringUtil.isNotBlank(ruleBaseDTO.getBaseLibName())) {
+            for (Lis lis : inputLis) {
+                Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lis);
+                if (CoreUtil.getMapFlag(map)) {
+                    CoreUtil.addSplitString(baseIdList, ids);
+                }
+            }
+        }
+    }
 }

+ 15 - 0
src/main/java/com/diagbot/rule/VitalRule.java

@@ -39,6 +39,21 @@ public class VitalRule {
         }
     }
 
+    /**
+     * 比较体征——推送
+     *
+     * @param vitalLabel
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(VitalLabel vitalLabel, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        Map<String, Object> map = CoreUtil.compareVital(ruleBaseDTO, vitalLabel);
+        if (CoreUtil.getMapFlag(map)) {
+            CoreUtil.addSplitString(baseIdList, ids);
+        }
+    }
+
     /**
      * 比较体征——高危手术
      *

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

@@ -1,7 +1,11 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.ReverseDTO;
 import com.diagbot.entity.ConceptInfo;
+import com.diagbot.vo.ReverseVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,4 +16,6 @@ import com.diagbot.entity.ConceptInfo;
  * @since 2020-08-18
  */
 public interface ConceptInfoService extends IService<ConceptInfo> {
+
+    public List<ReverseDTO> getReverse(ReverseVO reverseVO);
 }

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

@@ -0,0 +1,20 @@
+package com.diagbot.service;
+
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.entity.KlDiagnoseBase;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseBaseService extends IService<KlDiagnoseBase> {
+    //获取所有去重的基础诊断依据
+    List<BaseDiagnoseDTO> getAllBaseDiagnose();
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 诊断依据条件表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseConditionService extends IService<KlDiagnoseCondition> {
+
+}

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

@@ -0,0 +1,34 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DiagnoseDTO;
+import com.diagbot.dto.DiagnosesFindDTO;
+import com.diagbot.dto.KlDiagnoseByIdDTO;
+import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.entity.KlDiagnose;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.DiagnoseVO;
+import com.diagbot.vo.DiagnosesFindVO;
+import com.diagbot.vo.KlDiagnoseByIdVO;
+import com.diagbot.vo.KlDiagnoseInfoVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+public interface KlDiagnoseService extends IService<KlDiagnose> {
+    //根据匹配的基础规则ID获取确诊、拟诊、警惕的疾病
+    List<DiagnoseDTO> getDiagnoseByIds(DiagnoseVO diagnoseVO);
+
+    IPage<KlDiagnoseInfoDTO> getKlDiagnosePages(KlDiagnoseInfoVO klDiagnoseInfoVO);
+
+    List<KlDiagnoseByIdDTO> getByIdDiagnoses(KlDiagnoseByIdVO klDiagnoseByIdVO);
+
+    List<DiagnosesFindDTO> findDiaNameAll(DiagnosesFindVO diagnosesFindVO);
+}

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

@@ -1,12 +1,15 @@
 package com.diagbot.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.ReverseDTO;
 import com.diagbot.entity.ConceptInfo;
 import com.diagbot.mapper.ConceptInfoMapper;
 import com.diagbot.service.ConceptInfoService;
+import com.diagbot.vo.ReverseVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 静态知识标准术语表 服务实现类
@@ -16,6 +19,9 @@ import org.springframework.stereotype.Service;
  * @since 2020-08-18
  */
 @Service
-@DS("cdss")
 public class ConceptInfoServiceImpl extends ServiceImpl<ConceptInfoMapper, ConceptInfo> implements ConceptInfoService {
+    @Override
+    public List<ReverseDTO> getReverse(ReverseVO reverseVO) {
+        return baseMapper.getReverse(reverseVO);
+    }
 }

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

@@ -0,0 +1,26 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.dto.BaseDiagnoseDTO;
+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;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据基础表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseBaseServiceImpl extends ServiceImpl<KlDiagnoseBaseMapper, KlDiagnoseBase> implements KlDiagnoseBaseService {
+    //获取所有去重的基础诊断依据
+    public List<BaseDiagnoseDTO> getAllBaseDiagnose(){
+        return baseMapper.getAllBaseDiagnose();
+    }
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlDiagnoseCondition;
+import com.diagbot.mapper.KlDiagnoseConditionMapper;
+import com.diagbot.service.KlDiagnoseConditionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 诊断依据条件表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseConditionServiceImpl extends ServiceImpl<KlDiagnoseConditionMapper, KlDiagnoseCondition> implements KlDiagnoseConditionService {
+
+}

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

@@ -0,0 +1,49 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DiagnoseDTO;
+import com.diagbot.dto.DiagnosesFindDTO;
+import com.diagbot.dto.KlDiagnoseByIdDTO;
+import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.entity.KlDiagnose;
+import com.diagbot.mapper.KlDiagnoseMapper;
+import com.diagbot.service.KlDiagnoseService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.DiagnoseVO;
+import com.diagbot.vo.DiagnosesFindVO;
+import com.diagbot.vo.KlDiagnoseByIdVO;
+import com.diagbot.vo.KlDiagnoseInfoVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 诊断依据信息表 服务实现类
+ * </p>
+ *
+ * @author gaodm
+ * @since 2021-03-15
+ */
+@Service
+public class KlDiagnoseServiceImpl extends ServiceImpl<KlDiagnoseMapper, KlDiagnose> implements KlDiagnoseService {
+    //根据匹配的基础规则ID获取确诊、拟诊、警惕的疾病
+    public List<DiagnoseDTO> getDiagnoseByIds(DiagnoseVO diagnoseVO){
+        return baseMapper.getDiagnoseByIds(diagnoseVO);
+    }
+
+    @Override
+    public IPage<KlDiagnoseInfoDTO> getKlDiagnosePages(KlDiagnoseInfoVO klDiagnoseInfoVO) {
+        return baseMapper.getKlDiagnosePages(klDiagnoseInfoVO);
+    }
+
+    @Override
+    public List<KlDiagnoseByIdDTO> getByIdDiagnoses(KlDiagnoseByIdVO klDiagnoseByIdVO) {
+        return baseMapper.getByIdDiagnoses(klDiagnoseByIdVO);
+    }
+
+    @Override
+    public List<DiagnosesFindDTO> findDiaNameAll(DiagnosesFindVO diagnosesFindVO) {
+        return baseMapper.findDiaNameAll(diagnosesFindVO);
+    }
+}

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

@@ -19,7 +19,6 @@ import java.util.regex.Pattern;
 @Getter
 @Setter
 public class CatalogueUtil {
-    public static Map<String, QCCatalogue> qcCatalogueMap = new HashMap<>();
     public static Map<Integer, String> intMapString =
             ImmutableMap.<Integer, String>builder().put(1, "一").put(2, "二").put(3, "三").put(4, "四").put(5, "五")
                     .put(6, "六").put(7, "七").put(8, "八").put(9, "九").put(0, "零").build();

+ 159 - 159
src/main/java/com/diagbot/util/Constants.java

@@ -1,159 +1,159 @@
-/**   
-* @Company: 杭州朗通信息技术有限公司 
-* @Department: 系统软件部 
-* @Description: 朗通智能辅助诊疗系统 
-* @Address: 浙江省杭州市西湖区西斗门路3号 天堂软件园D-7B 
-*/
-package com.diagbot.util;
-
-/**
-* @Title: Constants.java 
-* @Package org.diagbot.public 
-* @Description: 通用常数接口定义  
-* @author 楼辉荣(Fyeman)   
-* @date 2015年4月23日 下午11:25:37 
-* @version V1.0
- */
-public interface Constants {
-    /**
-     * 操作名称
-     */
-    String OP_NAME = "op";
-    /**
-     * 消息key
-     */
-    String MESSAGE = "message";
-    /**
-     * 错误key
-     */
-    String ERROR = "error";
-    /**
-     * 上个页面地址
-     */
-    String BACK_URL = "BackURL";
-    String IGNORE_BACK_URL = "ignoreBackURL";
-    /**
-     * 当前请求的地址 带参数
-     */
-    String CURRENT_URL = "currentURL";
-    /**
-     * 当前请求的地址 不带参数
-     */
-    String NO_QUERYSTRING_CURRENT_URL = "noQueryStringCurrentURL";
-    /**
-     * 上下文
-     */
-    String CONTEXT_PATH = "ctx";
-    /**
-     * 当前登录的用户
-     */
-    String CURRENT_APPLICATION = "c_app";
-    String CURRENT_USER = "c_user";
-    String CURRENT_USERNAME = "username";
-    String USER_MENUS = "menus";
-    
-    /**
-     * 管理控制台应用ID=0
-     */
-    long ADMIN_APPLICATION = 0;
-    /**
-     * 一级菜单grade标识
-     */
-    int FIRST_MENU = 1;
-    /**
-     * 二级菜单grade标识
-     */
-    int SECOND_MENU = 2;
-    /**
-     * 操作按钮等级标识
-     */
-    int MENU_GRADE = 3;
-    /**
-     * 最高级资源grade标识
-     */
-    int TOP_REC = 0;
-    /**
-     * 编码方式
-     */
-    String ENCODING = "UTF-8";
-    /**
-     * 系统用户状态--启用
-     */
-    int USER_STATUS_UNLOCK = 1;
-    /**
-     * 系统用户状态--禁用
-     */
-    int USER_STATUS_LOCK = 0;
-    /**
-     * 通用值0
-     */
-    int COMMON_INT_0 = 0;
-    /**
-     * 通用值1
-     */
-    int COMMON_INT_1 = 1;
-    /**
-     * 通用值-1
-     */
-    int COMMON_INT_NEG_1 = -1;
-    /**
-     * 通用值0
-     */
-    long COMMON_LONG_0 = 0L;
-    /**
-     * 通用值1
-     */
-    long COMMON_LONG_1 = 1L;
-    /**
-     * 通用值-1
-     */
-    long COMMON_LONG_NEG_1 = -1L;
-    /**
-     * 通用值"0"
-     */
-    String COMMON_STRING_0 = "0";
-    /**
-     * 通用值"1"
-     */
-    String COMMON_STRING_1 = "1";
-    /**
-     * 通用值"-1"
-     */
-    String COMMON_STRING_NEG_1 = "-1";
-    
-    /**
-     * 通用值"-1"
-     */
-    String COMMON_STRING_99 = "99";
-    /**
-     * 登录页面
-     */
-    String LOGIN_URL = "/login";
-    /**
-     * 上传文件夹
-     */
-    String UPLOAD_FOLDER_NAME = "upload";
-    /**
-     * 临时文件夹
-     */
-    String TEMP_FOLDER_NAME = "temp";
-    /**
-     * 地域标示
-     */
-    public static final String DEFAULT_LOCALE = "zh_CN";
-    /**
-     * 缺省字符集
-     */
-    public static final String DEFAULT_ENCODE = "UTF-8";
-    /**
-     * 以下为接口返回公共属性定义常量
-     */
-    public static final String MSG_SUCCESS = "操作成功";	//操作成功
-    public static final String MSG_FALURE = "操作失败";	//操作失败
-    
-    public static final long INVALIDATE_VALUE = -1;		//起止时间定义
-    public static final int RET_SUCCESS = 0; 			//成功
-	public static final int RET_FAIL = 1; 				//失败
-	public static final int RET_ERROR_PARAM = -1; 		//参数校验失败
-	public static final int RET_NO_TOKEN = -2; 	//用户token丢失
-}
+/**   
+* @Company: 杭州朗通信息技术有限公司 
+* @Department: 系统软件部 
+* @Description: 朗通智能辅助诊疗系统 
+* @Address: 浙江省杭州市西湖区西斗门路3号 天堂软件园D-7B 
+*/
+package com.diagbot.util;
+
+/**
+* @Title: Constants.java 
+* @Package org.diagbot.public 
+* @Description: 通用常数接口定义  
+* @author 楼辉荣(Fyeman)   
+* @date 2015年4月23日 下午11:25:37 
+* @version V1.0
+ */
+public interface Constants {
+    /**
+     * 操作名称
+     */
+    String OP_NAME = "op";
+    /**
+     * 消息key
+     */
+    String MESSAGE = "message";
+    /**
+     * 错误key
+     */
+    String ERROR = "error";
+    /**
+     * 上个页面地址
+     */
+    String BACK_URL = "BackURL";
+    String IGNORE_BACK_URL = "ignoreBackURL";
+    /**
+     * 当前请求的地址 带参数
+     */
+    String CURRENT_URL = "currentURL";
+    /**
+     * 当前请求的地址 不带参数
+     */
+    String NO_QUERYSTRING_CURRENT_URL = "noQueryStringCurrentURL";
+    /**
+     * 上下文
+     */
+    String CONTEXT_PATH = "ctx";
+    /**
+     * 当前登录的用户
+     */
+    String CURRENT_APPLICATION = "c_app";
+    String CURRENT_USER = "c_user";
+    String CURRENT_USERNAME = "username";
+    String USER_MENUS = "menus";
+    
+    /**
+     * 管理控制台应用ID=0
+     */
+    long ADMIN_APPLICATION = 0;
+    /**
+     * 一级菜单grade标识
+     */
+    int FIRST_MENU = 1;
+    /**
+     * 二级菜单grade标识
+     */
+    int SECOND_MENU = 2;
+    /**
+     * 操作按钮等级标识
+     */
+    int MENU_GRADE = 3;
+    /**
+     * 最高级资源grade标识
+     */
+    int TOP_REC = 0;
+    /**
+     * 编码方式
+     */
+    String ENCODING = "UTF-8";
+    /**
+     * 系统用户状态--启用
+     */
+    int USER_STATUS_UNLOCK = 1;
+    /**
+     * 系统用户状态--禁用
+     */
+    int USER_STATUS_LOCK = 0;
+    /**
+     * 通用值0
+     */
+    int COMMON_INT_0 = 0;
+    /**
+     * 通用值1
+     */
+    int COMMON_INT_1 = 1;
+    /**
+     * 通用值-1
+     */
+    int COMMON_INT_NEG_1 = -1;
+    /**
+     * 通用值0
+     */
+    long COMMON_LONG_0 = 0L;
+    /**
+     * 通用值1
+     */
+    long COMMON_LONG_1 = 1L;
+    /**
+     * 通用值-1
+     */
+    long COMMON_LONG_NEG_1 = -1L;
+    /**
+     * 通用值"0"
+     */
+    String COMMON_STRING_0 = "0";
+    /**
+     * 通用值"1"
+     */
+    String COMMON_STRING_1 = "1";
+    /**
+     * 通用值"-1"
+     */
+    String COMMON_STRING_NEG_1 = "-1";
+    
+    /**
+     * 通用值"-1"
+     */
+    String COMMON_STRING_99 = "99";
+    /**
+     * 登录页面
+     */
+    String LOGIN_URL = "/login";
+    /**
+     * 上传文件夹
+     */
+    String UPLOAD_FOLDER_NAME = "upload";
+    /**
+     * 临时文件夹
+     */
+    String TEMP_FOLDER_NAME = "temp";
+    /**
+     * 地域标示
+     */
+    public static final String DEFAULT_LOCALE = "zh_CN";
+    /**
+     * 缺省字符集
+     */
+    public static final String DEFAULT_ENCODE = "UTF-8";
+    /**
+     * 以下为接口返回公共属性定义常量
+     */
+    public static final String MSG_SUCCESS = "操作成功";	//操作成功
+    public static final String MSG_FALURE = "操作失败";	//操作失败
+    
+    public static final long INVALIDATE_VALUE = -1;		//起止时间定义
+    public static final int RET_SUCCESS = 0; 			//成功
+	public static final int RET_FAIL = 1; 				//失败
+	public static final int RET_ERROR_PARAM = -1; 		//参数校验失败
+	public static final int RET_NO_TOKEN = -2; 	//用户token丢失
+}

+ 176 - 32
src/main/java/com/diagbot/util/CoreUtil.java

@@ -2,6 +2,7 @@ package com.diagbot.util;
 
 import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
+import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.model.entity.BodyPart;
@@ -11,6 +12,7 @@ import com.diagbot.model.entity.PD;
 import com.diagbot.model.entity.Usual;
 import com.diagbot.model.entity.Vital;
 import com.diagbot.model.label.VitalLabel;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
@@ -19,6 +21,8 @@ import org.springframework.stereotype.Component;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -158,16 +162,13 @@ public class CoreUtil {
      * @return : 父类中的属性值
      */
     public static Object getFieldValue(Object object, String fieldName) {
-        //根据 对象和属性名通过反射 调用上面的方法获取 Field对象
-        Field field = getDeclaredField(object, fieldName);
-
-        //抑制Java对其的检查
-        field.setAccessible(true);
-
         try {
+            //根据 对象和属性名通过反射 调用上面的方法获取 Field对象
+            Field field = getDeclaredField(object, fieldName);
+            //抑制Java对其的检查
+            field.setAccessible(true);
             //获取 object 中 field 所代表的属性值
             return field.get(object);
-
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -329,9 +330,17 @@ public class CoreUtil {
                 flag = compareNum(ruleBaseDTO, value);
                 if (flag) {
                     if (StringUtil.isNotBlank(lis.getName()) && lis.getName().equals(lis.getDetailName())) {
-                        map.put("msg", lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                        if (StringUtil.isNotBlank(lis.getResult())) {
+                            map.put("msg", lis.getDetailName() + lis.getResult());
+                        } else {
+                            map.put("msg", lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                        }
                     } else {
-                        map.put("msg", lis.getName() + lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                        if (StringUtil.isNotBlank(lis.getResult())) {
+                            map.put("msg", lis.getName() + lis.getDetailName() + lis.getResult());
+                        } else {
+                            map.put("msg", lis.getName() + lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
+                        }
                     }
                 }
             }
@@ -906,30 +915,165 @@ public class CoreUtil {
         return map;
     }
 
+    /**
+     * 将字符串以“,”分隔,添加到list列表中
+     * @param list
+     * @param s
+     */
+    public static void addSplitString(List<Long> list, String s) {
+        if (StringUtil.isBlank(s)) {
+            return ;
+        }
+        list.addAll(Arrays.stream(s.split(",")).map(r -> Long.parseLong(r)).collect(Collectors.toList()));
+    }
+
+    /**
+     * 在源列表中移除过滤的内容
+     *
+     * @param orginList
+     * @param splitList
+     */
+    public static void removeRepeat(List<String> orginList, List<String> splitList) {
+        if (ListUtil.isEmpty(orginList) || ListUtil.isEmpty(splitList)) {
+            return ;
+        }
+        Iterator<String> iterator = orginList.iterator();
+        while (iterator.hasNext()) {
+            String key = iterator.next();
+            if (splitList.contains(key)) {
+                iterator.remove();
+            }
+        }
+    }
+
+    /**
+     * 根据属性名获取内容
+     *
+     * @param tList
+     * @param propertyName
+     * @return
+     */
+    public static <T> List<String> getByPropertyName(List<T> tList, String... propertyName) {
+        List<String> list = Lists.newArrayList();
+        if (ListUtil.isEmpty(tList)) {
+            return list;
+        }
+        for (T t : tList) {
+            for (String key : propertyName) {
+                String name = (String)getFieldValue(t, key);
+                // 去重
+                if (StringUtil.isNotBlank(name) && !list.contains(name)) {
+                    list.add(name);
+                }
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 去除重复元素
+     *
+     * @param list
+     */
+    public static <T> List<T> removeRepeat(List<T> list) {
+        if (ListUtil.isNotEmpty(list) && list.size() > 1) {
+            list = list.stream().distinct().collect(Collectors.toList());
+        }
+        return list;
+    }
+
+    /**
+     * 根据属性去除重复元素
+     *
+     * @param source
+     * @param property
+     * @param <T>
+     */
+    public static <T> void removeByRepeatProperty(List<T> source, String property) {
+        if (ListUtil.isEmpty(source)) {
+            return ;
+        }
+        List<Object> list = Lists.newArrayList();
+        Iterator<T> iterator = source.iterator();
+        T t = null;
+        Object object = null;
+        while(iterator.hasNext()) {
+            t = iterator.next();
+            object = getFieldValue(t, property);
+            if (list.contains(object)) {
+                iterator.remove();
+            } else {
+                list.add(object);
+            }
+        }
+    }
+
+    /**
+     * 获取指定属性且过滤属性的名称列表,例如:获取对象negative不为null的uniqueName字段值
+     *
+     * @param input
+     * @param propertyName
+     * @param filterProperty
+     * @param <T>
+     * @return
+     */
+    public static <T> List<String> getPropertyWithFilter(List<T> input, String propertyName, String filterProperty) {
+        List<String> res = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(input)) {
+            for (T d : input) {
+                Negative val = (Negative) CoreUtil.getFieldValue(d, filterProperty);
+                if (val != null) {
+                    String name = (String) CoreUtil.getFieldValue(d, propertyName);
+                    if (StringUtil.isNotBlank(name)) {
+                        res.add(name);
+                    }
+                }
+            }
+        }
+        return res;
+    }
 
     public static void main(String[] args) {
-        List<Item> list = new ArrayList<>();
-        Item item = new Item();
-        item.setUniqueName("test1");
-        item.setName("test");
-        list.add(item);
-
-        Item item2 = new Item();
-        item2.setUniqueName("test2");
-        item2.setName("test");
-        list.add(item2);
-
-        Item item3 = new Item();
-        item3.setUniqueName("test1");
-        item3.setName("test");
-        list.add(item3);
-
-        Item item4 = new Item();
-        item4.setUniqueName("test2");
-        item4.setName("test");
-        list.add(item4);
-        Map<String, List<Item>> map = makeEntityListMap(list, "name", "uniqueName");
-
-        System.out.println(map);
+        List<PushBaseDTO> pushBaseDTOList = ListUtil.newArrayList();
+        PushBaseDTO pushBaseDTO = new PushBaseDTO();
+        pushBaseDTO.setName("a1");
+        pushBaseDTOList.add(pushBaseDTO);
+
+        PushBaseDTO pushBaseDTO1 = new PushBaseDTO();
+        pushBaseDTO1.setName("a1");
+        pushBaseDTOList.add(pushBaseDTO1);
+
+        removeByRepeatProperty(pushBaseDTOList, "name");
+        System.out.println(pushBaseDTOList);
+
+        // List<String> list = Lists.newArrayList("a","b","a");
+        // list = removeRepeat(list);
+        // System.out.println(list);
+        // System.out.println(pushBaseDTOList);
+
+
+        // List<Item> list = new ArrayList<>();
+        // Item item = new Item();
+        // item.setUniqueName("test1");
+        // item.setName("test");
+        // list.add(item);
+        //
+        // Item item2 = new Item();
+        // item2.setUniqueName("test2");
+        // item2.setName("test");
+        // list.add(item2);
+        //
+        // Item item3 = new Item();
+        // item3.setUniqueName("test1");
+        // item3.setName("test");
+        // list.add(item3);
+        //
+        // Item item4 = new Item();
+        // item4.setUniqueName("test2");
+        // item4.setName("test");
+        // list.add(item4);
+        // Map<String, List<Item>> map = makeEntityListMap(list, "name", "uniqueName");
+        //
+        // System.out.println(map);
     }
 }

+ 0 - 46
src/main/java/com/diagbot/util/GenericNode.java

@@ -1,46 +0,0 @@
-package com.diagbot.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class GenericNode<T> {
-
-    public List<Map<String, Object>> fillNodeTree(List<?> nodelist) {
-        List<Map<String, Object>> baseNodes = new ArrayList<>();
-        Map<String, Object> node;
-
-        for (Object nd : nodelist) {
-            node = BeanMapUtils.beanToMap(nd);
-
-            baseNodes.add(node);
-        }
-
-        return baseNodes;
-    }
-
-
-    public static List<Map<String, Object>> removeRelation(List<Map<String, Object>> nodes) {
-        List<String> rmkeys = new ArrayList<>();
-        try {
-            for (String key : nodes.get(0).keySet()) {
-                if (nodes.get(0).get(key) instanceof Set) {
-                    rmkeys.add(key);
-                }
-            }
-
-            for (Map<String, Object> node : nodes) {
-                for (String key : rmkeys) {
-                    node.remove(key);
-                }
-            }
-        }
-        catch (Exception ex) {
-            ex.printStackTrace();
-        }
-        finally {
-            return nodes;
-        }
-    }
-}

+ 7 - 7
src/main/java/com/diagbot/util/ParamUtil.java

@@ -30,33 +30,33 @@ public class ParamUtil {
                 switch (otherValue) {
                     case "阳性":
                     case "阴性":
-                        lis.setResult(otherValue);
+                        lis.setOtherValue(otherValue);
                         break;
                     case "+":
                     case "++":
                     case "+++":
                     case "++++":
-                        lis.setResult("阳性");
+                        lis.setOtherValue("阳性");
                         break;
                     case "-":
                     case "--":
                     case "---":
                     case "----":
-                        lis.setResult("阴性");
+                        lis.setOtherValue("阴性");
                         break;
                     default: // 其他类型
-                        lis.setResult(otherValue);
+                        lis.setOtherValue(otherValue);
                         break;
                 }
             } else if (value != null) {
                 Double max = lis.getMaxValue();
                 Double min = lis.getMinValue();
                 if (max != null && max < value) {
-                    lis.setResult("升高");
+                    lis.setOtherValue("升高");
                 } else if (min != null && value < min) {
-                    lis.setResult("降低");
+                    lis.setOtherValue("降低");
                 } else {
-                    lis.setResult("正常");
+                    lis.setOtherValue("正常");
                 }
             }
         }

+ 0 - 88
src/main/java/com/diagbot/util/QCCatalogue.java

@@ -1,88 +0,0 @@
-package com.diagbot.util;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * @ClassName : QCCatalogue
- * @Description : 质控条目解析
- * @Author : 楼辉荣
- * @Date: 2020-03-04 11:24
- */
-@Slf4j
-public class QCCatalogue {
-
-    protected ThreadLocal<String> status = new ThreadLocal<String>();
-    protected ThreadLocal<String> info = new ThreadLocal<String>();
-
-    /*public void execute(InputInfo inputInfo, OutputInfo outputInfo) {
-//        long t1 = System.currentTimeMillis();
-        if (outputInfo.getResult().get(className) != null) {
-            return;
-        }
-        if (!precondExecute(inputInfo, outputInfo)) {
-            variablePreset("-2", "");
-            return;
-        }
-        try {
-            variablePreset("-1", "");
-            start(inputInfo, outputInfo);
-        } catch (Exception e) {
-            variablePreset("-1", "");
-            log.error(e.getMessage() + "......类名:" + this.className);
-        }
-//        long t2 = System.currentTimeMillis();
-//        log.error(inputInfo.getMedicalRecordInfoDoc().getStructureMap().get("behospitalCode") + "-----" + className + "(规则)  耗时:" + (t2 - t1));
-        insertOpt(outputInfo);
-    }
-
-    private void insertOpt(OutputInfo outputInfo) {
-        Map<String, String> resultDetail = Maps.newHashMap();
-        resultDetail.put("info", info.get());
-        resultDetail.put("status", status.get());
-        outputInfo.getResult().put(className, resultDetail);
-        status.remove();
-        info.remove();
-    }
-
-    private void variablePreset(String arg0, String arg1) {
-        status.set(arg0);
-        info.set(arg1);
-    }
-
-    //前置条件运行 true通过,false不通过
-    private boolean precondExecute(InputInfo inputInfo, OutputInfo outputInfo) {
-        Map<String, String> catalogueMap = inputInfo.getInputCatalogueMap().get(className);
-        if (catalogueMap == null) {
-            return true;
-        }
-        String precond = catalogueMap.get("precond");
-        if (StringUtil.isBlank(precond)) {
-            return true;
-        }
-        boolean flag = true;
-        String[] codes = precond.split(",");
-        for (String code : codes) {
-            QCCatalogue qCCatalogue = CatalogueUtil.qcCatalogueMap.get(code);
-            if (qCCatalogue != null) {
-                qCCatalogue.execute(inputInfo, outputInfo);
-            }
-        }
-        for (String code : codes) {
-            if (!outputInfo.getResult().get(code).get("status").equals("0")) {
-                flag = false;
-                break;
-            }
-        }
-        return flag;
-    }
-
-    private String className = this.getClass().getSimpleName();
-
-    public QCCatalogue() {
-        CatalogueUtil.qcCatalogueMap.put(className, this);
-    }
-
-    protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
-    }*/
-
-}

+ 54 - 30
src/main/java/com/diagbot/util/RedisUtil.java

@@ -2,6 +2,7 @@ package com.diagbot.util;
 
 import com.diagbot.enums.RedisEnum;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.dao.DataAccessException;
@@ -30,26 +31,6 @@ public class RedisUtil {
     @Qualifier("redisTemplateForSimilar")
     RedisTemplate redisTemplate;
 
-    /**
-     * 更新指定类型下的数据
-     *
-     * @param map
-     * @param type
-     */
-    public void updateValue(Map<String, String> map, String type) {
-        redisTemplate.opsForValue().set(type, map);
-    }
-
-    /**
-     * 更新指定类型下的数据
-     *
-     * @param key
-     * @param list
-     */
-    public void updateValue(String key, List<String> list) {
-        redisTemplate.opsForValue().set(key, list);
-    }
-
     /**
      * 更新指定的数据
      *
@@ -82,6 +63,36 @@ public class RedisUtil {
         return (T) redisTemplate.opsForValue().get(key);
     }
 
+    /**
+     * 根据指定key设置obj
+     *
+     * @param key
+     * @param obj
+     */
+    public void set(String key, Object obj) {
+        redisTemplate.opsForValue().set(key, obj);
+    }
+
+    /**
+     * 批量获取
+     *
+     * @param keys
+     * @return
+     */
+    public <T> List<T> multiGet(Collection<String> keys) {
+        return redisTemplate.opsForValue().multiGet(keys);
+    }
+
+    /**
+     * 批量设置
+     *
+     * @param map
+     * @return
+     */
+    public void multiSet(Map<String, Object> map) {
+        redisTemplate.opsForValue().multiSet(map);
+    }
+
     /**
      * 根据正则key获取value列表
      *
@@ -263,16 +274,6 @@ public class RedisUtil {
         redisTemplate.opsForValue().set(key, value);
     }
 
-    /**
-     * 批量获取
-     *
-     * @param keys
-     * @return
-     */
-    public <T> List<T> multiGet(Collection<String> keys) {
-        return redisTemplate.opsForValue().multiGet(keys);
-    }
-
     /**
      * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
      *
@@ -296,4 +297,27 @@ public class RedisUtil {
     public boolean setIfAbsent(String key, String value) {
         return redisTemplate.opsForValue().setIfAbsent(key, value);
     }
+
+    /**
+     * map集合的形式添加键值对
+     *
+     * @param key
+     * @param map
+     */
+    public void putHashMap(String key, Map<String, Object> map) {
+        if (MapUtils.isNotEmpty(map)) {
+            redisTemplate.opsForHash().putAll(key, map);
+        }
+    }
+
+    /**
+     * 获取集合中指定field的内容
+     * @param key
+     * @param field
+     * @param <T>
+     * @return
+     */
+    public <T> T getByKeyAndField(String key, String field) {
+        return (T)redisTemplate.opsForHash().get(key, field);
+    }
 }

+ 28 - 0
src/main/java/com/diagbot/vo/DiagnoseVO.java

@@ -0,0 +1,28 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/3/15 11:21
+ */
+@Getter
+@Setter
+public class DiagnoseVO {
+    /**
+     * 符合的Id列表
+     */
+    private List<Long> ids;
+    /**
+     * 性别:1:男, 2:女, 3:通用
+     */
+    private Integer sexType;
+    /**
+     * 年龄
+     */
+    private Double age;
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-29 11:05
+ */
+@Setter
+@Getter
+public class DiagnosesFindVO {
+    @ApiModelProperty(value="名称")
+    @NotBlank(message = "请输入搜索名称")
+    private String diseaseName;
+}

+ 19 - 0
src/main/java/com/diagbot/vo/KlDiagnoseByIdVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 15:27
+ */
+@Setter
+@Getter
+public class KlDiagnoseByIdVO {
+
+    @NotNull(message = "请输入id")
+    private Long id;
+}

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

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 17:03
+ */
+@Setter
+@Getter
+public class KlDiagnoseClearVO {
+    @NotNull(message = "请输id")
+    private Long id;
+}

+ 63 - 0
src/main/java/com/diagbot/vo/KlDiagnoseDetailVO.java

@@ -0,0 +1,63 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-23 9:45
+ */
+@Setter
+@Getter
+public class KlDiagnoseDetailVO {
+    /**
+     * 描述
+     */
+    private String basDescription;
+    private Long basConceptId;
+    private String basLibName;
+    private Integer basLibType;
+    private String basLename;
+    /**
+     * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
+     */
+    private Integer basType;
+    /**
+     * 最小域比较符
+     */
+    private String minOperator;
+    /**
+     * 最小域值
+     */
+    private String minVal;
+
+    /**
+     * 最小域单位
+     */
+    private String minUnit;
+    /**
+     * 最大域比较符
+     */
+    private String maxOperator;
+    /**
+     * 最大域值
+     */
+    private String maxVal;
+    /**
+     * 最大域单位
+     */
+    private String maxUnit;
+    /**
+     * 等于域比较符
+     */
+    private String eqOperator;
+    /**
+     * 等于域值
+     */
+    private String eqValue;
+    /**
+     * 等于域单位
+     */
+    private String eqUnit;
+}

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

@@ -0,0 +1,33 @@
+package com.diagbot.vo;
+
+import com.diagbot.dto.KlDiagnoseByIdDTO;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-23 9:43
+ */
+@Setter
+@Getter
+public class KlDiagnoseGroupVO {
+    /**
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+    /**
+     * 满足的条件
+     */
+    private Integer fitNo;
+    /**
+     * 上一级的组别
+     */
+    private Integer conditionGroup;
+    /**
+     * 组别里的明细
+     */
+    List<KlDiagnoseDetailVO> klDiagnoseDetail;
+}

+ 26 - 0
src/main/java/com/diagbot/vo/KlDiagnoseInfoVO.java

@@ -0,0 +1,26 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 15:25
+ */
+@Setter
+@Getter
+public class KlDiagnoseInfoVO extends Page {
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
+    private String conceptName;
+}

+ 19 - 0
src/main/java/com/diagbot/vo/KlDiagnoseSatarDisVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 17:02
+ */
+@Setter
+@Getter
+public class KlDiagnoseSatarDisVO {
+    @NotNull(message = "请输id")
+    private Long id;
+    private String modifier;
+}

+ 31 - 0
src/main/java/com/diagbot/vo/KlDiagnoseSaveVO.java

@@ -0,0 +1,31 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-22 17:10
+ */
+@Setter
+@Getter
+public class KlDiagnoseSaveVO {
+    private Long id;
+    /**
+     * 疾病概念id
+     */
+    private Long conceptId;
+    /**
+     * 描述
+     */
+    private String description;
+
+    private String modifier;
+
+    List<KlDiagnoseTypeVO> klDiagnoseTypeVO;
+
+
+}

+ 29 - 0
src/main/java/com/diagbot/vo/KlDiagnoseTypeVO.java

@@ -0,0 +1,29 @@
+package com.diagbot.vo;
+
+import com.diagbot.dto.KlDiagnoseGroupDTO;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-23 9:41
+ */
+@Setter
+@Getter
+public class KlDiagnoseTypeVO {
+
+    /**
+     * 条件类型名
+     */
+    private String conditionTypeName;
+    /**
+     * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
+     */
+    private Integer conditionType;
+
+    List<KlDiagnoseGroupVO> groupVO;
+
+}

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

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+/**
+ * @Description:基础推理入参
+ * @Author:zhoutg
+ * @time: 2020/7/29 15:34
+ */
+@Data
+public class PushNewVO {
+    private String hospitalType = "0"; // 医院类型, 0:全科,1:妇幼,2:精神
+    private Double age; // 年龄
+    private Integer sex; // 性别
+    private String chief; // 主诉
+    private String present; // 现病史
+    private Integer num = 10; // 疾病个数
+}

+ 19 - 0
src/main/java/com/diagbot/vo/ReverseVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:基础推理入参
+ * @Author:zhoutg
+ * @time: 2020/7/29 15:34
+ */
+@Data
+public class ReverseVO {
+    private String libName; // 标准词名称
+    private Integer libType; // 标准词类型
+    private List<Integer> relationType; // 关联类型
+    private Integer sexType;
+    private Double age;
+}

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

@@ -0,0 +1,14 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 16:53
+ */
+@Data
+public class TestCrfVO {
+    private String modelType;
+    private String content;
+}

+ 40 - 1
src/main/java/com/diagbot/web/CacheController.java

@@ -37,6 +37,7 @@ public class CacheController {
         cacheFacade.getDiseaseCorrespondCache();
         cacheFacade.getdiseaseFilterCache();
         cacheFacade.loadAllRuleCache();
+        cacheFacade.loadAllBaseDiagnoseCache();
         //无用的缓存
 //        cacheFacade.loadDiseaseTypeCache();
 //        cacheFacade.getSymptomCache();
@@ -47,6 +48,15 @@ public class CacheController {
         return RespDTO.onSuc(true);
     }
 
+    @ApiOperation(value = "重新加载基础诊断依据[by:zhoutg]",
+            notes = "")
+    @PostMapping("/reloadDiagnose")
+    @SysLogger("reloadDiagnose")
+    public RespDTO<Boolean> reloadDiagnose() {
+        cacheFacade.loadAllBaseDiagnoseCache();
+        return RespDTO.onSuc(true);
+    }
+
     @ApiOperation(value = "重新加载药物缓存[by:zhoutg]",
             notes = "")
     @PostMapping("/clearDrug")
@@ -74,7 +84,20 @@ public class CacheController {
         return RespDTO.onSuc(true);
     }
 
-    @ApiOperation(value = "重新加载标准词及规则、药物缓存[by:wangfeng]",
+    @ApiOperation(value = "重新加载大数据缓存[by:zhoutg]",
+            notes = "")
+    @PostMapping("/reloadPushDB")
+    @SysLogger("reloadPushDB")
+    public RespDTO<Boolean> reloadPushDB() {
+        boolean flag = cacheFacade.reloadPushDB();
+        if (flag) {
+            return RespDTO.onSuc(flag);
+        } else {
+            return RespDTO.onError("加载大数据缓存失败");
+        }
+    }
+
+    @ApiOperation(value = "重新加载标准词及规则、药物缓存、基础诊断依据[by:wangfeng]",
             notes = "")
     @PostMapping("/clearStandRuleDrug")
     @SysLogger("clearStandRuleDrug")
@@ -82,6 +105,22 @@ public class CacheController {
         cacheFacade.clearStandConvert();
         cacheFacade.loadAllRuleCache();
         cacheFacade.loadDrugTypeCache();
+        cacheFacade.loadAllBaseDiagnoseCache();
+        // 加载大数据缓存
+        boolean flag = cacheFacade.reloadPushDB();
+        if (flag) {
+            return RespDTO.onSuc(flag);
+        } else {
+            return RespDTO.onError("加载知识库缓存成功,加载大数据缓存失败");
+        }
+    }
+
+    @ApiOperation(value = "加载大数据推送类型【字段:push_mode】和推送版本【字段:remark】[by:zhoutg]",
+            notes = "表:tran_hospital_info,【remark】字段:old表示使用原5.0推理,其他值:新版推理")
+    @PostMapping("/loadHostipalPush")
+    @SysLogger("loadHostipalPush")
+    public RespDTO<Boolean> loadHostipalPush() {
+        cacheFacade.loadHostipalPush();
         return RespDTO.onSuc(true);
     }
 }

+ 2 - 3
src/main/java/com/diagbot/web/CoreController.java

@@ -45,9 +45,8 @@ public class CoreController {
     @ApiOperation(value = "推送API[zhoutg]", notes = "featureType 类型(多选必填),1:症状,4:查体结果,5:检验,6:检查,7:诊断,8:药品,9:手术,10:一般治疗")
     @PostMapping("/push")
     public RespDTO<PushDTO> push(@RequestBody PushVO pushVo) {
-//        PushDTO pushDTO = pushFacade.pushFac(pushVo);
-        PushDTO pushDTO1 = pushFacade.processAggreate(pushVo);
-        return RespDTO.onSuc(pushDTO1);
+        PushDTO pushDTO = pushFacade.pushFac(pushVo);
+        return RespDTO.onSuc(pushDTO);
     }
 
     @ApiOperation(value = "推送持续检验检查计划API[zhaops]", notes = "operationName:随访手术")

+ 95 - 0
src/main/java/com/diagbot/web/KlDiagnoseController.java

@@ -0,0 +1,95 @@
+package com.diagbot.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.DiagnosesFindDTO;
+import com.diagbot.dto.GetAllForRelationDTO;
+import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.dto.KlDiagnoseTypeDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.enums.StatusEnum;
+import com.diagbot.facade.KlDiagnoseFacade;
+import com.diagbot.vo.DiagnosesFindVO;
+import com.diagbot.vo.KlDiagnoseByIdVO;
+import com.diagbot.vo.KlDiagnoseClearVO;
+import com.diagbot.vo.KlDiagnoseInfoVO;
+import com.diagbot.vo.KlDiagnoseSatarDisVO;
+import com.diagbot.vo.KlDiagnoseSaveVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-03-19 14:52
+ */
+@RestController
+@RequestMapping("/klDiagnose")
+@Api(value = "诊断依据维护相关API", tags = { "诊断依据维护相关API" })
+@SuppressWarnings("unchecked")
+public class KlDiagnoseController {
+    @Autowired
+    KlDiagnoseFacade klDiagnoseFacade;
+
+    @ApiOperation(value = "分页获取诊断依据维护列表[by:wangfeng]")
+    @PostMapping("/getKlDiagnosePage")
+    @SysLogger("getKlDiagnosePage")
+    public RespDTO<IPage<KlDiagnoseInfoDTO>> getDiagnosePages(@RequestBody KlDiagnoseInfoVO klRuleInfoVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.getKlDiagnoseInfoPage(klRuleInfoVO));
+    }
+
+    @ApiOperation(value = "根据Id获取诊断依据详情[by:wangfeng]")
+    @PostMapping("/getByIdDiagnose")
+    @SysLogger("getByIdDiagnose")
+    public RespDTO<List<KlDiagnoseTypeDTO>> getByIdDiagnoseAll(@RequestBody @Valid KlDiagnoseByIdVO klDiagnoseByIdVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.getByIdDiagnoseAll(klDiagnoseByIdVO));
+    }
+
+    @ApiOperation(value = "保存诊断依据详情[by:wangfeng]")
+    @PostMapping("/saveDiagnose")
+    @SysLogger("saveDiagnose")
+    @Transactional
+    public RespDTO<Boolean> saveDiagnoseAll(@RequestBody @Valid KlDiagnoseSaveVO klDiagnoseSaveVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.saveDiagnoseAll(klDiagnoseSaveVO));
+    }
+
+    @ApiOperation(value = "刪除诊断依据详情[by:wangfeng]")
+    @PostMapping("/clearDiagnose")
+    @SysLogger("clearDiagnose")
+    @Transactional
+    public RespDTO<Boolean> clearDiagnoseAll(@RequestBody @Valid KlDiagnoseClearVO klDiagnoseClearVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.clearDiagnoseAll(klDiagnoseClearVO));
+    }
+
+    @ApiOperation(value = "停用诊断依据[by:wangfeng]")
+    @PostMapping("/disableKlDiagnose")
+    @SysLogger("disableKlDiagnose")
+    public RespDTO<Boolean> disableDiagnoses(@RequestBody @Valid KlDiagnoseSatarDisVO klDiagnoseSatarDisVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.disableDiagnose(klDiagnoseSatarDisVO, StatusEnum.Disable.getKey()));
+    }
+
+    @ApiOperation(value = "启用诊断依据[by:wangfeng]")
+    @PostMapping("/startKlDiagnose")
+    @SysLogger("startKlDiagnose")
+    public RespDTO<Boolean> startKlDiagnoses(@RequestBody @Valid KlDiagnoseSatarDisVO klDiagnoseSatarDisVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.disableDiagnose(klDiagnoseSatarDisVO, StatusEnum.Enable.getKey()));
+    }
+
+    @ApiOperation(value = "搜索未添加的诊断依据术语名[by:wangfeng]",
+            notes = "diseaseName:疾病医学术语名称 <br>")
+    @PostMapping("/findDiaName")
+    @SysLogger("findDiaName")
+    public RespDTO<List<DiagnosesFindDTO>> findDiaNames(@Valid @RequestBody DiagnosesFindVO diagnosesFindVO) {
+        List<DiagnosesFindDTO> klConcepts = klDiagnoseFacade.findDiaNameAlls(diagnosesFindVO);
+        return RespDTO.onSuc(klConcepts);
+    }
+}

+ 11 - 1
src/main/java/com/diagbot/web/KlRegularConfigController.java

@@ -1,8 +1,11 @@
 package com.diagbot.web;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.RegularValueDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.KlRegularConfig;
+import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.facade.KlRegularConfigFacade;
 import com.diagbot.vo.RegularConfigDataVO;
 import com.diagbot.vo.RegularConfigSaveVO;
@@ -35,11 +38,18 @@ public class KlRegularConfigController {
     @Autowired
     KlRegularConfigFacade klRegularConfigFacade;
 
+
     @ApiOperation(value = "从文本中取出化验相应正则数据",
             notes = "从文本中取出化验相应正则数据")
     @PostMapping("/getRegularConfigData")
     public RespDTO<List<RegularValueDTO>> getRegularConfigData(@Valid @RequestBody RegularConfigDataVO regularConfigDataVO) {
-        List<RegularValueDTO> data = klRegularConfigFacade.getRegularConfigDatas(regularConfigDataVO);
+        // 现病史化验和过敏史
+        QueryWrapper<KlRegularConfig> regularQuery = new QueryWrapper<>();
+        regularQuery.eq("is_deleted", IsDeleteEnum.N.getKey())
+        .eq(regularConfigDataVO.getRulesCode() != null, "rules_code", regularConfigDataVO.getRulesCode())
+                .eq(regularConfigDataVO.getRulesTepy() != null, "rules_tepy", regularConfigDataVO.getRulesTepy());
+        List<KlRegularConfig> regularConfigs = klRegularConfigFacade.list(regularQuery);
+        List<RegularValueDTO> data = klRegularConfigFacade.getRegularConfigDatas(regularConfigDataVO.getText(), regularConfigs);
         return RespDTO.onSuc(data);
     }
 

+ 31 - 7
src/main/java/com/diagbot/web/TestController.java

@@ -1,11 +1,18 @@
 package com.diagbot.web;
 
+import com.diagbot.dto.DiagnoseDTO;
+import com.diagbot.dto.PushNewDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StandConvertCrfBatchDTO;
 import com.diagbot.dto.StandConvertCrfDTO;
+import com.diagbot.facade.KlDiagnoseFacade;
+import com.diagbot.facade.PushFacade;
 import com.diagbot.facade.TestFacade;
+import com.diagbot.vo.DiagnoseVO;
+import com.diagbot.vo.PushNewVO;
 import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.TestAllVO;
+import com.diagbot.vo.TestCrfVO;
 import com.diagbot.vo.TestLineVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -34,6 +41,10 @@ public class TestController {
 
     @Autowired
     private TestFacade testFacade;
+    @Autowired
+    private KlDiagnoseFacade klDiagnoseFacade;
+    @Autowired
+    PushFacade pushFacade;
 
     @ApiOperation(value = "开单合理性测试API[zhoutg]",
             notes = "idNum:指定行测试<br>" +
@@ -120,12 +131,6 @@ public class TestController {
         return RespDTO.onSuc(testFacade.testStandConvert(standConvertCrfVO));
     }
 
-    @ApiOperation(value = "标准词转换API【新版】[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital")
-    @PostMapping("/testStandConvertNew")
-    public RespDTO<StandConvertCrfDTO> testStandConvertNew(@RequestBody StandConvertCrfVO standConvertCrfVO) {
-        return RespDTO.onSuc(testFacade.testStandConvertNew(standConvertCrfVO));
-    }
-
     @ApiOperation(value = "标准词批量转换API[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital")
     @PostMapping("/testStandConvertBatch")
     public RespDTO<StandConvertCrfBatchDTO> testStandConvertBatch(@RequestBody List<StandConvertCrfVO> standConvertCrfVOList) {
@@ -135,7 +140,7 @@ public class TestController {
     @ApiOperation(value = "标准词批量转换【新版】API[zhoutg]", notes = "类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital")
     @PostMapping("/testStandConvertBatchNew")
     public RespDTO<StandConvertCrfBatchDTO> testStandConvertBatchNew(@RequestBody List<StandConvertCrfVO> standConvertCrfVOList) {
-        return RespDTO.onSuc(testFacade.testStandConvertBatch(standConvertCrfVOList));
+        return RespDTO.onSuc(testFacade.testStandConvertBatchNew(standConvertCrfVOList));
     }
 
     @ApiOperation(value = "复杂高危手术测试API[zhoutg]",
@@ -165,5 +170,24 @@ public class TestController {
     public RespDTO<List<Map<String, Object>>> importBill(@RequestParam("file") MultipartFile file, TestLineVO testLineVO) {
         return RespDTO.onSuc(testFacade.importBill(file, testLineVO));
     }
+
+    @ApiOperation(value = "获取确诊、拟诊、警惕的疾病[gaodm]", notes = "")
+    @PostMapping("/getDiagnoseByIds")
+    public RespDTO<List<DiagnoseDTO>> getDiagnoseByIds(@RequestBody DiagnoseVO diagnoseVO) {
+        return RespDTO.onSuc(klDiagnoseFacade.getDiagnoseByIds(diagnoseVO));
+    }
+
+    @ApiOperation(value = "大数据推送接口测试[zhoutg]", notes = "")
+    @PostMapping("/testPush")
+    public RespDTO<PushNewDTO> testPush(@RequestBody PushNewVO pushNewVO) {
+        return RespDTO.onSuc(pushFacade.testPushFac(pushNewVO));
+    }
+
+    @ApiOperation(value = "crf解析测试[zhoutg]", notes = "content:文本内容\n" +
+            "modelType:模型类型,主诉、现病史:chief_present,既往史:PastFamily_cx,查体:Present_cx,个人史:PersonalHistory_cx,诊断:Diagnoses_cx")
+    @PostMapping("/testCrf")
+    public RespDTO<Object> testCrf(@RequestBody TestCrfVO testCrfVO) {
+        return RespDTO.onSuc(testFacade.testCrf(testCrfVO));
+    }
 }
 

+ 7 - 6
src/main/resources/application-dev.yml

@@ -56,11 +56,11 @@ spring:
         testOnBorrow: false
         testOnReturn: false
         # 打开PSCache,并且指定每个连接上PSCache的大小
-        poolPreparedStatements: true
+        poolPreparedStatements: false
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
         filters.commons-log.connection-logger-name: wall,log4j
-        share-prepared-statements: true
+        share-prepared-statements: false
         filter:
           stat:
             enabled: true
@@ -163,18 +163,19 @@ swagger:
 CRF:
   url: http://192.168.2.234:3456
 
-ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456
-
 StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:9205
+  url: http://192.168.3.150:7000
   rate: 0.9
 
 IcssPush:
   url: http://192.168.2.234:5008
 
+# 新版推送
+PushNew:
+  url: http://192.168.2.234:9210
+
 debugFlag: true

+ 6 - 9
src/main/resources/application-local.yml

@@ -56,11 +56,11 @@ spring:
         testOnBorrow: false
         testOnReturn: false
         # 打开PSCache,并且指定每个连接上PSCache的大小
-        poolPreparedStatements: true
+        poolPreparedStatements: false
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
         filters.commons-log.connection-logger-name: wall,log4j
-        share-prepared-statements: true
+        share-prepared-statements: false
         filter:
           stat:
             enabled: true
@@ -163,22 +163,19 @@ swagger:
 CRF:
   url: http://192.168.2.234:3456
 
-ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456
-
 StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:9205
+  url: http://192.168.3.150:7000
   rate: 0.9
 
 IcssPush:
   url: http://192.168.2.234:5008
 
-Similarity:
-  url: http://192.168.2.234:12480
-
+# 新版推送
+PushNew:
+  url: http://192.168.2.234:9210
 
 debugFlag: true

+ 46 - 45
src/main/resources/application-pre.yml

@@ -39,49 +39,49 @@ spring:
   datasource:
     dynamic:
       primary: med
-      # 数据库配置
-      datasource:
-        druid:
-          # 连接池的配置信息
-          # 初始化大小,最小,最大
-          initialSize: 5
-          minIdle: 5
-          maxActive: 20
-          # 配置获取连接等待超时的时间
-          maxWait: 60000
-          # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-          timeBetweenEvictionRunsMillis: 60000
-          # 配置一个连接在池中最小生存的时间,单位是毫秒
-          minEvictableIdleTimeMillis: 300000
-          validationQuery: SELECT 1 FROM DUAL
-          testWhileIdle: true
-          testOnBorrow: false
-          testOnReturn: false
-          # 打开PSCache,并且指定每个连接上PSCache的大小
-          poolPreparedStatements: true
-          maxPoolPreparedStatementPerConnectionSize: 20
-          # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
-          filters.commons-log.connection-logger-name: wall,log4j
-          share-prepared-statements: true
-          filter:
-            stat:
-              enabled: true
-              mergeSql: true
-              log-slow-sql: true
-              slow-sql-millis: 2000
-          #监控配置
-          web-stat-filter:
+      druid:
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        initialSize: 5
+        minIdle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: false
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters.commons-log.connection-logger-name: wall,log4j
+        share-prepared-statements: false
+        filter:
+          stat:
             enabled: true
-            url-pattern: /*
-            exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+            mergeSql: true
+            log-slow-sql: true
+            slow-sql-millis: 2000
+        #监控配置
+        web-stat-filter:
+          enabled: true
+          url-pattern: /*
+          exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
 
-          # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
-          stat-view-servlet:
-            enabled: true
-            url-pattern: /druid/*
-            reset-enable: false
-            login-username: root
-            login-password: root
+        # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+        stat-view-servlet:
+          enabled: true
+          url-pattern: /druid/*
+          reset-enable: false
+          login-username: root
+          login-password: root
+      # 数据库配置
+      datasource:
         cdss:
           driver-class-name: com.mysql.cj.jdbc.Driver
           platform: mysql
@@ -163,18 +163,19 @@ swagger:
 CRF:
   url: http://192.168.2.234:3456
 
-ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456
-
 StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:9205
+  url: http://192.168.3.150:7000
   rate: 0.9
 
 IcssPush:
   url: http://192.168.2.186:5008
 
+# 新版推送
+PushNew:
+  url: http://192.168.2.234:9210
+
 debugFlag: true

+ 7 - 6
src/main/resources/application-pro.yml

@@ -56,11 +56,11 @@ spring:
         testOnBorrow: false
         testOnReturn: false
         # 打开PSCache,并且指定每个连接上PSCache的大小
-        poolPreparedStatements: true
+        poolPreparedStatements: false
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
         filters.commons-log.connection-logger-name: wall,log4j
-        share-prepared-statements: true
+        share-prepared-statements: false
         filter:
           stat:
             enabled: true
@@ -163,18 +163,19 @@ swagger:
 CRF:
   url: http://192.168.2.234:3456
 
-ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456
-
 StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:9205
+  url: http://192.168.3.150:7000
   rate: 0.9
 
 IcssPush:
   url: http://192.168.2.123:5008
 
+# 新版推送
+PushNew:
+  url: http://192.168.2.234:9210
+
 debugFlag: true

+ 7 - 6
src/main/resources/application-test.yml

@@ -56,11 +56,11 @@ spring:
         testOnBorrow: false
         testOnReturn: false
         # 打开PSCache,并且指定每个连接上PSCache的大小
-        poolPreparedStatements: true
+        poolPreparedStatements: false
         maxPoolPreparedStatementPerConnectionSize: 20
         # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
         filters.commons-log.connection-logger-name: wall,log4j
-        share-prepared-statements: true
+        share-prepared-statements: false
         filter:
           stat:
             enabled: true
@@ -163,18 +163,19 @@ swagger:
 CRF:
   url: http://192.168.2.234:3456
 
-ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456
-
 StandConvert:
   url: http://192.168.2.234:23232
   rate: 0.9
 
 StandConvertNew:
-  url: http://192.168.3.150:9205
+  url: http://192.168.3.150:7000
   rate: 0.9
 
 IcssPush:
   url: http://192.168.2.241:5008
 
+# 新版推送:9210是241环境,9211其他环境
+PushNew:
+  url: http://192.168.2.234:9211
+
 debugFlag: true

+ 66 - 10
src/main/resources/mapper/ConceptInfoMapper.xml

@@ -4,16 +4,72 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.diagbot.entity.ConceptInfo">
-        <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="name" property="name" />
-        <result column="type" property="type" />
-        <result column="clinical_pathway_name" property="clinicalPathwayName" />
-        <result column="notice_name" property="noticeName" />
+        <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="name" property="name"/>
+        <result column="type" property="type"/>
+        <result column="clinical_pathway_name" property="clinicalPathwayName"/>
+        <result column="notice_name" property="noticeName"/>
     </resultMap>
 
+    <select id="getReverse" resultType="com.diagbot.dto.ReverseDTO">
+        SELECT
+        t.*, e.sex_type,
+        e.min_age,
+        e.max_age
+        FROM
+        (
+        SELECT
+        a.lib_name,
+        d.id sonId,
+        d.lib_type sonType,
+        d.lib_name sonName,
+        c.order_no,
+        b.relation_id
+        FROM
+        kl_concept a,
+        kl_relation b,
+        kl_relation_order c,
+        kl_concept d
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        <if test="libName != null and libName != ''">
+            AND a.lib_name = #{libName}
+        </if>
+        <if test="libType != null and libType != ''">
+            AND a.lib_type = #{libType}
+        </if>
+        AND a.id = b.start_id
+        AND b.end_id = d.id
+        AND b.id = c.t_relation_id
+        <if test="relationType != null and relationType.size() > 0">
+            AND b.relation_id IN
+            <foreach collection="relationType" open="(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+        ) t
+        LEFT JOIN kl_concept_common e ON t.sonId = e.concept_id
+        AND e.is_deleted = 'N'
+        <where>
+            <if test="sexType != null and sexType != 3 and sexType != ''">
+                and (e.sex_type in (3, #{sexType}) or e.sex_type is null)
+            </if>
+            <if test="age != null and age != ''">
+                <![CDATA[ and ((e.min_age <= #{age} and e.max_age >= #{age})
+                          OR (e.min_age IS NULL and e.max_age IS NULL))]]>
+            </if>
+        </where>
+        ORDER BY
+        t.relation_id,
+        t.order_no
+    </select>
+
 </mapper>

+ 0 - 0
src/main/resources/mapper/KlDiagnoseBaseMapper.xml


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.