Browse Source

Merge branch 'indicationman' into develop

gaodm 4 years ago
parent
commit
39748e320b
45 changed files with 3032 additions and 83 deletions
  1. 210 0
      doc/002.20201209初始化脚本/cdss-core_init.sql
  2. 2 2
      pom.xml
  3. 48 0
      src/main/java/com/diagbot/dto/DictionaryInfoDTO.java
  4. 88 0
      src/main/java/com/diagbot/entity/DictionaryInfo.java
  5. 3 0
      src/main/java/com/diagbot/entity/node/Age.java
  6. 20 0
      src/main/java/com/diagbot/entity/node/BillConcept.java
  7. 24 0
      src/main/java/com/diagbot/entity/node/BillCondition.java
  8. 37 0
      src/main/java/com/diagbot/entity/node/BillItem.java
  9. 37 0
      src/main/java/com/diagbot/entity/node/BillItemDetail.java
  10. 5 2
      src/main/java/com/diagbot/entity/node/Group.java
  11. 8 4
      src/main/java/com/diagbot/entity/relationship/base/BaseRelation.java
  12. 500 0
      src/main/java/com/diagbot/facade/BillManFacade.java
  13. 67 0
      src/main/java/com/diagbot/facade/DictionaryFacade.java
  14. 16 0
      src/main/java/com/diagbot/mapper/DictionaryInfoMapper.java
  15. 47 0
      src/main/java/com/diagbot/repository/AgeRepository.java
  16. 17 7
      src/main/java/com/diagbot/repository/BaseNodeRepository.java
  17. 15 0
      src/main/java/com/diagbot/repository/BillConflictItemRepository.java
  18. 215 0
      src/main/java/com/diagbot/repository/BillManRepository.java
  19. 29 1
      src/main/java/com/diagbot/repository/ClinicalFindingRepository.java
  20. 15 0
      src/main/java/com/diagbot/repository/ConflictDeviceRepository.java
  21. 15 0
      src/main/java/com/diagbot/repository/DiseaseRepository.java
  22. 15 0
      src/main/java/com/diagbot/repository/GenderRepository.java
  23. 30 3
      src/main/java/com/diagbot/repository/GroupRepository.java
  24. 48 0
      src/main/java/com/diagbot/repository/LisRepository.java
  25. 76 20
      src/main/java/com/diagbot/repository/LisSetNode.java
  26. 119 12
      src/main/java/com/diagbot/repository/MedRegNameNode.java
  27. 15 0
      src/main/java/com/diagbot/repository/OralMedicineRepository.java
  28. 15 0
      src/main/java/com/diagbot/repository/PacsDescribeRepository.java
  29. 377 21
      src/main/java/com/diagbot/repository/PacsNameNode.java
  30. 318 3
      src/main/java/com/diagbot/repository/PacsSubNameNode.java
  31. 29 1
      src/main/java/com/diagbot/repository/VitalRepository.java
  32. 282 4
      src/main/java/com/diagbot/repository/YiBaoOperationNameNode.java
  33. 16 0
      src/main/java/com/diagbot/service/DictionaryInfoService.java
  34. 20 0
      src/main/java/com/diagbot/service/impl/DictionaryInfoServiceImpl.java
  35. 25 0
      src/main/java/com/diagbot/vo/BillPageVO.java
  36. 26 0
      src/main/java/com/diagbot/vo/BillSaveVO.java
  37. 23 0
      src/main/java/com/diagbot/vo/ConceptIndexVO.java
  38. 27 0
      src/main/java/com/diagbot/vo/ConditionIndexVO.java
  39. 18 0
      src/main/java/com/diagbot/vo/RelationIdVO.java
  40. 15 0
      src/main/java/com/diagbot/vo/RelationStatusVO.java
  41. 96 0
      src/main/java/com/diagbot/web/BillManController.java
  42. 1 1
      src/main/resources/application-dev.yml
  43. 1 1
      src/main/resources/application-local.yml
  44. 1 1
      src/main/resources/logback-spring.xml
  45. 21 0
      src/main/resources/mapper/DictionaryInfoMapper.xml

+ 210 - 0
doc/002.20201209初始化脚本/cdss-core_init.sql

@@ -0,0 +1,210 @@
+use `cdss`;
+
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 192.168.2.236
+ Source Server Type    : MySQL
+ Source Server Version : 50731
+ Source Host           : 192.168.2.236:3306
+ Source Schema         : cdss
+
+ Target Server Type    : MySQL
+ Target Server Version : 50731
+ File Encoding         : 65001
+
+ Date: 09/12/2020 10:24:41
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for sys_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_menu`;
+CREATE TABLE `sys_menu`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '菜单名称',
+  `parent_id` bigint(20) NOT NULL DEFAULT -1 COMMENT '-1:表示顶级,其他值表示上级菜单的id',
+  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '编码,与前端对应',
+  `order_no` int(11) NOT NULL DEFAULT 0 COMMENT '排序,从小到大',
+  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统菜单' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of sys_menu
+-- ----------------------------
+INSERT INTO `sys_menu` VALUES (1, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医学术语库维护', -1, 'CDSS-YXSYK', 1, '');
+INSERT INTO `sys_menu` VALUES (2, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '系统配置', -1, 'CDSS-XTPZ', 2, '');
+INSERT INTO `sys_menu` VALUES (3, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '诊断关联维护', 1, 'YXSYK-ZDGLWH', 2, '医学术语库维护-诊断关联维护');
+INSERT INTO `sys_menu` VALUES (4, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '检验关联维护', 1, 'YXSYK-JYGLWH', 3, '医学术语库维护-检验关联维护');
+INSERT INTO `sys_menu` VALUES (5, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '检查关联维护', 1, 'YXSYK-JCGLWH', 4, '医学术语库维护-检验关联维护-检查关联维护');
+INSERT INTO `sys_menu` VALUES (6, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '药品关联维护', 1, 'YXSYK-YPGLWH', 5, '');
+INSERT INTO `sys_menu` VALUES (7, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '手术/操作关联维护', 1, 'YXSYK-SSCZGLWH', 6, '');
+INSERT INTO `sys_menu` VALUES (8, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '科室关联维护', 1, 'YXSYK-KSGLWH', 8, '');
+INSERT INTO `sys_menu` VALUES (9, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医学术语静态知识维护', 1, 'YXSYK-JTZSWH', 1, '');
+INSERT INTO `sys_menu` VALUES (10, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '关联维护设置', 1, 'YXSYK-GLWH', 9, '');
+INSERT INTO `sys_menu` VALUES (11, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '电子病历方案配置', 2, 'XTPZ-DZBLFAPZ', 1, '');
+INSERT INTO `sys_menu` VALUES (12, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '输血关联维护', 1, 'YXSYK-SXGLWH', 7, '');
+INSERT INTO `sys_menu` VALUES (13, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '规则维护', -1, 'CDSS-GZWH', 3, '规则维护');
+INSERT INTO `sys_menu` VALUES (14, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '开单合理性规则维护', 13, 'GZWH-KDHLXGZWH', 1, '规则维护-开单合理性规则维护');
+
+SET FOREIGN_KEY_CHECKS = 1;
+
+
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 192.168.2.236
+ Source Server Type    : MySQL
+ Source Server Version : 50731
+ Source Host           : 192.168.2.236:3306
+ Source Schema         : cdss
+
+ Target Server Type    : MySQL
+ Target Server Version : 50731
+ File Encoding         : 65001
+
+ Date: 09/12/2020 10:25:03
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for sys_role_menu
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_role_menu`;
+CREATE TABLE `sys_role_menu`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `role_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '角色id',
+  `menu_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '菜单id',
+  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色和菜单的映射表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of sys_role_menu
+-- ----------------------------
+INSERT INTO `sys_role_menu` VALUES (1, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 1, NULL);
+INSERT INTO `sys_role_menu` VALUES (2, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 2, NULL);
+INSERT INTO `sys_role_menu` VALUES (3, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 3, NULL);
+INSERT INTO `sys_role_menu` VALUES (4, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 4, NULL);
+INSERT INTO `sys_role_menu` VALUES (5, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 5, NULL);
+INSERT INTO `sys_role_menu` VALUES (6, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 6, NULL);
+INSERT INTO `sys_role_menu` VALUES (7, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 7, NULL);
+INSERT INTO `sys_role_menu` VALUES (8, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 8, NULL);
+INSERT INTO `sys_role_menu` VALUES (9, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 9, NULL);
+INSERT INTO `sys_role_menu` VALUES (10, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 10, NULL);
+INSERT INTO `sys_role_menu` VALUES (11, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 11, NULL);
+INSERT INTO `sys_role_menu` VALUES (12, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 12, NULL);
+INSERT INTO `sys_role_menu` VALUES (13, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 13, NULL);
+INSERT INTO `sys_role_menu` VALUES (14, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', -1, 14, NULL);
+
+SET FOREIGN_KEY_CHECKS = 1;
+
+
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 192.168.2.236
+ Source Server Type    : MySQL
+ Source Server Version : 50731
+ Source Host           : 192.168.2.236:3306
+ Source Schema         : cdss
+
+ Target Server Type    : MySQL
+ Target Server Version : 50731
+ File Encoding         : 65001
+
+ Date: 09/12/2020 10:39:12
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for sys_dictionary_info
+-- ----------------------------
+DROP TABLE IF EXISTS `sys_dictionary_info`;
+CREATE TABLE `sys_dictionary_info`  (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `is_deleted` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime(0) NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `group_type` bigint(20) NOT NULL DEFAULT 0 COMMENT '分组(值自定义)',
+  `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '内容',
+  `val` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci 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) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 50 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'CDSS字典表' ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of sys_dictionary_info
+-- ----------------------------
+INSERT INTO `sys_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 `sys_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 `sys_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 `sys_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 `sys_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 `sys_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 `sys_dictionary_info` VALUES (7, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '诊断', '医保疾病名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (8, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '药品', '药品通用名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (9, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '检验套餐', '实验室检查套餐名', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (10, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '检验细项', '实验室检查名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (11, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '检查', '辅助检查名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (12, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '手术和操作', '医保手术和操作名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (13, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '', '0', 0, 1, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (14, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '注射剂', '1', 0, 10, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (15, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '片剂', '2', 0, 20, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (16, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '缓释剂', '3', 0, 30, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (17, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '胶囊剂', '4', 0, 40, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (18, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 9, '滴丸剂', '5', 0, 50, '药品剂型');
+INSERT INTO `sys_dictionary_info` VALUES (19, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '检查子项', '辅助检查子项目名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (21, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '诊断', '1', 0, 1, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (22, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '药品', '2', 0, 2, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (23, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '检验套餐', '3', 0, 3, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (24, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '检验细项', '4', 0, 4, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (25, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '检查', '5', 0, 5, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (26, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '检查子项', '6', 0, 6, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (27, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 10, '手术和操作', '7', 0, 7, '静态知识类型');
+INSERT INTO `sys_dictionary_info` VALUES (28, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 8, '药品注册名称', '药品注册名称', 0, 0, '图谱标签与页面显示类型对应关系');
+INSERT INTO `sys_dictionary_info` VALUES (29, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 11, '检验套餐', '1', 0, 1, '开单合理项检索类型');
+INSERT INTO `sys_dictionary_info` VALUES (30, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 11, '检查', '2', 0, 2, '开单合理项检索类型');
+INSERT INTO `sys_dictionary_info` VALUES (31, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 11, '检查子项', '3', 0, 3, '开单合理项检索类型');
+INSERT INTO `sys_dictionary_info` VALUES (32, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 11, '手术和操作', '4', 0, 4, '开单合理项检索类型');
+INSERT INTO `sys_dictionary_info` VALUES (33, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 11, '药品注册名称', '5', 0, 5, '开单合理项检索类型');
+INSERT INTO `sys_dictionary_info` VALUES (34, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '性别', '1', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (35, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '实验室检查', '2', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (36, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '临床表现', '3', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (37, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '辅助检查名称描述', '4', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (38, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '疾病', '5', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (39, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '服用药品', '6', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (40, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '药物过敏原', '7', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (41, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '食物过敏原', '8', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (42, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '手术', '9', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (43, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '禁忌人群', '10', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (44, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '过敏原', '11', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (45, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '体征', '12', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (46, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '禁忌医疗器械及物品', '13', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (47, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '年龄', '14', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (48, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '给药途径', '15', 0, 0, '开单禁忌条件类型');
+INSERT INTO `sys_dictionary_info` VALUES (49, 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 12, '开单项互斥', '16', 0, 0, '开单禁忌条件类型');
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 2 - 2
pom.xml

@@ -34,8 +34,8 @@
         <logstash.version>5.2</logstash.version>
         <logstash.version>5.2</logstash.version>
         <docker-maven-plugin.version>1.2.1</docker-maven-plugin.version>
         <docker-maven-plugin.version>1.2.1</docker-maven-plugin.version>
         <aggregator.version>1.1.3</aggregator.version>
         <aggregator.version>1.1.3</aggregator.version>
-        <docker.image.prefix>192.168.2.121:5000/diagbotcloud</docker.image.prefix>
-        <registryUrl>http://192.168.2.121:5000/repository/diagbotcloud/</registryUrl>
+        <docker.image.prefix>192.168.2.236:5000/diagbotcloud</docker.image.prefix>
+        <registryUrl>http://192.168.2.236:5000/repository/diagbotcloud/</registryUrl>
     </properties>
     </properties>
 
 
     <dependencyManagement>
     <dependencyManagement>

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

@@ -0,0 +1,48 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * icss字典表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@Getter
+@Setter
+public class DictionaryInfoDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 分组(值自定义)
+     */
+    private Long groupType;
+
+    /**
+     * 内容
+     */
+    private String name;
+
+    /**
+     * 值
+     */
+    private String val;
+
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 88 - 0
src/main/java/com/diagbot/entity/DictionaryInfo.java

@@ -0,0 +1,88 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * CDSS字典表
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@TableName("sys_dictionary_info")
+@Getter
+@Setter
+public class DictionaryInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 分组(值自定义)
+     */
+    private Long groupType;
+
+    /**
+     * 内容
+     */
+    private String name;
+
+    /**
+     * 值
+     */
+    private String val;
+
+    /**
+     * 返回类型(0: 都返回,1:后台维护返回 2:icss界面返回)
+     */
+    private Integer returnType;
+
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 3 - 0
src/main/java/com/diagbot/entity/node/Age.java

@@ -17,6 +17,9 @@ import java.util.Set;
 @NodeEntity(label = "年龄")
 @NodeEntity(label = "年龄")
 public class Age extends BaseNode  {
 public class Age extends BaseNode  {
 
 
+	@Property(name = "单位")
+	private String unit;
+
 	@Property(name = "最小值")
 	@Property(name = "最小值")
 	private Double minval;
 	private Double minval;
 
 

+ 20 - 0
src/main/java/com/diagbot/entity/node/BillConcept.java

@@ -0,0 +1,20 @@
+package com.diagbot.entity.node;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/19 13:26
+ */
+@Getter
+@Setter
+@QueryResult
+public class BillConcept {
+    private Long id;
+    private String name;
+    private Integer status;
+    private String conceptLabel;
+}

+ 24 - 0
src/main/java/com/diagbot/entity/node/BillCondition.java

@@ -0,0 +1,24 @@
+package com.diagbot.entity.node;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/18 16:09
+ */
+@Getter
+@Setter
+@QueryResult
+public class BillCondition {
+    private Long id;
+    private String name;
+    private Integer status;
+    private String conditionLabel;
+    private String unit;
+    private Double minValue;
+    private Double maxValue;
+    private Integer range;
+}

+ 37 - 0
src/main/java/com/diagbot/entity/node/BillItem.java

@@ -0,0 +1,37 @@
+package com.diagbot.entity.node;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 13:38
+ */
+@Setter
+@Getter
+@QueryResult
+public class BillItem {
+    private String ruleName;
+    private Integer type;
+
+    private Long conceptId;
+    private String conceptName;
+    private String conceptLabel;
+    private Integer conceptStatus;
+
+    private Integer ruleType;
+    private Long relationId;
+    private String relationName;
+    private Integer relationStatus;
+
+    private Long conditionId;
+    private String conditionName;
+    private String conditionLabel;
+    private Double conditionMinValue;
+    private Double conditionMaxValue;
+    private String conditionUnit;
+    private Integer conditionRange;
+    private Integer conditionStatus;
+}

+ 37 - 0
src/main/java/com/diagbot/entity/node/BillItemDetail.java

@@ -0,0 +1,37 @@
+package com.diagbot.entity.node;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.neo4j.annotation.QueryResult;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/24 16:10
+ */
+@Getter
+@Setter
+@QueryResult
+public class BillItemDetail {
+    private String ruleName;
+    private Integer type;
+
+    private Long conceptId;
+    private String conceptName;
+    private String conceptLabel;
+    private Integer conceptStatus;
+
+    private Integer ruleType;
+    private Long relationId;
+    private String relationName;
+    private Integer relationStatus;
+
+    private Long conditionId;
+    private String conditionName;
+    private String conditionLabel;
+    private Double conditionMinValue;
+    private Double conditionMaxValue;
+    private String conditionUnit;
+    private Integer conditionRange;
+    private Integer conditionStatus;
+}

+ 5 - 2
src/main/java/com/diagbot/entity/node/Group.java

@@ -25,8 +25,11 @@ public class Group extends BaseNode  {
 	@Property(name = "最大值")
 	@Property(name = "最大值")
 	private Double maxval;
 	private Double maxval;
 
 
-	@Property(name = "禁忌人群指标")
-	private String groupidx;
+	@Property(name = "范围")
+	private Integer range;
+
+    @Property(name = "禁忌人群指标")
+    private String groupidx;
 
 
 	@Relationship(type = "实验室检查名称禁忌禁忌人群", direction = Relationship.INCOMING)
 	@Relationship(type = "实验室检查名称禁忌禁忌人群", direction = Relationship.INCOMING)
 	private Set<LisNameGroup> lisnameGroups = new HashSet<>();
 	private Set<LisNameGroup> lisnameGroups = new HashSet<>();

+ 8 - 4
src/main/java/com/diagbot/entity/relationship/base/BaseRelation.java

@@ -1,11 +1,11 @@
 package com.diagbot.entity.relationship.base;
 package com.diagbot.entity.relationship.base;
 
 
-import com.diagbot.entity.node.Group;
-import com.diagbot.entity.node.YiBaoOperationName;
-import lombok.Data;
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
-import org.neo4j.ogm.annotation.*;
+import org.neo4j.ogm.annotation.GeneratedValue;
+import org.neo4j.ogm.annotation.Id;
+import org.neo4j.ogm.annotation.Property;
+import org.neo4j.ogm.annotation.RelationshipEntity;
 
 
 @Getter
 @Getter
 @Setter
 @Setter
@@ -18,4 +18,8 @@ public class BaseRelation {
     // 节点的状态, 0:删除 1:正常
     // 节点的状态, 0:删除 1:正常
     @Property(name = "状态")
     @Property(name = "状态")
     private Integer status;
     private Integer status;
+
+    // 规则类型, 1:文本规则 2:数值规则
+    @Property(name = "规则类型")
+    private Integer ruleType;
 }
 }

+ 500 - 0
src/main/java/com/diagbot/facade/BillManFacade.java

@@ -0,0 +1,500 @@
+package com.diagbot.facade;
+
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.entity.node.BillConcept;
+import com.diagbot.entity.node.BillCondition;
+import com.diagbot.entity.node.BillItem;
+import com.diagbot.entity.node.Group;
+import com.diagbot.entity.node.Lis;
+import com.diagbot.entity.node.LisSet;
+import com.diagbot.entity.node.MedRegName;
+import com.diagbot.entity.node.PacsName;
+import com.diagbot.entity.node.PacsSubName;
+import com.diagbot.entity.node.Vital;
+import com.diagbot.entity.node.YiBaoOperationName;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.repository.*;
+import com.diagbot.util.Cn2SpellUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.BillPageVO;
+import com.diagbot.vo.BillSaveVO;
+import com.diagbot.vo.ConceptIndexVO;
+import com.diagbot.vo.ConditionIndexVO;
+import com.diagbot.vo.RelationIdVO;
+import com.diagbot.vo.RelationStatusVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 13:53
+ */
+@Component
+public class BillManFacade {
+    @Autowired
+    BillManRepository billManRepository;
+    @Autowired
+    DictionaryFacade dictionaryFacade;
+    @Autowired
+    BaseNodeRepository baseNodeRepository;
+
+    @Autowired
+    PacsNameRepository pacsNameRepository;
+    @Autowired
+    PacsSubNameRepository pacsSubNameRepository;
+    @Autowired
+    LisSetRepository lisSetRepository;
+    @Autowired
+    YiBaoOperationNameRepository yiBaoOperationNameRepository;
+    @Autowired
+    MedRegNameRepository medRegNameRepository;
+
+    @Autowired
+    PacsNameNode pacsNameNode;
+    @Autowired
+    PacsSubNameNode pacsSubNameNode;
+    @Autowired
+    MedRegNameNode medRegNameNode;
+    @Autowired
+    LisSetNode lisSetNode;
+    @Autowired
+    YiBaoOperationNameNode yiBaoOperationNameNode;
+
+
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    GenderRepository genderRepository;
+    @Autowired
+    LisRepository lisRepository;
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    ClinicalFindingRepository clinicalFindingRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    AgeRepository ageRepository;
+    @Autowired
+    DiseaseRepository diseaseRepository;
+    @Autowired
+    BillConflictItemRepository billConflictItemRepository;
+    @Autowired
+    ConflictDeviceRepository conflictDeviceRepository;
+    @Autowired
+    OralMedicineRepository oralMedicineRepository;
+    @Autowired
+    PacsDescribeRepository pacsDescribeRepository;
+    @Autowired
+    AllergenRepository allergenRepository;
+
+    /**
+     * 获取开单合理项列表
+     *
+     * @param billPageVO
+     * @return
+     */
+    public Page<BillItem> getPage(BillPageVO billPageVO) {
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        List<String> labels = Lists.newArrayList();
+        if (ListUtil.isNotEmpty(billPageVO.getTypes())) {
+            for (Integer type : billPageVO.getTypes()) {
+                if (dicIndicationManTypeMap.containsKey(type.toString())
+                        && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(type.toString()))) {
+                    labels.add(dicTypeConvertMap.get(dicIndicationManTypeMap.get(type.toString())));
+                }
+            }
+        }
+        billPageVO.setLabels(labels);
+        Pageable pageable = PageRequest.of(billPageVO.getNumber(), billPageVO.getSize());
+        Page<BillItem> page = billManRepository.getPage(billPageVO.getLabels(),
+                billPageVO.getConceptName(),
+                billPageVO.getConditionName(),
+                billPageVO.getRelationStatus(),
+                pageable);
+
+        if(ListUtil.isNotEmpty(page.getContent())) {
+            for (BillItem record : page.getContent()) {
+                /*int index = record.getConditionName().indexOf("禁忌");
+                if (index > 0) {
+                    record.setConditionName(record.getConditionName().substring(index + 2));
+                }*/
+                record.setRuleName(record.getConditionName() + "开单" + record.getConceptName());
+            }
+        }
+        return page;
+    }
+
+    /**
+     * 条件明细检索
+     *
+     * @param conditionIndexVO
+     * @return
+     */
+    public List<BillCondition> conditionIndex(ConditionIndexVO conditionIndexVO) {
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        List<DictionaryInfoDTO> dicBillConditionType = dictionaryFacade.getListByGroupType(12);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        Map<String, String> dicBillConditionTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicBillConditionType, "name", "val");
+        /*if (dicIndicationManTypeMap.containsKey(conditionIndexVO.getType().toString())
+                && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(conditionIndexVO.getType().toString()))) {
+            conditionIndexVO.setConceptLabel(dicTypeConvertMap.get(dicIndicationManTypeMap.get(conditionIndexVO.getType().toString())));
+        }*/
+        //条件明细筛选范围
+        List<String> conditionLabels = Lists.newArrayList();
+        List<String> relationTypes = billManRepository.getRelationTypes(conditionIndexVO.getConceptLabel());
+        if (ListUtil.isNotEmpty(relationTypes)) {
+            for (String relationType : relationTypes) {
+                int index = relationType.indexOf("禁忌");
+                if (index > 0 && dicBillConditionTypeMap.containsKey(relationType.substring(index + 2))) {
+                    conditionLabels.add(relationType.substring(index + 2));
+                }
+            }
+        }
+        //排除项
+        List<Long> notInIds = Lists.newArrayList();
+       /* List<BillCondition> notInConditions
+                = billManRepository.getNotInConditions(conditionIndexVO.getConceptName(), conditionIndexVO.getConceptLabel());
+        if (ListUtil.isNotEmpty(notInConditions)) {
+            notInIds = notInConditions.stream().map(i -> i.getId()).distinct().collect(Collectors.toList());
+        }*/
+        List<BillCondition> conditions = billManRepository.conditionIndex(conditionLabels,
+                notInIds,
+                conditionIndexVO.getConditionName(),
+                conditionIndexVO.getConditionName(),
+                100);
+
+        for (BillCondition condition : conditions) {
+            if (condition.getRange() != null && condition.getRange().equals(1)) {
+                Double minValue = condition.getMinValue();
+                condition.setMinValue(condition.getMaxValue());
+                condition.setMaxValue(minValue);
+                condition.setRange(0);
+            }
+        }
+        return conditions;
+    }
+
+    /**
+     * 开单项检索
+     *
+     * @param conceptIndexVO
+     * @return
+     */
+    public List<BillConcept> conceptIndex(ConceptIndexVO conceptIndexVO) {
+        List<String> conceptLabels = Lists.newArrayList();
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        if (dicIndicationManTypeMap.containsKey(conceptIndexVO.getType().toString())
+                && dicTypeConvertMap.containsKey(dicIndicationManTypeMap.get(conceptIndexVO.getType().toString()))) {
+            conceptIndexVO.setConceptLabel(dicTypeConvertMap.get(dicIndicationManTypeMap.get(conceptIndexVO.getType().toString())));
+            conceptLabels.add(conceptIndexVO.getConceptLabel());
+        }
+        List<BillConcept> concepts = billManRepository.conceptIndex(conceptLabels,
+                conceptIndexVO.getConceptName(),
+                conceptIndexVO.getConceptName(),
+                100);
+
+        return concepts;
+    }
+
+
+    /**
+     * 查询单条规则
+     *
+     * @param relationIdVO
+     * @return
+     */
+    public BillSaveVO getRecordByRelationId(RelationIdVO relationIdVO) {
+        BillSaveVO billSaveVO = new BillSaveVO();
+        BillConcept billConcept = new BillConcept();
+        BillCondition billCondition = new BillCondition();
+
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "val", "name");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "name", "val");
+        BillItem billItem = billManRepository.getRecordByRelationId(relationIdVO.getRelationId());
+        if (billItem != null) {
+            billConcept.setId(billItem.getConceptId());
+            billConcept.setName(billItem.getConceptName());
+            billConcept.setConceptLabel(billItem.getConceptLabel());
+            billConcept.setStatus(billItem.getConceptStatus());
+
+            billCondition.setId(billItem.getConditionId());
+            billCondition.setName(billItem.getConditionName());
+            billCondition.setConditionLabel(billItem.getConditionLabel());
+            billCondition.setMaxValue(billItem.getConditionMaxValue());
+            billCondition.setMinValue(billItem.getConditionMinValue());
+            billCondition.setUnit(billItem.getConditionUnit());
+            billCondition.setRange(billItem.getConditionRange());
+            billCondition.setStatus(billItem.getConditionStatus());
+
+            //如果数值范围取区间外,大小值交换
+            if (billCondition.getRange() != null && billCondition.getRange().equals(1)) {
+                Double minValue = billCondition.getMinValue();
+                billCondition.setMinValue(billCondition.getMaxValue());
+                billCondition.setMaxValue(minValue);
+                billCondition.setRange(0);
+            }
+
+            /*int index = billCondition.getName().indexOf("禁忌");
+            if (index > 0) {
+                billCondition.setName(billCondition.getName().substring(index + 2));
+            }*/
+
+            if (dicTypeConvertMap.containsKey(billItem.getConceptLabel())
+                    && dicIndicationManTypeMap.containsKey(dicTypeConvertMap.get(billItem.getConceptLabel()))) {
+                billSaveVO.setType(Integer.valueOf(dicIndicationManTypeMap.get(dicTypeConvertMap.get(billItem.getConceptLabel()))));
+            }
+            billSaveVO.setRuleType(billItem.getRuleType());
+            billSaveVO.setRuleName(billCondition.getName() + "开单" + billConcept.getName());
+            billSaveVO.setRelationId(billItem.getRelationId());
+            billSaveVO.setRelationName(billItem.getRelationName());
+            billSaveVO.setRelationStatus(billItem.getRelationStatus());
+            billSaveVO.setConcept(billConcept);
+            billSaveVO.setCondition(billCondition);
+        }
+        return billSaveVO;
+    }
+
+    /**
+     * 保存
+     *
+     * @param billSaveVO
+     * @return
+     */
+    public Boolean saveRecord(BillSaveVO billSaveVO) {
+        List<DictionaryInfoDTO> dicTypeConvert = dictionaryFacade.getListByGroupType(8);
+        List<DictionaryInfoDTO> dicIndicationManType = dictionaryFacade.getListByGroupType(11);
+        List<DictionaryInfoDTO> dicBillConditionType = dictionaryFacade.getListByGroupType(12);
+        Map<String, String> dicTypeConvertMap
+                = EntityUtil.makeMapWithKeyValue(dicTypeConvert, "name", "val");
+        Map<String, String> dicIndicationManTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicIndicationManType, "val", "name");
+        Map<String, String> dicBillConditionTypeMap
+                = EntityUtil.makeMapWithKeyValue(dicBillConditionType, "name", "val");
+
+        //文本类型: 开单项-[]->条件明细
+        //数值类型: 开单项-[]->开单项+禁忌+条件明细
+        String relationType
+                = billSaveVO.getConcept().getConceptLabel() + "禁忌" + billSaveVO.getCondition().getConditionLabel();
+        BillConcept concept = billSaveVO.getConcept();
+        BillCondition condition = billSaveVO.getCondition();
+
+        String conditionName = condition.getName();
+        String conditionName_new = concept.getName() + "禁忌" + condition.getName();
+        String conditionName_save = conditionName;
+
+        BillItem existRelation = billManRepository.isExistRelation(billSaveVO.getConcept().getName(),
+                conditionName,
+                relationType);
+        BillItem existRelation_new = billManRepository.isExistRelation(billSaveVO.getConcept().getName(),
+                conditionName_new,
+                relationType);
+
+        //条件名称
+        if (billSaveVO.getRuleType().equals(2)) {
+            conditionName_save = conditionName_new;
+        }
+
+        //新增已存在
+        if (billSaveVO.getRelationId() == null) {
+            if ((billSaveVO.getRuleType().equals(1) && existRelation != null)
+                    || (billSaveVO.getRuleType().equals(2) && existRelation_new != null)) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "规则已存在");
+            }
+        } else {
+            if ((billSaveVO.getRelationId().equals(1)
+                    && existRelation != null
+                    && !existRelation.getRelationId().equals(billSaveVO.getRelationId()))
+                    || (billSaveVO.getRelationId().equals(2)
+                    && existRelation_new != null
+                    && !existRelation_new.getRelationId().equals(billSaveVO.getRelationId()))) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "规则已存在");
+            }
+        }
+
+        //条件明细筛选范围
+        List<String> conditionLabels = Lists.newArrayList();
+        List<String> relationTypes = billManRepository.getRelationTypes(concept.getConceptLabel());
+        if (ListUtil.isNotEmpty(relationTypes)) {
+            for (String item : relationTypes) {
+                int index = item.indexOf("禁忌");
+                if (index > 0 && dicBillConditionTypeMap.containsKey(item.substring(index + 2))) {
+                    conditionLabels.add(item.substring(index + 2));
+                }
+            }
+        }
+
+        if (!conditionLabels.contains(condition.getConditionLabel())) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS, "开单项目与条件明细无关联");
+        }
+
+        //数值类型特殊处理
+        if (billSaveVO.getRuleType() != null
+                && billSaveVO.getRuleType().equals(2)) {
+            if (condition.getMinValue() != null
+                    && condition.getMaxValue() != null
+                    && condition.getMinValue() > condition.getMaxValue()) {
+                Double minValue = condition.getMinValue();
+                condition.setMinValue(condition.getMaxValue());
+                condition.setMaxValue(minValue);
+                condition.setRange(1);
+            } else {
+                condition.setRange(0);
+            }
+            billSaveVO.setCondition(condition);
+        }
+
+        //删除旧的关系
+        if (billSaveVO.getRelationId() != null) {
+            RelationIdVO relationIdVO = new RelationIdVO();
+            relationIdVO.setRelationId(billSaveVO.getRelationId());
+            BillSaveVO oldBillRecord = getRecordByRelationId(relationIdVO);
+            if (oldBillRecord != null
+                    && oldBillRecord.getRelationId().equals(billSaveVO.getRelationId())
+                    && (!oldBillRecord.getCondition().getId().equals(condition.getId())
+                    || !oldBillRecord.getConcept().getId().equals(concept.getId()))) {
+                baseNodeRepository.deleteRelationStatusById(billSaveVO.getRelationId());
+            }
+        }
+
+        //条件明细节点更新
+        //数值类型可新增或更新条件明细节点,文本类型不允许新增或修改
+        if (billSaveVO.getRuleType().equals(1)) {
+        } else if (billSaveVO.getRuleType().equals(2)) {
+            switch (condition.getConditionLabel()) {
+                case "实验室检查":
+                    Lis lis = lisRepository.createOrUpdate(conditionName_save,
+                            0,
+                            Cn2SpellUtil.converterToFirstSpell(conditionName_save),
+                            1,
+                            condition.getMaxValue(),
+                            condition.getMinValue(),
+                            condition.getRange(),
+                            condition.getUnit(),
+                            conditionName);
+                    break;
+                case "禁忌人群":
+                    Group group = groupRepository.createOrUpdate(conditionName_save,
+                            0,
+                            Cn2SpellUtil.converterToFirstSpell(conditionName_save),
+                            1,
+                            condition.getMaxValue(),
+                            condition.getMinValue(),
+                            condition.getRange(),
+                            condition.getUnit(),
+                            conditionName);
+                    break;
+                case "体征":
+                    Vital vital = vitalRepository.createOrUpdate(conditionName_save,
+                            0,
+                            Cn2SpellUtil.converterToFirstSpell(conditionName_save),
+                            1,
+                            condition.getMaxValue(),
+                            condition.getMinValue(),
+                            condition.getRange(),
+                            condition.getUnit(),
+                            conditionName);
+                    break;
+                /*
+                case "临床表现":
+                    break;
+                case "年龄":
+                    break;
+                case "性别":
+                    break;
+                case "辅助检查名称描述":
+                    break;
+                case "疾病":
+                    break;
+                case "服用药品":
+                    break;
+                case "药物过敏原":
+                    break;
+                case "食物过敏原":
+                    break;
+                case "手术":
+                    break;
+                case "过敏原":
+                    break;
+                case "禁忌医疗器械及物品":
+                    break;
+                case "给药途径":
+                    break;
+                case "开单项互斥":
+                    break;*/
+                default:
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "该条件不允许添加数值规则");
+            }
+        }
+
+        //保存关系
+        switch (concept.getConceptLabel()) {
+            case "实验室检查套餐名":
+                LisSet lisSet = lisSetRepository.findByNameIs(concept.getName()).get(0);
+                lisSetNode.updateRelationExt(lisSet, relationType, 1, billSaveVO.getRuleType(), conditionName_save, lisSetRepository);
+                break;
+            case "辅助检查名称":
+                PacsName pacsName = pacsNameRepository.findByNameIs(concept.getName()).get(0);
+                pacsNameNode.updateRelationExt(pacsName, relationType, 1, billSaveVO.getRuleType(), conditionName_save, pacsNameRepository);
+                break;
+            case "辅助检查子项目名称":
+                PacsSubName pacsSubName = pacsSubNameRepository.findByNameIs(concept.getName()).get(0);
+                pacsSubNameNode.updateRelationExt(pacsSubName, relationType, 1, billSaveVO.getRuleType(), conditionName_save, pacsSubNameRepository);
+                break;
+            case "医保手术和操作名称":
+                YiBaoOperationName yiBaoOperationName = yiBaoOperationNameRepository.findByNameIs(concept.getName()).get(0);
+                yiBaoOperationNameNode.updateRelationExt(yiBaoOperationName, relationType, 1, billSaveVO.getRuleType(), conditionName_save, yiBaoOperationNameRepository);
+                break;
+            case "药品注册名称":
+                MedRegName medRegName = medRegNameRepository.findByNameIs(concept.getName()).get(0);
+                medRegNameNode.updateRelationExt(medRegName, relationType, 1, billSaveVO.getRuleType(), conditionName_save, medRegNameRepository);
+                break;
+            default:
+                break;
+        }
+        return true;
+    }
+
+    /**
+     * 启用禁用
+     *
+     * @param relationStatusVO
+     * @return
+     */
+    public Boolean updateStatus(RelationStatusVO relationStatusVO) {
+        if (relationStatusVO.getStatus() == null) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "请输入启用禁用状态");
+        }
+        baseNodeRepository.updateRelationStatusById(relationStatusVO.getRelationId(), relationStatusVO.getStatus());
+        return true;
+    }
+}

+ 67 - 0
src/main/java/com/diagbot/facade/DictionaryFacade.java

@@ -0,0 +1,67 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.DictionaryInfoDTO;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.impl.DictionaryInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2018/11/23 11:37
+ */
+@Component
+public class DictionaryFacade extends DictionaryInfoServiceImpl {
+
+    /**
+     * 返回字典信息
+     *
+     * @return
+     */
+    public Map<Long, List<DictionaryInfoDTO>> getList() {
+        List<DictionaryInfo> list = this.list(new QueryWrapper<DictionaryInfo>()
+                .in("return_type", ListUtil.arrayToList(new Long[] { 0L, 2L }))
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("group_type", "order_no"));
+        List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
+        return EntityUtil.makeEntityListMap(listRes, "groupType");
+    }
+
+    /**
+     * 返回字典信息
+     *
+     * @return
+     */
+    public Map<Long, List<DictionaryInfoDTO>> getListBack() {
+        List<DictionaryInfo> list = this.list(new QueryWrapper<DictionaryInfo>()
+                .in("return_type", ListUtil.arrayToList(new Long[] { 0L, 1L }))
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("group_type", "order_no"));
+        List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
+        return EntityUtil.makeEntityListMap(listRes, "groupType");
+    }
+
+
+    /**
+     * 返回指定字典信息
+     *
+     * @param groupType
+     * @return
+     */
+    public List<DictionaryInfoDTO> getListByGroupType(Integer groupType) {
+        List<DictionaryInfo> list = this.list(new QueryWrapper<DictionaryInfo>()
+                .eq("group_type", groupType)
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .orderByAsc("order_no"));
+        List<DictionaryInfoDTO> listRes = BeanUtil.listCopyTo(list, DictionaryInfoDTO.class);
+        return listRes;
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.DictionaryInfo;
+
+/**
+ * <p>
+ * CDSS字典表 Mapper 接口
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+public interface DictionaryInfoMapper extends BaseMapper<DictionaryInfo> {
+
+}

+ 47 - 0
src/main/java/com/diagbot/repository/AgeRepository.java

@@ -0,0 +1,47 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.Age;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/25 15:07
+ */
+public interface AgeRepository extends Neo4jRepository<Age,Long> {
+    List<Age> findByNameIs(String name);
+
+    @Query("merge (n:年龄{name:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.年龄指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.年龄指标={indication} "+
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    Age createOrUpdate(@Param("name") String name,
+                        @Param("is_kl") Integer is_kl,
+                        @Param("pycode") String pycode,
+                        @Param("status") Integer status,
+                        @Param("maxValue") Double maxValue,
+                        @Param("minValue") Double minValue,
+                        @Param("range") Integer range,
+                        @Param("unit") String unit,
+                        @Param("indication") String indication);
+}

+ 17 - 7
src/main/java/com/diagbot/repository/BaseNodeRepository.java

@@ -4,7 +4,13 @@ package com.diagbot.repository;
 import com.diagbot.entity.DiseaseInfo;
 import com.diagbot.entity.DiseaseInfo;
 import com.diagbot.entity.DiseaseProperty;
 import com.diagbot.entity.DiseaseProperty;
 import com.diagbot.entity.SymptomNumOfDiS;
 import com.diagbot.entity.SymptomNumOfDiS;
-import com.diagbot.entity.node.*;
+import com.diagbot.entity.node.Dept;
+import com.diagbot.entity.node.LisName;
+import com.diagbot.entity.node.LisSet;
+import com.diagbot.entity.node.Medicine;
+import com.diagbot.entity.node.PacsName;
+import com.diagbot.entity.node.YiBaoDiseaseName;
+import com.diagbot.entity.node.YiBaoOperationName;
 import com.diagbot.entity.node.base.BaseNode;
 import com.diagbot.entity.node.base.BaseNode;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
@@ -16,7 +22,7 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
 
 
     void delete(BaseNode baseNode);
     void delete(BaseNode baseNode);
 
 
-    <Optional>BaseNode findById(long id);
+    <Optional> BaseNode findById(long id);
 
 
     List<BaseNode> findByNameIs(String name);
     List<BaseNode> findByNameIs(String name);
 
 
@@ -59,15 +65,15 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
 
 
     //化验查疾病
     //化验查疾病
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) return d.name")
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) return d.name")
-    List<String> getDisByLis(@Param("lisBig") String lisBig,@Param("subres") String subres);
+    List<String> getDisByLis(@Param("lisBig") String lisBig, @Param("subres") String subres);
 
 
     //化验查疾病(有特异性)
     //化验查疾病(有特异性)
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) where lr.special='是' return d.name")
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) where lr.special='是' return d.name")
-    List<String> getDisByLis_Special(@Param("lisBig") String lisBig,@Param("subres") String subres);
+    List<String> getDisByLis_Special(@Param("lisBig") String lisBig, @Param("subres") String subres);
 
 
     //化验查疾病(无特异性)
     //化验查疾病(无特异性)
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) where not exists(lr.special) return d.name")
     @Query("match(d:医保疾病名称)-[r1]->(l:化验套餐名称{name:{lisBig}})-[r:化验套餐名称相关化验细项及结果]->(lr:化验细项及结果{name:{subres}}),(d)-[r2]->(lr) where not exists(lr.special) return d.name")
-    List<String> getDisByLis_Other(@Param("lisBig") String lisBig,@Param("subres") String subres);
+    List<String> getDisByLis_Other(@Param("lisBig") String lisBig, @Param("subres") String subres);
 
 
     @Query("match(d:医保疾病名称)-[r:医保疾病名称相关性别]->(h) return DISTINCT d.name+'&'+h.name")
     @Query("match(d:医保疾病名称)-[r:医保疾病名称相关性别]->(h) return DISTINCT d.name+'&'+h.name")
     List<String> getDisSexClass();
     List<String> getDisSexClass();
@@ -100,7 +106,7 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
     List<Dept> getDeptbyPinYin(@Param("py") String pycode);
     List<Dept> getDeptbyPinYin(@Param("py") String pycode);
 
 
     @Query("MATCH (n) WHERE labels(n)[0]={lab} and n.name={nm} set n.静态知识标识={sign}")
     @Query("MATCH (n) WHERE labels(n)[0]={lab} and n.name={nm} set n.静态知识标识={sign}")
-    void updateStaticKnowledgeSign(@Param("lab") String lab,@Param("nm") String nm,@Param("sign") Integer sign);
+    void updateStaticKnowledgeSign(@Param("lab") String lab, @Param("nm") String nm, @Param("sign") Integer sign);
 
 
     @Query("match(d:医保疾病名称)\n" +
     @Query("match(d:医保疾病名称)\n" +
             "return d.name as name, case \n" +
             "return d.name as name, case \n" +
@@ -114,7 +120,7 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
             "case\n" +
             "case\n" +
             "when d.fbl is not null then d.fbl\n" +
             "when d.fbl is not null then d.fbl\n" +
             "else '0'\n" +
             "else '0'\n" +
-            "end as fbl,\n"+
+            "end as fbl,\n" +
             "case\n" +
             "case\n" +
             "when d.dept is not null then d.dept\n" +
             "when d.dept is not null then d.dept\n" +
             "else '医学全科'\n" +
             "else '医学全科'\n" +
@@ -136,5 +142,9 @@ public interface BaseNodeRepository extends Neo4jRepository<BaseNode, Long> {
     @Query("match(d:医保疾病名称)-[r:医保疾病名称相关典型症状]->(s:症状) where s.name={py} return d.name")
     @Query("match(d:医保疾病名称)-[r:医保疾病名称相关典型症状]->(s:症状) where s.name={py} return d.name")
     List<String> getDisBySymptom_main(@Param("py") String py);
     List<String> getDisBySymptom_main(@Param("py") String py);
 
 
+    @Query("match ()-[r]->() where id(r)={relationId} set r.状态={status}")
+    void updateRelationStatusById(@Param("relationId") Long relationId, @Param("status") Integer status);
 
 
+    @Query("match ()-[r]->() where id(r)={relationId} delete r")
+    void deleteRelationStatusById(@Param("relationId") Long relationId);
 }
 }

+ 15 - 0
src/main/java/com/diagbot/repository/BillConflictItemRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.BillConflictItem;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 10:11
+ */
+public interface BillConflictItemRepository extends Neo4jRepository<BillConflictItem,Long> {
+    List<BillConflictItem> findByNameIs(String name);
+}

+ 215 - 0
src/main/java/com/diagbot/repository/BillManRepository.java

@@ -0,0 +1,215 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.BillConcept;
+import com.diagbot.entity.node.BillCondition;
+import com.diagbot.entity.node.BillItem;
+import com.diagbot.entity.node.BillItemDetail;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 13:26
+ */
+public interface BillManRepository extends Neo4jRepository<BillItemDetail,Long> {
+
+    @Query(value = "match(m)-[r]->(n) \n" +
+            "where 1 = 1 \n" +
+            "and (m:实验室检查套餐名 or m:辅助检查名称 or m:辅助检查子项目名称 or m:医保手术和操作名称 or m:药品注册名称) \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
+            //"and (case {labels} is not null and size({labels})>0 when true then labels(m)[0] in {labels} else 1 = 1 end ) \n" +
+            "and (case {conceptName} is not null and {conceptName} <> '' when true then m.name contains {conceptName} else 1 = 1 end ) \n" +
+            "and (case {conditionName} is not null and {conditionName} <> '' when true then " +
+            "(case  \n" +
+            "when exists(n.禁忌人群指标) then toLower(n.禁忌人群指标) contains toLower({conditionName}) \n" +
+            "when exists(n.实验室检查指标) then toLower(n.实验室检查指标) contains toLower({conditionName}) \n" +
+            "when exists(n.体征指标) then toLower(n.体征指标) contains toLower({conditionName}) \n" +
+            "else toLower(n.`name`) contains toLower({conditionName}) \n" +
+            "end ) \n" +
+            "else 1 = 1 " +
+            "end ) \n" +
+            "and (case {relationStatus} is not null  when true then r.状态 = {relationStatus} else 1 = 1 end ) \n" +
+            "and type(r) contains('禁忌') \n" +
+            "and m.状态=1 \n" +
+            "and n.状态=1 \n" +
+            "return " +
+            "r.规则类型 as ruleType,\n" +
+            "case labels(m)[0] " +
+            "when '实验室检查套餐名' then 1 " +
+            "when '辅助检查名称' then 2 " +
+            "when '辅助检查子项目名称' then 3 " +
+            "when '医保手术和操作名称' then 4 " +
+            "when '药品注册名称' then 5 " +
+            "end as type," +
+            "id(m) as conceptId,m.name as conceptName,labels(m)[0] as conceptType,\n" +
+            "id(r) as relationId,type(r) as relationName,r.状态 as relationStatus, \n" +
+            "id(n) as conditionId," +
+            //"n.name as conditionName," +
+            "(case \n" +
+            "when exists(n.禁忌人群指标) then n.禁忌人群指标 \n" +
+            "when exists(n.实验室检查指标) then n.实验室检查指标 \n" +
+            "when exists(n.体征指标) then n.体征指标 \n" +
+            "else n.name \n" +
+            "end ) as conditionName,\n" +
+            "labels(n)[0] as conditionType  \n" +
+            "order by r.状态 desc, id(r) desc",
+            countQuery = "match(m)-[r]->(n) \n" +
+                    "where 1 = 1 \n" +
+                    "and (m:实验室检查套餐名 or m:辅助检查名称 or m:辅助检查子项目名称 or m:医保手术和操作名称 or m:药品注册名称) \n" +
+                    "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
+                    //"and (case {labels} is not null and size({labels})>0 when true then labels(m)[0] in {labels} else 1 = 1 end ) \n" +
+                    "and (case {conceptName} is not null and {conceptName} <> '' when true then m.name contains {conceptName} else 1 = 1 end ) \n" +
+                    "and (case {conditionName} is not null and {conditionName} <> '' when true then " +
+                    "(case  \n" +
+                    "when exists(n.禁忌人群指标) then toLower(n.禁忌人群指标) contains toLower({conditionName}) \n" +
+                    "when exists(n.实验室检查指标) then toLower(n.实验室检查指标) contains toLower({conditionName}) \n" +
+                    "when exists(n.体征指标) then toLower(n.体征指标) contains toLower({conditionName}) \n" +
+                    "else toLower(n.`name`) contains toLower({conditionName}) \n" +
+                    "end ) \n" +
+                    "else 1 = 1 " +
+                    "end ) \n" +
+                    "and (case {relationStatus} is not null  when true then r.状态 = {relationStatus} else 1 = 1 end ) \n" +
+                    "and type(r) contains('禁忌') \n" +
+                    "and m.状态=1 \n" +
+                    "and n.状态=1 \n" +
+                    "return count(n)")
+    Page<BillItem> getPage(@Param("labels") List<String> labels,
+                           @Param("conceptName") String conceptName,
+                           @Param("conditionName") String conditionName,
+                           @Param("relationStatus") Integer relationStatus,
+                           Pageable pageable);
+
+    @Query("match (m)-[r]->(n) " +
+            "where type(r) contains '禁忌' " +
+            "and labels(m)[0] = $conceptLabel " +
+            "return distinct type(r)")
+    List<String> getRelationTypes(@Param("conceptLabel") String conceptLabel);
+
+    @Query("MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode)) \n" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
+            "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
+            "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n" +
+            "union \n" +
+            "MATCH (n) \n " +
+            "WHERE (toLower(n.`name`) starts with toLower($name) OR toLower(n.`拼音编码`) starts with toLower($pycode)) \n" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
+            "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
+            "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n" +
+            "union \n" +
+            "MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode)) \n" +
+            //"AND labels(n)[0] in {labels}  \n" +
+            "and (n:性别 or n:实验室检查 or n:临床表现 or n:辅助检查名称描述 or n:疾病 or n:服用药品 or n:药物过敏原 or n:食物过敏原 or n:手术 or n:禁忌人群 or n:过敏原 or n:体征 or n:禁忌医疗器械及物品 or n:年龄 or n:给药途径 or n:开单项互斥) \n" +
+            "AND not(exists(n.禁忌人群指标) or exists(n.实验室检查指标) or exists(n.体征指标)) \n" +
+            "AND (case {notInIds} is not null and size({notInIds})>0 when true then not(id(n) in {notInIds}) else 1 = 1 end ) \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n")
+    List<BillCondition> conditionIndex(@Param("labels") List<String> labels,
+                                       @Param("notInIds") List<Long> notInIds,
+                                       @Param("name") String name,
+                                       @Param("pycode") String pycode,
+                                       @Param("size") Integer size);
+
+    @Query("MATCH(m)-[r]->(n) \n" +
+            "where m.name={conceptName} \n" +
+            "and {conceptLabel} in labels(m) \n" +
+            "and type(r) contains '禁忌' \n" +
+            "return ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel \n")
+    List<BillCondition> getNotInConditions(@Param("conceptName") String conceptName, @Param("conceptLabel") String conceptLabel);
+
+    @Query("MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) = toLower($name) OR toLower(n.`拼音编码`) = toLower($pycode))  \n" +
+            "AND labels(n)[0] in {labels}  \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel \n" +
+            "union \n" +
+            "MATCH (n) \n " +
+            "WHERE (toLower(n.`name`) starts with toLower($name) OR toLower(n.`拼音编码`) starts with toLower($pycode)) \n " +
+            "AND labels(n)[0] in {labels}  \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel  \n" +
+            "union \n" +
+            "MATCH (n) \n" +
+            "WHERE (toLower(n.`name`) CONTAINS toLower($name) OR toLower(n.`拼音编码`) CONTAINS toLower($pycode))  \n" +
+            "AND labels(n)[0] in {labels}  \n" +
+            "WITH n SKIP 0 LIMIT $size \n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conceptLabel \n")
+    List<BillConcept> conceptIndex(@Param("labels") List<String> labels,
+                                   @Param("name") String name,
+                                   @Param("pycode") String pycode,
+                                   @Param("size") Integer size);
+
+    @Query("MATCH (m)-[r]->(n) \n" +
+            "where m.name={conceptName} \n" +
+            "and n.name={conditionName}\n" +
+            "and type(r) ={relationType} \n" +
+            "and {conceptLabel} in labels(m)\n" +
+            "and {conditionLabel} in labels(n)\n" +
+            "RETURN ID(n) as id, n.name as name,n.状态 as status,labels(n)[0] as conditionLabel,n.最小值 as minValue,n.最大值 as maxValue,n.单位 as unit,n.范围 as range \n")
+    BillCondition isExistCondition(@Param("conceptName") String conceptName,
+                                   @Param("conceptLabel") String conceptLabel,
+                                   @Param("relationType") String relationType,
+                                   @Param("conditionName") String conditionName,
+                                   @Param("conditionLabel") String conditionLabel);
+
+    @Query("MATCH (m)-[r]->(n) \n" +
+            "where id(r) ={relationId} \n" +
+            "RETURN id(m) as conceptId,\n" +
+            "m.name as conceptName,\n" +
+            "labels(m)[0] as conceptLabel,\n" +
+            "m.状态 as conceptStatus,\n" +
+            "r.规则类型 as ruleType,\n" +
+            "id(r) as relationId,\n" +
+            "type(r) as relationName,\n" +
+            "r.状态 as relationStatus,\n" +
+            "id(n) as conditionId,\n" +
+            //" n.name as conditionName," +
+            "(case  \n" +
+            "when exists(n.禁忌人群指标) then n.禁忌人群指标 \n" +
+            "when exists(n.实验室检查指标) then n.实验室检查指标 \n" +
+            "when exists(n.体征指标) then n.体征指标 \n" +
+            "else n.name \n" +
+            "end ) as conditionName,\n" +
+            "labels(n)[0] as conditionLabel,\n" +
+            "n.最小值 as conditionMinValue,\n" +
+            "n.最大值 as conditionMaxValue,\n" +
+            "n.单位 as conditionUnit,\n" +
+            "n.范围 as conditionRange,\n" +
+            "n.状态 as conditionStatus")
+    BillItem getRecordByRelationId(@Param("relationId") Long relationId);
+
+    @Query("MATCH (m)-[r]->(n) \n" +
+            "where m.name ={conceptName} \n" +
+            "and n.name={conditionName} \n" +
+            "and type(r) ={relationType} \n" +
+            "RETURN id(m) as conceptId,\n" +
+            "m.name as conceptName,\n" +
+            "labels(m)[0] as conceptLabel,\n" +
+            "m.状态 as conceptStatus,\n" +
+            "r.规则类型 as ruleType,\n" +
+            "id(r) as relationId,\n" +
+            "type(r) as relationName,\n" +
+            "r.状态 as relationStatus,\n" +
+            "id(n) as conditionId,\n" +
+            "n.name as conditionName,\n" +
+            "labels(n)[0] as conditionLabel,\n" +
+            "n.最小值 as conditionMinValue,\n" +
+            "n.最大值 as conditionMaxValue,\n" +
+            "n.单位 as conditionUnit,\n" +
+            "n.范围 as conditionRange,\n" +
+            "n.状态 as conditionStatus")
+    BillItem isExistRelation(@Param("conceptName") String conceptName,
+                             @Param("conditionName") String conditionName,
+                             @Param("relationType") String relationType);
+}

+ 29 - 1
src/main/java/com/diagbot/repository/ClinicalFindingRepository.java

@@ -16,5 +16,33 @@ public interface ClinicalFindingRepository extends Neo4jRepository<ClinicalFindi
 
 
     List<ClinicalFinding> findByNameContaining(String name);
     List<ClinicalFinding> findByNameContaining(String name);
 
 
+    @Query("merge (n:临床表现{name:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.临床表现指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.临床表现指标={indication} " +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    ClinicalFinding createOrUpdate(@Param("name") String name,
+                                   @Param("is_kl") Integer is_kl,
+                                   @Param("pycode") String pycode,
+                                   @Param("status") Integer status,
+                                   @Param("maxValue") Double maxValue,
+                                   @Param("minValue") Double minValue,
+                                   @Param("range") Integer range,
+                                   @Param("unit") String unit,
+                                   @Param("indication") String indication);
 }
 }
-

+ 15 - 0
src/main/java/com/diagbot/repository/ConflictDeviceRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.ConflictDevice;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 10:07
+ */
+public interface ConflictDeviceRepository extends Neo4jRepository<ConflictDevice,Long> {
+    List<ConflictDevice> findByNameIs(String name);
+}

+ 15 - 0
src/main/java/com/diagbot/repository/DiseaseRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.Disease;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 10:02
+ */
+public interface DiseaseRepository extends Neo4jRepository<Disease,Long> {
+    List<Disease> findByNameIs(String name);
+}

+ 15 - 0
src/main/java/com/diagbot/repository/GenderRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.Gender;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/25 14:22
+ */
+public interface GenderRepository extends Neo4jRepository<Gender,Long> {
+    List<Gender> findByNameIs(String name);
+}

+ 30 - 3
src/main/java/com/diagbot/repository/GroupRepository.java

@@ -1,8 +1,6 @@
 package com.diagbot.repository;
 package com.diagbot.repository;
 
 
 import com.diagbot.entity.node.Group;
 import com.diagbot.entity.node.Group;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
 import org.springframework.data.repository.query.Param;
 import org.springframework.data.repository.query.Param;
@@ -18,4 +16,33 @@ public interface GroupRepository extends Neo4jRepository<Group, Long> {
 
 
     List<Group> findByNameIn(List<String> names);
     List<Group> findByNameIn(List<String> names);
 
 
-}
+    @Query("merge (n:禁忌人群{name:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.禁忌人群指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.禁忌人群指标={indication} " +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    Group createOrUpdate(@Param("name") String name,
+                         @Param("is_kl") Integer is_kl,
+                         @Param("pycode") String pycode,
+                         @Param("status") Integer status,
+                         @Param("maxValue") Double maxValue,
+                         @Param("minValue") Double minValue,
+                         @Param("range") Integer range,
+                         @Param("unit") String unit,
+                         @Param("indication") String indication);
+}

+ 48 - 0
src/main/java/com/diagbot/repository/LisRepository.java

@@ -0,0 +1,48 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.Lis;
+import org.springframework.data.neo4j.annotation.Query;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/25 14:43
+ */
+public interface LisRepository extends Neo4jRepository<Lis,Long> {
+    List<Lis> findByNameIs(String name);
+
+    @Query("merge (n:实验室检查{name:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.实验室检查指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.实验室检查指标={indication} " +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    Lis createOrUpdate(@Param("name") String name,
+                       @Param("is_kl") Integer is_kl,
+                       @Param("pycode") String pycode,
+                       @Param("status") Integer status,
+                       @Param("maxValue") Double maxValue,
+                       @Param("minValue") Double minValue,
+                       @Param("range") Integer range,
+                       @Param("unit") String unit,
+                       @Param("indication") String indication);
+
+}

+ 76 - 20
src/main/java/com/diagbot/repository/LisSetNode.java

@@ -4,18 +4,32 @@ import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.LisBillNeoDTO;
 import com.diagbot.dto.LisBillNeoDTO;
 import com.diagbot.dto.NeoEntityDTO;
 import com.diagbot.dto.NeoEntityDTO;
 import com.diagbot.entity.node.Gender;
 import com.diagbot.entity.node.Gender;
-import com.diagbot.entity.node.LisSet;
 import com.diagbot.entity.node.Group;
 import com.diagbot.entity.node.Group;
+import com.diagbot.entity.node.LisSet;
 import com.diagbot.entity.relationship.LisSetGender;
 import com.diagbot.entity.relationship.LisSetGender;
 import com.diagbot.entity.relationship.LisSetGroup;
 import com.diagbot.entity.relationship.LisSetGroup;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.NeoUtil;
-
-import java.util.*;
+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.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
+@Component
 public class LisSetNode {
 public class LisSetNode {
 
 
+	@Autowired
+	GenderRepository genderRepository;
+	@Autowired
+	GroupRepository groupRepository;
+
+
 	public LisBillNeoDTO LisPacktoLISDTO(LisSet lisset) {
 	public LisBillNeoDTO LisPacktoLISDTO(LisSet lisset) {
 
 
 		LisBillNeoDTO lisBillNeoDTO = new LisBillNeoDTO();
 		LisBillNeoDTO lisBillNeoDTO = new LisBillNeoDTO();
@@ -182,7 +196,6 @@ public class LisSetNode {
 	}
 	}
 
 
 
 
-
 	/**
 	/**
 	 * 获取化验套餐名称列表
 	 * 获取化验套餐名称列表
 	 */
 	 */
@@ -266,12 +279,11 @@ public class LisSetNode {
 	}
 	}
 
 
 
 
-
 	/**
 	/**
 	 * 根据关系名查询对应节点
 	 * 根据关系名查询对应节点
 	 */
 	 */
 	public List<?> getNodesbyRelation(LisSet lisSet, String relname) {
 	public List<?> getNodesbyRelation(LisSet lisSet, String relname) {
-		List<?> nodelist =  new ArrayList<>();
+		List<?> nodelist = new ArrayList<>();
 
 
 		try {
 		try {
 			switch (relname) {
 			switch (relname) {
@@ -282,11 +294,9 @@ public class LisSetNode {
 					nodelist = lisSet.getLisSetGroups().stream().map(x -> x.getGroup()).collect(Collectors.toList());
 					nodelist = lisSet.getLisSetGroups().stream().map(x -> x.getGroup()).collect(Collectors.toList());
 					break;
 					break;
 			}
 			}
-		}
-		catch (Exception ex) {
+		} catch (Exception ex) {
 			ex.printStackTrace();
 			ex.printStackTrace();
-		}
-		finally {
+		} finally {
 			return nodelist;
 			return nodelist;
 		}
 		}
 	}
 	}
@@ -304,24 +314,70 @@ public class LisSetNode {
 					lisSetRepository.save(lisSet);
 					lisSetRepository.save(lisSet);
 					break;
 					break;
 				case "实验室检查名称禁忌禁忌人群":
 				case "实验室检查名称禁忌禁忌人群":
-					lisSet.getLisSetGroups().stream().filter(x -> x.getGroup().getName()==e_name)
+					lisSet.getLisSetGroups().stream().filter(x -> x.getGroup().getName() == e_name)
 							.collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
 							.collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
 					lisSetRepository.save(lisSet);
 					lisSetRepository.save(lisSet);
 					break;
 					break;
-//				case "实验室检查名称相关实验室检查套餐名":
-//					lisSet.getLisnamelisSet().stream().filter(x -> x.getLisSet().getName()==e_name).
-//							collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
-//					lisSetRepository.save(lisSet);
-//					break;
+				//				case "实验室检查名称相关实验室检查套餐名":
+				//					lisSet.getLisnamelisSet().stream().filter(x -> x.getLisSet().getName()==e_name).
+				//							collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
+				//					lisSetRepository.save(lisSet);
+				//					break;
 			}
 			}
-		}
-		catch (Exception ex) {
+		} catch (Exception ex) {
 			ex.printStackTrace();
 			ex.printStackTrace();
-		}
-		finally {
+		} finally {
 
 
 		}
 		}
 	}
 	}
 
 
+	/**
+	 * 更新关系状态属性
+	 */
+	public void updateRelationExt(LisSet lisSet, String relname, Integer status, Integer ruleType, String e_name, LisSetRepository lisSetRepository) {
+		Boolean isExist = false;
+		try {
+			switch (relname) {
+				case "实验室检查套餐名禁忌性别":
+					Gender gender = genderRepository.findByNameIs(e_name).get(0);
+					LisSetGender lisSetGender = new LisSetGender();
+					lisSetGender.setGender(gender);
+					lisSetGender.setLisSet(lisSet);
+					lisSetGender.setStatus(status);
+					lisSetGender.setRuleType(ruleType);
+					lisSet.setLisSetgender(lisSetGender);
+					break;
+				case "实验室检查套餐名禁忌禁忌人群":
+					Group group = groupRepository.findByNameIs(e_name).get(0);
+					Set<LisSetGroup> lisSetGroupSet = lisSet.getLisSetGroups();
+					isExist = false;
+					for (LisSetGroup item : lisSetGroupSet) {
+						if (item.getGroup() != null
+								&& item.getGroup().getName().equals(e_name)) {
+							isExist = true;
+							item.setLisSet(lisSet);
+							item.setGroup(group);
+							item.setStatus(status);
+							item.setRuleType(ruleType);
+						}
+					}
+					if (!isExist) {
+						LisSetGroup lisSetGroup = new LisSetGroup();
+						lisSetGroup.setGroup(group);
+						lisSetGroup.setLisSet(lisSet);
+						lisSetGroup.setStatus(status);
+						lisSetGroup.setRuleType(ruleType);
+						lisSetGroupSet.add(lisSetGroup);
+					}
+					lisSet.setLisSetGroups(lisSetGroupSet);
+					break;
+			}
+			lisSetRepository.save(lisSet, 1);
+		} catch (Exception ex) {
+			ex.printStackTrace();
+		} finally {
+
+		}
+	}
 }
 }
 
 

+ 119 - 12
src/main/java/com/diagbot/repository/MedRegNameNode.java

@@ -1,23 +1,41 @@
 package com.diagbot.repository;
 package com.diagbot.repository;
 
 
-import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.DrugBillNeoDTO;
 import com.diagbot.dto.DrugBillNeoDTO;
 import com.diagbot.dto.HighRiskNeoDTO;
 import com.diagbot.dto.HighRiskNeoDTO;
 import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.dto.NodeNeoDTO;
-import com.diagbot.entity.node.*;
-import com.diagbot.entity.relationship.*;
+import com.diagbot.entity.node.Group;
+import com.diagbot.entity.node.MedAllergen;
+import com.diagbot.entity.node.MedCodeName;
+import com.diagbot.entity.node.MedRegName;
+import com.diagbot.entity.node.Medicine;
+import com.diagbot.entity.node.Vital;
+import com.diagbot.entity.relationship.MedCodeNameMedRegName;
+import com.diagbot.entity.relationship.MedCodeNameMedicine;
+import com.diagbot.entity.relationship.MedRegNameGroup;
+import com.diagbot.entity.relationship.MedRegNameMedAllergen;
+import com.diagbot.entity.relationship.MedRegNameMedRegName;
+import com.diagbot.entity.relationship.MedRegNameVital;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.vo.Drug;
 import com.diagbot.vo.Drug;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
-
+@Component
 public class MedRegNameNode {
 public class MedRegNameNode {
 
 
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    MedRegNameRepository medRegNameRepository;
+
     /**
     /**
      * 获取高危药品数据
      * 获取高危药品数据
      */
      */
@@ -41,7 +59,7 @@ public class MedRegNameNode {
             medicine = medRepository.findByNameIs(drugname);
             medicine = medRepository.findByNameIs(drugname);
 
 
             if (null != medicine) {
             if (null != medicine) {
-                for (Medicine med: medicine) {
+                for (Medicine med : medicine) {
                     for (MedCodeNameMedicine medCodeMed : med.getMedcodenameMedicines()) {
                     for (MedCodeNameMedicine medCodeMed : med.getMedcodenameMedicines()) {
                         if (NeoUtil.isExist(medCodeMed)) {
                         if (NeoUtil.isExist(medCodeMed)) {
                             MedCodeName medcdname = medCodeMed.getMedCodeName();
                             MedCodeName medcdname = medCodeMed.getMedCodeName();
@@ -70,7 +88,7 @@ public class MedRegNameNode {
                         }
                         }
                     }
                     }
 
 
-                    if (highRiskNeoDTO.getType()!=null) {
+                    if (highRiskNeoDTO.getType() != null) {
                         break;
                         break;
                     }
                     }
 
 
@@ -113,7 +131,7 @@ public class MedRegNameNode {
         Set<MedRegNameGroup> medGroups = medRegName.getMedRegNameGroup();
         Set<MedRegNameGroup> medGroups = medRegName.getMedRegNameGroup();
         for (MedRegNameGroup medgroup : medGroups) {
         for (MedRegNameGroup medgroup : medGroups) {
             if (NeoUtil.isExist(medgroup) && NeoUtil.isExist(medgroup.getGroup())
             if (NeoUtil.isExist(medgroup) && NeoUtil.isExist(medgroup.getGroup())
-                    && !NeoUtil.inlist(medgroup.getGroup().getName(),drugBillNeoDTO.getGroup())) {
+                    && !NeoUtil.inlist(medgroup.getGroup().getName(), drugBillNeoDTO.getGroup())) {
                 NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
                 NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
                 nodeNeoDTO.setName(medgroup.getGroup().getName());
                 nodeNeoDTO.setName(medgroup.getGroup().getName());
                 nodeNeoDTO.setTermtype(Constants.group);
                 nodeNeoDTO.setTermtype(Constants.group);
@@ -147,7 +165,7 @@ public class MedRegNameNode {
 
 
 
 
         String conflict_gender = medRegName.getConflict_gender();
         String conflict_gender = medRegName.getConflict_gender();
-        if (null!=conflict_gender) {
+        if (null != conflict_gender) {
             NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
             NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
             nodeNeoDTO.setName(conflict_gender);
             nodeNeoDTO.setName(conflict_gender);
             nodeNeoDTO.setTermtype(Constants.gender);
             nodeNeoDTO.setTermtype(Constants.gender);
@@ -156,7 +174,7 @@ public class MedRegNameNode {
 
 
 
 
         String conflict_geiyao = medRegName.getConflict_geiyao();
         String conflict_geiyao = medRegName.getConflict_geiyao();
-        if (null!=conflict_geiyao) {
+        if (null != conflict_geiyao) {
             NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
             NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
             nodeNeoDTO.setName(conflict_geiyao);
             nodeNeoDTO.setName(conflict_geiyao);
             nodeNeoDTO.setTermtype(Constants.geiyao);
             nodeNeoDTO.setTermtype(Constants.geiyao);
@@ -166,5 +184,94 @@ public class MedRegNameNode {
 
 
         return drugBillNeoDTO;
         return drugBillNeoDTO;
     }
     }
-}
 
 
+    /**
+     * 更新关系状态属性
+     */
+    public void updateRelationExt(MedRegName medRegName, String relname, Integer status, Integer ruleType, String e_name, MedRegNameRepository medRegNameRepository) {
+        Boolean isExist = false;
+        try {
+            switch (relname) {
+                case "药品注册名称禁忌禁忌人群":
+                    Group group = groupRepository.findByNameIs(e_name).get(0);
+                    Set<MedRegNameGroup> medRegNameGroupSet = medRegName.getMedRegNameGroup();
+                    isExist = false;
+                    for (MedRegNameGroup item : medRegNameGroupSet) {
+                        if (item.getGroup() != null
+                                && item.getGroup().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setMedRegName(medRegName);
+                            item.setGroup(group);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        MedRegNameGroup medRegNameGroup = new MedRegNameGroup();
+                        medRegNameGroup.setGroup(group);
+                        medRegNameGroup.setMedRegName(medRegName);
+                        medRegNameGroup.setStatus(status);
+                        medRegNameGroup.setRuleType(ruleType);
+                        medRegNameGroupSet.add(medRegNameGroup);
+                    }
+                    medRegName.setMedRegNameGroup(medRegNameGroupSet);
+                    break;
+                case "药品注册名称禁忌药物过敏原":
+                    MedAllergen medAllergen = medAllergenRepository.findByNameIs(e_name).get(0);
+                    Set<MedRegNameMedAllergen> medRegNameMedAllergenSet = medRegName.getMedRegNameMedAllergens();
+                    isExist = false;
+                    for (MedRegNameMedAllergen item : medRegNameMedAllergenSet) {
+                        if (item.getMedAllergen() != null
+                                && item.getMedAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setMedRegName(medRegName);
+                            item.setMedAllergen(medAllergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        MedRegNameMedAllergen medRegNameMedAllergen = new MedRegNameMedAllergen();
+                        medRegNameMedAllergen.setMedAllergen(medAllergen);
+                        medRegNameMedAllergen.setMedRegName(medRegName);
+                        medRegNameMedAllergen.setStatus(status);
+                        medRegNameMedAllergen.setRuleType(ruleType);
+                        medRegNameMedAllergenSet.add(medRegNameMedAllergen);
+                    }
+                    medRegName.setMedRegNameMedAllergens(medRegNameMedAllergenSet);
+                    break;
+                case "药品注册名称禁忌药品注册名称":
+                    break;
+                case "药品注册名称禁忌体征":
+                    Vital vital = vitalRepository.findByNameIs(e_name).get(0);
+                    Set<MedRegNameVital> medRegNameVitalSet = medRegName.getMedRegNameVital();
+                    isExist = false;
+                    for (MedRegNameVital item : medRegNameVitalSet) {
+                        if (item.getVital() != null
+                                && item.getVital().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setMedRegName(medRegName);
+                            item.setVital(vital);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        MedRegNameVital medRegNameVital = new MedRegNameVital();
+                        medRegNameVital.setVital(vital);
+                        medRegNameVital.setMedRegName(medRegName);
+                        medRegNameVital.setStatus(status);
+                        medRegNameVital.setRuleType(ruleType);
+                        medRegNameVitalSet.add(medRegNameVital);
+                    }
+                    medRegName.setMedRegNameVital(medRegNameVitalSet);
+                    break;
+            }
+            medRegNameRepository.save(medRegName, 1);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+
+        }
+    }
+}

+ 15 - 0
src/main/java/com/diagbot/repository/OralMedicineRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.OralMedicine;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 10:08
+ */
+public interface OralMedicineRepository extends Neo4jRepository<OralMedicine,Long> {
+    List<OralMedicine> findByNameIs(String name);
+}

+ 15 - 0
src/main/java/com/diagbot/repository/PacsDescribeRepository.java

@@ -0,0 +1,15 @@
+package com.diagbot.repository;
+
+import com.diagbot.entity.node.PacsDescribe;
+import org.springframework.data.neo4j.repository.Neo4jRepository;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 10:10
+ */
+public interface PacsDescribeRepository extends Neo4jRepository<PacsDescribe,Long> {
+    List<PacsDescribe> findByNameIs(String name);
+}

+ 377 - 21
src/main/java/com/diagbot/repository/PacsNameNode.java

@@ -6,14 +6,73 @@ import com.diagbot.entity.BaseNodeInfo;
 import com.diagbot.entity.node.*;
 import com.diagbot.entity.node.*;
 import com.diagbot.entity.relationship.*;
 import com.diagbot.entity.relationship.*;
 import com.diagbot.entity.relationship.base.BaseRelation;
 import com.diagbot.entity.relationship.base.BaseRelation;
+import com.diagbot.entity.node.Allergen;
+import com.diagbot.entity.node.BillConflictItem;
+import com.diagbot.entity.node.ClinicalFinding;
+import com.diagbot.entity.node.ConflictDevice;
+import com.diagbot.entity.node.Disease;
+import com.diagbot.entity.node.Gender;
+import com.diagbot.entity.node.Group;
+import com.diagbot.entity.node.Lis;
+import com.diagbot.entity.node.MedAllergen;
+import com.diagbot.entity.node.OralMedicine;
+import com.diagbot.entity.node.PacsDescribe;
+import com.diagbot.entity.node.PacsName;
+import com.diagbot.entity.node.Vital;
+import com.diagbot.entity.relationship.PacsNameAllergen;
+import com.diagbot.entity.relationship.PacsNameBillConflictItem;
+import com.diagbot.entity.relationship.PacsNameClinicalFinding;
+import com.diagbot.entity.relationship.PacsNameConflictDevice;
+import com.diagbot.entity.relationship.PacsNameDisease;
+import com.diagbot.entity.relationship.PacsNameGender;
+import com.diagbot.entity.relationship.PacsNameGroup;
+import com.diagbot.entity.relationship.PacsNameLis;
+import com.diagbot.entity.relationship.PacsNameMedAllergen;
+import com.diagbot.entity.relationship.PacsNameOralMedicine;
+import com.diagbot.entity.relationship.PacsNamePacsDescribe;
+import com.diagbot.entity.relationship.PacsNameVital;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.NeoUtil;
-
-import java.util.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
+@Component
 public class PacsNameNode {
 public class PacsNameNode {
 
 
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    GenderRepository genderRepository;
+    @Autowired
+    LisRepository lisRepository;
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    ClinicalFindingRepository clinicalFindingRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    AgeRepository ageRepository;
+    @Autowired
+    DiseaseRepository diseaseRepository;
+    @Autowired
+    BillConflictItemRepository billConflictItemRepository;
+    @Autowired
+    ConflictDeviceRepository conflictDeviceRepository;
+    @Autowired
+    OralMedicineRepository oralMedicineRepository;
+    @Autowired
+    PacsDescribeRepository pacsDescribeRepository;
+    @Autowired
+    AllergenRepository allergenRepository;
+
 
 
     public PacsBillNeoDTO PacstoPACSDTO(PacsName pacs) {
     public PacsBillNeoDTO PacstoPACSDTO(PacsName pacs) {
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
@@ -314,7 +373,7 @@ public class PacsNameNode {
      * 根据关系名查询对应节点
      * 根据关系名查询对应节点
      */
      */
     public List<?> getNodesbyRelation(PacsName pacsName, String relname) {
     public List<?> getNodesbyRelation(PacsName pacsName, String relname) {
-        List<?> nodelist =  new ArrayList<>();
+        List<?> nodelist = new ArrayList<>();
 
 
         try {
         try {
             switch (relname) {
             switch (relname) {
@@ -352,11 +411,9 @@ public class PacsNameNode {
                     nodelist = pacsName.getPacsNameConflictdevices().stream().map(x -> x.getConflictDevice()).collect(Collectors.toList());
                     nodelist = pacsName.getPacsNameConflictdevices().stream().map(x -> x.getConflictDevice()).collect(Collectors.toList());
                     break;
                     break;
             }
             }
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             ex.printStackTrace();
             ex.printStackTrace();
-        }
-        finally {
+        } finally {
             return nodelist;
             return nodelist;
         }
         }
     }
     }
@@ -374,47 +431,346 @@ public class PacsNameNode {
                     pacsNameRepository.save(pacsName);
                     pacsNameRepository.save(pacsName);
                     break;
                     break;
                 case "辅助检查名称禁忌临床表现":
                 case "辅助检查名称禁忌临床表现":
-                    pacsName.getPacsNameClinicalfindings().stream().filter(x -> x.getClinicalFinding().getName()==e_name).
+                    pacsName.getPacsNameClinicalfindings().stream().filter(x -> x.getClinicalFinding().getName() == e_name).
                             collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
                             collect(Collectors.toList()).stream().forEach(y -> y.setStatus(status));
                     pacsNameRepository.save(pacsName);
                     pacsNameRepository.save(pacsName);
                     break;
                     break;
                 case "辅助检查名称禁忌体征":
                 case "辅助检查名称禁忌体征":
-                    List<PacsNameVital> pacsNameVitals = pacsName.getPacsNameVitals().stream().filter(x -> x.getVital().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameVital> pacsNameVitals = pacsName.getPacsNameVitals().stream().filter(x -> x.getVital().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌实验室检查":
                 case "辅助检查名称禁忌实验室检查":
-                    List<PacsNameLis> pacsNameLis = pacsName.getPacsNameLis().stream().filter(x -> x.getLis().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameLis> pacsNameLis = pacsName.getPacsNameLis().stream().filter(x -> x.getLis().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌辅助检查名称描述":
                 case "辅助检查名称禁忌辅助检查名称描述":
-                    List<PacsNamePacsDescribe> pacsNamePacsDescribes = pacsName.getPacsNamePacsdescribes().stream().filter(x -> x.getPacsDescribe().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNamePacsDescribe> pacsNamePacsDescribes = pacsName.getPacsNamePacsdescribes().stream().filter(x -> x.getPacsDescribe().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌禁忌人群":
                 case "辅助检查名称禁忌禁忌人群":
-                    List<PacsNameGroup> pacsNameGroups = pacsName.getPacsNameGroups().stream().filter(x -> x.getGroup().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameGroup> pacsNameGroups = pacsName.getPacsNameGroups().stream().filter(x -> x.getGroup().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌服用药品":
                 case "辅助检查名称禁忌服用药品":
-                    List<PacsNameOralMedicine> pacsNameOralMedicines = pacsName.getPacsNameOralmedicines().stream().filter(x -> x.getOralMedicine().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameOralMedicine> pacsNameOralMedicines = pacsName.getPacsNameOralmedicines().stream().filter(x -> x.getOralMedicine().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌药物过敏原":
                 case "辅助检查名称禁忌药物过敏原":
-                    List<PacsNameMedAllergen> pacsNameMedAllergens = pacsName.getPacsNameMedallergens().stream().filter(x -> x.getMedAllergen().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameMedAllergen> pacsNameMedAllergens = pacsName.getPacsNameMedallergens().stream().filter(x -> x.getMedAllergen().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌疾病":
                 case "辅助检查名称禁忌疾病":
-                    List<PacsNameDisease> pacsNameDiseases = pacsName.getPacsNameDiseases().stream().filter(x -> x.getDisease().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameDisease> pacsNameDiseases = pacsName.getPacsNameDiseases().stream().filter(x -> x.getDisease().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌过敏原":
                 case "辅助检查名称禁忌过敏原":
-                    List<PacsNameAllergen> pacsNameAllergens = pacsName.getPacsNameAllergens().stream().filter(x -> x.getAllergen().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameAllergen> pacsNameAllergens = pacsName.getPacsNameAllergens().stream().filter(x -> x.getAllergen().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
                 case "辅助检查名称禁忌禁忌医疗器械及物品":
                 case "辅助检查名称禁忌禁忌医疗器械及物品":
-                    List<PacsNameConflictDevice> pacsNameConflictDevices = pacsName.getPacsNameConflictdevices().stream().filter(x -> x.getConflictDevice().getName()==e_name).collect(Collectors.toList());
+                    List<PacsNameConflictDevice> pacsNameConflictDevices = pacsName.getPacsNameConflictdevices().stream().filter(x -> x.getConflictDevice().getName() == e_name).collect(Collectors.toList());
                     break;
                     break;
             }
             }
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             ex.printStackTrace();
             ex.printStackTrace();
-        }
-        finally {
+        } finally {
 
 
         }
         }
     }
     }
 
 
+    /**
+     * 更新关系状态属性
+     */
+    public void updateRelationExt(PacsName pacsName, String relname, Integer status, Integer ruleType, String e_name, PacsNameRepository pacsNameRepository) {
+        Boolean isExist = false;
+        try {
+            switch (relname) {
+                case "辅助检查名称禁忌性别":
+                    Gender gender = genderRepository.findByNameIs(e_name).get(0);
+                    PacsNameGender pacsNameGender = new PacsNameGender();
+                    pacsNameGender.setGender(gender);
+                    pacsNameGender.setPacsName(pacsName);
+                    pacsNameGender.setStatus(status);
+                    pacsNameGender.setRuleType(ruleType);
+                    pacsName.setPacsNameGender(pacsNameGender);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌禁忌人群":
+                    Group group = groupRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameGroup> pacsNameGroupSet = pacsName.getPacsNameGroups();
+                    isExist = false;
+                    for (PacsNameGroup item : pacsNameGroupSet) {
+                        if (item.getGroup() != null
+                                && item.getGroup().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setGroup(group);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameGroup pacsNameGroup = new PacsNameGroup();
+                        pacsNameGroup.setGroup(group);
+                        pacsNameGroup.setPacsName(pacsName);
+                        pacsNameGroup.setStatus(status);
+                        pacsNameGroup.setRuleType(ruleType);
+                        pacsNameGroupSet.add(pacsNameGroup);
+                    }
+                    pacsName.setPacsNameGroups(pacsNameGroupSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌药物过敏原":
+                    MedAllergen medAllergen = medAllergenRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameMedAllergen> pacsNameMedAllergenSet = pacsName.getPacsNameMedallergens();
+                    isExist = false;
+                    for (PacsNameMedAllergen item : pacsNameMedAllergenSet) {
+                        if (item.getMedAllergen() != null
+                                && item.getMedAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setMedAllergen(medAllergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameMedAllergen pacsNameMedAllergen = new PacsNameMedAllergen();
+                        pacsNameMedAllergen.setMedAllergen(medAllergen);
+                        pacsNameMedAllergen.setPacsName(pacsName);
+                        pacsNameMedAllergen.setStatus(status);
+                        pacsNameMedAllergen.setRuleType(ruleType);
+                        pacsNameMedAllergenSet.add(pacsNameMedAllergen);
+                    }
+                    pacsName.setPacsNameMedallergens(pacsNameMedAllergenSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌临床表现":
+                    ClinicalFinding clinicalFinding = clinicalFindingRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameClinicalFinding> pacsNameClinicalFindingSet = pacsName.getPacsNameClinicalfindings();
+                    isExist = false;
+                    for (PacsNameClinicalFinding item : pacsNameClinicalFindingSet) {
+                        if (item.getClinicalFinding() != null
+                                && item.getClinicalFinding().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setClinicalFinding(clinicalFinding);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameClinicalFinding pacsNameClinicalFinding = new PacsNameClinicalFinding();
+                        pacsNameClinicalFinding.setClinicalFinding(clinicalFinding);
+                        pacsNameClinicalFinding.setPacsName(pacsName);
+                        pacsNameClinicalFinding.setStatus(status);
+                        pacsNameClinicalFinding.setRuleType(ruleType);
+                        pacsNameClinicalFindingSet.add(pacsNameClinicalFinding);
+                    }
+                    pacsName.setPacsNameClinicalfindings(pacsNameClinicalFindingSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌实验室检查名称":
+                    break;
+                case "辅助检查名称禁忌实验室检查":
+                    Lis lis = lisRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameLis> pacsNameLisSet = pacsName.getPacsNameLis();
+                    isExist = false;
+                    for (PacsNameLis item : pacsNameLisSet) {
+                        if (item.getLis() != null
+                                && item.getLis().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setLis(lis);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameLis pacsNameLis = new PacsNameLis();
+                        pacsNameLis.setLis(lis);
+                        pacsNameLis.setPacsName(pacsName);
+                        pacsNameLis.setStatus(status);
+                        pacsNameLis.setRuleType(ruleType);
+                        pacsNameLisSet.add(pacsNameLis);
+                    }
+                    pacsName.setPacsNameLis(pacsNameLisSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌疾病":
+                    Disease disease = diseaseRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameDisease> pacsNameDiseaseSet = pacsName.getPacsNameDiseases();
+                    isExist = false;
+                    for (PacsNameDisease item : pacsNameDiseaseSet) {
+                        if (item.getDisease() != null
+                                && item.getDisease().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setDisease(disease);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameDisease pacsNameDisease = new PacsNameDisease();
+                        pacsNameDisease.setDisease(disease);
+                        pacsNameDisease.setPacsName(pacsName);
+                        pacsNameDisease.setStatus(status);
+                        pacsNameDisease.setRuleType(ruleType);
+                        pacsNameDiseaseSet.add(pacsNameDisease);
+                    }
+                    pacsName.setPacsNameDiseases(pacsNameDiseaseSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌禁忌医疗器械及物品":
+                    ConflictDevice conflictDevice = conflictDeviceRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameConflictDevice> pacsNameConflictDeviceSet = pacsName.getPacsNameConflictdevices();
+                    isExist = false;
+                    for (PacsNameConflictDevice item : pacsNameConflictDeviceSet) {
+                        if (item.getConflictDevice() != null
+                                && item.getConflictDevice().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setConflictDevice(conflictDevice);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameConflictDevice pacsNameConflictDevice = new PacsNameConflictDevice();
+                        pacsNameConflictDevice.setConflictDevice(conflictDevice);
+                        pacsNameConflictDevice.setPacsName(pacsName);
+                        pacsNameConflictDevice.setStatus(status);
+                        pacsNameConflictDevice.setRuleType(ruleType);
+                        pacsNameConflictDeviceSet.add(pacsNameConflictDevice);
+                    }
+                    pacsName.setPacsNameConflictdevices(pacsNameConflictDeviceSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌体征":
+                    Vital vital = vitalRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameVital> pacsNameVitalSet = pacsName.getPacsNameVitals();
+                    isExist = false;
+                    for (PacsNameVital item : pacsNameVitalSet) {
+                        if (item.getVital() != null
+                                && item.getVital().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setVital(vital);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameVital pacsNameVital = new PacsNameVital();
+                        pacsNameVital.setVital(vital);
+                        pacsNameVital.setPacsName(pacsName);
+                        pacsNameVital.setStatus(status);
+                        pacsNameVital.setRuleType(ruleType);
+                        pacsNameVitalSet.add(pacsNameVital);
+                    }
+                    pacsName.setPacsNameVitals(pacsNameVitalSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌服用药品":
+                    OralMedicine oralMedicine = oralMedicineRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameOralMedicine> pacsNameOralMedicineSet = pacsName.getPacsNameOralmedicines();
+                    isExist = false;
+                    for (PacsNameOralMedicine item : pacsNameOralMedicineSet) {
+                        if (item.getOralMedicine() != null
+                                && item.getOralMedicine().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setOralMedicine(oralMedicine);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameOralMedicine pacsNameOralMedicine = new PacsNameOralMedicine();
+                        pacsNameOralMedicine.setOralMedicine(oralMedicine);
+                        pacsNameOralMedicine.setPacsName(pacsName);
+                        pacsNameOralMedicine.setStatus(status);
+                        pacsNameOralMedicine.setRuleType(ruleType);
+                        pacsNameOralMedicineSet.add(pacsNameOralMedicine);
+                    }
+                    pacsName.setPacsNameOralmedicines(pacsNameOralMedicineSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌辅助检查名称描述":
+                    PacsDescribe pacsDescribe = pacsDescribeRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNamePacsDescribe> pacsNamePacsDescribeSet = pacsName.getPacsNamePacsdescribes();
+                    isExist = false;
+                    for (PacsNamePacsDescribe item : pacsNamePacsDescribeSet) {
+                        if (item.getPacsDescribe() != null
+                                && item.getPacsDescribe().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setPacsDescribe(pacsDescribe);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNamePacsDescribe pacsNamePacsDescribe = new PacsNamePacsDescribe();
+                        pacsNamePacsDescribe.setPacsDescribe(pacsDescribe);
+                        pacsNamePacsDescribe.setPacsName(pacsName);
+                        pacsNamePacsDescribe.setStatus(status);
+                        pacsNamePacsDescribe.setRuleType(ruleType);
+                        pacsNamePacsDescribeSet.add(pacsNamePacsDescribe);
+                    }
+                    pacsName.setPacsNamePacsdescribes(pacsNamePacsDescribeSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌过敏原":
+                    Allergen allergen = allergenRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameAllergen> pacsNameAllergenSet = pacsName.getPacsNameAllergens();
+                    isExist = false;
+                    for (PacsNameAllergen item : pacsNameAllergenSet) {
+                        if (item.getAllergen() != null
+                                && item.getAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setAllergen(allergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameAllergen pacsNameAllergen = new PacsNameAllergen();
+                        pacsNameAllergen.setAllergen(allergen);
+                        pacsNameAllergen.setPacsName(pacsName);
+                        pacsNameAllergen.setStatus(status);
+                        pacsNameAllergen.setRuleType(ruleType);
+                        pacsNameAllergenSet.add(pacsNameAllergen);
+                    }
+                    pacsName.setPacsNameAllergens(pacsNameAllergenSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+                case "辅助检查名称禁忌开单项互斥":
+                    BillConflictItem billConflictItem = billConflictItemRepository.findByNameIs(e_name).get(0);
+                    Set<PacsNameBillConflictItem> pacsNameBillConflictItemSet = pacsName.getPacsNameBillConflictItems();
+                    isExist = false;
+                    for (PacsNameBillConflictItem item : pacsNameBillConflictItemSet) {
+                        if (item.getBillConflictItem() != null
+                                && item.getBillConflictItem().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsName(pacsName);
+                            item.setBillConflictItem(billConflictItem);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsNameBillConflictItem pacsNameBillConflictItem = new PacsNameBillConflictItem();
+                        pacsNameBillConflictItem.setBillConflictItem(billConflictItem);
+                        pacsNameBillConflictItem.setPacsName(pacsName);
+                        pacsNameBillConflictItem.setStatus(status);
+                        pacsNameBillConflictItem.setRuleType(ruleType);
+                        pacsNameBillConflictItemSet.add(pacsNameBillConflictItem);
+                    }
+                    pacsName.setPacsNameBillConflictItems(pacsNameBillConflictItemSet);
+                    pacsNameRepository.save(pacsName, 1);
+                    break;
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+
+        }
+    }
 }
 }
 
 
 
 

+ 318 - 3
src/main/java/com/diagbot/repository/PacsSubNameNode.java

@@ -2,18 +2,69 @@ package com.diagbot.repository;
 
 
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
 import com.diagbot.dto.PacsBillNeoDTO;
-import com.diagbot.entity.node.*;
-import com.diagbot.entity.relationship.*;
+import com.diagbot.entity.node.Allergen;
+import com.diagbot.entity.node.ClinicalFinding;
+import com.diagbot.entity.node.ConflictDevice;
+import com.diagbot.entity.node.Disease;
+import com.diagbot.entity.node.Gender;
+import com.diagbot.entity.node.Group;
+import com.diagbot.entity.node.Lis;
+import com.diagbot.entity.node.MedAllergen;
+import com.diagbot.entity.node.OralMedicine;
+import com.diagbot.entity.node.PacsDescribe;
+import com.diagbot.entity.node.PacsSubName;
+import com.diagbot.entity.node.Vital;
+import com.diagbot.entity.relationship.PacsSubNameAllergen;
+import com.diagbot.entity.relationship.PacsSubNameClinicalFinding;
+import com.diagbot.entity.relationship.PacsSubNameConflictDevice;
+import com.diagbot.entity.relationship.PacsSubNameDisease;
+import com.diagbot.entity.relationship.PacsSubNameGender;
+import com.diagbot.entity.relationship.PacsSubNameGroup;
+import com.diagbot.entity.relationship.PacsSubNameLis;
+import com.diagbot.entity.relationship.PacsSubNameMedAllergen;
+import com.diagbot.entity.relationship.PacsSubNameOralMedicine;
+import com.diagbot.entity.relationship.PacsSubNamePacsDescribe;
+import com.diagbot.entity.relationship.PacsSubNameVital;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.NeoUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
+@Component
 public class PacsSubNameNode {
 public class PacsSubNameNode {
 
 
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    GenderRepository genderRepository;
+    @Autowired
+    LisRepository lisRepository;
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    ClinicalFindingRepository clinicalFindingRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    AgeRepository ageRepository;
+    @Autowired
+    DiseaseRepository diseaseRepository;
+    @Autowired
+    BillConflictItemRepository billConflictItemRepository;
+    @Autowired
+    ConflictDeviceRepository conflictDeviceRepository;
+    @Autowired
+    OralMedicineRepository oralMedicineRepository;
+    @Autowired
+    PacsDescribeRepository pacsDescribeRepository;
+    @Autowired
+    AllergenRepository allergenRepository;
+
 
 
     public PacsBillNeoDTO PacstoPACSDTO(PacsSubName pacs) {
     public PacsBillNeoDTO PacstoPACSDTO(PacsSubName pacs) {
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
         PacsBillNeoDTO pacsBillNeoDTO = new PacsBillNeoDTO();
@@ -222,8 +273,272 @@ public class PacsSubNameNode {
 
 
         return pacslist;
         return pacslist;
     }
     }
-}
 
 
+    /**
+     * 更新关系状态属性
+     */
+    public void updateRelationExt(PacsSubName pacsSubName, String relname, Integer status, Integer ruleType, String e_name, PacsSubNameRepository pacsSubNameRepository) {
+        Boolean isExist = false;
+        try {
+            switch (relname) {
+                case "辅助检查子项目名称禁忌性别":
+                    Gender gender = genderRepository.findByNameIs(e_name).get(0);
+                    PacsSubNameGender pacsSubNameGender = new PacsSubNameGender();
+                    pacsSubNameGender.setGender(gender);
+                    pacsSubNameGender.setPacsSubName(pacsSubName);
+                    pacsSubNameGender.setStatus(status);
+                    pacsSubNameGender.setRuleType(ruleType);
+                    pacsSubName.setPacsSubNameGender(pacsSubNameGender);
+                    break;
+                case "辅助检查子项目名称禁忌禁忌人群":
+                    Group group = groupRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameGroup> pacsSubNameGroupSet = pacsSubName.getPacsSubNameGroups();
+                    isExist = false;
+                    for (PacsSubNameGroup item : pacsSubNameGroupSet) {
+                        if (item.getGroup() != null
+                                && item.getGroup().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setGroup(group);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameGroup pacsSubNameGroup = new PacsSubNameGroup();
+                        pacsSubNameGroup.setGroup(group);
+                        pacsSubNameGroup.setPacsSubName(pacsSubName);
+                        pacsSubNameGroup.setStatus(status);
+                        pacsSubNameGroup.setRuleType(ruleType);
+                        pacsSubNameGroupSet.add(pacsSubNameGroup);
+                    }
+                    pacsSubName.setPacsSubNameGroups(pacsSubNameGroupSet);
+                    break;
+                case "辅助检查子项目名称禁忌药物过敏原":
+                    MedAllergen medAllergen = medAllergenRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameMedAllergen> pacsSubNameMedAllergenSet = pacsSubName.getPacsSubNameMedallergens();
+                    isExist = false;
+                    for (PacsSubNameMedAllergen item : pacsSubNameMedAllergenSet) {
+                        if (item.getMedAllergen() != null
+                                && item.getMedAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setMedAllergen(medAllergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameMedAllergen pacsSubNameMedAllergen = new PacsSubNameMedAllergen();
+                        pacsSubNameMedAllergen.setMedAllergen(medAllergen);
+                        pacsSubNameMedAllergen.setPacsSubName(pacsSubName);
+                        pacsSubNameMedAllergen.setStatus(status);
+                        pacsSubNameMedAllergen.setRuleType(ruleType);
+                        pacsSubNameMedAllergenSet.add(pacsSubNameMedAllergen);
+                    }
+                    pacsSubName.setPacsSubNameMedallergens(pacsSubNameMedAllergenSet);
+                    break;
+                case "辅助检查子项目名称禁忌临床表现":
+                    ClinicalFinding clinicalFinding = clinicalFindingRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameClinicalFinding> pacsSubNameClinicalFindingSet = pacsSubName.getPacsSubNameClinicalfindings();
+                    isExist = false;
+                    for (PacsSubNameClinicalFinding item : pacsSubNameClinicalFindingSet) {
+                        if (item.getClinicalFinding() != null
+                                && item.getClinicalFinding().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setClinicalFinding(clinicalFinding);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameClinicalFinding pacsSubNameClinicalFinding = new PacsSubNameClinicalFinding();
+                        pacsSubNameClinicalFinding.setClinicalFinding(clinicalFinding);
+                        pacsSubNameClinicalFinding.setPacsSubName(pacsSubName);
+                        pacsSubNameClinicalFinding.setStatus(status);
+                        pacsSubNameClinicalFinding.setRuleType(ruleType);
+                        pacsSubNameClinicalFindingSet.add(pacsSubNameClinicalFinding);
+                    }
+                    pacsSubName.setPacsSubNameClinicalfindings(pacsSubNameClinicalFindingSet);
+                    break;
+                case "辅助检查子项目名称禁忌实验室检查":
+                    Lis lis = lisRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameLis> pacsSubNameLisSet = pacsSubName.getPacsSubNameLis();
+                    isExist = false;
+                    for (PacsSubNameLis item : pacsSubNameLisSet) {
+                        if (item.getLis() != null
+                                && item.getLis().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setLis(lis);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameLis pacsSubNameLis = new PacsSubNameLis();
+                        pacsSubNameLis.setLis(lis);
+                        pacsSubNameLis.setPacsSubName(pacsSubName);
+                        pacsSubNameLis.setStatus(status);
+                        pacsSubNameLis.setRuleType(ruleType);
+                        pacsSubNameLisSet.add(pacsSubNameLis);
+                    }
+                    pacsSubName.setPacsSubNameLis(pacsSubNameLisSet);
+                    break;
+                case "辅助检查子项目名称禁忌疾病":
+                    Disease disease = diseaseRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameDisease> pacsSubNameDiseaseSet = pacsSubName.getPacsSubNameDiseases();
+                    isExist = false;
+                    for (PacsSubNameDisease item : pacsSubNameDiseaseSet) {
+                        if (item.getDisease() != null
+                                && item.getDisease().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setDisease(disease);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameDisease pacsSubNameDisease = new PacsSubNameDisease();
+                        pacsSubNameDisease.setDisease(disease);
+                        pacsSubNameDisease.setPacsSubName(pacsSubName);
+                        pacsSubNameDisease.setStatus(status);
+                        pacsSubNameDisease.setRuleType(ruleType);
+                        pacsSubNameDiseaseSet.add(pacsSubNameDisease);
+                    }
+                    pacsSubName.setPacsSubNameDiseases(pacsSubNameDiseaseSet);
+                    break;
+                case "辅助检查子项目名称禁忌禁忌医疗器械及物品":
+                    ConflictDevice conflictDevice = conflictDeviceRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameConflictDevice> pacsSubNameConflictDeviceSet = pacsSubName.getPacsSubNameConflictdevices();
+                    isExist = false;
+                    for (PacsSubNameConflictDevice item : pacsSubNameConflictDeviceSet) {
+                        if (item.getConflictDevice() != null
+                                && item.getConflictDevice().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setConflictDevice(conflictDevice);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameConflictDevice pacsSubNameConflictDevice = new PacsSubNameConflictDevice();
+                        pacsSubNameConflictDevice.setConflictDevice(conflictDevice);
+                        pacsSubNameConflictDevice.setPacsSubName(pacsSubName);
+                        pacsSubNameConflictDevice.setStatus(status);
+                        pacsSubNameConflictDevice.setRuleType(ruleType);
+                        pacsSubNameConflictDeviceSet.add(pacsSubNameConflictDevice);
+                    }
+                    pacsSubName.setPacsSubNameConflictdevices(pacsSubNameConflictDeviceSet);
+                    break;
+                case "辅助检查子项目名称禁忌体征":
+                    Vital vital = vitalRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameVital> pacsSubNameVitalSet = pacsSubName.getPacsSubNameVitals();
+                    isExist = false;
+                    for (PacsSubNameVital item : pacsSubNameVitalSet) {
+                        if (item.getVital() != null
+                                && item.getVital().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setVital(vital);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameVital pacsSubNameVital = new PacsSubNameVital();
+                        pacsSubNameVital.setVital(vital);
+                        pacsSubNameVital.setPacsSubName(pacsSubName);
+                        pacsSubNameVital.setStatus(status);
+                        pacsSubNameVital.setRuleType(ruleType);
+                        pacsSubNameVitalSet.add(pacsSubNameVital);
+                    }
+                    pacsSubName.setPacsSubNameVitals(pacsSubNameVitalSet);
+                    break;
+                case "辅助检查子项目名称禁忌服用药品":
+                    OralMedicine oralMedicine = oralMedicineRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameOralMedicine> pacsSubNameOralMedicineSet = pacsSubName.getPacsSubNameOralmedicines();
+                    isExist = false;
+                    for (PacsSubNameOralMedicine item : pacsSubNameOralMedicineSet) {
+                        if (item.getOralMedicine() != null
+                                && item.getOralMedicine().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setOralMedicine(oralMedicine);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameOralMedicine pacsSubNameOralMedicine = new PacsSubNameOralMedicine();
+                        pacsSubNameOralMedicine.setOralMedicine(oralMedicine);
+                        pacsSubNameOralMedicine.setPacsSubName(pacsSubName);
+                        pacsSubNameOralMedicine.setStatus(status);
+                        pacsSubNameOralMedicine.setRuleType(ruleType);
+                        pacsSubNameOralMedicineSet.add(pacsSubNameOralMedicine);
+                    }
+                    pacsSubName.setPacsSubNameOralmedicines(pacsSubNameOralMedicineSet);
+                    break;
+                case "辅助检查子项目名称禁忌辅助检查名称描述":
+                    PacsDescribe pacsDescribe = pacsDescribeRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNamePacsDescribe> pacsSubNamePacsDescribeSet = pacsSubName.getPacsSubNamePacsdescribes();
+                    isExist = false;
+                    for (PacsSubNamePacsDescribe item : pacsSubNamePacsDescribeSet) {
+                        if (item.getPacsDescribe() != null
+                                && item.getPacsDescribe().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setPacsDescribe(pacsDescribe);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNamePacsDescribe pacsSubNamePacsDescribe = new PacsSubNamePacsDescribe();
+                        pacsSubNamePacsDescribe.setPacsDescribe(pacsDescribe);
+                        pacsSubNamePacsDescribe.setPacsSubName(pacsSubName);
+                        pacsSubNamePacsDescribe.setStatus(status);
+                        pacsSubNamePacsDescribe.setRuleType(ruleType);
+                        pacsSubNamePacsDescribeSet.add(pacsSubNamePacsDescribe);
+                    }
+                    pacsSubName.setPacsSubNamePacsdescribes(pacsSubNamePacsDescribeSet);
+                    break;
+                case "辅助检查子项目名称禁忌过敏原":
+                    Allergen allergen = allergenRepository.findByNameIs(e_name).get(0);
+                    Set<PacsSubNameAllergen> pacsSubNameAllergenSet = pacsSubName.getPacsSubNameAllergens();
+                    isExist = false;
+                    for (PacsSubNameAllergen item : pacsSubNameAllergenSet) {
+                        if (item.getAllergen() != null
+                                && item.getAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setPacsSubName(pacsSubName);
+                            item.setAllergen(allergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        PacsSubNameAllergen pacsSubNameAllergen = new PacsSubNameAllergen();
+                        pacsSubNameAllergen.setAllergen(allergen);
+                        pacsSubNameAllergen.setPacsSubName(pacsSubName);
+                        pacsSubNameAllergen.setStatus(status);
+                        pacsSubNameAllergen.setRuleType(ruleType);
+                        pacsSubNameAllergenSet.add(pacsSubNameAllergen);
+                    }
+                    pacsSubName.setPacsSubNameAllergens(pacsSubNameAllergenSet);
+                    break;
+            }
+            pacsSubNameRepository.save(pacsSubName, 1);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+
+        }
+    }
+}
 
 
 
 
 
 

+ 29 - 1
src/main/java/com/diagbot/repository/VitalRepository.java

@@ -1,6 +1,5 @@
 package com.diagbot.repository;
 package com.diagbot.repository;
 
 
-import com.diagbot.entity.node.Symptom;
 import com.diagbot.entity.node.Vital;
 import com.diagbot.entity.node.Vital;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
 import org.springframework.data.neo4j.repository.Neo4jRepository;
@@ -36,5 +35,34 @@ public interface VitalRepository extends Neo4jRepository<Vital, Long> {
     @Query("MATCH (n:体征) return distinct(n.name) as name LIMIT {size}")
     @Query("MATCH (n:体征) return distinct(n.name) as name LIMIT {size}")
     List<String> getVitalNames(@Param("size") Integer size);
     List<String> getVitalNames(@Param("size") Integer size);
 
 
+    @Query("merge (n:体征{name:{name}})  " +
+            "on create set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.体征指标={indication} " +
+            "on match set  " +
+            "n.拼音编码={pycode}," +
+            "n.静态知识标识={is_kl}," +
+            "n.状态={status}," +
+            "n.最大值={maxValue}," +
+            "n.最小值={minValue}," +
+            "n.范围={range}," +
+            "n.单位={unit}, " +
+            "n.体征指标={indication} " +
+            "RETURN n,[ (n)-[r]->(m) | [ r, m ] ], ID(n)\n")
+    Vital createOrUpdate(@Param("name") String name,
+                         @Param("is_kl") Integer is_kl,
+                         @Param("pycode") String pycode,
+                         @Param("status") Integer status,
+                         @Param("maxValue") Double maxValue,
+                         @Param("minValue") Double minValue,
+                         @Param("range") Integer range,
+                         @Param("unit") String unit,
+                         @Param("indication") String indication);
 }
 }
 
 

+ 282 - 4
src/main/java/com/diagbot/repository/YiBaoOperationNameNode.java

@@ -20,7 +20,16 @@ import com.diagbot.entity.node.OralMedicine;
 import com.diagbot.entity.node.PacsDescribe;
 import com.diagbot.entity.node.PacsDescribe;
 import com.diagbot.entity.node.Vital;
 import com.diagbot.entity.node.Vital;
 import com.diagbot.entity.node.YiBaoOperationName;
 import com.diagbot.entity.node.YiBaoOperationName;
-import com.diagbot.entity.relationship.*;
+import com.diagbot.entity.relationship.YiBaoOperationNameClinicalFinding;
+import com.diagbot.entity.relationship.YiBaoOperationNameConflictDevice;
+import com.diagbot.entity.relationship.YiBaoOperationNameDisease;
+import com.diagbot.entity.relationship.YiBaoOperationNameGender;
+import com.diagbot.entity.relationship.YiBaoOperationNameGroup;
+import com.diagbot.entity.relationship.YiBaoOperationNameLis;
+import com.diagbot.entity.relationship.YiBaoOperationNameMedAllergen;
+import com.diagbot.entity.relationship.YiBaoOperationNameOralMedicine;
+import com.diagbot.entity.relationship.YiBaoOperationNamePacsDescribe;
+import com.diagbot.entity.relationship.YiBaoOperationNameVital;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.model.label.PacsLabel;
 import com.diagbot.model.label.PacsLabel;
 import com.diagbot.model.label.VitalLabel;
 import com.diagbot.model.label.VitalLabel;
@@ -28,14 +37,44 @@ import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.NeoUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
+@Component
 public class YiBaoOperationNameNode {
 public class YiBaoOperationNameNode {
 
 
+    @Autowired
+    MedAllergenRepository medAllergenRepository;
+    @Autowired
+    GenderRepository genderRepository;
+    @Autowired
+    LisRepository lisRepository;
+    @Autowired
+    GroupRepository groupRepository;
+    @Autowired
+    ClinicalFindingRepository clinicalFindingRepository;
+    @Autowired
+    VitalRepository vitalRepository;
+    @Autowired
+    AgeRepository ageRepository;
+    @Autowired
+    DiseaseRepository diseaseRepository;
+    @Autowired
+    BillConflictItemRepository billConflictItemRepository;
+    @Autowired
+    ConflictDeviceRepository conflictDeviceRepository;
+    @Autowired
+    OralMedicineRepository oralMedicineRepository;
+    @Autowired
+    PacsDescribeRepository pacsDescribeRepository;
+    @Autowired
+    AllergenRepository allergenRepository;
+
 
 
     public OperationBillNeoDTO YiBaoOperationtoOperationDTO(YiBaoOperationName operation) {
     public OperationBillNeoDTO YiBaoOperationtoOperationDTO(YiBaoOperationName operation) {
         OperationBillNeoDTO opBillNeoDTO = new OperationBillNeoDTO();
         OperationBillNeoDTO opBillNeoDTO = new OperationBillNeoDTO();
@@ -109,7 +148,7 @@ public class YiBaoOperationNameNode {
             }
             }
         }
         }
 
 
-        Set<YiBaoOperationNameOralMedicine> yiBaoOperationNameOralMeds= operation.getOralmeds();
+        Set<YiBaoOperationNameOralMedicine> yiBaoOperationNameOralMeds = operation.getOralmeds();
         for (YiBaoOperationNameOralMedicine yiBaoOperationNameOralMed : yiBaoOperationNameOralMeds) {
         for (YiBaoOperationNameOralMedicine yiBaoOperationNameOralMed : yiBaoOperationNameOralMeds) {
             if (NeoUtil.isExist(yiBaoOperationNameOralMed)) {
             if (NeoUtil.isExist(yiBaoOperationNameOralMed)) {
                 if (NeoUtil.isExist(yiBaoOperationNameOralMed.getOralMedicine())) {
                 if (NeoUtil.isExist(yiBaoOperationNameOralMed.getOralMedicine())) {
@@ -332,7 +371,7 @@ public class YiBaoOperationNameNode {
             String cond = operation.getHighriskcond();
             String cond = operation.getHighriskcond();
             JSONObject jobj = JSONObject.parseObject(cond);
             JSONObject jobj = JSONObject.parseObject(cond);
 
 
-            if (null!=jobj) {
+            if (null != jobj) {
                 // 判断年龄
                 // 判断年龄
                 JSONObject ageobj = jobj.getJSONObject("年龄");
                 JSONObject ageobj = jobj.getJSONObject("年龄");
 
 
@@ -425,5 +464,244 @@ public class YiBaoOperationNameNode {
 
 
     }
     }
 
 
+    /**
+     * 更新关系状态属性
+     */
+    public void updateRelationExt(YiBaoOperationName yiBaoOperationName, String relname, Integer status, Integer ruleType, String e_name, YiBaoOperationNameRepository yiBaoOperationNameRepository) {
+        Boolean isExist = false;
+        try {
+            switch (relname) {
+                case "医保手术和操作名称禁忌性别":
+                    Gender gender = genderRepository.findByNameIs(e_name).get(0);
+                    YiBaoOperationNameGender yiBaoOperationNameGender = new YiBaoOperationNameGender();
+                    yiBaoOperationNameGender.setGender(gender);
+                    yiBaoOperationNameGender.setYiBaoOperationName(yiBaoOperationName);
+                    yiBaoOperationNameGender.setStatus(status);
+                    yiBaoOperationNameGender.setRuleType(ruleType);
+                    yiBaoOperationName.setGender(yiBaoOperationNameGender);
+                    break;
+                case "医保手术和操作名称禁忌禁忌人群":
+                    Group group = groupRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameGroup> yiBaoOperationNameGroupSet = yiBaoOperationName.getGroups();
+                    isExist = false;
+                    for (YiBaoOperationNameGroup item : yiBaoOperationNameGroupSet) {
+                        if (item.getGroup() != null
+                                && item.getGroup().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setGroup(group);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameGroup yiBaoOperationNameGroup = new YiBaoOperationNameGroup();
+                        yiBaoOperationNameGroup.setGroup(group);
+                        yiBaoOperationNameGroup.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameGroup.setStatus(status);
+                        yiBaoOperationNameGroup.setRuleType(ruleType);
+                        yiBaoOperationNameGroupSet.add(yiBaoOperationNameGroup);
+                    }
+                    yiBaoOperationName.setGroups(yiBaoOperationNameGroupSet);
+                    break;
+                case "医保手术和操作名称禁忌药物过敏原":
+                    MedAllergen medAllergen = medAllergenRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameMedAllergen> yiBaoOperationNameMedAllergenSet = yiBaoOperationName.getMedallergens();
+                    isExist = false;
+                    for (YiBaoOperationNameMedAllergen item : yiBaoOperationNameMedAllergenSet) {
+                        if (item.getMedAllergen() != null
+                                && item.getMedAllergen().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setMedAllergen(medAllergen);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameMedAllergen yiBaoOperationNameMedAllergen = new YiBaoOperationNameMedAllergen();
+                        yiBaoOperationNameMedAllergen.setMedAllergen(medAllergen);
+                        yiBaoOperationNameMedAllergen.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameMedAllergen.setStatus(status);
+                        yiBaoOperationNameMedAllergen.setRuleType(ruleType);
+                        yiBaoOperationNameMedAllergenSet.add(yiBaoOperationNameMedAllergen);
+                    }
+                    yiBaoOperationName.setMedallergens(yiBaoOperationNameMedAllergenSet);
+                    break;
+                case "医保手术和操作名称禁忌临床表现":
+                    ClinicalFinding clinicalFinding = clinicalFindingRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameClinicalFinding> yiBaoOperationNameClinicalFindingSet = yiBaoOperationName.getClinicalFindings();
+                    isExist = false;
+                    for (YiBaoOperationNameClinicalFinding item : yiBaoOperationNameClinicalFindingSet) {
+                        if (item.getClinicalFinding() != null
+                                && item.getClinicalFinding().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setClinicalFinding(clinicalFinding);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameClinicalFinding yiBaoOperationNameClinicalFinding = new YiBaoOperationNameClinicalFinding();
+                        yiBaoOperationNameClinicalFinding.setClinicalFinding(clinicalFinding);
+                        yiBaoOperationNameClinicalFinding.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameClinicalFinding.setStatus(status);
+                        yiBaoOperationNameClinicalFinding.setRuleType(ruleType);
+                        yiBaoOperationNameClinicalFindingSet.add(yiBaoOperationNameClinicalFinding);
+                    }
+                    yiBaoOperationName.setClinicalFindings(yiBaoOperationNameClinicalFindingSet);
+                    break;
+                case "医保手术和操作名称禁忌实验室检查":
+                    Lis lis = lisRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameLis> yiBaoOperationNameLisSet = yiBaoOperationName.getLiss();
+                    isExist = false;
+                    for (YiBaoOperationNameLis item : yiBaoOperationNameLisSet) {
+                        if (item.getLis() != null
+                                && item.getLis().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setLis(lis);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameLis yiBaoOperationNameLis = new YiBaoOperationNameLis();
+                        yiBaoOperationNameLis.setLis(lis);
+                        yiBaoOperationNameLis.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameLis.setStatus(status);
+                        yiBaoOperationNameLis.setRuleType(ruleType);
+                        yiBaoOperationNameLisSet.add(yiBaoOperationNameLis);
+                    }
+                    yiBaoOperationName.setLiss(yiBaoOperationNameLisSet);
+                    break;
+                case "医保手术和操作名称禁忌疾病":
+                    Disease disease = diseaseRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameDisease> yiBaoOperationNameDiseaseSet = yiBaoOperationName.getDiseases();
+                    isExist = false;
+                    for (YiBaoOperationNameDisease item : yiBaoOperationNameDiseaseSet) {
+                        if (item.getDisease() != null
+                                && item.getDisease().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setDisease(disease);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameDisease yiBaoOperationNameDisease = new YiBaoOperationNameDisease();
+                        yiBaoOperationNameDisease.setDisease(disease);
+                        yiBaoOperationNameDisease.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameDisease.setStatus(status);
+                        yiBaoOperationNameDisease.setRuleType(ruleType);
+                        yiBaoOperationNameDiseaseSet.add(yiBaoOperationNameDisease);
+                    }
+                    yiBaoOperationName.setDiseases(yiBaoOperationNameDiseaseSet);
+                    break;
+                case "医保手术和操作名称禁忌禁忌医疗器械及物品":
+                    ConflictDevice conflictDevice = conflictDeviceRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameConflictDevice> yiBaoOperationNameConflictDeviceSet = yiBaoOperationName.getConflictdevices();
+                    isExist = false;
+                    for (YiBaoOperationNameConflictDevice item : yiBaoOperationNameConflictDeviceSet) {
+                        if (item.getConflictDevice() != null
+                                && item.getConflictDevice().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setConflictDevice(conflictDevice);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameConflictDevice yiBaoOperationNameConflictDevice = new YiBaoOperationNameConflictDevice();
+                        yiBaoOperationNameConflictDevice.setConflictDevice(conflictDevice);
+                        yiBaoOperationNameConflictDevice.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameConflictDevice.setStatus(status);
+                        yiBaoOperationNameConflictDevice.setRuleType(ruleType);
+                        yiBaoOperationNameConflictDeviceSet.add(yiBaoOperationNameConflictDevice);
+                    }
+                    yiBaoOperationName.setConflictdevices(yiBaoOperationNameConflictDeviceSet);
+                    break;
+                case "医保手术和操作名称禁忌体征":
+                    Vital vital = vitalRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameVital> yiBaoOperationNameVitalSet = yiBaoOperationName.getVitals();
+                    isExist = false;
+                    for (YiBaoOperationNameVital item : yiBaoOperationNameVitalSet) {
+                        if (item.getVital() != null
+                                && item.getVital().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setVital(vital);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameVital yiBaoOperationNameVital = new YiBaoOperationNameVital();
+                        yiBaoOperationNameVital.setVital(vital);
+                        yiBaoOperationNameVital.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameVital.setStatus(status);
+                        yiBaoOperationNameVital.setRuleType(ruleType);
+                        yiBaoOperationNameVitalSet.add(yiBaoOperationNameVital);
+                    }
+                    yiBaoOperationName.setVitals(yiBaoOperationNameVitalSet);
+                    break;
+                case "医保手术和操作名称禁忌服用药品":
+                    OralMedicine oralMedicine = oralMedicineRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNameOralMedicine> yiBaoOperationNameOralMedicineSet = yiBaoOperationName.getOralmeds();
+                    isExist = false;
+                    for (YiBaoOperationNameOralMedicine item : yiBaoOperationNameOralMedicineSet) {
+                        if (item.getOralMedicine() != null
+                                && item.getOralMedicine().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setOralMedicine(oralMedicine);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNameOralMedicine yiBaoOperationNameOralMedicine = new YiBaoOperationNameOralMedicine();
+                        yiBaoOperationNameOralMedicine.setOralMedicine(oralMedicine);
+                        yiBaoOperationNameOralMedicine.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNameOralMedicine.setStatus(status);
+                        yiBaoOperationNameOralMedicine.setRuleType(ruleType);
+                        yiBaoOperationNameOralMedicineSet.add(yiBaoOperationNameOralMedicine);
+                    }
+                    yiBaoOperationName.setOralmeds(yiBaoOperationNameOralMedicineSet);
+                    break;
+                case "医保手术和操作名称禁忌辅助检查名称描述":
+                    PacsDescribe pacsDescribe = pacsDescribeRepository.findByNameIs(e_name).get(0);
+                    Set<YiBaoOperationNamePacsDescribe> yiBaoOperationNamePacsDescribeSet = yiBaoOperationName.getPacsdescs();
+                    isExist = false;
+                    for (YiBaoOperationNamePacsDescribe item : yiBaoOperationNamePacsDescribeSet) {
+                        if (item.getPacsDescribe() != null
+                                && item.getPacsDescribe().getName().equals(e_name)) {
+                            isExist = true;
+                            item.setYiBaoOperationName(yiBaoOperationName);
+                            item.setPacsDescribe(pacsDescribe);
+                            item.setStatus(status);
+                            item.setRuleType(ruleType);
+                        }
+                    }
+                    if (!isExist) {
+                        YiBaoOperationNamePacsDescribe yiBaoOperationNamePacsDescribe = new YiBaoOperationNamePacsDescribe();
+                        yiBaoOperationNamePacsDescribe.setPacsDescribe(pacsDescribe);
+                        yiBaoOperationNamePacsDescribe.setYiBaoOperationName(yiBaoOperationName);
+                        yiBaoOperationNamePacsDescribe.setStatus(status);
+                        yiBaoOperationNamePacsDescribe.setRuleType(ruleType);
+                        yiBaoOperationNamePacsDescribeSet.add(yiBaoOperationNamePacsDescribe);
+                    }
+                    yiBaoOperationName.setPacsdescs(yiBaoOperationNamePacsDescribeSet);
+                    break;
+            }
+            yiBaoOperationNameRepository.save(yiBaoOperationName, 1);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
 
 
-}
+        }
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.DictionaryInfo;
+
+/**
+ * <p>
+ * CDSS字典表 服务类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+public interface DictionaryInfoService extends IService<DictionaryInfo> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.DictionaryInfo;
+import com.diagbot.mapper.DictionaryInfoMapper;
+import com.diagbot.service.DictionaryInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * CDSS字典表 服务实现类
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2018-12-25
+ */
+@Service
+public class DictionaryInfoServiceImpl extends ServiceImpl<DictionaryInfoMapper, DictionaryInfo> implements DictionaryInfoService {
+
+}

+ 25 - 0
src/main/java/com/diagbot/vo/BillPageVO.java

@@ -0,0 +1,25 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 16:53
+ */
+@Getter
+@Setter
+public class BillPageVO {
+    private List<Integer> types;
+    private int number = 0;
+    private int size = 10;
+    @ApiModelProperty(hidden = true)
+    private List<String> labels;
+    private String conceptName;
+    private String conditionName;
+    private Integer relationStatus;
+}

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

@@ -0,0 +1,26 @@
+package com.diagbot.vo;
+
+import com.diagbot.entity.node.BillConcept;
+import com.diagbot.entity.node.BillCondition;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/19 14:22
+ */
+@Getter
+@Setter
+public class BillSaveVO {
+    private Integer type;
+    private BillConcept concept;
+
+    private Long relationId;
+    private String relationName;
+    private Integer relationStatus;
+    private Integer ruleType;
+    private String ruleName;
+
+    private BillCondition condition;
+}

+ 23 - 0
src/main/java/com/diagbot/vo/ConceptIndexVO.java

@@ -0,0 +1,23 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/19 13:22
+ */
+@Getter
+@Setter
+public class ConceptIndexVO {
+    @NotBlank(message = "请选择开单项类型")
+    private Integer type;
+    @ApiModelProperty(hidden = true)
+    private String conceptLabel;
+    @NotBlank(message = "请选择开单项")
+    private String conceptName;
+}

+ 27 - 0
src/main/java/com/diagbot/vo/ConditionIndexVO.java

@@ -0,0 +1,27 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/18 14:39
+ */
+@Getter
+@Setter
+public class ConditionIndexVO {
+    @NotBlank(message = "请选择开单项类型")
+    private Integer type;
+    @ApiModelProperty(hidden = true)
+    private String conceptLabel;
+    @NotBlank(message = "请选择开单项")
+    private String conceptName;
+    @NotBlank(message = "请选择规则类型:文本类型、数值类型")
+    private String ruleType;
+    @NotBlank(message = "请输入条件明细")
+    private String conditionName;
+}

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

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/24 14:47
+ */
+@Getter
+@Setter
+public class RelationIdVO {
+    @NotNull(message = "请输入关系id")
+    private Long relationId;
+}

+ 15 - 0
src/main/java/com/diagbot/vo/RelationStatusVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/26 16:00
+ */
+@Getter
+@Setter
+public class RelationStatusVO extends RelationIdVO {
+    private Integer status;
+}

+ 96 - 0
src/main/java/com/diagbot/web/BillManController.java

@@ -0,0 +1,96 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.node.BillConcept;
+import com.diagbot.entity.node.BillCondition;
+import com.diagbot.entity.node.BillItem;
+import com.diagbot.facade.BillManFacade;
+import com.diagbot.vo.BillPageVO;
+import com.diagbot.vo.BillSaveVO;
+import com.diagbot.vo.ConceptIndexVO;
+import com.diagbot.vo.ConditionIndexVO;
+import com.diagbot.vo.RelationIdVO;
+import com.diagbot.vo.RelationStatusVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/11/17 13:56
+ */
+@RestController
+@RequestMapping("/billman")
+@Api(value = "开单合理项维护相关API", tags = { "开单合理项维护相关API" })
+@SuppressWarnings("unchecked")
+public class BillManController {
+    @Autowired
+    BillManFacade billManFacade;
+
+    @ApiOperation(value = "获取开单合理项列表[zhaops]",
+            notes = "number:页码<br>" +
+                    "size:每页条目数<br>" +
+                    "types:开单类型(多选)1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名<br>" +
+                    "conceptName:开单项(模糊匹配)<br>" +
+                    "conditionName:条件明细(模糊匹配)<br>" +
+                    "relationStatus:启用禁用标志(0-禁用,1-启用)<br>")
+    @PostMapping("/getPage")
+    public RespDTO<BillItem> getPage(@RequestBody BillPageVO billPageVO) {
+        Page<BillItem> data = billManFacade.getPage(billPageVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "条件明细检索[zhaops]",
+            notes = "type:开单类型(1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名)<br>" +
+                    "conceptName:开单项<br>" +
+                    "ruleType:规则类型(1-文本类型、2-数值类型)<br>" +
+                    "conditionName:条件明细(模糊匹配)<br>")
+    @PostMapping("/conditionIndex")
+    public RespDTO<BillCondition> conditionIndex(@RequestBody ConditionIndexVO conditionIndexVO) {
+        List<BillCondition> data = billManFacade.conditionIndex(conditionIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "开单项检索[zhaops]",
+            notes = "type:开单类型(1-检验套餐、2-检查、3-检查子项、4-手术和操作、5-药品注册名)<br>" +
+                    "conceptName:开单项(模糊匹配)<br>")
+    @PostMapping("/conceptIndex")
+    public RespDTO<BillConcept> conceptIndex(@RequestBody ConceptIndexVO conceptIndexVO) {
+        List<BillConcept> data = billManFacade.conceptIndex(conceptIndexVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "查询单条规则[zhaops]",
+            notes = "relationId:关系id<br>")
+    @PostMapping("/getRecordByRelationId")
+    public RespDTO<BillSaveVO> getRecordByRelationId(@RequestBody @Valid RelationIdVO relationIdVO) {
+        BillSaveVO data = billManFacade.getRecordByRelationId(relationIdVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "保存规则[zhaops]",
+            notes = "")
+    @PostMapping("/saveRecord")
+    public RespDTO<Boolean> saveRecord(@RequestBody BillSaveVO billSaveVO) {
+        Boolean data = billManFacade.saveRecord(billSaveVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "规则启用禁用[zhaops]",
+            notes = "relationId:关系id<br>" +
+                    "status:状态(0-禁用、1-启用)")
+    @PostMapping("/updateStatus")
+    public RespDTO<Boolean> updateStatus(@RequestBody @Valid RelationStatusVO relationStatusVO) {
+        Boolean data = billManFacade.updateStatus(relationStatusVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 1 - 1
src/main/resources/application-dev.yml

@@ -106,7 +106,7 @@ spring:
 
 
 neo4j:
 neo4j:
   data:
   data:
-    URI: http://192.168.3.150:7480
+    URI: http://192.168.2.234:7480
     username: neo4j
     username: neo4j
     password: root
     password: root
 
 

+ 1 - 1
src/main/resources/application-local.yml

@@ -106,7 +106,7 @@ spring:
 
 
 neo4j:
 neo4j:
   data:
   data:
-    URI: http://192.168.3.150:7480
+    URI: http://192.168.2.234:7480
     username: neo4j
     username: neo4j
     password: root
     password: root
 
 

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -204,7 +204,7 @@
     <!-- FrameworkServlet日志-->
     <!-- FrameworkServlet日志-->
     <logger name="org.springframework" level="WARN"/>
     <logger name="org.springframework" level="WARN"/>
 
 
-    <!--<logger name="org.neo4j.ogm" level="DEBUG" />-->
+    <logger name="org.neo4j.ogm" level="DEBUG" />
 
 
     <!-- mybatis日志打印-->
     <!-- mybatis日志打印-->
     <logger name="org.apache.ibatis" level="DEBUG"/>
     <logger name="org.apache.ibatis" level="DEBUG"/>

+ 21 - 0
src/main/resources/mapper/DictionaryInfoMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.DictionaryInfoMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.DictionaryInfo">
+        <id column="id" property="id" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+        <result column="group_type" property="groupType" />
+        <result column="name" property="name" />
+        <result column="val" property="val" />
+        <result column="return_type" property="returnType" />
+        <result column="order_no" property="orderNo" />
+        <result column="remark" property="remark" />
+    </resultMap>
+
+</mapper>