Jelajahi Sumber

Merge branch 'master' of http://192.168.2.236:10080/gaodm/mrqc-sys into his/wenfuyi

# Conflicts:
#	src/main/java/com/diagbot/config/ResourceServerConfigurer.java
#	src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
#	src/main/resources/application-local.yml
#	src/main/resources/application-pro.yml
#	src/main/resources/bootstrap.yml
lipc 3 tahun lalu
induk
melakukan
1ebf870cb6
100 mengubah file dengan 7045 tambahan dan 831 penghapusan
  1. 12 0
      doc/034.20210804_2.0.5/qc_initv2.0.5.sql
  2. 90 0
      doc/036.20211015_2.1.1/qc_initv2.1.1.sql
  3. 174 0
      doc/037.20211117_2.1.4/qc_initv2.1.4.sql
  4. 9 0
      doc/038.20211129_2.1.3/qc_initv2.1.3.sql
  5. 10 0
      doc/040.20211228_2.1.5/qc_initv2.1.5.sql
  6. 15 0
      doc/041.20220113_v2.1.6_演示版_历史评分及操作日志/qc_initv2.1.6.sql
  7. 215 0
      doc/041.20220118_v2.2.0_通用版_申诉驳回/qc_init_v2.2.0_通用版_申诉驳回.sql
  8. 33 0
      doc/042.20220303病案首页字段新增/qc_initv2.1.5.sql
  9. 8 0
      doc/044.20220311v2.2.1/qc_initv2.2.1.sql
  10. 17 2
      pom.xml
  11. 129 0
      src/main/java/com/diagbot/aggregate/LeaveHosCountByDeptAggregate.java
  12. 91 0
      src/main/java/com/diagbot/client/MedAppealExamineInfoServiceClient.java
  13. 102 0
      src/main/java/com/diagbot/client/MedAppealExamineInfoServiceClientFacade.java
  14. 48 0
      src/main/java/com/diagbot/client/MedAppealInfoServiceClient.java
  15. 52 0
      src/main/java/com/diagbot/client/MedAppealInfoServiceClientFacade.java
  16. 63 0
      src/main/java/com/diagbot/client/hystrix/MedAppealExamineInfoServiceHystrix.java
  17. 64 0
      src/main/java/com/diagbot/client/hystrix/MedAppealInfoServiceHystrix.java
  18. 37 0
      src/main/java/com/diagbot/config/AccessDeniedExceptionPoint.java
  19. 32 0
      src/main/java/com/diagbot/config/AuthExceptionEntryPoint.java
  20. 90 0
      src/main/java/com/diagbot/config/AuthenticationExceptionHandler.java
  21. 223 0
      src/main/java/com/diagbot/config/MyJwtTokenStore.java
  22. 14 2
      src/main/java/com/diagbot/config/OAuth2Configurer.java
  23. 82 27
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  24. 112 3
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  25. 13 1
      src/main/java/com/diagbot/config/security/UrlFilterSecurityInterceptor.java
  26. 89 0
      src/main/java/com/diagbot/dto/AppealExamineRecordDTO.java
  27. 94 0
      src/main/java/com/diagbot/dto/BehospitalAnalysisDTO.java
  28. 72 0
      src/main/java/com/diagbot/dto/BehospitalCodeDetail.java
  29. 20 0
      src/main/java/com/diagbot/dto/BehospitalCodeInfo.java
  30. 58 37
      src/main/java/com/diagbot/dto/BehospitalInfoDTO.java
  31. 61 0
      src/main/java/com/diagbot/dto/CommonResult.java
  32. 26 0
      src/main/java/com/diagbot/dto/EntryDefectImprove.java
  33. 24 0
      src/main/java/com/diagbot/dto/EntryDefectImproveInner.java
  34. 25 0
      src/main/java/com/diagbot/dto/EntryDefectImproveInnerDoctor.java
  35. 27 0
      src/main/java/com/diagbot/dto/EntryDefectImproveInnerExport.java
  36. 58 0
      src/main/java/com/diagbot/dto/ExportGetAppealReviewDTO.java
  37. 57 0
      src/main/java/com/diagbot/dto/ExportGetComplaintRecordDTO.java
  38. 20 0
      src/main/java/com/diagbot/dto/GetAppealDeptDTO.java
  39. 72 0
      src/main/java/com/diagbot/dto/GetAppealInfoDTO.java
  40. 20 0
      src/main/java/com/diagbot/dto/GetAppealModeDTO.java
  41. 67 0
      src/main/java/com/diagbot/dto/GetAppealReviewDTO.java
  42. 92 0
      src/main/java/com/diagbot/dto/GetComplaintRecordDTO.java
  43. 77 0
      src/main/java/com/diagbot/dto/GetEntryDefectImproveDTO.java
  44. 85 0
      src/main/java/com/diagbot/dto/GetEntryDefectImproveDeptDTO.java
  45. 35 0
      src/main/java/com/diagbot/dto/GetEntryInfoDTO.java
  46. 40 0
      src/main/java/com/diagbot/dto/GetQcClickDTO.java
  47. 52 0
      src/main/java/com/diagbot/dto/GetQcClickInnerPageDTO.java
  48. 22 0
      src/main/java/com/diagbot/dto/GetReviewerDTO.java
  49. 5 0
      src/main/java/com/diagbot/dto/HomePageNumDTO.java
  50. 138 0
      src/main/java/com/diagbot/dto/HomePageNumXYDTO.java
  51. 40 0
      src/main/java/com/diagbot/dto/MedRecordContentOtherDTO.java
  52. 26 0
      src/main/java/com/diagbot/dto/MsgApiDTO.java
  53. 19 0
      src/main/java/com/diagbot/dto/MsgDTO.java
  54. 38 0
      src/main/java/com/diagbot/dto/QcCasesHistoryDTO.java
  55. 20 0
      src/main/java/com/diagbot/dto/QcResultDetailInfo.java
  56. 35 0
      src/main/java/com/diagbot/dto/StrAdmissionNoteDTO.java
  57. 5 0
      src/main/java/com/diagbot/entity/BehospitalInfo.java
  58. 6 0
      src/main/java/com/diagbot/entity/HomeDiagnoseInfo.java
  59. 40 0
      src/main/java/com/diagbot/entity/HomePage.java
  60. 61 0
      src/main/java/com/diagbot/entity/ImageCaptchaParams.java
  61. 103 0
      src/main/java/com/diagbot/entity/MedAppealExamineInfo.java
  62. 145 0
      src/main/java/com/diagbot/entity/MedAppealInfo.java
  63. 92 0
      src/main/java/com/diagbot/entity/MedClickInfo.java
  64. 6 0
      src/main/java/com/diagbot/entity/MedQcresultCases.java
  65. 61 0
      src/main/java/com/diagbot/entity/MedQcresultClick.java
  66. 4 0
      src/main/java/com/diagbot/entity/QcresultDetail.java
  67. 77 0
      src/main/java/com/diagbot/entity/WorkFlowInfo.java
  68. 52 0
      src/main/java/com/diagbot/entity/operationLog.java
  69. 44 0
      src/main/java/com/diagbot/enums/AppealOperationTypeEnum.java
  70. 44 0
      src/main/java/com/diagbot/enums/ExampleOperationEnum.java
  71. 43 0
      src/main/java/com/diagbot/enums/ExampleStatusEnum.java
  72. 43 0
      src/main/java/com/diagbot/enums/WorkFlowNodeEnum.java
  73. 3 0
      src/main/java/com/diagbot/exception/CommonExceptionHandler.java
  74. 3 0
      src/main/java/com/diagbot/exception/ServiceErrorCode.java
  75. 26 18
      src/main/java/com/diagbot/facade/AlgorithmFacade.java
  76. 15 1
      src/main/java/com/diagbot/facade/BasDeptInfoFacade.java
  77. 4 0
      src/main/java/com/diagbot/facade/BasDoctorInfoFacade.java
  78. 447 239
      src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
  79. 76 120
      src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java
  80. 122 3
      src/main/java/com/diagbot/facade/ConsoleExportFacade.java
  81. 60 5
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  82. 215 0
      src/main/java/com/diagbot/facade/DataAnalysisDeptFacade.java
  83. 758 0
      src/main/java/com/diagbot/facade/DataAnalysisFacade.java
  84. 65 0
      src/main/java/com/diagbot/facade/DataEditFacade.java
  85. 310 0
      src/main/java/com/diagbot/facade/MedAppealExamineInfoManagementFacade.java
  86. 18 0
      src/main/java/com/diagbot/facade/MedAppealInfoManagementFacade.java
  87. 207 233
      src/main/java/com/diagbot/facade/MedCheckInfoFacade.java
  88. 121 0
      src/main/java/com/diagbot/facade/MedicalRecordOtherFacade.java
  89. 50 1
      src/main/java/com/diagbot/facade/QcModuleInfoFacade.java
  90. 96 44
      src/main/java/com/diagbot/facade/QcresultInfoFacade.java
  91. 54 28
      src/main/java/com/diagbot/facade/RecordCheckFacade.java
  92. 47 3
      src/main/java/com/diagbot/facade/SysDictionaryFacade.java
  93. 122 34
      src/main/java/com/diagbot/facade/SysUserFacade.java
  94. 46 18
      src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java
  95. 16 0
      src/main/java/com/diagbot/mapper/MedAppealExamineInfoMapper.java
  96. 16 0
      src/main/java/com/diagbot/mapper/MedAppealInfoMapper.java
  97. 37 0
      src/main/java/com/diagbot/mapper/MedClickInfoMapper.java
  98. 16 0
      src/main/java/com/diagbot/mapper/MedQcresultClickMapper.java
  99. 20 12
      src/main/java/com/diagbot/mapper/QcresultInfoMapper.java
  100. 0 0
      src/main/java/com/diagbot/mapper/SysUserMapper.java

+ 12 - 0
doc/034.20210804_2.0.5/qc_initv2.0.5.sql

@@ -0,0 +1,12 @@
+use `qc`;
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据编辑', '-1', 'YH-SJBJ', '1', '1', '11', '入院记录展示/编辑');
+SET @id =@@identity;
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1',@id, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1',@id, NULL);
+
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据编辑', 'FUNC000151', '/qc/dataEdit/getDataEdit', 'ALL', '数据编辑获取入院记录json数据', NULL);
+SET @it =@@identity;
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @id, @it, NULL, '数据编辑获取入院记录json数据');
+
+
+

+ 90 - 0
doc/036.20211015_2.1.1/qc_initv2.1.1.sql

@@ -0,0 +1,90 @@
+
+use `qc`;
+-- 执行前请看注意事项!
+-- 通用版均执行病历doctorId、doctorName回查 @hospitalId =**:需要更新的医院hospitalId在此调整即可
+-- med_behospital_info病历doctorName回查
+-- 最下面有仅湘雅三院医院的sql!!
+SET @hospitalId =35;
+ UPDATE med_behospital_info a,
+ (
+	SELECT
+		doctor_id,
+		name
+		NAME
+	FROM
+		bas_doctor_info b
+	WHERE
+		b.hospital_id = @hospitalId
+	AND b.is_deleted = 'N'
+) c
+SET a.doctor_name = c. NAME
+WHERE
+	a.doctor_id = c.doctor_id
+AND a.hospital_id = @hospitalId
+AND (a.doctor_name is null or a.doctor_name = '' or a.doctor_name ='-' or a.doctor_name ='—' or LENGTH(a.doctor_name)>64);
+
+-- med_behospital_info病历doctorId回查
+UPDATE med_behospital_info a,
+ (
+	SELECT
+		doctor_id,
+		NAME
+	FROM
+		bas_doctor_info b
+	WHERE
+		b.hospital_id = @hospitalId
+	AND b.is_deleted = 'N'
+	GROUP BY
+		b. NAME
+	HAVING
+		count(b.doctor_id) = 1
+) c
+SET a.doctor_id = c.doctor_id
+WHERE
+	a.doctor_name = c.NAME
+AND a.hospital_id = @hospitalId
+AND (a.doctor_id is null or a.doctor_id = '' or a.doctor_id ='-' or a.doctor_id ='—' or LENGTH(a.doctor_id)>64);
+
+
+
+-- 仅仅湘雅三院医院执行!!
+-- 全院
+update sys_menu a set a.order_no = a.order_no+1 where a.parent_id = 17 and a.order_no>0;
+
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医师病案首页合格率占比', '17', 'YH-ZKK-BASYHGLYSZB_XQ', '1', '1', '1', '医师病案首页合格率占比');
+SET @id =@@identity;
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @id, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '2021-11-01 13:48:37', '2021-11-01 13:48:37', '243', '243', '1', @id, NULL);
+
+
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医师病案首页合格率占比报表', '', '/console/homePageLevelStatisticsXY', 'ALL', '医师病案首页合格率占比报表', NULL);
+SET @id2 =@@identity;
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @id2, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '2021-11-01 13:48:37', '2021-11-01 13:48:37', '243', '243', '1', @id2, NULL);
+
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`)
+ VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @id, @id2, NULL, '医师病案首页合格率占比');
+
+
+-- 科室
+update sys_menu a set a.order_no = a.order_no+1 where a.parent_id = 18 and a.order_no>1;
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医师病案首页合格率占比', '18', 'YH-KSZR-BASYHGLYSZB_XQ', '1', '1', '2', '医师病案首页合格率占比-科室');
+SET @id3 =@@identity;
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @id3, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '2021-10-27 11:39:27', '2021-10-27 11:39:27', '13', '13', '2', @id3, NULL);
+
+
+INSERT INTO `sys_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '医师病案首页合格率占比报表', '', '/consoleByDept/homePageLevelStatisticsXYByDept', 'ALL', '医师病案首页合格率占比报表', NULL);
+SET @id4 =@@identity;
+
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @id4, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '2021-10-27 11:39:27', '2021-10-27 11:39:27', '13', '13', '2', @id4, NULL);
+
+
+INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @id3, @id4, NULL, '医师病案首页合格率占比科室');
+
+
+
+

+ 174 - 0
doc/037.20211117_2.1.4/qc_initv2.1.4.sql

@@ -0,0 +1,174 @@
+
+use `qc`;
+-- 执行前请看注意事项!
+-- 此脚本为通版脚本,均执行病历doctorId、doctorName回查 @hospitalId =**:需要更新的医院hospitalId在下面调整即可SET @hospitalId =**
+
+-- 如果其它医院不使用此次版本的数据分析报表,则需要手动到关闭数据分析报表
+SET @hospitalId =35;
+ UPDATE med_behospital_info a,
+ (
+	SELECT
+		doctor_id,
+		name
+		NAME
+	FROM
+		bas_doctor_info b
+	WHERE
+		b.hospital_id = @hospitalId
+	AND b.is_deleted = 'N'
+) c
+SET a.doctor_name = c. NAME
+WHERE
+	a.doctor_id = c.doctor_id
+AND a.hospital_id = @hospitalId
+AND (a.doctor_name is null or a.doctor_name = '' or a.doctor_name ='-' or a.doctor_name ='—' or LENGTH(a.doctor_name)>64);
+
+-- med_behospital_info病历doctorId回查
+UPDATE med_behospital_info a,
+ (
+	SELECT
+		doctor_id,
+		NAME
+	FROM
+		bas_doctor_info b
+	WHERE
+		b.hospital_id = @hospitalId
+	AND b.is_deleted = 'N'
+	GROUP BY
+		b. NAME
+	HAVING
+		count(b.doctor_id) = 1
+) c
+SET a.doctor_id = c.doctor_id
+WHERE
+	a.doctor_name = c.NAME
+AND a.hospital_id = @hospitalId
+AND (a.doctor_id is null or a.doctor_id = '' or a.doctor_id ='-' or a.doctor_id ='—' or LENGTH(a.doctor_id)>64);
+
+
+-- 对空数据初始化
+UPDATE med_behospital_info a set a.doctor_name = '-' where (a.doctor_name is null or a.doctor_name = '') AND a.hospital_id = @hospitalId;
+UPDATE med_behospital_info a set a.doctor_id = '-' where (a.doctor_id is null or a.doctor_id = '') AND a.hospital_id = @hospitalId;
+
+
+DROP TABLE IF EXISTS `med_click_info`;
+CREATE TABLE `med_click_info` (
+  `id` int(20) NOT NULL AUTO_INCREMENT,
+  `hospital_id` tinyint(5) DEFAULT '0' COMMENT '医院ID',
+  `dept_id` varchar(16) DEFAULT NULL COMMENT '科室ID',
+  `dept_name` varchar(64) DEFAULT NULL COMMENT '科室名称',
+  `doctor_id` varchar(16) DEFAULT NULL COMMENT '医生ID',
+  `doctor_name` varchar(64) DEFAULT NULL COMMENT '医生姓名',
+  `opt_type` tinyint(1) DEFAULT '1' COMMENT '0-单模块质控 1-全病历质控',
+  `qcresult_info_id` int(16) DEFAULT NULL COMMENT '评分结果id',
+  `behospital_code` varchar(16) DEFAULT NULL COMMENT '病人住院ID',
+  `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime DEFAULT '1970-01-01 12:00:00' COMMENT ' 记录创建时间',
+  `gmt_modified` datetime DEFAULT '1970-01-01 12:00:00' COMMENT ' 记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  PRIMARY KEY (`id`),
+  KEY `idx_all` (`hospital_id`,`behospital_code`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=62313 DEFAULT CHARSET=utf8 COMMENT='临床医生点击质控病历次数基本表';
+
+DROP TABLE IF EXISTS `med_qcresult_click`;
+CREATE TABLE `med_qcresult_click` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT,
+  `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
+  `behospital_code` varchar(16) NOT NULL COMMENT '病人住院ID',
+  `dept_id` varchar(16) DEFAULT NULL COMMENT '住院科室ID',
+  `dept_name` varchar(64) DEFAULT NULL COMMENT '住院科室名称',
+  `qcresult_info_id` bigint(20) NOT NULL COMMENT '评分结果id',
+  `cases_entry_ids` varchar(1024) DEFAULT '0' COMMENT '触发埋点病历质控缺陷id集',
+  `is_deleted` char(3) DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime DEFAULT '1970-01-01 12:00:00' COMMENT ' 记录创建时间',
+  PRIMARY KEY (`id`),
+  KEY `idx_all` (`hospital_id`,`behospital_code`)
+) ENGINE=InnoDB AUTO_INCREMENT=8587 DEFAULT CHARSET=utf8 COMMENT='全病历质控、单模块质控(触发埋点)缺陷详情';
+
+
+
+/**
+med_qcresult_detail表新增评分结果主表id字段
+ */
+ALTER TABLE `med_qcresult_detail` ADD COLUMN qcresult_info_id BIGINT (20) DEFAULT NULL COMMENT '评分结果id' AFTER `behospital_code`;
+
+/**
+med_qcresult_cases表新增评分结果主表id字段
+ */
+ALTER TABLE `med_qcresult_cases` ADD COLUMN qcresult_info_id BIGINT (20) DEFAULT NULL COMMENT '评分结果id' AFTER `behospital_code`;
+
+-- 全院
+SET @id =69;
+INSERT INTO `sys_menu` ( `id`,`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES (@id,'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据分析', '-1', 'YH-SJFX', '1', '1', '12', '用户-数据分析');
+
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '临床质控使用统计', @id , 'YH-ZKK-LCZKSYTJ', '1', '1', '1', '用户-质控科-临床质控使用统计');
+SET @idSec =@@identity;
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计', @id , 'YH-ZKK-TMQXGSTJ', '1', '1', '2', '用户-质控科-条目缺陷改善统计');
+SET @idThr =@@identity;
+
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @id, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @id, NULL);
+
+
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idSec, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idSec, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idThr, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idThr, NULL);
+
+
+
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '临床质控使用统计', '', '/qc/analysis/getQcClick', 'ALL', '临床质控使用统计', NULL);
+SET @idperFir =@@identity;
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '临床质控使用统计(内页)', '', '/qc/analysis/getQcClickInnerPage', 'ALL', '临床质控使用统计(内页)', NULL);
+SET @idperSec =@@identity;
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计', '', '/qc/analysis/getEntryDefectImprove', 'ALL', '条目缺陷改善统计', NULL);
+SET @idperThr =@@identity;
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计(内页)', '', '/qc/analysis/getEntryDefectImproveInner', 'ALL', '条目缺陷改善统计(内页)-病历列表', NULL);
+SET @idperFou =@@identity;
+
+
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperFir, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperSec, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperThr, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperFou, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idperFir, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idperSec, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idperThr, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', @idperFou, NULL);
+
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idSec, @idperFir, NULL, '临床质控使用统计');
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idSec, @idperSec, NULL, '临床质控使用统计(内页)');
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idThr, @idperThr, NULL, '条目缺陷改善统计');
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idThr, @idperFou, NULL, '条目缺陷改善统计(内页)');
+
+
+-- 科室
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '数据分析(科室)', '-1', 'YH-SJFXKS', '1', '1', '13', '用户-数据分析(科室)');
+SET @idks =@@identity;
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计', @idks , 'YH-KSZR-TMQXGSTJ', '1', '1', '2', '用户-质控科-条目缺陷改善统计(科室)');
+SET @idksThr =@@identity;
+
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idks, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', @idks, NULL);
+
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idksThr, NULL);
+INSERT INTO `sys_role_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `menu_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', @idksThr, NULL);
+
+
+
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计', '', '/qc/analysisDept/getEntryDefectImproveDept', 'ALL', '条目缺陷改善统计-科室', NULL);
+SET @idperFiv =@@identity;
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '条目缺陷改善统计(内页)', '', '/qc/analysisDept/getEntryDefectImproveInnerDept', 'ALL', '条目缺陷改善统计(内页)-科室', NULL);
+SET @idperSix =@@identity;
+
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperFiv, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', @idperSix, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', @idperFiv, NULL);
+INSERT INTO `sys_role_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `role_id`, `permission_id`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', @idperSix, NULL);
+
+
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idksThr, @idperFiv, NULL, '条目缺陷改善统计');
+-- INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idksThr, @idperSix, NULL, '条目缺陷改善统计(内页)');

+ 9 - 0
doc/038.20211129_2.1.3/qc_initv2.1.3.sql

@@ -0,0 +1,9 @@
+
+use `qc`;
+-- 执行前请看注意事项!
+-- 通用版本token有效时间配置化
+/**
+sys_dictionary_info表新增token时间配置
+ */
+INSERT INTO `sys_dictionary_info` (`group_type`, `name`, `val`, `return_type`, `remark`) VALUES ('31', 'accessToken', '86400', '2', 'accessToken有效期(单位秒)');
+INSERT INTO `sys_dictionary_info` (`group_type`, `name`, `val`, `return_type`, `remark`) VALUES ('31', 'refreshToken', '604800', '2', 'refreshToken有效期(单位秒)');

File diff ditekan karena terlalu besar
+ 10 - 0
doc/040.20211228_2.1.5/qc_initv2.1.5.sql


+ 15 - 0
doc/041.20220113_v2.1.6_演示版_历史评分及操作日志/qc_initv2.1.6.sql

@@ -0,0 +1,15 @@
+
+use `qc`;
+-- 执行前请看注意事项!
+-- 执行后还需要给操作账号操作日志菜单权限
+-- 注意
+/**
+演示菜单添加操作日志
+ */
+
+INSERT INTO `sys_menu` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '操作日志', '-1', 'YH-CZRZ', '1', '1', '11', '用户-操作日志');
+SET @idMenu =@@identity;
+
+INSERT INTO `sys_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '操作日志', '', '/qc/behospitalInfo/operationLog', 'ALL', '操作日志', '用户-操作日志');
+SET @idPermission =@@identity;
+INSERT INTO `sys_menu_permission` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @idMenu, @idPermission, NULL, '用户-操作日志');

+ 215 - 0
doc/041.20220118_v2.2.0_通用版_申诉驳回/qc_init_v2.2.0_通用版_申诉驳回.sql

@@ -0,0 +1,215 @@
+
+use `qc`;
+-- 执行前请看注意事项!
+-- 申诉驳回相关配置
+-- 注意
+
+
+ALTER TABLE med_qcresult_detail MODIFY COLUMN explain_info varchar(1500) DEFAULT NULL COMMENT '解释说明';
+
+/**
+med_appeal_info 申诉记录表
+ */
+DROP TABLE IF EXISTS `med_appeal_info`;
+CREATE TABLE `med_appeal_info` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
+  `behospital_code` varchar(16) NOT NULL COMMENT '病人住院ID',
+  `qcresult_detail_id` bigint(20) DEFAULT NULL COMMENT '质控缺陷id',
+  `qcresult_detail_msg` varchar(255) DEFAULT NULL COMMENT '缺陷详情',
+  `qcresult_detai_value` decimal(5,1) DEFAULT NULL COMMENT '缺陷扣分分值',
+  `cases_score` decimal(5,1) DEFAULT NULL COMMENT '模块总分',
+  `is_reject` int(3) DEFAULT '0' COMMENT '单项否决(1-单项否决 0-非)',
+  `cases_entry_id` bigint(20) DEFAULT NULL COMMENT '条目ID',
+  `cases_entry_name` varchar(255) DEFAULT NULL COMMENT '质控条目(新增已有操作才有值)',
+  `cases_entry_msg` varchar(255) DEFAULT NULL COMMENT '提示信息(新增已有操作才有值)',
+  `value` decimal(5,1) DEFAULT NULL COMMENT '分值(新增已有操作才有值)',
+  `mode_id` bigint(20) DEFAULT NULL COMMENT '模块id',
+  `mode_name` varchar(60) DEFAULT NULL COMMENT '模块名称',
+  `defect_content` longtext COMMENT '病历内容',
+  `claimant_id` bigint(20) NOT NULL COMMENT '申诉人id',
+  `appeal_type` char(3) NOT NULL COMMENT '申诉类型(0:医生申诉|1:质控申诉)',
+  `appeal_operation_type` char(3) NOT NULL COMMENT '申诉操作类型(0:删改|1:新增已有|2:新增缺失|3:恢复)',
+  `appeal_explain` varchar(1500) DEFAULT NULL COMMENT '申诉说明',
+  `check_id` bigint(20) NOT NULL COMMENT '审核人id',
+  `work_flow_node_id` bigint(20) NOT NULL COMMENT '当前工作流节点id',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(60) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(60) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='申诉记录表';
+
+/**
+med_appeal_examine_info 申诉审批表
+ */
+DROP TABLE IF EXISTS `med_appeal_examine_info`;
+CREATE TABLE `med_appeal_examine_info` (
+  `id` bigint(11) NOT NULL AUTO_INCREMENT COMMENT '申诉审批id',
+  `appeal_info_id` bigint(11) NOT NULL COMMENT '申诉id',
+  `check_id` bigint(20) NOT NULL COMMENT '审核人id',
+  `example_status` char(1) DEFAULT '0' COMMENT '审核状态:0:待审核|1:驳回|2:通过',
+  `example_operation` char(1) DEFAULT NULL COMMENT '审核处理方式: 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复',
+  `value` decimal(5,1) DEFAULT NULL COMMENT '审核分值',
+  `process_result` varchar(1500) DEFAULT NULL COMMENT '处理结果',
+  `reject_reason` varchar(1500) DEFAULT NULL COMMENT '驳回理由',
+  `msg` varchar(255) DEFAULT '' COMMENT '提示信息',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `remark` varchar(1500) NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='申诉审批表';
+
+
+/**
+med_work_flow_info 流程表
+ */
+DROP TABLE IF EXISTS `med_work_flow_info`;
+CREATE TABLE `med_work_flow_info` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `hospital_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '医院ID',
+  `work_flow_name` varchar(60) NOT NULL COMMENT '流程名称',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='流程表';
+
+SET @hospitalid ='35';
+INSERT INTO `med_work_flow_info` (`hospital_id`, `work_flow_name`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES ( @hospitalid, '湘雅申诉审核流程', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+
+/**
+med_work_flow_link 流程线表
+ */
+DROP TABLE IF EXISTS `med_work_flow_link`;
+CREATE TABLE `med_work_flow_link` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `work_flow_id` bigint(20) NOT NULL COMMENT '流程id',
+  `work_flow_link_id` bigint(20) NOT NULL COMMENT '工作流id',
+  `work_link_now_node` bigint(20) NOT NULL COMMENT '当前节点id',
+  `work_link_condition` varchar(60) DEFAULT NULL COMMENT '流程条件(流程线分叉,下一结点判断条件)',
+  `work_link_next_node` bigint(20) NOT NULL COMMENT '下一节点id 0:表示结束',
+  `work_link_name` varchar(60) NOT NULL COMMENT '流程线内容',
+  `work_link_status` varchar(60) NOT NULL COMMENT '工作流状态',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='流程线表';
+
+set @workflowid:= (SELECT id FROM `med_work_flow_info` where `work_flow_name`='湘雅申诉审核流程' and `hospital_id`= @hospitalid );
+INSERT INTO `med_work_flow_link` (`work_flow_id`, `work_flow_link_id`, `work_link_now_node`, `work_link_condition`, `work_link_next_node`, `work_link_name`, `work_link_status`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '1', '0', NULL, '1', '申诉人员向审核员发起申诉', '申诉', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+INSERT INTO `med_work_flow_link` (`work_flow_id`, `work_flow_link_id`, `work_link_now_node`, `work_link_condition`, `work_link_next_node`, `work_link_name`, `work_link_status`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '2', '1', NULL, '2', '申诉人员撤回申诉', '申诉', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+INSERT INTO `med_work_flow_link` (`work_flow_id`, `work_flow_link_id`, `work_link_now_node`, `work_link_condition`, `work_link_next_node`, `work_link_name`, `work_link_status`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '3', '1', NULL, '3', '科室审核员审核', '审核', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+
+
+/**
+med_work_flow_node 流程节点表
+ */
+DROP TABLE IF EXISTS `med_work_flow_node`;
+CREATE TABLE `med_work_flow_node` (
+  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `work_flow_id` bigint(20) NOT NULL COMMENT '流程id',
+  `work_flow_node_id` bigint(20) NOT NULL COMMENT '工作节点id',
+  `work_node_name` varchar(60) NOT NULL COMMENT '节点名称',
+  `is_deleted` char(1) NOT NULL DEFAULT 'N' COMMENT '是否删除,N:未删除,Y:删除',
+  `gmt_create` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录创建时间',
+  `gmt_modified` datetime NOT NULL DEFAULT '1970-01-01 12:00:00' COMMENT '记录修改时间,如果时间是1970年则表示纪录未修改',
+  `creator` varchar(20) NOT NULL DEFAULT '0' COMMENT '创建人,0表示无创建人值',
+  `modifier` varchar(20) NOT NULL DEFAULT '0' COMMENT '修改人,如果为0则表示纪录未修改',
+  `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='流程节点表';
+
+INSERT INTO `med_work_flow_node` (`work_flow_id`,`work_flow_node_id`, `work_node_name`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '1', '申诉', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+INSERT INTO `med_work_flow_node` (`work_flow_id`,`work_flow_node_id`, `work_node_name`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '2', '撤销申诉', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+INSERT INTO `med_work_flow_node` (`work_flow_id`,`work_flow_node_id`, `work_node_name`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `remark`) VALUES (@workflowid, '3', '科室审核', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '');
+
+
+/**
+sys_dictionary_info 系统字典表
+ */
+
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '32', '0', '删改条目', '2', '0', '操作类型');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '32', '1', '新增已有条目', '2', '0', '操作类型');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '32', '2', '新增缺失条目', '2', '0', '操作类型');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '32', '3', '恢复条目', '2', '0', '操作类型');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '0', '待审核', '2', '0', '状态');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '1', '已驳回', '2', '0', '状态');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '33', '2', '审核通过', '2', '0', '状态');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '34', '申诉驳回', '32,33,35', '2', '0', '申诉驳回状态登字典数据总览');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '1', '修改', '2', '0', '审核处理方式');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '2', '删除', '2', '0', '审核处理方式');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '3', '新增已有', '2', '0', '审核处理方式');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '4', '新增缺失', '2', '0', '审核处理方式');
+INSERT INTO `sys_dictionary_info` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '35', '5', '恢复', '2', '0', '审核处理方式');
+
+
+/**
+sys_hospital_set 系统配置表
+ */
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '医院是否开启申诉功能', 'appeal_flag', 'true', '医院是否开启申诉功能');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '审核人是否可以是自己开关', 'self_flag', 'false', '审核人是否可以是自己开关');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '核查按钮是否关联申诉流程', 'check_appeal_relation', 'true', '核查按钮是否关联申诉流程');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '核查操作是否与申诉状态关联配置', 'check_operation_with_appeal', 'true', '核查操作是否与申诉状态关联配置');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '工作流节点-操作接口映射关系', 'work_flow_node_mapping', '{\"addAppealInfo\":1,\"cancelAppealInfo\":2,\"approved\":3,\"rejected\":3}', '工作流节点-操作接口映射关系');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '医院是否开启申诉功能', 'appeal_flag', 'true', '医院是否开启申诉功能');
+INSERT INTO `sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @hospitalid, '单人申诉', 'single_appeal_falg', 'true', '单人申诉开关');
+
+
+/**
+sys_role 系统角色表
+ */
+INSERT INTO `sys_role` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `roleLevel`, `descritpion`, `menuItems`, `remark`) VALUES ('10', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '申诉审核员', '0', '', '', NULL);
+
+/**
+sys_menu 菜单表
+ */
+INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('100', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '申诉信息', '-1', 'YH-SSXX', '1', '1', '14', '用户-申诉信息');
+INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('101', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '申诉记录', '100', 'YH-SSXX-SSJL', '1', '1', '1', '用户-申诉信息-申诉记录');
+INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('102', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '申诉审核', '100', 'YH-SSXX-SSSH', '1', '1', '2', '用户-申诉信息-申诉审核');
+INSERT INTO `sys_menu` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `parent_id`, `code`, `show_status`, `maintain_status`, `order_no`, `remark`) VALUES ('103', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '申诉发起', '100', 'YH-SSXX-SSFQ', '1', '1', '3', '用户-申诉信息-申诉发起');
+
+
+/**
+sys_permission 系统资源表
+ */
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('166', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '查看', 'FUNC000166', '/qc/appealInfo/getAppealInfo', 'ALL', '查看', '用户-申诉信息-申诉记录-查看');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('167', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '撤回', 'FUNC000167', '/qc/appealInfo/cancelAppealInfo', 'ALL', '撤回', '用户-申诉信息-申诉记录-撤回');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('168', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '再次申诉', 'FUNC000168', '/qc/appealInfo/addAppealInfo', 'ALL', '再次申诉', '用户-申诉信息-申诉记录-再次申诉');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('169', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '查看', 'FUNC000169', '/qc/appealExamineInfo/getApprovedView', 'ALL', '查看', '用户-申诉信息-申诉审核-查看');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('170', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '缺陷申诉', 'FUNC000170', '/qc/appealInfo/addAppealInfo', 'ALL', '缺陷申诉', '用户-申诉信息-申诉发起-缺陷申诉');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('171', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '新增缺陷申', 'FUNC000171', '/qc/appealInfo/addAppealInfo', 'ALL', '新增缺陷申', '用户-申诉信息-申诉发起-新增缺陷申诉');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('172', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '撤回申诉', 'FUNC000172', '/qc/appealInfo/cancelAppealInfo', 'ALL', '撤回申诉', '用户-申诉信息-申诉发起-撤回申诉');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('173', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '审核通过', 'FUNC000173', '/qc/appealExamineInfo/approved', 'ALL', '\r\n审核通过', '用户-申诉信息-申诉审核-审核通过');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('174', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '驳回', 'FUNC000174', '/qc/appealExamineInfo/rejected', 'ALL', '驳回', '用户-申诉信息-申诉审核-驳回');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('175', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '病案详情查看', 'FUNC000014', '/qc/behospitalInfo/getByBehospitalCode', 'ALL', '用户-申诉信息-申诉记录-病案详情查看', '无需加密');
+INSERT INTO `sys_permission` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `name`, `code`, `permissionUrl`, `method`, `descritpion`, `remark`) VALUES ('176', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '病案详情查看', 'FUNC000014', '/qc/behospitalInfo/getByBehospitalCode', 'ALL', '用户-申诉信息-申诉审核-病案详情查看', '无需加密');
+
+
+/**
+sys_menu_permission 系统资源表
+ */
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '101', '166', NULL, '用户-申诉信息-申诉记录-查看');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '101', '167', NULL, '用户-申诉信息-申诉记录-撤回');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '101', '168', NULL, '用户-申诉信息-申诉记录-再次申诉');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '101', '166', NULL, '用户-申诉信息-申诉审核-查看');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '103', '170', NULL, '用户-申诉信息-申诉发起-缺陷申诉');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '103', '171', NULL, '用户-申诉信息-申诉发起-新增缺陷申诉');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '103', '172', NULL, '用户-申诉信息-申诉发起-撤回申诉');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '102', '173', NULL, '用户-申诉信息-申诉审核-审核通过');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '102', '174', NULL, '用户-申诉信息-申诉审核-驳回');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '102', '169', NULL, '用户-申诉信息-申诉审核-查看');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '101', '175', NULL, '用户-申诉信息-申诉记录-病案详情查看');
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `order_nu`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '102', '176', NULL, '用户-申诉信息-申诉审核-病案详情查看');

+ 33 - 0
doc/042.20220303病案首页字段新增/qc_initv2.1.5.sql

@@ -0,0 +1,33 @@
+use `qc`;
+
+-- 最先执行字段添加
+
+  ALTER TABLE `med_home_page` ADD  `treatment_type` varchar(2) DEFAULT NULL COMMENT '治疗类别(1.中医<1.1 中医;1.2 民族医>、2.中西医、3.西医 )'AFTER `behospital_day_num`;
+  ALTER TABLE `med_home_page` ADD `outpatient_emr_ch_diagnose` varchar(64) DEFAULT NULL COMMENT '门急诊诊断(中医)'AFTER `outpatient_emr_diagnose`;
+  ALTER TABLE `med_home_page` ADD  `outpatient_emr_ch_diagnose_code` varchar(64) DEFAULT NULL COMMENT '门急诊诊断编码(中医)'AFTER `outpatient_emr_diagnose_code`;
+  ALTER TABLE `med_home_page` ADD  `implementation_clinical_pathway` varchar(2) DEFAULT NULL COMMENT '实施临床路径(1中医、2西医、3否)'AFTER `outpatient_emr_ch_diagnose_code`;
+  ALTER TABLE `med_home_page` ADD  `is_chinese_medicine_preparation` varchar(2) DEFAULT NULL COMMENT '使用医疗机构中药制剂(1是、2否)'AFTER `implementation_clinical_pathway`;
+  ALTER TABLE `med_home_page` ADD  `is_chinese_diagnose_equipment` varchar(2) DEFAULT NULL COMMENT '使用中医诊疗设备(1是、2否)	'AFTER `is_chinese_medicine_preparation`;
+  ALTER TABLE `med_home_page` ADD  `is_chinese_diagnose_technology` varchar(2) DEFAULT NULL COMMENT '使用中医诊疗技术(1是 、2否)	'AFTER `is_chinese_diagnose_equipment`;
+  ALTER TABLE `med_home_page` ADD  `dialectical_nursing` varchar(2) DEFAULT NULL COMMENT '辩证施护(1是、2否)'AFTER `is_chinese_diagnose_technology`;
+
+
+
+  ALTER TABLE `med_home_diagnose_info` ADD  `chinese_western_type` varchar(2) DEFAULT '0' COMMENT '中西医类别(0 西医 1中医)'AFTER `hospital_id`;
+
+
+
+
+ -- ALTER TABLE `med_behospital_info` ADD `in_state` varchar(20) DEFAULT NULL COMMENT 'R-住院登记I-病房接诊B-出院登记O-出院结算P-预约出院N-无费退院'AFTER `placefile_date`;
+
+
+
+
+
+
+
+
+
+
+
+

+ 8 - 0
doc/044.20220311v2.2.1/qc_initv2.2.1.sql

@@ -0,0 +1,8 @@
+use `qc`;
+
+UPDATE `qc_mode` SET `name`='其他信息' WHERE (`name`='其他');
+
+
+
+
+

+ 17 - 2
pom.xml

@@ -36,9 +36,11 @@
         <aggregator.version>1.1.0</aggregator.version>
         <okhttp.version>4.2.2</okhttp.version>
         <easypoi.version>4.2.0</easypoi.version>
+        <patchca.version>1.1.2</patchca.version>
+        <hutool.version>5.0.7</hutool.version>
         <docker-maven-plugin.version>1.2.1</docker-maven-plugin.version>
-        <docker.image.prefix>192.168.2.236:5000/diagbotcloud</docker.image.prefix>
-        <registryUrl>http://192.168.2.236:5000/repository/diagbotcloud/</registryUrl>
+        <docker.image.prefix>192.168.2.122:5000/diagbotcloud</docker.image.prefix>
+        <registryUrl>http://192.168.2.122:5000/repository/diagbotcloud/</registryUrl>
     </properties>
 
     <dependencyManagement>
@@ -108,6 +110,19 @@
             <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.bladejava</groupId>
+            <artifactId>blade-patchca</artifactId>
+            <version>${patchca.version}</version>
+
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>${hutool.version}</version>
+        </dependency>
+
         <!--swagger-->
         <dependency>
             <groupId>io.springfox</groupId>

+ 129 - 0
src/main/java/com/diagbot/aggregate/LeaveHosCountByDeptAggregate.java

@@ -0,0 +1,129 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.dto.DeptBaseDTO;
+import com.diagbot.dto.NumDTO;
+import com.diagbot.facade.BasDeptInfoFacade;
+import com.diagbot.facade.BehospitalInfoFacade;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.FilterVO;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2020/7/15 16:03
+ */
+@Component
+public class LeaveHosCountByDeptAggregate {
+    @Autowired
+    private BehospitalInfoFacade behospitalInfoFacade;
+    @Autowired
+    private BasDeptInfoFacade basDeptInfoFacade;
+
+    @DataProvider("setAllLeaveHosCount")
+    public Map<String, Object> setAllLeaveHosCount(
+            @InvokeParameter("filterVO") FilterVO filterVO,
+            @DataConsumer("leaveHosCountByDept") List<NumDTO> totleNumList,
+            @DataConsumer("deathCountByDept") List<NumDTO> deathNumList,
+            @DataConsumer("operationCountByDept") List<NumDTO> operationNumList) {
+        Map<String, Object> retMap = new LinkedHashMap<>();
+        //关联科室
+        Map<String, Object> deptMap = getDeptByUser(filterVO);
+        if (deptMap == null) {
+            return retMap;
+        }
+        Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
+                ? new HashMap<>()
+                : EntityUtil.makeEntityMap(totleNumList, "name");
+
+        Map<String, NumDTO> deathMap = new HashMap<>();
+        Map<String, NumDTO> operationMap = new HashMap<>();
+        deathMap = ListUtil.isEmpty(deathNumList)
+                ? new HashMap<>()
+                : EntityUtil.makeEntityMap(deathNumList, "name");
+        operationMap = ListUtil.isEmpty(operationNumList)
+                ? new HashMap<>()
+                : EntityUtil.makeEntityMap(operationNumList, "name");
+
+
+        for (String deptName : deptMap.keySet()) {
+            Map<String, Object> map = new LinkedHashMap<>();
+            map.put("总人数", 0);
+            map.put("死亡人数", 0);
+            map.put("手术病人数", 0);
+            if (totleMap.containsKey(deptName)) {
+                map.put("总人数", totleMap.get(deptName).getNum());
+            }
+            if (deathMap.containsKey(deptName)) {
+                map.put("死亡人数", deathMap.get(deptName).getNum());
+            }
+            if (operationMap.containsKey(deptName)) {
+                map.put("手术病人数", operationMap.get(deptName).getNum());
+            }
+            retMap.put(deptName, map);
+        }
+        return retMap;
+    }
+
+    /**
+     * 出院总人数
+     *
+     * @param filterVO
+     * @return
+     */
+    @DataProvider("leaveHosCountByDept")
+    public List<NumDTO> leaveHosCountByDept(@InvokeParameter("filterVO") FilterVO filterVO) {
+        List<NumDTO> numDTOS = behospitalInfoFacade.leaveHosCountByDept(filterVO);
+        return numDTOS;
+    }
+
+    /**
+     * 死亡人数
+     *
+     * @param filterVO
+     * @return
+     */
+    @DataProvider("deathCountByDept")
+    public List<NumDTO> deathCountByDept(@InvokeParameter("filterVO") FilterVO filterVO) {
+        List<NumDTO> numDTOS = behospitalInfoFacade.deathCountByDept(filterVO);
+        return numDTOS;
+
+    }
+
+    /**
+     * 手术人数
+     *
+     * @param filterVO
+     * @return
+     */
+    @DataProvider("operationCountByDept")
+    public List<NumDTO> operationCountByDept(@InvokeParameter("filterVO") FilterVO filterVO) {
+        List<NumDTO> numDTOS = behospitalInfoFacade.operationCountByDept(filterVO);
+        return numDTOS;
+    }
+
+    /**
+     * 用户关联科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public Map<String, Object> getDeptByUser(FilterVO filterVO) {
+        List<DeptBaseDTO> deptList = basDeptInfoFacade.getDeptByUser(filterVO);
+        if (ListUtil.isNotEmpty(deptList)) {
+            return EntityUtil.makeMapWithKeyValue(deptList, "deptName", "deptId");
+        } else {
+            return null;
+        }
+    }
+}

+ 91 - 0
src/main/java/com/diagbot/client/MedAppealExamineInfoServiceClient.java

@@ -0,0 +1,91 @@
+package com.diagbot.client;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.hystrix.MedAppealExamineInfoServiceHystrix;
+import com.diagbot.dto.CommonResult;
+import com.diagbot.dto.GetAppealInfoDTO;
+import com.diagbot.dto.GetAppealReviewDTO;
+import com.diagbot.dto.GetComplaintRecordDTO;
+import com.diagbot.entity.QcresultDetail;
+import com.diagbot.vo.ApprovedVo;
+import com.diagbot.vo.GetAppealInfoVO;
+import com.diagbot.vo.GetAppealReviewVO;
+import com.diagbot.vo.GetAuditNumberVO;
+import com.diagbot.vo.GetComplaintDetailMsgVO;
+import com.diagbot.vo.GetComplaintRecordVO;
+import com.diagbot.vo.RejectedVo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+
+/**
+ * @description: 申诉功能远程调用
+ * @author: zhoutg
+ * @date: 2020/4/13 18:28
+ */
+@FeignClient(name = "gateway-service", url = "${appeal.address}", fallback = MedAppealExamineInfoServiceHystrix.class)
+public interface MedAppealExamineInfoServiceClient {
+    /**
+     * 获取申诉记录
+     * @param getComplaintRecordVO
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/getComplaintRecord")
+    CommonResult<Page<GetComplaintRecordDTO>> getComplaintRecord(@RequestBody GetComplaintRecordVO getComplaintRecordVO);
+
+    /**
+     * 获取申诉审核列表
+     * @param getAppealReviewVO
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/getAppealReview")
+    CommonResult<Page<GetAppealReviewDTO>> getAppealReview(@RequestBody GetAppealReviewVO getAppealReviewVO);
+
+
+    /**
+     *审核通过
+     * @param approvedVo
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/approved")
+    CommonResult<Boolean> approved(@RequestBody ApprovedVo approvedVo);
+
+    /**
+     *驳回
+     * @param rejectedVo
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/rejected")
+    CommonResult<Boolean> rejected(@RequestBody RejectedVo rejectedVo);
+
+    /**
+     *审核查看
+     * @param getAppealInfoVO
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/getApprovedView")
+    CommonResult<GetAppealInfoDTO> getApprovedView(@RequestBody GetAppealInfoVO getAppealInfoVO);
+
+    /**
+     *待审核数量
+     * @param getAuditNumberVO
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/getAuditNumber")
+    CommonResult<Integer> getAuditNumber(@RequestBody GetAuditNumberVO getAuditNumberVO);
+
+    /**
+     *获取该申诉记录最新缺陷详情
+     * @param getComplaintDetailMsgVO
+     * @return
+     */
+    @PostMapping(value = "/report-service/medAppealExamineInInfoManage/getComplaintDetailMsg")
+    CommonResult<QcresultDetail> getComplaintDetailMsg(@RequestBody GetComplaintDetailMsgVO getComplaintDetailMsgVO);
+
+
+}
+
+
+

+ 102 - 0
src/main/java/com/diagbot/client/MedAppealExamineInfoServiceClientFacade.java

@@ -0,0 +1,102 @@
+package com.diagbot.client;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.CommonResult;
+import com.diagbot.dto.GetAppealInfoDTO;
+import com.diagbot.dto.GetAppealReviewDTO;
+import com.diagbot.dto.GetComplaintRecordDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.QcresultDetail;
+import com.diagbot.vo.ApprovedVo;
+import com.diagbot.vo.GetAppealInfoVO;
+import com.diagbot.vo.GetAppealReviewVO;
+import com.diagbot.vo.GetAuditNumberVO;
+import com.diagbot.vo.GetComplaintDetailMsgVO;
+import com.diagbot.vo.GetComplaintRecordVO;
+import com.diagbot.vo.RejectedVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @description: 申诉功能远程调用后处理
+ * @author: zhoutg
+ * @date: 2020/4/13 18:28
+ */
+@Component
+public class MedAppealExamineInfoServiceClientFacade {
+
+    @Autowired
+    MedAppealExamineInfoServiceClient medAppealExamineInfoServiceClient;
+
+    /**
+     * 获取申诉记录
+     *
+     * @param getComplaintRecordVO
+     * @return
+     */
+    public RespDTO<Page<GetComplaintRecordDTO>> getComplaintRecord(GetComplaintRecordVO getComplaintRecordVO) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.getComplaintRecord(getComplaintRecordVO));
+    }
+
+    /**
+     * 获取申诉审核列表
+     *
+     * @param getAppealReviewVO
+     * @return
+     */
+    public RespDTO<Page<GetAppealReviewDTO>> getAppealReview(GetAppealReviewVO getAppealReviewVO) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.getAppealReview(getAppealReviewVO));
+    }
+
+
+    /**
+     * 审核通过
+     *
+     * @param approvedVo
+     * @return
+     */
+    public RespDTO<Boolean> approved(ApprovedVo approvedVo) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.approved(approvedVo));
+    }
+
+    /**
+     * 驳回
+     *
+     * @param rejectedVo
+     * @return
+     */
+    public RespDTO<Boolean> rejected(RejectedVo rejectedVo) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.rejected(rejectedVo));
+    }
+
+    /**
+     * 审核查看
+     *
+     * @param getAppealInfoVO
+     * @return
+     */
+    public RespDTO<GetAppealInfoDTO> getApprovedView(GetAppealInfoVO getAppealInfoVO) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.getApprovedView(getAppealInfoVO));
+    }
+
+    /**
+     * 待审核数量
+     *
+     * @param getAuditNumberVO
+     * @return
+     */
+    public RespDTO<Integer> getAuditNumber(GetAuditNumberVO getAuditNumberVO) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.getAuditNumber(getAuditNumberVO));
+    }
+
+    /**
+     * 获取该申诉记录最新缺陷详情
+     *
+     * @param getComplaintDetailMsgVO
+     * @return
+     */
+    public RespDTO<QcresultDetail> getComplaintDetailMsg(GetComplaintDetailMsgVO getComplaintDetailMsgVO) {
+        return CommonResult.tranResp(medAppealExamineInfoServiceClient.getComplaintDetailMsg(getComplaintDetailMsgVO));
+    }
+
+}

+ 48 - 0
src/main/java/com/diagbot/client/MedAppealInfoServiceClient.java

@@ -0,0 +1,48 @@
+package com.diagbot.client;
+
+import com.diagbot.client.hystrix.MedAppealInfoServiceHystrix;
+import com.diagbot.dto.*;
+import com.diagbot.vo.*;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.validation.Valid;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * @description: 申诉功能远程调用
+ * @author: zhoutg
+ * @date: 2020/4/13 18:28
+ */
+@FeignClient(name = "gateway-service", url = "${appeal.address}", fallback = MedAppealInfoServiceHystrix.class)
+public interface MedAppealInfoServiceClient {
+
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/addAppealInfo")
+    CommonResult<Boolean> addAppealInfo(@RequestBody @Valid AddAppealInfoVO addAppealInfoVO);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/getReviewer")
+    CommonResult<List<GetReviewerDTO>> getReviewer(@RequestBody GetReviewerVO getReviewerVO);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/getAppealOperationType")
+    CommonResult<Map<String, String>> getAppealOperationType(@RequestBody @Valid GetAppealOperationTypeVO getAppealOperationTypeVO);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/cancelAppealInfo")
+    CommonResult<Boolean> cancelAppealInfo(@RequestBody @Valid CancelAppealInfoVO cancelAppealInfoVO);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/getAppealInfo")
+    CommonResult<GetAppealInfoDTO> getAppealInfo(@RequestBody GetAppealInfoVO getAppealInfoVO);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/getAppealDept")
+    CommonResult<List<GetAppealDeptDTO>> getAppealDept(@RequestBody GetAppealDeptVo getAppealDeptVo);
+
+    @PostMapping(value = "/report-service/medAppealInfoManage/getAppealMode")
+    CommonResult<List<GetAppealModeDTO>> getAppealMode(@RequestBody GetAppealModeVo getAppealModeVo);
+
+}
+
+
+

+ 52 - 0
src/main/java/com/diagbot/client/MedAppealInfoServiceClientFacade.java

@@ -0,0 +1,52 @@
+package com.diagbot.client;
+
+import com.diagbot.dto.*;
+import com.diagbot.vo.*;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 申诉功能远程调用后处理
+ * @author: zhoutg
+ * @date: 2020/4/13 18:28
+ */
+@Component
+public class MedAppealInfoServiceClientFacade {
+
+    @Autowired
+    private MedAppealInfoServiceClient medAppealInfoServiceClient;
+
+    public RespDTO<Boolean> addAppealInfo(AddAppealInfoVO addAppealInfoVO) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.addAppealInfo(addAppealInfoVO));
+    }
+
+    public RespDTO<List<GetReviewerDTO>> getReviewer(GetReviewerVO getReviewerVO) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.getReviewer(getReviewerVO));
+    }
+
+    public RespDTO<Map<String, String>> getAppealOperationType(GetAppealOperationTypeVO getAppealOperationTypeVO) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.getAppealOperationType(getAppealOperationTypeVO));
+    }
+
+    public RespDTO<Boolean> cancelAppealInfo(CancelAppealInfoVO cancelAppealInfoVO) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.cancelAppealInfo(cancelAppealInfoVO));
+    }
+
+    public RespDTO<GetAppealInfoDTO> getAppealInfo(GetAppealInfoVO getAppealInfoVO) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.getAppealInfo(getAppealInfoVO));
+    }
+
+    public RespDTO<List<GetAppealDeptDTO>> getAppealDept(GetAppealDeptVo getAppealDeptVo) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.getAppealDept(getAppealDeptVo));
+    }
+
+
+    public RespDTO<List<GetAppealModeDTO>> getAppealMode(GetAppealModeVo getAppealModeVo) {
+        return CommonResult.tranResp(medAppealInfoServiceClient.getAppealMode(getAppealModeVo));
+    }
+
+}

+ 63 - 0
src/main/java/com/diagbot/client/hystrix/MedAppealExamineInfoServiceHystrix.java

@@ -0,0 +1,63 @@
+package com.diagbot.client.hystrix;
+
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.MedAppealExamineInfoServiceClient;
+import com.diagbot.dto.*;
+import com.diagbot.entity.QcresultDetail;
+import com.diagbot.vo.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestBody;
+/**
+ * @description: 申诉远程调用熔断器
+ * @author: zhoutg
+ * @date: 2020/4/13 18:23
+ */
+@Component
+@Slf4j
+public class MedAppealExamineInfoServiceHystrix implements MedAppealExamineInfoServiceClient {
+
+    @Override
+    public CommonResult<Page<GetComplaintRecordDTO>> getComplaintRecord(@RequestBody GetComplaintRecordVO getComplaintRecordVO) {
+        log.error("【hystrix】调用{}异常", "getComplaintRecord");
+        return null;
+    }
+
+    @Override
+    public CommonResult<Page<GetAppealReviewDTO>> getAppealReview(@RequestBody GetAppealReviewVO getAppealReviewVO) {
+        log.error("【hystrix】调用{}异常", "getAppealReview");
+        return null;
+    }
+
+
+    @Override
+    public CommonResult<Boolean> approved( @RequestBody ApprovedVo approvedVo) {
+        log.error("【hystrix】调用{}异常", "approved");
+        return null;
+    }
+
+    @Override
+    public CommonResult<Boolean> rejected( @RequestBody RejectedVo rejectedVo) {
+        log.error("【hystrix】调用{}异常", "rejected");
+        return null;
+    }
+    @Override
+    public CommonResult<GetAppealInfoDTO> getApprovedView( @RequestBody GetAppealInfoVO getAppealInfoVO) {
+        log.error("【hystrix】调用{}异常", "getApprovedView");
+        return null;
+    }
+    @Override
+    public CommonResult<Integer> getAuditNumber( @RequestBody GetAuditNumberVO getAuditNumberVO) {
+        log.error("【hystrix】调用{}异常", "getAuditNumberVO");
+        return null;
+    }
+
+    @Override
+    public CommonResult<QcresultDetail> getComplaintDetailMsg(@RequestBody GetComplaintDetailMsgVO getComplaintDetailMsgVO) {
+        log.error("【hystrix】调用{}异常", "getComplaintDetailMsg");
+        return null;
+    }
+
+}

+ 64 - 0
src/main/java/com/diagbot/client/hystrix/MedAppealInfoServiceHystrix.java

@@ -0,0 +1,64 @@
+package com.diagbot.client.hystrix;
+
+
+import com.diagbot.client.MedAppealInfoServiceClient;
+import com.diagbot.dto.*;
+import com.diagbot.vo.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.validation.Valid;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @description: 申诉远程调用熔断器
+ * @author: zhoutg
+ * @date: 2020/4/13 18:23
+ */
+@Component
+@Slf4j
+public class MedAppealInfoServiceHystrix implements MedAppealInfoServiceClient {
+
+    @Override
+    public CommonResult<Boolean> addAppealInfo(@Valid AddAppealInfoVO addAppealInfoVO) {
+        log.error("【hystrix】调用{}异常", "addAppealInfo");
+        return null;
+    }
+
+    @Override
+    public CommonResult<List<GetReviewerDTO>> getReviewer(GetReviewerVO getReviewerVO) {
+        log.error("【hystrix】调用{}异常", "getReviewer");
+        return null;
+    }
+
+    @Override
+    public CommonResult<Map<String, String>> getAppealOperationType(@Valid GetAppealOperationTypeVO getAppealOperationTypeVO) {
+        log.error("【hystrix】调用{}异常", "getAppealOperationType");
+        return null;
+    }
+
+    @Override
+    public CommonResult<Boolean> cancelAppealInfo(@Valid CancelAppealInfoVO cancelAppealInfoVO) {
+        log.error("【hystrix】调用{}异常", "cancelAppealInfo");
+        return null;
+    }
+
+    @Override
+    public CommonResult<GetAppealInfoDTO> getAppealInfo(GetAppealInfoVO getAppealInfoVO) {
+        log.error("【hystrix】调用{}异常", "getAppealInfo");
+        return null;
+    }
+
+    @Override
+    public CommonResult<List<GetAppealDeptDTO>> getAppealDept(@Valid GetAppealDeptVo getAppealDeptVo) {
+        log.error("【hystrix】调用{}异常", "getAppealDept");
+        return null;
+    }
+
+    @Override
+    public CommonResult<List<GetAppealModeDTO>> getAppealMode(GetAppealModeVo getAppealModeVo) {
+        log.error("【hystrix】调用{}异常", "getAppealMode");
+        return null;
+    }
+}

+ 37 - 0
src/main/java/com/diagbot/config/AccessDeniedExceptionPoint.java

@@ -0,0 +1,37 @@
+package com.diagbot.config;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.web.access.AccessDeniedHandler;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author songxl
+ * @Date 2021/11/30
+ */
+@Component
+public class AccessDeniedExceptionPoint implements AccessDeniedHandler {
+    @Override
+    public void handle(HttpServletRequest httpServletRequest, HttpServletResponse response, AccessDeniedException e) throws IOException, ServletException {
+        Map map = new HashMap();
+        //响应状态码统一为200
+        response.setStatus(HttpServletResponse.SC_OK);
+        map.put("code", "00000001");
+        map.put("msg","没有该权限");
+        response.setContentType("application/json");
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.writeValue(response.getOutputStream(), map);
+        } catch (Exception e1) {
+            throw new ServletException();
+        }
+    }
+}

+ 32 - 0
src/main/java/com/diagbot/config/AuthExceptionEntryPoint.java

@@ -0,0 +1,32 @@
+package com.diagbot.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.AuthenticationEntryPoint;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @Description:
+ * @Author songxl
+ * @Date 2021/11/30
+ */
+@Component
+public class AuthExceptionEntryPoint implements AuthenticationEntryPoint {
+    @Autowired
+    AuthenticationExceptionHandler authenticationExceptionHandler;
+
+    @Override
+    public void commence(HttpServletRequest request, HttpServletResponse response,
+                         AuthenticationException authException)
+            throws ServletException {
+        try {
+            authenticationExceptionHandler.handleException(request,response,authException);
+        } catch (Exception e) {
+            throw new ServletException();
+        }
+    }
+}

+ 90 - 0
src/main/java/com/diagbot/config/AuthenticationExceptionHandler.java

@@ -0,0 +1,90 @@
+package com.diagbot.config;
+
+
+import com.diagbot.facade.SysUserFacade;
+import com.diagbot.util.StringUtil;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.AccountExpiredException;
+import org.springframework.security.authentication.AccountStatusException;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.CredentialsExpiredException;
+import org.springframework.security.authentication.DisabledException;
+import org.springframework.security.authentication.InsufficientAuthenticationException;
+import org.springframework.security.authentication.LockedException;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.stereotype.Component;
+import org.springframework.validation.BindException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @Description:权限认证异常处理
+ * @Author songxl
+ * @Date 2021/12/13
+ */
+@Component
+public class AuthenticationExceptionHandler {
+    @Autowired
+    private SysUserFacade userFacade;
+
+    public void handleException(HttpServletRequest request, HttpServletResponse response,
+                                AuthenticationException authException) throws ServletException {
+        Map map = new HashMap();
+        //登录前的获取登录页面的请求接口不知道什么原因会抛出未认证(Full authentication is required to access this resource)
+        //如果抛出未认证在这个调用这个服务接口返回消息
+        //响应状态码统一为200
+        response.setStatus(HttpServletResponse.SC_OK);
+        if (matchers("/sys/user/getHospitalMark", request)) {
+            map.put("code", "0");
+            map.put("msg", "");
+            map.put("data", userFacade.getHospitalMark());
+        } else if (authException instanceof BadCredentialsException) {
+            map.put("code", "00000001");
+            map.put("msg", "用户或密码不正确");
+        } else if (authException instanceof AccountStatusException) {
+            if (authException instanceof LockedException) {
+                map.put("code", "00000001");
+                map.put("msg", "账户锁定");
+            } else if (authException instanceof AccountExpiredException) {//账户过期
+                map.put("code", "10020011");
+                map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
+            } else if (authException instanceof CredentialsExpiredException) {//证书过期
+                map.put("code", "10020011");
+                map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
+            } else if (authException instanceof DisabledException) {
+                map.put("code", "00000001");
+                map.put("msg", "账户不可用");
+            } else {
+                map.put("code", "00000001");
+                map.put("msg", "用户状态异常");
+            }
+        } else if (authException instanceof InsufficientAuthenticationException) {
+            map.put("code", "10020011");
+            map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
+        } else {
+            map.put("code", "00000001");
+            map.put("msg", authException.getMessage());
+        }
+        response.setContentType("application/json");
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.writeValue(response.getOutputStream(), map);
+        } catch (Exception e) {
+            throw new ServletException();
+        }
+    }
+
+    private boolean matchers(String url, HttpServletRequest request) {
+        AntPathRequestMatcher matcher = new AntPathRequestMatcher(url);
+        if (matcher.matches(request)) {
+            return true;
+        }
+        return false;
+    }
+}

+ 223 - 0
src/main/java/com/diagbot/config/MyJwtTokenStore.java

@@ -0,0 +1,223 @@
+package com.diagbot.config;
+
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.RedisUtils;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.jwt.Jwt;
+import org.springframework.security.jwt.JwtHelper;
+import org.springframework.security.jwt.crypto.sign.RsaVerifier;
+import org.springframework.security.jwt.crypto.sign.SignatureVerifier;
+import org.springframework.security.oauth2.common.DefaultExpiringOAuth2RefreshToken;
+import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
+import org.springframework.security.oauth2.common.DefaultOAuth2RefreshToken;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.security.oauth2.common.OAuth2RefreshToken;
+import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
+import org.springframework.security.oauth2.common.util.JsonParser;
+import org.springframework.security.oauth2.common.util.JsonParserFactory;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
+import org.springframework.security.oauth2.provider.approval.Approval;
+import org.springframework.security.oauth2.provider.approval.ApprovalStore;
+import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
+import org.springframework.security.oauth2.provider.token.store.JwtClaimsSetVerifier;
+import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
+import org.springframework.security.oauth2.provider.approval.Approval.ApprovalStatus;
+import org.springframework.util.FileCopyUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @Description:token续签
+ * @Author songxl
+ * @Date 2021/12/17
+ */
+public class MyJwtTokenStore extends JwtTokenStore {
+    private JwtAccessTokenConverter jwtTokenEnhancer;
+    private ApprovalStore approvalStore;
+    private JsonParser objectMapper = JsonParserFactory.create();
+    private JwtClaimsSetVerifier jwtClaimsSetVerifier = new NoOpJwtClaimsSetVerifier();
+    private SignatureVerifier verifier;
+    private RedisUtils redisUtils;
+    public MyJwtTokenStore(JwtAccessTokenConverter jwtTokenEnhancer,RedisUtils redisUtils) {
+        super(jwtTokenEnhancer);
+        verifier = createVerifier();
+        this.jwtTokenEnhancer = jwtTokenEnhancer;
+        this.redisUtils = redisUtils;
+    }
+
+    private SignatureVerifier createVerifier() {
+        Resource resource = new ClassPathResource("public.cert");
+        String publicKey;
+        try {
+            publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return new RsaVerifier(publicKey);
+    }
+
+    public void setApprovalStore(ApprovalStore approvalStore) {
+        this.approvalStore = approvalStore;
+    }
+
+    public OAuth2Authentication readAuthentication(OAuth2AccessToken token) {
+        return this.readAuthentication(token.getValue());
+    }
+
+
+    public void storeAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) {
+    }
+
+    public OAuth2AccessToken readAccessToken(String tokenValue) {
+        DefaultOAuth2AccessToken accessToken = (DefaultOAuth2AccessToken) this.convertAccessToken(tokenValue);
+        OAuth2AccessToken newAccessToken = updateTokenOutTime(accessToken);
+        if (this.jwtTokenEnhancer.isRefreshToken(accessToken)) {
+            throw new InvalidTokenException("Encoded token is a refresh token");
+        } else {
+            return newAccessToken;
+        }
+    }
+
+    private OAuth2AccessToken updateTokenOutTime(DefaultOAuth2AccessToken accessToken) {
+        if(accessToken.getAdditionalInformation()!=null&&accessToken.getAdditionalInformation().containsKey("user_id")){
+            //通过用户id获取redis存储的token过期时间
+            Object userIdObj = accessToken.getAdditionalInformation().get("user_id");
+            Integer value =(Integer) redisUtils.get("user:refreshToken:outTime_" + userIdObj);
+            if (value!=null){
+                //更新token过期时间为明天
+                accessToken.setExpiration(DateUtil.addDay(new Date(),1));
+                //将这个时间重新存到redis
+                redisUtils.set("user:refreshToken:outTime_" + userIdObj, value, value);
+            }
+        }
+        return accessToken;
+    }
+
+    private OAuth2AccessToken convertAccessToken(String tokenValue) {
+        return this.jwtTokenEnhancer.extractAccessToken(tokenValue, decode(tokenValue));
+    }
+
+    public void removeAccessToken(OAuth2AccessToken token) {
+    }
+
+    public void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication) {
+    }
+
+    public OAuth2RefreshToken readRefreshToken(String tokenValue) {
+        OAuth2AccessToken encodedRefreshToken = this.convertAccessToken(tokenValue);
+        OAuth2RefreshToken refreshToken = this.createRefreshToken(encodedRefreshToken);
+        if (this.approvalStore != null) {
+            OAuth2Authentication authentication = this.readAuthentication(tokenValue);
+            if (authentication.getUserAuthentication() != null) {
+                String userId = authentication.getUserAuthentication().getName();
+                String clientId = authentication.getOAuth2Request().getClientId();
+                Collection<Approval> approvals = this.approvalStore.getApprovals(userId, clientId);
+                Collection<String> approvedScopes = new HashSet();
+                Iterator var9 = approvals.iterator();
+
+                while(var9.hasNext()) {
+                    Approval approval = (Approval)var9.next();
+                    if (approval.isApproved()) {
+                        approvedScopes.add(approval.getScope());
+                    }
+                }
+
+                if (!approvedScopes.containsAll(authentication.getOAuth2Request().getScope())) {
+                    return null;
+                }
+            }
+        }
+
+        return refreshToken;
+    }
+
+    private OAuth2RefreshToken createRefreshToken(OAuth2AccessToken encodedRefreshToken) {
+        if (!this.jwtTokenEnhancer.isRefreshToken(encodedRefreshToken)) {
+            throw new InvalidTokenException("Encoded token is not a refresh token");
+        } else {
+            return (OAuth2RefreshToken)(encodedRefreshToken.getExpiration() != null ? new DefaultExpiringOAuth2RefreshToken(encodedRefreshToken.getValue(), encodedRefreshToken.getExpiration()) : new DefaultOAuth2RefreshToken(encodedRefreshToken.getValue()));
+        }
+    }
+
+    public OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token) {
+        return this.readAuthentication(token.getValue());
+    }
+
+    public void removeRefreshToken(OAuth2RefreshToken token) {
+        this.remove(token.getValue());
+    }
+
+    public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken) {
+    }
+
+    public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) {
+        return null;
+    }
+
+    public Collection<OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String userName) {
+        return Collections.emptySet();
+    }
+
+    public Collection<OAuth2AccessToken> findTokensByClientId(String clientId) {
+        return Collections.emptySet();
+    }
+
+    public void setTokenEnhancer(JwtAccessTokenConverter tokenEnhancer) {
+        this.jwtTokenEnhancer = tokenEnhancer;
+    }
+
+    private void remove(String token) {
+        if (this.approvalStore != null) {
+            OAuth2Authentication auth = this.readAuthentication(token);
+            String clientId = auth.getOAuth2Request().getClientId();
+            Authentication user = auth.getUserAuthentication();
+            if (user != null) {
+                Collection<Approval> approvals = new ArrayList();
+                Iterator var6 = auth.getOAuth2Request().getScope().iterator();
+
+                while(var6.hasNext()) {
+                    String scope = (String)var6.next();
+                    approvals.add(new Approval(user.getName(), clientId, scope, new Date(), ApprovalStatus.APPROVED));
+                }
+
+                this.approvalStore.revokeApprovals(approvals);
+            }
+        }
+
+    }
+
+    protected Map<String, Object> decode(String token) {
+        try {
+            Jwt jwt = JwtHelper.decodeAndVerify(token,verifier);
+            String claimsStr = jwt.getClaims();
+            Map<String, Object> claims = this.objectMapper.parseMap(claimsStr);
+            if (claims.containsKey("exp") && claims.get("exp") instanceof Integer) {
+                Integer intValue = (Integer)claims.get("exp");
+                claims.put("exp", new Long((long)intValue));
+            }
+
+            jwtClaimsSetVerifier.verify(claims);
+            return claims;
+        } catch (Exception var6) {
+            throw new InvalidTokenException("Cannot convert access token to JSON", var6);
+        }
+    }
+
+
+    private class NoOpJwtClaimsSetVerifier implements JwtClaimsSetVerifier {
+        private NoOpJwtClaimsSetVerifier() {
+        }
+
+        public void verify(Map<String, Object> claims) throws InvalidTokenException {
+        }
+    }
+}

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

@@ -1,5 +1,6 @@
 package com.diagbot.config;
 
+import com.diagbot.facade.SysDictionaryFacade;
 import com.diagbot.service.UrlUserService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,17 +34,28 @@ import java.util.Arrays;
 public class OAuth2Configurer extends AuthorizationServerConfigurerAdapter {
     @Autowired
     private UrlUserService urlUserService;
+    @Autowired
+    private SysDictionaryFacade sysDictionaryFacade;
 
     @Override
     public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
+        int accessToken = 24 * 3600;
+        int refreshToken = 30 * 24 * 3600;
+        if (sysDictionaryFacade.getDictionaryWithKey() != null
+                && sysDictionaryFacade.getDictionaryWithKey().containsKey("31")
+                && sysDictionaryFacade.getDictionaryWithKey().get("31").containsKey("accessToken")
+                && sysDictionaryFacade.getDictionaryWithKey().get("31").containsKey("refreshToken")) {
+            accessToken = Integer.parseInt(sysDictionaryFacade.getDictionaryWithKey().get("31").get("accessToken"));
+            refreshToken = Integer.parseInt(sysDictionaryFacade.getDictionaryWithKey().get("31").get("refreshToken"));
+        }
         clients.inMemory()
                 .withClient("uaa-service")
                 .secret("{noop}123456")
                 .scopes("service")
                 .autoApprove(true)
                 .authorizedGrantTypes("implicit", "refresh_token", "password", "authorization_code")
-                .accessTokenValiditySeconds(24 * 3600)
-                .refreshTokenValiditySeconds(30 * 24 * 3600);
+                .accessTokenValiditySeconds(accessToken)
+                .refreshTokenValiditySeconds(refreshToken);
     }
 
     /**

+ 82 - 27
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -1,5 +1,6 @@
 package com.diagbot.config;
 
+import com.diagbot.util.RedisUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,7 @@ import org.springframework.security.jwt.crypto.sign.RsaVerifier;
 import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
 import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
 import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
+import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint;
 import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
 import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
 import org.springframework.util.FileCopyUtils;
@@ -29,15 +31,27 @@ import java.io.IOException;
 @ComponentScan({"com.diagbot.config"})
 public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
     Logger log = LoggerFactory.getLogger(ResourceServerConfigurer.class);
+    @Autowired
+    private AuthExceptionEntryPoint authExceptionEntryPoint;
+    @Autowired
+    private AccessDeniedExceptionPoint accessDeniedExceptionPoint;
+    @Autowired
+    private RedisUtils redisUtils;
 
     @Override
     public void configure(HttpSecurity http) throws Exception {
         http.cors()
+                .and()
+                .exceptionHandling().authenticationEntryPoint(authExceptionEntryPoint)
+                .and()
+                .exceptionHandling().accessDeniedHandler(accessDeniedExceptionPoint)
                 .and()
                 .csrf().disable()
                 .authorizeRequests()
                 .regexMatchers(".*swagger.*", ".*v2.*", ".*webjars.*", "/druid.*", "/actuator.*", "/hystrix.*").permitAll()
                 .antMatchers("/sys/user/getJwt").permitAll()
+                .antMatchers("/sys/user/getCaptcha").permitAll()
+                .antMatchers("/sys/user/getHospitalMark").permitAll()
                 .antMatchers("/sys/user/getJwtNoPass").permitAll()
                 .antMatchers("/sys/user/refreshJwt").permitAll()
                 .antMatchers("/sys/user/checkToken").permitAll()
@@ -84,6 +98,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/entryCountGroupByCasePage").permitAll()
                 .antMatchers("/console/entryCountGroupByEntry").permitAll()
                 .antMatchers("/console/entryCountGroupByEntryPage").permitAll()
+                .antMatchers("/console/entryCountGroupXYByEntryPage").permitAll()
                 .antMatchers("/console/entryGroupByEntryInnerPage").permitAll()
                 .antMatchers("/console/getAverageDayNum").permitAll()
                 .antMatchers("/console/getAverageDayNumPage").permitAll()
@@ -95,6 +110,16 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/getLevelResultDept").permitAll()
                 .antMatchers("/console/homePageLevelLimit").permitAll()
                 .antMatchers("/console/homePageLevelStatistics").permitAll()
+                .antMatchers("/console/homePageLevelStatisticsXY").permitAll()
+                .antMatchers("/console/export/homePageLevelXYExport").permitAll()
+                .antMatchers("/consoleByDept/homePageLevelStatisticsXYByDept").permitAll()
+                .antMatchers("/print/export/homePageLevelXYExportByDept").permitAll()
+                .antMatchers("/consoleByDept/entryCountGroupXYByEntryPageDept").permitAll()
+                .antMatchers("/print/export/entryCountGroupXYByExportDept").permitAll()
+                .antMatchers("/consoleByDept/qcResultShortXYPageByDept").permitAll()
+                .antMatchers("/print/export/qcResultShortXYPageExportDept").permitAll()
+                .antMatchers("/consoleByDept/badLevelXYPageByDept").permitAll()
+                .antMatchers("/print/export/badLevelPageXYExportByDept").permitAll()
                 .antMatchers("/console/leaveHosCount").permitAll()
                 .antMatchers("/console/medicalRecordIndicator").permitAll()
                 .antMatchers("/console/codingMonthly").permitAll()
@@ -104,6 +129,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/mrCount").permitAll()
                 .antMatchers("/console/mrStatistics").permitAll()
                 .antMatchers("/console/qcResultShortPage").permitAll()
+                .antMatchers("/console/qcResultShortXYPage").permitAll()
                 .antMatchers("/console/resultStatistics").permitAll()
                 .antMatchers("/console/resultStatisticsByDeptPage").permitAll()
                 .antMatchers("/console/homePageMRCount").permitAll()
@@ -136,9 +162,11 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/getAverageFeeExport").permitAll()
                 .antMatchers("/console/export/levelPercentGroupByDeptExport").permitAll()
                 .antMatchers("/console/export/entryCountGroupByEntryExport").permitAll()
+                .antMatchers("/console/export/entryCountGroupXYByEntryExport").permitAll()
                 .antMatchers("/console/export/entryCountGroupByCaseExport").permitAll()
                 .antMatchers("/console/export/entryStatisticsExport").permitAll()
                 .antMatchers("/console/export/qcResultShortPageExport").permitAll()
+                .antMatchers("/console/export/qcResultShortXYPageExport").permitAll()
                 .antMatchers("/console/export/leaveHosMrPageExport").permitAll()
                 .antMatchers("/console/export/qcCheckStatisticsExport").permitAll()
                 .antMatchers("/console/export/unModifyMRPageExport").permitAll()
@@ -168,32 +196,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/data/getColumnZhAndCh").permitAll()
                 .antMatchers("/qc/data/analyseRec").permitAll()
                 .antMatchers("/qc/data/hisDataDeal").permitAll()
-                .antMatchers("/qc/data_str/sendAdmissionNote").permitAll()
-                .antMatchers("/qc/data_str/sendBloodResult").permitAll()
-                .antMatchers("/qc/data_str/sendBloodTransfusion").permitAll()
-                .antMatchers("/qc/data_str/sendConsultationApply").permitAll()
-                .antMatchers("/qc/data_str/sendConsultationNote").permitAll()
-                .antMatchers("/qc/data_str/sendConsultationRecord").permitAll()
-                .antMatchers("/qc/data_str/sendConsultationResult").permitAll()
-                .antMatchers("/qc/data_str/sendCrisisNote").permitAll()
-                .antMatchers("/qc/data_str/sendDeathDiscussion").permitAll()
-                .antMatchers("/qc/data_str/sendDeathNote").permitAll()
-                .antMatchers("/qc/data_str/sendDifficultCase").permitAll()
-                .antMatchers("/qc/data_str/sendFirstRecord").permitAll()
-                .antMatchers("/qc/data_str/sendIllCritically").permitAll()
-                .antMatchers("/qc/data_str/sendIllSeriousl").permitAll()
-                .antMatchers("/qc/data_str/sendLeaveHospital").permitAll()
-                .antMatchers("/qc/data_str/sendOperativeFirstRecord").permitAll()
-                .antMatchers("/qc/data_str/sendOperativeNote").permitAll()
-                .antMatchers("/qc/data_str/sendWardRecord").permitAll()
-                .antMatchers("/qc/data_str/sendTransferOutNote").permitAll()
-                .antMatchers("/qc/data_str/sendTransferInNote").permitAll()
-                .antMatchers("/qc/data_str/sendRescueNote").permitAll()
-                .antMatchers("/qc/data_str/sendPeriodConclusion").permitAll()
-                .antMatchers("/qc/data_str/sendPreoperativeDiscussion").permitAll()
-                .antMatchers("/qc/data_str/sendTalkInform").permitAll()
-                .antMatchers("/qc/data_str/sendInformedConsent").permitAll()
-                .antMatchers("/qc/data_str/sendContent").permitAll()
+                .antMatchers("/qc/data_str/*").permitAll()
                 .antMatchers("/qc/doctoradvice/getPage").permitAll()
                 .antMatchers("/qc/medPacsInfo/getCheckPage").permitAll()
                 .antMatchers("/qc/medLisInfo/getExaminePage").permitAll()
@@ -204,8 +207,12 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/export/medicalCheckExport").permitAll()
                 .antMatchers("/console/export/medicalCheckInnerExport").permitAll()
                 .antMatchers("/console/badLevelPage").permitAll()
+                .antMatchers("/console/badLevelXYPage").permitAll()
                 .antMatchers("/console/export/badLevelPagePageExport").permitAll()
+                .antMatchers("/console/export/badLevelPageXYExport").permitAll()
                 .antMatchers("/qc/medNurse/getMedNursePage").permitAll()
+                .antMatchers("/qc/medRecordOther/getMedRecordOtherPage").permitAll()
+                .antMatchers("/qc/medRecordOther/getMedRecordContentOther").permitAll()
                 .antMatchers("/qc/behospitalInfo/exportQcresultByPerson").permitAll()
                 .antMatchers("/consoleByDept/beHosCountByDept").permitAll()
                 .antMatchers("/consoleByDept/casesEntryStatisticsByDept").permitAll()
@@ -245,15 +252,63 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/console/saveMedicaIndicator").permitAll()
                 .antMatchers("/qc/medCheckInfo/createMedBeHospitalInfoType").permitAll()
                 .antMatchers("/qc/medCheckInfo/addMedCheckInfo").permitAll()
+                .antMatchers("/qc/medCheckInfo/getDataEdit").permitAll()
+                .antMatchers("/qc/medCheckInfo/saveDataEdit").permitAll()
+                .antMatchers("/qc/analysis/addMedClickInfo").permitAll()
+                .antMatchers("/qc/analysis/getQcClickDeptList").permitAll()
+                .antMatchers("/qc/analysis/getQcClick").permitAll()
+                .antMatchers("/qc/analysis/getQcClickByExport").permitAll()
+                .antMatchers("/qc/analysis/getQcClickInnerPage").permitAll()
+                .antMatchers("/qc/analysis/getQcClickInnerPageByExport").permitAll()
+                .antMatchers("/qc/analysis/getEntryDefectImprove").permitAll()
+                .antMatchers("/qc/analysis/getEntryDefectImproveByExport").permitAll()
+                .antMatchers("/qc/analysis/getEntryDefectImproveInner").permitAll()
+                .antMatchers("/qc/analysis/getDefectImproveInnerByExport").permitAll()
+                .antMatchers("/qc/analysisDept/getEntryDefectImproveDept").permitAll()
+                .antMatchers("/qc/analysisDept/getEntryDefectImproveByDeptExport").permitAll()
+                .antMatchers("/qc/analysisDept/getEntryDefectImproveInnerDept").permitAll()
+                .antMatchers("/qc/analysisDept/getDefectImproveInnerByDeptExport").permitAll()
+                .antMatchers("/qc/behospitalInfo/historyAnalyze").permitAll()
+                .antMatchers("/qc/behospitalInfo/operationLog").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getComplaintRecord").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getAppealReview").permitAll()
+                .antMatchers("/qc/appealExamineInfo/approved").permitAll()
+                .antMatchers("/qc/appealExamineInfo/rejected").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getApprovedView").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getAppealReviewDictionary").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getAuditNumber").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getAppealReviewExport").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getComplaintRecordExport").permitAll()
+                .antMatchers("/qc/appealExamineInfo/getComplaintDetailMsg").permitAll()
+                .antMatchers("/qc/appealInfo/addAppealInfo").permitAll()
+                .antMatchers("/qc/appealInfo/addAppealInfoApi").permitAll()
+                .antMatchers("/qc/appealInfo/getReviewer").permitAll()
+                .antMatchers("/qc/appealInfo/getReviewerApi").permitAll()
+                .antMatchers("/qc/behospitalInfo/addCase").permitAll()
+                .antMatchers("/qc/appealInfo/delCase").permitAll()
+                .antMatchers("/qc/appealInfo/logicDelCase").permitAll()
+                .antMatchers("/qc/appealInfo/updCase").permitAll()
+                .antMatchers("/qc/appealInfo/getAppealOperationType").permitAll()
+                .antMatchers("/qc/appealInfo/cancelAppealInfo").permitAll()
+                .antMatchers("/qc/appealInfo/cancelAppealInfoApi").permitAll()
+                .antMatchers("/qc/appealInfo/getAppealInfo").permitAll()
+                .antMatchers("/qc/appealInfo/getAppealDept").permitAll()
+                .antMatchers("/qc/appealInfo/getAppealMode").permitAll()
+                .antMatchers("/qc/appealInfo/getUserRole").permitAll()
+                .antMatchers("/qc/mode/getModes").permitAll()
                 .antMatchers("/qc/data/sendTemplateInfos").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }
+
     @Override
     public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
         log.info("Configuring ResourceServerSecurityConfigurer");
-        resources.resourceId("user-service").tokenStore(new JwtTokenStore(jwtTokenEnhancerClient()));
+        resources.resourceId("user-service").tokenStore(new MyJwtTokenStore(jwtTokenEnhancerClient(),redisUtils));
+        resources.authenticationEntryPoint(authExceptionEntryPoint);
+        resources.accessDeniedHandler(accessDeniedExceptionPoint);
     }
+
     @Autowired
     private CustomAccessTokenConverter customAccessTokenConverter;
 

+ 112 - 3
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -1,5 +1,8 @@
 package com.diagbot.config.security;
 
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.exception.ServiceErrorCode;
 import com.diagbot.facade.TokenFacade;
 import com.diagbot.util.HttpUtils;
 import com.diagbot.util.StringUtil;
@@ -32,17 +35,34 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
     public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
         HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
         String url, method;
+        String tokenStr = HttpUtils.getHeaders(request).get("Authorization");
+        if (!request.getMethod().equals("OPTIONS") && StringUtil.isEmpty(tokenStr)) {
+            tokenStr = HttpUtils.getHeaders(request).get("authorization");
+        }
+        //用户是否被顶掉校验
+        if (StringUtil.isNotEmpty(tokenStr) && !matchNotCheckUrl(request)) {
+            tokenStr = tokenStr.replaceFirst("Bearer ", "");
+            int res = tokenFacade.newVerifyToken(tokenStr, 1);
+            if (-1 == res) {
+                throw new CommonException(ServiceErrorCode.LONGIN_ERROE);
+            } else if (-2 == res) {
+                throw new CommonException(ServiceErrorCode.USER_POWER_UP);
+            }
+        }
+
         if (matchPermitAllUrl(request)) {
             return;
         }
         if ("anonymousUser".equals(authentication.getPrincipal())) {
             throw new AccessDeniedException("no right");
         } else {
-            String tokenStr = HttpUtils.getHeaders(request).get("Authorization");
             if (StringUtil.isNotEmpty(tokenStr)) {
                 tokenStr = tokenStr.replaceFirst("Bearer ", "");
-                Boolean res = tokenFacade.verifyToken(tokenStr, 1);
-                if (!res) {
+//                Boolean res = tokenFacade.verifyToken(tokenStr, 1);
+                int res = tokenFacade.newVerifyToken(tokenStr, 1);
+                if (-1 == res) {
+                    throw new CommonException(ServiceErrorCode.LONGIN_ERROE);
+                } else if (1 != res) {
                     throw new AccountExpiredException("token expire");
                 }
             }
@@ -81,6 +101,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/actuator/**", request)
                 || matchers("/hystrix/**", request)
                 || matchers("/sys/user/getJwt", request)
+                || matchers("/sys/user/getCaptcha", request)
+                || matchers("/sys/user/getHospitalMark", request)
                 || matchers("/sys/user/getJwtNoPass", request)
                 || matchers("/sys/user/refreshJwt", request)
                 || matchers("/sys/dictionaryInfo/getDictionary", request)
@@ -128,6 +150,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/entryCountGroupByCasePage", request)
                 || matchers("/console/entryCountGroupByEntry", request)
                 || matchers("/console/entryCountGroupByEntryPage", request)
+                || matchers("/console/entryCountGroupXYByEntryPage", request)
                 || matchers("/console/entryGroupByEntryInnerPage", request)
                 || matchers("/console/getAverageDayNum", request)
                 || matchers("/console/getAverageDayNumPage", request)
@@ -139,6 +162,16 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/getLevelResultDept", request)
                 || matchers("/console/homePageLevelLimit", request)
                 || matchers("/console/homePageLevelStatistics", request)
+                || matchers("/console/homePageLevelStatisticsXY", request)
+                || matchers("/console/export/homePageLevelXYExport", request)
+                || matchers("/consoleByDept/homePageLevelStatisticsXYByDept", request)
+                || matchers("/print/export/homePageLevelXYExportByDept", request)
+                || matchers("/consoleByDept/entryCountGroupXYByEntryPageDept", request)
+                || matchers("/print/export/entryCountGroupXYByExportDept", request)
+                || matchers("/consoleByDept/qcResultShortXYPageByDept", request)
+                || matchers("/print/export/qcResultShortXYPageExportDept", request)
+                || matchers("/consoleByDept/badLevelXYPageByDept", request)
+                || matchers("/print/export/badLevelPageXYExportByDept", request)
                 || matchers("/console/leaveHosCount", request)
                 || matchers("/console/levelPercentGroupByDeptPage", request)
                 || matchers("/console/levelStatistics", request)
@@ -148,6 +181,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/medicalRecordIndicator", request)
                 || matchers("/console/codingMonthly", request)
                 || matchers("/console/qcResultShortPage", request)
+                || matchers("/console/qcResultShortXYPage", request)
                 || matchers("/console/resultStatistics", request)
                 || matchers("/console/resultStatisticsByDeptPage", request)
                 || matchers("/console/homePageMRCount", request)
@@ -180,9 +214,11 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/getAverageFeeExport", request)
                 || matchers("/console/export/levelPercentGroupByDeptExport", request)
                 || matchers("/console/export/entryCountGroupByEntryExport", request)
+                || matchers("/console/export/entryCountGroupXYByEntryExport", request)
                 || matchers("/console/export/entryCountGroupByCaseExport", request)
                 || matchers("/console/export/entryStatisticsExport", request)
                 || matchers("/console/export/qcResultShortPageExport", request)
+                || matchers("/console/export/qcResultShortXYPageExport", request)
                 || matchers("/console/export/leaveHosMrPageExport", request)
                 || matchers("/console/export/qcCheckStatisticsExport", request)
                 || matchers("/console/export/unModifyMRPageExport", request)
@@ -248,8 +284,12 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/export/medicalCheckExport", request)
                 || matchers("/console/export/medicalCheckInnerExport", request)
                 || matchers("/console/badLevelPage", request)
+                || matchers("/console/badLevelXYPage", request)
                 || matchers("/console/export/badLevelPagePageExport", request)
+                || matchers("/console/export/badLevelPageXYExport", request)
                 || matchers("/qc/medNurse/getMedNursePage", request)
+                || matchers("/qc/medRecordOther/getMedRecordOtherPage", request)
+                || matchers("/qc/medRecordOther/getMedRecordContentOther", request)
                 || matchers("/qc/behospitalInfo/exportQcresultByPerson", request)
                 || matchers("/consoleByDept/beHosCountByDept", request)
                 || matchers("/consoleByDept/casesEntryStatisticsByDept", request)
@@ -289,6 +329,50 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/console/saveMedicaIndicator", request)
                 || matchers("/qc/medCheckInfo/createMedBeHospitalInfoType", request)
                 || matchers("/qc/medCheckInfo/addMedCheckInfo", request)
+                || matchers("/qc/dataEdit/getDataEdit", request)
+                || matchers("/qc/dataEdit/saveDataEdit", request)
+                || matchers("/qc/analysis/addMedClickInfo", request)
+                || matchers("/qc/analysis/getQcClickDeptList", request)
+                || matchers("/qc/analysis/getQcClick", request)
+                || matchers("/qc/analysis/getQcClickByExport", request)
+                || matchers("/qc/analysis/getQcClickInnerPage", request)
+                || matchers("/qc/analysis/getQcClickInnerPageByExport", request)
+                || matchers("/qc/analysis/getEntryDefectImprove", request)
+                || matchers("/qc/analysis/getEntryDefectImproveByExport", request)
+                || matchers("/qc/analysis/getEntryDefectImproveInner", request)
+                || matchers("/qc/analysis/getDefectImproveInnerByExport", request)
+                || matchers("/qc/analysisDept/getEntryDefectImproveDept", request)
+                || matchers("/qc/analysisDept/getEntryDefectImproveByDeptExport", request)
+                || matchers("/qc/analysisDept/getEntryDefectImproveInnerDept", request)
+                || matchers("/qc/analysisDept/getDefectImproveInnerByDeptExport", request)
+                || matchers("/qc/behospitalInfo/historyAnalyze", request)
+                || matchers("/qc/behospitalInfo/operationLog", request)
+                || matchers("/qc/appealExamineInfo/getComplaintRecord", request)
+                || matchers("/qc/appealExamineInfo/getAppealReview", request)
+                || matchers("/qc/appealExamineInfo/approved", request)
+                || matchers("/qc/appealExamineInfo/rejected", request)
+                || matchers("/qc/appealExamineInfo/getApprovedView", request)
+                || matchers("/qc/appealExamineInfo/getAppealReviewDictionary", request)
+                || matchers("/qc/appealExamineInfo/getAuditNumber", request)
+                || matchers("/qc/appealExamineInfo/getAppealReviewExport", request)
+                || matchers("/qc/appealExamineInfo/getComplaintRecordExport", request)
+                || matchers("/qc/appealExamineInfo/getComplaintDetailMsg", request)
+                || matchers("/qc/appealInfo/addAppealInfo", request)
+                || matchers("/qc/appealInfo/addAppealInfoApi", request)
+                || matchers("/qc/appealInfo/getReviewer", request)
+                || matchers("/qc/appealInfo/getReviewerApi", request)
+                || matchers("/qc/behospitalInfo/addCase", request)
+                || matchers("/qc/behospitalInfo/delCase", request)
+                || matchers("/qc/behospitalInfo/logicDelCase", request)
+                || matchers("/qc/behospitalInfo/updCase", request)
+                || matchers("/qc/appealInfo/getAppealOperationType", request)
+                || matchers("/qc/appealInfo/cancelAppealInfo", request)
+                || matchers("/qc/appealInfo/cancelAppealInfoApi", request)
+                || matchers("/qc/appealInfo/getAppealInfo", request)
+                || matchers("/qc/appealInfo/getAppealDept", request)
+                || matchers("/qc/appealInfo/getAppealMode", request)
+                || matchers("/qc/appealInfo/getUserRole", request)
+                || matchers("/qc/mode/getModes", request)
                 || matchers("/qc/data/sendTemplateInfos", request)
                 || matchers("/", request)) {
             return true;
@@ -303,4 +387,29 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
         }
         return false;
     }
+
+    private boolean matchNotCheckUrl(HttpServletRequest request) {
+        if (matchers("/swagger/**", request)
+                || matchers("/v2/**", request)
+                || matchers("/swagger-ui.html/**", request)
+                || matchers("/swagger-resources/**", request)
+                || matchers("/webjars/**", request)
+                || matchers("/druid/**", request)
+                || matchers("/actuator/**", request)
+                || matchers("/hystrix/**", request)
+                || matchers("/sys/user/getJwt", request)
+                || matchers("/sys/user/logout", request)
+                || matchers("/sys/user/getCaptcha", request)
+                || matchers("/sys/user/getHospitalMark", request)
+                || matchers("/sys/user/getJwtNoPass", request)
+                || matchers("/sys/user/refreshJwt", request)
+                || matchers("/sys/dictionaryInfo/getDictionary", request)
+                || matchers("/sys/user/checkToken", request)
+                || matchers("/oauth/token", request)
+                || matchers("/oauth/check_token", request)
+                || matchers("/cache/clear", request)) {
+            return true;
+        }
+        return false;
+    }
 }

+ 13 - 1
src/main/java/com/diagbot/config/security/UrlFilterSecurityInterceptor.java

@@ -1,5 +1,7 @@
 package com.diagbot.config.security;
 
+import com.alibaba.fastjson.JSONObject;
+import com.diagbot.exception.CommonException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.SecurityMetadataSource;
 import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
@@ -43,7 +45,17 @@ public class UrlFilterSecurityInterceptor extends AbstractSecurityInterceptor im
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
 
         FilterInvocation fi = new FilterInvocation(request, response, chain);
-        invoke(fi);
+        try {
+            invoke(fi);
+        }catch (CommonException e)
+        {
+            JSONObject error = new JSONObject();
+            response.setContentType("text/html;charset=utf-8");
+            error.put("code",e.getCode());
+            error.put("msg", e.getMessage());
+            response.getWriter().println(error);
+            response.flushBuffer();
+        }
     }
 
 

+ 89 - 0
src/main/java/com/diagbot/dto/AppealExamineRecordDTO.java

@@ -0,0 +1,89 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description: 申诉审核记录对象
+ * @Author songxl
+ */
+@Data
+public class AppealExamineRecordDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "申诉id")
+    private Long id;
+
+    @ApiModelProperty(value = "条目ID")
+    private Long casesEntryId;
+
+    @ApiModelProperty(value = "质控条目")
+    private String casesEntryName;
+
+    @ApiModelProperty(value = "申诉-提示信息(新增已有操作才有值)")
+    private String casesEntryMsg;
+
+    @ApiModelProperty(value = "申诉-分值(新增已有操作才有值)")
+    private BigDecimal value;
+
+    @ApiModelProperty(value = "申诉人id")
+    private String claimantId;
+
+    @ApiModelProperty(value = "申诉类型(0:医生申诉|1:质控申诉)")
+    private String appealType;
+
+    @ApiModelProperty(value = "申诉操作类型(0:删改|1:新增已有|2:新增缺失|3:恢复)")
+    private String appealOperationType;
+
+    @ApiModelProperty(value = "申诉说明")
+    private String appealExplain;
+
+    @ApiModelProperty(value = "审核人id")
+    private Long checkId;
+
+    @ApiModelProperty(value = "申诉备注")
+    private String appealRemark;
+
+    @ApiModelProperty(value = "审核状态:1:驳回|2:通过")
+    private String exampleStatus;
+
+    @ApiModelProperty(value = "审核处理方式: 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复")
+    private String exampleOperation;
+
+    @ApiModelProperty(value = "处理结果")
+    private String processResult;
+
+    @ApiModelProperty(value = "驳回理由")
+    private String rejectReason;
+
+    @ApiModelProperty(value = "审核备注")
+    private String exampleRemark;
+
+    @ApiModelProperty(value = "申诉人姓名")
+    private String claimantName;
+
+    @ApiModelProperty(value = "审核人姓名")
+    private String checkName;
+
+    @ApiModelProperty(value = "申诉时间")
+    private Date appealCreateDate;
+
+    @ApiModelProperty(value = "审核时间")
+    private Date appealExamineDate;
+
+    @ApiModelProperty(value = "审核-提示信息")
+    private String msg;
+
+    @ApiModelProperty(value = "审核-分值")
+    private BigDecimal score;
+
+    @ApiModelProperty(value = "单项否决")
+    private String isReject;
+
+    @ApiModelProperty(value = "模块总分")
+    private BigDecimal casesScore;
+}

+ 94 - 0
src/main/java/com/diagbot/dto/BehospitalAnalysisDTO.java

@@ -0,0 +1,94 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 住院病历信息
+ * </p>
+ *
+ * @author zhoutg
+ * @since 2020-04-13
+ */
+@Data
+public class BehospitalAnalysisDTO implements Serializable {
+
+    /**
+     * 病历等级
+     */
+    @Excel(name = "病历等级")
+    private String level;
+
+    /**
+     * 最后得分
+     */
+    @Excel(name = "病历得分")
+    private Double scoreRes;
+
+    /**
+     * 病人住院ID
+     */
+    @Excel(name = "病人住院序号",width = 12d)
+    private String behospitalCode;
+
+    /**
+     * 档案号
+     */
+    @Excel(name = "病案号")
+    private String fileCode;
+
+    /**
+     * 姓名
+     */
+    @Excel(name = "病人姓名")
+    private String name;
+
+
+    /**
+     * 年龄
+     */
+    @Excel(name = "年龄")
+    private String age = "";
+
+
+    /**
+     * 入院时间
+     */
+    @Excel(name = "入院日期", exportFormat = "yyyy/MM/dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date behospitalDate;
+
+    /**
+     * 出院时间
+     */
+    @Excel(name = "出院日期", exportFormat = "yyyy/MM/dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+    /**
+     * 医生姓名
+     */
+    @Excel(name = "主管医生",width = 12d)
+    private String doctorName;
+
+    /**
+     * 住院科室名称
+     */
+    @Excel(name = "科室")
+    private String behDeptName;
+
+    private String behDoctorName;
+
+
+    /**
+     * 评分时间
+     */
+    @Excel(name = "评分时间", exportFormat = "yyyy/MM/dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date gradeTime;
+}

+ 72 - 0
src/main/java/com/diagbot/dto/BehospitalCodeDetail.java

@@ -0,0 +1,72 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class BehospitalCodeDetail {
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 姓名
+     */
+    private String name;
+
+    /**
+     * 档案号
+     */
+    private String fileCode;
+
+    /**
+     * 入院时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date behospitalDate;
+
+    /**
+     * 出院时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 年龄
+     */
+    private String age;
+
+    /**
+     * 病历等级
+     */
+    private String level;
+
+    /**
+     * 最后得分
+     */
+    private Double scoreRes;
+
+    /**
+     * 评分时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date gradeTime;
+
+    List<QcResultDetailInfo> qcResultDetailInfos;
+}

+ 20 - 0
src/main/java/com/diagbot/dto/BehospitalCodeInfo.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class BehospitalCodeInfo {
+    /**
+     * 住院号
+     */
+    private String behospitalCode;
+
+    List<QcResultDetailInfo> qcResultDetailInfos;
+}

+ 58 - 37
src/main/java/com/diagbot/dto/BehospitalInfoDTO.java

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
@@ -20,82 +21,107 @@ public class BehospitalInfoDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 病人住院ID
+     * 住院科室名称
      */
-    private String behospitalCode;
+    @Excel(name = "科室", mergeVertical = true, width = 25d, orderNum = "1")
+    private String behDeptName;
+
+
+    /**
+     * 医生姓名
+     */
+    @Excel(name = "主管医生", orderNum = "2")
+    private String doctorName;
 
+
+    private String behDoctorName;
     /**
      * 姓名
      */
+    @Excel(name = "患者姓名", orderNum = "3")
     private String name;
 
     /**
-     * 性别
+     * 档案号
      */
-    private String sex;
+    @Excel(name = "病案号", orderNum = "4")
+    private String fileCode;
 
     /**
-     * 出生日期
+     * 年龄
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date birthday;
+    @Excel(name = "年龄", orderNum = "5")
+    private String age = "";
+
 
     /**
-     * 档案号
+     * 入院时间
      */
-    private String fileCode;
+    @Excel(name = "入院时间", orderNum = "6", exportFormat = "yyyy/MM/dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date behospitalDate;
 
     /**
-     * 病区名称
+     * 出院时间
      */
-    private String wardName;
+    @Excel(name = "出院时间", orderNum = "7", exportFormat = "yyyy/MM/dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
 
     /**
-     * 住院科室名称
+     * 最后得分
      */
-    private String behDeptName;
+    @Excel(name = "病历得分", orderNum = "8")
+    private Double scoreRes;
 
     /**
-     * 床位号
+     * 病历等级
      */
-    private String bedCode;
+    @Excel(name = "病历等级", orderNum = "9")
+    private String level;
 
     /**
-     * 入院时间
+     * 评分时间
      */
+    @Excel(name = "评分时间", orderNum = "10", exportFormat = "yyyy/MM/dd")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date behospitalDate;
+    private Date gradeTime;
+
 
     /**
-     * 出院时间
+     * 病人住院ID
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date leaveHospitalDate;
+    private String behospitalCode;
+
 
     /**
-     * 疾病名称
+     * 性别
      */
-    private String diagnose;
+    private String sex;
 
     /**
-     * 医生姓名
+     * 出生日期
      */
-    private String doctorName;
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthday;
 
     /**
-     * 年龄
+     * 病区名称
      */
-    private String age;
+    private String wardName;
 
     /**
-     * 病历等级
+     * 床位号
      */
-    private String level;
+    private String bedCode;
+
 
     /**
-     * 最后得分
+     * 疾病名称
      */
-    private Double scoreRes;
+    private String diagnose;
+
 
     /**
      * 病案首页得分
@@ -107,15 +133,10 @@ public class BehospitalInfoDTO implements Serializable {
      */
     private String gradeType;
 
-    /**
-     * 评分时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    private Date gradeTime;
 
-    private String directorDoctorName ;
+    private String directorDoctorName;
+
 
-    private String behDoctorName;
 
     /**
      * 归档时间

+ 61 - 0
src/main/java/com/diagbot/dto/CommonResult.java

@@ -0,0 +1,61 @@
+package com.diagbot.dto;
+
+/**
+ * @Description: 通用返回对象
+ * @author: rengb
+ * @time: 2021/1/5 18:27
+ */
+public class CommonResult<T> {
+
+    private long code;
+    private String message;
+    private T data;
+
+    protected CommonResult() {
+    }
+
+    protected CommonResult(long code, String message, T data) {
+        this.code = code;
+        this.message = message;
+        this.data = data;
+    }
+
+    public long getCode() {
+        return code;
+    }
+
+    public void setCode(long code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    public static <T> RespDTO<T> tranResp(CommonResult<T> commonResult) {
+        RespDTO respDTO = new RespDTO();
+        if (commonResult.code == 500l) {
+            respDTO.code = "-1";
+        } else if (commonResult.code == 200l) {
+            respDTO.code = "0";
+        } else {
+            respDTO.code = commonResult.code + "";
+        }
+        respDTO.msg = commonResult.message;
+        respDTO.data = commonResult.data;
+        return respDTO;
+    }
+
+}

+ 26 - 0
src/main/java/com/diagbot/dto/EntryDefectImprove.java

@@ -0,0 +1,26 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImprove {
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室name
+     */
+    private String deptName;
+
+    List<BehospitalCodeInfo> behospitalCodeInfos;
+
+}

+ 24 - 0
src/main/java/com/diagbot/dto/EntryDefectImproveInner.java

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImproveInner {
+
+    /**
+     * 住院科室名称
+     */
+    private String behDeptName;
+
+
+    List<BehospitalCodeDetail> behospitalCodeInfos;
+}

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

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImproveInnerDoctor {
+    /**
+     * 医生id
+     */
+    private String doctorId;
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+
+    List<BehospitalCodeInfo> behospitalCodeInfos;
+}

+ 27 - 0
src/main/java/com/diagbot/dto/EntryDefectImproveInnerExport.java

@@ -0,0 +1,27 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class EntryDefectImproveInnerExport {
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室name
+     */
+    private String deptName;
+
+
+    List<EntryDefectImproveInnerDoctor> entryDefectImproveInnerDoctors;
+}

+ 58 - 0
src/main/java/com/diagbot/dto/ExportGetAppealReviewDTO.java

@@ -0,0 +1,58 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 审核excle
+ *
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class ExportGetAppealReviewDTO {
+
+//    @Excel(name = "申述id", needMerge = true)
+//    private Long id;
+
+    @Excel(name = "申诉人", needMerge = true)
+    private String claimantName;
+
+    @Excel(name = "所属科室", needMerge = true)
+    private String behDeptName;
+
+    @Excel(name = "申诉时间", needMerge = true, exportFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date claimantGmtCreate;
+
+    @Excel(name = "病人住院序号", needMerge = true)
+    private String behospitalCode;
+
+    @Excel(name = "患者姓名", needMerge = true)
+    private String name;
+
+    @Excel(name = "申诉模块", needMerge = true)
+    private String modeName;
+
+    @Excel(name = "缺陷详情", needMerge = true)
+    private String qcresultDetailMsg;
+
+    @Excel(name = "审核人", needMerge = true)
+    private String checkName;
+
+    @Excel(name = "审核时间", needMerge = true, exportFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date checkGmtCreate;
+
+    @Excel(name = "操作类型", needMerge = true, replace = {"删改条目_0","新增已有条目_1","新增缺失条目_2","恢复条目_3"})
+    private String appealOperationType;
+
+    @Excel(name = "状态", needMerge = true, replace = {"待审核_0","已驳回_1","审核通过_2"})
+    private String exampleStatus;
+
+}

+ 57 - 0
src/main/java/com/diagbot/dto/ExportGetComplaintRecordDTO.java

@@ -0,0 +1,57 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 申述记录excle
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class ExportGetComplaintRecordDTO {
+
+//    @Excel(name = "申述id", needMerge = true)
+//    private Long id;
+
+    @Excel(name = "申诉人", needMerge = true)
+    private String claimantName;
+
+    @Excel(name = "所属科室", needMerge = true)
+    private String behDeptName;
+
+    @Excel(name = "申诉时间", needMerge = true, exportFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date claimantGmtCreate;
+
+    @Excel(name = "病人住院序号", needMerge = true)
+    private String behospitalCode;
+
+    @Excel(name = "患者姓名", needMerge = true)
+    private String name;
+
+    @Excel(name = "申诉模块", needMerge = true)
+    private String modeName;
+
+    @Excel(name = "缺陷详情", needMerge = true)
+    private String qcresultDetailMsg;
+
+    @Excel(name = "审核人", needMerge = true)
+    private String checkName;
+
+    @Excel(name = "审核时间", needMerge = true, exportFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date checkGmtCreate;
+
+    @Excel(name = "操作类型", needMerge = true, replace = {"删改条目_0","新增已有条目_1","新增缺失条目_2","恢复条目_3"})
+    private String appealOperationType;
+
+    @Excel(name = "状态", needMerge = true, replace = {"待审核_0","已驳回_1","审核通过_2"})
+    private String exampleStatus;
+}

+ 20 - 0
src/main/java/com/diagbot/dto/GetAppealDeptDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 申诉审核科室下拉列表返回对象
+ * @Author songxl
+ */
+@Data
+public class GetAppealDeptDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty(value = "科室id")
+    private String deptId;
+
+    @ApiModelProperty(value = "科室名称")
+    private String deptName;
+}

+ 72 - 0
src/main/java/com/diagbot/dto/GetAppealInfoDTO.java

@@ -0,0 +1,72 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 申诉审核内容对象
+ * @Author songxl
+ */
+@Data
+public class GetAppealInfoDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "医院ID")
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "病人住院ID")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "性别(男,女)")
+    private String sex;
+
+    @ApiModelProperty(value = "年龄")
+    private String age;
+
+    @ApiModelProperty(value = "住院科室ID")
+    private String deptId;
+
+    @ApiModelProperty(value = "住院科室名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "主管医生ID")
+    private String doctorId;
+
+    @ApiModelProperty(value = "主管医生ID")
+    private String doctorName;
+
+    @ApiModelProperty(value = "入院时间")
+    private Date behospitalDate;
+
+    @ApiModelProperty(value = "出院时间")
+    private Date leaveHospitalDate;
+
+    @ApiModelProperty(value = "申诉模块id")
+    private Long modeId;
+
+    @ApiModelProperty(value = "模块名称")
+    private String modeName;
+
+    @ApiModelProperty(value = "病历内容")
+    private String defectContent;
+
+    @ApiModelProperty(value = "质控缺陷id")
+    private Long qcresultDetailId;
+
+    @ApiModelProperty(value = "缺陷详情")
+    private String qcresultDetailMsg;
+
+    @ApiModelProperty(value = "缺陷扣分分值")
+    private BigDecimal qcresultDetaiValue;
+
+    @ApiModelProperty(value = "申诉审核记录")
+    private List<AppealExamineRecordDTO> appealExamineRecordDTOList;
+}

+ 20 - 0
src/main/java/com/diagbot/dto/GetAppealModeDTO.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 申诉审核模块下拉列表返回对象
+ * @Author songxl
+ */
+@Data
+public class GetAppealModeDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty(value = "申诉模块id")
+    private Long modeId;
+
+    @ApiModelProperty(value = "模块名称")
+    private String modeName;
+}

+ 67 - 0
src/main/java/com/diagbot/dto/GetAppealReviewDTO.java

@@ -0,0 +1,67 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 审核
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetAppealReviewDTO {
+
+    @ApiModelProperty(value = "申述id")
+    private Long id;
+
+    @ApiModelProperty(value = "申述人")
+    private String claimantName;
+
+    @ApiModelProperty(value = "所属科室")
+    private String behDeptName;
+
+    @ApiModelProperty(value = "医院id")
+    private String hospitalId;
+
+    @ApiModelProperty(value = "缺陷详情id")
+    private String qcresultDetailId;
+
+    @ApiModelProperty(value = "条目ID")
+    private String casesEntryId;
+
+    @ApiModelProperty(value = "申述申诉时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date claimantGmtCreate;
+
+    @ApiModelProperty(value = "病人住院序号")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "患者姓名")
+    private String name;
+
+    @ApiModelProperty(value = "申述模块")
+    private String modeName;
+
+    @ApiModelProperty(value = "缺陷详情")
+    private String qcresultDetailMsg;
+
+    @ApiModelProperty(value = "审核人")
+    private String checkName;
+
+    @ApiModelProperty(value = "审核时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date checkGmtCreate;
+
+    @ApiModelProperty(value = "操作类型")
+    private String appealOperationType;
+
+    @ApiModelProperty(value = "状态")
+    private String exampleStatus;
+
+}

+ 92 - 0
src/main/java/com/diagbot/dto/GetComplaintRecordDTO.java

@@ -0,0 +1,92 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 申述记录
+ *
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetComplaintRecordDTO {
+
+    @ApiModelProperty(value = "申述id")
+    private Long id;
+
+    @ApiModelProperty(value = "申述人")
+    private String claimantName;
+
+    @ApiModelProperty(value = "申述人ID")
+    private String claimantId;
+
+    @ApiModelProperty(value = "审核人ID")
+    private String checkId;
+
+    @ApiModelProperty(value = "所属科室")
+    private String behDeptName;
+
+    @ApiModelProperty(value = "申述申诉时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date claimantGmtCreate;
+
+    @ApiModelProperty(value = "病人住院序号")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "医院id")
+    private String hospitalId;
+
+    @ApiModelProperty(value = "缺陷详情id")
+    private String qcresultDetailId;
+
+    @ApiModelProperty(value = "条目ID")
+    private String casesEntryId;
+
+    @ApiModelProperty(value = "患者姓名")
+    private String name;
+
+    @ApiModelProperty(value = "申述模块")
+    private String modeName;
+
+    @ApiModelProperty(value = "缺陷详情")
+    private String qcresultDetailMsg;
+
+    @ApiModelProperty(value = "审核人")
+    private String checkName;
+
+    @ApiModelProperty(value = "审核时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date checkGmtCreate;
+
+    @ApiModelProperty(value = "操作类型")
+    private String appealOperationType;
+
+    @ApiModelProperty(value = "状态")
+    private String exampleStatus;
+
+    @ApiModelProperty(value = "审核处理方式: 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复")
+    private String exampleOperation;
+
+    @ApiModelProperty(value = "缺陷扣分分值")
+    private BigDecimal qcresultDetaiValue;
+
+    @ApiModelProperty(value = "模块总分")
+    private BigDecimal casesScore;
+
+    @ApiModelProperty(value = "单项否决(1-单项否决 0-非)")
+    private Integer isReject;
+
+    @ApiModelProperty(value = "模块id")
+    private Long modeId;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+}

+ 77 - 0
src/main/java/com/diagbot/dto/GetEntryDefectImproveDTO.java

@@ -0,0 +1,77 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.text.DecimalFormat;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Data
+public class GetEntryDefectImproveDTO {
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+
+    /**
+     * 科室名称
+     */
+    @Excel(name = "科室", width = 25d, orderNum = "1")
+    private String deptName;
+
+    /**
+     * 模块id
+     */
+    private String casesId;
+
+    /**
+     * 模块名称
+     */
+    @Excel(name = "模块名称", width = 15d, orderNum = "2")
+    private String casesName;
+
+    /**
+     * 缺陷id
+     */
+    private String entryId;
+
+    /**
+     * 缺陷名称
+     */
+    @Excel(name = "缺陷名称", width = 30d, orderNum = "3")
+    private String entryName;
+
+
+    /**
+     * 缺陷总数
+     */
+    @Excel(name = "总数量", width = 10d, orderNum = "4")
+    private Long totalNum = 0L;
+
+    /**
+     * 已改善数
+     */
+    @Excel(name = "已改善数量", width = 13d, orderNum = "5")
+    private Long handleNum = 0L;
+
+    /**
+     * 待改善数
+     */
+    @Excel(name = "待改善数量", width = 13d, orderNum = "6")
+    private Long improveleNum = 0L;
+
+    /**
+     * 改善率
+     */
+    @Excel(name = "改善率", width = 10d, orderNum = "7")
+    private String handleStr = "0.00%";
+
+}

+ 85 - 0
src/main/java/com/diagbot/dto/GetEntryDefectImproveDeptDTO.java

@@ -0,0 +1,85 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Data
+public class GetEntryDefectImproveDeptDTO {
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+
+    /**
+     * 科室名称
+     */
+    @Excel(name = "科室", width = 25d, orderNum = "1")
+    private String deptName;
+
+    /**
+     * 模块id
+     */
+    private String casesId;
+
+    /**
+     * 模块名称
+     */
+    @Excel(name = "模块名称", width = 15d, orderNum = "2")
+    private String casesName;
+
+    /**
+     * 缺陷id
+     */
+    private String entryId;
+
+    /**
+     * 缺陷名称
+     */
+    @Excel(name = "缺陷名称", width = 30d, orderNum = "3")
+    private String entryName;
+
+    /**
+     * 主管医生
+     */
+    @Excel(name = "主管医生", width = 10d, orderNum = "4")
+    private String doctorName;
+
+    /**
+     * 医师工号
+     */
+    @Excel(name = "医师工号", width = 10d, orderNum = "5")
+    private String doctorId;
+
+
+
+    /**
+     * 缺陷总数
+     */
+    @Excel(name = "总数量", width = 10d, orderNum = "6")
+    private Long totalNum=0L;
+
+    /**
+     * 已改善数
+     */
+    @Excel(name = "已改善数量", width = 13d, orderNum = "7")
+    private Long handleNum=0L;
+
+    /**
+     * 待改善数
+     */
+    @Excel(name = "待改善数量", width = 13d, orderNum = "8")
+    private Long improveleNum=0L;
+
+    /**
+     * 改善率
+     */
+    @Excel(name = "改善率", width = 10d, orderNum = "9")
+    private String handleStr= "0.00%";
+
+}

+ 35 - 0
src/main/java/com/diagbot/dto/GetEntryInfoDTO.java

@@ -0,0 +1,35 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class GetEntryInfoDTO {
+    /**
+     * 模块id
+     */
+    private String casesId;
+
+    /**
+     * 模块名称
+     */
+    private String casesName;
+
+    /**
+     * 缺陷id
+     */
+    private String entryId;
+
+    /**
+     * 缺陷名称
+     */
+    private String entryName;
+
+}

+ 40 - 0
src/main/java/com/diagbot/dto/GetQcClickDTO.java

@@ -0,0 +1,40 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetQcClickDTO implements Serializable {
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室名称
+     */
+    @Excel(name = "科室", width = 30d, orderNum = "1")
+    private String deptName;
+
+    /**
+     * 模块质控按钮点击数
+     */
+    @Excel(name = "模块质控按钮点击数", width = 20d,orderNum = "2")
+    private Integer singleModeNum;
+
+    /**
+     * 全病历质控按钮点击数
+     */
+    @Excel(name = "全病历质控按钮点击数", width = 20d,orderNum = "3")
+    private Integer totalModeNum;
+
+}

+ 52 - 0
src/main/java/com/diagbot/dto/GetQcClickInnerPageDTO.java

@@ -0,0 +1,52 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+/**
+ * @Description:
+ * @author: cy
+ * @time: 2020/9/4 14:59
+ */
+@Getter
+@Setter
+public class GetQcClickInnerPageDTO implements Serializable {
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+
+    /**
+     * 科室名称
+     */
+    @Excel(name = "科室", width = 30d, orderNum = "1")
+    private String deptName;
+
+    /**
+     * 医师id
+     */
+    @Excel(name = "医师工号", width = 10d, orderNum = "2")
+    private String doctorId;
+
+    /**
+     * 医师姓名
+     */
+    @Excel(name = "医师姓名", width = 10d, orderNum = "3")
+    private String doctorName;
+
+    /**
+     * 模块质控按钮点击数
+     */
+    @Excel(name = "模块质控按钮点击数", width = 20d,orderNum = "4")
+    private Integer singleModeNum;
+
+    /**
+     * 全病历质控按钮点击数
+     */
+    @Excel(name = "全病历质控按钮点击数", width = 20d,orderNum = "5")
+    private Integer totalModeNum;
+}

+ 22 - 0
src/main/java/com/diagbot/dto/GetReviewerDTO.java

@@ -0,0 +1,22 @@
+package com.diagbot.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 审核人对象
+ * @Author songxl
+ */
+@Data
+public class GetReviewerDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "审核人ID")
+    private Long id;
+
+    @ApiModelProperty(value = "审核人姓名")
+    private String userName;
+
+}

+ 5 - 0
src/main/java/com/diagbot/dto/HomePageNumDTO.java

@@ -29,6 +29,11 @@ public class HomePageNumDTO {
      * 主管医生名称
      */
     private String doctorName;
+
+    /**
+     * 主管医生职称
+     */
+    private String professor;
     /**
      * 缺陷条目数
      */

+ 138 - 0
src/main/java/com/diagbot/dto/HomePageNumXYDTO.java

@@ -0,0 +1,138 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:病案首页合格率占比返回结构
+ * @Author:zhaops
+ * @time: 2020/6/5 17:32
+ */
+@Getter
+@Setter
+public class HomePageNumXYDTO {
+    /**
+     * 科室id(科室编码)
+     */
+    private String deptId;
+    /**
+     * 科室名称
+     */
+    @Excel(name = "科室", width = 30, orderNum = "1")
+    private String deptName;
+
+
+    /**
+     * 主管医生职称
+     */
+    @Excel(name = "医师类别", width = 20, orderNum = "2")
+    private String professor;
+
+    /**
+     * 主管医生id
+     */
+    private String doctorId;
+    /**
+     * 主管医生名称
+     */
+    @Excel(name = "医师姓名", width = 20, orderNum = "3")
+    private String doctorName;
+    /**
+     * 缺陷条目数
+     */
+    @Excel(name = "缺陷总数", orderNum = "4")
+    private Integer entryNum = 0;
+    /**
+     * 病案首页不合格病历数
+     */
+    @Excel(name = "不合格数", orderNum = "5")
+    private Integer secondLevelNum = 0;
+
+    /**
+     * 质控评分(总分)
+     */
+    private Double totleValue = 0d;
+
+    /**
+     * 病案首页合格病历数
+     */
+    @Excel(name = "合格数", orderNum = "6")
+    private Integer firstLevelNum = 0;
+    /**
+     * 病案首页合格病历占比
+     */
+    private Double firstLevelPercent = 0.00d;
+    /**
+     * 病案首页不合格病历占比
+     */
+    private Double secondLevelPercent = 0.00d;
+    /**
+     * 病案首页合格病历占比(百分比)
+     */
+    @Excel(name = "合格率", orderNum = "7")
+    private String firstLevelPercentStr = "0.00%";
+    /**
+     * 病案首页不合格病历占比(百分比)
+     */
+    private String secondLevelPercentStr = "0.00%";
+    /**
+     * 上级科室id(上级科室编码)
+     */
+    private String deptClassId;
+    /**
+     * 上级科室名称
+     */
+    private String deptClass;
+    /**
+     * 空项数
+     */
+    @Excel(name = "空项数", orderNum = "8")
+    private Integer emptyNum = 0;
+
+    /**
+     * 完整率
+     */
+
+    private Double emptyPercent = 0.00d;
+
+    /**
+     * 完整率(百分比)
+     */
+    @Excel(name = "完整率", orderNum = "9")
+    private String emptyPercentStr = "0.00%";
+
+    /**
+     * 错误数
+     */
+    @Excel(name = "错误数", orderNum = "10")
+    private Integer errorNum = 0;
+
+    /**
+     * 完整率、完善率分母(质控病历数*病案首页条目数)
+     */
+    private Integer entryTotleNum = 0;
+
+    /**
+     * 完善率
+     */
+    private Double errorPercent = 0.00d;
+
+    /**
+     * 完善率(百分比)
+     */
+    @Excel(name = "完善率", orderNum = "11")
+    private String errorPercentStr = "0.00%";
+
+    /**
+     * 质控评分(平均分)
+     */
+    @Excel(name = "质控平均分", orderNum = "12")
+    private Double averageValue = 0d;
+
+    /**
+     * 质控病历数
+     */
+    @Excel(name = "质控病历数", orderNum = "13")
+    private Integer mrNum = 0;
+}

+ 40 - 0
src/main/java/com/diagbot/dto/MedRecordContentOtherDTO.java

@@ -0,0 +1,40 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author Wsy
+ * @since 2022-03-09
+ */
+@Getter
+@Setter
+public class MedRecordContentOtherDTO implements Serializable {
+
+    /**
+     * 病历ID
+     */
+    private String recId;
+
+    /**
+     * 文书内容
+     */
+    private String htmlText;
+
+    /**
+     * 创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 修改时间(如果时间是1970年则表示纪录未修改)
+     */
+    private Date gmtModified;
+}

+ 26 - 0
src/main/java/com/diagbot/dto/MsgApiDTO.java

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -13,6 +14,8 @@ import java.math.BigDecimal;
 @Getter
 @Setter
 public class MsgApiDTO {
+    //明细主键
+    private Long id;
     //得分
     private BigDecimal score;
     //提示信息
@@ -21,4 +24,27 @@ public class MsgApiDTO {
     private String isReject;
     //模块名称
     private String modelName;
+    //模块id
+    private String modelId;
+    //模块ID
+    private Long casesId;
+    //模块分数
+    private BigDecimal casesScore;
+    // 条目ID
+    private Long casesEntryId;
+
+    @ApiModelProperty("申诉条目id")
+    private Long appealInfoId;
+
+    @ApiModelProperty("审核状态 0:待审核|1:驳回|2:通过")
+    private String exampleStatus;
+
+    @ApiModelProperty(value = "操作类型")
+    private String appealOperationType;
+
+    @ApiModelProperty(value = "缺陷说明")
+    private String explainInfo;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
 }

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

@@ -1,5 +1,6 @@
 package com.diagbot.dto;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -62,4 +63,22 @@ public class MsgDTO {
     private String explainInfo;
     // 条目id对应页面数据的key值
     private List<Long> pageKeyList = new ArrayList<>();
+
+    @ApiModelProperty("申诉条目id")
+    private Long appealInfoId;
+
+    @ApiModelProperty("审核状态 0:待审核|1:驳回|2:通过")
+    private String exampleStatus;
+
+    @ApiModelProperty(value = "操作类型")
+    private String appealOperationType;
+
+    @ApiModelProperty(value = "审核人")
+    private String reviewer;
+
+    @ApiModelProperty(value = "审核时间")
+    private Date exampleDate;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
 }

+ 38 - 0
src/main/java/com/diagbot/dto/QcCasesHistoryDTO.java

@@ -0,0 +1,38 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/4/12 13:58
+ */
+@Getter
+@Setter
+public class QcCasesHistoryDTO {
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 评分人
+     */
+    private String name;
+
+    /**
+     * 模块总分
+     */
+    private BigDecimal scoreRes;
+
+    /**
+     * 病历等级
+     */
+    private String level;
+
+}

+ 20 - 0
src/main/java/com/diagbot/dto/QcResultDetailInfo.java

@@ -0,0 +1,20 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: cy
+ * @time: 2021/12/2 11:04
+ */
+@Data
+public class QcResultDetailInfo {
+
+    /**
+     * 触发埋点病历质控缺陷id集
+     */
+    private String CasesEntryIds;
+
+}

+ 35 - 0
src/main/java/com/diagbot/dto/StrAdmissionNoteDTO.java

@@ -0,0 +1,35 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 入院记录
+ * </p>
+ *
+ * @author cy
+ * @since 2020-10-09
+ */
+@Data
+public class StrAdmissionNoteDTO implements Serializable {
+
+
+    /**
+     * 记录编号
+     */
+    private String recId;
+
+
+    /**
+     * 结构化数据
+     */
+    private String wholeData;
+
+    /**
+     * modeId
+     */
+    private String modeId;
+
+}

+ 5 - 0
src/main/java/com/diagbot/entity/BehospitalInfo.java

@@ -158,6 +158,11 @@ public class BehospitalInfo implements Serializable {
      */
     private Date placefileDate;
 
+    /**
+     * R-住院登记I-病房接诊B-出院登记O-出院结算P-预约出院N-无费退院
+     */
+    private String inState;
+
     /**
      * 是否删除,N:未删除,Y:删除
      */

+ 6 - 0
src/main/java/com/diagbot/entity/HomeDiagnoseInfo.java

@@ -33,6 +33,12 @@ public class HomeDiagnoseInfo implements Serializable {
      */
     private Long hospitalId;
 
+    /**
+     * 中西医类别(0 西医 1中医)
+     */
+
+    private String chineseWesternType;
+
     /**
      * 诊断序号
      */

+ 40 - 0
src/main/java/com/diagbot/entity/HomePage.java

@@ -278,16 +278,56 @@ public class HomePage implements Serializable {
      */
     private String behospitalDayNum;
 
+    /**
+     * 治疗类别(1.中医<1.1 中医;1.2 民族医>、2.中西医、3.西医 )
+     */
+    private String treatmentType;
+
     /**
      * 门急诊诊断
      */
     private String outpatientEmrDiagnose;
 
+    /**
+     * 门急诊诊断(中医)
+     */
+    private String outpatientEmrChDiagnose;
+
     /**
      * 门急诊诊断编码
      */
     private String outpatientEmrDiagnoseCode;
 
+    /**
+     * 门急诊诊断编码(中医)
+     */
+    private String outpatientEmrChDiagnoseCode;
+
+    /**
+     * 实施临床路径(1中医、2西医、3否)
+     */
+    private String implementationClinicalPathway;
+
+    /**
+     * 使用医疗机构中药制剂(1是、2否)
+     */
+    private String isChineseMedicinePreparation;
+
+    /**
+     * 使用中医诊疗设备(1是、2否)
+     */
+    private String isChineseDiagnoseEquipment;
+
+    /**
+     * 使用中医诊疗技术(1是 、2否)
+     */
+    private String isChineseDiagnoseTechnology;
+
+    /**
+     * 辩证施护(1是、2否)
+     */
+    private String dialecticalNursing;
+
     /**
      * 损伤中毒因素
      */

+ 61 - 0
src/main/java/com/diagbot/entity/ImageCaptchaParams.java

@@ -0,0 +1,61 @@
+package com.diagbot.entity;
+import lombok.Data;
+
+
+/**
+ * @Author chengyao
+ * @Date 2021/10/14 19:57
+ * @Version 1.0
+ */
+
+@Data
+public class ImageCaptchaParams {
+    /**
+     * 默认图片验证码的文字内容
+     */
+    public static final String DEFAULT_WORDS = "123456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
+    public static final String DEFAULT_FORMAT = "png";
+    /**
+     * 图片验证码宽度
+     */
+    private int width;
+    /**
+     * 图片验证码高度
+     */
+    private int height;
+    /**
+     * 最多生成几个文字
+     */
+    private int maxWordAmount;
+    /**
+     * 最小生成几个文字
+     */
+    private int minWordAmount;
+    /**
+     * 字体最大尺寸
+     */
+    private int maxFontSize;
+    /**
+     * 文字最小尺寸
+     */
+    private int minFontSize;
+    /**
+     * 生成图片验证码内容的字体
+     */
+    private String words;
+    /**
+     * 图片类型
+     */
+    private String format;
+
+    public ImageCaptchaParams(){
+        this.width = 105;
+        this.height = 35;
+        this.maxWordAmount = 4;
+        this.minWordAmount = 4;
+        this.minFontSize = 24;
+        this.maxFontSize = 25;
+        this.words = DEFAULT_WORDS;
+        this.format = DEFAULT_FORMAT;
+    }
+}

+ 103 - 0
src/main/java/com/diagbot/entity/MedAppealExamineInfo.java

@@ -0,0 +1,103 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 申诉审批表
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-01-20
+ */
+@Getter
+@Setter
+public class MedAppealExamineInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 申诉审批id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 申诉id
+     */
+    private Long appealInfoId;
+
+    /**
+     * 审核人id
+     */
+    private Long checkId;
+
+    /**
+     * 审核状态:1:驳回|2:通过
+     */
+    private String exampleStatus;
+
+    /**
+     * 审核处理方式: 1:修改|2:删除|3:新增已有|4:新增缺失|5:恢复
+     */
+    private String exampleOperation;
+
+    /**
+     * 审核分值
+     */
+    private BigDecimal value;
+
+    /**
+     * 处理结果
+     */
+    private String processResult;
+
+    /**
+     * 驳回理由
+     */
+    private String rejectReason;
+
+    /**
+     * 提示信息
+     */
+    private String msg;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 145 - 0
src/main/java/com/diagbot/entity/MedAppealInfo.java

@@ -0,0 +1,145 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 申诉记录表
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-01-20
+ */
+@Data
+public class MedAppealInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 质控缺陷id
+     */
+    private Long qcresultDetailId;
+
+    /**
+     * 缺陷详情
+     */
+    private String qcresultDetailMsg;
+
+    /**
+     * 缺陷扣分分值
+     */
+    private BigDecimal qcresultDetaiValue;
+
+    /**
+     * 条目ID
+     */
+    private Long casesEntryId;
+
+    /**
+     * 质控条目(新增已有操作才有值)
+     */
+    private String casesEntryName;
+
+    /**
+     * 提示信息(新增已有操作才有值)
+     */
+    private String casesEntryMsg;
+
+    /**
+     * 分值(新增已有操作才有值)
+     */
+    private BigDecimal value;
+
+    /**
+     * 申诉模块id
+     */
+    private Long modeId;
+
+    /**
+     * 模块名称
+     */
+    private String modeName;
+
+    /**
+     * 病历内容
+     */
+    private String defectContent;
+
+    /**
+     * 申诉人id
+     */
+    private String claimantId;
+
+    /**
+     * 申诉类型(0:医生申诉|1:质控申诉)
+     */
+    private String appealType;
+
+    /**
+     * 申诉操作类型(0:删改|1:新增已有|2:新增缺失|3:恢复)
+     */
+    private String appealOperationType;
+
+    /**
+     * 申诉说明
+     */
+    private String appealExplain;
+
+    /**
+     * 审核人id
+     */
+    private Long checkId;
+
+    /**
+     * 当前工作流节点id
+     */
+    private Long workFlowNodeId;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private LocalDateTime gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private LocalDateTime gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+}

+ 92 - 0
src/main/java/com/diagbot/entity/MedClickInfo.java

@@ -0,0 +1,92 @@
+package com.diagbot.entity;
+
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 医生点击质控病历次数基本表
+ * </p>
+ *
+ * @author cy
+ * @since 2021-11-10
+ */
+@Data
+public class MedClickInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 科室ID
+     */
+    private String deptId;
+
+    /**
+     * 科室名称
+     */
+    private String deptName;
+
+    /**
+     * 医生ID
+     */
+    private String doctorId;
+
+    /**
+     * 医生姓名
+     */
+    private String doctorName;
+
+    /**
+     * 0-单模块质控 1-全病历质控
+     */
+    private Long optType;
+
+    /**
+     * 质控结果基本信息ID
+     */
+    private Long qcresultInfoId;
+
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     *  记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     *  记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+}

+ 6 - 0
src/main/java/com/diagbot/entity/MedQcresultCases.java

@@ -2,6 +2,7 @@ package com.diagbot.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -15,6 +16,7 @@ import java.util.Date;
  * @author gaodm
  * @since 2020-05-19
  */
+@Data
 public class MedQcresultCases implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -26,6 +28,10 @@ public class MedQcresultCases implements Serializable {
      * 医院ID
      */
     private Long hospitalId;
+    /**
+     * 评分结果ID
+     */
+    private Long qcresultInfoId;
 
     /**
      * 病人住院ID

+ 61 - 0
src/main/java/com/diagbot/entity/MedQcresultClick.java

@@ -0,0 +1,61 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-12-02
+ */
+@Data
+public class MedQcresultClick implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 住院号
+     */
+    private String behospitalCode;
+
+    /**
+     * 科室id
+     */
+    private String deptId;
+
+    /**
+     * 科室name
+     */
+    private String deptName;
+
+
+    /**
+     * 评分结果id
+     */
+    private Long qcresultInfoId;
+
+    /**
+     * 触发埋点病历质控缺陷id集
+     */
+    private String CasesEntryIds;
+
+    /**
+     *  记录创建时间
+     */
+    private Date gmtCreate;
+}

+ 4 - 0
src/main/java/com/diagbot/entity/QcresultDetail.java

@@ -31,6 +31,10 @@ public class QcresultDetail implements Serializable {
      * 医院ID
      */
     private Long hospitalId;
+    /**
+     * 评分结果ID
+     */
+    private Long qcresultInfoId;
 
     /**
      * 病人住院ID

+ 77 - 0
src/main/java/com/diagbot/entity/WorkFlowInfo.java

@@ -0,0 +1,77 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 流程表 实体类
+ * </p>
+ */
+@Data
+@TableName("med_work_flow_info")
+public class WorkFlowInfo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 医院ID
+     */
+    @TableField("hospital_id")
+    private Long hospitalId;
+
+    /**
+     * 流程名称
+     */
+    @TableField("work_flow_name")
+    private String workFlowName;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    @TableField("is_deleted")
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    @TableField("gmt_create")
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    @TableField("gmt_modified")
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    @TableField("creator")
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    @TableField("modifier")
+    private String modifier;
+
+    /**
+     * 备注
+     */
+    @TableField("remark")
+    private String remark;
+
+}

+ 52 - 0
src/main/java/com/diagbot/entity/operationLog.java

@@ -0,0 +1,52 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 医院科室信息
+ * </p>
+ *
+ * @author gaodm
+ * @since 2020-04-27
+ */
+@Data
+public class operationLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    /**
+     * 序号
+     */
+    private String id;
+    /**
+     * 操作时间
+     */
+    private String gmtCreate;
+    /**
+     * 操作类型
+     */
+    private String Type;
+    /**
+     * 操作模块
+     */
+    private String module;
+    /**
+     * 操作账号
+     */
+    private String account;
+    /**
+     * IP地址
+     */
+    private String IPAddress;
+    /**
+     * 操作内容
+     */
+    private String content;
+
+
+}

+ 44 - 0
src/main/java/com/diagbot/enums/AppealOperationTypeEnum.java

@@ -0,0 +1,44 @@
+package com.diagbot.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 工作流节点
+ * @author: gaodm
+ * @time: 2018/9/3 16:01
+ */
+public enum AppealOperationTypeEnum {
+
+    UP_OR_DEL("0", "删改"),
+    ADD_EXIST("1", "新增已有"),
+    ADD_NO_EXIST("2", "新增缺失"),
+    RECOVER("3", "恢复");
+
+    @Getter
+    @Setter
+    private String key;
+
+    @Getter
+    @Setter
+    private String name;
+
+    AppealOperationTypeEnum(String key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static AppealOperationTypeEnum getEnum(String key) {
+        for (AppealOperationTypeEnum item : AppealOperationTypeEnum.values()) {
+            if (item.key.equals(key)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(String key) {
+        AppealOperationTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+}

+ 44 - 0
src/main/java/com/diagbot/enums/ExampleOperationEnum.java

@@ -0,0 +1,44 @@
+package com.diagbot.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 审核状态
+ * @author: gaodm
+ * @time: 2018/9/3 16:01
+ */
+public enum ExampleOperationEnum {
+    UP_OR_UP("1", "修改"),
+    UP_OR_DEL("2", "删除"),
+    ADD_EXIST("3", "新增已有"),
+    ADD_NO_EXIST("4", "新增缺失"),
+    RECOVER("5", "恢复");
+
+    @Getter
+    @Setter
+    private String key;
+
+    @Getter
+    @Setter
+    private String name;
+
+    ExampleOperationEnum(String key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ExampleOperationEnum getEnum(String key) {
+        for (ExampleOperationEnum item : ExampleOperationEnum.values()) {
+            if (item.key.equals(key)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(String key) {
+        ExampleOperationEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+}

+ 43 - 0
src/main/java/com/diagbot/enums/ExampleStatusEnum.java

@@ -0,0 +1,43 @@
+package com.diagbot.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 审核状态
+ * @author: gaodm
+ * @time: 2018/9/3 16:01
+ */
+public enum ExampleStatusEnum {
+
+    NOT_EXAMPLE("0", "待审核"),
+    REJECT_EXAMPLE("1", "驳回"),
+    ADOPT_EXAMPLE("2", "审核通过");
+
+    @Getter
+    @Setter
+    private String key;
+
+    @Getter
+    @Setter
+    private String name;
+
+    ExampleStatusEnum(String key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ExampleStatusEnum getEnum(String key) {
+        for (ExampleStatusEnum item : ExampleStatusEnum.values()) {
+            if (item.key.equals(key)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(String key) {
+        ExampleStatusEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+}

+ 43 - 0
src/main/java/com/diagbot/enums/WorkFlowNodeEnum.java

@@ -0,0 +1,43 @@
+package com.diagbot.enums;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 工作流节点
+ * @author: gaodm
+ * @time: 2018/9/3 16:01
+ */
+public enum WorkFlowNodeEnum {
+
+    APPEAL("1", "申诉"),
+    APPEAL_BACK("2", "撤销申诉"),
+    DEPT_CHECK("3", "科室审核");
+
+    @Getter
+    @Setter
+    private String key;
+
+    @Getter
+    @Setter
+    private String name;
+
+    WorkFlowNodeEnum(String key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static WorkFlowNodeEnum getEnum(String key) {
+        for (WorkFlowNodeEnum item : WorkFlowNodeEnum.values()) {
+            if (item.key.equals(key)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(String key) {
+        WorkFlowNodeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+}

+ 3 - 0
src/main/java/com/diagbot/exception/CommonExceptionHandler.java

@@ -73,6 +73,9 @@ public class CommonExceptionHandler {
         }
         resp.code = CommonErrorCode.FAIL.getCode();
         resp.msg = e.getMessage();
+        if (resp.msg == null) {
+            resp.msg = "操作异常,请联系管理员!!!";
+        }
         log.error("【系统异常】:{}", e.getMessage());
         e.printStackTrace();
         return new ResponseEntity(resp, HttpStatus.OK);

+ 3 - 0
src/main/java/com/diagbot/exception/ServiceErrorCode.java

@@ -12,6 +12,9 @@ public enum ServiceErrorCode implements ErrorCode {
     USER_PASSWORD_ERROR("10020001", "账号或密码不正确"),
     GET_TOKEN_FAIL("10020002", "获取token失败"),
     TOKEN_IS_NOT_MATCH_USER("10020003", "请使用自己的token进行接口请求"),
+    LONGIN_ERROE("10020012", "您的账号在其它地方已登录,您已被迫下线,请重新登录。如非本人授权,登录后请及时修改密码。"),
+    USER_POWER_UP("10020012", "您的权限已被管理员修改,您已被迫下线,请重新登录。"),
+    LONGIN_TOKEN_ERROE("10020013", "登录异常"),
 
     SMS_SEND_ERROR("10020004", "短信发送错误"),
     USER_BIND_ERROR("10020005", "用户手机号已经绑定无需再次验证"),

+ 26 - 18
src/main/java/com/diagbot/facade/AlgorithmFacade.java

@@ -197,7 +197,11 @@ public class AlgorithmFacade {
                 }
                 qcResultAlgVOList.add(algorithmVO.getOptResultAlgVO());
             }
-
+            if(ListUtil.isEmpty(qcResultAlgVOList)){
+                qcResultAlgVOList = new ArrayList<>();
+                qcResultAlgVOList.add(algorithmVO.getOptResultAlgVO());
+                algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
+            }
         }
         //删除
         else if (algorithmVO.getType().equals(2)||(algorithmVO.getType().equals(4)&&0==algorithmVO.getDelStatus())) {
@@ -226,28 +230,32 @@ public class AlgorithmFacade {
                 throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "恢复操作条目不能为空!");
             }
             //操作数据
-            if (ListUtil.isNotEmpty(qcResultAlgVOList)) {
-                Boolean hasData = false;
-                Long optId = algorithmVO.getOptResultAlgVO().getId(); // 操作id
-                QcresultDetail qcresultDetail = qcresultDetailFacade.getOne(new QueryWrapper<QcresultDetail>()
-                        .eq("id",optId));
-                if(qcresultDetail!=null)
-                {
-                    QcResultAlgVO qcResultAlgVO = new QcResultAlgVO();
-                    qcResultAlgVO.setScore(qcresultDetail.getScore());
-                    qcResultAlgVO.setId(qcresultDetail.getId());
-                    qcResultAlgVO.setCasesEntryId(qcresultDetail.getCasesEntryId());
-                    qcResultAlgVO.setCasesId(qcresultDetail.getCasesId());
-                    qcResultAlgVO.setMsg(qcresultDetail.getMsg());
-                    qcResultAlgVO.setIsReject(qcresultDetail.getIsReject());
-                    qcResultAlgVO.setCasesScore(qcresultDetail.getCasesScore());
+            Boolean hasData = false;
+            Long optId = algorithmVO.getOptResultAlgVO().getId(); // 操作id
+            QcresultDetail qcresultDetail = qcresultDetailFacade.getOne(new QueryWrapper<QcresultDetail>()
+                    .eq("id",optId));
+            if(qcresultDetail!=null)
+            {
+                QcResultAlgVO qcResultAlgVO = new QcResultAlgVO();
+                qcResultAlgVO.setScore(qcresultDetail.getScore());
+                qcResultAlgVO.setId(qcresultDetail.getId());
+                qcResultAlgVO.setCasesEntryId(qcresultDetail.getCasesEntryId());
+                qcResultAlgVO.setCasesId(qcresultDetail.getCasesId());
+                qcResultAlgVO.setMsg(qcresultDetail.getMsg());
+                qcResultAlgVO.setIsReject(qcresultDetail.getIsReject());
+                qcResultAlgVO.setCasesScore(qcresultDetail.getCasesScore());
+                if (ListUtil.isNotEmpty(qcResultAlgVOList)) {
+                    qcResultAlgVOList.add(qcResultAlgVO);
+                }else{
+                    qcResultAlgVOList = new ArrayList<>();
                     qcResultAlgVOList.add(qcResultAlgVO);
-                    hasData = true;
+                    algorithmVO.setQcResultAlgVOList(qcResultAlgVOList);
                 }
+                hasData = true;
+            }
                 if (!hasData) {
                     throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "恢复的条目不存在!");
                 }
-            }
         }
 
         //修改

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

@@ -4,6 +4,7 @@ import com.diagbot.dto.BasDeptInfoDTO;
 import com.diagbot.service.impl.BasDeptInfoServiceImpl;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.BasDeptInfoVO;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -24,10 +25,23 @@ public class BasDeptInfoFacade extends BasDeptInfoServiceImpl {
      */
     public List<BasDeptInfoDTO> listForUser(BasDeptInfoVO basDeptInfoVO) {
         basDeptInfoVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
+        listForUserSet(basDeptInfoVO);
         List<BasDeptInfoDTO> basDeptInfoDTOList = this.getList(basDeptInfoVO);
         return basDeptInfoDTOList;
     }
-
+    private void listForUserSet(BasDeptInfoVO basDeptInfoVO) {
+        if (StringUtils.isNotBlank(basDeptInfoVO.getInputStr())) {
+            String tranStr = basDeptInfoVO.getInputStr();
+            if( tranStr.contains("%")){
+                tranStr = tranStr.replace("%", "\\%");
+                basDeptInfoVO.setInputStr(tranStr);
+            }
+            if( tranStr.contains("_")){
+                tranStr = tranStr.replace("_","\\_");
+                basDeptInfoVO.setInputStr(tranStr);
+            }
+        }
+    }
 
     /**
      * 获取医院用户下拉列表信息

+ 4 - 0
src/main/java/com/diagbot/facade/BasDoctorInfoFacade.java

@@ -15,6 +15,7 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @Description:
@@ -28,8 +29,11 @@ public class BasDoctorInfoFacade extends BasDoctorInfoServiceImpl {
     @Autowired
     BasDeptInfoFacade basDeptInfoFacade;
     @Autowired
+    BasDoctorInfoFacade basDoctorInfoFacade;
+    @Autowired
     BehospitalInfoFacade behospitalInfoFacade;
 
+
     /**
      * 获取医院医生下拉列表信息
      *

File diff ditekan karena terlalu besar
+ 447 - 239
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java


+ 76 - 120
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -11,6 +11,7 @@ import com.diagbot.exception.CommonException;
 import com.diagbot.util.*;
 import com.diagbot.vo.*;
 import com.google.common.collect.Lists;
+import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -44,6 +45,8 @@ public class ConsoleByDeptFacade {
     private SysHospitalSetFacade sysHospitalSetFacade;
     @Autowired
     private QcCasesEntryFacade qcCasesEntryFacade;
+    @Autowired
+    private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
 
 
     /**
@@ -60,40 +63,13 @@ public class ConsoleByDeptFacade {
         if (deptMap == null) {
             return retMap;
         }
-        //出院总人数
-        List<NumDTO> totleNumList = behospitalInfoFacade.leaveHosCountByDept(filterVO);
-        Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(totleNumList, "name");
-        Map<String, NumDTO> deathMap = new HashMap<>();
-        Map<String, NumDTO> operationMap = new HashMap<>();
-        //终末--死亡人数/手术病人数
-            //死亡人数
-            List<NumDTO> deathNumList = behospitalInfoFacade.deathCountByDept(filterVO);
-             deathMap = ListUtil.isEmpty(deathNumList)
-                    ? new HashMap<>()
-                    : EntityUtil.makeEntityMap(deathNumList, "name");
-            //手术人数
-            List<NumDTO> operationNumList = behospitalInfoFacade.operationCountByDept(filterVO);
-             operationMap = ListUtil.isEmpty(operationNumList)
-                    ? new HashMap<>()
-                    : EntityUtil.makeEntityMap(operationNumList, "name");
-
-        for (String deptName : deptMap.keySet()) {
-            Map<String, Object> map = new LinkedHashMap<>();
-            map.put("总人数", 0);
-            map.put("死亡人数", 0);
-            map.put("手术病人数", 0);
-            if (totleMap.containsKey(deptName)) {
-                map.put("总人数", totleMap.get(deptName).getNum());
-            }
-            if(deathMap.containsKey(deptName)) {
-                map.put("死亡人数", deathMap.get(deptName).getNum());
-            }
-            if(operationMap.containsKey(deptName)) {
-                map.put("手术病人数", operationMap.get(deptName).getNum());
-            }
-            retMap.put(deptName, map);
+        try {
+            Map<String, Object> invokeParams = new HashMap<>();
+            invokeParams.put("filterVO", filterVO);
+            retMap  = dataBeanAggregateQueryFacade.get("setAllLeaveHosCount", invokeParams, Map.class);
+            long L2 = System.currentTimeMillis();
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
         }
         return retMap;
     }
@@ -123,98 +99,78 @@ public class ConsoleByDeptFacade {
         DecimalFormat df = new DecimalFormat("#0.00");
         Map<String, Object> retMap = new LinkedHashMap<>();
         filterFacade.filterVOSet(filterVO);
-        QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
-        BeanUtil.copyProperties(filterVO, qcresultFilterVO);
         //关联科室
         Map<String, Object> deptMap = getDeptByUser(filterVO);
         if (deptMap == null) {
             return retMap;
         }
-        //质控病历总数
-        List<NumDTO> totleNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> totleMap = ListUtil.isEmpty(totleNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(totleNumList, "name");
-        //甲级病历
-        qcresultFilterVO.setLevel("甲");
-        List<NumDTO> firstNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> firstMap = ListUtil.isEmpty(firstNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(firstNumList, "name");
-        //乙级病历
-        qcresultFilterVO.setLevel("乙");
-        List<NumDTO> secondNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> secondMap = ListUtil.isEmpty(secondNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(secondNumList, "name");
-        //丙级病历
-        qcresultFilterVO.setLevel("丙");
-        List<NumDTO> thirdNumList = qcresultInfoFacade.resultCountByDept(qcresultFilterVO);
-        Map<String, NumDTO> thirdMap = ListUtil.isEmpty(thirdNumList)
-                ? new HashMap<>()
-                : EntityUtil.makeEntityMap(thirdNumList, "name");
-        for (String deptName : deptMap.keySet()) {
-            List<NumDTO> retList = Lists.newLinkedList();
-            int totleNum = 0;
-            int firstLevelNum = 0;
-            int secondLevelNum = 0;
-            int thirdLevelNum = 0;
-            if (totleMap.containsKey(deptName)) {
-                totleNum = totleMap.get(deptName).getNum();
-            }
-            if (firstMap.containsKey(deptName)) {
-                firstLevelNum = firstMap.get(deptName).getNum();
-            }
-            if (secondMap.containsKey(deptName)) {
-                secondLevelNum = secondMap.get(deptName).getNum();
-            }
-            if (thirdMap.containsKey(deptName)) {
-                thirdLevelNum = thirdMap.get(deptName).getNum();
-            }
-            //总病历数为0
-            if (totleNum == 0) {
-                retMap.put(deptName, Lists.newLinkedList());
-                continue;
+        QcresultFilterVO qcresultFilterVO = new QcresultFilterVO();
+        BeanUtil.copyProperties(filterVO, qcresultFilterVO);
+        //质控病历数
+        List<Map<String,Object>> maps = qcresultInfoFacade.resultMrCountByDept(qcresultFilterVO);
+        if(ListUtil.isEmpty(maps)){
+            return retMap;
+        }
+        for (Map<String, Object> map : maps) {
+            if(null != map.get("NAME") && StringUtils.isNotBlank(map.get("NAME").toString()) && deptMap.containsKey(map.get("NAME").toString())){
+                List<NumDTO> retList = Lists.newLinkedList();
+                int totleNum = 0;
+                int firstLevelNum = 0;
+                int secondLevelNum = 0;
+                int thirdLevelNum = 0;
+                if(null != map.get("num")){
+                    totleNum = Integer.parseInt(map.get("num").toString());
+                }
+                if(null != map.get("firNum")){
+                    firstLevelNum = Integer.parseInt(map.get("firNum").toString());
+                }
+                if(null != map.get("secNum")){
+                    secondLevelNum = Integer.parseInt(map.get("secNum").toString());
+                }
+                if(null != map.get("thrNum")){
+                    thirdLevelNum = Integer.parseInt(map.get("thrNum").toString());
+                }
+
+                NumDTO totleNumDTO = new NumDTO();
+                totleNumDTO.setName("累计质控病历数");
+                totleNumDTO.setTotleNum(totleNum);
+                totleNumDTO.setNum(totleNum);
+                NumDTO firstLevelNumDTO = new NumDTO();
+                firstLevelNumDTO.setName("甲级病历");
+                firstLevelNumDTO.setNum(firstLevelNum);
+                firstLevelNumDTO.setTotleNum(totleNum);
+                Double firstPercent = BigDecimal.valueOf(firstLevelNum)
+                        .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
+                        .doubleValue();
+                String firstPercentStr = df.format(BigDecimal.valueOf(firstPercent).multiply(BigDecimal.valueOf(100))) + "%";
+                firstLevelNumDTO.setPercent(firstPercent);
+                firstLevelNumDTO.setPercentStr(firstPercentStr);
+                NumDTO secondLevelNumDTO = new NumDTO();
+                secondLevelNumDTO.setName("乙级病历");
+                secondLevelNumDTO.setNum(secondLevelNum);
+                secondLevelNumDTO.setTotleNum(totleNum);
+                Double secondPercent = BigDecimal.valueOf(secondLevelNum)
+                        .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
+                        .doubleValue();
+                String secondPercentStr = df.format(BigDecimal.valueOf(secondPercent).multiply(BigDecimal.valueOf(100))) + "%";
+                secondLevelNumDTO.setPercent(secondPercent);
+                secondLevelNumDTO.setPercentStr(secondPercentStr);
+                NumDTO thirdLevelNumDTO = new NumDTO();
+                thirdLevelNumDTO.setName("丙级病历");
+                thirdLevelNumDTO.setNum(thirdLevelNum);
+                thirdLevelNumDTO.setTotleNum(totleNum);
+                Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
+                        .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
+                        .doubleValue();
+                String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
+                thirdLevelNumDTO.setPercent(thirdPercent);
+                thirdLevelNumDTO.setPercentStr(thirdPercentStr);
+                retList.add(totleNumDTO);
+                retList.add(firstLevelNumDTO);
+                retList.add(secondLevelNumDTO);
+                retList.add(thirdLevelNumDTO);
+                retMap.put(map.get("NAME").toString(), retList);
             }
-            NumDTO totleNumDTO = new NumDTO();
-            totleNumDTO.setName("累计质控病历数");
-            totleNumDTO.setTotleNum(totleNum);
-            totleNumDTO.setNum(totleNum);
-            NumDTO firstLevelNumDTO = new NumDTO();
-            firstLevelNumDTO.setName("甲级病历");
-            firstLevelNumDTO.setNum(firstLevelNum);
-            firstLevelNumDTO.setTotleNum(totleNum);
-            Double firstPercent = BigDecimal.valueOf(firstLevelNum)
-                    .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
-                    .doubleValue();
-            String firstPercentStr = df.format(BigDecimal.valueOf(firstPercent).multiply(BigDecimal.valueOf(100))) + "%";
-            firstLevelNumDTO.setPercent(firstPercent);
-            firstLevelNumDTO.setPercentStr(firstPercentStr);
-            NumDTO secondLevelNumDTO = new NumDTO();
-            secondLevelNumDTO.setName("乙级病历");
-            secondLevelNumDTO.setNum(secondLevelNum);
-            secondLevelNumDTO.setTotleNum(totleNum);
-            Double secondPercent = BigDecimal.valueOf(secondLevelNum)
-                    .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
-                    .doubleValue();
-            String secondPercentStr = df.format(BigDecimal.valueOf(secondPercent).multiply(BigDecimal.valueOf(100))) + "%";
-            secondLevelNumDTO.setPercent(secondPercent);
-            secondLevelNumDTO.setPercentStr(secondPercentStr);
-            NumDTO thirdLevelNumDTO = new NumDTO();
-            thirdLevelNumDTO.setName("丙级病历");
-            thirdLevelNumDTO.setNum(thirdLevelNum);
-            thirdLevelNumDTO.setTotleNum(totleNum);
-            Double thirdPercent = BigDecimal.valueOf(thirdLevelNum)
-                    .divide(BigDecimal.valueOf(totleNum), 4, RoundingMode.HALF_UP)
-                    .doubleValue();
-            String thirdPercentStr = df.format(BigDecimal.valueOf(thirdPercent).multiply(BigDecimal.valueOf(100))) + "%";
-            thirdLevelNumDTO.setPercent(thirdPercent);
-            thirdLevelNumDTO.setPercentStr(thirdPercentStr);
-            retList.add(totleNumDTO);
-            retList.add(firstLevelNumDTO);
-            retList.add(secondLevelNumDTO);
-            retList.add(thirdLevelNumDTO);
-            retMap.put(deptName, retList);
         }
         return retMap;
     }

+ 122 - 3
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -1,7 +1,6 @@
 package com.diagbot.facade;
 
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
@@ -13,8 +12,6 @@ import com.diagbot.util.*;
 import com.diagbot.vo.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.Lists;
-import com.google.gson.JsonObject;
-import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -50,6 +47,21 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcel(res, null, "sheet1", HomePageNumDTO.class, fileName, response, 12.8f);
     }
 
+    /**
+     * 病案首页合格率占比-湘雅
+     *
+     * @param filterOrderXYPageVO
+     * @return
+     */
+    public void homePageLevelXYExport(HttpServletResponse response, FilterOrderXYPageVO filterOrderXYPageVO) {
+        filterOrderXYPageVO.setCurrent(1L);
+        filterOrderXYPageVO.setSize(Long.MAX_VALUE);
+        filterOrderXYPageVO.setSearchCount(false);
+        IPage<HomePageNumXYDTO> res = consoleFacade.homePageLevelStatisticsXY(filterOrderXYPageVO);
+        String fileName = "病案首页合格率占比.xls";
+        ExcelUtils.exportExcel(res.getRecords(), null, "sheet1", HomePageNumXYDTO.class, fileName, response, 12.8f);
+    }
+
     /**
      * 条目缺陷占比(内页)
      *
@@ -184,6 +196,22 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", EntryNumGroupDTO.class, fileName, response, 12.8f);
     }
 
+    /**
+     * 缺陷详情导出-湘雅
+     *
+     * @param filterPageVO
+     * @return
+     */
+    public void entryCountGroupXYByEntryExport(HttpServletResponse response, FilterPageXYVO filterPageVO) {
+        filterPageVO.setCurrent(1L);
+        filterPageVO.setSize(Long.MAX_VALUE);
+        filterPageVO.setSearchCount(false);
+        IPage<EntryNumGroupDTO> page = consoleFacade.entryCountGroupXYByEntryPage(filterPageVO);
+        String fileName = "缺陷详情.xls";
+        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", EntryNumGroupDTO.class, fileName, response, 12.8f);
+    }
+
+
 
     /**
      * 各模块缺陷占比导出
@@ -244,6 +272,38 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
 
+    /**
+     * 缺陷详情质控评分页导出-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public void qcResultShortXYPageExport(HttpServletResponse response, QcResultShortXYPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
+                && qcResultShortPageVO.getDeptName().equals("全部")) {
+            qcResultShortPageVO.setDeptName("");
+        }
+        Date startDate = qcResultShortPageVO.getStartDate();
+        Date endDate = qcResultShortPageVO.getEndDate();
+        //时间间隔90天
+        long interval = 90 * 24l * 60l * 60l * 1000l;
+        if (endDate.getTime() < startDate.getTime()) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+        }
+        if (endDate.getTime() - startDate.getTime() > interval) {
+            throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+        }
+
+        qcResultShortPageVO.setCurrent(1L);
+        qcResultShortPageVO.setSize(Long.MAX_VALUE);
+        qcResultShortPageVO.setSearchCount(false);
+        List<ExportExcelDTO> record = behospitalInfoFacade.getBaseMapper().qcResultShortXYPageExport(qcResultShortPageVO);
+        String fileName = "缺陷详情质控评分页.xls";
+        ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
+    }
+
     /**
      * 出院人数统计导出
      *
@@ -427,6 +487,65 @@ public class ConsoleExportFacade {
         }
    }
 
+    /**
+     * 病案首页不合格/合格数-XY
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public void badLevelPageXYExport(HttpServletResponse response, QcResultShortXYPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
+                && qcResultShortPageVO.getDeptName().equals("全部")) {
+            qcResultShortPageVO.setDeptName("");
+        }
+        Date startDate = qcResultShortPageVO.getStartDate();
+        Date endDate = qcResultShortPageVO.getEndDate();
+        //时间间隔7天
+        long interval_7 = 7 * 24 * 60 * 60 * 1000;
+        long interval_90 = 90 * 24 * 60 * 60 * 1000l;
+
+        if("1".equals(qcResultShortPageVO.getRadioCheck())){
+            //时间间隔7天
+            if (endDate.getTime() < startDate.getTime()) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+            }
+            if (endDate.getTime() - startDate.getTime() > interval_7) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+            }
+        }else{
+            //时间间隔90天
+            if (endDate.getTime() < startDate.getTime()) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+            }
+            if (endDate.getTime() - startDate.getTime() > interval_90) {
+                throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+            }
+        }
+
+        qcResultShortPageVO.setCurrent(1L);
+        qcResultShortPageVO.setSize(Long.MAX_VALUE);
+        qcResultShortPageVO.setSearchCount(false);
+        List<ExportExcelDTO> records = behospitalInfoFacade.getBaseMapper().badLevelPageXYExport(qcResultShortPageVO);
+        List<ExportWideExcelDTO> resWide = new ArrayList<ExportWideExcelDTO>();
+        if("2".equals(qcResultShortPageVO.getRadioCheck())){
+            resWide = transList(records, resWide);
+        }
+        String fileName = null;
+        if("不合格数".equals(qcResultShortPageVO.getTitleName())){
+            fileName = "病案首页不合格数病历详情页.xls";
+        }else{
+            fileName = "病案首页合格数病历详情页.xls";
+        }
+        if("1".equals(qcResultShortPageVO.getRadioCheck())){
+            ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
+        }
+        if("2".equals(qcResultShortPageVO.getRadioCheck())){
+            ExcelUtils.exportExcelUser(resWide, null, "sheet1", ExportWideExcelDTO.class, fileName, response);
+        }
+    }
+
     /**
      * 未整改病历统计导出
      *

+ 60 - 5
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.aggregate.AverageStatisticsAggregate;
-import com.diagbot.aggregate.LeaveHosStatisticsAggregate;
 import com.diagbot.aggregate.MrStatisticsAggregate;
 import com.diagbot.aggregate.ResultStatisticsAggregate;
 import com.diagbot.dto.*;
@@ -22,8 +21,6 @@ import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
-import org.apache.poi.hssf.record.DVALRecord;
-import org.apache.poi.ss.formula.functions.Na;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -42,8 +39,6 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.stream.Collectors;
 
-import static io.netty.util.internal.SystemPropertyUtil.contains;
-
 /**
  * @Description:
  * @Author:zhaops
@@ -1413,6 +1408,22 @@ public class ConsoleFacade {
         return page;
     }
 
+
+    /**
+     * 缺陷详情(分页)-湘雅
+     *
+     * @param filterPageVO
+     * @return
+     */
+    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(FilterPageXYVO filterPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        filterPageVO.setHospitalId(hospitalId);
+        filterPageVO.setUserId(Long.valueOf(userId));
+        IPage<EntryNumGroupDTO> page = qcresultInfoFacade.getBaseMapper().entryCountGroupXYByEntryPage(filterPageVO);
+        return page;
+    }
+
     /**
      * 按科室统计平均住院天数(分页)
      *
@@ -2161,6 +2172,21 @@ public class ConsoleFacade {
         return records;
     }
 
+    /**
+     * 医师病案首页合格率占比 湘雅定制
+     *
+     * @param filterOrderXYPageVO
+     * @return
+     */
+    public IPage<HomePageNumXYDTO> homePageLevelStatisticsXY(FilterOrderXYPageVO filterOrderXYPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        filterOrderXYPageVO.setHospitalId(hospitalId);
+        filterOrderXYPageVO.setUserId(Long.valueOf(userId));
+        IPage<HomePageNumXYDTO> records = behospitalInfoFacade.homePageLevelStatisticsXY(filterOrderXYPageVO);
+        return records;
+    }
+
     /**
      * 病历质控报表
      *
@@ -2429,6 +2455,21 @@ public class ConsoleFacade {
         return page;
     }
 
+    /**
+     * 条目缺陷质控评分页(内页)-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> qcResultShortXYPage(QcResultShortXYPageVO qcResultShortPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        qcResultShortPageVO.setHospitalId(hospitalId);
+        qcResultShortPageVO.setUserId(Long.valueOf(userId));
+        IPage<QcResultShortDTO> page = behospitalInfoFacade.getBaseMapper().qcResultShortXYPage(qcResultShortPageVO);
+        return page;
+    }
+
     /**
      * 关键条目缺陷占比统计
      *
@@ -2994,6 +3035,20 @@ public class ConsoleFacade {
         return behospitalInfoFacade.badLevelPage(qcResultPageVO);
     }
 
+    /**
+     * 不合格/合格数病历号(内页)-湘雅
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> badLevelXYPage(QcResultPageXYVO qcResultPageVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        String userId = SysUserUtils.getCurrentPrincipleID();
+        qcResultPageVO.setHospitalId(hospitalId);
+        qcResultPageVO.setUserId(Long.valueOf(userId));
+        return behospitalInfoFacade.getBaseMapper().badLevelXYPage(qcResultPageVO);
+    }
+
     /**
      * 31天再入院详情页
      *

+ 215 - 0
src/main/java/com/diagbot/facade/DataAnalysisDeptFacade.java

@@ -0,0 +1,215 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.BehospitalCodeInfo;
+import com.diagbot.dto.EntryDefectImproveInnerDoctor;
+import com.diagbot.dto.EntryDefectImproveInnerExport;
+import com.diagbot.dto.GetEntryDefectImproveDeptDTO;
+import com.diagbot.dto.GetEntryInfoDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.MedClickInfoServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.GetEntryDefectImproveDeptVO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+import javax.servlet.http.HttpServletResponse;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * @Description:数据分析
+ * @Author: cy
+ * @time: 2021/11/16 18:28
+ */
+@Component
+public class DataAnalysisDeptFacade {
+    @Autowired
+    @Qualifier("medClickInfoServiceImpl")
+    private MedClickInfoServiceImpl medClickInfoService;
+
+    public IPage<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        int current = (int) getEntryDefectImproveDeptVO.getCurrent();
+        int size = (int) getEntryDefectImproveDeptVO.getSize();
+        entryDefectDeptSet(getEntryDefectImproveDeptVO);
+        IPage<GetEntryDefectImproveDeptDTO> page = new Page<>();
+        List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOList = new ArrayList<>();
+        DecimalFormat df = new DecimalFormat("#.00");
+        //获取标准缺陷信息
+        List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
+        //查询基础数据源
+        List<EntryDefectImproveInnerExport> records = medClickInfoService.getBaseMapper().getEntryDefectImproveDept(getEntryDefectImproveDeptVO);
+        //遍历科室
+        for (EntryDefectImproveInnerExport entryDefectImproveInnerExport : records) {
+            List<EntryDefectImproveInnerDoctor> entryDefectImproveInnerDoctors = entryDefectImproveInnerExport.getEntryDefectImproveInnerDoctors();
+            for (EntryDefectImproveInnerDoctor entryDefectImproveInnerDoctor : entryDefectImproveInnerDoctors) {
+                //对科室下医生质控的病历缺陷计数
+                Map<String, Long> totalMap = new HashMap<>();
+                Map<String, Long> improveleMap = new HashMap<>();
+                List<BehospitalCodeInfo> behospitalCodeInfoList = entryDefectImproveInnerDoctor.getBehospitalCodeInfos();
+                //多份病历多次质控评分得到质控缺陷总量、待改善总量
+                DataAnalysisFacade.unitProcessing(behospitalCodeInfoList, totalMap, improveleMap);
+                //按照全院维度进行数据封装
+                for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
+                    GetEntryDefectImproveDeptDTO getEntryDefectImproveDeptDTO = new GetEntryDefectImproveDeptDTO();
+                    getEntryDefectImproveDeptDTO.setDeptId(entryDefectImproveInnerExport.getDeptId());
+                    getEntryDefectImproveDeptDTO.setDeptName(entryDefectImproveInnerExport.getDeptName());
+                    getEntryDefectImproveDeptDTO.setDoctorId(entryDefectImproveInnerDoctor.getDoctorId());
+                    getEntryDefectImproveDeptDTO.setDoctorName(entryDefectImproveInnerDoctor.getDoctorName());
+                    getEntryDefectImproveDeptDTO.setEntryId(stringLongEntry.getKey());
+                    getEntryInfoByDept(entryInfo, stringLongEntry, getEntryDefectImproveDeptDTO);
+                    getEntryDefectImproveDeptDTO.setTotalNum(stringLongEntry.getValue());
+                    if (improveleMap.containsKey(stringLongEntry.getKey())) {
+                        getEntryDefectImproveDeptDTO.setImproveleNum(improveleMap.get(stringLongEntry.getKey()));
+                    }
+                    getEntryDefectImproveDeptDTO.setHandleNum(getEntryDefectImproveDeptDTO.getTotalNum() - getEntryDefectImproveDeptDTO.getImproveleNum());
+                    double handleRatio = 0d;
+                    if(getEntryDefectImproveDeptDTO.getTotalNum()!=0 && getEntryDefectImproveDeptDTO.getHandleNum()!=0){
+                        handleRatio = getEntryDefectImproveDeptDTO.getHandleNum().doubleValue()*100/getEntryDefectImproveDeptDTO.getTotalNum().doubleValue();
+                        String handleStr = df.format(handleRatio)+"%";
+                        getEntryDefectImproveDeptDTO.setHandleStr(handleStr);
+                    }
+                    getEntryDefectImproveDeptDTOList.add(getEntryDefectImproveDeptDTO);
+                }
+            }
+        }
+        //(部分模糊查询在此)
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDeptDTOList)) {
+            if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getCasesName()) || StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getEntryName())) {
+                getEntryDefectImproveQueryDept(getEntryDefectImproveDeptVO, getEntryDefectImproveDeptDTOList);
+            }
+        }
+
+        //导出操作
+        if (getEntryDefectImproveDeptVO.getExportType() == 1L) {
+            size = getEntryDefectImproveDeptDTOList.size();
+        }
+        page.setSize(size);
+        page.setTotal(getEntryDefectImproveDeptDTOList.size());
+        page.setCurrent(current);
+        //排序操作
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDeptDTOList)) {
+            getEntryDefectImproveDeptDTOList = sortEntryDefectListByDdept(getEntryDefectImproveDeptDTOList, getEntryDefectImproveDeptVO);
+        }
+        //分页操作
+        List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOS = DataAnalysisFacade.page(getEntryDefectImproveDeptDTOList, size, current);
+        page.setRecords(getEntryDefectImproveDeptDTOS);
+        return page;
+    }
+
+    public void getEntryDefectImproveQueryDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO, List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOList) {
+
+        Iterator<GetEntryDefectImproveDeptDTO> iterator = getEntryDefectImproveDeptDTOList.iterator();
+        while (iterator.hasNext()) {
+            boolean mark = true;
+            GetEntryDefectImproveDeptDTO kfc = iterator.next();
+            if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getCasesName()) &&
+                    !kfc.getCasesName().contains(getEntryDefectImproveDeptVO.getCasesName())) {
+                iterator.remove();
+                mark = false;
+            }
+            if (mark && StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getEntryName()) &&
+                    !kfc.getEntryName().contains(getEntryDefectImproveDeptVO.getEntryName())) {
+                iterator.remove();
+            }
+        }
+    }
+
+    public void getEntryDefectImproveByDeptExport(HttpServletResponse response, GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        getEntryDefectImproveDeptVO.setCurrent(1L);
+        getEntryDefectImproveDeptVO.setSize(Long.MAX_VALUE);
+        getEntryDefectImproveDeptVO.setSearchCount(false);
+        getEntryDefectImproveDeptVO.setExportType(1L);
+        IPage<GetEntryDefectImproveDeptDTO> page = getEntryDefectImproveDept(getEntryDefectImproveDeptVO);
+        String fileName = "条目缺陷改善统计(科室).xls";
+        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetEntryDefectImproveDeptDTO.class, fileName, response, 12.8f);
+    }
+
+    private void entryDefectDeptSet(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        if(StringUtils.isBlank(getEntryDefectImproveDeptVO.getDeptName())){
+            getEntryDefectImproveDeptVO.setDeptName("--");
+        }
+        getEntryDefectImproveDeptVO.setCurrent(1L);
+        getEntryDefectImproveDeptVO.setSize(Long.MAX_VALUE);
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getEntryDefectImproveDeptVO.getStartDate());
+            endDate = simpleDateFormat.parse(getEntryDefectImproveDeptVO.getEndDate());
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate, endDate)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getEntryDefectImproveDeptVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+    public List<GetEntryDefectImproveDeptDTO> sortEntryDefectListByDdept(List<GetEntryDefectImproveDeptDTO> getEntryDefectImproveDeptDTOS, GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO) {
+        if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getAsc())) {
+            if ("totalNum".equals(getEntryDefectImproveDeptVO.getAsc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getTotalNum)).collect(Collectors.toList());
+
+            }
+            if ("handleNum".equals(getEntryDefectImproveDeptVO.getAsc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getHandleNum)).collect(Collectors.toList());
+
+            }
+            if ("improveleNum".equals(getEntryDefectImproveDeptVO.getAsc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getImproveleNum)).collect(Collectors.toList());
+            }
+        }
+
+        if (StringUtils.isNotBlank(getEntryDefectImproveDeptVO.getDesc())) {
+            if ("totalNum".equals(getEntryDefectImproveDeptVO.getDesc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getTotalNum).reversed()).collect(Collectors.toList());
+
+            }
+            if ("handleNum".equals(getEntryDefectImproveDeptVO.getDesc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getHandleNum).reversed()).collect(Collectors.toList());
+
+            }
+            if ("improveleNum".equals(getEntryDefectImproveDeptVO.getDesc())) {
+                getEntryDefectImproveDeptDTOS = getEntryDefectImproveDeptDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDeptDTO::getImproveleNum).reversed()).collect(Collectors.toList());
+            }
+        }
+        return getEntryDefectImproveDeptDTOS;
+    }
+
+    /**
+     * @Description: 缺陷信息封装
+     * @Param: [entryInfo, stringLongEntry, getEntryDefectImprove]
+     * @return: com.diagbot.dto.GetEntryDefectImproveDTO
+     * @Author: cy
+     * @Date: 2021/12/3
+     */
+    public GetEntryDefectImproveDeptDTO getEntryInfoByDept(List<GetEntryInfoDTO> entryInfo, Map.Entry<String, Long> stringLongEntry,
+                                                           GetEntryDefectImproveDeptDTO getEntryDefectImproveDeptDTO) {
+        entryInfo.parallelStream().filter(kfc -> kfc.getEntryId().equals(stringLongEntry.getKey())).forEach(
+                obj -> {
+                    getEntryDefectImproveDeptDTO.setCasesId(obj.getCasesId());
+                    getEntryDefectImproveDeptDTO.setCasesName(obj.getCasesName());
+                    getEntryDefectImproveDeptDTO.setEntryName(obj.getEntryName());
+                }
+        );
+        return getEntryDefectImproveDeptDTO;
+    }
+}

+ 758 - 0
src/main/java/com/diagbot/facade/DataAnalysisFacade.java

@@ -0,0 +1,758 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.BehospitalAnalysisDTO;
+import com.diagbot.dto.BehospitalCodeDetail;
+import com.diagbot.dto.BehospitalCodeInfo;
+import com.diagbot.dto.DeptBaseDTO;
+import com.diagbot.dto.EntryDefectImprove;
+import com.diagbot.dto.EntryDefectImproveInner;
+import com.diagbot.dto.GetEntryDefectImproveDTO;
+import com.diagbot.dto.GetEntryInfoDTO;
+import com.diagbot.dto.GetQcClickDTO;
+import com.diagbot.dto.GetQcClickInnerPageDTO;
+import com.diagbot.dto.QcResultDetailInfo;
+import com.diagbot.entity.BehospitalInfo;
+import com.diagbot.entity.MedClickInfo;
+import com.diagbot.entity.MedQcresultClick;
+import com.diagbot.entity.QcresultDetail;
+import com.diagbot.entity.QcresultInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.MedQcresultClickService;
+import com.diagbot.service.impl.MedClickInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.BasDeptInfoVO;
+import com.diagbot.vo.GetEntryDefectImproveInnerVO;
+import com.diagbot.vo.GetEntryDefectImproveVO;
+import com.diagbot.vo.GetQcClickInnerPageVO;
+import com.diagbot.vo.GetQcClickVO;
+import com.diagbot.vo.MedClickInfoVO;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletResponse;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+
+/**
+ * @Description:数据分析
+ * @Author: cy
+ * @time: 2021/11/16 18:28
+ */
+@Component
+public class DataAnalysisFacade {
+    @Autowired
+    @Qualifier("medClickInfoServiceImpl")
+    private MedClickInfoServiceImpl medClickInfoService;
+
+    @Autowired
+    private QcresultInfoFacade qcresultInfoFacade;
+
+    @Autowired
+    private QcresultDetailFacade qcresultDetailFacade;
+
+    @Autowired
+    private MedQcresultClickService medQcresultClickService;
+
+    @Autowired
+    private BehospitalInfoFacade behospitalInfoFacade;
+
+    /**
+     * @Description:医生质控信息次数
+     * @Param: [medClickInfoVO]
+     * @return: void
+     * @Author: cy
+     * @Date: 2021/11/10
+     */
+    public Boolean addMedClickInfo(MedClickInfoVO medClickInfoVO) {
+        BehospitalInfo behospitalInfo = behospitalInfoFacade.lambdaQuery()
+                .eq(BehospitalInfo::getHospitalId, medClickInfoVO.getHospitalId())
+                .eq(BehospitalInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
+                .ne(BehospitalInfo::getQcTypeId, "0")
+                .eq(BehospitalInfo::getIsDeleted, IsDeleteEnum.N.getKey())
+                .one();
+        if(null == behospitalInfo){
+            throw new CommonException(CommonErrorCode.FAIL, "该病历不符合要求");
+        }
+
+        MedClickInfo medClickInfo = new MedClickInfo();
+        BeanUtil.copyProperties(medClickInfoVO, medClickInfo);
+        QcresultInfo qcresultInfo = qcresultInfoFacade.lambdaQuery()
+                .eq(QcresultInfo::getHospitalId, medClickInfoVO.getHospitalId())
+                .eq(QcresultInfo::getBehospitalCode, medClickInfoVO.getBehospitalCode())
+                .eq(QcresultInfo::getIsDeleted, IsDeleteEnum.N.getKey())
+                .select(QcresultInfo::getId).one();
+        if (null == qcresultInfo || null == qcresultInfo.getId()
+        ) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "内部参数异常");
+        }
+        medClickInfo.setQcresultInfoId(qcresultInfo.getId());
+        medClickInfo.setGmtCreate(new Date());
+        medClickInfoService.save(medClickInfo);
+
+        List<QcresultDetail> list = qcresultDetailFacade.lambdaQuery()
+                .eq(QcresultDetail::getHospitalId, medClickInfoVO.getHospitalId())
+                .eq(QcresultDetail::getBehospitalCode, medClickInfoVO.getBehospitalCode())
+                .eq(QcresultDetail::getQcresultInfoId, qcresultInfo.getId())
+                .eq(QcresultDetail::getIsDeleted, IsDeleteEnum.N.getKey()).list();
+        if (ListUtil.isNotEmpty(list)) {
+            StringBuilder sbFir = new StringBuilder();
+            for (QcresultDetail qcresultDetail : list) {
+                if (1 == qcresultDetail.getGradeType()) {
+                    if (null != qcresultDetail.getCasesEntryId() && 0L != qcresultDetail.getCasesEntryId()) {
+                        sbFir.append(qcresultDetail.getCasesEntryId() + "、");
+                    }
+                }
+            }
+            if (sbFir.length() > 0) {
+                sbFir = sbFir.deleteCharAt(sbFir.length() - 1);
+            }
+            MedQcresultClick medQcresultClick = new MedQcresultClick();
+            medQcresultClick.setHospitalId(medClickInfoVO.getHospitalId());
+            medQcresultClick.setBehospitalCode(medClickInfoVO.getBehospitalCode());
+            medQcresultClick.setDeptId(behospitalInfo.getBehDeptId());
+            medQcresultClick.setDeptName(behospitalInfo.getBehDeptName());
+            medQcresultClick.setQcresultInfoId(qcresultInfo.getId());
+            medQcresultClick.setCasesEntryIds(sbFir.toString());
+            medQcresultClick.setGmtCreate(new Date());
+            medQcresultClickService.save(medQcresultClick);
+        }
+        return true;
+    }
+
+    public List<DeptBaseDTO> getQcClickDeptList(BasDeptInfoVO basDeptInfoVO) {
+        long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
+        List<DeptBaseDTO> deptDTO = new ArrayList<>();
+        List<MedClickInfo> deptList = medClickInfoService.lambdaQuery()
+                .eq(MedClickInfo::getHospitalId, hospitalId)
+                .eq(MedClickInfo::getIsDeleted, IsDeleteEnum.N.getKey())
+                .like(MedClickInfo::getDeptName, basDeptInfoVO.getInputStr())
+                .select(MedClickInfo::getDeptId, MedClickInfo::getDeptName)
+                .groupBy(MedClickInfo::getDeptId)
+                .groupBy(MedClickInfo::getDeptName)
+                .list();
+        if (ListUtil.isNotEmpty(deptList)) {
+            for (MedClickInfo kfc : deptList) {
+                if (null == kfc) {
+                    return deptDTO;
+                }
+                DeptBaseDTO deptBaseDTO = new DeptBaseDTO();
+                deptBaseDTO.setDeptId(kfc.getDeptId());
+                deptBaseDTO.setDeptName(kfc.getDeptName());
+                deptDTO.add(deptBaseDTO);
+            }
+        }
+        return deptDTO;
+    }
+
+    public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO) {
+        clickPageSet(getQcClickVO);
+        List<GetQcClickDTO> records = medClickInfoService.getBaseMapper().getQcClick(getQcClickVO);
+        //没有科室过滤时增加全院数据
+        if (StringUtil.isBlank(getQcClickVO.getDeptName()) || getQcClickVO.getDeptName().equals("全院")) {
+            GetQcClickDTO item = getGlobleTitle(records);
+            if (item != null) {
+                records.add(0, item);
+            }
+        }
+        return records;
+    }
+
+
+    public void getQcClickByExport(HttpServletResponse response, GetQcClickVO getQcClickVO) {
+        List<GetQcClickDTO> records = getQcClick(getQcClickVO);
+        String fileName = "临床质控使用统计.xls";
+        ExcelUtils.exportExcel(records, null, "sheet1", GetQcClickDTO.class, fileName, response, 12.8f);
+    }
+
+    public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        clickInnerPageSet(getQcClickInnerPageVO);
+        IPage<GetQcClickInnerPageDTO> records = medClickInfoService.getBaseMapper().getQcClickInnerPage(getQcClickInnerPageVO);
+        return records;
+    }
+
+    public void getQcClickInnerPageByExport(HttpServletResponse response, GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        getQcClickInnerPageVO.setCurrent(1L);
+        getQcClickInnerPageVO.setSize(Long.MAX_VALUE);
+        getQcClickInnerPageVO.setSearchCount(false);
+        IPage<GetQcClickInnerPageDTO> page = getQcClickInnerPage(getQcClickInnerPageVO);
+        String fileName = "临床质控使用统计内页.xls";
+        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetQcClickInnerPageDTO.class, fileName, response, 12.8f);
+    }
+
+    public IPage<GetEntryDefectImproveDTO> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        int current = (int) getEntryDefectImproveVO.getCurrent();
+        int size = (int) getEntryDefectImproveVO.getSize();
+        IPage<GetEntryDefectImproveDTO> page = new Page<>();
+        entryDefectSet(getEntryDefectImproveVO);
+        DecimalFormat df = new DecimalFormat("#.00");
+        List<GetEntryDefectImproveDTO> getEntryDefectImproveDTO = new ArrayList<>();
+        //获取标准缺陷信息
+        List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
+        //查询基础数据源
+        List<EntryDefectImprove> records = medClickInfoService.getBaseMapper().getEntryDefectImprove(getEntryDefectImproveVO);
+        //遍历科室
+        for (EntryDefectImprove entryDefectImprove : records) {
+            Map<String, Long> totalMap = new HashMap<>();
+            Map<String, Long> improveleMap = new HashMap<>();
+            List<BehospitalCodeInfo> behospitalCodeInfoList = entryDefectImprove.getBehospitalCodeInfos();
+            //多份病历多次质控评分得到质控缺陷总量、待改善总量
+            unitProcessing(behospitalCodeInfoList, totalMap, improveleMap);
+            //按照全院维度进行数据封装
+            for (Map.Entry<String, Long> stringLongEntry : totalMap.entrySet()) {
+                //封装DTO
+                GetEntryDefectImproveDTO getEntryDefectImprove = new GetEntryDefectImproveDTO();
+                getEntryDefectImprove.setDeptId(entryDefectImprove.getDeptId());
+                getEntryDefectImprove.setDeptName(entryDefectImprove.getDeptName());
+                getEntryDefectImprove.setEntryId(stringLongEntry.getKey());
+                getEntryInfo(entryInfo, stringLongEntry, getEntryDefectImprove);
+                getEntryDefectImprove.setTotalNum(stringLongEntry.getValue());
+                if (improveleMap.containsKey(stringLongEntry.getKey())) {
+                    getEntryDefectImprove.setImproveleNum(improveleMap.get(stringLongEntry.getKey()));
+                }
+                getEntryDefectImprove.setHandleNum(getEntryDefectImprove.getTotalNum() - getEntryDefectImprove.getImproveleNum());
+                double handleRatio = 0d;
+                if(getEntryDefectImprove.getTotalNum()!=0 && getEntryDefectImprove.getHandleNum()!=0){
+                    handleRatio = getEntryDefectImprove.getHandleNum().doubleValue()*100/getEntryDefectImprove.getTotalNum().doubleValue();
+                    String handleStr = df.format(handleRatio)+"%";
+                    getEntryDefectImprove.setHandleStr(handleStr);
+                }
+                getEntryDefectImproveDTO.add(getEntryDefectImprove);
+            }
+        }
+        //(部分模糊查询在此)
+            if (ListUtil.isNotEmpty(getEntryDefectImproveDTO)) {
+                if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) || StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName())) {
+                getEntryDefectImproveQuery(getEntryDefectImproveVO, getEntryDefectImproveDTO);
+            }
+        }
+
+
+        //导出操作
+        if (getEntryDefectImproveVO.getExportType() == 1L) {
+            size = getEntryDefectImproveDTO.size();
+        }
+        page.setSize(size);
+        page.setTotal(getEntryDefectImproveDTO.size());
+        page.setCurrent(current);
+        //排序操作
+        if (ListUtil.isNotEmpty(getEntryDefectImproveDTO)) {
+            getEntryDefectImproveDTO =  sortEntryDefectList( getEntryDefectImproveDTO ,getEntryDefectImproveVO);
+        }
+        //分页操作
+        List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS = page(getEntryDefectImproveDTO, size, current);
+        page.setRecords(getEntryDefectImproveDTOS);
+        return page;
+    }
+
+    /**
+     * @Description: 缺陷信息封装
+     * @Param: [entryInfo, stringLongEntry, getEntryDefectImprove]
+     * @return: com.diagbot.dto.GetEntryDefectImproveDTO
+     * @Author: cy
+     * @Date: 2021/12/3
+     */
+    public GetEntryDefectImproveDTO getEntryInfo(List<GetEntryInfoDTO> entryInfo, Map.Entry<String, Long> stringLongEntry,
+                                                 GetEntryDefectImproveDTO getEntryDefectImprove) {
+        entryInfo.parallelStream().filter(kfc -> kfc.getEntryId().equals(stringLongEntry.getKey())).forEach(
+                obj -> {
+                    getEntryDefectImprove.setCasesId(obj.getCasesId());
+                    getEntryDefectImprove.setCasesName(obj.getCasesName());
+                    getEntryDefectImprove.setEntryName(obj.getEntryName());
+                }
+        );
+        return getEntryDefectImprove;
+    }
+
+    /**
+     * @Description: 多份病历多次质控评分得到质控缺陷总量、待改善总量
+     * @Param: [behospitalCodeInfoList, totalMap, improveleMap]
+     * @return: void
+     * @Author: cy
+     * @Date: 2021/12/3
+     */
+    public static void unitProcessing(List<BehospitalCodeInfo> behospitalCodeInfoList, Map<String, Long> totalMap,
+                                      Map<String, Long> improveleMap) {
+        for (BehospitalCodeInfo behospitalCodeInfo : behospitalCodeInfoList) {
+            //病历下
+            List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeInfo.getQcResultDetailInfos();
+                //获取多病历多质控质控缺陷总量
+                totalMap = getEntryTotalMap(qcResultDetailInfos, totalMap);
+                if (MapUtils.isNotEmpty(totalMap)) {
+                    //获取多病历多质控质控缺陷待改善总量
+                    QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
+                    improveleMap = getEntryImproveleMap(qcResultDetailInfo, improveleMap);
+                }
+        }
+    }
+
+
+    public void getEntryDefectImproveQuery(GetEntryDefectImproveVO getEntryDefectImproveVO, List<GetEntryDefectImproveDTO> getEntryDefectImproveDTO) {
+        Iterator<GetEntryDefectImproveDTO> iterator = getEntryDefectImproveDTO.iterator();
+        while (iterator.hasNext()) {
+            boolean mark = true;
+            GetEntryDefectImproveDTO kfc = iterator.next();
+            if (StringUtils.isNotBlank(getEntryDefectImproveVO.getCasesName()) &&
+                    !kfc.getCasesName().contains(getEntryDefectImproveVO.getCasesName())) {
+                iterator.remove();
+                mark = false;
+            }
+            if (mark && StringUtils.isNotBlank(getEntryDefectImproveVO.getEntryName()) &&
+                    !kfc.getEntryName().contains(getEntryDefectImproveVO.getEntryName())) {
+                iterator.remove();
+            }
+        }
+    }
+
+    /**
+     * @Description:分页数据
+     * @Param: [dataList, pageSize, currentPage]
+     * @return: java.util.List<java.lang.String>
+     * @Author: cy
+     * @Date: 2021/12/2
+     */
+    public static <T> List<T> page(List<T> retRecords, int pageSize, int currentPage) {
+        List<T> currentPageList = new ArrayList<>();
+        if (retRecords != null && retRecords.size() > 0) {
+            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
+            for (int i = 0; i < pageSize && i < retRecords.size() - currIdx; i++) {
+                T data = retRecords.get(currIdx + i);
+                currentPageList.add(data);
+            }
+        }
+        return currentPageList;
+    }
+
+    public  List<BehospitalAnalysisDTO>  getEntryDefectImproveInnerDTOS( List<BehospitalAnalysisDTO> behospitalInfoDTOList ,GetEntryDefectImproveInnerVO
+            getEntryDefectImproveInnerVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getAsc())){
+            if("behDeptName".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehDeptName, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("behDoctorName".equals(getEntryDefectImproveInnerVO.getAsc()) || "doctorName".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getDoctorName, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("name".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getName, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("fileCode".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getFileCode, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("behospitalCode".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehospitalCode, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("age".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getAge, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("behospitalDate".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehospitalDate, Comparator.nullsLast(Date::compareTo))).collect(Collectors.toList());
+            }
+            if("leaveHospitalDate".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getLeaveHospitalDate, Comparator.nullsLast(Date::compareTo))).collect(Collectors.toList());
+            }
+            if("scoreRes".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getScoreRes, Comparator.nullsLast(Double::compareTo))).collect(Collectors.toList());
+            }
+            if("level".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getLevel, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList());
+            }
+            if("gradeTime".equals(getEntryDefectImproveInnerVO.getAsc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getGradeTime, Comparator.nullsLast(Date::compareTo))).collect(Collectors.toList());
+            }
+        }
+
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getDesc())){
+            if("behDeptName".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehDeptName, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("behDoctorName".equals(getEntryDefectImproveInnerVO.getDesc()) || "doctorName".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getDoctorName, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("name".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getName, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("fileCode".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getFileCode, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("behospitalCode".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehospitalCode, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("age".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getAge, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("behospitalDate".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getBehospitalDate, Comparator.nullsLast(Date::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("leaveHospitalDate".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getLeaveHospitalDate, Comparator.nullsLast(Date::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("scoreRes".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getScoreRes, Comparator.nullsLast(Double::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("level".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getLevel, Comparator.nullsLast(String::compareTo)).reversed()).collect(Collectors.toList());
+            }
+            if("gradeTime".equals(getEntryDefectImproveInnerVO.getDesc())){
+                behospitalInfoDTOList = behospitalInfoDTOList.stream().sorted(Comparator.comparing(BehospitalAnalysisDTO::getGradeTime, Comparator.nullsLast(Date::compareTo)).reversed()).collect(Collectors.toList());
+            }
+        }
+        return behospitalInfoDTOList;
+    }
+    public  List<GetEntryDefectImproveDTO>  sortEntryDefectList( List<GetEntryDefectImproveDTO> getEntryDefectImproveDTOS ,GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveVO.getAsc())){
+            if("totalNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getTotalNum)).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getHandleNum)).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveVO.getAsc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getImproveleNum)).collect(Collectors.toList());
+            }
+        }
+
+        if(StringUtils.isNotBlank(getEntryDefectImproveVO.getDesc())){
+            if("totalNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getTotalNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("handleNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getHandleNum).reversed()).collect(Collectors.toList());
+
+            }
+            if("improveleNum".equals(getEntryDefectImproveVO.getDesc())){
+                getEntryDefectImproveDTOS = getEntryDefectImproveDTOS.stream().sorted(Comparator.comparing(GetEntryDefectImproveDTO::getImproveleNum).reversed()).collect(Collectors.toList());
+            }
+        }
+        return getEntryDefectImproveDTOS;
+    }
+
+    public static Map getEntryTotalMap(List<QcResultDetailInfo> qcResultDetailInfos, Map<String, Long> totalMap) {
+        Set<String> totalSet = new HashSet<String>();
+        for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
+                //质控下获取科室下总缺陷
+                String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
+                totalSet = getSetEntry(casesEntryIds, totalSet);
+        }
+        if (null == totalSet && totalSet.size() == 0) {
+            return totalMap;
+        }
+        totalMap = getSetEntryCount(totalMap, totalSet);
+        return totalMap;
+    }
+
+    public static Map getEntryImproveleMap(QcResultDetailInfo qcResultDetailInfo, Map<String, Long> improveMap) {
+        Set<String> improveleSet = new HashSet<String>();
+        String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
+        improveleSet = getSetEntry(casesEntryIds, improveleSet);
+        improveMap = getSetEntryCount(improveMap, improveleSet);
+        return improveMap;
+    }
+
+    public static Set getSetEntry(String casesEntryIds, Set set) {
+        if (StringUtils.isNotBlank(casesEntryIds) && !"0".equals(casesEntryIds)) {
+            if (casesEntryIds.contains("、")) {
+                String[] split = casesEntryIds.split("、");
+                for (String id : split) {
+                    set.add(id);
+                }
+            } else {
+                set.add(casesEntryIds);
+            }
+        }
+        return set;
+    }
+
+    public static Map getSetEntryCount(Map<String, Long> map, Set<String> sets) {
+        if (null != sets && sets.size() > 0) {
+        for (String set : sets) {
+            if (map.containsKey(set)) {
+                long count = map.get(set) + 1l;
+                map.put(set, count);
+            } else {
+                map.put(set, 1L);
+                }
+            }
+        }
+        return map;
+    }
+
+    public void getEntryDefectImproveByExport(HttpServletResponse response, GetEntryDefectImproveVO
+            getEntryDefectImproveVO) {
+        getEntryDefectImproveVO.setExportType(1L);
+        getEntryDefectImproveVO.setCurrent(1L);
+        getEntryDefectImproveVO.setSize(Long.MAX_VALUE);
+        getEntryDefectImproveVO.setSearchCount(false);
+        IPage<GetEntryDefectImproveDTO> page = getEntryDefectImprove(getEntryDefectImproveVO);
+        String fileName = "条目缺陷改善统计.xls";
+        ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", GetEntryDefectImproveDTO.class, fileName, response, 12.8f);
+    }
+
+
+    public IPage<BehospitalAnalysisDTO> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO
+                                                                       getEntryDefectImproveInnerVO) {
+        int current = (int) getEntryDefectImproveInnerVO.getCurrent();
+        int size = (int) getEntryDefectImproveInnerVO.getSize();
+        IPage<BehospitalAnalysisDTO> page = new Page<>();
+        List<BehospitalAnalysisDTO> behospitalInfoDTOS = new ArrayList<>();
+        entryDefectInnerSet(getEntryDefectImproveInnerVO);
+        // List<GetEntryInfoDTO> entryInfo = medClickInfoService.getBaseMapper().getEntryInfo();
+        List<EntryDefectImproveInner> records = medClickInfoService.getBaseMapper().getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
+        if (ListUtil.isNotEmpty(records) && records.size() == 1) {
+            EntryDefectImproveInner entryDefectImproveInner = records.get(0);
+            List<BehospitalCodeDetail> behospitalCodeDetails = entryDefectImproveInner.getBehospitalCodeInfos();
+            for (BehospitalCodeDetail behospitalCodeDetail : behospitalCodeDetails) {
+                List<QcResultDetailInfo> qcResultDetailInfos = behospitalCodeDetail.getQcResultDetailInfos();
+                Set<String> totalSet = new HashSet<String>();
+                Set<String> improveleSet = new HashSet<String>();
+                for (QcResultDetailInfo qcResultDetailInfo : qcResultDetailInfos) {
+                    String casesEntryIds = qcResultDetailInfo.getCasesEntryIds();
+                    totalSet = getSetEntry(casesEntryIds, totalSet);
+                }
+                QcResultDetailInfo qcResultDetailInfo = qcResultDetailInfos.get(qcResultDetailInfos.size() - 1);
+                if (null != qcResultDetailInfo && StringUtils.isNotBlank(qcResultDetailInfo.getCasesEntryIds())) {
+                    improveleSet = getSetEntry(qcResultDetailInfo.getCasesEntryIds(), improveleSet);
+                }
+                if ("0".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
+                    behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
+                }
+                if ("1".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())
+                        && !improveleSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
+                    behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
+                }
+                if ("2".equals(getEntryDefectImproveInnerVO.getTypeMark()) && totalSet.contains(getEntryDefectImproveInnerVO.getEntryId())
+                        && improveleSet.contains(getEntryDefectImproveInnerVO.getEntryId())) {
+                    behospitalInfoDTOS = getBehospitalInfoDTO(entryDefectImproveInner, behospitalCodeDetail, behospitalInfoDTOS);
+                }
+            }
+        }
+        //导出操作
+        if (getEntryDefectImproveInnerVO.getExportType() == 1L) {
+            size = behospitalInfoDTOS.size();
+        }
+        page.setSize(size);
+        page.setTotal(behospitalInfoDTOS.size());
+        page.setCurrent(current);
+        //排序操作
+        if (ListUtil.isNotEmpty(behospitalInfoDTOS)) {
+            behospitalInfoDTOS =  getEntryDefectImproveInnerDTOS( behospitalInfoDTOS ,getEntryDefectImproveInnerVO);
+        }
+        //分页操作
+        List<BehospitalAnalysisDTO> behospitalInfoDTOList = page(behospitalInfoDTOS, size, current);
+        page.setRecords(behospitalInfoDTOList);
+        return page;
+    }
+
+    /**
+     * @Description: 数据封装
+     * @Param: [entryDefectImproveInner, behospitalCodeDetail, qcResultDetailInfo, behospitalInfoDTOS]
+     * @return: java.util.List<com.diagbot.dto.BehospitalInfoDTO>
+     * @Author: cy
+     * @Date: 2021/12/3
+     */
+    public List<BehospitalAnalysisDTO> getBehospitalInfoDTO(EntryDefectImproveInner entryDefectImproveInner, BehospitalCodeDetail behospitalCodeDetail,
+                                                        List<BehospitalAnalysisDTO> behospitalInfoDTOS) {
+        BehospitalAnalysisDTO behospitalInfoDTO = new BehospitalAnalysisDTO();
+        behospitalInfoDTO.setLevel(behospitalCodeDetail.getLevel());
+        behospitalInfoDTO.setScoreRes(behospitalCodeDetail.getScoreRes());
+        behospitalInfoDTO.setFileCode(behospitalCodeDetail.getFileCode());
+        behospitalInfoDTO.setBehospitalCode(behospitalCodeDetail.getBehospitalCode());
+        behospitalInfoDTO.setName(behospitalCodeDetail.getName());
+        behospitalInfoDTO.setAge(behospitalCodeDetail.getAge());
+        behospitalInfoDTO.setBehospitalDate(behospitalCodeDetail.getBehospitalDate());
+        behospitalInfoDTO.setLeaveHospitalDate(behospitalCodeDetail.getLeaveHospitalDate());
+        behospitalInfoDTO.setDoctorName(behospitalCodeDetail.getDoctorName());
+        behospitalInfoDTO.setBehDoctorName(behospitalCodeDetail.getDoctorName());
+        behospitalInfoDTO.setBehDeptName(entryDefectImproveInner.getBehDeptName());
+        behospitalInfoDTO.setGradeTime(behospitalCodeDetail.getGradeTime());
+        behospitalInfoDTOS.add(behospitalInfoDTO);
+        return behospitalInfoDTOS;
+    }
+
+    public void getDefectImproveInnerByExport(HttpServletResponse response, GetEntryDefectImproveInnerVO
+            getEntryDefectImproveInnerVO) {
+        getEntryDefectImproveInnerVO.setExportType(1L);
+        getEntryDefectImproveInnerVO.setCurrent(1L);
+        getEntryDefectImproveInnerVO.setSize(Long.MAX_VALUE);
+        getEntryDefectImproveInnerVO.setSearchCount(false);
+        String fileName = "条目缺陷改善统计病历列表.xls";
+        IPage<BehospitalAnalysisDTO> page = this.getEntryDefectImproveInner(getEntryDefectImproveInnerVO);
+        ExcelUtils.exportExcelUser(page.getRecords(), null, "sheet1", BehospitalAnalysisDTO.class, fileName, response);
+    }
+
+    /**
+     * 增加全院记录
+     *
+     * @param records
+     * @return
+     */
+    public GetQcClickDTO getGlobleTitle(List<GetQcClickDTO> records) {
+        GetQcClickDTO item = new GetQcClickDTO();
+        if (ListUtil.isEmpty(records)) {
+            return null;
+        }
+
+        //缺陷总数
+        Integer singleMode = records
+                .stream()
+                .map(GetQcClickDTO::getSingleModeNum)
+                .reduce(0, Integer::sum);
+        if (singleMode == null) {
+            singleMode = 0;
+        }
+        Integer totalMode = records
+                .stream()
+                .map(GetQcClickDTO::getTotalModeNum)
+                .reduce(0, Integer::sum);
+        if (totalMode == null) {
+            totalMode = 0;
+        }
+        item.setDeptName("全院");
+        item.setSingleModeNum(singleMode);
+        item.setTotalModeNum(totalMode);
+        return item;
+    }
+
+    private void clickPageSet(GetQcClickVO getQcClickVO) {
+        if(StringUtils.isNotBlank(getQcClickVO.getDeptName())){
+            getQcClickVO.setDeptName(transferredMeaning(getQcClickVO.getDeptName()));
+        }
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getQcClickVO.getStartDate());
+            endDate = simpleDateFormat.parse(getQcClickVO.getEndDate());
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate, endDate)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getQcClickVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+    private void clickInnerPageSet(GetQcClickInnerPageVO getQcClickInnerPageVO) {
+        if(StringUtils.isNotBlank(getQcClickInnerPageVO.getDoctorId())){
+            getQcClickInnerPageVO.setDoctorId(transferredMeaning(getQcClickInnerPageVO.getDoctorId()));
+        }
+        if(StringUtils.isNotBlank(getQcClickInnerPageVO.getDoctorName())){
+            getQcClickInnerPageVO.setDoctorName(transferredMeaning(getQcClickInnerPageVO.getDoctorName()));
+        }
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getQcClickInnerPageVO.getStartDate());
+            endDate = simpleDateFormat.parse(getQcClickInnerPageVO.getEndDate());
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate, endDate)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getQcClickInnerPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+   public String transferredMeaning(String tranStr){
+          if( tranStr.contains("%")){
+              tranStr = tranStr.replace("%", "\\%");
+          }
+           if( tranStr.contains("_")){
+              tranStr = tranStr.replace("_","\\_");
+           }
+       return tranStr;
+    };
+    private void entryDefectSet(GetEntryDefectImproveVO getEntryDefectImproveVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveVO.getDeptName())){
+            getEntryDefectImproveVO.setDeptName(transferredMeaning(getEntryDefectImproveVO.getDeptName()));
+        }
+        getEntryDefectImproveVO.setCurrent(1L);
+        getEntryDefectImproveVO.setSize(Long.MAX_VALUE);
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getEntryDefectImproveVO.getStartDate());
+            endDate = simpleDateFormat.parse(getEntryDefectImproveVO.getEndDate());
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate, endDate)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        getEntryDefectImproveVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+    private void entryDefectInnerSet(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO) {
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getPatName())){
+            getEntryDefectImproveInnerVO.setPatName(transferredMeaning(getEntryDefectImproveInnerVO.getPatName()));
+        }
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getDoctorId())){
+            getEntryDefectImproveInnerVO.setDoctorId(transferredMeaning(getEntryDefectImproveInnerVO.getDoctorId()));
+        }
+        if(StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getDoctorName())){
+            getEntryDefectImproveInnerVO.setDoctorName(transferredMeaning(getEntryDefectImproveInnerVO.getDoctorName()));
+        }
+        getEntryDefectImproveInnerVO.setCurrent(1L);
+        getEntryDefectImproveInnerVO.setSize(Long.MAX_VALUE);
+        //入参验证
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date startDate = null;
+        Date endDate = null;
+        try {
+            startDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getStartDate());
+            endDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getEndDate());
+
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        if (DateUtil.after(startDate, endDate)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间必须小于结束时间!");
+        }
+        if (StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeStart())
+                && StringUtils.isNotBlank(getEntryDefectImproveInnerVO.getChTimeEnd())
+        ) {
+            Date chTimeStartDate = null;
+            Date chTimeEndDate = null;
+            try {
+                chTimeStartDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
+                chTimeEndDate = simpleDateFormat.parse(getEntryDefectImproveInnerVO.getChTimeStart());
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            if (DateUtil.after(chTimeStartDate, chTimeEndDate)) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "病历核查开始时间必须小于结束时间!");
+            }
+        }
+        getEntryDefectImproveInnerVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+}

+ 65 - 0
src/main/java/com/diagbot/facade/DataEditFacade.java

@@ -0,0 +1,65 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.StrAdmissionNoteDTO;
+import com.diagbot.entity.*;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.service.*;
+import com.diagbot.util.*;
+import com.diagbot.vo.DataEditVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:wangsy
+ * @time: 2021/08/14 11:37
+ */
+@Component
+public class DataEditFacade {
+
+    @Autowired
+    @Qualifier("strAdmissionNoteServiceImpl")
+    StrAdmissionNoteService strAdmissionNoteService;
+
+    /**
+     * 数据检索
+     */
+    public StrAdmissionNoteDTO dataSearch() {
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        StrAdmissionNote strAdmissionNote= strAdmissionNoteService.getBaseMapper().selectOne(new QueryWrapper<StrAdmissionNote>()
+                .eq("hospital_id", hospitalId)
+                .eq("remark", hospitalId + "N")
+                .select("rec_id", "whole_data"));
+        StrAdmissionNoteDTO strAdmissionNoteDTO = new StrAdmissionNoteDTO();
+        BeanUtil.copyProperties(strAdmissionNote,strAdmissionNoteDTO);
+        strAdmissionNoteDTO.setModeId("200");
+        return strAdmissionNoteDTO;
+    }
+
+
+
+    /**
+     * 更新数据
+     *
+     * @param dataEditVO
+     * @return
+     */
+    public Boolean saveDataEditFacade(DataEditVO dataEditVO) {
+        return strAdmissionNoteService.update(new UpdateWrapper<StrAdmissionNote>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", SysUserUtils.getCurrentHospitalID())
+                .eq("rec_id", dataEditVO.getRecId())
+                .set("whole_data", dataEditVO.getWholeData())
+                .set("gmt_modified", DateUtil.now())
+                .set("modifier", SysUserUtils.getCurrentPrincipleID())
+        );
+    }
+
+}

+ 310 - 0
src/main/java/com/diagbot/facade/MedAppealExamineInfoManagementFacade.java

@@ -0,0 +1,310 @@
+package com.diagbot.facade;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.client.MedAppealExamineInfoServiceClientFacade;
+import com.diagbot.dto.AnalyzeDTO;
+
+import com.diagbot.dto.ExportGetAppealReviewDTO;
+import com.diagbot.dto.ExportGetComplaintRecordDTO;
+import com.diagbot.dto.GetAppealReviewDTO;
+import com.diagbot.dto.GetComplaintRecordDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.MedAppealExamineInfo;
+import com.diagbot.entity.MedAppealInfo;
+
+import com.diagbot.entity.QcCasesEntry;
+import com.diagbot.entity.QcresultDetail;
+import com.diagbot.enums.ExampleOperationEnum;
+import com.diagbot.enums.ExampleStatusEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.MedAppealExamineInfoServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.ExcelUtils;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.ApprovedVo;
+import com.diagbot.vo.GetAppealReviewVO;
+import com.diagbot.vo.GetComplaintRecordVO;
+import com.diagbot.vo.QcResultAlgVO;
+import com.diagbot.vo.QcresultVO;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description:申述记录
+ * @Author: songxl
+ * @Date 2022/1/5
+ */
+@Component
+public class MedAppealExamineInfoManagementFacade extends MedAppealExamineInfoServiceImpl {
+    @Autowired
+    private QcresultDetailFacade qcresultDetailFacade;
+    @Autowired
+    private MedAppealInfoManagementFacade medAppealInfoManagementFacade;
+    @Autowired
+    private QcresultInfoFacade qcresultInfoFacade;
+    @Autowired
+    private QcCasesEntryFacade qcCasesEntryFacade;
+
+    /**
+     * 审核通过
+     *
+     * @param approvedVo
+     * @return
+     */
+    public Boolean approved(ApprovedVo approvedVo) {
+        LocalDateTime dateTime = LocalDateTime.now();
+        QcresultVO qcresultVO = new QcresultVO();
+        qcresultVO.setBehospitalCode(approvedVo.getBehospitalCode());
+        qcresultVO.setHospitalId(approvedVo.getHospitalId());
+        QcResultAlgVO qcResultAlgVO = approvedVo.getQcResultAlgVO();
+        Long modeId = approvedVo.getModeId();
+        if (modeId != null) {
+            QcCasesEntry qcCasesEntry = qcCasesEntryFacade.getOne(new QueryWrapper<QcCasesEntry>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("mode_id", modeId)
+                    .groupBy("mode_id")
+            );
+            if(qcCasesEntry!=null) {
+                qcResultAlgVO.setCasesId(qcCasesEntry.getCasesId());
+            }
+        }
+        //获取处理方式
+        String handling = approvedVo.getExampleOperation();
+        if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.UP_OR_DEL.getKey())) {
+            QcresultDetail detail = getQcresultDetail(approvedVo);
+            if (detail == null) {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "该条目已删除,无法进行审核操作,请走驳回流程。");
+            }
+            //调用删除接口
+            qcresultVO.setDelStatus(0);
+            qcresultVO.setType(4);
+            qcResultAlgVO.setId(detail.getId());
+            qcresultVO.setOptResultAlgVO(qcResultAlgVO);
+            AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
+            if (analyzeDTORespDTO.getIsSuccess()) {
+                approvedVo.setQcresultDetailId(detail.getId());
+                Boolean appealInfo = updateAppealInfo(approvedVo);
+                MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+                medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.UP_OR_DEL.getKey());
+                medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+                medAppealExamineInfo.setMsg(qcresultVO.getOptResultAlgVO().getMsg());
+                medAppealExamineInfo.setValue(qcresultVO.getOptResultAlgVO().getScore());
+                medAppealExamineInfo.setGmtCreate(dateTime);
+                medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
+                boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("appeal_info_id", approvedVo.getId())
+                        .eq("check_id", approvedVo.getAppealId())
+                );
+                if (appealInfo && update) {
+                    return true;
+                } else {
+                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                }
+            } else {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "删除失败!");
+            }
+        }
+        if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.UP_OR_UP.getKey())) {
+            QcresultDetail detail = getQcresultDetail(approvedVo);
+            if (detail == null) {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "该条目已删除,无法进行审核操作,请走驳回流程。");
+            }
+            //调用修改接口
+            qcresultVO.setType(3);
+            qcResultAlgVO.setId(detail.getId());
+            qcresultVO.setOptResultAlgVO(qcResultAlgVO);
+            AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
+            if (analyzeDTORespDTO.getIsSuccess()) {
+                Boolean appealInfo = updateAppealInfo(approvedVo);
+                MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+                medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.UP_OR_UP.getKey());
+                medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+                medAppealExamineInfo.setMsg(qcresultVO.getOptResultAlgVO().getMsg());
+                medAppealExamineInfo.setValue(qcresultVO.getOptResultAlgVO().getScore());
+                medAppealExamineInfo.setGmtCreate(dateTime);
+                medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
+                boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("appeal_info_id", approvedVo.getId())
+                        .eq("check_id", approvedVo.getAppealId())
+                );
+                if (appealInfo && update) {
+                    return true;
+                } else {
+                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                }
+            } else {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "修改失败!");
+            }
+        }
+        if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.ADD_EXIST.getKey())) {
+            //判断是否已存在该条目
+            QcresultDetail qcresultDetail = getQcresultDetail(approvedVo);
+            if (qcresultDetail != null) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "该条目已存在,无法新增,请走驳回流程");
+            }
+            //调用新增接口
+            qcresultVO.setType(1);
+            qcresultVO.setOptResultAlgVO(qcResultAlgVO);
+            AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
+            if (analyzeDTORespDTO.getIsSuccess()) {
+                QcresultDetail detail = getQcresultDetail(approvedVo);
+                MedAppealInfo medAppealInfo = new MedAppealInfo();
+                medAppealInfo.setQcresultDetailId(detail.getId());
+                medAppealInfo.setWorkFlowNodeId(approvedVo.getWorkFlowNodeId());
+                boolean update = medAppealInfoManagementFacade.update(medAppealInfo, new UpdateWrapper<MedAppealInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", approvedVo.getHospitalId())
+                        .eq("behospital_code", approvedVo.getBehospitalCode())
+                        .eq("id", approvedVo.getId())
+                );
+                MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+                medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.ADD_EXIST.getKey());
+                medAppealExamineInfo.setValue(qcresultVO.getOptResultAlgVO().getScore());
+                medAppealExamineInfo.setMsg(qcresultVO.getOptResultAlgVO().getMsg());
+                medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+                medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
+                medAppealExamineInfo.setGmtCreate(dateTime);
+                boolean update1 = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("appeal_info_id", approvedVo.getId())
+                        .eq("check_id", approvedVo.getAppealId())
+                );
+                if (update && update1) {
+                    return true;
+                } else {
+                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                }
+            } else {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "新增失败!");
+            }
+        }
+        if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.RECOVER.getKey())) {
+            qcresultVO.setType(4);
+            qcresultVO.setDelStatus(1);
+            //判断条目是否以恢复
+            QcresultDetail qcresultDetail = getQcresultDetail(approvedVo);
+            if (qcresultDetail != null) {
+                throw new CommonException(CommonErrorCode.IS_EXISTS, "该条目已恢复,无法进行审核操作,请走驳回流程。");
+            }
+
+            //调用删除恢复接口
+            List<QcresultDetail> qcresultDetails = qcresultDetailFacade.list(new QueryWrapper<QcresultDetail>()
+                    .eq("hospital_id", approvedVo.getHospitalId())
+                    .eq("behospital_code", approvedVo.getBehospitalCode())
+                    .eq("cases_entry_id", approvedVo.getQcResultAlgVO().getCasesEntryId())
+                    .eq("is_deleted",IsDeleteEnum.Y.getKey())
+                    .eq("grade_type", 2)
+                    .orderByDesc("id")
+            );
+            if(ListUtil.isNotEmpty(qcresultDetails)){
+                qcResultAlgVO.setId(qcresultDetails.get(0).getId());
+                qcresultVO.setOptResultAlgVO(qcResultAlgVO);
+                AnalyzeDTO analyzeDTORespDTO = qcresultInfoFacade.changeQcResult(qcresultVO);
+                if (analyzeDTORespDTO.getIsSuccess()) {
+                    approvedVo.setQcresultDetailId(qcresultDetails.get(0).getId());
+                    Boolean appealInfo = updateAppealInfo(approvedVo);
+                    MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+                    medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.RECOVER.getKey());
+                    medAppealExamineInfo.setValue(qcresultVO.getOptResultAlgVO().getScore());
+                    medAppealExamineInfo.setMsg(qcresultVO.getOptResultAlgVO().getMsg());
+                    medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+                    medAppealExamineInfo.setRemark(qcResultAlgVO.getExplainInfo());
+                    medAppealExamineInfo.setGmtCreate(dateTime);
+                    boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                            .eq("is_deleted", IsDeleteEnum.N.getKey())
+                            .eq("appeal_info_id", approvedVo.getId())
+                            .eq("check_id", approvedVo.getAppealId())
+                    );
+                    if (appealInfo && update) {
+                        return true;
+                    } else {
+                        throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+                    }
+                } else {
+                    throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "恢复失败!");
+                }
+            }
+        }
+        if (StringUtil.isNotEmpty(handling) && handling.equals(ExampleOperationEnum.ADD_NO_EXIST.getKey())) {
+            Boolean appealInfo = updateAppealInfo(approvedVo);
+            MedAppealExamineInfo medAppealExamineInfo = new MedAppealExamineInfo();
+            medAppealExamineInfo.setExampleOperation(ExampleOperationEnum.ADD_NO_EXIST.getKey());
+            medAppealExamineInfo.setExampleStatus(ExampleStatusEnum.ADOPT_EXAMPLE.getKey());
+            medAppealExamineInfo.setProcessResult(approvedVo.getProcessResult());
+            medAppealExamineInfo.setGmtCreate(dateTime);
+            boolean update = this.update(medAppealExamineInfo, new UpdateWrapper<MedAppealExamineInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("appeal_info_id", approvedVo.getId())
+                    .eq("check_id", approvedVo.getAppealId())
+            );
+            if (appealInfo && update) {
+                return true;
+            } else {
+                throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "审核通过失败!");
+            }
+        }
+        throw new CommonException(CommonErrorCode.NOT_EXISTS, "无此类型处理方式!");
+    }
+    public Boolean updateAppealInfo(ApprovedVo approvedVo) {
+        MedAppealInfo medAppealInfo = new MedAppealInfo();
+        medAppealInfo.setQcresultDetailId(approvedVo.getQcresultDetailId());
+        medAppealInfo.setWorkFlowNodeId(approvedVo.getWorkFlowNodeId());
+        boolean update = medAppealInfoManagementFacade.update(medAppealInfo, new UpdateWrapper<MedAppealInfo>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", approvedVo.getHospitalId())
+                .eq("behospital_code", approvedVo.getBehospitalCode())
+                .eq("id", approvedVo.getId())
+        );
+        if (update) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    //  获取detail条目信息
+    public QcresultDetail getQcresultDetail(ApprovedVo approvedVo) {
+        QcresultDetail qcresultDetail = qcresultDetailFacade.getOne(new QueryWrapper<QcresultDetail>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", approvedVo.getHospitalId())
+                .eq("behospital_code", approvedVo.getBehospitalCode())
+                .eq("cases_entry_id", approvedVo.getQcResultAlgVO().getCasesEntryId())
+        );
+        return qcresultDetail;
+    }
+
+    public void getAppealReviewExport(HttpServletResponse response, GetAppealReviewVO getAppealReviewVO, MedAppealExamineInfoServiceClientFacade medAppealExamineInfoServiceClient) {
+        getAppealReviewVO.setCurrent(1L);
+        getAppealReviewVO.setSize(Long.MAX_VALUE);
+        getAppealReviewVO.setSearchCount(false);
+        RespDTO<Page<GetAppealReviewDTO>> appealReview = medAppealExamineInfoServiceClient.getAppealReview(getAppealReviewVO);
+        //格式转换
+        List<ExportGetAppealReviewDTO> out = BeanUtil.listCopyTo(appealReview.data.getRecords(), ExportGetAppealReviewDTO.class);
+        String fileName = "申诉审核.xls";
+        ExcelUtils.exportExcelUser(out, null, "sheet1", ExportGetAppealReviewDTO.class, fileName, response);
+    }
+
+    public void getComplaintRecordExport(HttpServletResponse response, GetComplaintRecordVO getComplaintRecordVO, MedAppealExamineInfoServiceClientFacade medAppealExamineInfoServiceClient) {
+        getComplaintRecordVO.setCurrent(1L);
+        getComplaintRecordVO.setSize(Long.MAX_VALUE);
+        getComplaintRecordVO.setSearchCount(false);
+        RespDTO<Page<GetComplaintRecordDTO>> complaintRecord = medAppealExamineInfoServiceClient.getComplaintRecord(getComplaintRecordVO);
+        //格式转换
+        List<ExportGetComplaintRecordDTO> out = BeanUtil.listCopyTo(complaintRecord.data.getRecords(), ExportGetComplaintRecordDTO.class);
+        String fileName = "申诉记录.xls";
+        ExcelUtils.exportExcelUser(out, null, "sheet1", ExportGetComplaintRecordDTO.class, fileName, response);
+    }
+}

+ 18 - 0
src/main/java/com/diagbot/facade/MedAppealInfoManagementFacade.java

@@ -0,0 +1,18 @@
+package com.diagbot.facade;
+
+
+
+
+import com.diagbot.service.impl.MedAppealInfoServiceImpl;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * @Description:申诉审核管理
+ * @Author: songxl
+ * @Date 2022/1/5
+ */
+@Component
+public class MedAppealInfoManagementFacade extends MedAppealInfoServiceImpl {
+
+}

+ 207 - 233
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -72,10 +72,11 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //获取人员id 和 该人员的医院id
         Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
         Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        checkAppealRelation();
         QueryWrapper<SysUser> userQuer = new QueryWrapper<>();
         userQuer.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("id",principleId)
-                .eq("status",1);
+                .eq("id", principleId)
+                .eq("status", 1);
         SysUser user = sysUserFacade.getOne(userQuer);
         String principleName = user.getLinkman();
         Map<String, Object> mapAll = new HashMap<String, Object>();
@@ -111,6 +112,10 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         return res;
     }
 
+    private void checkAppealRelation() {
+
+    }
+
     /**
      * @param mapAll
      * @param now
@@ -141,15 +146,16 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         }
         return res;
     }
+
     /**
      * @Author songxl
      * @Description 获取操作用户的核查科室以及人员
-     * @Date  2021/5/14
+     * @Date 2021/5/14
      * @Param []
-     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @Return java.util.Map<java.lang.String, java.util.List < com.diagbot.dto.CheckDeptDTO>>
      * @MethodName getCheckUserMap
      */
-    public IPage<CheckJobDTO> getUserCheckList(CheckJobPageVO  checkJobVO) {
+    public IPage<CheckJobDTO> getUserCheckList(CheckJobPageVO checkJobVO) {
         //校验
         userCheckPageSet(checkJobVO);
         //质控管理员要判断该角色是否是质控科
@@ -160,7 +166,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //获取核查监管相关角色id
         List<Long> checkRoleIds = sysRoleFacade.list(new QueryWrapper<SysRole>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .like("name","监管人员")
+                .like("name", "监管人员")
         ).stream().map(SysRole::getId).collect(Collectors.toList());
         //查询该角色的所有角色id
         List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
@@ -169,35 +175,30 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         ).stream().distinct().map(SysUserRole::getRoleId).collect(Collectors.toList());
         List<Long> searchRoleIds = new ArrayList<>();
         //当前用户是监管人员或者是超级管理员
-        if(roleIds.contains(-1L))
-        {
+        if (roleIds.contains(-1L)) {
             searchRoleIds.addAll(checkRoleIds);
+        } else {
+            searchRoleIds.addAll(containsRole(checkRoleIds, roleIds));
         }
-        else{
-            searchRoleIds.addAll(containsRole(checkRoleIds,roleIds));
-        }
-        if(searchRoleIds.isEmpty())
-        {
+        if (searchRoleIds.isEmpty()) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户不是核查监管人员!");
         }
         //质控科监管人员
-        if(searchRoleIds.contains(CheckerRoleEnum.QUAT_SUPERVISOR.getKey()*1l)
-                &&(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey()+"").equals(checkJobVO.getJobType()))
-        {
+        if (searchRoleIds.contains(CheckerRoleEnum.QUAT_SUPERVISOR.getKey() * 1l)
+                && (CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + "").equals(checkJobVO.getJobType())) {
             //用户是不是质管科人员校验
-            String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
+            BasDeptInfo deptInfo = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id",hospitalId)
-                    .like("dept_name","质管科")).getDeptId();
-            if(StringUtil.isBlank(zkkDeptId))
-            {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在!");
+                    .eq("hospital_id", hospitalId)
+                    .eq("station", "质管"));
+            if (deptInfo == null || deptInfo.getDeptId() == null) {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在,请联系管理员!");
             }
             //2.获取监管人员所在科室集合
             List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id",hospitalId)
-                    .eq("user_id",principleId)
+                    .eq("hospital_id", hospitalId)
+                    .eq("user_id", principleId)
             ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
             //3.判断这个人是否在质控科
 //            if(deptIds.contains(zkkDeptId))
@@ -208,31 +209,27 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             return getCheckList(checkJobVO);
         }
         //临床科室监管人员 或 院级监管人员
-        else if(searchRoleIds.contains(CheckerRoleEnum.DEPT_SUPERVISOR.getKey()*1l)
-                ||searchRoleIds.contains(CheckerRoleEnum.HOSP_SUPERVISOR.getKey()*1l))
-        {
+        else if (searchRoleIds.contains(CheckerRoleEnum.DEPT_SUPERVISOR.getKey() * 1l)
+                || searchRoleIds.contains(CheckerRoleEnum.HOSP_SUPERVISOR.getKey() * 1l)) {
             //查询没有指定科室
-            if(checkJobVO.getDeptList()==null||checkJobVO.getDeptList().isEmpty())
-            {
+            if (checkJobVO.getDeptList() == null || checkJobVO.getDeptList().isEmpty()) {
                 //科室获取待分配任务所在科室集合
-                if(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey()==Integer.parseInt(checkJobVO.getJobType())){
+                if (CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() == Integer.parseInt(checkJobVO.getJobType())) {
                     List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
                             .eq("is_deleted", IsDeleteEnum.N.getKey())
-                            .eq("hospital_id",hospitalId)
-                            .eq("user_id",principleId)
+                            .eq("hospital_id", hospitalId)
+                            .eq("user_id", principleId)
                     ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
 
-                    if(deptIds!=null&&!deptIds.isEmpty()){
+                    if (deptIds != null && !deptIds.isEmpty()) {
                         checkJobVO.setDeptList(deptIds);
                         return getCheckList(checkJobVO);
-                    }
-                    else
-                    {
-                        return  new CheckJobPageVO();
+                    } else {
+                        return new CheckJobPageVO();
                     }
                 }
                 //院区获取
-                if(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey()==Integer.parseInt(checkJobVO.getJobType())){
+                if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == Integer.parseInt(checkJobVO.getJobType())) {
 //                    //获取管理员所在科室
 //                    List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
 //                            .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -256,39 +253,34 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 }
             }
             return getCheckList(checkJobVO);
-        }
-        else
-        {
+        } else {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户的角色和任务类型不对应!");
         }
     }
+
     /**
      * @Author songxl
      * @Description 待分配列表页面校验
-     * @Date  2021/5/18
+     * @Date 2021/5/18
      * @Param [checkJobVO]
      * @Return void
      * @MethodName userCheckPageSet
      */
-    private void userCheckPageSet(CheckJobPageVO  checkJobVO) {
-        if(StringUtil.isBlank(checkJobVO.getStartTime())&&StringUtil.isBlank(checkJobVO.getEndTime())
-                &&StringUtil.isBlank(checkJobVO.getBehosDateStart())&&StringUtil.isBlank(checkJobVO.getBehosDateEnd()))
-        {
+    private void userCheckPageSet(CheckJobPageVO checkJobVO) {
+        if (StringUtil.isBlank(checkJobVO.getStartTime()) && StringUtil.isBlank(checkJobVO.getEndTime())
+                && StringUtil.isBlank(checkJobVO.getBehosDateStart()) && StringUtil.isBlank(checkJobVO.getBehosDateEnd())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
         }
-        if(StringUtil.isBlank(checkJobVO.getJobType()))
-        {
+        if (StringUtil.isBlank(checkJobVO.getJobType())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有任务类型!");
         }
-        if(StringUtil.isNotBlank(checkJobVO.getBehosDateStart())&&StringUtil.isNotBlank(checkJobVO.getBehosDateEnd()))
-        {
+        if (StringUtil.isNotBlank(checkJobVO.getBehosDateStart()) && StringUtil.isNotBlank(checkJobVO.getBehosDateEnd())) {
             if (DateUtil.after(DateUtil.parseDate(checkJobVO.getBehosDateStart()),
                     DateUtil.parseDate(checkJobVO.getBehosDateEnd()))) {
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
             }
         }
-        if(StringUtil.isNotBlank(checkJobVO.getStartTime())&&StringUtil.isNotBlank(checkJobVO.getEndTime()))
-        {
+        if (StringUtil.isNotBlank(checkJobVO.getStartTime()) && StringUtil.isNotBlank(checkJobVO.getEndTime())) {
             if (DateUtil.after(DateUtil.parseDate(checkJobVO.getStartTime()),
                     DateUtil.parseDate(checkJobVO.getEndTime()))) {
                 throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "任务生成的开始时间必须小于结束时间!");
@@ -300,9 +292,9 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
     /**
      * @Author songxl
      * @Description 获取操作用户的核查科室以及科室核查人员
-     * @Date  2021/5/14
+     * @Date 2021/5/14
      * @Param []
-     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @Return java.util.Map<java.lang.String, java.util.List < com.diagbot.dto.CheckDeptDTO>>
      * @MethodName getCheckUserMap
      */
     public Map<String, List<CheckDeptDTO>> getCheckUserMap() {
@@ -314,7 +306,7 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //获取核查监管相关角色id
         List<Long> checkRoleIds = sysRoleFacade.list(new QueryWrapper<SysRole>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .like("name","监管人员")
+                .like("name", "监管人员")
         ).stream().map(SysRole::getId).collect(Collectors.toList());
         //查询该角色的所有角色id
         List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
@@ -323,66 +315,60 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         ).stream().distinct().map(SysUserRole::getRoleId).collect(Collectors.toList());
         List<Long> searchRoleIds = new ArrayList<>();
         //当前用户是监管人员或者是超级管理员
-        if(roleIds.contains(-1L))
-        {
-               searchRoleIds.addAll(checkRoleIds);
-        }
-        else{
-            searchRoleIds.addAll(containsRole(checkRoleIds,roleIds));
+        if (roleIds.contains(-1L)) {
+            searchRoleIds.addAll(checkRoleIds);
+        } else {
+            searchRoleIds.addAll(containsRole(checkRoleIds, roleIds));
         }
-        if(searchRoleIds.isEmpty())
-        {
+        if (searchRoleIds.isEmpty()) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户不是核查监管人员!");
         }
         //2.获取相应角色对应的科室以及核查人员
-        Map<String, List<CheckDeptDTO>> checkUserMap = getCheckRoleMap(searchRoleIds,hospitalId,principleId);
+        Map<String, List<CheckDeptDTO>> checkUserMap = getCheckRoleMap(searchRoleIds, hospitalId, principleId);
         return checkUserMap;
     }
+
     /**
      * @Author songxl
      * @Description 获取相应角色对应的科室以及核查人员
-     * @Date  2021/5/14
+     * @Date 2021/5/14
      * @Param [searchRoleIds]
-     * @Return java.util.Map<java.lang.String,java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>
+     * @Return java.util.Map<java.lang.String, java.util.List < java.util.Map < java.lang.String, java.lang.Object>>>
      * @MethodName getCheckRoleMap
      */
 
-    private Map<String, List<CheckDeptDTO>> getCheckRoleMap(List<Long> searchRoleIds,Long hospitalId,Long principleId) {
+    private Map<String, List<CheckDeptDTO>> getCheckRoleMap(List<Long> searchRoleIds, Long hospitalId, Long principleId) {
         Map<String, List<CheckDeptDTO>> checkRoleMap = new HashMap<>();
-        for(Long id:searchRoleIds)
-        {
-            try
-            {
+        for (Long id : searchRoleIds) {
+            try {
                 //不同角色不同查询方式
-                switch (id.intValue())
-                {
+                switch (id.intValue()) {
                     //临床科室监管人员
                     case 4:
-                        getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
+                        getDeptCheckInfo(checkRoleMap, hospitalId, principleId);
                         break;
                     //质控科监管人员
                     case 5:
-                        getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
+                        getZKKCheckInfo(checkRoleMap, hospitalId, principleId);
                         break;
                     //院级监管人员
                     case 6:
-                        getYQCheckInfo(checkRoleMap,hospitalId,principleId);
+                        getYQCheckInfo(checkRoleMap, hospitalId, principleId);
                         break;
                     default:
                         break;
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
         return checkRoleMap;
     }
+
     /**
      * @Author songxl
      * @Description 院区管理员获取管理的科室以及科室包涵质控人员
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [checkRoleMap, hospitalId, principleId]
      * @Return void
      * @MethodName getYQCheckInfo
@@ -391,35 +377,37 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //1.获取院级质控人员有哪些
         //1.1获取院级质控人员角色id
         CheckUserVO checkUserVOS = new CheckUserVO();
-        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.HOSP_GENERAL.getKey()*1l));
+        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.HOSP_GENERAL.getKey() * 1l));
         checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
         checkUserVOS.setHospitalId(hospitalId);
         List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
         //2.用户科室整合
-        margeDept(checkRoleMap,checkUserDTOS,CheckerRoleEnum.HOSP_SUPERVISOR.getKey()+"");
-        if(!ListUtil.isEmpty(checkRoleMap.get(CheckerRoleEnum.HOSP_SUPERVISOR.getKey()+""))){
+        margeDept(checkRoleMap, checkUserDTOS, CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + "");
+        if (!ListUtil.isEmpty(checkRoleMap.get(CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + ""))) {
             //2.3获取所有医生信息的核查数
             CheckUserVO checkUserVO = new CheckUserVO();
             checkUserVO.setJobType(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey());
             //通过核查人员id获取核查人员的核查任务数
             List<DeptCheckUserDTO> userJobs = baseMapper.getDeptJobNumByUserId(checkUserVO);
-            addCheckInfoMaps(checkRoleMap,null,userJobs,checkUserDTOS,CheckerRoleEnum.HOSP_SUPERVISOR.getKey(),CheckJobTypeEnum.HOSP_SUPERVISOR.getKey());
-        }
-        else {
-            checkRoleMap.put(CheckerRoleEnum.HOSP_SUPERVISOR.getKey()+"",new ArrayList<>());
+            addCheckInfoMaps(checkRoleMap, null, userJobs, checkUserDTOS, CheckerRoleEnum.HOSP_SUPERVISOR.getKey(), CheckJobTypeEnum.HOSP_SUPERVISOR.getKey());
+        } else {
+            checkRoleMap.put(CheckerRoleEnum.HOSP_SUPERVISOR.getKey() + "", new ArrayList<>());
         }
 
     }
+
     /**
      * @Author songxl
      * @Description 院区人员用户科室合并
-     * @Date  2021/6/1
+     * @Date 2021/6/1
      * @Param [checkRoleMap, checkUserDTOS, s]
      * @Return void
      * @MethodName margeDept
      */
     private void margeDept(Map<String, List<CheckDeptDTO>> checkRoleMap, List<CheckUserDTO> checkUserDTOS, String roleId) {
-        if(ListUtil.isEmpty(checkUserDTOS)){return;}
+        if (ListUtil.isEmpty(checkUserDTOS)) {
+            return;
+        }
         Set<String> userIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toSet());
         try {
             List<CheckDeptDTO> tempDepts = new ArrayList<>();
@@ -433,13 +421,15 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 StringBuilder deptNameBuilder = new StringBuilder();
                 StringBuilder userName = new StringBuilder();
                 checkUserDTOS.stream().forEach(checkUserDTO -> {
-                    if(userId.equals(checkUserDTO.getDoctorId())){
+                    if (userId.equals(checkUserDTO.getDoctorId())) {
                         deptIdBuilder.append(checkUserDTO.getDeptId()).append(",");
                         deptNameBuilder.append(checkUserDTO.getDeptName()).append(",");
-                        if(userName.length()==0){userName.append(checkUserDTO.getDoctorName());}
+                        if (userName.length() == 0) {
+                            userName.append(checkUserDTO.getDoctorName());
+                        }
                         //除了全部以外添加科室信息
-                        if(!tempDepts.stream().map(CheckDeptDTO::getDeptId).collect(Collectors.toList())
-                                .contains(checkUserDTO.getDeptId())){
+                        if (!tempDepts.stream().map(CheckDeptDTO::getDeptId).collect(Collectors.toList())
+                                .contains(checkUserDTO.getDeptId())) {
                             CheckDeptDTO oneCheckUser = new CheckDeptDTO();
                             oneCheckUser.setDeptId(checkUserDTO.getDeptId());
                             oneCheckUser.setDeptName(checkUserDTO.getDeptName());
@@ -449,8 +439,8 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 });
 
                 //合并科室
-                String deptId = deptIdBuilder.substring(0,deptIdBuilder.length()-1);
-                String deptName = deptNameBuilder.substring(0,deptNameBuilder.length()-1);
+                String deptId = deptIdBuilder.substring(0, deptIdBuilder.length() - 1);
+                String deptName = deptNameBuilder.substring(0, deptNameBuilder.length() - 1);
                 //科室用户
                 DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
                 deptCheckUserDTO.setDoctorId(userId);
@@ -459,28 +449,27 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 deptCheckUserDTO.setDeptName(deptName);
                 AtomicBoolean hasFlag = new AtomicBoolean(false);
                 //全部处理
-                if(ListUtil.isEmpty(allCheckDept.getDeptcheckUsers())){
+                if (ListUtil.isEmpty(allCheckDept.getDeptcheckUsers())) {
                     allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
                 }
                 allCheckDept.getDeptcheckUsers().forEach(oneDeptCheckUser -> {
-                    if(!deptId.equals(oneDeptCheckUser.getDeptId())&&!userId.equals(oneDeptCheckUser.getDoctorId()))
-                    {
+                    if (!userId.equals(oneDeptCheckUser.getDoctorId())) {
                         hasFlag.set(true);
                     }
                 });
-                if(hasFlag.get()){
+                if (hasFlag.get()) {
                     allCheckDept.getDeptcheckUsers().add(deptCheckUserDTO);
                 }
 
                 tempDepts.stream().forEach(checkDeptDTO -> {
-                    if(deptId.contains(checkDeptDTO.getDeptId())){
+                    if (deptId.contains(checkDeptDTO.getDeptId())) {
                         checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
                     }
                 });
             });
-            tempDepts.add(0,allCheckDept);
-            checkRoleMap.put(roleId+"",tempDepts);
-        }catch (Exception e){
+            tempDepts.add(0, allCheckDept);
+            checkRoleMap.put(roleId + "", tempDepts);
+        } catch (Exception e) {
             e.printStackTrace();
         }
 
@@ -489,20 +478,19 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
     /**
      * @Author songxl
      * @Description 质控科管理员获取管理的科室以及科室包涵质控人员
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [checkRoleMap, hospitalId, principleId]
      * @Return void
      * @MethodName getZKKCheckInfo
      */
     private void getZKKCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
         //1.获取质控科id
-        String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
+        BasDeptInfo deptInfo = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .like("dept_name","质管科")).getDeptId();
-        if(StringUtil.isBlank(zkkDeptId))
-        {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在!");
+                .eq("hospital_id", hospitalId)
+                .eq("station", "质管"));
+        if (deptInfo == null || deptInfo.getDeptId() == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在,请联系管理员!");
         }
 //        //2.获取监管人员所在科室集合
 //        List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
@@ -518,20 +506,19 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
 //        }
         CheckUserVO checkUserVOS = new CheckUserVO();
         //质管科人员角色
-        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.QUAT_GENERAL.getKey()*1l));
+        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.QUAT_GENERAL.getKey() * 1l));
         //质管科
         checkUserVOS.setDeptStations(Lists.newArrayList("质管"));
-        checkUserVOS.setDeptIds(Lists.newArrayList(zkkDeptId));
+        checkUserVOS.setDeptIds(Lists.newArrayList(deptInfo.getDeptId()));
         checkUserVOS.setHospitalId(hospitalId);
         List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
         //2.1获取科室详情
-        Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
+        Map<String, String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .in("dept_id",Lists.newArrayList(zkkDeptId))).stream()
-                .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
-        if(deptMap!=null&&!deptMap.isEmpty())
-        {
+                .eq("hospital_id", hospitalId)
+                .in("dept_id", Lists.newArrayList(deptInfo.getDeptId()))).stream()
+                .collect(Collectors.toMap(BasDeptInfo::getDeptId, BasDeptInfo::getDeptName, (v1, v2) -> v2));
+        if (deptMap != null && !deptMap.isEmpty()) {
             //2.3获取质控科核查人员的核查数
             List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
             CheckUserVO checkUserVO = new CheckUserVO();
@@ -540,19 +527,19 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             //通过核查人员id获取核查人员的核查任务数
             List<DeptCheckUserDTO> userJobs = baseMapper.getDeptJobNumByUserId(checkUserVO);
             userJobs.stream().forEach(deptCheckUserDTO -> {
-                deptCheckUserDTO.setDeptId(zkkDeptId);
+                deptCheckUserDTO.setDeptId(deptInfo.getDeptId());
             });
-            addCheckInfoMaps(checkRoleMap,deptMap,userJobs,checkUserDTOS,CheckerRoleEnum.QUAT_SUPERVISOR.getKey(),CheckJobTypeEnum.QUAT_SUPERVISOR.getKey());
-        }
-        else {
-            checkRoleMap.put(CheckerRoleEnum.QUAT_SUPERVISOR.getKey()+"",new ArrayList<>());
+            addCheckInfoMaps(checkRoleMap, deptMap, userJobs, checkUserDTOS, CheckerRoleEnum.QUAT_SUPERVISOR.getKey(), CheckJobTypeEnum.QUAT_SUPERVISOR.getKey());
+        } else {
+            checkRoleMap.put(CheckerRoleEnum.QUAT_SUPERVISOR.getKey() + "", new ArrayList<>());
         }
 
     }
+
     /**
      * @Author songxl
      * @Description 临床科室管理员获取管理的科室以及科室包涵质控人员
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [checkRoleMap, hospitalId, principleId]
      * @Return void
      * @MethodName getDeptCheckInfo
@@ -562,31 +549,37 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //1.获取监管人员所在科室集合
         List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .eq("user_id",principleId)
+                .eq("hospital_id", hospitalId)
+                .eq("user_id", principleId)
         ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
-        if(deptIds.isEmpty()){return;}
+        if (deptIds.isEmpty()) {
+            return;
+        }
         //1.2去除质管科
-        String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
+        BasDeptInfo deptInfo = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .like("dept_name","质管科")).getDeptId();
-        if(StringUtil.isNotBlank(zkkDeptId)){deptIds.remove(zkkDeptId);}
+                .eq("hospital_id", hospitalId)
+                .eq("station", "质管"));
+        if (deptInfo == null || deptInfo.getDeptId() == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在,请联系管理员!");
+        }
+        if (StringUtil.isNotBlank(deptInfo.getDeptId())) {
+            deptIds.remove(deptInfo.getDeptId());
+        }
         CheckUserVO checkUserVOS = new CheckUserVO();
         //科室普通核查人员角色筛选
-        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.DEPT_GENERAL.getKey()*1l));
+        checkUserVOS.setRoleIds(Lists.newArrayList(CheckerRoleEnum.DEPT_GENERAL.getKey() * 1l));
         checkUserVOS.setDeptIds(deptIds);
         checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
         checkUserVOS.setHospitalId(hospitalId);
         List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
         //2.1获取科室详情
-        Map<String,String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
+        Map<String, String> deptMap = basDeptInfoFacade.list(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .in("dept_id",deptIds)).stream()
-                .collect(Collectors.toMap(BasDeptInfo::getDeptId,BasDeptInfo::getDeptName, (v1, v2) -> v2));
-        if(deptMap!=null&&!deptMap.isEmpty())
-        {
+                .eq("hospital_id", hospitalId)
+                .in("dept_id", deptIds)).stream()
+                .collect(Collectors.toMap(BasDeptInfo::getDeptId, BasDeptInfo::getDeptName, (v1, v2) -> v2));
+        if (deptMap != null && !deptMap.isEmpty()) {
             //2.3获取所有医生信息的核查数
             List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
             CheckUserVO checkUserVO = new CheckUserVO();
@@ -595,44 +588,41 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
             checkUserVO.setDeptIds(deptIds);
             //通过核查人员id获取核查人员的核查任务数
             List<DeptCheckUserDTO> userJobs = baseMapper.getDeptJobNumByUserId(checkUserVO);
-            addCheckInfoMaps(checkRoleMap,deptMap,userJobs,checkUserDTOS,CheckerRoleEnum.DEPT_SUPERVISOR.getKey(),CheckJobTypeEnum.DEPT_SUPERVISOR.getKey());
-        }
-        else {
-            checkRoleMap.put(CheckerRoleEnum.DEPT_SUPERVISOR.getKey()+"",new ArrayList<>());
+            addCheckInfoMaps(checkRoleMap, deptMap, userJobs, checkUserDTOS, CheckerRoleEnum.DEPT_SUPERVISOR.getKey(), CheckJobTypeEnum.DEPT_SUPERVISOR.getKey());
+        } else {
+            checkRoleMap.put(CheckerRoleEnum.DEPT_SUPERVISOR.getKey() + "", new ArrayList<>());
         }
 
 
-
     }
 
     /**
      * @Author songxl
      * @Description 拼装科室、核查人员、任务数对象
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [checkRoleMap, doctorInfos, userJobs, deptInfos, roleId]
      * @Return void
      * @MethodName addCheckInfoMap
      */
     private void addCheckInfoMaps(Map<String, List<CheckDeptDTO>> checkRoleMap, Map<String, String> deptMap,
-                                  List<DeptCheckUserDTO> userJobs, List<CheckUserDTO> checkUserDTOS, int roleId,int jobType) {
+                                  List<DeptCheckUserDTO> userJobs, List<CheckUserDTO> checkUserDTOS, int roleId, int jobType) {
         //非院区任务
-        if(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey()!=jobType){
-            if(deptMap.isEmpty()||checkUserDTOS.isEmpty()){return;}
-            checkRoleMap.put(roleId+"",new ArrayList<>());
+        if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() != jobType) {
+            if (deptMap.isEmpty() || checkUserDTOS.isEmpty()) {
+                return;
+            }
+            checkRoleMap.put(roleId + "", new ArrayList<>());
             //遍历科室
-            for(String deptId:deptMap.keySet())
-            {
+            for (String deptId : deptMap.keySet()) {
                 //科室对象
                 CheckDeptDTO checkDeptDTO = new CheckDeptDTO();
                 checkDeptDTO.setDeptId(deptId);
                 checkDeptDTO.setDeptName(deptMap.get(deptId));
                 checkDeptDTO.setDeptcheckUsers(new ArrayList<DeptCheckUserDTO>());
                 //遍历医生
-                for(CheckUserDTO checkUserDTO:checkUserDTOS)
-                {
+                for (CheckUserDTO checkUserDTO : checkUserDTOS) {
                     //同一科室
-                    if(checkDeptDTO.getDeptId().equals(checkUserDTO.getDeptId()))
-                    {
+                    if (checkDeptDTO.getDeptId().equals(checkUserDTO.getDeptId())) {
                         DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
                         deptCheckUserDTO.setDeptId(checkUserDTO.getDeptId());
                         deptCheckUserDTO.setDeptName(checkUserDTO.getDeptName());
@@ -641,20 +631,16 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                         checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
                     }
                 }
-                for(DeptCheckUserDTO deptCheckUserDTO:checkDeptDTO.getDeptcheckUsers())
-                {
+                for (DeptCheckUserDTO deptCheckUserDTO : checkDeptDTO.getDeptcheckUsers()) {
                     //遍历数量
-                    for(DeptCheckUserDTO jobNumDto:userJobs)
-                    {
+                    for (DeptCheckUserDTO jobNumDto : userJobs) {
                         //这个科室有这个人
-                        if(deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId()))
-                        {
-                            if(deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
-                            {
-                                if(jobNumDto.getStatus()==0){
+                        if (deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId())) {
+                            if (deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId())) {
+                                if (jobNumDto.getStatus() == 0) {
                                     deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
                                 }
-                                if(jobNumDto.getStatus()==1){
+                                if (jobNumDto.getStatus() == 1) {
 
                                     deptCheckUserDTO.setCheckNum(jobNumDto.getJobNum());
                                 }
@@ -663,21 +649,20 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                         }
                     }
                 }
-                checkRoleMap.get(roleId+"").add(checkDeptDTO);
+                checkRoleMap.get(roleId + "").add(checkDeptDTO);
             }
         }
         //院区任务不是同一科室的人员数量增加
-        else if(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey()==jobType)
-        {
-            checkRoleMap.get(roleId+"").stream().forEach(checkDeptDTO -> {
-                if(!ListUtil.isEmpty(checkDeptDTO.getDeptcheckUsers())){
+        else if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == jobType) {
+            checkRoleMap.get(roleId + "").stream().forEach(checkDeptDTO -> {
+                if (!ListUtil.isEmpty(checkDeptDTO.getDeptcheckUsers())) {
                     checkDeptDTO.getDeptcheckUsers().stream().forEach(deptCheckUser -> {
                         userJobs.stream().forEach(userJob -> {
-                            if(deptCheckUser.getDoctorId().equals(userJob.getDoctorId())){
-                                if(userJob.getStatus()==0){
+                            if (deptCheckUser.getDoctorId().equals(userJob.getDoctorId())) {
+                                if (userJob.getStatus() == 0) {
                                     deptCheckUser.setJobNum(userJob.getJobNum());
                                 }
-                                if(userJob.getStatus()==1){
+                                if (userJob.getStatus() == 1) {
                                     deptCheckUser.setCheckNum(userJob.getJobNum());
                                 }
                             }
@@ -689,31 +674,29 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
     }
 
 
-
     /**
      * @Author songxl
      * @Description list求交集
-     * @Date  2021/5/14
+     * @Date 2021/5/14
      * @Param [checkRoleIds, roleIds]
      * @Return java.util.List<java.lang.Long>
      * @MethodName containsRole
      */
-    private  List<Long> containsRole(List<Long> checkRoleIds, List<Long> roleIds) {
+    private List<Long> containsRole(List<Long> checkRoleIds, List<Long> roleIds) {
 
         List<Long> searchRoleIds = new ArrayList<>();
-        for(Long id:roleIds)
-        {
-            if(checkRoleIds.contains(id))
-            {
+        for (Long id : roleIds) {
+            if (checkRoleIds.contains(id)) {
                 searchRoleIds.add(id);
             }
         }
         return searchRoleIds;
     }
+
     /**
      * @Author songxl
      * @Description 分配/取消核查任务
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [distributionJobVO]
      * @Return boolean
      * @MethodName distributionJobs
@@ -721,30 +704,28 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
     public boolean distributionJobs(DistributionJobVO distributionJobVO) {
 
         //1非空校验
-        if(StringUtil.isBlank(distributionJobVO.getCheckId())||
-                StringUtil.isBlank(distributionJobVO.getCheckName())||
-                StringUtil.isBlank(distributionJobVO.getDistributionType())||
-                distributionJobVO.getBehospitalCodes()==null||
-                distributionJobVO.getBehospitalCodes().isEmpty())
-        {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,"入参为空");
+        if (StringUtil.isBlank(distributionJobVO.getCheckId()) ||
+                StringUtil.isBlank(distributionJobVO.getCheckName()) ||
+                StringUtil.isBlank(distributionJobVO.getDistributionType()) ||
+                distributionJobVO.getBehospitalCodes() == null ||
+                distributionJobVO.getBehospitalCodes().isEmpty()) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "入参为空");
         }
-        if(StringUtil.isBlank(distributionJobVO.getCheckDept())){
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,"核查人科室(checkDept)为空");
+        if (StringUtil.isBlank(distributionJobVO.getCheckDept())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "核查人科室(checkDept)为空");
         }
-        if(distributionJobVO.getBehospitalDepts()==null
-                ||distributionJobVO.getBehospitalDepts().isEmpty()){
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,"核查任务科室集合(behospitalDepts)为空");
+        if (distributionJobVO.getBehospitalDepts() == null
+                || distributionJobVO.getBehospitalDepts().isEmpty()) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "核查任务科室集合(behospitalDepts)为空");
         }
-        if(StringUtil.isEmpty(distributionJobVO.getJobType()))
-        {
-            throw new CommonException(CommonErrorCode.PARAM_IS_NULL,"核查任务类型(jobType)为空");
+        if (StringUtil.isEmpty(distributionJobVO.getJobType())) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "核查任务类型(jobType)为空");
         }
         //全院的话要判断院级核查人员和核查病历不是同一科室
-        if(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey()==Integer.parseInt(distributionJobVO.getJobType())){
-            for(String deptId:distributionJobVO.getCheckDept().split(",")){
-                if(distributionJobVO.getBehospitalDepts().contains(deptId)){
-                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,"院级核查人员和核查病历是同一科室");
+        if (CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() == Integer.parseInt(distributionJobVO.getJobType())) {
+            for (String deptId : distributionJobVO.getCheckDept().split(",")) {
+                if (distributionJobVO.getBehospitalDepts().contains(deptId)) {
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "院级核查人员和核查病历是同一科室");
                 }
             }
 
@@ -755,32 +736,32 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         //2.获取任务类型 0分配 1取消
         String distributionType = distributionJobVO.getDistributionType();
         //3 分配
-        if(StringUtil.isNotBlank(distributionType)&&"0".equals(distributionType))
-        {
+        if (StringUtil.isNotBlank(distributionType) && "0".equals(distributionType)) {
             //3.1 任务未分配校验
             List<String> distributionNames = this.list(new QueryWrapper<MedCheckInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id",hospitalId)
-                    .in("behospital_code",distributionJobVO.getBehospitalCodes())
-                    ).stream().filter(s-> s.getJobDistributionName() !=null).map(MedCheckInfo::getJobDistributionName)
+                    .eq("hospital_id", hospitalId)
+                    .in("behospital_code", distributionJobVO.getBehospitalCodes())
+            ).stream().filter(s -> s.getJobDistributionName() != null).map(MedCheckInfo::getJobDistributionName)
                     .collect(Collectors.toList());
-            if(distributionNames!=null&&distributionNames.size()>0)
-            {
+            if (distributionNames != null && distributionNames.size() > 0) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "待分配任务列表存在已分配任务!");
             }
 
             //获取分配用户信息
             QueryWrapper<SysUser> userQuer = new QueryWrapper<>();
             userQuer.eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("id",principleId)
-                    .eq("status",1);
+                    .eq("id", principleId)
+                    .eq("status", 1);
             SysUser user = sysUserFacade.getOne(userQuer);
             String principleName = user.getLinkman();
             //用户名称如果是null(目的:分配用户名为null表示用户未分配)
-            if(principleName==null){principleName = "";}
+            if (principleName == null) {
+                principleName = "";
+            }
             Date now = DateUtil.now();
             //3.2分配核查任务
-            return  this.update(new UpdateWrapper<MedCheckInfo>()
+            return this.update(new UpdateWrapper<MedCheckInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
                     .eq("hospital_id", hospitalId)
                     .in("behospital_code", distributionJobVO.getBehospitalCodes())
@@ -792,31 +773,27 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
 
         }
         //4 取消分配
-        else if(StringUtil.isNotBlank(distributionType)&&"1".equals(distributionType))
-        {
+        else if (StringUtil.isNotBlank(distributionType) && "1".equals(distributionType)) {
             //4.1 任务已取消校验
             Set<Long> checkIds = this.list(new QueryWrapper<MedCheckInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq("hospital_id",hospitalId)
-                    .in("behospital_code",distributionJobVO.getBehospitalCodes())
+                    .eq("hospital_id", hospitalId)
+                    .in("behospital_code", distributionJobVO.getBehospitalCodes())
             ).stream().map(MedCheckInfo::getCheckId).collect(Collectors.toSet());
             //4.2获取出来的核查用户存在但不是一个
-            if(checkIds==null||checkIds.isEmpty()||
-                    (checkIds.size()!=1&&checkIds.contains(distributionJobVO.getCheckId())))
-            {
+            if (checkIds == null || checkIds.isEmpty() ||
+                    (checkIds.size() != 1 && checkIds.contains(distributionJobVO.getCheckId()))) {
                 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "待取消分配任务列表不存在或存在不是该用户的任务!");
-            }
-            else
-            {
+            } else {
                 Date now = DateUtil.now();
                 //4.3取消分配
                 Long a = null;
-                return  this.update(new UpdateWrapper<MedCheckInfo>()
+                return this.update(new UpdateWrapper<MedCheckInfo>()
                         .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", hospitalId)
-                        .eq("check_id",  distributionJobVO.getCheckId())
+                        .eq("check_id", distributionJobVO.getCheckId())
                         .in("behospital_code", distributionJobVO.getBehospitalCodes())
-                        .set("job_distributor",a)
+                        .set("job_distributor", a)
                         .set("job_distribution_name", a)
                         .set("check_id", a)
                         .set("check_name", a)
@@ -826,32 +803,29 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
 
         return false;
     }
+
     /**
      * @Author songxl
      * @Description 获取指定核查人员的核查任务
-     * @Date  2021/5/17
+     * @Date 2021/5/17
      * @Param [checkJobVO]
      * @Return java.util.List<com.diagbot.dto.CheckJobDTO>
      * @MethodName getCheckListByUserId
      */
     public IPage<CheckJobDTO> getCheckListByUserId(CheckJobPageVO checkJobVO) {
         //非空校验
-        if(StringUtil.isBlank(checkJobVO.getCheckId()))
-        {
+        if (StringUtil.isBlank(checkJobVO.getCheckId())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传核查用户id!");
         }
-        IPage<CheckJobDTO> checkJobDTOS= baseMapper.getCheckListByUserId(checkJobVO);
+        IPage<CheckJobDTO> checkJobDTOS = baseMapper.getCheckListByUserId(checkJobVO);
         //获取当前登录人员
         Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
         List<CheckJobDTO> outCheckJobDTOS = new ArrayList<>();
         //判断分配人员是否是当前人员
-        for(CheckJobDTO checkJobDTO:checkJobDTOS.getRecords())
-        {
-            if (principleId.equals(checkJobDTO.getJobDistributor()))
-            {
+        for (CheckJobDTO checkJobDTO : checkJobDTOS.getRecords()) {
+            if (principleId.equals(checkJobDTO.getJobDistributor())) {
                 checkJobDTO.setDelFlag(true);
-            }
-            else {
+            } else {
                 checkJobDTO.setDelFlag(false);
             }
             outCheckJobDTOS.add(checkJobDTO);

+ 121 - 0
src/main/java/com/diagbot/facade/MedicalRecordOtherFacade.java

@@ -0,0 +1,121 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.diagbot.dto.*;
+import com.diagbot.entity.MedicalRecord;
+import com.diagbot.entity.MedicalRecordContent;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.facade.data.AMedicalRecordContentFacade;
+import com.diagbot.service.impl.MedicalRecordServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.EncrypDES;
+import com.diagbot.util.StringUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.MedRecordContentOtherVO;
+import com.diagbot.vo.MedRecordOtherVO;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description:
+ * @author: Wsy
+ * @time: 2022/3/9 11:39
+ */
+@Component
+public class MedicalRecordOtherFacade extends MedicalRecordServiceImpl {
+
+    @Autowired
+    private MedicalRecordFacade medicalRecordFacade;
+
+    @Autowired
+    private AMedicalRecordContentFacade AMedicalRecordContentFacade;
+
+    @Value("${encrypt.enable}")
+    Boolean encryptFlag;
+
+    /**
+     * @param medRecordOtherVO
+     * @return
+     */
+    public IPage<MedicalRecord> pageFac(MedRecordOtherVO medRecordOtherVO) {
+        Boolean flag = false;
+        QueryWrapper<MedicalRecord> medicalRecordQueryWrapper = new QueryWrapper<>();
+        medicalRecordQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
+        medicalRecordQueryWrapper.eq("hospital_id", Long.valueOf(SysUserUtils.getCurrentHospitalID()));
+        medicalRecordQueryWrapper.eq("mode_id", 0);
+        if (medRecordOtherVO != null) {
+            medicalRecordQueryWrapper.eq("behospital_code", medRecordOtherVO.getBehospitalCode());
+        }
+
+        if (medRecordOtherVO.getRecTitle() != null && medRecordOtherVO != null) {
+            medicalRecordQueryWrapper.like("rec_title", medRecordOtherVO.getRecTitle());
+        }
+        if (medRecordOtherVO.getRecDateStart() != null && medRecordOtherVO != null) {
+            medicalRecordQueryWrapper.ge("rec_date", medRecordOtherVO.getRecDateStart());
+        }
+        if (medRecordOtherVO.getRecDateEnd() != null && medRecordOtherVO != null) {
+            medicalRecordQueryWrapper.le("rec_date", medRecordOtherVO.getRecDateEnd());
+        }
+        for (Object order : medRecordOtherVO.getOrders()) {
+            ObjectMapper objectMapper = new ObjectMapper();
+            OrderItem orderName = objectMapper.convertValue(order, OrderItem.class);
+            String column = orderName.getColumn();
+            if (StringUtil.isNotEmpty(column) && orderName.isAsc()) {
+                flag = true;
+            }
+        }
+        if (flag) {
+            medicalRecordQueryWrapper.orderByAsc("rec_date");
+        } else {
+            medicalRecordQueryWrapper.orderByDesc("rec_date");
+        }
+
+        Page<MedicalRecord> pageCase = new Page<MedicalRecord>(medRecordOtherVO.getCurrent(), medRecordOtherVO.getSize());
+        IPage<MedicalRecord> medicalRecordIPage = medicalRecordFacade.getBaseMapper().selectPage(pageCase, medicalRecordQueryWrapper);
+
+        return medicalRecordIPage;
+    }
+
+    /**
+     * 文书详情
+     */
+    public MedRecordContentOtherDTO getRecordContentOther(MedRecordContentOtherVO medRecordContentOtherVO) {
+        MedicalRecordContent medicalRecordContent = AMedicalRecordContentFacade.getOne(new QueryWrapper<MedicalRecordContent>()
+                .eq("hospital_id", Long.valueOf(SysUserUtils.getCurrentHospitalID()))
+                .eq("rec_id", medRecordContentOtherVO.getRecId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+        );
+        if (medicalRecordContent != null) {
+            if (medicalRecordContent.getHospitalId() == 35) {
+                medicalRecordContent.setHtmlText(medicalRecordContent.getXmlText());
+            }
+        } else {
+            throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该文书数据缺失~");
+        }
+        MedRecordContentOtherDTO medRecordContentOtherDTO = new MedRecordContentOtherDTO();
+        BeanUtil.copyProperties(medicalRecordContent, medRecordContentOtherDTO);
+        // 解密数据
+        if (encryptFlag) {
+            try {
+                EncrypDES encrypDES = new EncrypDES();
+                if (StringUtils.isNotEmpty(medRecordContentOtherDTO.getHtmlText())) {
+                    medRecordContentOtherDTO.setHtmlText(encrypDES.decryptor(medRecordContentOtherDTO.getHtmlText()));
+                }
+            } catch (Exception e) {
+                medRecordContentOtherDTO.setHtmlText(null);
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        "解密错误!病历ID=【" + medRecordContentOtherDTO.getRecId() + "】");
+            }
+        }
+        return medRecordContentOtherDTO;
+    }
+
+}

+ 50 - 1
src/main/java/com/diagbot/facade/QcModuleInfoFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.dto.GetModuleInfoOneDTO;
 import com.diagbot.dto.QcModuleDetailDTO;
@@ -13,6 +14,7 @@ import com.diagbot.service.impl.QcModuleInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.GetModuleInfoOneVO;
 import com.diagbot.vo.GetModuleMapVO;
 import com.diagbot.vo.QuestionIdsVO;
@@ -38,6 +40,8 @@ public class QcModuleInfoFacade extends QcModuleInfoServiceImpl {
     QcModuleDetailFacade qcModuleDetailFacade;
     @Autowired
     QcQuestionFacade qcQuestionFacade;
+    @Autowired
+    SysHospitalSetFacade sysHospitalSetFacade;
 
     /**
      * 根据id获取模板信息
@@ -95,10 +99,55 @@ public class QcModuleInfoFacade extends QcModuleInfoServiceImpl {
             return new HashMap<>();
         }
         GetModuleInfoOneVO getModuleInfoOneVO = new GetModuleInfoOneVO();
+        String pageShowFlag = sysHospitalSetFacade.getValue(getModuleMapVO.getHospitalId(), "page_show_flag");
+        String pageShowConfig = sysHospitalSetFacade.getValue(getModuleMapVO.getHospitalId(), "page_show_config");
         for (Long id : ids) {
             getModuleInfoOneVO.setModuleId(id);
-            res.put(id, getByIdFac(getModuleInfoOneVO));
+            GetModuleInfoOneDTO oneDTO = getByIdFac(getModuleInfoOneVO);
+            //原文书(超链接)配置
+            originalDocumentConfigure(oneDTO, pageShowFlag, pageShowConfig, getModuleMapVO.getHospitalId());
+            res.put(id, oneDTO);
         }
         return res;
     }
+
+    private void originalDocumentConfigure(GetModuleInfoOneDTO oneDTO, String pageShowFlag, String pageShowConfig, Long hospitalId) {
+        if (StringUtil.isNotEmpty(pageShowFlag) && StringUtil.isNotEmpty(pageShowConfig)) {
+            JSONObject pageShowFlagJSON = JSONObject.parseObject(pageShowFlag);
+            JSONObject pageShowConfigJSON = JSONObject.parseObject(pageShowConfig);
+            try {
+                if (pageShowFlagJSON.containsKey(oneDTO.getModeId().toString())) {
+                    if (pageShowFlagJSON.getBoolean(oneDTO.getModeId().toString())) {
+                        QcModuleDetailDTO qcModuleDetailDTO = createQcModuleDetailDTO(pageShowConfigJSON, hospitalId, oneDTO.getModeId());
+                        oneDTO.getModuleDetail().get(0).add(0,qcModuleDetailDTO);
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private QcModuleDetailDTO createQcModuleDetailDTO(JSONObject pageShowConfigJSON, Long hospitalId, Long modeId) {
+        QcModuleDetailDTO qcModuleDetailDTO = new QcModuleDetailDTO();
+        QuestionDTO questionDTO = new QuestionDTO();
+        qcModuleDetailDTO.setQuestionId(modeId*-1);
+        qcModuleDetailDTO.setGroupId(pageShowConfigJSON.getInteger("groupId"));
+
+        questionDTO.setId(modeId*-1);
+        questionDTO.setName("");
+        questionDTO.setVal(pageShowConfigJSON.getString("val"));
+        questionDTO.setTagName("");
+        questionDTO.setControlType(pageShowConfigJSON.getInteger("controlType"));
+        questionDTO.setTagType(pageShowConfigJSON.getInteger("tagType"));
+        questionDTO.setHospitalId(hospitalId);
+        questionDTO.setModeId(modeId);
+        questionDTO.setRetract(pageShowConfigJSON.getInteger("retract"));
+        questionDTO.setAddLine(pageShowConfigJSON.getInteger("addLine"));
+        questionDTO.setMonoLine(pageShowConfigJSON.getInteger("monoLine"));
+        questionDTO.setBold(pageShowConfigJSON.getInteger("bold"));
+        questionDTO.setPosition(pageShowConfigJSON.getInteger("position"));
+        qcModuleDetailDTO.setQuestionDTO(questionDTO);
+        return qcModuleDetailDTO;
+    }
 }

+ 96 - 44
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -2,18 +2,13 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.AlgorithmDTO;
 import com.diagbot.dto.AnalyzeDTO;
+import com.diagbot.dto.QcCasesHistoryDTO;
 import com.diagbot.dto.QcResultDTO;
 import com.diagbot.dto.SentEntryRecordDTO;
-import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.entity.MedCheckInfo;
-import com.diagbot.entity.MedQcresultCases;
-import com.diagbot.entity.QcCasesEntry;
-import com.diagbot.entity.QcMode;
-import com.diagbot.entity.QcresultDetail;
-import com.diagbot.entity.QcresultInfo;
-import com.diagbot.entity.SysUser;
+import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -25,12 +20,7 @@ import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
-import com.diagbot.vo.AlgorithmVO;
-import com.diagbot.vo.AnalyzeVO;
-import com.diagbot.vo.GetDetailVO;
-import com.diagbot.vo.MedQcresultCasesVO;
-import com.diagbot.vo.QcResultAlgVO;
-import com.diagbot.vo.QcresultVO;
+import com.diagbot.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -162,12 +152,18 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
             try {
                 useId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
             } catch (Exception e) {
-            //analyze_run运行质控没有登录认证   所以会获取不到
+                //analyze_run运行质控没有登录认证   所以会获取不到
                 useId = 952795279527L;
             }
         }
+        //获取上一次人工添加的缺陷
+        QcresultInfo qcresultInfoup
+                = this.getOne(
+                new QueryWrapper<QcresultInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", analyzeVO.getHospitalId())
+                        .eq("behospital_code", analyzeVO.getBehospitalCode()), false);
         Date now = DateUtil.now();
-        //逻辑删除记录
         this.update(new UpdateWrapper<QcresultInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", analyzeVO.getHospitalId())
@@ -205,16 +201,41 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         qcresultInfo.setGmtModified(now);
         qcresultInfo.setModifier(useId.toString());
         this.save(qcresultInfo);
+        Long newId = qcresultInfo.getId();
         //更新质控评分明细信息
         switch (algorithmVO.getType()) {
             //自动评分
             case 0:
                 //删除记录
-                qcresultDetailServiceImpl.remove(new QueryWrapper<QcresultDetail>()
+//                qcresultDetailServiceImpl.remove(new QueryWrapper<QcresultDetail>()
+//                        .eq("hospital_id", analyzeVO.getHospitalId())
+//                        .eq("behospital_code", analyzeVO.getBehospitalCode()));
+
+                //上一次人工评分条目
+                List<QcresultDetail> oldQcresultDetails = null;
+                if (qcresultInfoup != null) {
+                    oldQcresultDetails = qcresultDetailServiceImpl.list(new QueryWrapper<QcresultDetail>()
+                            .eq("hospital_id", analyzeVO.getHospitalId())
+                            .eq("qcresult_info_id", qcresultInfoup.getId())
+                            .eq("grade_type", "2")
+                            .eq("behospital_code", analyzeVO.getBehospitalCode()));
+                }
+
+                qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
                         .eq("hospital_id", analyzeVO.getHospitalId())
-                        .eq("behospital_code", analyzeVO.getBehospitalCode()));
+                        .eq("behospital_code", analyzeVO.getBehospitalCode())
+                        .set("is_deleted", IsDeleteEnum.Y.getKey()));
+                //
                 //批量插入新的数据
                 List<QcresultDetail> qcresultDetailList = new ArrayList<>();
+                if (ListUtil.isNotEmpty(oldQcresultDetails)) {
+                    qcresultDetailList.addAll(oldQcresultDetails);
+                    qcresultDetailList.forEach(qcresultDetail -> {
+                        //原手动添加缺陷绑定新机器评分id
+                        qcresultDetail.setQcresultInfoId(newId);
+                    });
+                }
                 List<QcResultAlgVO> qcResultAlgVORes = algorithmVO.getQcResultAlgVOList();
                 if (ListUtil.isNotEmpty(qcResultAlgVORes)) {
                     for (QcResultAlgVO qcResultAlgVO : qcResultAlgVORes) {
@@ -229,10 +250,11 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         qcresultDetail.setGmtModified(now);
                         qcresultDetail.setModifier(useId.toString());
                         qcresultDetail.setInfo(StringUtil.isNotBlank(qcResultAlgVO.getInfo()) ? qcResultAlgVO.getInfo() : "");
+                        qcresultDetail.setQcresultInfoId(newId);
                         qcresultDetailList.add(qcresultDetail);
                     }
-                    qcresultDetailServiceImpl.saveBatch(qcresultDetailList);
                 }
+                qcresultDetailServiceImpl.saveBatch(qcresultDetailList);
                 break;
             case 1:
                 //新增条目
@@ -246,6 +268,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 qcresultDetailAdd.setCreator(useId.toString());
                 qcresultDetailAdd.setGmtModified(now);
                 qcresultDetailAdd.setModifier(useId.toString());
+                qcresultDetailAdd.setQcresultInfoId(newId);
                 qcresultDetailServiceImpl.save(qcresultDetailAdd);
                 //发送质控人员新增人工缺陷到his系统
                 SentEntryRecordDTO sentEntryRecordDTO = new SentEntryRecordDTO();
@@ -305,44 +328,44 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .set("msg", algorithmVO.getOptResultAlgVO().getMsg())
                         .set("score", algorithmVO.getOptResultAlgVO().getScore())
                         .set("opt_type", 3)
-                        .set("grade_type",2)
+                        .set("grade_type", 2)
                         .set("modifier", useId)
+                        .set("qcresult_info_id", newId)
                         .set("gmt_modified", now)
-                        .set("explain_info",algorithmVO.getOptResultAlgVO().getExplainInfo())
+                        .set("explain_info", algorithmVO.getOptResultAlgVO().getExplainInfo())
                 );
                 break;
             case 4:
                 //获取病历核查人员id,该操作只能是核查员操作
-                Long checkId = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
-                        .eq("is_deleted", IsDeleteEnum.N.getKey())
-                        .eq("hospital_id", analyzeVO.getHospitalId())
-                        .eq("behospital_code", analyzeVO.getBehospitalCode())).getCheckId();
-                if(checkId==null)
-                {
-                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "病历没有分配核查人员");
-                }
-                if(!checkId.equals(useId))
-                {
-                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前用户不是分配的核查人员");
-                }
+//                Long checkId = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
+//                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+//                        .eq("hospital_id", analyzeVO.getHospitalId())
+//                        .eq("behospital_code", analyzeVO.getBehospitalCode())).getCheckId();
+//                if(checkId==null)
+//                {
+//                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "病历没有分配核查人员");
+//                }
+//                if(!checkId.equals(useId))
+//                {
+//                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前用户不是分配的核查人员");
+//                }
                 //逻辑删除质控明细 0删除
-                if(analyzeVO.getDelStatus()==0)
-                {
+                if (analyzeVO.getDelStatus() == 0) {
                     qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                             .eq("id", algorithmVO.getOptResultAlgVO().getId())
                             .eq("is_deleted", IsDeleteEnum.N.getKey())
                             .eq("hospital_id", analyzeVO.getHospitalId())
                             .eq("behospital_code", analyzeVO.getBehospitalCode())
                             .set("is_deleted", IsDeleteEnum.Y.getKey())
-                            .set("grade_type",2)
+                            .set("grade_type", 2)
                             .set("opt_type", 2)
+                            .set("qcresult_info_id", newId)
                             .set("modifier", useId)
                             .set("gmt_modified", now)
                     );
                 }
                 //1恢复
-                else if(analyzeVO.getDelStatus()==1)
-                {
+                else if (analyzeVO.getDelStatus() == 1) {
                     //该条目是机器插入条目
                     qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
                             .eq("id", algorithmVO.getOptResultAlgVO().getId())
@@ -350,24 +373,43 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                             .eq("hospital_id", analyzeVO.getHospitalId())
                             .eq("behospital_code", analyzeVO.getBehospitalCode())
                             .set("is_deleted", IsDeleteEnum.N.getKey())
-                            .set("grade_type",2)
+                            .set("grade_type", 2)
                             .set("opt_type", 1)
+                            .set("qcresult_info_id", newId)
                             .set("modifier", useId)
-                            .set("remark", null)
                             .set("gmt_modified", now)
                     );
-                }
-                else {
+                } else {
                     throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "delStatus参数错误");
                 }
-
-
                 break;
             default:
                 /* DO NOTHING */
                 break;
         }
 
+        //如果不是自动评分(是新增修改删除条目)修改评分主表id
+        if (algorithmVO.getType() != 0) {
+            //修改上一次人工条目 评分主表id
+            if (qcresultInfoup != null && qcresultInfoup.getId() != null) {
+                qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                        .eq("qcresult_info_id", qcresultInfoup.getId())
+                        .eq("hospital_id", analyzeVO.getHospitalId())
+                        .eq("grade_type", 2)
+                        .eq("behospital_code", analyzeVO.getBehospitalCode())
+                        .set("qcresult_info_id", newId)
+                );
+            }
+            //未删除的 评分主表id
+            qcresultDetailServiceImpl.update(new UpdateWrapper<QcresultDetail>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", analyzeVO.getHospitalId())
+                    .eq("behospital_code", analyzeVO.getBehospitalCode())
+                    .set("qcresult_info_id", newId)
+            );
+        }
+
+
         //质控模块评分数据
         //统一为长兴的算法
         //逻辑删除数据
@@ -389,6 +431,7 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                 medQcresultCases.setCreator(useId.toString());
                 medQcresultCases.setGmtModified(now);
                 medQcresultCases.setModifier(useId.toString());
+                medQcresultCases.setQcresultInfoId(newId);
                 medQcresultCasesList.add(medQcresultCases);
             }
             medQcresultCasesService.saveBatch(medQcresultCasesList);
@@ -417,4 +460,13 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
         }
         return res;
     }
+
+    /**
+     * 历史评分
+     * @param historyAnalyzePageVO
+     * @return
+     */
+    public IPage<QcCasesHistoryDTO> getMedQcresultResultList(HistoryAnalyzePageVO historyAnalyzePageVO){
+        return getMedQcresultResult(historyAnalyzePageVO);
+    }
 }

+ 54 - 28
src/main/java/com/diagbot/facade/RecordCheckFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.BehospitalInfoAgeDTO;
 import com.diagbot.dto.CheckedRecordListDTO;
 import com.diagbot.dto.SysUserDeptDTO;
 import com.diagbot.entity.BasDeptInfo;
+import com.diagbot.entity.MedAppealInfo;
 import com.diagbot.entity.MedBehospitalType;
 import com.diagbot.entity.MedCheckInfo;
 import com.diagbot.entity.SysUserDept;
@@ -21,8 +22,10 @@ import com.diagbot.service.MedQcresultDetailService;
 import com.diagbot.service.impl.MedBehospitalTypeServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.CheckedRecordListVO;
+import com.diagbot.vo.MedCheckInfoAddVO;
 import com.diagbot.vo.RecordCheckVO;
 import com.diagbot.vo.SysUserBaseVO;
 import com.google.common.collect.Lists;
@@ -30,9 +33,7 @@ import com.google.common.collect.Maps;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -59,7 +60,10 @@ public class RecordCheckFacade {
     BasDeptInfoFacade basDeptInfoFacade;
     @Autowired
     MedBehospitalTypeServiceImpl medBehospitalTypeServiceImpl;
-
+    @Autowired
+    private SysHospitalSetFacade sysHospitalSetFacade;
+    @Autowired
+    private MedAppealInfoManagementFacade appealInfoManagementFacade;
 
     public IPage<CheckedRecordListDTO> checkedRecordList(CheckedRecordListVO checkedRecordListVO) {
         Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
@@ -73,10 +77,13 @@ public class RecordCheckFacade {
             deptIds.addAll(sysUserDeptDTO.getSelDepts().stream().map(i -> i.getDeptId()).collect(Collectors.toList()));
         }
         //1.2去除质管科
-        String zkkDeptId = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
+        BasDeptInfo deptInfo = basDeptInfoFacade.getOne(new QueryWrapper<BasDeptInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("hospital_id",hospitalId)
-                .eq("station","质管")).getDeptId();
+                .eq("hospital_id", hospitalId)
+                .eq("station", "质管"));
+        if (deptInfo == null || deptInfo.getDeptId() == null) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "科室质管科不存在,请联系管理员!");
+        }
         List<Long> userIds = Lists.newArrayList();
         List<String> JobTypes = Lists.newArrayList();
         roleIds.forEach(roleId -> {
@@ -87,13 +94,13 @@ public class RecordCheckFacade {
             } else if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey()
                     && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + ""))) {
                 //添加质管科人员
-                deptIds.add(zkkDeptId);
+                deptIds.add(deptInfo.getDeptId());
                 userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.QUAT_GENERAL.getKey()));
                 JobTypes.add(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + "");
             } else if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey() && ListUtil.isNotEmpty(deptIds)
                     && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + ""))) {
                 //移除质管科人员
-                deptIds.remove(zkkDeptId);
+                deptIds.remove(deptInfo.getDeptId());
                 JobTypes.add(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + "");
                 userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.DEPT_GENERAL.getKey()));
             } else if ((roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey() && ListUtil.isNotEmpty(deptIds))
@@ -103,17 +110,17 @@ public class RecordCheckFacade {
         });
 
         //如果用户是质控科核查人员,在不传入任务类型的时候要添加质控科任务类型进行筛选
-        if(roleIds.contains(CheckerRoleEnum.QUAT_GENERAL.getKey()*1l)){
+        if (roleIds.contains(CheckerRoleEnum.QUAT_GENERAL.getKey() * 1l)) {
             JobTypes.add(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + "");
         }
-        if(roleIds.contains(CheckerRoleEnum.DEPT_GENERAL.getKey()*1l)){
+        if (roleIds.contains(CheckerRoleEnum.DEPT_GENERAL.getKey() * 1l)) {
             JobTypes.add(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + "");
         }
-        if(roleIds.contains(CheckerRoleEnum.HOSP_GENERAL.getKey()*1l)){
+        if (roleIds.contains(CheckerRoleEnum.HOSP_GENERAL.getKey() * 1l)) {
             JobTypes.add(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() + "");
         }
 
-        if(ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes())){
+        if (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes())) {
             checkedRecordListVO.setCheckJobTypes(JobTypes);
         }
         if (ListUtil.isEmpty(userIds)) {
@@ -155,7 +162,8 @@ public class RecordCheckFacade {
     public boolean recordCheck(RecordCheckVO recordCheckVO) {
         Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
         Long userId = Long.parseLong(SysUserUtils.getCurrentPrincipleID());
-
+        //获取核查与申诉是否相关配置(核查完成是否有申诉时的内容)
+        checkAppealRelation(hospitalId,recordCheckVO);
         QueryWrapper<MedCheckInfo> medCheckInfoQueryWrapper = new QueryWrapper<>();
         medCheckInfoQueryWrapper.eq("behospital_code", recordCheckVO.getBehospitalCode());
         medCheckInfoQueryWrapper.eq("hospital_id", hospitalId);
@@ -172,40 +180,58 @@ public class RecordCheckFacade {
 
         return true;
     }
+
+    private void checkAppealRelation(Long hospitalId, RecordCheckVO recordCheckVO) {
+        //获取核查与申诉是否相关配置(核查完成是否有申诉时的内容)
+        String check_appeal_relation = sysHospitalSetFacade.getValue(hospitalId,"check_appeal_relation");
+        if(StringUtil.isNotEmpty(check_appeal_relation)&&Boolean.parseBoolean(check_appeal_relation)){
+            //获取该病例在待审核状态下的病历数量
+            int count = appealInfoManagementFacade.count(new QueryWrapper<MedAppealInfo>()
+                    .eq("work_flow_node_id","1")
+                    .eq("behospital_code",recordCheckVO.getBehospitalCode())
+                    .eq("is_deleted",IsDeleteEnum.N.getKey()));
+            if(count>0){
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "当前缺陷列表存在待审核记录,无法完成核查。");
+            }
+        }
+
+    }
+
     /**
      * @Author songxl
      * @Description获取当前用户的任务来源 和筛选分值
-     * @Date  2021/5/28
+     * @Date 2021/5/28
      * @Param []
-     * @Return java.util.Map<java.lang.String,java.lang.String>
+     * @Return java.util.Map<java.lang.String, java.lang.String>
      * @MethodName getCheckType
      */
     public Map<String, Object> getCheckType() {
-        Map<String,Object> out = Maps.newLinkedHashMap();
-        Map<Integer,String> checkTypes = Maps.newLinkedHashMap();
+        Map<String, Object> out = Maps.newLinkedHashMap();
+        Map<Integer, String> checkTypes = Maps.newLinkedHashMap();
         Long userId = Long.parseLong(SysUserUtils.getCurrentPrincipleID());
         SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
         sysUserBaseVO.setUserId(userId);
         List<Long> roleIds = sysUserFacade.getUserRoles(sysUserBaseVO).getSelRoles().stream().map(i -> i.getId()).collect(Collectors.toList());
         roleIds.stream().forEach(roleId -> {
-            if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey()||roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey()){
-                checkTypes.put(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey(),CheckJobTypeEnum.DEPT_SUPERVISOR.getName());
+            if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.DEPT_GENERAL.getKey()) {
+                checkTypes.put(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey(), CheckJobTypeEnum.DEPT_SUPERVISOR.getName());
             }
-            if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey()||roleId.intValue() == CheckerRoleEnum.QUAT_GENERAL.getKey()){
-                checkTypes.put(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey(),CheckJobTypeEnum.QUAT_SUPERVISOR.getName());
+            if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.QUAT_GENERAL.getKey()) {
+                checkTypes.put(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey(), CheckJobTypeEnum.QUAT_SUPERVISOR.getName());
             }
-            if (roleId.intValue() == CheckerRoleEnum.HOSP_SUPERVISOR.getKey()||roleId.intValue() == CheckerRoleEnum.HOSP_GENERAL.getKey()){
-                checkTypes.put(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey(),CheckJobTypeEnum.HOSP_SUPERVISOR.getName());
+            if (roleId.intValue() == CheckerRoleEnum.HOSP_SUPERVISOR.getKey() || roleId.intValue() == CheckerRoleEnum.HOSP_GENERAL.getKey()) {
+                checkTypes.put(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey(), CheckJobTypeEnum.HOSP_SUPERVISOR.getName());
             }
         });
         Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
-        List<Integer> valus = medBehospitalTypeServiceImpl.list(new QueryWrapper<MedBehospitalType>()
+        Map<String,Integer> valueMaps = medBehospitalTypeServiceImpl.list(new QueryWrapper<MedBehospitalType>()
                 .eq("hospital_id", hospitalId)
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .isNotNull("value")
-                .groupBy("value")).stream().map(MedBehospitalType::getValue).collect(Collectors.toList());
-        out.put("source",checkTypes);
-        out.put("value",valus);
+                .select("behospital_type,value")
+                .groupBy("value")).stream().collect(Collectors.toMap(MedBehospitalType::getBehospitalType, MedBehospitalType::getValue,(k1, k2) -> k1,LinkedHashMap::new));
+        out.put("source", checkTypes);
+        out.put("value", valueMaps);
         return out;
     }
 }

+ 47 - 3
src/main/java/com/diagbot/facade/SysDictionaryFacade.java

@@ -11,9 +11,7 @@ import com.diagbot.util.ListUtil;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Component;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @Description:
@@ -61,4 +59,50 @@ public class SysDictionaryFacade extends SysDictionaryInfoServiceImpl {
         return res;
     }
 
+    public long getAccessTokenOutTime() {
+        long accessToken = 24 * 3600*1l;
+        if (getDictionaryWithKey() != null
+                && getDictionaryWithKey().containsKey("31")
+                && getDictionaryWithKey().get("31").containsKey("accessToken")) {
+            accessToken = Long.parseLong(getDictionaryWithKey().get("31").get("accessToken"));
+        }
+        return accessToken;
+    }
+
+    /**
+     * 获取字典申诉驳回具体信息
+     * @return
+     */
+    public List<SysDictionaryInfoDTO> getAppealRejectDictionary(String groupType){
+        List<SysDictionaryInfoDTO> sysDictionaryInfoDTOS = new LinkedList<SysDictionaryInfoDTO>();
+        if (getDictionary() != null
+                && getDictionary().containsKey(Long.parseLong(groupType))
+        ) {
+            sysDictionaryInfoDTOS = getDictionary().get(Long.parseLong(groupType));
+        }
+        return sysDictionaryInfoDTOS;
+    }
+
+    /**
+     * 获取字典申诉驳回总体信息
+     * @return
+     */
+    public Map<String,Map<String, String>> getAppealRejectionDictionary(){
+        Map<String, Map<String,String>> appealOperationMap = new HashMap<>();
+        Map<String, String> appealOperationMapKey = new HashMap<>();
+        if (getDictionaryWithKey() != null
+                && getDictionaryWithKey().containsKey("34")
+        ) {
+            appealOperationMapKey= getDictionaryWithKey().get("34");
+        }
+        String appealOperation = appealOperationMapKey.get("申诉驳回");
+        String[] split = appealOperation.split(",");
+        List<String> strings = Arrays.asList(split);
+        for (int i = 0; i < strings.size(); i++) {
+            List<SysDictionaryInfoDTO> appealStatusDictionary = getAppealRejectDictionary(strings.get(i));
+            Map<String, String> keyValue = EntityUtil.makeMapWithKeyValue(appealStatusDictionary, "name", "val");
+            appealOperationMap.put(appealStatusDictionary.get(0).getRemark(), keyValue);
+        }
+        return appealOperationMap;
+    }
 }

+ 122 - 34
src/main/java/com/diagbot/facade/SysUserFacade.java

@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.AuthServiceClient;
 import com.diagbot.dto.*;
 import com.diagbot.entity.BasHospitalInfo;
+import com.diagbot.entity.ImageCaptchaParams;
 import com.diagbot.entity.JWT;
 import com.diagbot.entity.JwtStore;
+import com.diagbot.entity.SysHospitalSet;
 import com.diagbot.entity.SysUser;
 import com.diagbot.entity.SysUserDept;
 import com.diagbot.entity.SysUserHospital;
@@ -25,7 +27,9 @@ import com.diagbot.service.impl.SysUserServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.EntityUtil;
+import com.diagbot.util.ImageCaptchaUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.RedisUtils;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.BasDeptInfoVO;
@@ -33,6 +37,7 @@ import com.diagbot.vo.SysUserBaseVO;
 import com.diagbot.vo.SysUserDeptVO;
 import com.diagbot.vo.SysUserQueryVO;
 import com.diagbot.vo.SysUserRoleVO;
+import com.diagbot.vo.UserLoginVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.crypto.factory.PasswordEncoderFactories;
@@ -40,7 +45,16 @@ import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.oauth2.common.OAuth2AccessToken;
 import org.springframework.stereotype.Component;
 import org.springframework.util.DigestUtils;
-
+import org.springframework.util.StringUtils;
+
+import javax.imageio.ImageIO;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -84,28 +98,85 @@ public class SysUserFacade extends SysUserServiceImpl {
     private SysUserRoleFacade sysUserRoleFacade;
     @Autowired
     private SysDictionaryFacade sysDictionaryFacade;
+    @Autowired
+    private SysHospitalSetFacade sysHospitalSetFacade;
+    @Autowired
+    private RedisUtils redisUtils;
+
+
+    /**
+     * 获取标识--选择登录页面
+     *
+     * @return java.lang.Long
+     */
+    public Long getHospitalMark() {
+        Long mark = 0L;//0-默认通用医院 1-湘雅医院特殊登录页面
+        SysHospitalSet sysHospitalSet = sysHospitalSetFacade.lambdaQuery()
+                .eq(SysHospitalSet::getHospitalId, 35)
+                .eq(SysHospitalSet::getIsDeleted, IsDeleteEnum.N.getKey())
+                .eq(SysHospitalSet::getCode, "special_page_csxy").one();
+        if (null != sysHospitalSet) {
+            String val = sysHospitalSet.getValue();
+            if (StringUtil.isNotBlank(val) && "1".equals(val)) {
+                mark = Long.valueOf(val);
+            }
+        }
+        return mark;
+    }
+
+    public void getCaptcha(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        response.setContentType("image/png");
+        response.setHeader("Pragma", "no-cache");
+        response.setHeader("Cache-Control", "no-cache");
+        response.setDateHeader("Expires", 0);
+        HttpSession session = request.getSession();
+        String captchaId = session.getId();
+        ServletOutputStream outputStream = response.getOutputStream();
+        ImageCaptchaUtil imageCaptchaUtil = new ImageCaptchaUtil();
+        BufferedImage image = imageCaptchaUtil.createRandom();
+        String captcha = imageCaptchaUtil.getText();
+        redisUtils.set("user:captchaIds:" + captchaId, captcha, 60 * 3);
+        ImageIO.write(image, ImageCaptchaParams.DEFAULT_FORMAT, outputStream);
+        outputStream.flush();
+        outputStream.close();
+    }
 
     /**
      * 获取jwt
+     * <p>
+     * userLoginVO
      *
-     * @param username 用户名
-     * @param password 密码
      * @return jwt
      */
-    public JwtDTO getJwt(String username, String password) {
+    public JwtDTO getJwt(HttpServletRequest request, UserLoginVO userLoginVO) {
         JwtDTO data = new JwtDTO();
-        if (StringUtil.isBlank(username)) {
+        if (StringUtil.isBlank(userLoginVO.getUsername())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "请输入用户名");
         }
-        if (StringUtil.isBlank(password)) {
+        if (StringUtil.isBlank(userLoginVO.getPassword())) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
                     "请输入密码");
         }
+        //非湘雅医院执行
+        String captchaId = "";
+        if (0L == getHospitalMark()) {
+            if (StringUtils.isEmpty(userLoginVO.getCaptcha())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
+                        "请输入验证码");
+            }
+            // 验证码校验
+            captchaId = request.getSession().getId();
+            Object captchaObject = redisUtils.get("user:captchaIds:" + captchaId);
+            if (null == captchaObject || StringUtil.isBlank(captchaObject.toString()) || !captchaObject.toString().trim().equalsIgnoreCase(userLoginVO.getCaptcha())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "验证码错误");
+            }
+        }
+
         //使用MD5对密码进行加密
-        String MD5Password = DigestUtils.md5DigestAsHex(password.getBytes());
+        String MD5Password = DigestUtils.md5DigestAsHex(userLoginVO.getPassword().getBytes());
         QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
-        userQueryWrapper.eq("username", username)
+        userQueryWrapper.eq("username", userLoginVO.getUsername())
                 .eq("status", StatusEnum.Enable.getKey())
                 .eq("is_deleted", IsDeleteEnum.N.getKey());
         SysUser user = this.getOne(userQueryWrapper, false);
@@ -117,10 +188,13 @@ public class SysUserFacade extends SysUserServiceImpl {
             throw new CommonException(ServiceErrorCode.USER_PASSWORD_ERROR);
         }
         JWT jwt = authServiceClient.getToken("Basic dWFhLXNlcnZpY2U6MTIzNDU2",
-                "password", username, MD5Password);
+                "password", userLoginVO.getUsername(), MD5Password);
         if (null == jwt) {
             throw new CommonException(ServiceErrorCode.GET_TOKEN_FAIL);
         }
+        if (0L == getHospitalMark()) {
+            redisUtils.del("user:captchaIds:" + captchaId);
+        }
         data.setAccessToken(jwt.getAccess_token());
         data.setRefreshToken(jwt.getRefresh_token());
         data.setType(user.getType());
@@ -129,15 +203,12 @@ public class SysUserFacade extends SysUserServiceImpl {
         try {
             SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
             sysUserBaseVO.setUserId(user.getId());
-            List<SysRoleDTO> selRoles =getlocalUserRoles(sysUserBaseVO);
-            if(selRoles!=null&&!selRoles.isEmpty())
-            {
+            List<SysRoleDTO> selRoles = getlocalUserRoles(sysUserBaseVO);
+            if (selRoles != null && !selRoles.isEmpty()) {
                 data.setSelRoles(selRoles);
             }
 
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         //token存入redis
@@ -145,11 +216,15 @@ public class SysUserFacade extends SysUserServiceImpl {
         jwtStore.setAccessToken(jwt.getAccess_token());
         jwtStore.setRefreshToken(jwt.getRefresh_token());
         tokenFacade.createToken(jwtStore);
+
+        //每次登录在redis缓存该用户登录成功的token;缓存时间为token有效时间
+        long accessTokenTime = sysDictionaryFacade.getAccessTokenOutTime();
+        redisUtils.set("user:refreshToken:outTime_" + user.getId(), accessTokenTime, accessTokenTime);
         /***
          * 未经过MD5加密密码复杂度判断
          */
-     //   获取用户医院id
-   //     String hospitalID = SysUserUtils.getCurrentHospitalID();
+        //   获取用户医院id
+        //     String hospitalID = SysUserUtils.getCurrentHospitalID();
         Long id = user.getId();
         QueryWrapper<SysUserHospital> UserHospitalQueryWrapper = new QueryWrapper<>();
         UserHospitalQueryWrapper
@@ -158,8 +233,8 @@ public class SysUserFacade extends SysUserServiceImpl {
         SysUserHospital userHospital = sysUserHospitalFacade.getOne(UserHospitalQueryWrapper, false);
         Long hospitalId = userHospital.getHospitalId();
         String idStr = String.valueOf(hospitalId);
-        Boolean passwordRegular = passwordRegular(password,idStr);
-        if(!passwordRegular){
+        Boolean passwordRegular = passwordRegular(userLoginVO.getPassword(), idStr);
+        if (!passwordRegular) {
             data.setPasswordComplexity("未修改初始密码,请及时修改密码");
         }
         return data;
@@ -271,8 +346,8 @@ public class SysUserFacade extends SysUserServiceImpl {
         }
         //对传入的密码进行格式验证
         String hospitalID = SysUserUtils.getCurrentHospitalID();
-        Boolean regularBoolean = passwordRegular(modifyPassword,hospitalID);
-        if(!regularBoolean){
+        Boolean regularBoolean = passwordRegular(modifyPassword, hospitalID);
+        if (!regularBoolean) {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "请输入正确格式的新密码");
         }
         String userId = SysUserUtils.getCurrentPrincipleID();
@@ -302,23 +377,25 @@ public class SysUserFacade extends SysUserServiceImpl {
 
     /**
      * 未加密密文正则表达式  至少8个字符,1个大写字母,1个小写字母,1个数字和1个特殊字符:
+     *
      * @param password
      * @return
      */
-    public Boolean passwordRegular(String password,String hospitalId){
-        boolean check=true;
+    public Boolean passwordRegular(String password, String hospitalId) {
+        boolean check = true;
         Map<String, Map<String, String>> dictionaryWithKey = sysDictionaryFacade.getDictionaryWithKey();
-        if(dictionaryWithKey!=null){
+        if (dictionaryWithKey != null) {
             Map<String, String> stringStringMap = dictionaryWithKey.get("30");
-            if(stringStringMap!=null) {
+            if (stringStringMap != null) {
                 String regular = stringStringMap.get(hospitalId);
-                if(StringUtil.isNotEmpty(regular)) {
+                if (StringUtil.isNotEmpty(regular)) {
                     check = password.matches(regular);
                 }
             }
         }
         return check;
     }
+
     /**
      * 登录
      *
@@ -333,13 +410,13 @@ public class SysUserFacade extends SysUserServiceImpl {
                 .eq("status", StatusEnum.Enable.getKey())
                 .eq("id", userId), false);
         QueryWrapper<SysUserRole> sysUserRoleQueryWrapper = new QueryWrapper<>();
-        sysUserRoleQueryWrapper.eq("user_id",userId);
-        sysUserRoleQueryWrapper .eq("is_deleted", IsDeleteEnum.N.getKey());
+        sysUserRoleQueryWrapper.eq("user_id", userId);
+        sysUserRoleQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
         List<SysUserRole> sysUserRoleList = sysUserRoleFacade.list(sysUserRoleQueryWrapper);
-        if(ListUtil.isNotEmpty(sysUserRoleList)){
-            sysUserRoleList.forEach(sysUserRole ->{
-                roleSet.add(sysUserRole.getRoleId()+"");
-            } );
+        if (ListUtil.isNotEmpty(sysUserRoleList)) {
+            sysUserRoleList.forEach(sysUserRole -> {
+                roleSet.add(sysUserRole.getRoleId() + "");
+            });
         }
         if (user == null) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
@@ -362,8 +439,8 @@ public class SysUserFacade extends SysUserServiceImpl {
         }
 
         //添加菜单信息
-        List<SysMenuWrapper> menuList = sysMenuFacade.getByRole(user.getId(),roleSet);
-        List<SysUserPermissionDTO> sysUserPermissionDTOList = sysMenuFacade.getByRolePermission(user.getId(),roleSet);
+        List<SysMenuWrapper> menuList = sysMenuFacade.getByRole(user.getId(), roleSet);
+        List<SysUserPermissionDTO> sysUserPermissionDTOList = sysMenuFacade.getByRolePermission(user.getId(), roleSet);
         Map<Long, List<SysMenuWrapper>> menuMap = EntityUtil.makeEntityListMap(menuList, "parentId");
         Map<Long, List<SysUserPermissionDTO>> menuPermissionMap = EntityUtil.makeEntityListMap(sysUserPermissionDTOList, "menuId");
         List<SysMenuWrapper> menuRes = menuMap.get(-1L);
@@ -519,6 +596,7 @@ public class SysUserFacade extends SysUserServiceImpl {
 
         return sysUserRoleDTO;
     }
+
     /**
      * 获取用户角色
      *
@@ -630,6 +708,8 @@ public class SysUserFacade extends SysUserServiceImpl {
             }
             sysUserDeptService.saveBatch(sysUserDeptList);
         }
+        //删除Token
+        tokenFacade.deleteToken(sysUserDeptVO.getUserId().toString());
         //更新用户表
         return this.update(new UpdateWrapper<SysUser>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -700,6 +780,14 @@ public class SysUserFacade extends SysUserServiceImpl {
             throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "该医院下无该用户");
         }
     }
+
+    public Long getUserId(String claimantId, Long hospitalId) {
+        SysUser user = this.getBaseMapper().getUser(claimantId, hospitalId);
+        if (user != null && user.getId() != null) {
+            return user.getId();
+        }
+        return null;
+    }
     //-------------用户维护END---------------------------
 
 }

+ 46 - 18
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -4,24 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.*;
 import com.diagbot.entity.BehospitalInfo;
-import com.diagbot.vo.AnalyzeCodeVO;
-import com.diagbot.vo.AnalyzeVO;
-import com.diagbot.vo.BehospitalPageVO;
-import com.diagbot.vo.CaseScoreVO;
-import com.diagbot.vo.EntryStatisticsVO;
-import com.diagbot.vo.ExportQcresultVO;
-import com.diagbot.vo.FilterMedicalCheckVO;
-import com.diagbot.vo.FilterOrderByDeptVO;
-import com.diagbot.vo.FilterOrderVO;
-import com.diagbot.vo.FilterPageByDeptVO;
-import com.diagbot.vo.FilterPageVO;
-import com.diagbot.vo.FilterUnModifyMRVO;
-import com.diagbot.vo.FilterVO;
-import com.diagbot.vo.MedIndexFilterVO;
-import com.diagbot.vo.QcResultPageVO;
-import com.diagbot.vo.QcResultShortPageVO;
-import com.diagbot.vo.ReBeHosPageVO;
-import com.diagbot.vo.TaskVO;
+import com.diagbot.vo.*;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -41,6 +24,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
     public IPage<BehospitalInfoDTO> getPage(BehospitalPageVO behospitalPageVO);
 
     public List<MsgDTO> getMsg(AnalyzeVO analyzeVO);
+    public List<MsgDTO> getForeignMsg(AnalyzeVO analyzeVO);
 
     public List<MsgDTO> getMsgByEntryCode(AnalyzeCodeVO analyzeCodeVO);
 
@@ -164,6 +148,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<HomePageNumDTO> homePageLevelStatistics(FilterOrderVO filterOrderVO);
 
+    /**
+     * 医师病案首页合格率占比 湘雅定制
+     *
+     * @param filterOrderXYPageVO
+     * @return
+     */
+    public IPage<HomePageNumXYDTO> homePageLevelStatisticsXY(FilterOrderXYPageVO filterOrderXYPageVO);
+
     /**
      * 病历质控报表--扣分项
      *
@@ -313,6 +305,15 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<QcResultShortDTO> qcResultShortPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+
+    /**
+     * 条目缺陷质控评分页(内页)-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> qcResultShortXYPage(@Param("qcResultShortPageVO") QcResultShortXYPageVO qcResultShortPageVO);
+
     /**
      * 条目缺陷质控评分页-科室(内页)
      *
@@ -451,6 +452,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<ExportExcelDTO> qcResultShortPageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+    /**
+     * 条目缺陷质控评分详情页导出到excel-湘雅
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+    public List<ExportExcelDTO> qcResultShortXYPageExport(@Param("qcResultShortPageVO") QcResultShortXYPageVO qcResultShortPageVO);
+
     /**
      * 未整改病历统计
      *
@@ -536,6 +545,15 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<QcResultShortDTO> badLevelPage(@Param("qcResultPageVO") QcResultPageVO qcResultPageVO);
 
+    /**
+     * 不合格/合格数病历号(内页)XY
+     *
+     * @param qcResultPageVO
+     * @return
+     */
+    public IPage<QcResultShortDTO> badLevelXYPage(@Param("qcResultPageVO") QcResultPageXYVO qcResultPageVO);
+
+
 
     /**
      * 未整改病历缺陷评分详情页导出
@@ -565,6 +583,16 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
 
     public List<ExportExcelDTO> badLevelPagePageExport(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO);
 
+
+    /**
+     * 病案首页不合格/合格数病历详情页导出-XY
+     *
+     * @param qcResultShortPageVO
+     * @return
+     */
+
+    public List<ExportExcelDTO> badLevelPageXYExport(@Param("qcResultShortPageVO") QcResultShortXYPageVO qcResultShortPageVO);
+
     /**
      * 病案首页不合格/合格数病历详情页导出-科室
      *

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedAppealExamineInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 申诉审批表 Mapper 接口
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-01-20
+ */
+public interface MedAppealExamineInfoMapper extends BaseMapper<MedAppealExamineInfo> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedAppealInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 申诉记录表 Mapper 接口
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-01-20
+ */
+public interface MedAppealInfoMapper extends BaseMapper<MedAppealInfo> {
+
+}

+ 37 - 0
src/main/java/com/diagbot/mapper/MedClickInfoMapper.java

@@ -0,0 +1,37 @@
+package com.diagbot.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.EntryDefectImprove;
+import com.diagbot.dto.EntryDefectImproveInner;
+import com.diagbot.dto.EntryDefectImproveInnerExport;
+import com.diagbot.dto.ExportExcelDTO;
+import com.diagbot.dto.GetEntryInfoDTO;
+import com.diagbot.dto.GetQcClickDTO;
+import com.diagbot.dto.GetQcClickInnerPageDTO;
+import com.diagbot.entity.MedClickInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.GetEntryDefectImproveDeptVO;
+import com.diagbot.vo.GetEntryDefectImproveInnerVO;
+import com.diagbot.vo.GetEntryDefectImproveVO;
+import com.diagbot.vo.GetQcClickInnerPageVO;
+import com.diagbot.vo.GetQcClickVO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 医生点击质控病历次数基本表 Mapper 接口
+ * </p>
+ *
+ * @author cy
+ * @since 2021-11-10
+ */
+public interface MedClickInfoMapper extends BaseMapper<MedClickInfo> {
+    public List<GetQcClickDTO> getQcClick(GetQcClickVO getQcClickVO);
+    public IPage<GetQcClickInnerPageDTO> getQcClickInnerPage(GetQcClickInnerPageVO getQcClickInnerPageVO);
+    public List<EntryDefectImprove> getEntryDefectImprove(GetEntryDefectImproveVO getEntryDefectImproveVO);
+    public List<GetEntryInfoDTO> getEntryInfo();
+    public List<EntryDefectImproveInnerExport> getEntryDefectImproveDept(GetEntryDefectImproveDeptVO getEntryDefectImproveDeptVO);
+    public List<EntryDefectImproveInner> getEntryDefectImproveInner(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO);
+    public List<ExportExcelDTO> getDefectImproveInnerByExport(GetEntryDefectImproveInnerVO getEntryDefectImproveInnerVO);
+}

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedQcresultClick;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-12-02
+ */
+public interface MedQcresultClickMapper extends BaseMapper<MedQcresultClick> {
+
+}

+ 20 - 12
src/main/java/com/diagbot/mapper/QcresultInfoMapper.java

@@ -2,21 +2,11 @@ package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.DeptEntryNumDTO;
-import com.diagbot.dto.DeptNumDTO;
-import com.diagbot.dto.EntryNumDTO;
-import com.diagbot.dto.EntryNumGroupDTO;
-import com.diagbot.dto.NumDTO;
-import com.diagbot.dto.QcResultPercentDTO;
+import com.diagbot.dto.*;
 import com.diagbot.entity.QcresultInfo;
-import com.diagbot.vo.FilterPageByDeptVO;
-import com.diagbot.vo.FilterPageVO;
-import com.diagbot.vo.FilterVO;
-import com.diagbot.vo.QcresultFilterVO;
+import com.diagbot.vo.*;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -88,6 +78,8 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      */
     public List<NumDTO> resultCountByDept(QcresultFilterVO qcresultFilterVO);
 
+    public List<Map<String,Object>> resultMrCountByDept(QcresultFilterVO qcresultFilterVO);
+
     /**
      * 各模块缺陷占比-按科室
      *
@@ -120,6 +112,15 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      */
     public IPage<EntryNumGroupDTO> entryCountGroupByEntryPage(@Param("filterPageVO") FilterPageVO filterPageVO);
 
+
+    /**
+     * 缺陷详情(分页)-湘雅
+     *
+     * @param filterPageVO
+     * @return
+     */
+    public IPage<EntryNumGroupDTO> entryCountGroupXYByEntryPage(@Param("filterPageVO") FilterPageXYVO filterPageVO);
+
     /**
      * 各科室质控平均分(分页)
      *
@@ -203,4 +204,11 @@ public interface QcresultInfoMapper extends BaseMapper<QcresultInfo> {
      * @return
      */
     public List<DeptNumDTO> qcResultLevelPercent(FilterVO filterVO);
+
+    /**
+     * 历史评分
+     * @param historyAnalyzePageVO
+     * @return
+     */
+    public IPage<QcCasesHistoryDTO> getMedQcresultResult(HistoryAnalyzePageVO historyAnalyzePageVO);
 }

+ 0 - 0
src/main/java/com/diagbot/mapper/SysUserMapper.java


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini