Browse Source

Merge remote-tracking branch 'origin/master' into his/nbzhongyiyuan

# Conflicts:
#	src/main/resources/application-local.yml
xuejiafu 4 years ago
parent
commit
49cdaf417b
100 changed files with 3731 additions and 977 deletions
  1. 4 0
      doc/011.20210715开单合理性重复开立/med_2021_init.sql
  2. 17 0
      doc/012.20210712静态知识增加法律法规/cdss_init.sql
  3. 31 0
      doc/012.20210712静态知识增加法律法规/med2021_init.sql
  4. 5 0
      doc/013.20210801静态知识法律法规修改成政策法规/cdss_init.sql
  5. 5 0
      doc/013.20210801静态知识法律法规修改成政策法规/med2021_init.sql
  6. 531 0
      doc/014.20210727提示规则新需求/med2021_init.sql
  7. 81 0
      doc/014.20210727提示规则新需求/temp.sql
  8. 23 0
      doc/015.20210805提示类信息规则维护支持集合分类维护/med2021_init.sql
  9. 242 0
      src/main/java/com/diagbot/aggregate/RuleAggregate.java
  10. 8 2
      src/main/java/com/diagbot/config/CacheDeleteInit.java
  11. 1 0
      src/main/java/com/diagbot/dto/AnesthesiaInfoDTO.java
  12. 1 0
      src/main/java/com/diagbot/dto/DiseaseInfoDTO.java
  13. 1 0
      src/main/java/com/diagbot/dto/DrugInfoDTO.java
  14. 2 0
      src/main/java/com/diagbot/dto/IndexBatchDTO.java
  15. 11 8
      src/main/java/com/diagbot/dto/IndicationExportDTO.java
  16. 1 0
      src/main/java/com/diagbot/dto/KlRuleByIdDTO.java
  17. 1 0
      src/main/java/com/diagbot/dto/KlRuleByIdSubDTO.java
  18. 1 0
      src/main/java/com/diagbot/dto/LisDetailDTO.java
  19. 1 0
      src/main/java/com/diagbot/dto/NurseInfoDTO.java
  20. 3 0
      src/main/java/com/diagbot/dto/OperationInfoDTO.java
  21. 18 0
      src/main/java/com/diagbot/dto/RetrievalConceptDTO.java
  22. 45 40
      src/main/java/com/diagbot/dto/RetrievalDTO.java
  23. 14 12
      src/main/java/com/diagbot/dto/RuleBaseDTO.java
  24. 15 0
      src/main/java/com/diagbot/dto/RuleBaseInitDTO.java
  25. 2 0
      src/main/java/com/diagbot/dto/RuleConditionDTO.java
  26. 18 0
      src/main/java/com/diagbot/dto/RuleConditionInitDTO.java
  27. 25 0
      src/main/java/com/diagbot/dto/RuleInitDTO.java
  28. 4 0
      src/main/java/com/diagbot/dto/RuleSimpleDTO.java
  29. 1 0
      src/main/java/com/diagbot/dto/ScaleInfoDTO.java
  30. 1 0
      src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java
  31. 1 0
      src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java
  32. 19 0
      src/main/java/com/diagbot/dto/TermConceptDTO.java
  33. 5 1
      src/main/java/com/diagbot/dto/WordCrfDTO.java
  34. 158 0
      src/main/java/com/diagbot/entity/KlOperation.java
  35. 18 4
      src/main/java/com/diagbot/entity/KlRuleCondition.java
  36. 296 0
      src/main/java/com/diagbot/entity/MappingConfig.java
  37. 49 0
      src/main/java/com/diagbot/entity/wrapper/MappingConfigWrapper.java
  38. 6 6
      src/main/java/com/diagbot/enums/ConEnum.java
  39. 78 0
      src/main/java/com/diagbot/enums/ConceptTypeEnum.java
  40. 2 1
      src/main/java/com/diagbot/enums/LexiconEnum.java
  41. 66 0
      src/main/java/com/diagbot/enums/MatchSourceEnum.java
  42. 3 1
      src/main/java/com/diagbot/enums/RedisEnum.java
  43. 56 0
      src/main/java/com/diagbot/enums/StandConvertCrfEnum.java
  44. 9 0
      src/main/java/com/diagbot/facade/BillFacade.java
  45. 30 0
      src/main/java/com/diagbot/facade/CacheFacade.java
  46. 198 109
      src/main/java/com/diagbot/facade/CommonFacade.java
  47. 312 91
      src/main/java/com/diagbot/facade/KlConceptFacade.java
  48. 15 9
      src/main/java/com/diagbot/facade/KlConceptStaticFacade.java
  49. 1 1
      src/main/java/com/diagbot/facade/KlDiagnoseDetailFacade.java
  50. 5 0
      src/main/java/com/diagbot/facade/KlLibraryInfoFacade.java
  51. 13 0
      src/main/java/com/diagbot/facade/KlOperationFacade.java
  52. 1 0
      src/main/java/com/diagbot/facade/KlRuleFacade.java
  53. 0 139
      src/main/java/com/diagbot/facade/LisConfigFacade.java
  54. 163 0
      src/main/java/com/diagbot/facade/MappingConfigFacade.java
  55. 41 18
      src/main/java/com/diagbot/facade/MedRetrievalFacade.java
  56. 19 7
      src/main/java/com/diagbot/facade/NeoFacade.java
  57. 0 57
      src/main/java/com/diagbot/facade/OperationConfigFacade.java
  58. 0 89
      src/main/java/com/diagbot/facade/PacsConfigFacade.java
  59. 190 0
      src/main/java/com/diagbot/facade/TermMatchingFacade.java
  60. 8 0
      src/main/java/com/diagbot/mapper/KlLibraryInfoMapper.java
  61. 16 0
      src/main/java/com/diagbot/mapper/KlOperationMapper.java
  62. 17 0
      src/main/java/com/diagbot/mapper/KlRuleMapper.java
  63. 0 15
      src/main/java/com/diagbot/mapper/LisConfigMapper.java
  64. 45 0
      src/main/java/com/diagbot/mapper/MappingConfigMapper.java
  65. 0 15
      src/main/java/com/diagbot/mapper/OperationConfigMapper.java
  66. 0 15
      src/main/java/com/diagbot/mapper/PacsConfigMapper.java
  67. 1 0
      src/main/java/com/diagbot/model/ai/process/EntityProcessClinic.java
  68. 1 1
      src/main/java/com/diagbot/model/ai/process/EntityProcessPacs.java
  69. 17 4
      src/main/java/com/diagbot/process/BillProcess.java
  70. 2 4
      src/main/java/com/diagbot/process/PushProcess.java
  71. 9 4
      src/main/java/com/diagbot/rule/AgeRule.java
  72. 167 81
      src/main/java/com/diagbot/rule/CommonRule.java
  73. 7 5
      src/main/java/com/diagbot/rule/DrugRule.java
  74. 63 7
      src/main/java/com/diagbot/rule/GroupRule.java
  75. 7 3
      src/main/java/com/diagbot/rule/LisRule.java
  76. 10 4
      src/main/java/com/diagbot/rule/MedEquRule.java
  77. 30 8
      src/main/java/com/diagbot/rule/PacsRule.java
  78. 10 4
      src/main/java/com/diagbot/rule/SexRule.java
  79. 9 3
      src/main/java/com/diagbot/rule/VitalRule.java
  80. 7 0
      src/main/java/com/diagbot/service/KlLibraryInfoService.java
  81. 16 0
      src/main/java/com/diagbot/service/KlOperationService.java
  82. 17 0
      src/main/java/com/diagbot/service/KlRuleService.java
  83. 0 15
      src/main/java/com/diagbot/service/LisConfigService.java
  84. 45 0
      src/main/java/com/diagbot/service/MappingConfigService.java
  85. 0 15
      src/main/java/com/diagbot/service/OperationConfigService.java
  86. 0 15
      src/main/java/com/diagbot/service/PacsConfigService.java
  87. 2 0
      src/main/java/com/diagbot/service/impl/KlConceptServiceImpl.java
  88. 14 1
      src/main/java/com/diagbot/service/impl/KlLibraryInfoServiceImpl.java
  89. 20 0
      src/main/java/com/diagbot/service/impl/KlOperationServiceImpl.java
  90. 39 0
      src/main/java/com/diagbot/service/impl/KlRuleServiceImpl.java
  91. 0 21
      src/main/java/com/diagbot/service/impl/LisConfigServiceImpl.java
  92. 60 0
      src/main/java/com/diagbot/service/impl/MappingConfigServiceImpl.java
  93. 0 21
      src/main/java/com/diagbot/service/impl/OperationConfigServiceImpl.java
  94. 0 21
      src/main/java/com/diagbot/service/impl/PacsConfigServiceImpl.java
  95. 2 35
      src/main/java/com/diagbot/util/CatalogueUtil.java
  96. 1 0
      src/main/java/com/diagbot/util/Content.java
  97. 106 17
      src/main/java/com/diagbot/util/CoreUtil.java
  98. 69 0
      src/main/java/com/diagbot/util/MsgNewUtil.java
  99. 47 48
      src/main/java/com/diagbot/util/MsgUtil.java
  100. 0 0
      src/main/java/com/diagbot/util/RegexUtil.java

+ 4 - 0
doc/011.20210715开单合理性重复开立/med_2021_init.sql

@@ -0,0 +1,4 @@
+USE `med_2021`;
+
+INSERT INTO `med_2021`.`kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('161', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '单次', '^(24小时维持|一次|1次|空)$|ALWAYS|BID|ONCE|每日', '1', '0', '开单频次');
+INSERT INTO `med_2021`.`kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('162', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '持续', '每周|每月|每年|每半年|(一|二|三)月一次|qw|biw', '1', '0', '开单频次');

+ 17 - 0
doc/012.20210712静态知识增加法律法规/cdss_init.sql

@@ -0,0 +1,17 @@
+USE `cdss`;
+
+INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('130', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '法律法规', '10', '2', '100', '静态知识检索类型');
+INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('131', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '10', '法律法规', '10', '0', '10', '静态知识类型');
+INSERT INTO `sys_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('132', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '法律法规', '法律法规', '1', '411', '页面显示词性');
+UPDATE `sys_dictionary_info` SET `return_type` = 0 WHERE `group_type` = 10 AND NAME LIKE '护理';
+-- 已经执行
+-- UPDATE `tran_plan_detail`
+-- SET number = NULL
+-- WHERE
+-- 	`name` IN (
+-- 		'开单合理性',
+-- 		'高危',
+-- 		'危急值提醒',
+-- 		'其他提醒'
+-- 	);
+

+ 31 - 0
doc/012.20210712静态知识增加法律法规/med2021_init.sql

@@ -0,0 +1,31 @@
+USE `med_2021`;
+
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('50', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '法律法规', '130', '0', '0', '0', '');
+
+
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('144', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '法律法规', '10', '2', '100', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('145', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '法律法规', '法律法规', '1', '411', '页面显示词性');
+
+-- 静态信息关联放入到数据库中
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('146', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '静态知识', '1', '1', '10', '静态知识类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('147', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '注意事项', '2', '1', '20', '静态知识类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('148', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '临床路径', '3', '1', '30', '静态知识类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('149', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '一般治疗', '4', '1', '40', '静态知识类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('150', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '1', '1,3,4', '1', '0', '诊断关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('151', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '2', '1', '1', '0', '药品关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('152', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '3', '1,2', '1', '0', '检验套餐关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('153', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '4', '1,2', '1', '0', '检验细项关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('154', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '5', '1,2', '1', '0', '检查关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('155', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '6', '1,2', '1', '0', '检查子项关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('156', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '7', '1', '1', '0', '手术和操作关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('157', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '8', '1', '1', '0', '量表关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('158', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '9', '1', '1', '0', '护理关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('159', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '10', '1', '1', '0', '法律法规关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('160', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '999', '1,2,3,4', '1', '0', '其他关联的静态信息类型');
+
+-- 已经执行
+-- UPDATE `med_2021`.`kl_rule_plan` SET `id`='73', `is_deleted`='Y', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `plan_code`='rule', `rule_type`='1', `parent_id`='10', `name`='开单项', `type`='5', `number`=NULL, `code`='', `order_no`='4', `remark`='' WHERE (`id`='73');
+-- UPDATE `med_2021`.`kl_rule_plan` SET `id`='103', `is_deleted`='Y', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `plan_code`='rule', `rule_type`='1', `parent_id`='11', `name`='开单项', `type`='5', `number`=NULL, `code`='', `order_no`='4', `remark`='' WHERE (`id`='103');
+-- UPDATE `med_2021`.`kl_rule_plan` SET `id`='403', `is_deleted`='Y', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `plan_code`='rule', `rule_type`='1', `parent_id`='14', `name`='开单项', `type`='5', `number`=NULL, `code`='', `order_no`=NULL, `remark`='' WHERE (`id`='403');
+-- UPDATE `med_2021`.`kl_rule_plan` SET `id`='503', `is_deleted`='Y', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `plan_code`='rule', `rule_type`='1', `parent_id`='15', `name`='开单项', `type`='5', `number`=NULL, `code`='', `order_no`=NULL, `remark`='' WHERE (`id`='503');
+-- DELETE FROM `kl_concept` where id = 80958;

+ 5 - 0
doc/013.20210801静态知识法律法规修改成政策法规/cdss_init.sql

@@ -0,0 +1,5 @@
+USE `cdss`;
+
+UPDATE `cdss`.`sys_dictionary_info` SET `id`='130', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='7', `name`='政策法规', `val`='10', `return_type`='2', `order_no`='100', `remark`='静态知识检索类型' WHERE (`id`='130');
+UPDATE `cdss`.`sys_dictionary_info` SET `id`='131', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='10', `name`='政策法规', `val`='10', `return_type`='0', `order_no`='10', `remark`='静态知识类型' WHERE (`id`='131');
+UPDATE `cdss`.`sys_dictionary_info` SET `id`='132', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='13', `name`='政策法规', `val`='政策法规', `return_type`='1', `order_no`='411', `remark`='页面显示词性' WHERE (`id`='132');

+ 5 - 0
doc/013.20210801静态知识法律法规修改成政策法规/med2021_init.sql

@@ -0,0 +1,5 @@
+USE `med_2021`;
+
+update kl_lexicon set name ='政策法规' where code=130;
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='144', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='7', `name`='政策法规', `val`='10', `return_type`='2', `order_no`='100', `remark`='静态知识检索类型' WHERE (`id`='144');
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='145', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='13', `name`='政策法规', `val`='政策法规', `return_type`='1', `order_no`='411', `remark`='页面显示词性' WHERE (`id`='145');

+ 531 - 0
doc/014.20210727提示规则新需求/med2021_init.sql

@@ -0,0 +1,531 @@
+USE `med_2021`;
+
+ALTER TABLE kl_rule_condition ADD  COLUMN `msg` varchar(255) NOT NULL DEFAULT '' COMMENT '附加信息' AFTER `rule_base_id`;
+
+UPDATE kl_rule_condition t1,
+ (
+	SELECT
+		*
+	FROM
+		`kl_rule`
+	WHERE
+		msg != ""
+) t2
+SET t1.msg = t2.msg
+where t1.rule_id = t2.id;
+
+SELECT
+		*
+	FROM
+		`kl_rule_condition`
+	WHERE
+		msg != "";
+/*
+Navicat MySQL Data Transfer
+
+Source Server         : 朗通mysql 236联调服务器
+Source Server Version : 50731
+Source Host           : 192.168.2.236:3306
+Source Database       : med_2021
+
+Target Server Type    : MYSQL
+Target Server Version : 50731
+File Encoding         : 65001
+
+Date: 2021-08-04 11:45:21
+*/
+
+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=244 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 ('7', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '量表', '8', '2', '80', '静态知识检索类型');
+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', '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', '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', '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', '诊断依据存在比较只有文本');
+INSERT INTO `kl_dictionary_info` VALUES ('143', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '护理', '9', '2', '90', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('144', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '7', '政策法规', '10', '2', '100', '静态知识检索类型');
+INSERT INTO `kl_dictionary_info` VALUES ('145', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '13', '政策法规', '政策法规', '1', '411', '页面显示词性');
+INSERT INTO `kl_dictionary_info` VALUES ('146', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '静态知识', '1', '1', '10', '静态知识类型');
+INSERT INTO `kl_dictionary_info` VALUES ('147', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '注意事项', '2', '1', '20', '静态知识类型');
+INSERT INTO `kl_dictionary_info` VALUES ('148', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '临床路径', '3', '1', '30', '静态知识类型');
+INSERT INTO `kl_dictionary_info` VALUES ('149', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '50', '一般治疗', '4', '1', '40', '静态知识类型');
+INSERT INTO `kl_dictionary_info` VALUES ('150', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '1', '1,3,4', '1', '0', '诊断关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('151', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '2', '1', '1', '0', '药品关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('152', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '3', '1,2', '1', '0', '检验套餐关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('153', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '4', '1,2', '1', '0', '检验细项关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('154', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '5', '1,2', '1', '0', '检查关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('155', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '6', '1,2', '1', '0', '检查子项关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('156', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '7', '1', '1', '0', '手术和操作关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('157', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '8', '1', '1', '0', '量表关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('158', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '9', '1', '1', '0', '护理关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('159', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '10', '1', '1', '0', '法律法规关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('160', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '51', '999', '1,2,3,4', '1', '0', '其他关联的静态信息类型');
+INSERT INTO `kl_dictionary_info` VALUES ('161', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '单次', '^(24小时维持|一次|1次|空)$|ALWAYS|BID|ONCE|每日', '1', '0', '开单频次');
+INSERT INTO `kl_dictionary_info` VALUES ('162', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '持续', '每周|每月|每年|每半年|(一|二|三)月一次|qw|biw', '1', '0', '开单频次');
+INSERT INTO `kl_dictionary_info` VALUES ('163', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌人群', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('164', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌性别', '[匹配内容]性患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('165', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌疾病', '[匹配内容]患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('166', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌医疗器械及物品', '该患者具有[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('167', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌服用药品', '该患者可能正在用药[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('168', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌临床表现', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('169', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌检查结果', '该患者检查提示[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('170', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌查体结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('171', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌手术', '该患者有[匹配内容]史,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('172', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌年龄', '该患者年龄[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('173', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌检验结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('174', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌过敏药品', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('175', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '药品_禁忌其他过敏原', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('176', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌人群', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('177', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌性别', '[匹配内容]性患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('178', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌疾病', '[匹配内容]患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('180', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌医疗器械及物品', '该患者具有[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('181', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌服用药品', '该患者可能正在用药[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('182', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌临床表现', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('183', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌检查结果', '该患者检查提示[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('184', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌查体结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('185', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌手术', '该患者有[匹配内容]史,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('186', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌年龄', '该患者年龄[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('187', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌检验结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('188', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌过敏药品', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('189', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_禁忌其他过敏原', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('190', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_开单项互斥', '该患者已开[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('191', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌人群', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('192', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌性别', '[匹配内容]性患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('193', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌疾病', '[匹配内容]患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('194', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌医疗器械及物品', '该患者具有[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('195', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌服用药品', '该患者可能正在用药[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('196', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌临床表现', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('197', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌检查结果', '该患者检查提示[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('198', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌查体结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('199', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌手术', '该患者有[匹配内容]史,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('200', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌年龄', '该患者年龄[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('201', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌检验结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('202', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌过敏药品', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('203', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_禁忌其他过敏原', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('204', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_开单项互斥', '该患者已开[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('205', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌人群', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('206', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌性别', '[匹配内容]性患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('207', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌疾病', '[匹配内容]患者,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('208', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌医疗器械及物品', '该患者具有[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('209', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌服用药品', '该患者可能正在用药[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('210', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌临床表现', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('211', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌检查结果', '该患者检查提示[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('212', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌查体结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('213', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌手术', '该患者有[匹配内容]史,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('214', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌年龄', '该患者年龄[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('215', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌检验结果', '该患者[匹配内容],不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('216', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌过敏药品', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('217', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '手术_禁忌其他过敏原', '该患者[匹配内容]过敏,不宜开[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('218', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌人群', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('219', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌性别', '[匹配内容]性患者,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('220', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌疾病', '[匹配内容]患者,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌医疗器械及物品', '该患者具有[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('222', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌服用药品', '该患者可能正在用药[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('223', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌临床表现', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('224', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌检查结果', '该患者检查提示[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('225', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌查体结果', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('226', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌手术', '该患者有[匹配内容]史,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('227', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌年龄', '该患者年龄[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('228', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌检验结果', '该患者[匹配内容],谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('229', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌过敏药品', '该患者[匹配内容]过敏,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('230', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '输血_禁忌其他过敏原', '该患者[匹配内容]过敏,谨慎输注[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('231', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_正常项目重复开立', '该患者近期做过[开单名称],检查结果[匹配内容],请谨慎开立[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('232', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_正常项目重复开立', '该患者近期做过[匹配内容],请谨慎开立[开单名称][原因及建议]', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('233', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '化验_24小时重复开立', '[开单名称]重复开立', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('234', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '41', '辅检_24小时重复开立', '[开单名称]重复开立', '1', '0', '提示语');
+INSERT INTO `kl_dictionary_info` VALUES ('235', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-药品通用名', '1-101-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('236', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-实验室检查套餐', '1-107-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('237', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-辅助检查项目', '1-109-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('238', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-辅助检查子项目', '1-110-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('239', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-手术和操作', '1-106-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('240', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '开单合理性-输血类型', '1-113-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('241', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-辅助检查项目', '6-109-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('242', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-辅助检查子项目', '6-110-0', '1', '0', '附加信息特殊处理(非必填)');
+INSERT INTO `kl_dictionary_info` VALUES ('243', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '21', '正常项目重复开立-实验室检查套餐', '6-107-0', '1', '0', '附加信息特殊处理(非必填)');
+
+-- ----------------------------
+-- Table structure for kl_rule_plan
+-- ----------------------------
+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=2428 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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('62', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '6', '实验室检查套餐', null, '1', '107', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('70', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单外等于术语本身', '1', null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('71', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单外存在比较', '2', null, '', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('72', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '过敏原', '4', null, '', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('73', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '10', '开单项', '5', null, '', '4', '');
+INSERT INTO `kl_rule_plan` VALUES ('74', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '人群', null, null, '117', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('75', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '性别', null, null, '116', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('76', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '70', '疾病', null, null, '100', '3', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('92', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '73', '辅助检查项目', null, null, '109', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('93', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '73', '辅助检查子项目', null, null, '110', '2', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('103', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '11', '开单项', '5', null, '', '4', '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('122', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '103', '实验室检查套餐', null, null, '107', 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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('400', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单外等于术语本身', '1', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('401', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单外存在比较', '2', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('402', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '过敏原', '4', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('403', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '14', '开单项', '5', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('404', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '人群', null, null, '117', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('405', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '性别', null, null, '116', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('406', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '400', '疾病', null, null, '100', null, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('422', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '403', '辅助检查项目', null, null, '109', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('423', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '403', '辅助检查子项目', null, null, '110', 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, '');
+INSERT INTO `kl_rule_plan` VALUES ('501', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单外存在比较', '2', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('502', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '过敏原', '4', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('503', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '15', '开单项', '5', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('504', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '人群', null, null, '117', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('505', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '性别', null, null, '116', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('506', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '500', '疾病', null, null, '100', null, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('522', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查项目', null, null, '109', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('523', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '1', '503', '辅助检查子项目', null, null, '110', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('600', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '20', '开单外等于术语本身', '1', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('601', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '无子条件', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('602', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '开单外等于术语本身', '1', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('603', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '21', '开单外存在比较', '2', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('604', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '600', '药品剂型', null, null, '102', null, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('610', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '2', '603', '实验室检查子项目', null, null, '108', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('700', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '30', '开单外等于术语本身', '1', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('701', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '30', '开单外存在比较', '2', null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('702', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '31', '无子条件', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('703', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '700', '人群', null, null, '117', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('704', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '3', '701', '实验室检查子项目', null, null, '108', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('800', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '40', '开单外等于术语本身', '1', null, '', null, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('812', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '802', '体格检查结果', null, null, '105', 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', '802', '疾病', null, null, '100', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('814', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '803', '年龄', null, null, '410', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('815', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '803', '实验室检查子项目', null, null, '108', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('816', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '803', '体格检查项目', null, null, '104', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('817', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '4', '804', '辅助检查结果', null, null, '112', 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, '');
+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, '');
+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, '');
+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, '');
+INSERT INTO `kl_rule_plan` VALUES ('904', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '5', '901', '实验室检查子项目', null, null, '108', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('1000', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '60', '检查结果正则表达式', '6', null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('1001', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '61', '检查结果正则表达式', '6', null, '', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('1002', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '62', '开单外存在比较', '2', null, '', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('1003', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1000', '辅助检查项目', null, null, '109', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('1004', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1001', '辅助检查子项目', null, null, '110', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('1005', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'rule', '6', '1002', '实验室检查子项目', null, null, '108', null, '');
+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, '');
+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', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('2214', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '查体正则', '5', null, '', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2215', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2200', '辅检结果正则', '6', null, '', '6', '');
+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, '103', '1', '');
+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, '105', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2218', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '疾病', null, null, '100', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2219', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '人群', null, null, '117', '4', '');
+INSERT INTO `kl_rule_plan` VALUES ('2220', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2210', '辅助检查结果', null, null, '112', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2221', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '年龄', null, null, '410', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2222', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '体格检查项目', null, null, '104', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2223', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2211', '实验室检查子项目', null, null, '108', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2224', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2212', '主诉现病史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2225', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2213', '既往史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2226', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2214', '查体正则', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('2227', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '2', '2215', '辅检结果正则', null, null, '', 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, '');
+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', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('2314', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '查体正则', '5', null, '', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2315', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2300', '辅检结果正则', '6', null, '', '6', '');
+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, '103', '1', '');
+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, '105', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2318', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '疾病', null, null, '100', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2319', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '人群', null, null, '117', '4', '');
+INSERT INTO `kl_rule_plan` VALUES ('2320', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2310', '辅助检查结果', null, null, '112', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2321', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '年龄', null, null, '410', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2322', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '体格检查项目', null, null, '104', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2323', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2311', '实验室检查子项目', null, null, '108', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2324', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2312', '主诉现病史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2325', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2313', '既往史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2326', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2314', '查体正则', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('2327', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '3', '2315', '辅检结果正则', null, null, '', 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, '');
+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', '');
+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', '');
+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', '');
+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', '');
+INSERT INTO `kl_rule_plan` VALUES ('2414', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '查体正则', '5', null, '', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2415', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2400', '辅检结果正则', '6', null, '', '6', '');
+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, '103', '1', '');
+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, '105', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2418', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '疾病', null, null, '100', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2419', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '人群', null, null, '117', '4', '');
+INSERT INTO `kl_rule_plan` VALUES ('2420', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2410', '辅助检查结果', null, null, '112', '5', '');
+INSERT INTO `kl_rule_plan` VALUES ('2421', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '年龄', null, null, '410', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2422', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '体格检查项目', null, null, '104', '2', '');
+INSERT INTO `kl_rule_plan` VALUES ('2423', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2411', '实验室检查子项目', null, null, '108', '3', '');
+INSERT INTO `kl_rule_plan` VALUES ('2424', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2412', '主诉现病史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2425', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2413', '既往史正则', null, null, '', '1', '');
+INSERT INTO `kl_rule_plan` VALUES ('2426', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2414', '查体正则', null, null, '', null, '');
+INSERT INTO `kl_rule_plan` VALUES ('2427', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'dis', '4', '2415', '辅检结果正则', null, null, '', null, '');
+
+
+
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='177', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='41', `name`='化验_禁忌性别', `val`='[匹配内容]性患者,不宜开[开单名称],[开单名称]为针对[性别取反]性患者的检验项目', `return_type`='1', `order_no`='0', `remark`='提示语' WHERE (`id`='177');
+
+UPDATE `med_2021`.`kl_dictionary_info` SET `id`='192', `is_deleted`='N', `gmt_create`='1970-01-01 12:00:00', `gmt_modified`='1970-01-01 12:00:00', `creator`='0', `modifier`='0', `group_type`='41', `name`='辅检_禁忌性别', `val`='[匹配内容]性患者,不宜开[开单名称],[开单名称]为针对[性别取反]性患者的检查项目', `return_type`='1', `order_no`='0', `remark`='提示语' WHERE (`id`='192');

+ 81 - 0
doc/014.20210727提示规则新需求/temp.sql

@@ -0,0 +1,81 @@
+USE `med_2021`;
+-- 临时表
+DROP TABLE IF EXISTS `temp_msg`;
+CREATE TABLE `temp_msg` (
+  `cond_id` bigint(20) DEFAULT NULL COMMENT 'con_id',
+  `msg` varchar(255) DEFAULT NULL COMMENT '提示语',
+   KEY (`cond_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+-- 更新提示语:原因及建议
+update kl_rule_condition a, temp_msg b set a.msg = b.msg where a.id = b.cond_id;
+
+-- 查询已有的开单条目
+SELECT
+	tt1.cond_id,
+	tt1.par_name,
+	tt1.par_type,
+	tt2.lib_name base_name,
+	xx2. NAME base_type,
+	CASE tt1.type
+WHEN '4' THEN
+	'过敏原'
+WHEN '5' THEN
+	'辅检开单互斥'
+ELSE
+	''
+END other_type,
+ tt1.max_value,
+ tt1.max_operator,
+ tt1.min_value,
+ tt1.min_operator,
+ tt1.cond_msg
+FROM
+	(
+		SELECT
+			c1.lib_name par_name,
+			c1.id par_id,
+			x1.`name` par_type,
+			t1.id rule_id,
+			t1.description,
+			t1.rule_type,
+			t1.has_sub_cond,
+			t1.msg,
+			t3.type,
+			t3.concept_id base_id,
+			t3.eq_value,
+			t3.min_value,
+			t3.min_operator,
+			t3.min_unit,
+			t3.max_value,
+			t3.max_operator,
+			t3.max_unit,
+			t2.id cond_id,
+			t2.msg cond_msg
+		FROM
+			kl_concept c1,
+			kl_lexicon x1,
+			kl_rule t1,
+			kl_rule_condition t2,
+			kl_rule_base t3
+		WHERE
+			c1.is_deleted = 'N'
+		AND t1.is_deleted = 'N'
+		AND t2.is_deleted = 'N'
+		AND t3.is_deleted = 'N'
+		AND c1.`status` = 1
+		AND t1.`status` = 1
+		AND c1.id = t1.concept_id
+		AND t1.id = t2.rule_id
+		AND t2.rule_base_id = t3.id
+		AND t1.rule_type = 1
+		AND x1.`code` = c1.lib_type
+	) tt1
+LEFT JOIN kl_concept tt2 ON tt2.is_deleted = 'N'
+AND tt2.`status` = 1
+AND tt1.base_id = tt2.id
+LEFT JOIN kl_lexicon xx2 ON tt2.lib_type = xx2. CODE
+ORDER BY
+	rule_id;
+
+

+ 23 - 0
doc/015.20210805提示类信息规则维护支持集合分类维护/med2021_init.sql

@@ -0,0 +1,23 @@
+USE `med_2021`;
+
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('52', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '疾病集合', '308', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('53', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '药品通用名集合', '309', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('54', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '药品剂型集合', '310', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('55', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '症状集合', '311', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('56', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '体格检查项目集合', '312', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('57', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '体格检查结果集合', '313', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('58', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '手术和操作集合', '314', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('59', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '实验室检查套餐集合', '315', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('60', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '辅助检查项目集合', '316', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('61', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '辅助检查子项目集合', '317', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('62', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '辅助检查描述集合', '318', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('63', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '辅助检查结果集合', '319', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('64', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '麻醉集合', '320', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('65', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '科室集合', '321', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('66', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '食物集合', '322', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('67', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '其他过敏原集合', '323', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('68', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医疗器械及物品集合', '324', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('69', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '部位集合', '325', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('70', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '中医疾病集合', '326', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('71', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '中医证候集合', '327', '0', '0', '0', '');
+INSERT INTO `kl_lexicon` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `is_has_common`, `only_one`, `can_change`, `remark`) VALUES ('72', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '诱因集合', '328', '0', '0', '0', '');

+ 242 - 0
src/main/java/com/diagbot/aggregate/RuleAggregate.java

@@ -0,0 +1,242 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.dto.RuleBaseDTO;
+import com.diagbot.dto.RuleBaseInitDTO;
+import com.diagbot.dto.RuleConditionDTO;
+import com.diagbot.dto.RuleConditionInitDTO;
+import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.RuleInitDTO;
+import com.diagbot.enums.RedisEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.facade.KlRuleFacade;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/5/31 17:14
+ */
+@Component
+@Slf4j
+public class RuleAggregate {
+    @Autowired
+    private KlRuleFacade klRuleFacade;
+
+    @DataProvider("getAllRules")
+    public Map<String, RuleDTO> getAllRules(
+            @DataConsumer("getRuleInit") Map<String, List<RuleInitDTO>> ruleInits,
+            @DataConsumer("getRuleConditionInit") Map<Integer, Map<String, List<RuleConditionInitDTO>>> ruleConditionInits,
+            @DataConsumer("getRuleBaseInit") Map<Integer, List<RuleBaseInitDTO>> ruleBaseInits) {
+        try {
+            Map<String, RuleDTO> res = new HashMap();
+            //结果判空第一层规则类型
+            if (MapUtils.isNotEmpty(ruleInits)) {
+                for (String ruleKey : ruleInits.keySet()) {
+                    RuleInitDTO ruleInitZeroDTO = ruleInits.get(ruleKey).get(0);
+                    RuleDTO ruleDTO = new RuleDTO();
+                    ruleDTO.setLibName(ruleInitZeroDTO.getLibName());
+                    ruleDTO.setLibType(ruleInitZeroDTO.getLibType());
+                    ruleDTO.setRuleType(ruleInitZeroDTO.getRuleType());
+                    Map<String, Integer> ruleConditionMap = new HashMap<>();
+                    for (RuleInitDTO ruleInitDTO : ruleInits.get(ruleKey)) {
+                        if (ruleInitDTO.getHasSubCond().equals(1)) {
+                            Map<String, List<RuleConditionInitDTO>> map = ruleConditionInits.get(ruleInitDTO.getRuleId());
+                            //结果判空第二层条件组别
+                            if (MapUtils.isNotEmpty(map)) {
+                                for (String ruleGroup : map.keySet()) {
+                                    RuleConditionDTO ruleConditionDTO = new RuleConditionDTO();
+                                    ruleConditionDTO.setHasSubCond(ruleInitDTO.getHasSubCond());
+                                    ruleConditionDTO.setRuleGroup(ruleGroup);
+                                    //结果判空第三层条件明细
+                                    if (ListUtil.isNotEmpty(map.get(ruleGroup))) {
+                                        List<List<RuleBaseDTO>> ruleBaseList = new ArrayList<>();
+                                        for (RuleConditionInitDTO ruleConditionInitDTO : map.get(ruleGroup)) {
+                                            ruleConditionDTO.setMsg(ruleConditionInitDTO.getMsg());
+                                            List<RuleBaseInitDTO> ruleBaseInitDTOList = ruleBaseInits.get(ruleConditionInitDTO.getRuleBaseId());
+                                            if (ListUtil.isNotEmpty(ruleBaseInitDTOList)) {
+                                                List<RuleBaseDTO> ruleBaseDTOList = BeanUtil.listCopyTo(ruleBaseInitDTOList, RuleBaseDTO.class);
+                                                ruleBaseList.add(ruleBaseDTOList);
+                                            }
+                                        }
+                                        //笛卡尔积
+                                        List<List<RuleBaseDTO>> ruleBaseGroup = new ArrayList<>();
+                                        descartes(ruleBaseList, ruleBaseGroup, 0, new ArrayList<>());
+                                        for (List<RuleBaseDTO> ruleBaseDTOList : ruleBaseGroup) {
+                                            RuleConditionDTO ruleConditionDTO1 = new RuleConditionDTO();
+                                            ruleConditionDTO1.setHasSubCond(ruleConditionDTO.getHasSubCond());
+                                            ruleConditionDTO1.setRuleGroup(ruleConditionDTO.getRuleGroup());
+                                            ruleConditionDTO1.setMsg(ruleConditionDTO.getMsg());
+                                            ruleConditionDTO1.getRuleBaseDTOList().addAll(ruleBaseDTOList);
+                                            if (!ruleConditionMap.containsKey(ruleConditionDTO1.toString())) {
+                                                ruleDTO.getRuleConditionDTOList().add(ruleConditionDTO1);
+                                                ruleConditionMap.put(ruleConditionDTO1.toString(), 1);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        } else {
+                            RuleConditionDTO ruleConditionDTO = new RuleConditionDTO();
+                            ruleConditionDTO.setHasSubCond(ruleInitDTO.getHasSubCond());
+                            ruleConditionDTO.setMsg(ruleInitDTO.getMsg());
+                            //无条件
+                            ruleConditionDTO.setRuleGroup(ruleInitDTO.getRuleId() + "-1");
+                            ruleConditionDTO.getRuleBaseDTOList().add(new RuleBaseDTO());
+                            if (!ruleConditionMap.containsKey(ruleConditionDTO.toString())) {
+                                ruleDTO.getRuleConditionDTOList().add(ruleConditionDTO);
+                                ruleConditionMap.put(ruleConditionDTO.toString(), 1);
+                            }
+                        }
+                    }
+                    res.put(RedisEnum.allRule.getName() + ruleDTO.getLibType() + "_" + ruleDTO.getLibName() + "_" + ruleDTO.getRuleType(), ruleDTO);
+                }
+            }
+            return res;
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "全部规则加载出错:" + e.getMessage());
+        }
+    }
+
+    @DataProvider("getRuleInit")
+    public Map<String, List<RuleInitDTO>> getRuleInit() {
+        List<RuleInitDTO> list = klRuleFacade.getRuleInitDTO();
+        return EntityUtil.makeEntityListMap(list, "conceptGroup");
+    }
+
+    //    @DataProvider("getRuleInit")
+    //    public Map<String, List<RuleInitDTO>> getRuleInit(
+    //            @DataConsumer("getRuleInitNotHaveClass") List<RuleInitDTO> ruleNotHaveClass,
+    //            @DataConsumer("getRuleInitHaveClass") List<RuleInitDTO> ruleHaveClass) {
+    //        List<RuleInitDTO> list = new ArrayList<>();
+    //        if (ListUtil.isNotEmpty(ruleNotHaveClass)) {
+    //            list.addAll(ruleNotHaveClass);
+    //        }
+    //        if (ListUtil.isNotEmpty(ruleHaveClass)) {
+    //            list.addAll(ruleHaveClass);
+    //        }
+    //        return EntityUtil.makeEntityListMap(list, "conceptGroup");
+    //    }
+
+    @DataProvider("getRuleConditionInit")
+    public Map<Integer, Map<String, List<RuleConditionInitDTO>>> getRuleConditionInit() {
+        List<RuleConditionInitDTO> list = klRuleFacade.getRuleConditionInitDTO();
+        Map<Integer, List<RuleConditionInitDTO>> map = EntityUtil.makeEntityListMap(list, "ruleId");
+        Map<Integer, Map<String, List<RuleConditionInitDTO>>> res = new HashMap<>();
+        for (Integer ruleId : map.keySet()) {
+            res.put(ruleId, EntityUtil.makeEntityListMap(map.get(ruleId), "ruleGroup"));
+        }
+        return res;
+    }
+
+    @DataProvider("getRuleBaseInit")
+    public Map<Integer, List<RuleBaseInitDTO>> getRuleBaseInit(
+            @DataConsumer("getRuleBaseInitNotHaveClass") List<RuleBaseInitDTO> ruleBaseNotHaveClass,
+            @DataConsumer("getRuleBaseInitHaveClass") List<RuleBaseInitDTO> ruleBaseHaveClass) {
+        List<RuleBaseInitDTO> list = new ArrayList<>();
+        if (ListUtil.isNotEmpty(ruleBaseNotHaveClass)) {
+            list.addAll(ruleBaseNotHaveClass);
+        }
+        if (ListUtil.isNotEmpty(ruleBaseHaveClass)) {
+            list.addAll(ruleBaseHaveClass);
+        }
+        return EntityUtil.makeEntityListMap(list, "ruleBaseId");
+    }
+
+
+    @DataProvider("getRuleInitNotHaveClass")
+    public List<RuleInitDTO> getRuleInitNotHaveClass() {
+        return klRuleFacade.getRuleInitDTONotHaveClass();
+    }
+
+    @DataProvider("getRuleInitHaveClass")
+    public List<RuleInitDTO> getRuleInitHaveClass() {
+        return klRuleFacade.getRuleInitDTOHaveClass();
+    }
+
+    @DataProvider("getRuleBaseInitNotHaveClass")
+    public List<RuleBaseInitDTO> getRuleBaseInitNotHaveClass() {
+        return klRuleFacade.getRuleBaseInitDTONotHaveClass();
+    }
+
+    @DataProvider("getRuleBaseInitHaveClass")
+    public List<RuleBaseInitDTO> getRuleBaseInitHaveClass() {
+        return klRuleFacade.getRuleBaseInitDTOHaveClass();
+    }
+
+    /**
+     * Discription: 笛卡尔乘积算法
+     * 把一个List{[1,2],[A,B],[a,b]} 转化成
+     * List{[1,A,a],[1,A,b],[1,B,a],[1,B,b],[2,A,a],[2,A,b],[2,B,a],[2,B,b]} 数组输出
+     *
+     * @param dimensionValue 原List
+     * @param result         通过乘积转化后的数组
+     * @param layer          中间参数
+     * @param currentList    中间参数
+     */
+    public static <T> void descartes(List<List<T>> dimensionValue, List<List<T>> result, int layer, List<T> currentList) {
+        if (layer < dimensionValue.size() - 1) {
+            if (dimensionValue.get(layer).size() == 0) {
+                descartes(dimensionValue, result, layer + 1, currentList);
+            } else {
+                for (int i = 0; i < dimensionValue.get(layer).size(); i++) {
+                    List<T> list = new ArrayList<T>(currentList);
+                    list.add(dimensionValue.get(layer).get(i));
+                    descartes(dimensionValue, result, layer + 1, list);
+                }
+            }
+        } else if (layer == dimensionValue.size() - 1) {
+            if (dimensionValue.get(layer).size() == 0) {
+                result.add(currentList);
+            } else {
+                for (int i = 0; i < dimensionValue.get(layer).size(); i++) {
+                    List<T> list = new ArrayList<T>(currentList);
+                    list.add(dimensionValue.get(layer).get(i));
+                    result.add(list);
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        List<List<RuleBaseDTO>> ruleBaseList = new ArrayList<>();
+        List<RuleBaseDTO> ruleBaseDTOListA = new ArrayList<>();
+        RuleBaseDTO baseDTOA = new RuleBaseDTO();
+        baseDTOA.setBaseLibName("A");
+        ruleBaseDTOListA.add(baseDTOA);
+        RuleBaseDTO baseDTOB = new RuleBaseDTO();
+        baseDTOB.setBaseLibName("B");
+        ruleBaseDTOListA.add(baseDTOB);
+        List<RuleBaseDTO> ruleBaseDTOListC = BeanUtil.listCopyTo(ruleBaseDTOListA, RuleBaseDTO.class);
+        ruleBaseList.add(ruleBaseDTOListC);
+        RuleBaseDTO baseDTOC = new RuleBaseDTO();
+        baseDTOC.setBaseLibName("C");
+        ruleBaseDTOListA.add(baseDTOC);
+        ruleBaseList.add(ruleBaseDTOListA);
+        List<RuleBaseDTO> ruleBaseDTOList1 = new ArrayList<>();
+        RuleBaseDTO baseDTO1 = new RuleBaseDTO();
+        baseDTO1.setBaseLibName("1");
+        ruleBaseDTOList1.add(baseDTO1);
+        RuleBaseDTO baseDTO2 = new RuleBaseDTO();
+        baseDTO2.setBaseLibName("2");
+        ruleBaseDTOList1.add(baseDTO2);
+        ruleBaseList.add(ruleBaseDTOList1);
+        List<List<RuleBaseDTO>> ruleBaseGroup = new ArrayList<>();
+        descartes(ruleBaseList, ruleBaseGroup, 0, new ArrayList<>());
+        System.out.println();
+    }
+
+}

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

@@ -33,8 +33,8 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.clear();
         log.info("CDSS-CORE服务启动清除redis缓存成功!");
 
-        cacheFacade.loadDrugTypeCache();
-        log.info("CDSS-CORE服务启动加载药品类型对应关系缓存成功!");
+//        cacheFacade.loadDrugTypeCache();
+//        log.info("CDSS-CORE服务启动加载药品类型对应关系缓存成功!");
 
         cacheFacade.getDiseaseCorrespondCache();
         log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");
@@ -48,6 +48,12 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.loadDeptPush();
         log.info("CDSS-CORE服务启动加载科室和推送映射成功!");
 
+        cacheFacade.loadFrequency();
+        log.info("CDSS-CORE服务启动加载开单频次成功!");
+
+        cacheFacade.loadMsg();
+        log.info("CDSS-CORE服务启动加载开单提示语成功!");
+
         conceptInfoFacade.loadCustomDictionary();
         log.info("CDSS-CORE服务启动加载NLP分词字典成功!");
 

+ 1 - 0
src/main/java/com/diagbot/dto/AnesthesiaInfoDTO.java

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class AnesthesiaInfoDTO {
+    private Long id;
     /**
      * 麻醉名称
      */

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

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

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

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

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

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

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

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

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

@@ -39,4 +39,5 @@ public class KlRuleByIdDTO {
     private String subEqOperator;//等于域比较符
     private String subEqValue;//等于域值
     private String subEqUnit;//等于域单位
+    private String subMsg;//附加信息
 }

+ 1 - 0
src/main/java/com/diagbot/dto/KlRuleByIdSubDTO.java

@@ -28,4 +28,5 @@ public class KlRuleByIdSubDTO {
     private String subEqOperator;//等于域比较符
     private String subEqValue;//等于域值
     private String subEqUnit;//等于域单位
+    private String subMsg;//附加信息
 }

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

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

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

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

+ 3 - 0
src/main/java/com/diagbot/dto/OperationInfoDTO.java

@@ -11,6 +11,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class OperationInfoDTO {
+    private Long id;
     /**
      * 手术或操作名称
      */
@@ -19,4 +20,6 @@ public class OperationInfoDTO {
      * 类型:手术、操作
      */
     private String type;
+
+    private String code;
 }

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

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-10 14:46
+ */
+@Setter
+@Getter
+public class RetrievalConceptDTO {
+    private Long id;
+    private String name;
+    private String code;
+}

+ 45 - 40
src/main/java/com/diagbot/dto/RetrievalDTO.java

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

+ 14 - 12
src/main/java/com/diagbot/dto/RuleBaseDTO.java

@@ -2,6 +2,7 @@ package com.diagbot.dto;
 
 import lombok.Getter;
 import lombok.Setter;
+import lombok.ToString;
 
 /**
  * @Description:
@@ -10,17 +11,18 @@ import lombok.Setter;
  */
 @Getter
 @Setter
+@ToString(includeFieldNames = false)
 public class RuleBaseDTO {
-    private String baseLibName;
-    private Integer baseLibType;
-    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;
+    private String baseLibName = "";
+    private Integer baseLibType = 0;
+    private Integer baseType = 0;
+    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 = "";
 }

+ 15 - 0
src/main/java/com/diagbot/dto/RuleBaseInitDTO.java

@@ -0,0 +1,15 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/2/3 16:25
+ */
+@Getter
+@Setter
+public class RuleBaseInitDTO extends RuleBaseDTO {
+    private Integer ruleBaseId;
+}

+ 2 - 0
src/main/java/com/diagbot/dto/RuleConditionDTO.java

@@ -2,6 +2,7 @@ package com.diagbot.dto;
 
 import lombok.Getter;
 import lombok.Setter;
+import lombok.ToString;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -13,6 +14,7 @@ import java.util.List;
  */
 @Getter
 @Setter
+@ToString(exclude = { "ruleGroup", "msg" }, includeFieldNames = false)
 public class RuleConditionDTO {
     private Integer hasSubCond;
     private String ruleGroup;

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

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/2/3 16:32
+ */
+@Getter
+@Setter
+public class RuleConditionInitDTO {
+    private Integer ruleId;
+    private String ruleGroup;
+    private Integer ruleBaseId;
+    private String msg;
+}

+ 25 - 0
src/main/java/com/diagbot/dto/RuleInitDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2021/2/3 16:34
+ */
+@Getter
+@Setter
+public class RuleInitDTO {
+    private String conceptGroup;
+    private Integer conceptId;
+    private Integer ruleId;
+    private String libName;
+    private Integer libType;
+    private Integer ruleType;
+    private String msg;
+    private Integer hasSubCond;
+}

+ 4 - 0
src/main/java/com/diagbot/dto/RuleSimpleDTO.java

@@ -23,4 +23,8 @@ public class RuleSimpleDTO {
     private String form;
     // 提示语
     private String msg;
+    // 界面匹配内容
+    private String content;
+    // 禁忌类型
+    private String conType;
 }

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

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

+ 1 - 0
src/main/java/com/diagbot/dto/TcmdiseaseInfoDTO.java

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

+ 1 - 0
src/main/java/com/diagbot/dto/TcmsyndromeInfoDTO.java

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

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

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

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

@@ -36,7 +36,7 @@ public class WordCrfDTO {
     private Double ageNum;
     // 性别(1:男,2:女)
     private Integer sex;
-    //科室
+    // 科室
     private List<Item> dept = new ArrayList<>();
     // 化验项目和结果
     private List<Lis> lis = new ArrayList<>();
@@ -88,6 +88,8 @@ public class WordCrfDTO {
     private List<Item> operationOrder = new ArrayList<>();
     // 当前输血开单项
     private List<ItemExt> transfusionOrder = new ArrayList<>();
+    // 输血记录
+    private List<ItemExt> transfusion = new ArrayList<>();
     /*******************************************入参数据拷贝结束******************************/
     // 化验
     // private LisLabel lisLabel;
@@ -110,6 +112,8 @@ public class WordCrfDTO {
     private String family = "";
     // 查体
     private String vital = "";
+    // 婚姻
+    private String marriage = "";
 
     // 【诊断数据来源】
     private List<Item> diagSource = new ArrayList<>();

+ 158 - 0
src/main/java/com/diagbot/entity/KlOperation.java

@@ -0,0 +1,158 @@
+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 zhaops
+ * @since 2021-06-15
+ */
+public class KlOperation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 术语概念id
+     */
+    private Long conceptId;
+
+    /**
+     * 手术级别(0,1,2,3,4)
+     */
+    private Integer operationLevel;
+
+    /**
+     * 手术操作码
+     */
+    private String operationCode;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    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 Integer getOperationLevel() {
+        return operationLevel;
+    }
+
+    public void setOperationLevel(Integer operationLevel) {
+        this.operationLevel = operationLevel;
+    }
+    public String getOperationCode() {
+        return operationCode;
+    }
+
+    public void setOperationCode(String operationCode) {
+        this.operationCode = operationCode;
+    }
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "KlOperation{" +
+            "id=" + id +
+            ", isDeleted=" + isDeleted +
+            ", gmtCreate=" + gmtCreate +
+            ", gmtModified=" + gmtModified +
+            ", creator=" + creator +
+            ", modifier=" + modifier +
+            ", conceptId=" + conceptId +
+            ", operationLevel=" + operationLevel +
+            ", operationCode=" + operationCode +
+            ", remark=" + remark +
+        "}";
+    }
+}

+ 18 - 4
src/main/java/com/diagbot/entity/KlRuleCondition.java

@@ -11,8 +11,8 @@ import java.util.Date;
  * 规则条件表
  * </p>
  *
- * @author gaodm
- * @since 2021-01-21
+ * @author zhoutg
+ * @since 2021-07-27
  */
 public class KlRuleCondition implements Serializable {
 
@@ -50,7 +50,7 @@ public class KlRuleCondition implements Serializable {
     private String modifier;
 
     /**
-     * 提示概念id
+     * 规则主表id
      */
     private Long ruleId;
 
@@ -60,10 +60,15 @@ public class KlRuleCondition implements Serializable {
     private Integer groupType;
 
     /**
-     * 提示概念id
+     * 基础规则id
      */
     private Long ruleBaseId;
 
+    /**
+     * 附加信息
+     */
+    private String msg;
+
     public Long getId() {
         return id;
     }
@@ -136,6 +141,14 @@ public class KlRuleCondition implements Serializable {
         this.ruleBaseId = ruleBaseId;
     }
 
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
     @Override
     public String toString() {
         return "KlRuleCondition{" +
@@ -148,6 +161,7 @@ public class KlRuleCondition implements Serializable {
                 ", ruleId=" + ruleId +
                 ", groupType=" + groupType +
                 ", ruleBaseId=" + ruleBaseId +
+                ", msg=" + msg +
                 "}";
     }
 }

+ 296 - 0
src/main/java/com/diagbot/entity/MappingConfig.java

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

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

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

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

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

+ 78 - 0
src/main/java/com/diagbot/enums/ConceptTypeEnum.java

@@ -0,0 +1,78 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/9/10 15:51
+ */
+public enum ConceptTypeEnum implements KeyedNamed {
+
+    LisPack(1, "检验套餐"),
+    Lis(2, "检验细项"),
+    Pacs(3, "检查"),
+    Disease(4, "诊断"),
+    Drug(5, "药品"),
+    Operation(6, "手术和操作"),
+    Dept(7, "科室"),
+    Transfusion(8, "输血"),
+    Symptom(9,"症状"),
+    //PacsSubName(9, "检查子项"),
+    Scale(10, "量表"),
+    Nurse(11, "护理"),
+    Tcmdisease(12,"中医疾病"),
+    Tcmsyndrome(13,"中医证候"),
+    Anesthesia(14, "麻醉"),
+    Form(15, "药品剂型");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    ConceptTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ConceptTypeEnum getEnum(int key) {
+        for (ConceptTypeEnum item : ConceptTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static ConceptTypeEnum getEnum(String name) {
+        for (ConceptTypeEnum item : ConceptTypeEnum.values()) {
+            if (item.name.equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        ConceptTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    public static Integer getKey(String name) {
+        ConceptTypeEnum item = getEnum(name);
+        return item != null ? item.key : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 2 - 1
src/main/java/com/diagbot/enums/LexiconEnum.java

@@ -58,7 +58,8 @@ public enum LexiconEnum implements KeyedNamed {
     OperationClassNode(407,"手术和操作类别根节点"),
     LisClassNode(408,"实验室检查类别根节点"),
     PacsClassNode(409,"辅助检查类别根节点"),
-    Age(410,"年龄");
+    Age(410,"年龄"),
+    Law(130,"政策法规");
 
 
     @Setter

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

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

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

@@ -25,7 +25,9 @@ public enum RedisEnum implements KeyedNamed {
     allBaseRegulation(12, "allBaseRegulation"),
     pushModel(13, "pushModel"),
     hospitalId_(14, "hospitalId_"),
-    deptPush(15, "deptPush");
+    deptPush(15, "deptPush"),
+    frequency(20, "frequency"),
+    msg(21, "msg");
 
     @Setter
     private int key;

+ 56 - 0
src/main/java/com/diagbot/enums/StandConvertCrfEnum.java

@@ -0,0 +1,56 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-11 9:28
+ */
+public enum StandConvertCrfEnum implements KeyedNamed {
+    // 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital
+    disease(1, "disease"),
+    symptom(2, "symptom"),
+    operation(3, "operation"),
+    drug(4, "drug"),
+    lis(5, "lis"),
+    pacs(6, "pacs"),
+    vital(7, "vital");
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    StandConvertCrfEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static StandConvertCrfEnum getEnum(int key) {
+        for (StandConvertCrfEnum item : StandConvertCrfEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        StandConvertCrfEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

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

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

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

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.PushReloadDTO;
 import com.diagbot.entity.SysDeptPush;
 import com.diagbot.entity.TranHospitalInfo;
@@ -199,4 +200,33 @@ public class CacheFacade {
                     deptPushList.stream().collect(Collectors.toMap(k -> k.getDeptName(), v -> v.getPush(), (v1, v2) -> (v2))));
         }
     }
+
+    /**
+     * 加载开单频次
+     */
+    public void loadFrequency() {
+        // 删除
+        redisUtil.delete(RedisEnum.frequency.getName());
+        // 加载
+        List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(40);
+        redisUtil.set(RedisEnum.frequency.getName(), dictionaryInfoDTOList);
+    }
+
+    /**
+     * 加载提示语
+     */
+    public void loadMsg() {
+        // 删除
+        redisUtil.delete(RedisEnum.msg.getName());
+        // 加载
+        List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(41);
+        if (ListUtil.isNotEmpty(dictionaryInfoDTOList)) {
+            // 提示语
+            Map<String, Object> msgMap = new LinkedMap<>();
+            for (DictionaryInfoDTO dic : dictionaryInfoDTOList) {
+                msgMap.put(dic.getName(), dic.getVal());
+            }
+            redisUtil.putHashMap(RedisEnum.msg.getName(), msgMap);
+        }
+    }
 }

+ 198 - 109
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -4,50 +4,23 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.client.CRFServiceClient;
 import com.diagbot.client.StandConvertServiceClient;
-import com.diagbot.dto.BillMsg;
-import com.diagbot.dto.RuleDTO;
-import com.diagbot.dto.RuleExtDTO;
-import com.diagbot.dto.StandConvertCrfBatchDTO;
-import com.diagbot.dto.StandConvertCrfDTO;
-import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.dto.*;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 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;
-import com.diagbot.model.label.DiagLabel;
-import com.diagbot.model.label.PacsLabel;
-import com.diagbot.model.label.PastLabel;
-import com.diagbot.model.label.PresentLabel;
-import com.diagbot.model.label.VitalLabel;
+import com.diagbot.model.entity.*;
+import com.diagbot.model.label.*;
 import com.diagbot.rule.CommonRule;
-import com.diagbot.util.BeanUtil;
-import com.diagbot.util.CoreUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.RedisUtil;
-import com.diagbot.util.ReflectUtil;
-import com.diagbot.util.StringUtil;
-import com.diagbot.vo.NeoPushVO;
-import com.diagbot.vo.RuleVO;
-import com.diagbot.vo.SearchData;
-import com.diagbot.vo.StandConvert;
-import com.diagbot.vo.StandConvertCrfVO;
-import com.diagbot.vo.neoPushEntity.ChiefPushVo;
+import com.diagbot.util.*;
+import com.diagbot.vo.*;
 import com.diagbot.vo.neoPushEntity.Diag;
-import com.diagbot.vo.neoPushEntity.DiagVo;
 import com.diagbot.vo.neoPushEntity.Drug;
-import com.diagbot.vo.neoPushEntity.LisPushVo;
-import com.diagbot.vo.neoPushEntity.PacsPushVo;
-import com.diagbot.vo.neoPushEntity.PresentPushVo;
-import com.diagbot.vo.neoPushEntity.Symptom;
+import com.diagbot.vo.neoPushEntity.*;
 import com.google.common.collect.Lists;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -55,12 +28,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.lang.reflect.Method;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -73,9 +43,7 @@ public class CommonFacade {
     @Autowired
     CRFServiceClient crfServiceClient;
     @Autowired
-    LisConfigFacade lisConfigFacade;
-    @Autowired
-    PacsConfigFacade pacsConfigFacade;
+    MappingConfigFacade mappingConfigFacade;
     @Autowired
     TranOperationConfigFacade tranOperationConfigFacade;
     @Autowired
@@ -140,6 +108,9 @@ public class CommonFacade {
         if (ListUtil.isNotEmpty(searchData.getDrug())) {
             wordCrfDTO.setDrug(searchData.getDrug());
         }
+        if (ListUtil.isNotEmpty(searchData.getTransfusion())) {
+            wordCrfDTO.setTransfusion(searchData.getTransfusion());
+        }
         if (ListUtil.isNotEmpty(searchData.getOperation())) {
             wordCrfDTO.setOperation(searchData.getOperation());
         }
@@ -182,6 +153,9 @@ public class CommonFacade {
         if (StringUtil.isNotBlank(searchData.getMarital())) {
             wordCrfDTO.setMarital(searchData.getMarital());
         }
+        if (StringUtil.isNotBlank(searchData.getMarriage())) {
+            wordCrfDTO.setMarriage(searchData.getMarriage());
+        }
         if (StringUtil.isNotBlank(searchData.getPersonal())) {
             wordCrfDTO.setPersonal(searchData.getPersonal());
         }
@@ -189,13 +163,13 @@ public class CommonFacade {
             wordCrfDTO.setVital(searchData.getVital());
         }
 
-        //模型处理数据
+        // 模型处理数据
         aiAnalyze.aiProcess(searchData, wordCrfDTO);
 
         // 统一处理化验、辅检、诊断,放入结构化
         processLisPacsDiag(wordCrfDTO);
 
-        // 现病史体征内容放入体征标签
+        // 现病史体征内容放入体征标签
         processPresentVital(wordCrfDTO);
 
         // 加入分词
@@ -432,9 +406,9 @@ public class CommonFacade {
         //        // 3、开单辅检项目
         //        CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
 
-        CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(), "detailName");
-        CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(), "name");
-
+        //        CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(), "detailName");
+        //        CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(), "name");
+        lisGetAndSet(wordCrfDTO);
         pacsGetAndSet(wordCrfDTO);
 
         // 【体征回填】
@@ -465,7 +439,7 @@ public class CommonFacade {
      * 类型,疾病: 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<>();
@@ -690,19 +664,25 @@ public class CommonFacade {
                 .distinct()
                 .collect(Collectors.toList());
 
-        Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
+        //        Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
         if (ListUtil.isNotEmpty(operationList)) {
-            configMap = tranOperationConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), operationList, null);
+            //            configMap = tranOperationConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), operationList, null);
+            Map<String, Map<String, Map<String, List<String>>>> operstionMap = mappingConfigFacade.groupByHisNameWithName(operationList, ConceptTypeEnum.Operation.getKey(), wordCrfDTO.getHospitalId());
             // 1、主诉手术
-            setListProperty(wordCrfDTO.getChiefLabel(), "operations", "standName", configMap);
+            //            setListProperty(wordCrfDTO.getChiefLabel(), "operations", "standName", configMap);
+            setListProperty(wordCrfDTO.getChiefLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
             // 2、现病史手术
-            setListProperty(wordCrfDTO.getPresentLabel(), "operations", "standName", configMap);
+            //            setListProperty(wordCrfDTO.getPresentLabel(), "operations", "standName", configMap);
+            setListProperty(wordCrfDTO.getPresentLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
             // 3、既往史手术
-            setListProperty(wordCrfDTO.getPastLabel(), "operations", "standName", configMap);
-            // 4、开单手术
-            setListProperty(wordCrfDTO, "operation", "uniqueName", configMap);
-            // 5、结构化手术
-            setListProperty(wordCrfDTO, "operationOrder", "uniqueName", configMap);
+            //            setListProperty(wordCrfDTO.getPastLabel(), "operations", "standName", configMap);
+            setListProperty(wordCrfDTO.getPastLabel(), "operations", ConceptTypeEnum.Operation.getKey(), "StandName", operstionMap);
+            // 4、结构化手术
+            //            setListProperty(wordCrfDTO, "operation", "uniqueName", configMap);
+            setListProperty(wordCrfDTO, "operation", ConceptTypeEnum.Operation.getKey(), "UniqueName", operstionMap);
+            // 5、手术
+            //            setListProperty(wordCrfDTO, "operationOrder", "uniqueName", configMap);
+            setListProperty(wordCrfDTO, "operationOrder", ConceptTypeEnum.Operation.getKey(), "UniqueName", operstionMap);
             // 6、选中手术
             if (wordCrfDTO.getOperationName() != null &&
                     StringUtil.isNotBlank(wordCrfDTO.getOperationName().getName()) &&
@@ -721,24 +701,50 @@ public class CommonFacade {
         // 【所有辅检】
         List<String> pacsList = new ArrayList<>();
         // 1、结构化
-        CoreUtil.addList(pacsList, CoreUtil.getPropertyList(wordCrfDTO.getPacs()));
-        // 2、开单
-        CoreUtil.addList(pacsList, CoreUtil.getPropertyList(wordCrfDTO.getPacsOrder()));
+        CoreUtil.addList(pacsList, CoreUtil.filterUniqueList(wordCrfDTO.getPacs()));
+        //        // 2、开单
+        CoreUtil.addList(pacsList, CoreUtil.filterUniqueList(wordCrfDTO.getPacsOrder()));
+        PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
+        if (pacsLabel != null) {
+            pacsList = pacsLabel.getItem().stream()
+                    .map(x -> x.getName())
+                    .collect(Collectors.toList());
+        }
+
+        if (ListUtil.isNotEmpty(pacsList)) {
+            Map<String, Map<String, Map<String, List<String>>>> pacsMap = mappingConfigFacade.groupByHisNameWithName(pacsList, ConceptTypeEnum.Pacs.getKey(), wordCrfDTO.getHospitalId());
+            setListProperty(wordCrfDTO, "pacs", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
+            setListProperty(wordCrfDTO, "pacsOrder", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
+            setListProperty(pacsLabel, "item", ConceptTypeEnum.Pacs.getKey(), "UniqueName", pacsMap);
+        }
+    }
 
-        pacsList = pacsList
+    /**
+     * 化验映射(关闭同义词转换)
+     *
+     * @param wordCrfDTO
+     */
+    public void lisGetAndSet(WordCrfDTO wordCrfDTO) {
+        //化验公表转换
+        List<String> lisHisNameList = Lists.newArrayList();
+        // 【所有化验】
+        List<Lis> lisList = wordCrfDTO.getLis();
+        if (ListUtil.isNotEmpty(lisList)) {
+            lisHisNameList.addAll(lisList
+                    .stream()
+                    .filter(i -> StringUtil.isNotBlank(i.getName()) || StringUtil.isNotBlank(i.getUniqueName()))
+                    .map(i -> i.getName())
+                    .collect(Collectors.toList()));
+        }
+        lisHisNameList = lisHisNameList
                 .stream()
                 .distinct()
                 .collect(Collectors.toList());
-
-        Map<String, Map<String, Long>> configMap = new LinkedHashMap<>();
-        if (ListUtil.isNotEmpty(pacsList)) {
-            configMap = pacsConfigFacade.getConfigMap(wordCrfDTO.getHospitalId(), pacsList, null);
-
-            // 4、结构化
-            setListProperty(wordCrfDTO, "pacs", "uniqueName", configMap);
-            // 5、开单
-            setListProperty(wordCrfDTO, "pacsOrder", "uniqueName", configMap);
+        if (ListUtil.isNotEmpty(lisHisNameList)) {
+            Map<String, Map<String, Map<String, List<String>>>> lisConfigMap = mappingConfigFacade.groupByHisNameWithName(lisHisNameList, ConceptTypeEnum.LisPack.getKey(), wordCrfDTO.getHospitalId());
+            setListProperty(wordCrfDTO, "lis", ConceptTypeEnum.LisPack.getKey(), "UniqueName", lisConfigMap);
         }
+
     }
 
     /**
@@ -755,6 +761,12 @@ public class CommonFacade {
         ReflectUtil.setProperty(obj, listProperty, newList);
     }
 
+    public <T> void setListProperty(Object obj, String listProperty, Integer type, String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
+        Object tList = CoreUtil.getFieldValue(obj, listProperty);
+        List<T> newList = convertStandName((List) tList, type, propertyName, configMap);
+        ReflectUtil.setProperty(obj, listProperty, newList);
+    }
+
     /**
      * 标准名称转换
      *
@@ -804,6 +816,99 @@ public class CommonFacade {
         return retList;
     }
 
+    /**
+     * 标准名称转换
+     *
+     * @param list
+     * @param configMap
+     * @param type
+     * @param <T>
+     * @return
+     */
+    public <T> List<T> convertStandName(List<T> list, Integer type, String propertyName, Map<String, Map<String, Map<String, List<String>>>> configMap) {
+        List<T> retList = new ArrayList<>();
+        if (ListUtil.isEmpty(list)) {
+            return list;
+        }
+
+        try {
+            for (T item : list) {
+                String name = ReflectUtil.getProperty(item, "name");
+                if (StringUtil.isBlank(name)) {
+                    retList.add(item);
+                    continue;
+                }
+
+                //                String uniqueName = item.getClass().getMethod("getUniqueName").invoke(item).toString();
+
+                String uniqueName = ReflectUtil.getProperty(item, "uniqueName");
+                if (StringUtil.isNotBlank(uniqueName) && !"StandName".equals(propertyName)) {
+                    retList.add(item);
+                    continue;
+                }
+
+                String hisDetailName = "";
+                if (type.equals(ConceptTypeEnum.LisPack.getKey())) {
+                    hisDetailName = ReflectUtil.getProperty(item, "detailName");
+                    if (StringUtil.isBlank(hisDetailName)) {
+                        hisDetailName = "";
+                    }
+                }
+
+                if (configMap != null && configMap.containsKey(name)) {
+                    Map<String, Map<String, List<String>>> subMap = configMap.get(name);
+                    if (subMap.containsKey(hisDetailName)) {
+                        if (type.equals(ConceptTypeEnum.Drug.getKey())) {
+                            for (Map.Entry<String, List<String>> thirdEntry : subMap.get(hisDetailName).entrySet()) {
+                                if (ListUtil.isNotEmpty(thirdEntry.getValue())) {
+                                    for (String form : thirdEntry.getValue()) {
+                                        T o = (T) item.getClass().newInstance();
+                                        BeanUtil.copyProperties(item, o);
+                                        Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
+                                        setUniqueName.invoke(o, thirdEntry.getKey());
+                                        Method setForm = o.getClass().getMethod("setForm", String.class);
+                                        setForm.invoke(o, form);
+                                        retList.add(o);
+                                    }
+                                } else {
+                                    T o = (T) item.getClass().newInstance();
+                                    BeanUtil.copyProperties(item, o);
+                                    Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
+                                    setUniqueName.invoke(o, thirdEntry.getKey());
+                                    retList.add(o);
+                                }
+                            }
+
+                        } else {
+                            List<String> standNames = new ArrayList<>(subMap.get(hisDetailName).keySet());
+                            for (String stdName : standNames) {
+                                T o = (T) item.getClass().newInstance();
+                                BeanUtil.copyProperties(item, o);
+                                Method setUniqueName = o.getClass().getMethod("set" + propertyName, String.class);
+                                setUniqueName.invoke(o, stdName);
+                                retList.add(o);
+                            }
+                        }
+                    } else {
+                        retList.add(item);
+                    }
+                } else {
+                    if (propertyName.equals("UniqueName")) {
+                        if (StringUtil.isNotBlank(hisDetailName)) {
+                            BeanUtils.copyProperty(item, "uniqueName", hisDetailName);
+                        } else {
+                            BeanUtils.copyProperty(item, "uniqueName", name);
+                        }
+                    }
+                    retList.add(item);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return retList;
+    }
+
     /**
      * 生成给图谱的入参(推送)
      */
@@ -963,9 +1068,9 @@ public class CommonFacade {
         /**************************化验结构化处理开始*****************************/
         List<Lis> lisList = new ArrayList<>();
         // 处理主诉化验
-        getLisStruct(wordCrfDTO.getChiefLabel().getLises(), lisList, wordCrfDTO.getHospitalId());
+        getLisStruct(wordCrfDTO.getChiefLabel().getLises(), lisList);
         // 处理现病史化验
-        getLisStruct(wordCrfDTO.getPresentLabel().getLises(), lisList, wordCrfDTO.getHospitalId());
+        getLisStruct(wordCrfDTO.getPresentLabel().getLises(), lisList);
         // 统一放置化验结构
         if (ListUtil.isNotEmpty(lisList)) {
             wordCrfDTO.getLis().addAll(lisList);
@@ -979,6 +1084,16 @@ public class CommonFacade {
         getPacsStruct(pacsLabel, wordCrfDTO.getChiefLabel().getPacsLabel());
         // 处理现病史辅检
         getPacsStruct(pacsLabel, wordCrfDTO.getPresentLabel().getPacsLabel());
+        //结构化pacs
+        List<com.diagbot.biz.push.entity.Pacs> pacs = wordCrfDTO.getPacs();
+        if (ListUtil.isNotEmpty(pacs)) {
+            pacs.forEach(p -> {
+                Item item = new Item();
+                item.setName(p.getName() == null ? "" : p.getName());
+                item.setUniqueName(p.getUniqueName() == null ? "" : p.getUniqueName());
+                pacsLabel.getItem().add(item);
+            });
+        }
         // 辅检结果去重
         if (ListUtil.isNotEmpty(pacsLabel.getRes())) {
             dealMsgWithItem(pacsLabel.getRes());
@@ -1011,8 +1126,8 @@ public class CommonFacade {
         if (ListUtil.isNotEmpty(res.getDisease())) {
             for (Pacs pacs : res.getDisease()) {
                 Item item = new Item();
-                item.setName(pacs.getName());
-                item.setUniqueName(pacs.getStandName());
+                item.setName(pacs.getName() == null ? "" : pacs.getName());
+                item.setUniqueName(pacs.getStandName() == null ? "" : pacs.getStandName());
                 pacsResList.add(item);
             }
         }
@@ -1052,43 +1167,17 @@ public class CommonFacade {
      *
      * @param lises
      * @param lisList
-     * @param hospitalId
      */
-    public void getLisStruct(List<com.diagbot.model.entity.Lis> lises, List<Lis> lisList, Long hospitalId) {
+    public void getLisStruct(List<com.diagbot.model.entity.Lis> lises, List<Lis> lisList) {
         if (ListUtil.isNotEmpty(lises)) {
-            List<String> lisNames = lises.stream().map(x -> x.getBigItem().getName()).distinct().collect(Collectors.toList());
-            Map<String, Map<String, Map<String, Long>>> configMap = lisConfigFacade.getConfigMap(hospitalId, lisNames, null);
-            if (configMap.size() > 0) {
-                lises.stream().forEach(x -> {
-                    String bigName = x.getBigItem().getName();//大项名
-                    String detailName = x.getName();//小项名
-                    String value = x.getPd().getValue();
-                    String unit = x.getPd().getUnit();
-                    if (configMap.containsKey(bigName)) {
-                        Map<String, Map<String, Long>> uniqueDetailMap = configMap.get(bigName);
-                        if (uniqueDetailMap.containsKey(detailName)) {
-                            List<String> uniques = uniqueDetailMap.get(detailName).keySet().stream().collect(Collectors.toList());//所有的公表项
-                            if (ListUtil.isNotEmpty(uniques)) {
-                                List<Lis> lisStream = uniques.stream().map(z -> {
-                                    return getLis(bigName, detailName, value, unit, z);
-                                }).collect(Collectors.toList());
-                                lisList.addAll(lisStream);
-                            }
-                        } else {
-                            Lis lis = getLis(bigName, detailName, value, unit, null);
-                            lisList.add(lis);
-                        }
-                    } else {
-                        Lis lis = getLis(bigName, detailName, value, unit, null);
-                        lisList.add(lis);
-                    }
-                });
-            } else {
-                lises.stream().forEach(x -> {
-                    Lis lis = getLis(x.getBigItem().getName(), x.getName(), x.getPd().getValue(), x.getPd().getUnit(), null);
-                    lisList.add(lis);
-                });
-            }
+            lises.stream().forEach(x -> {
+                String bigName = x.getBigItem().getName();//大项名
+                String detailName = x.getName();//小项名
+                String value = x.getPd().getValue();
+                String unit = x.getPd().getUnit();
+                String standName = x.getStandName();
+                lisList.add(getLis(bigName, detailName, value, unit, standName));
+            });
         }
     }
 

+ 312 - 91
src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -6,16 +6,21 @@ import com.diagbot.dto.IndexBatchDTO;
 import com.diagbot.dto.KllisDetailDTO;
 import com.diagbot.entity.KlConcept;
 import com.diagbot.entity.KlDisease;
+import com.diagbot.entity.KlLibraryInfo;
+import com.diagbot.entity.KlOperation;
 import com.diagbot.entity.TcmDisease;
 import com.diagbot.entity.TcmSyndrome;
+import com.diagbot.enums.ConceptTypeEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.MatchSourceEnum;
 import com.diagbot.enums.StatusEnum;
 import com.diagbot.service.impl.KlConceptServiceImpl;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.FilterVO;
 import com.diagbot.vo.KllisDetailVO;
 import com.diagbot.vo.SearchConceptVO;
 import com.google.common.collect.Lists;
@@ -23,8 +28,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -40,9 +45,13 @@ public class KlConceptFacade extends KlConceptServiceImpl {
     @Autowired
     private KlDiseaseFacade klDiseaseFacade;
     @Autowired
+    private KlOperationFacade klOperationFacade;
+    @Autowired
     private TcmDiseaseFacade tcmDiseaseFacade;
     @Autowired
     private TcmSyndromeFacade tcmSyndromeFacade;
+    @Autowired
+    private KlLibraryInfoFacade klLibraryInfoFacade;
 
     /**
      * 批量校验标准术语
@@ -51,122 +60,334 @@ public class KlConceptFacade extends KlConceptServiceImpl {
      * @return
      */
     public List<IndexBatchDTO> getConceptNames(ConceptVO conceptVO) {
-        if (ListUtil.isEmpty(conceptVO.getNames())) {
-            return new ArrayList<>();
-        }
         List<IndexBatchDTO> retList = Lists.newLinkedList();
-        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
-        Integer type = convertType(conceptVO.getType());
-
-        QueryWrapper<KlConcept> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .in("lib_name", conceptVO.getNames());
-        if (conceptVO.getType().equals(3)) {
-            //辅检同时检索辅检项目和辅检子项
-            queryWrapper.in("lib_type", Arrays.asList(LexiconEnum.PacsName.getKey(), LexiconEnum.PacsSubName.getKey()));
-        } else {
-            queryWrapper.eq("lib_type", type);
-        }
-        List<KlConcept> concepts = this.list(queryWrapper);
+        Integer type = convertType(conceptVO.getType(), false);
 
-        if (ListUtil.isNotEmpty(concepts)) {
+        if (conceptVO.getSource().equals(-1)) {
+            if (ListUtil.isEmpty(conceptVO.getIds())) {
+                return retList;
+            }
+            //根据id检索
+            List<KlConcept> concepts = this.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    //.eq("status", StatusEnum.Enable.getKey())
+                    .in("id", conceptVO.getIds()));
             for (KlConcept concept : concepts) {
                 IndexBatchDTO dto = new IndexBatchDTO();
                 dto.setId(concept.getId());
                 dto.setName(concept.getLibName());
+                dto.setType(convertType(concept.getLibType(), true));
                 retList.add(dto);
             }
+        } else if (conceptVO.getSource().equals(MatchSourceEnum.StandWord.getKey())) {
+            QueryWrapper<KlConcept> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+            //.eq("status", StatusEnum.Enable.getKey());
+            if (ListUtil.isNotEmpty(conceptVO.getNames())) {
+                queryWrapper.in("lib_name", conceptVO.getNames());
+            }
+            if (conceptVO.getType().equals(ConceptTypeEnum.Pacs.getKey())) {
+                //辅检同时检索辅检项目和辅检子项
+                queryWrapper.in("lib_type", Arrays.asList(LexiconEnum.PacsName.getKey(), LexiconEnum.PacsSubName.getKey()));
+            } else {
+                queryWrapper.eq("lib_type", type);
+            }
+            List<KlConcept> concepts = this.list(queryWrapper);
+
+            if (ListUtil.isNotEmpty(concepts)) {
+                for (KlConcept concept : concepts) {
+                    IndexBatchDTO dto = new IndexBatchDTO();
+                    dto.setId(concept.getId());
+                    dto.setName(concept.getLibName());
+                    retList.add(dto);
+                }
+            }
+        } else if (conceptVO.getSource().equals(MatchSourceEnum.SynonymsWord.getKey())) {
+            if (ListUtil.isEmpty(conceptVO.getNames())) {
+                return retList;
+            }
+            QueryWrapper<KlLibraryInfo> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("is_concept", 0)
+                    .in("name", conceptVO.getNames());
+            if (conceptVO.getType().equals(ConceptTypeEnum.Pacs.getKey())) {
+                //辅检同时检索辅检项目和辅检子项
+                queryWrapper.in("type_id", Arrays.asList(LexiconEnum.PacsName.getKey(), LexiconEnum.PacsSubName.getKey()));
+            } else {
+                queryWrapper.eq("type_id", type);
+            }
+            List<KlLibraryInfo> libratyInfos = klLibraryInfoFacade.list(queryWrapper);
+            if (ListUtil.isEmpty(libratyInfos)) {
+                return retList;
+            }
+            Map<Long, List<KlLibraryInfo>> libraryInfoMap
+                    = libratyInfos.stream().collect(Collectors.groupingBy(KlLibraryInfo::getConceptId));
+            List<Long> synonymsRelatedConceptIds
+                    = libratyInfos.stream().map(KlLibraryInfo::getConceptId).collect(Collectors.toList());
+            List<KlConcept> synonymsRelatedConcepts = this.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    //.eq("status", StatusEnum.Enable.getKey())
+                    .in("id", synonymsRelatedConceptIds));
+            Map<Long, KlConcept> conceptMap
+                    = synonymsRelatedConcepts.stream().collect(Collectors.toMap(KlConcept::getId, v -> v));
+
+            if (conceptMap != null && conceptMap.size() > 0) {
+                for (Map.Entry<Long, KlConcept> entry : conceptMap.entrySet()) {
+                    KlConcept concept = entry.getValue();
+                    if (libraryInfoMap.containsKey(entry.getKey())) {
+                        for (KlLibraryInfo libraryInfo : libraryInfoMap.get(entry.getKey())) {
+                            if (!conceptVO.getNames().contains(libraryInfo.getName())) {
+                                continue;
+                            }
+                            IndexBatchDTO indexBatchDTO = new IndexBatchDTO();
+                            indexBatchDTO.setId(concept.getId());
+                            indexBatchDTO.setName(concept.getLibName());
+                            indexBatchDTO.setSynonyms(libraryInfo.getName());
+                            retList.add(indexBatchDTO);
+                        }
+                    }
+                }
+            }
+        } else if (conceptVO.getSource().equals(MatchSourceEnum.Code.getKey())) {
+            if (ListUtil.isEmpty(conceptVO.getNames())) {
+                return retList;
+            }
+            List<Long> conceptIds = Lists.newArrayList();
+            Map<Long, List<String>> codeMap = new HashMap<>();
+            if (type.equals(LexiconEnum.Disease.getKey())) {
+                List<KlDisease> diseases = klDiseaseFacade.list(new QueryWrapper<KlDisease>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .in("icd10_code", conceptVO.getNames()));
+                if (ListUtil.isNotEmpty(diseases)) {
+                    conceptIds = diseases.stream().map(KlDisease::getConceptId).distinct().collect(Collectors.toList());
+                    codeMap = diseases.stream()
+                            .collect(Collectors.groupingBy(KlDisease::getConceptId,
+                                    Collectors.mapping(KlDisease::getIcd10Code, Collectors.toList())));
+                }
+            } else if (type.equals(LexiconEnum.Operation.getKey())) {
+                List<KlOperation> operations = klOperationFacade.list(new QueryWrapper<KlOperation>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .in("operation_code", conceptVO.getNames()));
+                if (ListUtil.isNotEmpty(operations)) {
+                    conceptIds = operations.stream().map(KlOperation::getConceptId).distinct().collect(Collectors.toList());
+                    codeMap = operations.stream()
+                            .collect(Collectors.groupingBy(KlOperation::getConceptId,
+                                    Collectors.mapping(KlOperation::getOperationCode, Collectors.toList())));
+                }
+            } else if (type.equals(LexiconEnum.Tcmdisease.getKey())) {
+                List<TcmDisease> tcmDiseases = tcmDiseaseFacade.list(new QueryWrapper<TcmDisease>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .in("code", conceptVO.getNames()));
+                if (ListUtil.isNotEmpty(tcmDiseases)) {
+                    conceptIds = tcmDiseases.stream().map(TcmDisease::getConceptId).distinct().collect(Collectors.toList());
+                    codeMap = tcmDiseases.stream().collect(Collectors.groupingBy(TcmDisease::getConceptId,
+                            Collectors.mapping(TcmDisease::getCode, Collectors.toList())));
+                }
+            } else if (type.equals(LexiconEnum.Tcmsyndrome.getKey())) {
+                List<TcmSyndrome> tcmSyndromes = tcmSyndromeFacade.list(new QueryWrapper<TcmSyndrome>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .in("code", conceptVO.getNames()));
+                if (ListUtil.isNotEmpty(tcmSyndromes)) {
+                    conceptIds = tcmSyndromes.stream().map(TcmSyndrome::getConceptId).distinct().collect(Collectors.toList());
+                    codeMap = tcmSyndromes.stream().collect(Collectors.groupingBy(TcmSyndrome::getConceptId,
+                            Collectors.mapping(TcmSyndrome::getCode, Collectors.toList())));
+                }
+            }
+            List<KlConcept> concepts = this.list(new QueryWrapper<KlConcept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    //.eq("status", StatusEnum.Enable.getKey())
+                    .in("id", conceptIds));
+            Map<Long, KlConcept> conceptMap
+                    = concepts.stream().collect(Collectors.toMap(KlConcept::getId, v -> v));
+            if (conceptMap != null && conceptMap.size() > 0) {
+                for (Map.Entry<Long, KlConcept> entry : conceptMap.entrySet()) {
+                    KlConcept concept = entry.getValue();
+                    if (codeMap.containsKey(entry.getKey())) {
+                        for (String code : codeMap.get(entry.getKey())) {
+                            if (!conceptVO.getNames().contains(code)) {
+                                continue;
+                            }
+                            IndexBatchDTO indexBatchDTO = new IndexBatchDTO();
+                            indexBatchDTO.setId(concept.getId());
+                            indexBatchDTO.setName(concept.getLibName());
+                            indexBatchDTO.setCode(code);
+                            retList.add(indexBatchDTO);
+                        }
+                    }
+                }
+            }
         }
 
         if (ListUtil.isEmpty(retList)) {
             return retList;
         }
+        //关联编码
         List<Long> conceptIds = retList.stream().map(IndexBatchDTO::getId).collect(Collectors.toList());
-
-        if (type.equals(LexiconEnum.Disease.getKey())) {
-            List<KlDisease> diseases = klDiseaseFacade.list(new QueryWrapper<KlDisease>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("concept_id", conceptIds));
-            if (ListUtil.isNotEmpty(diseases)) {
-                Map<Long, KlDisease> idMap = diseases.stream().collect(Collectors.toMap(KlDisease::getConceptId, v -> v));
-                for (IndexBatchDTO dto : retList) {
-                    if (idMap.containsKey(dto.getId())) {
-                        dto.setCode(idMap.get(dto.getId()).getIcd10Code());
-                    }
+        //诊断关联编码
+        List<KlDisease> diseases = klDiseaseFacade.list(new QueryWrapper<KlDisease>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("concept_id", conceptIds));
+        if (ListUtil.isNotEmpty(diseases)) {
+            Map<Long, KlDisease> idMap = diseases.stream().collect(Collectors.toMap(KlDisease::getConceptId, v -> v));
+            for (IndexBatchDTO dto : retList) {
+                if (idMap.containsKey(dto.getId())) {
+                    dto.setCode(idMap.get(dto.getId()).getIcd10Code());
                 }
             }
-        } else if (type.equals(LexiconEnum.Tcmdisease.getKey())) {
-            List<TcmDisease> tcmDiseases = tcmDiseaseFacade.list(new QueryWrapper<TcmDisease>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("concept_id", conceptIds));
-            if (ListUtil.isNotEmpty(tcmDiseases)) {
-                Map<Long, TcmDisease> idMap = tcmDiseases.stream().collect(Collectors.toMap(TcmDisease::getConceptId, v -> v));
-                for (IndexBatchDTO dto : retList) {
-                    if (idMap.containsKey(dto.getId())) {
-                        dto.setCode(idMap.get(dto.getId()).getCode());
-                    }
+        }
+        //手术关联编码
+        List<KlOperation> operations = klOperationFacade.list(new QueryWrapper<KlOperation>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("concept_id", conceptIds));
+        if (ListUtil.isNotEmpty(operations)) {
+            Map<Long, KlOperation> idMap = operations.stream().collect(Collectors.toMap(KlOperation::getConceptId, v -> v));
+            for (IndexBatchDTO dto : retList) {
+                if (idMap.containsKey(dto.getId())) {
+                    dto.setCode(idMap.get(dto.getId()).getOperationCode());
                 }
             }
-        } else if (type.equals(LexiconEnum.Tcmsyndrome.getKey())) {
-            List<TcmSyndrome> tcmSyndromes = tcmSyndromeFacade.list(new QueryWrapper<TcmSyndrome>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .in("concept_id", conceptIds));
-            if (ListUtil.isNotEmpty(tcmSyndromes)) {
-                Map<Long, TcmSyndrome> idMap = tcmSyndromes.stream().collect(Collectors.toMap(TcmSyndrome::getConceptId, v -> v));
-                for (IndexBatchDTO dto : retList) {
-                    if (idMap.containsKey(dto.getId())) {
-                        dto.setCode(idMap.get(dto.getId()).getCode());
-                    }
+        }
+        //中医疾病关联编码
+        List<TcmDisease> tcmDiseases = tcmDiseaseFacade.list(new QueryWrapper<TcmDisease>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("concept_id", conceptIds));
+        if (ListUtil.isNotEmpty(tcmDiseases)) {
+            Map<Long, TcmDisease> idMap = tcmDiseases.stream().collect(Collectors.toMap(TcmDisease::getConceptId, v -> v));
+            for (IndexBatchDTO dto : retList) {
+                if (idMap.containsKey(dto.getId())) {
+                    dto.setCode(idMap.get(dto.getId()).getCode());
                 }
             }
         }
+        //中医证候关联编码
+        List<TcmSyndrome> tcmSyndromes = tcmSyndromeFacade.list(new QueryWrapper<TcmSyndrome>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("concept_id", conceptIds));
+        if (ListUtil.isNotEmpty(tcmSyndromes)) {
+            Map<Long, TcmSyndrome> idMap = tcmSyndromes.stream().collect(Collectors.toMap(TcmSyndrome::getConceptId, v -> v));
+            for (IndexBatchDTO dto : retList) {
+                if (idMap.containsKey(dto.getId())) {
+                    dto.setCode(idMap.get(dto.getId()).getCode());
+                }
+            }
+        }
+        return retList;
+    }
 
+    /**
+     * 术语模糊检索
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<IndexBatchDTO> filter(FilterVO filterVO) {
+        List<IndexBatchDTO> retList = Lists.newArrayList();
+        List<KlConcept> klConcepts = this.list(new QueryWrapper<KlConcept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                //.eq("status", StatusEnum.Enable.getKey())
+                .like("lib_name", filterVO.getInputStr()));
+        for (KlConcept concept : klConcepts) {
+            IndexBatchDTO indexBatchDTO = new IndexBatchDTO();
+            indexBatchDTO.setId(concept.getId());
+            indexBatchDTO.setName(concept.getLibName());
+            Integer type = convertType(concept.getLibType(), true);
+            if (type != null) {
+                indexBatchDTO.setType(type);
+                retList.add(indexBatchDTO);
+            }
+        }
         return retList;
     }
 
 
-    public Integer convertType(Integer type) {
+    /**
+     * 类型互转
+     *
+     * @param type
+     * @param reverse
+     * @return
+     */
+    public Integer convertType(Integer type, Boolean reverse) {
         Integer retType = null;
-        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
-        switch (type) {
-            case 1:
-                retType = LexiconEnum.LisName.getKey();
-                break;
-            case 2:
-                retType = LexiconEnum.LisSubName.getKey();
-                break;
-            case 3:
-                retType = LexiconEnum.PacsName.getKey();
-                break;
-            case 4:
-                retType = LexiconEnum.Disease.getKey();
-                break;
-            case 5:
-                retType = LexiconEnum.Medicine.getKey();
-                break;
-            case 6:
-                retType = LexiconEnum.Operation.getKey();
-                break;
-            case 7:
-                retType = LexiconEnum.Dept.getKey();
-                break;
-            case 8:
-                retType = LexiconEnum.Transfusion.getKey();
-                break;
-            case 10:
-                retType = LexiconEnum.Scale.getKey();
-                break;
-            case 11:
-                retType = LexiconEnum.Nurse.getKey();
-                break;
-            case 12:
-                retType = LexiconEnum.Tcmdisease.getKey();
-                break;
-            case 13:
-                retType = LexiconEnum.Tcmsyndrome.getKey();
-                break;
-            default:
-                break;
+        if (type == null) {
+            return retType;
+        }
+        if (reverse) {
+            if (type.equals(LexiconEnum.LisName.getKey())
+                    || type.equals(LexiconEnum.LisSubName.getKey())) {
+                retType = ConceptTypeEnum.LisPack.getKey();
+            } else if (type.equals(LexiconEnum.PacsName.getKey())
+                    || type.equals(LexiconEnum.PacsSubName.getKey())) {
+                retType = ConceptTypeEnum.Pacs.getKey();
+            } else if (type.equals(LexiconEnum.Disease.getKey())) {
+                retType = ConceptTypeEnum.Disease.getKey();
+            } else if (type.equals(LexiconEnum.Medicine.getKey())) {
+                retType = ConceptTypeEnum.Drug.getKey();
+            } else if (type.equals(LexiconEnum.Operation.getKey())) {
+                retType = ConceptTypeEnum.Operation.getKey();
+            } else if (type.equals(LexiconEnum.Dept.getKey())) {
+                retType = ConceptTypeEnum.Dept.getKey();
+            } else if (type.equals(LexiconEnum.Transfusion.getKey())) {
+                retType = ConceptTypeEnum.Transfusion.getKey();
+            } else if (type.equals(LexiconEnum.Scale.getKey())) {
+                retType = ConceptTypeEnum.Scale.getKey();
+            } else if (type.equals(LexiconEnum.Nurse.getKey())) {
+                retType = ConceptTypeEnum.Nurse.getKey();
+            } else if (type.equals(LexiconEnum.Tcmdisease.getKey())) {
+                retType = ConceptTypeEnum.Tcmdisease.getKey();
+            } else if (type.equals(LexiconEnum.Tcmsyndrome.getKey())) {
+                retType = ConceptTypeEnum.Tcmsyndrome.getKey();
+            } else if (type.equals(LexiconEnum.Anesthesia.getKey())) {
+                retType = ConceptTypeEnum.Anesthesia.getKey();
+            } else if (type.equals(LexiconEnum.Form.getKey())) {
+                retType = ConceptTypeEnum.Form.getKey();
+            }
+        } else {
+            switch (type) {
+                case 1:
+                    retType = LexiconEnum.LisName.getKey();
+                    break;
+                case 2:
+                    retType = LexiconEnum.LisSubName.getKey();
+                    break;
+                case 3:
+                    retType = LexiconEnum.PacsName.getKey();
+                    break;
+                case 4:
+                    retType = LexiconEnum.Disease.getKey();
+                    break;
+                case 5:
+                    retType = LexiconEnum.Medicine.getKey();
+                    break;
+                case 6:
+                    retType = LexiconEnum.Operation.getKey();
+                    break;
+                case 7:
+                    retType = LexiconEnum.Dept.getKey();
+                    break;
+                case 8:
+                    retType = LexiconEnum.Transfusion.getKey();
+                    break;
+                case 10:
+                    retType = LexiconEnum.Scale.getKey();
+                    break;
+                case 11:
+                    retType = LexiconEnum.Nurse.getKey();
+                    break;
+                case 12:
+                    retType = LexiconEnum.Tcmdisease.getKey();
+                    break;
+                case 13:
+                    retType = LexiconEnum.Tcmsyndrome.getKey();
+                    break;
+                case 14:
+                    retType = LexiconEnum.Anesthesia.getKey();
+                    break;
+                case 15:
+                    retType = LexiconEnum.Form.getKey();
+                default:
+                    break;
+            }
         }
         return retType;
     }
@@ -202,4 +423,4 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         Map<String, KllisDetailDTO> res = EntityUtil.makeEntityMap(list, "libName");
         return res;
     }
-}
+}

+ 15 - 9
src/main/java/com/diagbot/facade/KlConceptStaticFacade.java

@@ -95,7 +95,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         StaticKnowledgeDTO staticKnowledgeDTO = new StaticKnowledgeDTO();
         Integer type = convertType(staticKnowledgeVO.getType(), 1);
         if (type == null) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确类型(1-诊断、2-药品、3-检验套餐、4-检验细项、5-检查、6-检查子项、7-手术和操作、8-量表、9-护理)");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确类型(1-诊断、2-药品、3-检验套餐、4-检验细项、5-检查、6-检查子项、7-手术和操作、8-量表、9-护理、10-政策法规)");
         }
         staticKnowledgeVO.setType(type);
 
@@ -346,7 +346,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
     public IPage<StaticKnowledgeIndexPageDTO> staticIndexPage(StaticKnowledgeIndexPageVO staticKnowledgeIndexPageVO) {
         //默认查找全部
         if (ListUtil.isEmpty(staticKnowledgeIndexPageVO.getTypes())) {
-            staticKnowledgeIndexPageVO.setTypeIds(Arrays.asList(new Integer[] { 0 }));
+            staticKnowledgeIndexPageVO.setTypeIds(Arrays.asList(0));
         }
         staticKnowledgeIndexPageVO.setTypeIds(new ArrayList<>());
 
@@ -359,7 +359,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         //检索类型(多选):0-全部、1-诊断、2-药品、3-检验、4-检查、5-手术和操作
         if (ListUtil.isEmpty(types)
                 || (ListUtil.isNotEmpty(types) && types.contains(0))) {
-            staticKnowledgeIndexPageVO.getTypeIds().addAll(Arrays.asList(new Integer[] { LexiconEnum.Disease.getKey(),
+            staticKnowledgeIndexPageVO.getTypeIds().addAll(Arrays.asList(LexiconEnum.Disease.getKey(),
                     LexiconEnum.Medicine.getKey(),
                     LexiconEnum.LisName.getKey(),
                     LexiconEnum.LisSubName.getKey(),
@@ -367,7 +367,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
                     LexiconEnum.PacsSubName.getKey(),
                     LexiconEnum.Operation.getKey(),
                     LexiconEnum.Scale.getKey(),
-                    LexiconEnum.Nurse.getKey() }));
+                    LexiconEnum.Nurse.getKey(),
+                    LexiconEnum.Law.getKey()));
         } else {
             if (types.contains(1)) {
                 staticKnowledgeIndexPageVO.getTypeIds().add(LexiconEnum.Disease.getKey());
@@ -392,9 +393,12 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
             if (types.contains(9)) {
                 staticKnowledgeIndexPageVO.getTypeIds().add(LexiconEnum.Nurse.getKey());
             }
+            if (types.contains(10)) {
+                staticKnowledgeIndexPageVO.getTypeIds().add(LexiconEnum.Law.getKey());
+            }
         }
         if (ListUtil.isEmpty(staticKnowledgeIndexPageVO.getTypeIds())) {
-            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确的检索类型(多选):0-全部、1-诊断、2-药品、3-检验、4-检查、7-手术和操作、8-量表、9-护理");
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确的检索类型(多选):0-全部、1-诊断、2-药品、3-检验、4-检查、7-手术和操作、8-量表、9-护理、10-政策法规");
         }
         IPage<StaticKnowledgeIndexPageDTO> page = super.staticIndexPage(staticKnowledgeIndexPageVO);
 
@@ -665,10 +669,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
         List<KlConceptScale> scales = klConceptScaleFacade.list(new QueryWrapper<KlConceptScale>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("concept_id", concept.getId()));
-        if (ListUtil.isEmpty(scales)) {
-            return false;
-        }
-        return true;
+        return !ListUtil.isEmpty(scales);
     }
 
     /**
@@ -713,6 +714,9 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
                 case 9:
                     retType = LexiconEnum.Nurse.getKey();
                     break;
+                case 10:
+                    retType = LexiconEnum.Law.getKey();
+                    break;
                 default:
                     break;
             }
@@ -735,6 +739,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
                 retType = 8;
             } else if (type.equals(LexiconEnum.Nurse.getKey())) {
                 retType = 9;
+            } else if (type.equals(LexiconEnum.Law.getKey())) {
+                retType = 10;
             }
         }
         return retType;

+ 1 - 1
src/main/java/com/diagbot/facade/KlDiagnoseDetailFacade.java

@@ -312,6 +312,6 @@ public class KlDiagnoseDetailFacade {
         String pateern = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
         String content = formulas.stream().collect(Collectors.joining(","));
         //获取公式中的编码
-        return RegexUtil.getRegexDatas(content, pateern);
+        return RegexUtil.getRegexDataAll(content, pateern);
     }
 }

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

@@ -1,6 +1,10 @@
 package com.diagbot.facade;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.TermConceptDTO;
+import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.service.impl.KlLibraryInfoServiceImpl;
+import com.diagbot.vo.TermMatchingVO;
 import org.springframework.stereotype.Component;
 
 /**
@@ -10,4 +14,5 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class KlLibraryInfoFacade extends KlLibraryInfoServiceImpl {
+
 }

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

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

+ 1 - 0
src/main/java/com/diagbot/facade/KlRuleFacade.java

@@ -213,6 +213,7 @@ public class KlRuleFacade extends KlRuleServiceImpl {
                     klRuleCondition.setGroupType(list.getGroupType());
                     klRuleCondition.setRuleBaseId(klRuleBase.getId());
                     klRuleCondition.setRuleId(klRuleInfoSaveVO.getParId());
+                    klRuleCondition.setMsg(list.getSubMsg());
                     res = klRuleConditionFacade.save(klRuleCondition);
                 }
 

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

@@ -1,139 +0,0 @@
-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:
- * @Author:zhaops
- * @time: 2020/7/29 15:03
- */
-@Component
-public class LisConfigFacade extends LisConfigServiceImpl {
-
-    /**
-     * 获取映射关系-id
-     * Map<hisName,Map<hisDetailName,Map<uniqueName,id>>>
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, Map<String, Long>>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Map<String, Long>>> retMap = new HashMap<>();
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        if (ListUtil.isNotEmpty(hisNames)) {
-            queryWrapper.in("his_name", hisNames);
-        }
-        if (ListUtil.isNotEmpty(uniqueNames)) {
-            queryWrapper.in("unique_name", uniqueNames);
-        }
-        List<LisConfig> records = this.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-
-        records.forEach(lisConfig -> {
-            if (lisConfig.getHisDetailName() == null) {
-                lisConfig.setHisDetailName("");
-            }
-        });
-
-        Map<String, List<LisConfig>> hisNameMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<LisConfig>> entry : hisNameMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                Map<String, Map<String, Long>> detailNameMap = new HashMap<>();
-                //his名称映射到标准词,1:n
-                Map<String, List<LisConfig>> hisDetailNameMap
-                        = EntityUtil.makeEntityListMap(entry.getValue(), "hisDetailName");
-                for (Map.Entry<String, List<LisConfig>> detailEntry : hisDetailNameMap.entrySet()) {
-                    if (ListUtil.isNotEmpty(detailEntry.getValue())) {
-                        detailNameMap.put(detailEntry.getKey(),
-                                EntityUtil.makeMapWithKeyValue(detailEntry.getValue(), "uniqueName", "id"));
-                    }
-                }
-                retMap.put(entry.getKey(), detailNameMap);
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 已映射
-     *
-     * @param name
-     * @return
-     */
-    public Boolean isMapping(String name) {
-        QueryWrapper<LisConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", name);
-        List<LisConfig> records = this.list(queryWrapper);
-        if (ListUtil.isNotEmpty(records)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * 标准术语名称修改
-     *
-     * @param oldName
-     * @param newName
-     * @return
-     */
-    public Boolean updateUniqueName(String oldName, String newName) {
-        UpdateWrapper<LisConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", oldName)
-                .set("unique_name", newName);
-        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();
-    }
-}

+ 163 - 0
src/main/java/com/diagbot/facade/MappingConfigFacade.java

@@ -0,0 +1,163 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.IndexBatchDTO;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.MappingConfigService;
+import com.diagbot.service.impl.MappingConfigServiceImpl;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.ConceptVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/9 14:19
+ */
+@Component
+public class MappingConfigFacade extends MappingConfigServiceImpl {
+
+    private static Pattern pattern = Pattern.compile("\\s*|\t|\r|\n");
+
+    @Autowired
+    @Qualifier("mappingConfigServiceImpl")
+    private MappingConfigService mappingConfigService;
+
+    @Autowired
+    private KlConceptFacade klConceptFacade;
+
+
+    /**
+     * 根据医院名称分组-返回id
+     *
+     * @param hisNames
+     * @param type
+     * @return
+     */
+    public Map<String, Map<String, Map<Long, List<Long>>>> groupByHisNameWithId(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<Long, List<Long>>>> retMap = new HashMap<>();
+        QueryWrapper<MappingConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("is_match", 1)
+                .eq("type", type);
+        if (hospitalId != null) {
+            queryWrapper.eq("hospital_id", hospitalId);
+        }
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        List<MappingConfig> list = this.list(queryWrapper);
+
+        if (ListUtil.isEmpty(list)) {
+            return retMap;
+        }
+
+        for (MappingConfig item : list) {
+            if (StringUtil.isBlank(item.getHisDetailName())) {
+                item.setHisDetailName("");
+            }
+        }
+
+        Map<String, List<MappingConfig>> hisMap = list.stream().collect(Collectors.groupingBy(MappingConfig::getHisName));
+        for (Map.Entry<String, List<MappingConfig>> entry : hisMap.entrySet()) {
+            Map<String, Map<Long, List<Long>>> subMap = new HashMap<>();
+            Map<String, List<MappingConfig>> detailMap = entry.getValue().stream()
+                    .collect(Collectors.groupingBy(MappingConfig::getHisDetailName));
+            for (Map.Entry<String, List<MappingConfig>> subEntry : detailMap.entrySet()) {
+                subMap.put(subEntry.getKey(), subEntry.getValue().stream().collect(Collectors.groupingBy(MappingConfig::getConceptId,
+                        Collectors.mapping(MappingConfig::getFormConceptId, Collectors.toList()))));
+            }
+            retMap.put(entry.getKey(), subMap);
+        }
+        return retMap;
+    }
+
+    /**
+     * 根据医院名称分组-返回名称
+     *
+     * @param hisNames
+     * @param type
+     * @param hospitalId
+     * @return
+     */
+    public Map<String, Map<String, Map<String, List<String>>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
+        Map<String, Map<String, Map<Long, List<Long>>>> idMap = groupByHisNameWithId(hisNames, type, hospitalId);
+
+        //conceptIds
+        List<Long> ids = idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
+                .map(i -> i.keySet())
+                .flatMap(Collection::stream)
+                .filter(i -> i != null)
+                .distinct()
+                .collect(Collectors.toList());
+
+        //formConceptId
+        ids.addAll(idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
+                .flatMap(i -> i.values().stream())
+                .flatMap(Collection::stream)
+                .filter(i -> i != null)
+                .distinct()
+                .collect(Collectors.toList()));
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(-1);
+        conceptVO.setType(type);
+        conceptVO.setIds(ids);
+        List<IndexBatchDTO> respDTO = klConceptFacade.getConceptNames(conceptVO);
+        List<IndexBatchDTO> indexList = respDTO;
+        if (ListUtil.isNotEmpty(indexList)) {
+            Map<Long, List<IndexBatchDTO>> indexMap
+                    = indexList.stream().collect(Collectors.groupingBy(IndexBatchDTO::getId));
+            for (Map.Entry<String, Map<String, Map<Long, List<Long>>>> entry : idMap.entrySet()) {
+                Map<String, Map<String, List<String>>> subMap = new HashMap<>();
+                for (Map.Entry<String, Map<Long, List<Long>>> subEntry : entry.getValue().entrySet()) {
+                    Map<String, List<String>> thirdMap = new HashMap<>();
+                    List<String> uniqueNames = Lists.newArrayList();
+                    List<String> forms = Lists.newArrayList();
+                    for (Long conceptId : subEntry.getValue().keySet()) {
+                        uniqueNames.addAll(indexMap.get(conceptId).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
+                    }
+                    List<Long> formConceptIds = subEntry.getValue().values()
+                            .stream()
+                            .flatMap(Collection::stream)
+                            .distinct()
+                            .collect(Collectors.toList());
+                    for (Long formConceptId : formConceptIds) {
+                        if (formConceptId == null) {
+                            forms.add("");
+                        } else {
+                            forms.addAll(indexMap.get(formConceptId).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
+                        }
+                    }
+                    forms = forms.stream().distinct().collect(Collectors.toList());
+                    for (String uniqueName : uniqueNames) {
+                        thirdMap.put(uniqueName, forms);
+                    }
+
+                    subMap.put(subEntry.getKey(), thirdMap);
+                }
+                retMap.put(entry.getKey(), subMap);
+            }
+        }
+        return retMap;
+    }
+
+
+}

+ 41 - 18
src/main/java/com/diagbot/facade/MedRetrievalFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.LisDetailDTO;
 import com.diagbot.dto.NurseInfoDTO;
 import com.diagbot.dto.OperationInfoDTO;
+import com.diagbot.dto.RetrievalConceptDTO;
 import com.diagbot.dto.RetrievalDTO;
 import com.diagbot.dto.ScaleInfoDTO;
 import com.diagbot.dto.StaticKnowledgeIndexDTO;
@@ -30,7 +31,6 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -63,13 +63,16 @@ public class MedRetrievalFacade {
         /**
          * 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、9-症状、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉
          */
+
         switch (retrievalVO.getType()) {
             case 1:
                 medRetrievalVO.setTypeId(LexiconEnum.LisName.getKey());
                 medRetrievalVO.getTypeIds().add(LexiconEnum.LisName.getKey());
+                List<RetrievalConceptDTO> nameList = new ArrayList<>();
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setLisNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
+                    nameList = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(nameList);
                 }
                 break;
             case 2:
@@ -94,11 +97,13 @@ public class MedRetrievalFacade {
                 break;
             case 3:
                 medRetrievalVO.setTypeId(LexiconEnum.PacsName.getKey());
-                medRetrievalVO.getTypeIds().addAll(Arrays.asList(new Integer[] { LexiconEnum.PacsName.getKey(),
-                        LexiconEnum.PacsSubName.getKey() }));
+                medRetrievalVO.getTypeIds().addAll(Arrays.asList(LexiconEnum.PacsName.getKey(),
+                        LexiconEnum.PacsSubName.getKey()));
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setPacsNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
+                    List<RetrievalConceptDTO> pacsNames = new ArrayList<>();
+                    pacsNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(pacsNames);
                 }
                 break;
             case 4:
@@ -106,7 +111,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Disease.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setDiseaseNames(BeanUtil.listCopyTo(indexList, DiseaseInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 5:
@@ -114,7 +119,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Medicine.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setDrugNames(BeanUtil.listCopyTo(indexList, DrugInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 6:
@@ -122,7 +127,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Operation.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setOperationNames(BeanUtil.listCopyTo(indexList, OperationInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 7:
@@ -130,7 +135,9 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Dept.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setDeptNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
+                    List<RetrievalConceptDTO> deptNames = new ArrayList<>();
+                    deptNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(deptNames);
                 }
                 break;
             case 8:
@@ -138,7 +145,9 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Transfusion.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setTransfusionNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
+                    List<RetrievalConceptDTO> transfusionNames = new ArrayList<>();
+                    transfusionNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(transfusionNames);
                 }
                 break;
             case 9:
@@ -146,7 +155,9 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Symptom.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setSymptomNames(indexList.stream().map(i -> i.getName()).collect(Collectors.toList()));
+                    List<RetrievalConceptDTO> symptomNames = new ArrayList<>();
+                    symptomNames = BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class);
+                    retrievalDTO.setNameList(symptomNames);
                 }
                 break;
             case 10:
@@ -154,7 +165,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Scale.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setScalenames(BeanUtil.listCopyTo(indexList, ScaleInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 11:
@@ -162,7 +173,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Nurse.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setNursenames(BeanUtil.listCopyTo(indexList, NurseInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 12:
@@ -170,7 +181,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Tcmdisease.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setTcmdiseaseNames(BeanUtil.listCopyTo(indexList, TcmdiseaseInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 13:
@@ -178,7 +189,7 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Tcmsyndrome.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setTcmsyndromeNames(BeanUtil.listCopyTo(indexList, TcmsyndromeInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
             case 14:
@@ -186,7 +197,15 @@ public class MedRetrievalFacade {
                 medRetrievalVO.getTypeIds().add(LexiconEnum.Anesthesia.getKey());
                 indexList = klConceptFacade.index(medRetrievalVO);
                 if (ListUtil.isNotEmpty(indexList)) {
-                    retrievalDTO.setAnesthesiaInfonames(BeanUtil.listCopyTo(indexList, AnesthesiaInfoDTO.class));
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
+                }
+                break;
+            case 15:
+                medRetrievalVO.setTypeId(LexiconEnum.Form.getKey());
+                medRetrievalVO.getTypeIds().add(LexiconEnum.Form.getKey());
+                indexList = klConceptFacade.index(medRetrievalVO);
+                if (ListUtil.isNotEmpty(indexList)) {
+                    retrievalDTO.setNameList(BeanUtil.listCopyTo(indexList, RetrievalConceptDTO.class));
                 }
                 break;
         }
@@ -214,7 +233,7 @@ public class MedRetrievalFacade {
         //检索类型(多选):0-全部、1-诊断、2-药品、3-检验、5-检查、6-手术和操作、8-量表、9-护理
         if (ListUtil.isEmpty(types)
                 || (ListUtil.isNotEmpty(types) && types.contains(0))) {
-            staticKnowledgeIndexVO.getTypeIds().addAll(Arrays.asList(new Integer[] { LexiconEnum.Disease.getKey(),
+            staticKnowledgeIndexVO.getTypeIds().addAll(Arrays.asList(LexiconEnum.Disease.getKey(),
                     LexiconEnum.Medicine.getKey(),
                     LexiconEnum.LisName.getKey(),
                     LexiconEnum.LisSubName.getKey(),
@@ -222,7 +241,8 @@ public class MedRetrievalFacade {
                     LexiconEnum.PacsSubName.getKey(),
                     LexiconEnum.Operation.getKey(),
                     LexiconEnum.Scale.getKey(),
-                    LexiconEnum.Nurse.getKey() }));
+                    LexiconEnum.Nurse.getKey(),
+                    LexiconEnum.Law.getKey()));
         } else {
             if (types.contains(1)) {
                 staticKnowledgeIndexVO.getTypeIds().add(LexiconEnum.Disease.getKey());
@@ -247,6 +267,9 @@ public class MedRetrievalFacade {
             if (types.contains(9)) {
                 staticKnowledgeIndexVO.getTypeIds().add(LexiconEnum.Nurse.getKey());
             }
+            if (types.contains(10)) {
+                staticKnowledgeIndexVO.getTypeIds().add(LexiconEnum.Law.getKey());
+            }
         }
 
         List<StaticKnowledgeIndexDTO> retList = klConceptFacade.staticIndex(staticKnowledgeIndexVO);

+ 19 - 7
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -16,6 +16,8 @@ import com.diagbot.entity.TranHospitalFilter;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.PushRelationTypeEnum;
 import com.diagbot.enums.RedisEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.model.entity.PD;
 import com.diagbot.service.KlDiseaseCorrespondingService;
 import com.diagbot.service.SymptomFeatureService;
@@ -32,6 +34,8 @@ import com.diagbot.vo.neoPushEntity.PresentPushVo;
 import com.diagbot.vo.neoPushEntity.Symptom;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import io.github.lvyahui8.spring.facade.DataFacade;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -54,6 +58,7 @@ import static com.diagbot.util.StringUtil.permutationNoRepeat;
  * @time: 2018/8/6 9:11
  */
 @Component
+@Slf4j
 public class NeoFacade {
     @Autowired
     NeoFacade self;
@@ -482,14 +487,21 @@ public class NeoFacade {
     }
 
     public void allRuleCache() {
-        List<RuleDTO> ruleDTOList = klRuleFacade.getAllRule();
-        if (ListUtil.isNotEmpty(ruleDTOList)) {
-            Map map = ruleDTOList.stream().collect(Collectors.toMap(
-                    k -> RedisEnum.allRule.getName() + k.getLibType() + "_" + k.getLibName() + "_" + k.getRuleType(),
-                    v -> v,
-                    (v1, v2) -> (v2)
-            ));
+//        List<RuleDTO> ruleDTOList = klRuleFacade.getAllRule();
+//        if (ListUtil.isNotEmpty(ruleDTOList)) {
+//            Map map = ruleDTOList.stream().collect(Collectors.toMap(
+//                    k -> RedisEnum.allRule.getName() + k.getLibType() + "_" + k.getLibName() + "_" + k.getRuleType(),
+//                    v -> v,
+//                    (v1, v2) -> (v2)
+//            ));
+//            redisTemplate.opsForValue().multiSet(map);
+//        }
+        try {
+            Map<String, Object> invokeParams = new HashMap<>();
+            Map<String, RuleDTO> map = DataFacade.get("getAllRules", invokeParams, Map.class);
             redisTemplate.opsForValue().multiSet(map);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有规则失败" + e.getMessage());
         }
     }
 

+ 0 - 57
src/main/java/com/diagbot/facade/OperationConfigFacade.java

@@ -1,57 +0,0 @@
-package com.diagbot.facade;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.service.OperationConfigService;
-import com.diagbot.util.ListUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:05
- */
-@Component
-public class OperationConfigFacade {
-    @Autowired
-    private OperationConfigService operationConfigService;
-
-    /**
-     * 已映射
-     *
-     * @param name
-     * @return
-     */
-    public Boolean isMapping(String name) {
-        QueryWrapper<OperationConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", name);
-        List<OperationConfig> records = operationConfigService.list(queryWrapper);
-        if (ListUtil.isNotEmpty(records)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * 标准术语名称修改
-     *
-     * @param oldName
-     * @param newName
-     * @return
-     */
-    public Boolean updateUniqueName(String oldName, String newName) {
-        UpdateWrapper<OperationConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", oldName)
-                .set("unique_name", newName);
-        operationConfigService.update(updateWrapper);
-        return true;
-    }
-}

+ 0 - 89
src/main/java/com/diagbot/facade/PacsConfigFacade.java

@@ -1,89 +0,0 @@
-package com.diagbot.facade;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.diagbot.entity.PacsConfig;
-import com.diagbot.enums.IsDeleteEnum;
-import com.diagbot.service.impl.PacsConfigServiceImpl;
-import com.diagbot.util.EntityUtil;
-import com.diagbot.util.ListUtil;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description:
- * @Author:zhaops
- * @time: 2020/7/29 15:03
- */
-@Component
-public class PacsConfigFacade extends PacsConfigServiceImpl {
-
-    /**
-     * 获取映射关系-公表名
-     *
-     * @param hospitalId
-     * @param hisNames
-     * @param uniqueNames
-     * @return
-     */
-    public Map<String, Map<String, Long>> getConfigMap(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
-        Map<String, Map<String, Long>> retMap = new HashMap<>();
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id", hospitalId);
-        if (ListUtil.isNotEmpty(hisNames)) {
-            queryWrapper.in("his_name", hisNames);
-        }
-        if (ListUtil.isNotEmpty(uniqueNames)) {
-            queryWrapper.in("unique_name", uniqueNames);
-        }
-        List<PacsConfig> records = this.list(queryWrapper);
-        if (ListUtil.isEmpty(records)) {
-            return retMap;
-        }
-        Map<String, List<PacsConfig>> configMap = EntityUtil.makeEntityListMap(records, "hisName");
-        for (Map.Entry<String, List<PacsConfig>> entry : configMap.entrySet()) {
-            if (ListUtil.isNotEmpty(entry.getValue())) {
-                retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "uniqueName", "id"));
-            }
-        }
-        return retMap;
-    }
-
-    /**
-     * 已映射
-     *
-     * @param name
-     * @return
-     */
-    public Boolean isMapping(String name) {
-        QueryWrapper<PacsConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", name);
-        List<PacsConfig> records = this.list(queryWrapper);
-        if (ListUtil.isNotEmpty(records)) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * 标准术语名称修改
-     *
-     * @param oldName
-     * @param newName
-     * @return
-     */
-    public Boolean updateUniqueName(String oldName, String newName) {
-        UpdateWrapper<PacsConfig> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("unique_name", oldName)
-                .set("unique_name", newName);
-        this.update(updateWrapper);
-        return true;
-    }
-}

+ 190 - 0
src/main/java/com/diagbot/facade/TermMatchingFacade.java

@@ -0,0 +1,190 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.client.StandConvertServiceClient;
+import com.diagbot.dto.StandConvertCrfDTO;
+import com.diagbot.dto.TermConceptDTO;
+import com.diagbot.entity.KlLibraryInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.StandConvertCrfEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.StandConvertCrfVO;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2021-06-10 19:48
+ */
+@Component
+public class TermMatchingFacade {
+    @Autowired
+    KlLibraryInfoFacade klLibraryInfoFacade;
+    @Autowired
+    StandConvertServiceClient standConvertServiceClient;
+
+    public List<TermConceptDTO> getTermMatchingAll(TermMatchingVO termMatchingVO) {
+        List<TermConceptDTO> list = new ArrayList<>();
+        Integer type = convertType(termMatchingVO.getType());
+        TermMatchingVO termMatchingVONew = new TermMatchingVO();
+        BeanUtil.copyProperties(termMatchingVO, termMatchingVONew);
+        termMatchingVONew.setType(type);
+        if (type != null) {
+            TermConceptDTO libraryInfo = klLibraryInfoFacade.getConcept(termMatchingVONew);
+            if (null == libraryInfo && type.equals(LexiconEnum.PacsName.getKey())) {
+                termMatchingVONew.setType(LexiconEnum.PacsSubName.getKey());
+                libraryInfo = klLibraryInfoFacade.getConcept(termMatchingVONew);
+            }
+            if (null != libraryInfo) {
+                TermConceptDTO termConceptDTO = new TermConceptDTO();
+                termConceptDTO.setId(libraryInfo.getId());
+                termConceptDTO.setName(libraryInfo.getName());
+                termConceptDTO.setSource(libraryInfo.getSource() == 1 ? 1 : 2);
+                termConceptDTO.setCode(libraryInfo.getCode());
+                list.add(termConceptDTO);
+            }
+        }
+        //没有找到标准词或同义词才找相似词
+        if (ListUtil.isEmpty(list)) {
+            //相似词
+            StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
+            // 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital
+            String wordType = wordType(termMatchingVO.getType());
+            if (StringUtil.isNotBlank(wordType)) {
+                standConvertCrfVO.setWord_type(wordType);
+                standConvertCrfVO.setWord(termMatchingVO.getInputStr());
+                standConvertCrfVO.setNumber(5);
+                StandConvertCrfDTO standConvertCrfDTO = new StandConvertCrfDTO();
+                try {
+                    standConvertCrfDTO = standConvertServiceClient.similarity(standConvertCrfVO);
+                } catch (Exception e) {
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换【服务器】挂了!" + e.getMessage());
+                }
+
+                List<Map<String, String>> standard_words = standConvertCrfDTO.getStandard_words();
+                List<String> placeToList = new ArrayList<>();
+                if (ListUtil.isNotEmpty(standard_words)) {
+                    for (Map<String, String> map : standard_words) {
+                        String placeTo = map.get("standard_word");
+                        placeToList.add(placeTo);
+                    }
+                    TermMatchingListVO termMatchingListVO = new TermMatchingListVO();
+                    termMatchingListVO.setPlaceToList(placeToList);
+                    termMatchingListVO.setType(type);
+                    QueryWrapper<KlLibraryInfo> klLibraryInfo = new QueryWrapper<>();
+                    klLibraryInfo.eq("is_deleted", IsDeleteEnum.N.getKey())
+                            .eq("type_id", type)
+                            .in("name", placeToList);
+                    List<TermConceptDTO> libraryInfoList = klLibraryInfoFacade.getConceptList(termMatchingListVO);
+                    if (ListUtil.isNotEmpty(libraryInfoList)) {
+                        for (TermConceptDTO data : libraryInfoList) {
+                            TermConceptDTO termConceptDTO = new TermConceptDTO();
+                            termConceptDTO.setId(data.getId());
+                            termConceptDTO.setName(data.getName());
+                            termConceptDTO.setCode(data.getCode());
+                            termConceptDTO.setSource(5);
+                            list.add(termConceptDTO);
+                        }
+                    }
+                }
+            }
+        }
+        return list;
+    }
+
+    public Integer convertType(Integer type) {
+        Integer retType = null;
+        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
+        switch (type) {
+            case 1:
+                retType = LexiconEnum.LisName.getKey();
+                break;
+            case 2:
+                retType = LexiconEnum.LisSubName.getKey();
+                break;
+            case 3:
+                retType = LexiconEnum.PacsName.getKey();
+                break;
+            case 4:
+                retType = LexiconEnum.Disease.getKey();
+                break;
+            case 5:
+                retType = LexiconEnum.Medicine.getKey();
+                break;
+            case 6:
+                retType = LexiconEnum.Operation.getKey();
+                break;
+            case 7:
+                retType = LexiconEnum.Dept.getKey();
+                break;
+            case 8:
+                retType = LexiconEnum.Transfusion.getKey();
+                break;
+            case 9:
+                retType = LexiconEnum.Symptom.getKey();
+                break;
+            case 10:
+                retType = LexiconEnum.Scale.getKey();
+                break;
+            case 11:
+                retType = LexiconEnum.Nurse.getKey();
+                break;
+            case 12:
+                retType = LexiconEnum.Tcmdisease.getKey();
+                break;
+            case 13:
+                retType = LexiconEnum.Tcmsyndrome.getKey();
+                break;
+            case 14:
+                retType = LexiconEnum.Anesthesia.getKey();
+                break;
+            case 15:
+                retType = LexiconEnum.Form.getKey();
+                break;
+            default:
+                break;
+        }
+        return retType;
+    }
+
+    public String wordType(Integer type) {
+        String retType = null;
+        //type: 类型:1-化验大项、2-化验小项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候
+        //类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 查体:vital
+        switch (type) {
+            case 1:
+                retType = StandConvertCrfEnum.lis.getName();
+                break;
+            case 2:
+                retType = StandConvertCrfEnum.lis.getName();
+                break;
+            case 3:
+                retType = StandConvertCrfEnum.pacs.getName();
+                break;
+            case 4:
+                retType = StandConvertCrfEnum.disease.getName();
+                break;
+            case 5:
+                retType = StandConvertCrfEnum.drug.getName();
+                break;
+            case 6:
+                retType = StandConvertCrfEnum.operation.getName();
+                break;
+            default:
+                break;
+        }
+        return retType;
+    }
+}

+ 8 - 0
src/main/java/com/diagbot/mapper/KlLibraryInfoMapper.java

@@ -1,7 +1,12 @@
 package com.diagbot.mapper;
 
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KlLibraryInfoMapper extends BaseMapper<KlLibraryInfo> {
 
+    TermConceptDTO getConcept(TermMatchingVO termMatchingVO);
+
+    List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO);
 }

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.KlOperation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 手术扩展表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-15
+ */
+public interface KlOperationMapper extends BaseMapper<KlOperation> {
+
+}

+ 17 - 0
src/main/java/com/diagbot/mapper/KlRuleMapper.java

@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
+import com.diagbot.dto.RuleBaseInitDTO;
+import com.diagbot.dto.RuleConditionInitDTO;
 import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.RuleInitDTO;
 import com.diagbot.entity.KlRule;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.vo.KlRuleByIdVO;
@@ -29,4 +32,18 @@ public interface KlRuleMapper extends BaseMapper<KlRule> {
     List<KlRuleByIdDTO> getByIdRuleInfo(KlRuleByIdVO klRuleByIdVO);
 
     List<IndicationExportDTO> exportIndication();
+
+    List<RuleInitDTO> getRuleInitDTO();
+
+    List<RuleConditionInitDTO> getRuleConditionInitDTO();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTO();
+
+    List<RuleInitDTO> getRuleInitDTONotHaveClass();
+
+    List<RuleInitDTO> getRuleInitDTOHaveClass();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTONotHaveClass();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass();
 }

+ 0 - 15
src/main/java/com/diagbot/mapper/LisConfigMapper.java

@@ -1,15 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.entity.LisConfig;
-
-/**
- * <p>
- * 化验公表映射 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface LisConfigMapper extends BaseMapper<LisConfig> {
-}

+ 45 - 0
src/main/java/com/diagbot/mapper/MappingConfigMapper.java

@@ -0,0 +1,45 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.RetrievalVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医学术语映射表 Mapper 接口
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+public interface MappingConfigMapper extends BaseMapper<MappingConfig> {
+    /**
+     * 分页查询
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
+
+    /**
+     * 医院术语检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    List<MappingConfig> hisNameIndex(RetrievalVO retrievalVO);
+
+    /**
+     * 医院术语-细项检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    List<MappingConfig> hisDetailNameIndex(RetrievalVO retrievalVO);
+}

+ 0 - 15
src/main/java/com/diagbot/mapper/OperationConfigMapper.java

@@ -1,15 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.entity.OperationConfig;
-
-/**
- * <p>
- * 手术映射表 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface OperationConfigMapper extends BaseMapper<OperationConfig> {
-}

+ 0 - 15
src/main/java/com/diagbot/mapper/PacsConfigMapper.java

@@ -1,15 +0,0 @@
-package com.diagbot.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.diagbot.entity.PacsConfig;
-
-/**
- * <p>
- * 检查公表映射 Mapper 接口
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface PacsConfigMapper extends BaseMapper<PacsConfig> {
-}

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

@@ -159,6 +159,7 @@ public class EntityProcessClinic extends EntityProcess {
                 Operation operation = new Operation();
                 operation.setName(lemma.getText());
                 operation.setStandName(lemma.getText()); // 先赋值,之后有同义词转换再替换
+//                operation.setStandName("");
                 if (lemma.isHaveChildren()) {
                     operation.setNegative(findNegative(lemma));//阴性
                 }

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

@@ -33,7 +33,7 @@ public class EntityProcessPacs extends EntityProcess {
             collect = pacsAll.stream().map(x -> {
                 Item item = new Item();
                 item.setName(x.getText());
-                item.setUniqueName(x.getText());
+                item.setUniqueName("");//设置为空,后期走映射
                 return item;
             }).collect(Collectors.toList());
         }

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

@@ -102,6 +102,7 @@ public class BillProcess {
             /** 3、规则处理 */
             List<RuleConditionDTO> ruleConditionDTOList = ruleExtDTO.getRuleConditionDTOList();
             for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
+                ruleSimpleDTO.setMsg(ruleConditionDTO.getMsg());
                 List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
                 switch (RuleTypeEnum.getEnum(ruleExtDTO.getRuleType())) {
                     case bill: // redis 数据以 _1结尾
@@ -116,7 +117,10 @@ public class BillProcess {
                                     case Disease: // 诊断
                                         commonRule.compareItemWithBill(diags, ruleBaseDTO, billMsgList, ConEnum.disease.getName(), ruleSimpleDTO);
                                         break;
-                                    case LisSubName: // 化验
+                                    case LisName: // 化验开单互斥
+                                        commonRule.exclusionBill(wordCrfDTO.getLisOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                        break;
+                                    case LisSubName: // 化验结果
                                         lisRule.bill(wordCrfDTO.getLis(), ruleBaseDTO, billMsgList, ConEnum.lis.getName(), ruleSimpleDTO);
                                         break;
                                     case VitalResult: //体格检查结果
@@ -127,7 +131,7 @@ public class BillProcess {
                                     case PacsSubName: // 辅助检查子项目
                                         if (ruleBaseDTO.getBaseType() != null && ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B5.getKey())) {
                                             // 开单项互斥
-                                            commonRule.exclusionBill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                            commonRule.exclusionBill(wordCrfDTO.getPacsOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
                                         } else {
                                             // 辅检项目,暂无数据
                                             pacsRule.bill(wordCrfDTO.getPacs(), ruleBaseDTO, billMsgList, ConEnum.pacs.getName(), ruleSimpleDTO);
@@ -172,8 +176,17 @@ public class BillProcess {
                         break;
                     case repeat:  // redis 数据以 _6结尾
                         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-                            // 无需重复开单项
-                            commonRule.needlessRepeatOrder(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                            switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                                case PacsName: // 辅助检查项目
+                                case PacsSubName: // 辅助检查子项目
+                                    // 辅检正常值,无需重复开单项
+                                    commonRule.needlessRepeatOrderPacs(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                                    break;
+                                case LisSubName: // 化验结果
+                                    // 化验正常值,无需重复开单项
+                                    commonRule.needlessRepeatOrderLis(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
+                                    break;
+                            }
                         }
                         break;
                     default:

+ 2 - 4
src/main/java/com/diagbot/process/PushProcess.java

@@ -28,7 +28,6 @@ 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.rule.AgeRule;
@@ -103,8 +102,7 @@ public class PushProcess {
     GroupRule groupRule;
     @Autowired
     ConceptInfoFacade conceptInfoFacade;
-    @Autowired
-    LisConfigFacade lisConfigFacade;
+
 
     public PushDTO processIcss(PushVO pushVo) {
 
@@ -591,7 +589,7 @@ public class PushProcess {
         dealFilter(filterMap, StandConvertEnum.disease.toString(),
                 CoreUtil.getByPropertyName(wordCrfDTO.getDiag(), "name", "uniqueName"));
         // 化验——获取过滤化验套餐名
-        dealFilter(filterMap, StandConvertEnum.lis.toString(), lisConfigFacade.getMappingLisItem(wordCrfDTO));
+//        dealFilter(filterMap, StandConvertEnum.lis.toString(), lisConfigFacade.getMappingLisItem(wordCrfDTO));
         return filterMap;
     }
 

+ 9 - 4
src/main/java/com/diagbot/rule/AgeRule.java

@@ -5,7 +5,9 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -18,6 +20,9 @@ import java.util.List;
 @Component
 public class AgeRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较年龄——开单项
      *
@@ -30,10 +35,10 @@ public class AgeRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Boolean flag = getFlag(wordCrfDTO, ruleBaseDTO);
         if (flag) {
-            String message = "年龄" + wordCrfDTO.getAge();
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    message, conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(wordCrfDTO.getAge());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 167 - 81
src/main/java/com/diagbot/rule/CommonRule.java

@@ -1,16 +1,20 @@
 package com.diagbot.rule;
 
+import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BaseDiagnoseDTO;
 import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.BaseDiagnoseTypeEnum;
 import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
+import com.diagbot.facade.KlDictionaryInfoFacade;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Negative;
 import com.diagbot.util.BeanUtil;
@@ -18,7 +22,10 @@ import com.diagbot.util.CatalogueUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
+import com.diagbot.util.RedisUtil;
+import com.diagbot.util.ReflectUtil;
 import com.diagbot.util.RegexUtil;
 import com.diagbot.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -53,6 +60,12 @@ public class CommonRule {
     AgeRule ageRule;
     @Autowired
     LisRule lisRule;
+    @Autowired
+    KlDictionaryInfoFacade klDictionaryInfoFacade;
+    @Autowired
+    RedisUtil redisUtil;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较阳性属性是否匹配
@@ -70,13 +83,13 @@ public class CommonRule {
             for (T d : input) {
                 Negative val = (Negative) CoreUtil.getFieldValue(d, "negative");
                 if (val == null) {
-                    String c = (String) CoreUtil.getFieldValue(d, "standName");
-                    String c_name = (String) CoreUtil.getFieldValue(d, "name");
-                    if (StringUtils.isNotBlank(c) && CoreUtil.compareName(ruleBaseDTO, c)) {
-                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                c_name, conType, ruleSimpleDTO.getLibTypeName());
-                        billMsgList.add(commonBillMsg);
+                    String standName = (String) CoreUtil.getFieldValue(d, "standName");
+                    String name = (String) CoreUtil.getFieldValue(d, "name");
+                    if (StringUtils.isNotBlank(standName) && CoreUtil.compareName(ruleBaseDTO, standName)) {
+                        ruleSimpleDTO.setContent(name);
+                        ruleSimpleDTO.setConType(conType);
+                        BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                        CoreUtil.addBeanToList(billMsgList, billMsg);
                     }
                 }
             }
@@ -167,13 +180,13 @@ public class CommonRule {
                                         String conType, RuleSimpleDTO ruleSimpleDTO) {
         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)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            c_name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                String uniqueName = (String) CoreUtil.getFieldValue(t, "uniqueName"); // 标准名称
+                String inputName = (String) CoreUtil.getFieldValue(t, "name"); // 界面名称
+                if (CoreUtil.compareName(ruleBaseDTO, uniqueName)) {
+                    ruleSimpleDTO.setContent(inputName);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }
@@ -221,15 +234,16 @@ public class CommonRule {
         }
     }
 
+
     /**
-     * 无需重复开单项
+     * 正常结果,无需重复开单项——辅检
      *
      * @param wordCrfDTO
      * @param ruleBaseDTO
      * @param billMsgList
      * @param ruleSimpleDTO
      */
-    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
+    public void needlessRepeatOrderPacs(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         String orderStandName = ruleBaseDTO.getBaseLibName();
         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
         List<Pacs> pacsList = map.get(orderStandName);
@@ -241,17 +255,42 @@ public class CommonRule {
                     && RegexUtil.getRegexRes(result, ruleBaseDTO.getBaseEqValue())) {
                 String dateValue = pacs.getDateValue(); // 结果日期
                 String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
-                if (StringUtil.isNotBlank(dateValue) && StringUtil.isNotBlank(orderDateValue)) {
-                    Date dateValueDate = CatalogueUtil.parseStringDate(dateValue);
-                    Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
-                    if (dateValueDate != null && orderDateValueDate != null) {
-                        if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7, false)) {
-                            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                    pacs.getName(), conType, ruleSimpleDTO.getLibTypeName());
-                            billMsgList.add(commonBillMsg);
-                        }
-                    }
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                if (flag == 1) {
+                    ruleSimpleDTO.setContent(result);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
+                }
+            }
+        }
+    }
+
+    /**
+     * 正常结果,无需重复开单项——化验
+     *
+     * @param wordCrfDTO
+     * @param ruleBaseDTO
+     * @param billMsgList
+     * @param ruleSimpleDTO
+     */
+    public void needlessRepeatOrderLis(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
+        String orderStandName = ruleBaseDTO.getBaseLibName();
+        Map<String, List<Lis>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getLis(), "uniqueName");
+        List<Lis> lisList = map.get(orderStandName);
+        if (ListUtil.isNotEmpty(lisList)) {
+            sortByProperty(lisList, "dateValue");
+            Lis lis = lisList.get(lisList.size() - 1); // 按时间排序,取最后一条
+            Map<String, Object> lisMap = CoreUtil.compareLis(ruleBaseDTO, lis);
+            if (CoreUtil.getMapFlag(lisMap)) {
+                String dateValue = lis.getDateValue(); // 结果日期
+                String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                if (flag == 1) { // 有效期范围内
+                    ruleSimpleDTO.setContent(CoreUtil.getMapMsg(lisMap));
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }
@@ -313,95 +352,137 @@ public class CommonRule {
         // repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName(), ConEnum.repeat24.getName()); // 输血重复开单
     }
 
+    // /**
+    //  * 互斥开单项——辅检
+    //  *
+    //  * @param wordCrfDTO
+    //  * @param ruleBaseDTO
+    //  * @param billMsgList
+    //  * @param ruleSimpleDTO
+    //  * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+    //  */
+    // public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+    //     // 辅检开单项互斥
+    //     List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
+    //     if (ListUtil.isNotEmpty(pacsOrder) && pacsOrder.size() > 1) {
+    //         // 不同的辅检项目可能对应同一个uniqueName,提示显示多条
+    //         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(pacsOrder, "uniqueName");
+    //         List<Pacs> orginNameList = map.get(ruleBaseDTO.getBaseLibName()); // 互斥名称
+    //         if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
+    //             for (Pacs pacs : orginNameList) {
+    //                 String orginName = pacs.getName();
+    //                 // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+    //                 if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
+    //                     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
+    //                     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
+    //                     ruleSimpleDTO.setContent(orginName);
+    //                     ruleSimpleDTO.setConType(conType);
+    //                     BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+    //                     CoreUtil.addBeanToList(billMsgList, billMsg);
+    //                 }
+    //             }
+    //         }
+    //     }
+    // }
+
     /**
      * 互斥开单项
      *
-     * @param wordCrfDTO
+     * @param orderList      开单列表
      * @param ruleBaseDTO
      * @param billMsgList
      * @param ruleSimpleDTO
-     * @param set 用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+     * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
      */
-    public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
-        // 辅检开单项互斥
-        List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
-        if (ListUtil.isNotEmpty(pacsOrder) && pacsOrder.size() > 1) {
-            // 不同的辅检项目可能对应同一个uniqueName,提示显示多条
-            Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(pacsOrder, "uniqueName");
-            List<Pacs> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
+    public <T> void exclusionBill(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+        if (ListUtil.isNotEmpty(orderList) && orderList.size() > 1) {
+            // 不同的项目可能对应同一个uniqueName,提示显示多条
+            Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
+            List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
             if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
-                for (Pacs pacs : orginNameList) {
-                    String orginName = pacs.getName();
-                    // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-                    if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
-                        set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
-                        set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                ruleSimpleDTO.getInputName(), "",
-                                orginName, conType, ruleSimpleDTO.getLibTypeName());
-                        billMsgList.add(commonBillMsg);
+                for (T bean : orginNameList) {
+                    String orderDateValue = ReflectUtil.getProperty(ruleSimpleDTO, "dateValue");
+                    String beanDateValue = ReflectUtil.getProperty(bean, "dateValue");
+                    int dateFlag = CoreUtil.compareTime(beanDateValue, orderDateValue);
+                    if (dateFlag == 1) {
+                        String orginName = ReflectUtil.getProperty(bean, "name");
+                        // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+                        // if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
+                        //     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
+                        //     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
+                            ruleSimpleDTO.setContent(orginName);
+                            ruleSimpleDTO.setConType(conType);
+                            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                            CoreUtil.addBeanToList(billMsgList, billMsg);
+                        // }
                     }
                 }
             }
         }
     }
 
+    /**
+     * 获取频次分组
+     *
+     * @param frequency
+     * @return
+     */
+    public String getFrquenceType(String frequency) {
+        if (StringUtil.isEmpty(frequency)) {
+            frequency = "空";
+        }
+        List<DictionaryInfoDTO> listByGroupType = redisUtil.get(RedisEnum.frequency.getName());
+        for (DictionaryInfoDTO dic : listByGroupType) {
+            if (RegexUtil.getRegexRes(frequency, dic.getVal())) {
+                return dic.getName();
+            }
+        }
+        return "单次";
+    }
+
     /**
      * 24小时重复开单入口
      *
      * @param billMsgList
      * @param itemList
      * @param type
-     * @param conType 禁忌条件
+     * @param conType     禁忌条件
      * @param <T>
      */
     public <T> void repeat24BillWithType(List<BillMsg> billMsgList, List<T> itemList, String type, String conType) {
         if (ListUtil.isEmpty(itemList)) {
             return;
         }
-        // Map<String, List<T>> map = EntityUtil.makeEntityListMap(itemList, "name");
         Map<String, List<T>> map = CoreUtil.makeEntityListMap(itemList, "name", "uniqueName");
         for (String key : map.keySet()) {
             List<T> items = map.get(key);
 
-            // 个数大于2个才比较
             if (ListUtil.isNotEmpty(items) && items.size() > 1) {
-                // items 按照时间排序
-                Collections.sort(items, new Comparator<T>() {
-                    @Override
-                    public int compare(T o1, T o2) {
-                        String o1Str = (String) CoreUtil.getFieldValue(o1, "dateValue");
-                        String o2Str = (String) CoreUtil.getFieldValue(o2, "dateValue");
-                        if (StringUtil.isBlank(o1Str) || StringUtil.isBlank(o2Str)) {
-                            return -1;
-                        } else {
-                            return o1Str.compareTo(o2Str);
-                        }
-                    }
-                });
-
-                // 比较时间是否在24小时内
-                List<Date> dateList = new ArrayList<>();
-                for (T it : items) {
-                    String dateValue = (String) CoreUtil.getFieldValue(it, "dateValue");
-                    if (StringUtil.isNotBlank(dateValue)) {
-                        Date cur = CatalogueUtil.parseStringDate(dateValue);
-                        // 如果为null,说明日期格式出错,不比较
-                        if (cur != null) {
-                            if (ListUtil.isNotEmpty(dateList)) {
-                                Date last = dateList.get(dateList.size() - 1);
-                                if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
+                for (int i = 0; i < items.size() - 1; i++) {
+                    T it = items.get(i);
+                    String curDateValue = ReflectUtil.getProperty(it, "dateValue");
+                    if (StringUtil.isNotBlank(curDateValue)) {
+                        Date curDate = CatalogueUtil.parseStringDate(curDateValue);
+                        for (int j = i + 1; j < items.size(); j++) {
+                            T itNext = items.get(j);
+                            String nextDateValue = ReflectUtil.getProperty(itNext, "dateValue");
+                            if (StringUtil.isNotBlank(nextDateValue)) {
+                                Date nextDate = CatalogueUtil.parseStringDate(nextDateValue);
+                                if (!CatalogueUtil.compareTime(curDate, nextDate, 60L * 24, true)
+                                        && getFrquenceType(ReflectUtil.getProperty(it, "frequency"))
+                                        .equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
                                     String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
-                                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                            name, uniqueName, name, ConEnum.repeat24.getName(), type);
-                                    billMsgList.add(commonBillMsg);
+                                    RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
+                                    ruleSimpleDTO.setInputName(name);
+                                    ruleSimpleDTO.setLibName(uniqueName);
+                                    ruleSimpleDTO.setLibTypeName(type);
+                                    ruleSimpleDTO.setContent(name);
+                                    ruleSimpleDTO.setConType(ConEnum.repeat24.getName());
+                                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                                    CoreUtil.addBeanToList(billMsgList, billMsg);
                                     break;
-                                } else {
-                                    dateList.add(cur);
                                 }
-                            } else {
-                                dateList.add(cur);
                             }
                         }
                     }
@@ -498,4 +579,9 @@ public class CommonRule {
         Collections.sort(baseIdList); // id排序,方便调试查看
         return baseIdList;
     }
+
+    public static void main(String[] args) {
+        CommonRule commonRule = new CommonRule();
+        System.out.println(commonRule.getFrquenceType(null));
+    }
 }

+ 7 - 5
src/main/java/com/diagbot/rule/DrugRule.java

@@ -7,7 +7,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +26,8 @@ public class DrugRule {
 
     @Autowired
     RedisUtil redisUtil;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较药品是否匹配(先根据baseLibType判断返回的是药品通用名还是药品分类,如果返回的是药品分类,从redis获取药品通用名)
@@ -56,10 +58,10 @@ public class DrugRule {
                 String uniqueName = (String) CoreUtil.getFieldValue(d, "uniqueName");
                 String name = (String) CoreUtil.getFieldValue(d, "name");
                 if (StringUtils.isNotBlank(uniqueName) && allDrug.contains(uniqueName)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                    ruleSimpleDTO.setContent(name);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }

+ 63 - 7
src/main/java/com/diagbot/rule/GroupRule.java

@@ -6,8 +6,11 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RegexUtil;
+import com.diagbot.util.StringUtil;
+import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -26,6 +29,8 @@ public class GroupRule {
 
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 禁忌人群开单项
@@ -39,10 +44,10 @@ public class GroupRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Map map = rule(wordCrfDTO, ruleBaseDTO);
         if (CoreUtil.getMapFlag(map)) {
-            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(commonBillMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 
@@ -71,10 +76,17 @@ public class GroupRule {
     public Map rule(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO) {
         Map res = new LinkedHashMap();
         Double age = wordCrfDTO.getAgeNum();
+        Integer sex = wordCrfDTO.getSex();
         // 妊娠目前从诊断里判断,包含“妊娠”
         String symptom = wordCrfDTO.getSymptom(); // 现病史内容
         String menstrual = wordCrfDTO.getMenstrual(); // 月经史
+        String marriage = wordCrfDTO.getMarriage(); // 婚姻
+        String marital = wordCrfDTO.getMarital();// 婚育史
+        String pasts = wordCrfDTO.getPasts(); // 既往史
         boolean flag = false;
+        String regex = "";
+        String regex2 = "";
+        List<String> groupList = Lists.newArrayList(); // 分组信息
         List<String> nameList = CoreUtil.getSplit(ruleBaseDTO.getBaseLibName());
         for (String name : nameList) {
             switch (name) {
@@ -88,8 +100,8 @@ public class GroupRule {
                     flag = commonRule.containsItem(wordCrfDTO.getDiag(), name);
                     break;
                 case "月经期":
-                    String regex = "月经第(([零一二三四五六七八九十]{0,3})||([0-9]{0,2}))天";
-                    String regex2 = "(?<!上一次)经期";
+                    regex = "月经第(([零一二三四五六七八九十]{0,3})||([0-9]{0,2}))天";
+                    regex2 = "(?<!上一次)经期";
                     if (RegexUtil.getRegexRes(symptom, regex) || RegexUtil.getRegexRes(menstrual, regex)
                             || RegexUtil.getRegexRes(symptom, regex2) || RegexUtil.getRegexRes(menstrual, regex2)) {
                         flag = true;
@@ -119,6 +131,50 @@ public class GroupRule {
                         flag = true;
                     }
                     break;
+                case "未婚女性":
+                    regex = "未婚";
+                    if (sex == 2 &&
+                            (RegexUtil.getRegexRes(marriage, regex) || "2".equals(marriage) || RegexUtil.getRegexRes(marital, regex))
+                    ) {
+                        flag = true;
+                    }
+                    break;
+                case "未经产妇": // 女性+(婚育史或既往史)数值累加为0
+                    regex = "(\\d+)-(\\d+)-(\\d+)-(\\d+)";
+                    if (sex == 2) {
+                        if (StringUtil.isNotBlank(marital) && RegexUtil.getRegexRes(marital, regex)) {
+                            // 婚育史判断
+                            groupList = RegexUtil.getRegexDataList(marital, regex);
+                        } else if (StringUtil.isNotBlank(pasts) && RegexUtil.getRegexRes(pasts, regex)) {
+                            // 既往史判断
+                            groupList = RegexUtil.getRegexDataList(pasts, regex);
+                        }
+                        if (ListUtil.isNotEmpty(groupList) && groupList.size() == 4) {
+                            if (Integer.parseInt(groupList.get(0)) + Integer.parseInt(groupList.get(1))
+                                    + Integer.parseInt(groupList.get(2)) == 0) {
+                                flag = true;
+                            }
+                        }
+                    }
+                    break;
+                case "经产妇": // 女性+(婚育史或既往史)数值累加>=1
+                    regex = "(\\d+)-(\\d+)-(\\d+)-(\\d+)";
+                    if (sex == 2) {
+                        if (StringUtil.isNotBlank(marital) && RegexUtil.getRegexRes(marital, regex)) {
+                            // 婚育史判断
+                            groupList = RegexUtil.getRegexDataList(marital, regex);
+                        } else if (StringUtil.isNotBlank(pasts) && RegexUtil.getRegexRes(pasts, regex)) {
+                            // 既往史判断
+                            groupList = RegexUtil.getRegexDataList(pasts, regex);
+                        }
+                        if (ListUtil.isNotEmpty(groupList) && groupList.size() == 4) {
+                            if (Integer.parseInt(groupList.get(0)) + Integer.parseInt(groupList.get(1))
+                                    + Integer.parseInt(groupList.get(2)) >= 1) {
+                                flag = true;
+                            }
+                        }
+                    }
+                    break;
                 default:
                     break;
             }

+ 7 - 3
src/main/java/com/diagbot/rule/LisRule.java

@@ -10,6 +10,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,8 @@ public class LisRule {
     GroupRule groupRule;
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较化验——开单合理性
@@ -45,9 +48,10 @@ public class LisRule {
             for (Lis lis : inputLis) {
                 Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lis);
                 if (CoreUtil.getMapFlag(map)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(),
-                            ruleSimpleDTO.getLibName(), (String) map.get("msg"), conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                    ruleSimpleDTO.setContent((String) map.get("msg"));
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }

+ 10 - 4
src/main/java/com/diagbot/rule/MedEquRule.java

@@ -4,7 +4,9 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -17,6 +19,9 @@ import java.util.List;
 @Component
 public class MedEquRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较文本内容是否存在
      *
@@ -37,9 +42,10 @@ public class MedEquRule {
             flag = true;
         }
         if (flag) {
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 }

+ 30 - 8
src/main/java/com/diagbot/rule/PacsRule.java

@@ -9,6 +9,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +34,8 @@ public class PacsRule {
     GroupRule groupRule;
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较辅检名称——开单合理性
@@ -47,14 +50,14 @@ public class PacsRule {
     public <T> void bill(List<T> inputList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType,
                          RuleSimpleDTO ruleSimpleDTO) {
         if (ListUtil.isNotEmpty(inputList)) {
-            for (T lis : inputList) {
-                String val = (String) CoreUtil.getFieldValue(lis, "uniqueName");
-                String val_name = (String) CoreUtil.getFieldValue(lis, "name");
-                if (StringUtils.isNotBlank(val) && CoreUtil.compareName(ruleBaseDTO, val)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            "已开" + val_name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+            for (T bean : inputList) {
+                String uniqueName = (String) CoreUtil.getFieldValue(bean, "uniqueName");
+                String name = (String) CoreUtil.getFieldValue(bean, "name");
+                if (StringUtils.isNotBlank(uniqueName) && CoreUtil.compareName(ruleBaseDTO, uniqueName)) {
+                    ruleSimpleDTO.setContent(name);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }
@@ -120,6 +123,25 @@ public class PacsRule {
                             }
                         }
                         break;
+                    case Disease: // 诊断
+                        map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
+                    case LisSubName: // 检验结果
+                        map = CoreUtil.compareLis(ruleBaseDTO, wordCrfDTO.getLis());
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
+                    case VitalResult: //体格检查结果
+                    case Vital: // 体格检查项目
+                        map = CoreUtil.compareVital(ruleBaseDTO, wordCrfDTO.getVitalLabel());
+                        if (CoreUtil.getMapFlag(map)) {
+                            i++;
+                        }
+                        break;
                     default:
                         break;
                 }

+ 10 - 4
src/main/java/com/diagbot/rule/SexRule.java

@@ -4,8 +4,10 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -18,6 +20,9 @@ import java.util.List;
 @Component
 public class SexRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较性别
      *
@@ -30,9 +35,10 @@ public class SexRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType,
                      RuleSimpleDTO ruleSimpleDTO) {
         if (getFlag(wordCrfDTO, ruleBaseDTO)) {
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 9 - 3
src/main/java/com/diagbot/rule/VitalRule.java

@@ -5,7 +5,9 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.model.label.VitalLabel;
 import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,6 +21,9 @@ import java.util.Map;
 @Component
 public class VitalRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较体征——开单合理性
      *
@@ -33,9 +38,10 @@ public class VitalRule {
         Map<String, Object> map = CoreUtil.compareVital(ruleBaseDTO, vitalLabel);
         List<String> msgList = CoreUtil.getMapMsgList(map);
         for (String s : msgList) {
-            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(),
-                    ruleSimpleDTO.getLibName(), s, conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(commonBillMsg);
+            ruleSimpleDTO.setContent(s);
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 7 - 0
src/main/java/com/diagbot/service/KlLibraryInfoService.java

@@ -1,7 +1,12 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +17,7 @@ import com.diagbot.entity.KlLibraryInfo;
  * @since 2021-01-21
  */
 public interface KlLibraryInfoService extends IService<KlLibraryInfo> {
+    TermConceptDTO getConcept(TermMatchingVO termMatchingVO);
 
+    List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO);
 }

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.KlOperation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 手术扩展表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-15
+ */
+public interface KlOperationService extends IService<KlOperation> {
+
+}

+ 17 - 0
src/main/java/com/diagbot/service/KlRuleService.java

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
+import com.diagbot.dto.RuleBaseInitDTO;
+import com.diagbot.dto.RuleConditionInitDTO;
 import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.RuleInitDTO;
 import com.diagbot.entity.KlRule;
 import com.diagbot.vo.KlRuleByIdVO;
 import com.diagbot.vo.KlRuleInfoVO;
@@ -25,4 +28,18 @@ public interface KlRuleService extends IService<KlRule> {
     IPage<KlRuleInfoDTO> getKlRuleInfoPages(KlRuleInfoVO klRuleInfoVO);
     List<KlRuleByIdDTO> getByIdRuleInfo(KlRuleByIdVO klRuleByIdVO);
     List<IndicationExportDTO> exportIndication();
+
+    List<RuleInitDTO> getRuleInitDTO();
+
+    List<RuleConditionInitDTO> getRuleConditionInitDTO();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTO();
+
+    List<RuleInitDTO> getRuleInitDTONotHaveClass();
+
+    List<RuleInitDTO> getRuleInitDTOHaveClass();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTONotHaveClass();
+
+    List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass();
 }

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

@@ -1,15 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.entity.LisConfig;
-
-/**
- * <p>
- * 化验公表映射 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface LisConfigService extends IService<LisConfig> {
-}

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

@@ -0,0 +1,45 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.RetrievalVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医学术语映射表 服务类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+public interface MappingConfigService extends IService<MappingConfig> {
+    /**
+     * 分页查询
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
+
+    /**
+     * 医院术语检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    List<MappingConfig> hisNameIndex(RetrievalVO retrievalVO);
+
+    /**
+     * 医院术语-细项检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    List<MappingConfig> hisDetailNameIndex(RetrievalVO retrievalVO);
+}

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

@@ -1,15 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.entity.OperationConfig;
-
-/**
- * <p>
- * 手术映射表 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface OperationConfigService extends IService<OperationConfig> {
-}

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

@@ -1,15 +0,0 @@
-package com.diagbot.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.diagbot.entity.PacsConfig;
-
-/**
- * <p>
- * 检查公表映射 服务类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-public interface PacsConfigService extends IService<PacsConfig> {
-}

+ 2 - 0
src/main/java/com/diagbot/service/impl/KlConceptServiceImpl.java

@@ -1,5 +1,6 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.IndexDTO;
 import com.diagbot.dto.KllisDetailDTO;
@@ -23,6 +24,7 @@ import java.util.List;
  * @since 2021-01-21
  */
 @Service
+@DS("med")
 public class KlConceptServiceImpl extends ServiceImpl<KlConceptMapper, KlConcept> implements KlConceptService {
 
     @Override

+ 14 - 1
src/main/java/com/diagbot/service/impl/KlLibraryInfoServiceImpl.java

@@ -1,11 +1,16 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.dto.TermConceptDTO;
 import com.diagbot.entity.KlLibraryInfo;
 import com.diagbot.mapper.KlLibraryInfoMapper;
 import com.diagbot.service.KlLibraryInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.TermMatchingListVO;
+import com.diagbot.vo.TermMatchingVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 术语表 服务实现类
@@ -17,4 +22,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class KlLibraryInfoServiceImpl extends ServiceImpl<KlLibraryInfoMapper, KlLibraryInfo> implements KlLibraryInfoService {
 
+    public TermConceptDTO getConcept(TermMatchingVO termMatchingVO) {
+        return baseMapper.getConcept(termMatchingVO);
+    }
+
+    @Override
+    public List<TermConceptDTO> getConceptList(TermMatchingListVO termMatchingListVO) {
+        return baseMapper.getConceptList(termMatchingListVO);
+    }
 }

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.KlOperation;
+import com.diagbot.mapper.KlOperationMapper;
+import com.diagbot.service.KlOperationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 手术扩展表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-15
+ */
+@Service
+public class KlOperationServiceImpl extends ServiceImpl<KlOperationMapper, KlOperation> implements KlOperationService {
+
+}

+ 39 - 0
src/main/java/com/diagbot/service/impl/KlRuleServiceImpl.java

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.IndicationExportDTO;
 import com.diagbot.dto.KlRuleByIdDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
+import com.diagbot.dto.RuleBaseInitDTO;
+import com.diagbot.dto.RuleConditionInitDTO;
 import com.diagbot.dto.RuleDTO;
+import com.diagbot.dto.RuleInitDTO;
 import com.diagbot.entity.KlRule;
 import com.diagbot.mapper.KlRuleMapper;
 import com.diagbot.service.KlRuleService;
@@ -43,4 +46,40 @@ public class KlRuleServiceImpl extends ServiceImpl<KlRuleMapper, KlRule> impleme
     public List<IndicationExportDTO> exportIndication() {
         return baseMapper.exportIndication();
     }
+
+    @Override
+    public List<RuleInitDTO> getRuleInitDTO(){
+        return baseMapper.getRuleInitDTO();
+    }
+
+    @Override
+    public List<RuleConditionInitDTO> getRuleConditionInitDTO(){
+        return baseMapper.getRuleConditionInitDTO();
+    }
+
+    @Override
+    public List<RuleBaseInitDTO> getRuleBaseInitDTO(){
+        return baseMapper.getRuleBaseInitDTO();
+    }
+
+
+    @Override
+    public List<RuleInitDTO> getRuleInitDTONotHaveClass(){
+        return baseMapper.getRuleInitDTONotHaveClass();
+    }
+
+    @Override
+    public List<RuleInitDTO> getRuleInitDTOHaveClass(){
+        return baseMapper.getRuleInitDTOHaveClass();
+    }
+
+    @Override
+    public List<RuleBaseInitDTO> getRuleBaseInitDTONotHaveClass(){
+        return baseMapper.getRuleBaseInitDTONotHaveClass();
+    }
+
+    @Override
+    public List<RuleBaseInitDTO> getRuleBaseInitDTOHaveClass(){
+        return baseMapper.getRuleBaseInitDTOHaveClass();
+    }
 }

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

@@ -1,21 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.entity.LisConfig;
-import com.diagbot.mapper.LisConfigMapper;
-import com.diagbot.service.LisConfigService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 化验公表映射 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-@DS("cdss")
-public class LisConfigServiceImpl extends ServiceImpl<LisConfigMapper, LisConfig> implements LisConfigService {
-}

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

@@ -0,0 +1,60 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
+import com.diagbot.mapper.MappingConfigMapper;
+import com.diagbot.service.MappingConfigService;
+import com.diagbot.vo.MappingConfigPageVO;
+import com.diagbot.vo.RetrievalVO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医学术语映射表 服务实现类
+ * </p>
+ *
+ * @author zhaops
+ * @since 2021-06-09
+ */
+@Service
+@DS("cdss")
+public class MappingConfigServiceImpl extends ServiceImpl<MappingConfigMapper, MappingConfig> implements MappingConfigService {
+    /**
+     * 分页查询
+     *
+     * @param mappingConfigPageVO
+     * @return
+     */
+    @Override
+    public IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
+        return baseMapper.getPage(mappingConfigPageVO);
+    }
+
+    /**
+     * 医院术语检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    @Override
+    public List<MappingConfig> hisNameIndex(RetrievalVO retrievalVO) {
+        return baseMapper.hisNameIndex(retrievalVO);
+    }
+
+    /**
+     * 医院术语-细项检索
+     *
+     * @param retrievalVO
+     * @return
+     */
+    @Override
+    public List<MappingConfig> hisDetailNameIndex(RetrievalVO retrievalVO) {
+        return baseMapper.hisDetailNameIndex(retrievalVO);
+    }
+}

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

@@ -1,21 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.entity.OperationConfig;
-import com.diagbot.mapper.OperationConfigMapper;
-import com.diagbot.service.OperationConfigService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 手术映射表 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-@DS("cdss")
-public class OperationConfigServiceImpl extends ServiceImpl<OperationConfigMapper, OperationConfig> implements OperationConfigService {
-}

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

@@ -1,21 +0,0 @@
-package com.diagbot.service.impl;
-
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.diagbot.entity.PacsConfig;
-import com.diagbot.mapper.PacsConfigMapper;
-import com.diagbot.service.PacsConfigService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 检查公表映射 服务实现类
- * </p>
- *
- * @author zhaops
- * @since 2020-07-28
- */
-@Service
-@DS("cdss")
-public class PacsConfigServiceImpl extends ServiceImpl<PacsConfigMapper, PacsConfig> implements PacsConfigService {
-}

+ 2 - 35
src/main/java/com/diagbot/util/CatalogueUtil.java

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

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

@@ -311,5 +311,6 @@ public class Content {
             "yyyy-MM-ddHH:mm:ss.000",
             "yyyyMMddHH:mm",
             "yyyy-MM-dd'T'HH:mm:ss",
+            "MM/dd/yyyyHH:mm:ss"
     };
 }

+ 106 - 17
src/main/java/com/diagbot/util/CoreUtil.java

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

+ 69 - 0
src/main/java/com/diagbot/util/MsgNewUtil.java

@@ -0,0 +1,69 @@
+package com.diagbot.util;
+
+import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.RuleSimpleDTO;
+import com.diagbot.enums.ConEnum;
+import com.diagbot.enums.RedisEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @description: 提示语工具类
+ * @author: zhoutg
+ * @time: 2020/9/14 11:16
+ */
+@Component
+public class MsgNewUtil {
+
+    @Autowired
+    RedisUtil redisUtil;
+
+    /**
+     * 开单合理性通用提示信息
+     *
+     * @param ruleSimpleDTO
+     * @return
+     */
+    public BillMsg getCommonBillMsg(RuleSimpleDTO ruleSimpleDTO) {
+        String orderName = ruleSimpleDTO.getInputName(); // 医院名称
+        String orderStandName = ruleSimpleDTO.getLibName(); // 标准名称
+        String orderType = ruleSimpleDTO.getLibTypeName(); // 开单项类型
+        String content = ruleSimpleDTO.getContent(); // 界面匹配内容
+        String conType = ruleSimpleDTO.getConType(); // 禁忌类型
+        String unionMsg = ruleSimpleDTO.getMsg(); // 原因及建议
+        String msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), orderType + "_" + conType);
+        if (StringUtil.isBlank(msg)) {
+            // msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), "通用" + "_" + "默认提示语");
+            msg = "";
+        }
+        BillMsg billMsg = new BillMsg();
+        // 出现2个“具有”,去除一个为空
+        if (ConEnum.medEqu.getName().equals(conType) && StringUtil.isNotBlank(content)
+                && content.startsWith("具有") && msg.startsWith("该患者具有")) {
+            msg = msg.replaceAll("具有", "");
+        }
+        if (StringUtil.isNotBlank(unionMsg)) {
+            msg = msg.replaceAll("\\[原因及建议]", "," + unionMsg);
+        } else {
+            msg = msg.replaceAll("\\[原因及建议]", "");
+        }
+        // [性别取反]标签替换
+        if (ConEnum.gender.getName().equals(conType)) {
+            if ("男".equals(content)) {
+                msg = msg.replaceAll("\\[性别取反]", "女");
+            } else if ("女".equals(content)) {
+                msg = msg.replaceAll("\\[性别取反]", "男");
+            }
+        }
+
+        // 放到最后统一替换【多处匹配】
+        msg = msg.replaceAll("\\[匹配内容]", content);
+        msg = msg.replaceAll("\\[开单名称]", orderName);
+        billMsg.setMsg(msg);
+        billMsg.setOrderName(orderName);
+        billMsg.setOrderStandName(orderStandName);
+        billMsg.setContent(content);
+        billMsg.setType(conType);
+        return billMsg;
+    }
+}

+ 47 - 48
src/main/java/com/diagbot/util/MsgUtil.java

@@ -2,7 +2,6 @@ package com.diagbot.util;
 
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
-import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.TypeEnum;
 
 /**
@@ -118,51 +117,51 @@ public class MsgUtil {
      * @param orderType      开单项类型
      * @return
      */
-    public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String conType, String orderType) {
-        BillMsg billMsg = new BillMsg();
-        // 禁忌项拼接提示语
-        switch (ConEnum.getEnum(conType)) {
-            case oralmeds: // 服用药品
-                content = "可能正在用药" + content;
-                break;
-            case allergicmeds: // 禁忌药品
-            case otherAllergy: // 禁忌其他过敏原
-                content = content + "过敏";
-                break;
-            case operations: // 手术
-                content = "有" + content + "史";
-                break;
-            case medEqu: // 禁忌医疗器械及物品
-                if (!content.startsWith("具有")) {
-                    content = "具有" + content;
-                }
-                break;
-        }
-        // 通用提示语
-        String msg = String.format("该患者%s,不宜开%s", content, orderName);
-        // 特殊情况下提示语
-        if (TypeEnum.transfusion.getName().equals(orderType)) {
-            // 输血开单项提示语
-            msg = String.format("该患者%s,谨慎输注%s", content, orderName);
-        } else if (TypeEnum.lis.getName().equals(orderType) && ConEnum.oralmeds.getName().equals(conType)) {
-            // 化验开单项 + 禁忌服用药品提示语
-            msg = String.format("该患者%s,会影响%s结果,请留意", content, orderName);
-        } else if (ConEnum.repeat24.getName().equals(conType)) {
-            // 24小时重复开立
-            msg = String.format("%s重复开立", orderName);
-        } else if (ConEnum.repeat.getName().equals(conType)) {
-            // 辅检正常项目无需重复开立
-            msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
-        } else  if (ConEnum.exclusion.getName().equals(conType)) {
-            // 开单项互斥
-            msg = String.format("检查项目互斥:%s与%s不宜同时进行", orderName, content);
-            billMsg.setMsg(msg);
-        }
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(conType);
-        return billMsg;
-    }
+    // public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String conType, String orderType) {
+    //     BillMsg billMsg = new BillMsg();
+    //     // 禁忌项拼接提示语
+    //     switch (ConEnum.getEnum(conType)) {
+    //         case oralmeds: // 服用药品
+    //             content = "可能正在用药" + content;
+    //             break;
+    //         case allergicmeds: // 禁忌药品
+    //         case otherAllergy: // 禁忌其他过敏原
+    //             content = content + "过敏";
+    //             break;
+    //         case operations: // 手术
+    //             content = "有" + content + "史";
+    //             break;
+    //         case medEqu: // 禁忌医疗器械及物品
+    //             if (!content.startsWith("具有")) {
+    //                 content = "具有" + content;
+    //             }
+    //             break;
+    //     }
+    //     // 通用提示语
+    //     String msg = String.format("该患者%s,不宜开%s", content, orderName);
+    //     // 特殊情况下提示语
+    //     if (TypeEnum.transfusion.getName().equals(orderType)) {
+    //         // 输血开单项提示语
+    //         msg = String.format("该患者%s,谨慎输注%s", content, orderName);
+    //     } else if (TypeEnum.lis.getName().equals(orderType) && ConEnum.oralmeds.getName().equals(conType)) {
+    //         // 化验开单项 + 禁忌服用药品提示语
+    //         msg = String.format("该患者%s,会影响%s结果,请留意", content, orderName);
+    //     } else if (ConEnum.repeat24.getName().equals(conType)) {
+    //         // 24小时重复开立
+    //         msg = String.format("%s重复开立", orderName);
+    //     } else if (ConEnum.repeat.getName().equals(conType)) {
+    //         // 辅检正常项目无需重复开立
+    //         msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
+    //     } else  if (ConEnum.exclusion.getName().equals(conType)) {
+    //         // 开单项互斥
+    //         msg = String.format("检查项目互斥:%s与%s不宜同时进行", orderName, content);
+    //         billMsg.setMsg(msg);
+    //     }
+    //     billMsg.setMsg(msg);
+    //     billMsg.setOrderName(orderName);
+    //     billMsg.setOrderStandName(orderStandName);
+    //     billMsg.setContent(content);
+    //     billMsg.setType(conType);
+    //     return billMsg;
+    // }
 }

+ 0 - 0
src/main/java/com/diagbot/util/RegexUtil.java


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