Bladeren bron

Merge branch '20210512_yw_check' into test

rengb 4 jaren geleden
bovenliggende
commit
5c24c9f3df
61 gewijzigde bestanden met toevoegingen van 3028 en 161 verwijderingen
  1. 7 10
      doc/031.20210326v2.0.2/qc_initv2.0.2.sql
  2. 0 7
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  3. 1 6
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  4. 23 0
      src/main/java/com/diagbot/dto/CheckDeptDTO.java
  5. 28 0
      src/main/java/com/diagbot/dto/CheckJobDTO.java
  6. 24 0
      src/main/java/com/diagbot/dto/CheckUserDTO.java
  7. 112 0
      src/main/java/com/diagbot/dto/CheckWorkDTO.java
  8. 129 0
      src/main/java/com/diagbot/dto/CheckedRecordListDTO.java
  9. 24 0
      src/main/java/com/diagbot/dto/DeptCheckUserDTO.java
  10. 4 0
      src/main/java/com/diagbot/dto/JwtDTO.java
  11. 4 0
      src/main/java/com/diagbot/dto/MedicalRecordDTO.java
  12. 8 0
      src/main/java/com/diagbot/dto/MsgDTO.java
  13. 71 0
      src/main/java/com/diagbot/entity/MedBehospitalType.java
  14. 56 99
      src/main/java/com/diagbot/entity/MedCheckInfo.java
  15. 4 0
      src/main/java/com/diagbot/entity/QcresultDetail.java
  16. 51 0
      src/main/java/com/diagbot/enums/CheckJobTypeEnum.java
  17. 51 0
      src/main/java/com/diagbot/enums/CheckTypeEnum.java
  18. 54 0
      src/main/java/com/diagbot/enums/CheckerRoleEnum.java
  19. 1 1
      src/main/java/com/diagbot/facade/AlgorithmFacade.java
  20. 1 1
      src/main/java/com/diagbot/facade/BehospitalInfoFacade.java
  21. 30 13
      src/main/java/com/diagbot/facade/FilterFacade.java
  22. 610 0
      src/main/java/com/diagbot/facade/MedCheckInfoFacade.java
  23. 277 0
      src/main/java/com/diagbot/facade/MedCheckWorkFacade.java
  24. 2 1
      src/main/java/com/diagbot/facade/QcClientFacade.java
  25. 14 0
      src/main/java/com/diagbot/facade/QcresultInfoFacade.java
  26. 126 0
      src/main/java/com/diagbot/facade/RecordCheckFacade.java
  27. 46 1
      src/main/java/com/diagbot/facade/SysUserFacade.java
  28. 16 0
      src/main/java/com/diagbot/mapper/MedBehospitalTypeMapper.java
  29. 26 0
      src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java
  30. 5 0
      src/main/java/com/diagbot/mapper/MedicalRecordMapper.java
  31. 16 0
      src/main/java/com/diagbot/service/MedBehospitalTypeService.java
  32. 9 1
      src/main/java/com/diagbot/service/MedCheckInfoService.java
  33. 5 0
      src/main/java/com/diagbot/service/MedicalRecordService.java
  34. 20 0
      src/main/java/com/diagbot/service/impl/MedBehospitalTypeServiceImpl.java
  35. 19 0
      src/main/java/com/diagbot/service/impl/MedCheckInfoServiceImpl.java
  36. 12 0
      src/main/java/com/diagbot/service/impl/MedicalRecordServiceImpl.java
  37. 71 0
      src/main/java/com/diagbot/task/BehospitalInfoTypeTask.java
  38. 1 11
      src/main/java/com/diagbot/task/MedIndexTask.java
  39. 51 0
      src/main/java/com/diagbot/vo/CheckJobPageVO.java
  40. 51 0
      src/main/java/com/diagbot/vo/CheckJobVO.java
  41. 31 0
      src/main/java/com/diagbot/vo/CheckUserVO.java
  42. 108 0
      src/main/java/com/diagbot/vo/CheckWorkPageVO.java
  43. 104 0
      src/main/java/com/diagbot/vo/CheckedRecordListVO.java
  44. 36 0
      src/main/java/com/diagbot/vo/DistributionJobVO.java
  45. 34 0
      src/main/java/com/diagbot/vo/MedCheckWorkAddVO.java
  46. 4 0
      src/main/java/com/diagbot/vo/QcResultAlgVO.java
  47. 24 0
      src/main/java/com/diagbot/vo/RecordCheckVO.java
  48. 24 0
      src/main/java/com/diagbot/vo/RecordTypeVO.java
  49. 11 0
      src/main/java/com/diagbot/web/BehospitalInfoController.java
  50. 57 0
      src/main/java/com/diagbot/web/MedCheckInfoController.java
  51. 67 0
      src/main/java/com/diagbot/web/MedCheckWorkController.java
  52. 48 0
      src/main/java/com/diagbot/web/RecordCheckController.java
  53. 1 1
      src/main/resources/application-pre.yml
  54. 8 4
      src/main/resources/application-test.yml
  55. 1 1
      src/main/resources/mapper/BasDeptInfoMapper.xml
  56. 8 2
      src/main/resources/mapper/BehospitalInfoMapper.xml
  57. 16 0
      src/main/resources/mapper/MedBehospitalTypeMapper.xml
  58. 337 0
      src/main/resources/mapper/MedCheckInfoMapper.xml
  59. 46 0
      src/main/resources/mapper/MedicalRecordMapper.xml
  60. 1 0
      src/main/resources/mapper/QcresultDetailMapper.xml
  61. 2 2
      src/test/java/com/diagbot/CodeGeneration.java

+ 7 - 10
doc/031.20210326v2.0.2/qc_initv2.0.2.sql

@@ -242,23 +242,16 @@ CREATE TABLE `med_outpatient_info` (
 
 
 --  菜单添加
-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-ZKK-YLZLKZ', '1', '1', '-4', '用户-医疗质量');
+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-ZKK-YLZLKZZB_XQ', '1', '1', '-4', '用户-医疗质量');
 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_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-YLZLKZZB_XQ', '1', '1', '0', '用户-科室主任-医疗质量控制指标_详情');
-SET @id2 =@@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', @id2, 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', @id2, 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', '医疗质量控制指标', 'FUNC000110', '/qc/behospitalInfo/getMedQualityCoList', 'ALL', '医疗质量控制指标表', 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', '医疗质量控制指标', 'FUNC000110', '/console/medicalRecordIndicator', 'ALL', '医疗质量控制指标表', NULL);
 SET @id3 =@@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', @id3, 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', @id3, NULL);
 
-INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `remark`, `order_nu`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @id2, @id3, '医疗质量控制指标表', NULL);
+INSERT INTO `sys_menu_permission` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `menu_id`, `permission_id`, `remark`, `order_nu`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', @id , @id3, '医疗质量控制指标表', NULL);
 
 
 -- 病案指标列表返回
@@ -318,3 +311,7 @@ CREATE TABLE `med_index_relevance` (
   PRIMARY KEY (`id`),
   UNIQUE KEY `index_all` (`relevance_type`,`hospital_id`,`behospital_code`) USING BTREE
 ) ENGINE=InnoDB AUTO_INCREMENT=345204 DEFAULT CHARSET=utf8;
+
+-- 注意 param参数为医院id,多家医院需执行对应医院id
+INSERT INTO `sys_task_cron` ( `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `cron_code`, `cron`, `param`, `is_used`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', 'TASK_INDEX', '0 0 3 * * ?', '4', '1', '获取当前时间前一天的病案指标');
+

+ 0 - 7
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -235,12 +235,6 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/consoleByDept/medicalCheckFormKs").permitAll()
                 .antMatchers("/print/export/medicalCheckExportByDept").permitAll()
                 .antMatchers("/consoleByDept/medicalCheckTitleKs").permitAll()
-                .antMatchers("/console/qualityControl").permitAll()
-                .antMatchers("/console/export/qualityControlExport").permitAll()
-                .antMatchers("/consoleByDept/qualityControlByDept").permitAll()
-                .antMatchers("/print/export/qualityControlExportByDept").permitAll()
-                .antMatchers("/qc/behospitalInfo/getMedQualityCoList").permitAll()
-                .antMatchers("/console/saveMedicaIndicator").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }
@@ -249,7 +243,6 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
         log.info("Configuring ResourceServerSecurityConfigurer");
         resources.resourceId("user-service").tokenStore(new JwtTokenStore(jwtTokenEnhancerClient()));
     }
-
     @Autowired
     private CustomAccessTokenConverter customAccessTokenConverter;
 

+ 1 - 6
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -279,18 +279,13 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/consoleByDept/medicalCheckFormKs", request)
                 || matchers("/print/export/medicalCheckExportByDept", request)
                 || matchers("/consoleByDept/medicalCheckTitleKs", request)
-                || matchers("/console/qualityControl", request)
-                || matchers("/console/export/qualityControlExport", request)
-                || matchers("/consoleByDept/qualityControlByDept", request)
-                || matchers("/print/export/qualityControlExportByDept", request)
-                || matchers("/qc/behospitalInfo/getMedQualityCoList", request)
-                || matchers("/console/saveMedicaIndicator", request)
                 || matchers("/", request)) {
             return true;
         }
         return false;
     }
 
+
     private boolean matchers(String url, HttpServletRequest request) {
         AntPathRequestMatcher matcher = new AntPathRequestMatcher(url);
         if (matcher.matches(request)) {

+ 23 - 0
src/main/java/com/diagbot/dto/CheckDeptDTO.java

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Description: 核查科室输出类
+ * @Author:songxl
+ * @time: 2021/5/14 13:45
+ */
+@Getter
+@Setter
+public class CheckDeptDTO {
+    //科室id
+    private String deptId;
+    //科室名称
+    private String deptName;
+    //科室质控人员列表
+    private List<DeptCheckUserDTO> deptcheckUsers = new ArrayList<>();
+}

+ 28 - 0
src/main/java/com/diagbot/dto/CheckJobDTO.java

@@ -0,0 +1,28 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 科室核查人员输出类
+ * @Author:songxl
+ * @time: 2021/5/14 13:45
+ */
+@Getter
+@Setter
+public class CheckJobDTO {
+    //核查任务id
+    private int id;
+    //病人住院序号
+    private String behospitalCode;
+    //病人姓名
+    private String name;
+    //科室
+    private String behospitalDept;
+    //主管医生
+    private String attendingDoctor;
+    //出院日期
+    private String leaveHospitalDate;
+    //筛选分值
+    private int value;
+}

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

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 核查人员用户科室、姓名、角色输出类
+ * @Author:songxl
+ * @time: 2021/5/14 13:45
+ */
+@Getter
+@Setter
+public class CheckUserDTO {
+    //科室id
+    private String deptId;
+    //科室名称
+    private String deptName;
+    //医生id
+    private String doctorId;
+    //医生名称
+    private String doctorName;
+    //角色id
+    private int roleId;
+}

+ 112 - 0
src/main/java/com/diagbot/dto/CheckWorkDTO.java

@@ -0,0 +1,112 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: wangsy
+ * @time: 2021/5/13 15:00
+ */
+@Getter
+@Setter
+public class CheckWorkDTO {
+
+    /**
+     * 病人住院序号
+     */
+    private String behospitalCode;
+
+    /**
+     * 病人姓名
+     */
+    private String name;
+
+
+    /**
+     * 病案号
+     */
+    private String fileCode;
+
+    /**
+     * 性别
+     */
+    private String sex;
+
+    /**
+     * 年龄
+     */
+    private String age;
+
+    /**
+     * 科室
+     */
+    private String behDeptName;
+
+    /**
+     * 出院日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+    /**
+     * 住院天数
+     */
+    private String behospitalDayNum;
+
+    /**
+     * 主管医生
+     */
+    private String doctorName;
+
+    /**
+     * 病历等级
+     */
+    private String level;
+
+    /**
+     * 病历得分
+     */
+    private String scoreRes;
+
+    /**
+     * 主诊断
+     */
+    private String diagnose;
+
+    /**
+     * 筛选分值
+     */
+    private String score;
+
+    /**
+     * 生成状态
+     */
+    private String creatStatus;
+
+    /**
+     * 生成日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date jobCreateTime;
+
+    /**
+     * 核查员
+     */
+    private String jobCreatorName;
+
+    /**
+     * 核查日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date checkTime;
+
+    /**
+     * 分配日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date jobDistributionTime;
+}

+ 129 - 0
src/main/java/com/diagbot/dto/CheckedRecordListDTO.java

@@ -0,0 +1,129 @@
+package com.diagbot.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2021/5/17 18:47
+ */
+@Getter
+@Setter
+@ApiModel("核查任务列表-获取核查任务列表-接口出参")
+public class CheckedRecordListDTO {
+
+    /**
+     * 病人住院序号
+     */
+    @ApiModelProperty("病人住院序号")
+    private String behospitalCode;
+
+    /**
+     * 病历核查状态
+     */
+    @ApiModelProperty("病历核查状态")
+    private String status;
+
+    /**
+     * 科室Id
+     */
+    @ApiModelProperty("科室Id")
+    private String behDeptId;
+
+    /**
+     * 科室
+     */
+    @ApiModelProperty("科室")
+    private String behDeptName;
+
+    /**
+     * 病人姓名
+     */
+    @ApiModelProperty("病人姓名")
+    private String name;
+
+    /**
+     * 病案号
+     */
+    @ApiModelProperty("病案号")
+    private String fileCode;
+
+    /**
+     * 主管医生
+     */
+    @ApiModelProperty("主管医生")
+    private String doctorName;
+
+    /**
+     * 出院日期
+     */
+    @ApiModelProperty("出院日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+    /**
+     * 生成日期
+     */
+    @ApiModelProperty("生成日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date jobCreateTime;
+
+    /**
+     * 分配日期
+     */
+    @ApiModelProperty("分配日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date jobDistributionTime;
+
+    /**
+     * 任务月份
+     */
+    @ApiModelProperty("任务月份")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date month;
+
+    /**
+     * 核查员id
+     */
+    @ApiModelProperty("核查员id")
+    private Long checkId;
+
+    /**
+     * 核查员
+     */
+    @ApiModelProperty("核查员")
+    private String checkName;
+
+    /**
+     * 核查日期
+     */
+    @ApiModelProperty("核查日期")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    private Date checkTime;
+
+    /**
+     * 缺陷数
+     */
+    @ApiModelProperty("缺陷数")
+    private int casesEntryNum;
+
+    /**
+     * 病历等级
+     */
+    @ApiModelProperty("病历等级")
+    private String level;
+
+    /**
+     * 病历得分
+     */
+    @ApiModelProperty("病历得分")
+    private BigDecimal scoreRes;
+
+}

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

@@ -0,0 +1,24 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description: 科室核查人员输出类
+ * @Author:songxl
+ * @time: 2021/5/14 13:45
+ */
+@Getter
+@Setter
+public class DeptCheckUserDTO {
+    //科室id
+    private String deptId;
+    //科室名称
+    private String deptName;
+    //医生id
+    private String doctorId;
+    //医生名称
+    private String doctorName;
+    //核查数
+    private int jobNum;
+}

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

@@ -3,6 +3,8 @@ package com.diagbot.dto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * @Description: jwt 输出类
  * @author: gaodm
@@ -15,4 +17,6 @@ public class JwtDTO {
     private String refreshToken;
     private Integer type; //用户类型
     private String typeCn; //用户类型中文
+    //用户权限列表
+    private List<SysRoleDTO> selRoles;
 }

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

@@ -17,6 +17,10 @@ public class MedicalRecordDTO implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 病人住院ID
+     */
+    private String behospitalCode;
     /**
      * 模块id
      */

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

@@ -52,6 +52,14 @@ public class MsgDTO {
     private Date gmtCreate;
     // 记录修改时间,如果时间是1970年则表示纪录未修改
     private Date gmtModified;
+    // 记录修改人id
+    private String modifier;
+    // 记录修改人姓名
+    private String linkman;
+    // 逻辑删除标志位
+    private String isDeleted;
+    // 缺陷说明
+    private String explainInfo;
     // 条目id对应页面数据的key值
     private List<Long> pageKeyList = new ArrayList<>();
 }

+ 71 - 0
src/main/java/com/diagbot/entity/MedBehospitalType.java

@@ -0,0 +1,71 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author songxl
+ * @since 2021-05-11
+ */
+@TableName("med_behospital_type")
+@Data
+public class MedBehospitalType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 医院ID
+     */
+    private Long hospitalId;
+
+    /**
+     * 病历号
+     */
+    private String behospitalCode;
+
+    /**
+     * 患者类型
+     */
+    private String behospitalType;
+
+    /**
+     * 类型分值
+     */
+    private Integer value;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 是否删除
+     */
+    private String isDeleted;
+
+    @Override
+    public String toString() {
+        return "MedBehospitalType{" +
+            "id=" + id +
+            ", hospitalId=" + hospitalId +
+            ", behospitalCode=" + behospitalCode +
+            ", behospitalType=" + behospitalType +
+            ", value=" + value +
+            ", createTime=" + createTime +
+            ", isDeleted=" + isDeleted +
+        "}";
+    }
+}

+ 56 - 99
src/main/java/com/diagbot/entity/MedCheckInfo.java

@@ -2,8 +2,10 @@ 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.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -14,6 +16,7 @@ import java.util.Date;
  * @author wangfeng
  * @since 2020-07-06
  */
+@Data
 public class MedCheckInfo implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -79,116 +82,70 @@ public class MedCheckInfo implements Serializable {
      */
     private Integer status;
 
-    private Integer checkType;
-
-    public Integer getCheckType() {
-        return checkType;
-    }
-
-    public void setCheckType(Integer checkType) {
-        this.checkType = checkType;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-    public String getIsDeleted() {
-        return isDeleted;
-    }
-
-    public void setIsDeleted(String isDeleted) {
-        this.isDeleted = isDeleted;
-    }
-    public Date getGmtCreate() {
-        return gmtCreate;
-    }
-
-    public void setGmtCreate(Date gmtCreate) {
-        this.gmtCreate = gmtCreate;
-    }
-    public Date getGmtModified() {
-        return gmtModified;
-    }
-
-    public void setGmtModified(Date gmtModified) {
-        this.gmtModified = gmtModified;
-    }
-    public String getCreator() {
-        return creator;
-    }
+    /**
+     * 核查类型(0病历,1病案首页,2全部)
+     */
+    private Integer checkType = 2;
 
-    public void setCreator(String creator) {
-        this.creator = creator;
-    }
-    public String getModifier() {
-        return modifier;
-    }
+    /**
+     * 核查任务创建人编号
+     */
+    private Long jobCreator;
 
-    public void setModifier(String modifier) {
-        this.modifier = modifier;
-    }
-    public String getBehospitalCode() {
-        return behospitalCode;
-    }
+    /**
+     * 核查任务创建人
+     */
+    private String jobCreatorName;
 
-    public void setBehospitalCode(String behospitalCode) {
-        this.behospitalCode = behospitalCode;
-    }
-    public Long getHospitalId() {
-        return hospitalId;
-    }
+    /**
+     * 核查任务生成时间
+     */
+    private Date jobCreateTime;
 
-    public void setHospitalId(Long hospitalId) {
-        this.hospitalId = hospitalId;
-    }
-    public Long getCheckId() {
-        return checkId;
-    }
+    /**
+     * 核查任务类型(0-科室任务 1-院级 2-质控科)
+     */
+    private Integer jobType;
 
-    public void setCheckId(Long checkId) {
-        this.checkId = checkId;
-    }
-    public String getCheckName() {
-        return checkName;
-    }
+    /**
+     * 核查任务分配人编号
+     */
+    private Long jobDistributor;
 
-    public void setCheckName(String checkName) {
-        this.checkName = checkName;
-    }
-    public Date getCheckTime() {
-        return checkTime;
-    }
+    /**
+     * 核查任务分配人姓名
+     */
+    private String jobDistributionName;
 
-    public void setCheckTime(Date checkTime) {
-        this.checkTime = checkTime;
-    }
-    public Integer getStatus() {
-        return status;
-    }
+    /**
+     * 核查任务分配时间
+     */
+    private Date jobDistributionTime;
 
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
 
     @Override
     public String toString() {
         return "MedCheckInfo{" +
-            "id=" + id +
-            ", isDeleted=" + isDeleted +
-            ", gmtCreate=" + gmtCreate +
-            ", gmtModified=" + gmtModified +
-            ", creator=" + creator +
-            ", modifier=" + modifier +
-            ", behospitalCode=" + behospitalCode +
-            ", hospitalId=" + hospitalId +
-            ", checkId=" + checkId +
-            ", checkName=" + checkName +
-            ", checkTime=" + checkTime +
-            ", status=" + status +
-        "}";
+                "id=" + id +
+                ", isDeleted=" + isDeleted +
+                ", gmtCreate=" + gmtCreate +
+                ", gmtModified=" + gmtModified +
+                ", creator=" + creator +
+                ", modifier=" + modifier +
+                ", behospitalCode=" + behospitalCode +
+                ", hospitalId=" + hospitalId +
+                ", checkId=" + checkId +
+                ", checkName=" + checkName +
+                ", checkTime=" + checkTime +
+                ", status=" + status +
+                ", checkType=" + checkType +
+                ", jobCreator=" + jobCreator +
+                ", jobCreatorName=" + jobCreatorName +
+                ", jobCreateTime=" + jobCreateTime +
+                ", jobType=" + jobType +
+                ", jobDistributor=" + jobDistributor +
+                ", jobDistributionName=" + jobDistributionName +
+                ", jobDistributionTime=" + jobDistributionTime +
+                "}";
     }
 }

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

@@ -111,4 +111,8 @@ public class QcresultDetail implements Serializable {
      * 备注
      */
     private String remark;
+    /**
+     * 质控条目说明
+     */
+    private String explainInfo;
 }

+ 51 - 0
src/main/java/com/diagbot/enums/CheckJobTypeEnum.java

@@ -0,0 +1,51 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description: 核查任务类型
+ * @date 2018年11月21日 下午2:31:42
+ */
+public enum CheckJobTypeEnum implements KeyedNamed {
+    DEPT_SUPERVISOR(0, "科室任务"),
+    HOSP_SUPERVISOR(1, "院级"),
+    QUAT_SUPERVISOR(2, "质控科");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    CheckJobTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static CheckJobTypeEnum getEnum(int key) {
+        for (CheckJobTypeEnum item : CheckJobTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        CheckJobTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

+ 51 - 0
src/main/java/com/diagbot/enums/CheckTypeEnum.java

@@ -0,0 +1,51 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description: 核查类型
+ * @date 2018年11月21日 下午2:31:42
+ */
+public enum CheckTypeEnum implements KeyedNamed {
+    COURSE(0, "病历"),
+    HOMEPAGE(1, "病案首页"),
+    ALL(2, "全部");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    CheckTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static CheckTypeEnum getEnum(int key) {
+        for (CheckTypeEnum item : CheckTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        CheckTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

+ 54 - 0
src/main/java/com/diagbot/enums/CheckerRoleEnum.java

@@ -0,0 +1,54 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description: TODO
+ * @date 2018年11月21日 下午2:31:42
+ */
+public enum CheckerRoleEnum implements KeyedNamed {
+    DEPT_SUPERVISOR(4, "临床科室监管人员"),
+    DEPT_GENERAL(7, "临床科室质控人员"),
+    QUAT_SUPERVISOR(5, "质控科监管人员"),
+    QUAT_GENERAL(8, "质控科质控人员"),
+    HOSP_SUPERVISOR(6, "院级监管人员"),
+    HOSP_GENERAL(9, "院级质控人员");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    CheckerRoleEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static CheckerRoleEnum getEnum(int key) {
+        for (CheckerRoleEnum item : CheckerRoleEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        CheckerRoleEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}
+

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

@@ -28,7 +28,7 @@ import java.util.Map;
  */
 @Component
 public class AlgorithmFacade {
-    private final static List<Integer> types = Arrays.asList(0, 1, 2, 3);
+    private final static List<Integer> types = Arrays.asList(0, 1, 2, 3,4);
 
     @Autowired
     private SysHospitalSetFacade sysHospitalSetFacade;

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

@@ -320,7 +320,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         List<RecordContentDTO> recordContentDTOList = medicalRecordFacade.getRecordContentFac(recordContentVO);
         String recTitle = "";
         // 解密数据
-        if (false  && encryptFlag) {
+        if (encryptFlag) {
             try {
                 EncrypDES encrypDES = new EncrypDES();
                 for (RecordContentDTO recordContentDTO : recordContentDTOList) {

+ 30 - 13
src/main/java/com/diagbot/facade/FilterFacade.java

@@ -244,21 +244,38 @@ public class FilterFacade {
      * @param filterVO
      */
           List<String> getTimeList(FilterVO filterVO) {
-              String hospitalId = SysUserUtils.getCurrentHospitalID();
-              String userId = SysUserUtils.getCurrentPrincipleID();
-              filterVO.setHospitalId(hospitalId);
-              filterVO.setUserId(Long.valueOf(userId));
-        // 返回的日期集合
-        List<String> days = new ArrayList<String>();
-
-        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        try {
-            Date start = dateFormat.parse(filterVO.getStartDate()+" 00:00:00");
-            Date end = dateFormat.parse(filterVO.getEndDate()+" 00:00:00");
-
+              DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+              // 返回的日期集合
+              List<String> days = new ArrayList<String>();
+              Date start =new Date();
+              Date end =new Date();
+              try {
+              if(StringUtils.isEmpty(filterVO.getHospitalId())){
+                  String hospitalId = SysUserUtils.getCurrentHospitalID();
+                  String userId = SysUserUtils.getCurrentPrincipleID();
+                  filterVO.setHospitalId(hospitalId);
+                  filterVO.setUserId(Long.valueOf(userId));
+                   start = dateFormat.parse(filterVO.getStartDate()+" 00:00:00");
+                   end = dateFormat.parse(filterVO.getEndDate()+" 00:00:00");
+              }else{
+                  //执行上一天的操作
+                  Date dNow = new Date(); //当前时间
+                  Date dBefore = new Date();
+                  Calendar calendar = Calendar.getInstance(); //得到日历
+                  calendar.setTime(dNow);//把当前时间赋给日历
+                  calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
+                  dBefore = calendar.getTime(); //得到前一天的时间
+                  SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); //设置时间格式
+                  String defaultStartDate = sdf.format(dBefore); //格式化前一天
+                  filterVO.setStartDate(defaultStartDate);
+                  filterVO.setEndDate(defaultStartDate);
+                  defaultStartDate = defaultStartDate+" 00:00:00";
+                  String defaultEndDate = defaultStartDate;
+                   start = dateFormat.parse(defaultStartDate);
+                   end = dateFormat.parse(defaultEndDate);
+              }
             Calendar tempStart = Calendar.getInstance();
             tempStart.setTime(start);
-
             Calendar tempEnd = Calendar.getInstance();
             tempEnd.setTime(end);
             tempEnd.add(Calendar.DATE, +1);

+ 610 - 0
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -1,22 +1,47 @@
 package com.diagbot.facade;
 
+import com.alibaba.fastjson.JSONObject;
 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.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.CheckUserDTO;
+import com.diagbot.dto.DeptCheckUserDTO;
+import com.diagbot.entity.BasDeptInfo;
+import com.diagbot.entity.BasDoctorInfo;
 import com.diagbot.entity.MedCheckInfo;
+import com.diagbot.entity.QcresultInfo;
+import com.diagbot.entity.SysRole;
 import com.diagbot.entity.SysUser;
+import com.diagbot.entity.SysUserDept;
+import com.diagbot.entity.SysUserRole;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.MedCheckInfoServiceImpl;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.CheckJobPageVO;
+import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.CheckUserVO;
+import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
+import com.google.common.collect.Lists;
+import org.apache.commons.collections4.ListUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author wangfeng
@@ -28,6 +53,17 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
 
     @Autowired
     SysUserFacade sysUserFacade;
+    @Autowired
+    SysUserRoleFacade sysUserRoleFacade;
+    @Autowired
+    SysRoleFacade sysRoleFacade;
+    @Autowired
+    SysUserDeptFacade sysUserDeptFacade;
+    @Autowired
+    BasDoctorInfoFacade basDoctorInfoFacade;
+    @Autowired
+    BasDeptInfoFacade basDeptInfoFacade;
+
 
     /**
      * @param medCheckInfoAddVO
@@ -108,4 +144,578 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
         }
         return res;
     }
+    /**
+     * @Author songxl
+     * @Description 获取操作用户的核查科室以及人员
+     * @Date  2021/5/14
+     * @Param []
+     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @MethodName getCheckUserMap
+     */
+    public IPage<CheckJobDTO> getUserCheckList(CheckJobPageVO  checkJobVO) {
+        //校验
+        userCheckPageSet(checkJobVO);
+        //质控管理员要判断该角色是否是质控科
+        //1.获取质控科id
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        //获取核查监管相关角色id
+        List<Long> checkRoleIds = sysRoleFacade.list(new QueryWrapper<SysRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .like("name","监管人员")
+        ).stream().map(SysRole::getId).collect(Collectors.toList());
+        //查询该角色的所有角色id
+        List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("user_id", principleId)
+        ).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(searchRoleIds.isEmpty())
+        {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户不是核查监管人员!");
+        }
+        //质控科监管人员
+        if(searchRoleIds.contains(5L)&&"2".equals(checkJobVO.getJobType()))
+        {
+            //用户是不是质管科人员校验
+            String zkkDeptId = 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, "科室质管科不存在!");
+            }
+            //2.获取监管人员所在科室集合
+            List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .eq("user_id",principleId)
+            ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+            //3.判断这个人是否在质控科
+            if(deptIds.contains(zkkDeptId))
+            {
+                return getCheckList(checkJobVO);
+            }
+        }
+        //临床科室监管人员
+        else if(searchRoleIds.contains(4L)&&"0".equals(checkJobVO.getJobType()))
+        {
+            //获取监管人员所在科室集合
+            List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .eq("user_id",principleId)
+            ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+            if(deptIds!=null&&!deptIds.isEmpty()){
+                checkJobVO.setDeptList(deptIds);
+            }
+            return getCheckList(checkJobVO);
+        }
+        //院级监管人员
+        else if(searchRoleIds.contains(6L)&&"1".equals(checkJobVO.getJobType()))
+        {
+            //获取监管人员所在科室集合
+            List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id",hospitalId)
+                    .eq("user_id",principleId)
+            ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+            //分配除了监管人员以外其他科室的核查任务
+            if(deptIds!=null&&!deptIds.isEmpty()){
+                checkJobVO.setDeptList(deptIds);
+            }
+            return getCheckList(checkJobVO);
+        }
+        else
+        {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户的角色和任务类型不对应!");
+        }
+       return null;
+    }
+    /**
+     * @Author songxl
+     * @Description 待分配列表页面校验
+     * @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()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有时间区间!");
+        }
+        if(StringUtil.isBlank(checkJobVO.getJobType()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有任务类型!");
+        }
+        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 (DateUtil.after(DateUtil.parseDate(checkJobVO.getStartTime()),
+                    DateUtil.parseDate(checkJobVO.getEndTime()))) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "任务生成的开始时间必须小于结束时间!");
+            }
+        }
+
+    }
+
+    /**
+     * @Author songxl
+     * @Description 获取操作用户的核查科室以及科室核查人员
+     * @Date  2021/5/14
+     * @Param []
+     * @Return java.util.Map<java.lang.String,java.util.List<com.diagbot.dto.CheckDeptDTO>>
+     * @MethodName getCheckUserMap
+     */
+    public Map<String, List<CheckDeptDTO>> getCheckUserMap() {
+
+        //1.获取当前用户对应的管理员角色
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        //获取核查监管相关角色id
+        List<Long> checkRoleIds = sysRoleFacade.list(new QueryWrapper<SysRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .like("name","监管人员")
+        ).stream().map(SysRole::getId).collect(Collectors.toList());
+        //查询该角色的所有角色id
+        List<Long> roleIds = sysUserRoleFacade.list(new QueryWrapper<SysUserRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("user_id", principleId)
+        ).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(searchRoleIds.isEmpty())
+        {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该用户不是核查监管人员!");
+        }
+        //2.获取相应角色对应的科室以及核查人员
+        Map<String, List<CheckDeptDTO>> checkUserMap = getCheckRoleMap(searchRoleIds,hospitalId,principleId);
+        return checkUserMap;
+    }
+    /**
+     * @Author songxl
+     * @Description 获取相应角色对应的科室以及核查人员
+     * @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>>>
+     * @MethodName getCheckRoleMap
+     */
+
+    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
+            {
+                //不同角色不同查询方式
+                switch (id.intValue())
+                {
+                    //临床科室监管人员
+                    case 4:
+                        getDeptCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //质控科监管人员
+                    case 5:
+                        getZKKCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    //院级监管人员
+                    case 6:
+                        getYQCheckInfo(checkRoleMap,hospitalId,principleId);
+                        break;
+                    default:
+                        break;
+                }
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        return checkRoleMap;
+    }
+    /**
+     * @Author songxl
+     * @Description 院区管理员获取管理的科室以及科室包涵质控人员
+     * @Date  2021/5/17
+     * @Param [checkRoleMap, hospitalId, principleId]
+     * @Return void
+     * @MethodName getYQCheckInfo
+     */
+    private void getYQCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
+        //1.获取院级质控人员有哪些
+        //1.1获取院级质控人员角色id
+        Long roleId = sysRoleFacade.getOne(new QueryWrapper<SysRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("name","院级质控人员")).getId();
+        CheckUserVO checkUserVOS = new CheckUserVO();
+        checkUserVOS.setRoleIds(Lists.newArrayList(roleId));
+        checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
+        checkUserVOS.setUserId(principleId);
+        checkUserVOS.setRoleId(6L);
+        checkUserVOS.setHospitalId(hospitalId);
+        List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
+        //2.1获取科室详情
+        Map<String,String> deptMap = checkUserDTOS.stream()
+                .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+        //2.3获取所有医生信息的核查数
+        List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
+        CheckUserVO checkUserVO = new CheckUserVO();
+        checkUserVO.setJobType(1);
+        checkUserVO.setUserList(doctorIds);
+        //通过核查人员id获取核查人员的核查任务数
+        List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
+        addCheckInfoMaps(checkRoleMap,deptMap,userJobs,checkUserDTOS,6);
+    }
+    /**
+     * @Author songxl
+     * @Description 质控科管理员获取管理的科室以及科室包涵质控人员
+     * @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>()
+                .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, "科室质管科不存在!");
+        }
+        //2.获取监管人员所在科室集合
+        List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id",hospitalId)
+                .eq("user_id",principleId)
+        ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+        //3.判断这个人是否在质控科
+        if(deptIds.contains(zkkDeptId))
+        {
+            CheckUserVO checkUserVOS = new CheckUserVO();
+            checkUserVOS.setRoleIds(Lists.newArrayList(7L,8L,9L));
+            checkUserVOS.setDeptStations(Lists.newArrayList("住院","质管"));
+            checkUserVOS.setUserId(principleId);
+            checkUserVOS.setRoleId(5L);
+            checkUserVOS.setHospitalId(hospitalId);
+            List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
+            //2.1获取科室详情
+            Map<String,String> deptMap = checkUserDTOS.stream()
+                    .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+            //2.3获取所有医生信息的核查数
+            List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
+            CheckUserVO checkUserVO = new CheckUserVO();
+            checkUserVO.setJobType(2);
+            checkUserVO.setUserList(doctorIds);
+            //通过核查人员id获取核查人员的核查任务数
+            List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
+            addCheckInfoMaps(checkRoleMap,deptMap,userJobs,checkUserDTOS,5);
+        }
+
+    }
+    /**
+     * @Author songxl
+     * @Description 临床科室管理员获取管理的科室以及科室包涵质控人员
+     * @Date  2021/5/17
+     * @Param [checkRoleMap, hospitalId, principleId]
+     * @Return void
+     * @MethodName getDeptCheckInfo
+     */
+    private void getDeptCheckInfo(Map<String, List<CheckDeptDTO>> checkRoleMap, Long hospitalId, Long principleId) {
+
+        //1.获取监管人员所在科室集合
+        List<String> deptIds = sysUserDeptFacade.list(new QueryWrapper<SysUserDept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id",hospitalId)
+                .eq("user_id",principleId)
+        ).stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
+        if(deptIds.isEmpty()){return;}
+        CheckUserVO checkUserVOS = new CheckUserVO();
+        checkUserVOS.setRoleIds(Lists.newArrayList(4L,7L));
+        checkUserVOS.setDeptIds(deptIds);
+        checkUserVOS.setDeptStations(Lists.newArrayList("住院"));
+        checkUserVOS.setHospitalId(hospitalId);
+        List<CheckUserDTO> checkUserDTOS = baseMapper.getCheckUser(checkUserVOS);
+        //2.1获取科室详情
+        Map<String,String> deptMap = checkUserDTOS.stream()
+                .collect(Collectors.toMap(CheckUserDTO::getDeptId,CheckUserDTO::getDeptName, (v1, v2) -> v2));
+        //2.3获取所有医生信息的核查数
+        List<String> doctorIds = checkUserDTOS.stream().map(CheckUserDTO::getDoctorId).collect(Collectors.toList());
+        CheckUserVO checkUserVO = new CheckUserVO();
+        checkUserVO.setJobType(0);
+        checkUserVO.setUserList(doctorIds);
+        //通过核查人员id获取核查人员的核查任务数
+        List<DeptCheckUserDTO> userJobs = baseMapper.getJobNumByUserId(checkUserVO);
+        addCheckInfoMaps(checkRoleMap,deptMap,userJobs,checkUserDTOS,4);
+    }
+
+    /**
+     * @Author songxl
+     * @Description 拼装科室、核查人员、任务数对象
+     * @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) {
+        if(deptMap.isEmpty()||checkUserDTOS.isEmpty()){}
+        checkRoleMap.put(roleId+"",new ArrayList<CheckDeptDTO>());
+        //遍历科室
+        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)
+            {
+                //同一科室
+                if(checkDeptDTO.getDeptId().equals(checkUserDTO.getDeptId()))
+                {
+                    DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
+                    deptCheckUserDTO.setDeptId(checkUserDTO.getDeptId());
+                    deptCheckUserDTO.setDeptName(checkUserDTO.getDeptName());
+                    deptCheckUserDTO.setDoctorId(checkUserDTO.getDoctorId());
+                    deptCheckUserDTO.setDoctorName(checkUserDTO.getDoctorName());
+                    checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
+                }
+            }
+            for(DeptCheckUserDTO deptCheckUserDTO:checkDeptDTO.getDeptcheckUsers())
+            {
+                //遍历数量
+                for(DeptCheckUserDTO jobNumDto:userJobs)
+                {
+                    //有这个人
+                    if(deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
+                    {
+                        deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
+                    }
+                    //没有这个人
+                    else
+                    {
+                        deptCheckUserDTO.setJobNum(0);
+                    }
+                }
+            }
+            checkRoleMap.get(roleId+"").add(checkDeptDTO);
+        }
+    }
+
+
+    /**
+     * @Author songxl
+     * @Description 拼装科室、核查人员、任务数对象
+     * @Date  2021/5/17
+     * @Param [checkRoleMap, doctorInfos, userJobs, deptInfos, roleId]
+     * @Return void
+     * @MethodName addCheckInfoMap
+     */
+    private void addCheckInfoMap(Map<String, List<CheckDeptDTO>> checkRoleMap, List<BasDoctorInfo> doctorInfos,
+                                 List<DeptCheckUserDTO> userJobs, List<BasDeptInfo> deptInfos, int roleId) {
+        if(deptInfos.isEmpty()||doctorInfos.isEmpty()){}
+        checkRoleMap.put(roleId+"",new ArrayList<CheckDeptDTO>());
+        //遍历科室
+        for(BasDeptInfo deptInfo:deptInfos)
+        {
+            //科室对象
+            CheckDeptDTO checkDeptDTO = new CheckDeptDTO();
+            checkDeptDTO.setDeptId(deptInfo.getDeptId());
+            checkDeptDTO.setDeptName(deptInfo.getDeptName());
+            checkDeptDTO.setDeptcheckUsers(new ArrayList<DeptCheckUserDTO>());
+            //遍历医生
+            for(BasDoctorInfo doctorInfo:doctorInfos)
+            {
+                //同一科室
+                if(checkDeptDTO.getDeptId().equals(doctorInfo.getDeptId()))
+                {
+                    DeptCheckUserDTO deptCheckUserDTO = new DeptCheckUserDTO();
+                    deptCheckUserDTO.setDeptId(doctorInfo.getDeptId());
+                    deptCheckUserDTO.setDeptName(deptInfo.getDeptName());
+                    deptCheckUserDTO.setDoctorId(doctorInfo.getDoctorId());
+                    deptCheckUserDTO.setDoctorName(doctorInfo.getName());
+                    checkDeptDTO.getDeptcheckUsers().add(deptCheckUserDTO);
+                }
+            }
+            for(DeptCheckUserDTO deptCheckUserDTO:checkDeptDTO.getDeptcheckUsers())
+            {
+                //遍历数量
+                for(DeptCheckUserDTO jobNumDto:userJobs)
+                {
+                    //有这个人
+                    if(deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
+                    {
+                        deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
+                    }
+                    //没有这个人
+                    else
+                    {
+                        deptCheckUserDTO.setJobNum(0);
+                    }
+                }
+            }
+            checkRoleMap.get(roleId+"").add(checkDeptDTO);
+        }
+    }
+
+    /**
+     * @Author songxl
+     * @Description list求交集
+     * @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) {
+
+        List<Long> searchRoleIds = new ArrayList<>();
+        for(Long id:roleIds)
+        {
+            if(checkRoleIds.contains(id))
+            {
+                searchRoleIds.add(id);
+            }
+        }
+        return searchRoleIds;
+    }
+    /**
+     * @Author songxl
+     * @Description 分配/取消核查任务
+     * @Date  2021/5/17
+     * @Param [distributionJobVO]
+     * @Return boolean
+     * @MethodName distributionJobs
+     */
+    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,"入参为空");
+        }
+        //获取人员id 和 该人员的医院id
+        Long hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        //2.获取任务类型 0分配 1取消
+        String distributionType = distributionJobVO.getDistributionType();
+        //3 分配
+        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)
+                    .collect(Collectors.toList());
+            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);
+            SysUser user = sysUserFacade.getOne(userQuer);
+            String principleName = user.getLinkman();
+            //用户名称如果是null(目的:分配用户名为null表示用户未分配)
+            if(principleName==null){principleName = "";}
+            Date now = DateUtil.now();
+            //3.2分配核查任务
+            return  this.update(new UpdateWrapper<MedCheckInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", hospitalId)
+                    .in("behospital_code", distributionJobVO.getBehospitalCodes())
+                    .set("job_distributor", principleId)
+                    .set("job_distribution_name", principleName)
+                    .set("check_id", distributionJobVO.getCheckId())
+                    .set("check_name", distributionJobVO.getCheckName())
+                    .set("job_distribution_time", now));
+
+        }
+        //4 取消分配
+        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())
+            ).stream().map(MedCheckInfo::getCheckId).collect(Collectors.toSet());
+            //4.2获取出来的核查用户存在但不是一个
+            if(checkIds==null||checkIds.isEmpty()||
+                    (checkIds.size()!=1&&checkIds.contains(distributionJobVO.getCheckId())))
+            {
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "待取消分配任务列表不存在或存在不是该用户的任务!");
+            }
+            else
+            {
+                Date now = DateUtil.now();
+                //4.3取消分配
+                return  this.update(new UpdateWrapper<MedCheckInfo>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", hospitalId)
+                        .eq("check_id",  distributionJobVO.getCheckId())
+                        .in("behospital_code", distributionJobVO.getBehospitalCodes())
+                        .set("job_distributor",-1)
+                        .set("job_distribution_name", null)
+                        .set("check_id", -1)
+                        .set("check_name", "")
+                        .set("job_distribution_time", now));
+            }
+        }
+
+        return false;
+    }
+    /**
+     * @Author songxl
+     * @Description 获取指定核查人员的核查任务
+     * @Date  2021/5/17
+     * @Param [checkJobVO]
+     * @Return java.util.List<com.diagbot.dto.CheckJobDTO>
+     * @MethodName getCheckListByUserId
+     */
+    public List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO) {
+        //非空校验
+        if(StringUtil.isBlank(checkJobVO.getCheckId()))
+        {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "没有传核查用户id!");
+        }
+        return baseMapper.getCheckListByUserId(checkJobVO);
+    }
 }

+ 277 - 0
src/main/java/com/diagbot/facade/MedCheckWorkFacade.java

@@ -0,0 +1,277 @@
+package com.diagbot.facade;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckWorkDTO;
+import com.diagbot.dto.MedicalRecordDTO;
+import com.diagbot.entity.*;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.impl.MedBehospitalTypeServiceImpl;
+import com.diagbot.service.impl.MedCheckInfoServiceImpl;
+import com.diagbot.service.impl.MedicalRecordServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+/**
+ * @author songxl
+ * @since 2021-05-11
+ */
+@Slf4j
+@Component
+public class MedCheckWorkFacade {
+    @Autowired
+    SysUserFacade sysUserFacade;
+    @Autowired
+    private MedCheckInfoServiceImpl medCheckInfoServiceImpl;
+    @Autowired
+    private MedCheckInfoFacade medCheckInfoFacade;
+    @Autowired
+    private MedBehospitalTypeServiceImpl medBehospitalTypeServiceImpl;
+    @Autowired
+    private MedicalRecordServiceImpl medicalRecordServiceImpl;
+
+    /**
+     * @Author songxl
+     * @Description 批量操作核查任务(增加和删除)
+     * @Date 2021/5/11
+     * @Param [medCheckWorkVO]
+     * @Return java.lang.Boolean
+     * @MethodName addCheck
+     */
+    public Boolean addCheckWork(MedCheckWorkAddVO medCheckWorkVO) {
+
+        boolean flag = false;
+        Date now = DateUtil.now();
+        //获取核查任务类型(0-科室任务 1-院级 2-质控科)
+        Integer workType = medCheckWorkVO.getJobType();
+        //获取操作类型(0-取消,1-添加)
+        Integer checkStatus = medCheckWorkVO.getCheckStatus();
+        Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
+        Long principleId = Long.valueOf(SysUserUtils.getCurrentPrincipleID());
+        SysUser user = sysUserFacade.getOne(new QueryWrapper<SysUser>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("id", principleId)
+                .eq("status", 1));
+        String principleName = user.getLinkman();
+        //取消核查任务【操作类型(0-取消,1-添加)】
+        if (checkStatus != null && checkStatus == 0) {
+            //判断核查任务是否生成
+            QueryWrapper<MedCheckInfo> medicalRecordQe = new QueryWrapper<>();
+            medicalRecordQe.eq("hospital_id", hospitalId);
+            medicalRecordQe.eq("is_deleted", IsDeleteEnum.N.getKey());
+            if (medCheckWorkVO.getBehospitalCodeList().size() > 0) {
+                medicalRecordQe.in("behospital_code", medCheckWorkVO.getBehospitalCodeList());
+            }
+            List<MedCheckInfo> list = medCheckInfoFacade.list(medicalRecordQe);
+            if (ListUtil.isEmpty(list)) {
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL, "存在未生成核查任务!");
+            }
+
+            int i = medCheckInfoFacade.getBaseMapper().deleteBatchCodes(medCheckWorkVO.getBehospitalCodeList());
+            if(i!=0)
+            {
+                return true;
+            }
+        } else if (checkStatus != null && checkStatus == 1) {
+            //生成核查任务
+            MedCheckInfo data = medCheckInfoFacade.getOne(new QueryWrapper<MedCheckInfo>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("hospital_id", hospitalId)
+                    .in("behospital_code", medCheckWorkVO.getBehospitalCodeList())
+            );
+            //任务是否存在
+            if (data != null) {
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL, "核查任务已存在!");
+            }
+
+            //该病历没有核查的时候, 就添加核查记录
+            List<MedCheckInfo> medCheckInfoList = new ArrayList<>();
+            for (String behospitalCode : medCheckWorkVO.getBehospitalCodeList()) {
+                MedCheckInfo medCheckInfo = new MedCheckInfo();
+                medCheckInfo.setIsDeleted(IsDeleteEnum.N.getKey());
+                medCheckInfo.setGmtCreate(now);
+                medCheckInfo.setBehospitalCode(behospitalCode);
+                medCheckInfo.setHospitalId(hospitalId);
+                medCheckInfo.setCheckType(medCheckWorkVO.getCheckType());
+                medCheckInfo.setJobCreator(principleId);
+                medCheckInfo.setJobCreatorName(principleName);
+                medCheckInfo.setJobCreateTime(now);
+                medCheckInfo.setJobType(medCheckWorkVO.getJobType());
+                medCheckInfoList.add(medCheckInfo);
+            }
+            flag = medCheckInfoServiceImpl.saveBatch(medCheckInfoList);
+        }
+        return flag;
+    }
+
+    /**
+     * @Author songxl
+     * @Description 获取每日住院患者的类型(出院、病危、抢救。。。)
+     * @Date 2021/5/11
+     * @Param [param]
+     * @Return void
+     * @MethodName execute
+     */
+    public void execute(String param) {
+        JSONObject paramJson = JSONObject.parseObject(param);
+        Long hospiatlId = paramJson.getLong("hospital");
+        JSONObject typeValue = paramJson.getJSONObject("typeVal");
+        JSONObject typeName = paramJson.getJSONObject("typeName");
+        int searchSize = paramJson.getInteger("searchSize");
+        int batchSize = paramJson.getInteger("batchSize");
+
+
+        //定义批量插入的集合
+        HashMap<String, MedBehospitalType> medBehospitalTypeMap = null;
+        //1.判断患者类型表是否有记录
+        int count = medBehospitalTypeServiceImpl.count();
+        if (count > 0) {
+            medBehospitalTypeMap = new HashMap<>();
+            //2.1获取最近指定归档时间间隔的患者
+            RecordTypeVO recordContentVO = new RecordTypeVO();
+            recordContentVO.setHospitalId(hospiatlId);
+            recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
+            recordContentVO.setIsPlacefile(1l);//获取已归档的患者
+            recordContentVO.setStartTime(DateUtil.formatDateTime(DateUtil.addMinutes(DateUtil.now(), -30)));
+            recordContentVO.setEndTime(DateUtil.formatDateTime(DateUtil.now()));
+            putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
+        } else {
+            //2.2添加今天之前所有患者的类型
+            //2.2.1获取所有数据数量
+            medBehospitalTypeMap = new HashMap<>();
+            RecordTypeVO recordContentVO = new RecordTypeVO();
+            recordContentVO.setHospitalId(hospiatlId);
+            recordContentVO.setModeList(new ArrayList<String>(typeValue.keySet()));
+            recordContentVO.setIsPlacefile(1l);//获取已归档的患者
+            putBehospitalTypeMap(medBehospitalTypeMap,recordContentVO,typeValue,typeName,hospiatlId,searchSize);
+        }
+        //3.批量执行插入操作
+        try {
+            if (medBehospitalTypeMap!=null&&medBehospitalTypeMap.size() > 0) {
+                List<MedBehospitalType> medBehospitalTypeList = new ArrayList<>(medBehospitalTypeMap.values());
+                medBehospitalTypeServiceImpl.saveBatch(medBehospitalTypeList, batchSize);
+            }
+        }
+        catch(Exception e)
+        {
+            log.error(e.getMessage(),e);
+        }
+    }
+
+    private void putBehospitalTypeMap(HashMap<String, MedBehospitalType> medBehospitalTypeMap,
+                                      RecordTypeVO recordContentVO, JSONObject typeValue,
+                                      JSONObject typeName, Long hospiatlId,int searchSize) {
+        int num = medicalRecordServiceImpl.getRecordCount(recordContentVO);
+        if (num > 0) {
+
+            if (num < searchSize) {
+                //执行一次
+                recordContentVO.setStart(0L);
+                recordContentVO.setEnd(num + 0L);
+                getPatientRecordType(medBehospitalTypeMap,
+                        medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
+            }
+            else
+            {
+                int i = num / searchSize + 1;
+                for (int j = 0; j < i; j++) {
+                    //5000个一次循环添加
+                    recordContentVO.setStart(j * searchSize * 1L);
+                    recordContentVO.setEnd(searchSize * 1L);
+                    getPatientRecordType(medBehospitalTypeMap,
+                            medicalRecordServiceImpl.getMedicalRecord(recordContentVO), typeValue, typeName, hospiatlId);
+                }
+            }
+        }
+    }
+
+    /**
+     * @Author songxl
+     * @Description 获取患者类型存入批量插入map
+     * @Date 2021/5/11
+     * @Param [medBehospitalTypeMap, medicalRecordList, typeValue, typeName, hospiatlId]
+     * @Return void
+     * @MethodName getPatientRecordType
+     */
+    private void getPatientRecordType(HashMap<String, MedBehospitalType> medBehospitalTypeMap,
+                                      List<MedicalRecordDTO> medicalRecordList,
+                                      JSONObject typeValue,
+                                      JSONObject typeName, Long hospiatlId) {
+
+        if (medicalRecordList == null || medicalRecordList.isEmpty()) {
+            return;
+        }
+        //1.遍历查询出来的结果
+        for (MedicalRecordDTO medicalRecordDTO : medicalRecordList) {
+            //2.判断批量插入map中有没有这个患者
+            if (medBehospitalTypeMap.containsKey(medicalRecordDTO.getBehospitalCode())) {
+                //3.比较这两次的分值大小
+                int lval = medBehospitalTypeMap.get(medicalRecordDTO.getBehospitalCode()).getValue();
+                int nval = typeValue.getInteger(medicalRecordDTO.getModeId() + "");
+                if (nval > lval) {
+                    medBehospitalTypeMap.get(medicalRecordDTO.getBehospitalCode()).setValue(nval);
+                    medBehospitalTypeMap.get(medicalRecordDTO.getBehospitalCode())
+                            .setBehospitalType(typeName.getString(medicalRecordDTO.getModeId() + ""));
+                }
+            } else {
+                //4.获取分值记录这个患者
+                MedBehospitalType medBehospitalType = new MedBehospitalType();
+                medBehospitalType.setBehospitalCode(medicalRecordDTO.getBehospitalCode());
+                medBehospitalType.setBehospitalType(typeName.getString(medicalRecordDTO.getModeId() + ""));
+                medBehospitalType.setValue(typeValue.getInteger(medicalRecordDTO.getModeId() + ""));
+                medBehospitalType.setCreateTime(DateUtil.now());
+                medBehospitalType.setHospitalId(hospiatlId);
+                medBehospitalTypeMap.put(medicalRecordDTO.getBehospitalCode(), medBehospitalType);
+            }
+        }
+    }
+
+
+    /**
+     * 分页
+     *
+     * @param checkWorkPageVO
+     * @return
+     */
+    public IPage<CheckWorkDTO> pageFac(CheckWorkPageVO checkWorkPageVO) {
+        checkWorkPageSet(checkWorkPageVO);
+        IPage<CheckWorkDTO> res = medCheckInfoFacade.getBaseMapper().getCheckWorkPage(checkWorkPageVO);
+        return res;
+    }
+
+    private void checkWorkPageSet(CheckWorkPageVO checkWorkPageVO) {
+        //入参验证
+        //出院时间
+        if (null != checkWorkPageVO && null != checkWorkPageVO.getStartDate()) {
+            checkWorkPageVO.setStartDate(DateUtil.getFirstTimeOfDay(checkWorkPageVO.getStartDate()));
+        }
+        if (null != checkWorkPageVO && null != checkWorkPageVO.getEndDate()) {
+            checkWorkPageVO.setEndDate(DateUtil.getFirstTimeOfDay(DateUtil.addDay(checkWorkPageVO.getEndDate(), 1)));
+        }
+        if (null != checkWorkPageVO && null != checkWorkPageVO.getStartDate() && null != checkWorkPageVO.getEndDate()) {
+            if (DateUtil.after(checkWorkPageVO.getStartDate(), checkWorkPageVO.getEndDate())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
+            }
+        }
+        //住院天数
+        if (null != checkWorkPageVO && null != checkWorkPageVO.getSmallDay() && null != checkWorkPageVO.getBigDay()) {
+            if (checkWorkPageVO.getSmallDay() > checkWorkPageVO.getBigDay()) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "住院天数区间有误!");
+            }
+        }
+        checkWorkPageVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
+
+}

+ 2 - 1
src/main/java/com/diagbot/facade/QcClientFacade.java

@@ -34,7 +34,8 @@ public class QcClientFacade {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "配置表内找不到评分接口地址数据!");
         }
         try {
-            uri = new URI(url);
+//            uri = new URI(url);
+            uri = new URI("http://localhost:6010");
         } catch (Exception e) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
         }

+ 14 - 0
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -250,6 +250,20 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         .set("opt_type", 3)
                         .set("modifier", useId)
                         .set("gmt_modified", now)
+                        .set("explain_info",algorithmVO.getOptResultAlgVO().getExplainInfo())
+                );
+                break;
+            case 4:
+                //逻辑删除质控明细
+                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("opt_type", 2)
+                        .set("modifier", useId)
+                        .set("gmt_modified", now)
                 );
                 break;
             default:

+ 126 - 0
src/main/java/com/diagbot/facade/RecordCheckFacade.java

@@ -0,0 +1,126 @@
+package com.diagbot.facade;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckedRecordListDTO;
+import com.diagbot.entity.MedCheckInfo;
+import com.diagbot.entity.MedQcresultDetail;
+import com.diagbot.entity.SysUserDept;
+import com.diagbot.entity.SysUserRole;
+import com.diagbot.enums.CheckJobTypeEnum;
+import com.diagbot.enums.CheckTypeEnum;
+import com.diagbot.enums.CheckerRoleEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.service.MedQcresultDetailService;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.CheckedRecordListVO;
+import com.diagbot.vo.RecordCheckVO;
+import com.diagbot.vo.SysUserBaseVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2021/5/17 18:43
+ */
+@Component
+public class RecordCheckFacade {
+
+    @Autowired
+    SysUserFacade sysUserFacade;
+    @Autowired
+    SysUserDeptFacade sysUserDeptFacade;
+    @Autowired
+    SysUserRoleFacade sysUserRoleFacade;
+    @Autowired
+    MedCheckInfoFacade medCheckInfoFacade;
+    @Autowired
+    MedQcresultDetailService medQcresultDetailService;
+
+    public IPage<CheckedRecordListDTO> checkedRecordList(CheckedRecordListVO checkedRecordListVO) {
+        Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
+        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());
+        List<String> deptIds = sysUserFacade.getUserDepts(sysUserBaseVO).getSelDepts().stream().map(i -> i.getDeptId()).collect(Collectors.toList());
+
+        List<Long> userIds = Lists.newArrayList();
+        roleIds.forEach(roleId -> {
+            if (roleId.intValue() == CheckerRoleEnum.HOSP_SUPERVISOR.getKey()
+                    && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.HOSP_SUPERVISOR.getKey() + ""))) {
+                userIds.addAll(getUserIdsOfRoleId(hospitalId, null, CheckerRoleEnum.HOSP_GENERAL.getKey()));
+            } else if (roleId.intValue() == CheckerRoleEnum.QUAT_SUPERVISOR.getKey()
+                    && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.QUAT_SUPERVISOR.getKey() + ""))) {
+                userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.QUAT_GENERAL.getKey()));
+            } else if (roleId.intValue() == CheckerRoleEnum.DEPT_SUPERVISOR.getKey()
+                    && (ListUtil.isEmpty(checkedRecordListVO.getCheckJobTypes()) || checkedRecordListVO.getCheckJobTypes().contains(CheckJobTypeEnum.DEPT_SUPERVISOR.getKey() + ""))) {
+                userIds.addAll(getUserIdsOfRoleId(hospitalId, deptIds, CheckerRoleEnum.DEPT_GENERAL.getKey()));
+            }
+        });
+
+        checkedRecordListVO.setCurrentDeptIds(String.join(",", deptIds));
+        checkedRecordListVO.setCurrentGeneralUserIds(userIds);
+        IPage<CheckedRecordListDTO> iPage = medCheckInfoFacade.getBaseMapper().checkedRecordList(checkedRecordListVO);
+
+        if (ListUtil.isNotEmpty(iPage.getRecords())) {
+            List<String> behospitalCodes = iPage.getRecords().stream().map(i -> i.getBehospitalCode()).collect(Collectors.toList());
+            QueryWrapper<MedQcresultDetail> medQcresultDetailQueryWrapper = new QueryWrapper<>();
+            medQcresultDetailQueryWrapper.eq("hospital_id", hospitalId);
+            medQcresultDetailQueryWrapper.in("behospital_code", behospitalCodes);
+            medQcresultDetailQueryWrapper.select("behospital_code", "cases_entry_id");
+            Map<String, Long> behospitalCodeCasesMap = medQcresultDetailService.list(medQcresultDetailQueryWrapper).stream().collect(Collectors.groupingBy(MedQcresultDetail::getBehospitalCode, Collectors.counting()));
+            iPage.getRecords().forEach(i -> {
+                i.setCasesEntryNum(behospitalCodeCasesMap.get(i.getBehospitalCode()).intValue());
+            });
+        }
+
+        return iPage;
+    }
+
+    private List<Long> getUserIdsOfRoleId(Long hospitalId, List<String> deptIds, long roleId) {
+        QueryWrapper<SysUserDept> sysUserDeptQueryWrapper = new QueryWrapper<>();
+        sysUserDeptQueryWrapper.eq("hospital_id", hospitalId);
+        sysUserDeptQueryWrapper.in(ListUtil.isNotEmpty(deptIds), "dept_id", deptIds);
+        List<Long> userIds = sysUserDeptFacade.list(sysUserDeptQueryWrapper).stream().map(i -> i.getUserId()).collect(Collectors.toList());
+
+        if (ListUtil.isEmpty(userIds)) {
+            return null;
+        }
+        QueryWrapper<SysUserRole> sysUserRoleQueryWrapper = new QueryWrapper<>();
+        sysUserRoleQueryWrapper.in("user_id", userIds);
+        sysUserRoleQueryWrapper.eq("role_id", roleId);
+        return sysUserRoleFacade.list(sysUserRoleQueryWrapper).stream().map(i -> i.getUserId()).collect(Collectors.toList());
+    }
+
+    public boolean recordCheck(RecordCheckVO recordCheckVO) {
+        Long hospitalId = Long.parseLong(SysUserUtils.getCurrentHospitalID());
+        Long userId = Long.parseLong(SysUserUtils.getCurrentPrincipleID());
+
+        QueryWrapper<MedCheckInfo> medCheckInfoQueryWrapper = new QueryWrapper<>();
+        medCheckInfoQueryWrapper.eq("behospital_code", recordCheckVO.getBehospitalCode());
+        medCheckInfoQueryWrapper.eq("hospital_id", hospitalId);
+        medCheckInfoQueryWrapper.eq("check_id", userId);
+        medCheckInfoQueryWrapper.eq("check_type", CheckTypeEnum.ALL.getKey());
+        MedCheckInfo medCheckInfo = medCheckInfoFacade.getOne(medCheckInfoQueryWrapper);
+        if (medCheckInfo == null) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "该数据您暂无核查权限!");
+        }
+
+        medCheckInfo.setStatus(1);
+        medCheckInfo.setCheckTime(DateUtil.now());
+        medCheckInfoFacade.updateById(medCheckInfo);
+        
+        return true;
+    }
+
+}

+ 46 - 1
src/main/java/com/diagbot/facade/SysUserFacade.java

@@ -129,6 +129,21 @@ public class SysUserFacade extends SysUserServiceImpl {
         data.setRefreshToken(jwt.getRefresh_token());
         data.setType(user.getType());
         data.setTypeCn(ConstantEnum.getName(user.getType()));//返回中文
+        //获取用户角色
+        try {
+            SysUserBaseVO sysUserBaseVO = new SysUserBaseVO();
+            sysUserBaseVO.setUserId(user.getId());
+            List<SysRoleDTO> selRoles =getlocalUserRoles(sysUserBaseVO);
+            if(selRoles!=null&&!selRoles.isEmpty())
+            {
+                data.setSelRoles(selRoles);
+            }
+
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
         //token存入redis
         JwtStore jwtStore = new JwtStore();
         jwtStore.setAccessToken(jwt.getAccess_token());
@@ -285,7 +300,7 @@ public class SysUserFacade extends SysUserServiceImpl {
         List<SysUserRole> sysUserRoleList = sysUserRoleFacade.list(sysUserRoleQueryWrapper);
         if(ListUtil.isNotEmpty(sysUserRoleList)){
             sysUserRoleList.forEach(sysUserRole ->{
-                    roleSet.add(sysUserRole.getRoleId()+"");
+                roleSet.add(sysUserRole.getRoleId()+"");
             } );
         }
         if (user == null) {
@@ -466,6 +481,36 @@ public class SysUserFacade extends SysUserServiceImpl {
 
         return sysUserRoleDTO;
     }
+    /**
+     * 获取用户角色
+     *
+     * @param sysUserBaseVO 获取用户角色入参
+     * @return 用户角色信息
+     */
+    private List<SysRoleDTO> getlocalUserRoles(SysUserBaseVO sysUserBaseVO) {
+        SysUserRoleDTO sysUserRoleDTO = new SysUserRoleDTO();
+        sysUserRoleDTO.setUserId(sysUserBaseVO.getUserId());
+        List<SysRoleDTO> sysRoleDTOList = sysRoleFacade.listFac();
+        List<SysUserRole> sysUserRoleList
+                = sysUserRoleService.list(new QueryWrapper<SysUserRole>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("user_id", sysUserBaseVO.getUserId())
+        );
+        List<SysRoleDTO> selRoles = new ArrayList<>();
+        if (ListUtil.isNotEmpty(sysUserRoleList)) {
+            Set<Long> selRoleIds = sysUserRoleList.stream()
+                    .map(SysUserRole::getRoleId)
+                    .collect(Collectors.toSet());
+            for (SysRoleDTO sysRoleDTO : sysRoleDTOList) {
+                if (selRoleIds.contains(sysRoleDTO.getId())) {
+                    selRoles.add(sysRoleDTO);
+                }
+            }
+            sysUserRoleDTO.setSelRoles(selRoles);
+        }
+
+        return selRoles;
+    }
 
     /**
      * 用户启用

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

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedBehospitalType;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author songxl
+ * @since 2021-05-11
+ */
+public interface MedBehospitalTypeMapper extends BaseMapper<MedBehospitalType> {
+
+}

+ 26 - 0
src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java

@@ -1,7 +1,20 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.CheckUserDTO;
+import com.diagbot.dto.CheckWorkDTO;
+import com.diagbot.dto.CheckedRecordListDTO;
+import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.vo.CheckJobPageVO;
+import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.CheckUserVO;
+import com.diagbot.vo.CheckWorkPageVO;
+import com.diagbot.vo.CheckedRecordListVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +25,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2020-07-06
  */
 public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
+    //获取未分配的核查任务
+    IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO);
+    //通过核查人员id获取核查人员的核查任务数
+    List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
+    //核查任务列表
+    IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO);
+    //获取指定核查人员的核查任务
+    List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO);
+    //取消核查任务
+    int deleteBatchCodes(List<String> list);
 
+    IPage<CheckedRecordListDTO> checkedRecordList(CheckedRecordListVO checkedRecordListVO);
+    //获取核查人员用户科室、姓名、角色
+    List<CheckUserDTO> getCheckUser(CheckUserVO checkUserVOS);
 }

+ 5 - 0
src/main/java/com/diagbot/mapper/MedicalRecordMapper.java

@@ -1,10 +1,12 @@
 package com.diagbot.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.dto.MedicalRecordDTO;
 import com.diagbot.dto.RecordContentDTO;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.vo.RecordContentVO;
 import com.diagbot.vo.RecordDataVO;
+import com.diagbot.vo.RecordTypeVO;
 
 import java.util.List;
 
@@ -22,4 +24,7 @@ public interface MedicalRecordMapper extends BaseMapper<MedicalRecord> {
     public List<RecordContentDTO> getRecordData(RecordDataVO recordContentVO);
 
     public void updateBatchByKey(List<MedicalRecord> list);
+    public int getRecordCount(RecordTypeVO recordContentVO);
+
+    List<MedicalRecordDTO> getMedicalRecord(RecordTypeVO recordContentVO);
 }

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

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.MedBehospitalType;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author songxl
+ * @since 2021-05-11
+ */
+public interface MedBehospitalTypeService extends IService<MedBehospitalType> {
+
+}

+ 9 - 1
src/main/java/com/diagbot/service/MedCheckInfoService.java

@@ -1,7 +1,15 @@
 package com.diagbot.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.DeptCheckUserDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.vo.CheckJobPageVO;
+import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.CheckUserVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +20,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2020-07-06
  */
 public interface MedCheckInfoService extends IService<MedCheckInfo> {
-
+    public IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO);
 }

+ 5 - 0
src/main/java/com/diagbot/service/MedicalRecordService.java

@@ -1,10 +1,12 @@
 package com.diagbot.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.dto.MedicalRecordDTO;
 import com.diagbot.dto.RecordContentDTO;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.vo.RecordContentVO;
 import com.diagbot.vo.RecordDataVO;
+import com.diagbot.vo.RecordTypeVO;
 
 import java.util.List;
 
@@ -20,4 +22,7 @@ public interface MedicalRecordService extends IService<MedicalRecord> {
 
     public List<RecordContentDTO> getRecordContent(RecordContentVO recordContentVO);
     public List<RecordContentDTO> getRecordData(RecordDataVO recordContentVO);
+    public int getRecordCount(RecordTypeVO recordContentVO);
+
+    public List<MedicalRecordDTO> getMedicalRecord(RecordTypeVO recordContentVO);
 }

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

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.MedBehospitalType;
+import com.diagbot.mapper.MedBehospitalTypeMapper;
+import com.diagbot.service.MedBehospitalTypeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author songxl
+ * @since 2021-05-11
+ */
+@Service
+public class MedBehospitalTypeServiceImpl extends ServiceImpl<MedBehospitalTypeMapper, MedBehospitalType> implements MedBehospitalTypeService {
+
+}

+ 19 - 0
src/main/java/com/diagbot/service/impl/MedCheckInfoServiceImpl.java

@@ -1,11 +1,19 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.CheckJobDTO;
+import com.diagbot.dto.CheckWorkDTO;
 import com.diagbot.entity.MedCheckInfo;
 import com.diagbot.mapper.MedCheckInfoMapper;
 import com.diagbot.service.MedCheckInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.CheckJobPageVO;
+import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.CheckWorkPageVO;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 核查表 服务实现类
@@ -17,4 +25,15 @@ import org.springframework.stereotype.Service;
 @Service
 public class MedCheckInfoServiceImpl extends ServiceImpl<MedCheckInfoMapper, MedCheckInfo> implements MedCheckInfoService {
 
+    public IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO) {
+        return baseMapper.getCheckWorkPage(checkWorkPageVO);
+    }
+
+    public int deleteBatchCodes(List<String> list){
+        return baseMapper.deleteBatchCodes(list);
+    }
+    @Override
+    public IPage<CheckJobDTO> getCheckList(CheckJobPageVO checkJobVO) {
+        return baseMapper.getCheckList(checkJobVO);
+    }
 }

+ 12 - 0
src/main/java/com/diagbot/service/impl/MedicalRecordServiceImpl.java

@@ -1,5 +1,6 @@
 package com.diagbot.service.impl;
 
+import com.diagbot.dto.MedicalRecordDTO;
 import com.diagbot.dto.RecordContentDTO;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.mapper.MedicalRecordMapper;
@@ -7,6 +8,7 @@ import com.diagbot.service.MedicalRecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.vo.RecordContentVO;
 import com.diagbot.vo.RecordDataVO;
+import com.diagbot.vo.RecordTypeVO;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -31,6 +33,16 @@ public class MedicalRecordServiceImpl extends ServiceImpl<MedicalRecordMapper, M
         return baseMapper.getRecordData(recordContentVO);
     }
 
+    @Override
+    public int getRecordCount(RecordTypeVO recordContentVO) {
+        return baseMapper.getRecordCount(recordContentVO);
+    }
+
+    @Override
+    public List<MedicalRecordDTO> getMedicalRecord(RecordTypeVO recordContentVO) {
+        return baseMapper.getMedicalRecord(recordContentVO);
+    }
+
     /**
      * 根据文书编码、医院编码、病人住院编码
      * @param list

+ 71 - 0
src/main/java/com/diagbot/task/BehospitalInfoTypeTask.java

@@ -0,0 +1,71 @@
+package com.diagbot.task;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.entity.SysTaskCron;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.BehospitalInfoFacade;
+import com.diagbot.facade.MedCheckWorkFacade;
+import com.diagbot.facade.SysTaskCronFacade;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.TaskVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.Trigger;
+import org.springframework.scheduling.TriggerContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+import org.springframework.scheduling.support.CronTrigger;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务(每隔半小时检查今天患者,然后修改今天的患者的类型)
+@Slf4j
+public class BehospitalInfoTypeTask implements SchedulingConfigurer{
+    @Autowired
+    private SysTaskCronFacade sysTaskCronFacade;
+
+    private SysTaskCron task001 = new SysTaskCron();
+
+    private String param = "";
+
+    //添加核查任务
+    @Autowired
+    private MedCheckWorkFacade medCheckWorkFacade;
+    /**
+     * 执行定时任务.
+     */
+    @Override
+    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
+        taskRegistrar.addTriggerTask(new Runnable() {
+            @Override
+            public void run() {
+                //1.添加任务内容(Runnable)
+                if (null != task001
+                        && task001.getIsDeleted().equals(IsDeleteEnum.N.getKey())
+                        && task001.getIsUsed().equals(1)) {
+                    log.info("执行动态定时任务: " + LocalDateTime.now().toLocalTime());
+                    medCheckWorkFacade.execute(param);
+                }
+            }
+        }, new Trigger() {
+            @Override
+            public Date nextExecutionTime(TriggerContext triggerContext) {
+                //2.1 从数据库获取执行周期
+                task001 = sysTaskCronFacade.getOne(new QueryWrapper<SysTaskCron>()
+                        .eq("cron_code", "TASK019"), false);
+                String cron = "0 0/30 * * * ?";
+                //2.2 合法性校验.
+                if (null != task001 && StringUtil.isNotBlank(task001.getCron())) {
+                    cron = task001.getCron();
+                    param = task001.getParam();
+                }
+                CronTrigger trigger = new CronTrigger(cron);
+                return trigger.nextExecutionTime(triggerContext);
+            }
+        });
+    }
+}

+ 1 - 11
src/main/java/com/diagbot/task/MedIndexTask.java

@@ -63,7 +63,7 @@ public class MedIndexTask implements SchedulingConfigurer{
                 //2.1 从数据库获取执行周期
                 task001 = sysTaskCronFacade.getOne(new QueryWrapper<SysTaskCron>()
                         .eq("cron_code", "TASK_INDEX"), false);
-                String cron = "* 22 * * * ?";
+                String cron = "0 0 3 * * ?";
                 //2.2 合法性校验.
                 if (null != task001 && StringUtil.isNotBlank(task001.getCron())) {
                     cron = task001.getCron();
@@ -73,14 +73,4 @@ public class MedIndexTask implements SchedulingConfigurer{
             }
         });
     }
-    private void timeHandle( FilterVO filterVO){
-        SimpleDateFormat simpleDateFormatRe = new SimpleDateFormat("yyyy-MM-dd");
-        LocalDate now = LocalDate.now();
-        LocalDate localDate = now.plusDays(-1);
-        ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
-        Date time = Date.from(zonedDateTime.toInstant());
-        String format = simpleDateFormatRe.format(time);
-        filterVO.setStartDate(format+" 00:00:00");
-        filterVO.setEndDate(format+" 23:59:59");
-    }
 }

+ 51 - 0
src/main/java/com/diagbot/vo/CheckJobPageVO.java

@@ -0,0 +1,51 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @description: 分配任务入参对象-分页
+ * @author: songxl
+ * @time: 2021/05/17
+ */
+@Data
+public class CheckJobPageVO extends Page implements Serializable {
+    private static final long serialVersionUID = 1L;
+    //生成任务开始时间
+    @ApiModelProperty("生成任务开始时间,格式为:yyyy-MM-dd")
+    private String startTime;
+    //生成任务结束时间
+    @ApiModelProperty("生成任务结束时间,格式为:yyyy-MM-dd")
+    private String endTime;
+    //出院开始时间
+    @ApiModelProperty("出院开始时间,格式为:yyyy-MM-dd")
+    private String behosDateStart;
+    //出院结束时间
+    @ApiModelProperty("出院结束时间,格式为:yyyy-MM-dd")
+    private String behosDateEnd;
+    //任务类型
+    @ApiModelProperty("任务类型 0-科室任务 1-院级 2-质控科")
+    private String jobType;
+    //核查用户id
+    @ApiModelProperty("核查用户id")
+    private String checkId;
+    //病人姓名
+    @ApiModelProperty("病人姓名")
+    private String name;
+    //病人住院序号
+    @ApiModelProperty("病人住院序号")
+    private String behospitalCode;
+    //主诊断医生
+    @ApiModelProperty("主诊断医生")
+    private String doctorName;
+    //科室id集合
+    @ApiModelProperty(hidden = true)
+    private List<String> deptList;
+
+
+
+}

+ 51 - 0
src/main/java/com/diagbot/vo/CheckJobVO.java

@@ -0,0 +1,51 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @description: 分配任务入参对象
+ * @author: songxl
+ * @time: 2021/05/17
+ */
+@Data
+public class CheckJobVO {
+    //生成任务开始时间
+    @ApiModelProperty("生成任务开始时间,格式为:yyyy-MM-dd")
+    private String startTime;
+    //生成任务结束时间
+    @ApiModelProperty("生成任务结束时间,格式为:yyyy-MM-dd")
+    private String endTime;
+    //出院开始时间
+    @ApiModelProperty("出院开始时间,格式为:yyyy-MM-dd")
+    private String behosDateStart;
+    //出院结束时间
+    @ApiModelProperty("出院结束时间,格式为:yyyy-MM-dd")
+    private String behosDateEnd;
+    //核查用户id
+    @ApiModelProperty("核查用户id")
+    private String checkId;
+    //任务类型
+    @ApiModelProperty(hidden = true)
+    private String jobType;
+    //病人姓名
+    @ApiModelProperty(hidden = true)
+    private String name;
+    //病人住院序号
+    @ApiModelProperty(hidden = true)
+    private String behospitalCode;
+    //主诊断医生
+    @ApiModelProperty(hidden = true)
+    private String doctorName;
+    //科室id集合
+    @ApiModelProperty(hidden = true)
+    private List<String> deptList;
+
+
+
+}

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

@@ -0,0 +1,31 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2020/4/13 18:31
+ */
+@Data
+public class CheckUserVO {
+    //任务类型
+    private Integer jobType;
+    //核查用户id集合
+    private List<String> userList;
+    //用户角色集合
+    private List<Long> roleIds;
+    //用户科室集合
+    private List<String> deptIds;
+    //医院
+    private Long hospitalId;
+    //科室类型集合
+    private List<String> deptStations;
+    //角色id
+    private  Long roleId;
+    //用户id
+    private  Long userId;
+
+}

+ 108 - 0
src/main/java/com/diagbot/vo/CheckWorkPageVO.java

@@ -0,0 +1,108 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ * 核查患者病历信息
+ * </p>
+ *
+ * @author wangsy
+ * @since 2021-05-13
+ */
+@Data
+public class CheckWorkPageVO extends Page implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 出院开始时间
+     */
+    @ApiModelProperty("出院开始时间")
+    private Date startDate;
+
+    /**
+     * 出院结束时间
+     */
+    @ApiModelProperty("出院结束时间")
+    private Date endDate;
+
+    /**
+     * 生成状态[0-未生成 1-已生成(默认未生成)]
+     */
+    @ApiModelProperty("生成状态[0-未生成 1-已生成(默认未生成)]")
+    private String creatStatus="0";
+
+    /**
+     * 核查任务类型(0-科室任务 1-院级 1-质控科)
+     */
+    private String jobType;
+
+    /**
+     * 医院ID
+     */
+
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;
+
+    /**
+     * 病人住院序号
+     */
+    @ApiModelProperty("病人住院序号")
+    private String behospitalCode;
+
+    /**
+     * 科室编号集合
+     */
+    @ApiModelProperty("科室编号集合")
+    private List<String> departments;
+
+    /**
+     * 病历等级
+     */
+    @ApiModelProperty("病历等级")
+    private String level;
+
+    /**
+     * 病人姓名
+     */
+    @ApiModelProperty("病人姓名")
+    private String name;
+
+    /**
+     * 医生姓名
+     */
+    @ApiModelProperty("医生姓名")
+    private String doctorName;
+
+    /**
+     * 主诊断
+     */
+    @ApiModelProperty("主诊断")
+    private String diagnose;
+
+    /**
+     * 最小天数
+     */
+    @ApiModelProperty("最小天数")
+    private Integer smallDay;
+
+    /**
+     * 最大天数
+     */
+    @ApiModelProperty("最大天数")
+    private Integer bigDay;
+
+    /**
+     * 是否归档(0:未归档,1:已归档)
+     */
+    @ApiModelProperty("是否归档(0:未归档,1:已归档)")
+    private String isPlacefile = "1";
+
+}

+ 104 - 0
src/main/java/com/diagbot/vo/CheckedRecordListVO.java

@@ -0,0 +1,104 @@
+package com.diagbot.vo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2021/5/17 18:48
+ */
+@Getter
+@Setter
+@ApiModel("核查任务列表-获取核查任务列表-接口入参")
+public class CheckedRecordListVO extends Page implements Serializable {
+
+    /**
+     * 病历核查状态
+     */
+    @ApiModelProperty("病历核查状态,0-未核查,1-已核查")
+    private Integer status;
+
+    /**
+     * 任务类型
+     */
+    @ApiModelProperty("任务类型,0-科室任务 1-院级 2-质控科")
+    private List<String> checkJobTypes;
+
+    /**
+     * 科室
+     */
+    @ApiModelProperty("科室")
+    private String behDeptId;
+
+    /**
+     * 病人姓名
+     */
+    @ApiModelProperty("病人姓名")
+    private String name;
+
+    /**
+     * 病人住院序号
+     */
+    @ApiModelProperty("病人住院序号")
+    private String behospitalCode;
+
+    /**
+     * 医生姓名
+     */
+    @ApiModelProperty("医生姓名")
+    private String doctorName;
+
+    /**
+     * 分配日期起始日期
+     */
+    @ApiModelProperty("分配日期起始日期,格式为:2018-11-28")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date jobDistributionTimeStart;
+
+    /**
+     * 分配日期终止日期
+     */
+    @ApiModelProperty("分配日期终止日期,格式为:2018-11-28")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date jobDistributionTimeEnd;
+
+    /**
+     * 核查员
+     */
+    @ApiModelProperty("核查员")
+    private String checkName;
+
+    /**
+     * 病历等级
+     */
+    @ApiModelProperty("病历等级")
+    private String level;
+
+    /**
+     * 当前用户归属科室Id集合,多个科室用英文逗号隔开
+     */
+    @ApiModelProperty(hidden = true)
+    private String currentDeptIds;
+
+    /**
+     * 当前用户下级普通质控员Id集合
+     */
+    @ApiModelProperty(hidden = true)
+    private List<Long> currentGeneralUserIds;
+
+    /**
+     * 当前用户归属医院Id
+     */
+    @ApiModelProperty(hidden = true)
+    private long hospitalId;
+
+}

+ 36 - 0
src/main/java/com/diagbot/vo/DistributionJobVO.java

@@ -0,0 +1,36 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description: 分配核查任务入参对象
+ * @author: songxl
+ * @time: 2021/05/17
+ */
+@Data
+public class DistributionJobVO {
+    //病人住院序号集合
+    @ApiModelProperty("病人住院序号集合")
+    private List<String> behospitalCodes;
+    //医院id
+    @ApiModelProperty(hidden = true)
+    private String hospitalId;
+    //分配用户id
+    @ApiModelProperty(hidden = true)
+    private String jobDistributor;
+    //核查用户id
+    @ApiModelProperty("核查用户id")
+    private String checkId;
+    //核查用户姓名
+    @ApiModelProperty("核查用户姓名")
+    private String checkName;
+    //操作类型 分配或取消 0-分配,1-取消分配
+    @ApiModelProperty("操作类型 分配或取消 0-分配,1-取消分配")
+    private String distributionType;
+
+
+
+}

+ 34 - 0
src/main/java/com/diagbot/vo/MedCheckWorkAddVO.java

@@ -0,0 +1,34 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author songxl
+ * @Description:核查任务添加对象
+ * @author songxl
+ * @since 2021-05-11
+ */
+@Getter
+@Setter
+public class MedCheckWorkAddVO {
+    @ApiModelProperty(hidden = true)
+    private Long hospitalId;            //医院id
+    @ApiModelProperty("病历id集合")
+    private List<String> behospitalCodeList = new ArrayList<>(); // 病历id
+    @ApiModelProperty(hidden = true)
+    private String jobCreator;         // 创建用户编号
+    @ApiModelProperty("任务类型 0-科室任务 1-院级 1-质控科")
+    private Integer jobType;           // 任务类型 0-科室任务 1-院级 1-质控科
+    @ApiModelProperty("操作类型 0-取消,1-添加")
+    private Integer checkStatus;        // 操作类型 0-取消,1-添加
+    @ApiModelProperty("操作时间")
+    private String createTime;          // 操作时间
+    @ApiModelProperty("核查类型 0病历,1病案首页,2全部 默认")
+    private Integer checkType;          // 核查类型 0病历,1病案首页,2全部 默认
+}

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

@@ -1,5 +1,6 @@
 package com.diagbot.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -29,6 +30,9 @@ public class QcResultAlgVO {
     private String code;
     //质控返回info
     private String info;
+    //质控条目说明
+    @ApiModelProperty(hidden = true)
+    private String explainInfo;
     //单项否决(1-单项否决 0-非)
     private Integer isReject;
 }

+ 24 - 0
src/main/java/com/diagbot/vo/RecordCheckVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2021/5/18 20:15
+ */
+@Getter
+@Setter
+@ApiModel("核查任务列表-病历核查-接口入参")
+public class RecordCheckVO {
+
+    /**
+     * 病人住院序号
+     */
+    @ApiModelProperty("病人住院序号")
+    private String behospitalCode;
+
+}

+ 24 - 0
src/main/java/com/diagbot/vo/RecordTypeVO.java

@@ -0,0 +1,24 @@
+package com.diagbot.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2020/4/13 18:31
+ */
+@Data
+public class RecordTypeVO {
+
+    private String behospitalCode; // 病历id
+    private Long hospitalId; //医院ID
+    private Long start; //开始
+    private Long end; //结束
+    private List<String> modeList;//所属模块
+    private Long isPlacefile;//是否归档
+    private String startTime;//筛选开始时间
+    private String endTime;//结束时间
+
+}

+ 11 - 0
src/main/java/com/diagbot/web/BehospitalInfoController.java

@@ -148,6 +148,17 @@ public class BehospitalInfoController {
         return RespDTO.onSuc(qcresultInfoFacade.changeQcResult(qcresultVO));
     }
 
+    @ApiOperation(value = "逻辑删除质控条目[by:songxl]",
+            notes = "behospitalCode:病历号,必填<br>" +
+                    "id:明细id,必填<br>")
+    @PostMapping("/logicDelCase")
+    @SysLogger("logicDelCase")
+    @Transactional
+    public RespDTO<AnalyzeDTO> logicDelCase(@RequestBody QcresultVO qcresultVO) {
+        qcresultVO.setType(4);
+        return RespDTO.onSuc(qcresultInfoFacade.changeQcResult(qcresultVO));
+    }
+
     @ApiOperation(value = "修改质控条目[by:zhoutg]",
             notes = "")
     @PostMapping("/updCase")

+ 57 - 0
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -1,9 +1,15 @@
 package com.diagbot.web;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.CheckDeptDTO;
+import com.diagbot.dto.CheckJobDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.MedCheckInfoFacade;
+import com.diagbot.vo.CheckJobPageVO;
+import com.diagbot.vo.CheckJobVO;
+import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -12,6 +18,10 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -34,9 +44,56 @@ public class MedCheckInfoController {
             notes = "核查数据接口")
     @PostMapping("/addMedCheckInfo")
     @SysLogger("addMedCheckInfo")
+    @ApiIgnore
     public RespDTO<Boolean> addMedCheckInfo(@RequestBody MedCheckInfoAddVO medCheckInfoAddVO) {
         Boolean res = medCheckInfoFacade.addMedCheckInfos(medCheckInfoAddVO);
         return RespDTO.onSuc(res);
     }
 
+
+
+    @ApiOperation(value = "分配核查任务--获取核查人员列表[by:songxl]",
+            notes = "获取核查人员列表")
+    @PostMapping("/getCheckUserMap")
+    @SysLogger("getCheckUserMap")
+    public RespDTO<Map<String, List<CheckDeptDTO>>> getCheckUserMap() {
+        Map<String, List<CheckDeptDTO>> userInfoMap = medCheckInfoFacade.getCheckUserMap();
+        return RespDTO.onSuc(userInfoMap);
+    }
+
+
+    @ApiOperation(value = "分配核查任务--获取待分配核查任务列表[by:songxl]",
+            notes = "startTime:任务生成开始时间 必填<br>" +
+                    "endTime:  任务生成结束时间 必填<br>" +
+                    "或<br>" +
+                    "behosDateStart:  出院开始时间 必填<br>" +
+                    "behosDateEnd:  出院结束时间 必填<br>" +
+                    "jobType:核查任务类型 必填 0-科室任务 1-院级 2-质控科<br>" )
+    @PostMapping("/getCheckList")
+    @SysLogger("getCheckList")
+    public RespDTO<IPage<CheckJobDTO>> getCheckList(@RequestBody CheckJobPageVO checkJobPageVO) {
+        IPage<CheckJobDTO> userInfos = medCheckInfoFacade.getUserCheckList(checkJobPageVO);
+        return RespDTO.onSuc(userInfos);
+    }
+
+    @ApiOperation(value = "分配核查任务--分配/取消核查任务[by:songxl]",
+            notes = "behospitalCodes:病人住院序号集合 必填<br>" +
+                    "checkId:  核查用户id 必填<br>" +
+                    "checkName:  核查用户姓名 必填<br>" +
+                    "distributionType:操作类型 必填 分配或取消 0-分配,1-取消分配<br>")
+    @PostMapping("/updateDistributionCheck")
+    @SysLogger("updateDistributionCheck")
+    public RespDTO<Boolean> distributionJobs(@RequestBody DistributionJobVO distributionJobVO) {
+        return RespDTO.onSuc(medCheckInfoFacade.distributionJobs(distributionJobVO));
+    }
+
+
+    @ApiOperation(value = "分配核查任务--获取指定核查人员的核查任务[by:songxl]",
+            notes = "checkId:核查用户id")
+    @PostMapping("/getCheckListByUserId")
+    @SysLogger("getCheckListByUserId")
+    public RespDTO<List<CheckJobDTO>> getCheckListByUserId(@RequestBody CheckJobVO checkJobVO) {
+        List<CheckJobDTO> userInfos = medCheckInfoFacade.getCheckListByUserId(checkJobVO);
+        return RespDTO.onSuc(userInfos);
+    }
 }

+ 67 - 0
src/main/java/com/diagbot/web/MedCheckWorkController.java

@@ -0,0 +1,67 @@
+package com.diagbot.web;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.CheckWorkDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.MedCheckWorkFacade;
+import com.diagbot.vo.CheckWorkPageVO;
+import com.diagbot.vo.MedCheckWorkAddVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ *
+ * @author songxl
+ * @since 2021-05-11
+ */
+@RestController
+@RequestMapping("/qc/medCheckWork")
+@Api(value = "生成核查任务--相关接口API", tags = { "生成核查任务--相关接口API" })
+public class MedCheckWorkController {
+    @Autowired
+    MedCheckWorkFacade medCheckworkFacade;
+
+    @ApiOperation(value = "生成/取消核查任务[by:wangsy]",
+            notes = "生成/取消核查任务 <br>" +
+            "behospitalCodeList:病历id(List) 【必填】<br>" +
+            "jobType:核查任务类型(0-科室任务 1-院级 1-质控科) 【必填】<br>" +
+            "checkStatus:操作类型(0-取消,1-添加) 【必填】<br>" +
+            "createTime: 操作时间<br>" +
+            "checkType:核查类型(0病历,1病案首页,2全部 默认)<br>")
+    @PostMapping("/addCheckWork")
+    @SysLogger("addCheckWork")
+    public RespDTO<Boolean> addCheckTask(@RequestBody MedCheckWorkAddVO medCheckWorkVO) {
+        Boolean res = medCheckworkFacade.addCheckWork(medCheckWorkVO);
+        return RespDTO.onSuc(res);
+    }
+
+    @ApiOperation(value = "获取患者病历列表[by:wangsy]",
+            notes = "startDate:出院开始时间 【必填】<br>" +
+                    "endDate:出院结束时间 【必填】<br>" +
+                    "creatStatus:生成状态(0-未生成 1-已生成) 【必填】<br>" +
+                    "jobType:核查任务类型(0-科室任务 1-院级 1-质控科) <br>" +
+                    "hospitalId: 医院ID<br>" +
+                    "behospitalCode:病人住院序号<br>" +
+                    "departments:科室<br>" +
+                    "level:病历等级<br>" +
+                    "name:病人姓名<br>" +
+                    "doctorName:医生姓名<br>" +
+                    "diagnose:主诊断<br>" +
+                    "sDay:最小天数<br>" +
+                    "lDay:最大天数<br>" +
+                    "isPlacefile:是否归档<br>")
+    @PostMapping("/getUserList")
+    @SysLogger("getUserList")
+    public RespDTO<IPage<CheckWorkDTO>> checkWorkPage(@RequestBody CheckWorkPageVO checkWorkPageVO) {
+        IPage<CheckWorkDTO> data = medCheckworkFacade.pageFac(checkWorkPageVO);
+        return RespDTO.onSuc(data);
+    }
+}

+ 48 - 0
src/main/java/com/diagbot/web/RecordCheckController.java

@@ -0,0 +1,48 @@
+package com.diagbot.web;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.CheckedRecordListDTO;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.RecordCheckFacade;
+import com.diagbot.vo.CheckedRecordListVO;
+import com.diagbot.vo.RecordCheckVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author rengb
+ * @since 2021-05-11
+ */
+@RestController
+@RequestMapping("/qc/recCheck")
+@Api(value = "核查任务列表--相关接口API", tags = { "核查任务列表--相关接口API" })
+public class RecordCheckController {
+
+    @Autowired
+    RecordCheckFacade recordCheckFacade;
+
+    @ApiOperation(value = "获取核查任务列表[by:rengb]")
+    @PostMapping("/checkedRecordList")
+    @SysLogger("checkedRecordList")
+    public RespDTO<IPage<CheckedRecordListDTO>> checkedRecordList(@RequestBody CheckedRecordListVO checkedRecordListVO) {
+        IPage<CheckedRecordListDTO> data = recordCheckFacade.checkedRecordList(checkedRecordListVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "病历核查[by:rengb]")
+    @PostMapping("/recordCheck")
+    @SysLogger("recordCheck")
+    @Transactional
+    public RespDTO<Boolean> recordCheck(@RequestBody RecordCheckVO recordCheckVO) {
+        Boolean res = recordCheckFacade.recordCheck(recordCheckVO);
+        return RespDTO.onSuc(res);
+    }
+
+}

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

@@ -164,7 +164,7 @@ oath.self.address: http://${myhost}:${server.port}
 
 # 加解密开关
 encrypt:
-  enable: false
+  enable: true
 
 swagger:
   enable: true

+ 8 - 4
src/main/resources/application-test.yml

@@ -59,7 +59,8 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://192.168.2.241:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+#      url: jdbc:mysql://192.168.2.241:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.2.236:3306/stu?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息
@@ -109,9 +110,12 @@ spring:
   #redis
   redis:
     database:
-      cache: 8 # cache索引
-      token: 8 # Token索引
-    host: 192.168.2.241  #Redis服务器地址
+#      cache: 8 # cache索引
+#      token: 8 # Token索引
+#    host: 192.168.2.241  #Redis服务器地址
+      cache: 3 # cache索引
+      token: 3 # Token索引
+    host: 192.168.2.236  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
     password: lantone # Redis服务器连接密码(默认为空)
     lettuce:

+ 1 - 1
src/main/resources/mapper/BasDeptInfoMapper.xml

@@ -27,7 +27,7 @@
             `bas_dept_info` t
         WHERE
             t.is_deleted = 'N'
-        AND t.station = '住院'
+        AND t.station = '住院' or t.station = '质管'
         AND t.hospital_id = #{hospitalId}
         <if test="inputStr !=null and inputStr != ''">
             AND (UPPER(t.spell) LIKE CONCAT('%', UPPER(TRIM(#{inputStr})),'%') OR UPPER(t.dept_name) LIKE CONCAT('%', UPPER(TRIM(#{inputStr})),'%'))

+ 8 - 2
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -37,6 +37,7 @@
         <result column="gmt_modified" property="gmtModified"/>
         <result column="creator" property="creator"/>
         <result column="modifier" property="modifier"/>
+        <result column="linkman" property="linkman"/>
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
@@ -682,9 +683,11 @@
         SELECT b.`name` model_name,c.score,c.msg,c.cases_entry_id,c.is_reject,c.id id,c.info,
         a.cases_id cases_id, d.score cases_score,b.id model_id, a.name standard_msg,
         c.opt_type, c.grade_type, c.gmt_create, c.gmt_modified,
+        c.modifier,u.linkman,c.is_deleted,c.explain_info as explainInfo,
         a.type, a.drgs
-        FROM `qc_cases_entry` a, qc_mode b, med_qcresult_detail c, qc_cases_hospital d
-        where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N' and d.is_deleted = 'N'
+        FROM `qc_cases_entry` a, qc_mode b, med_qcresult_detail c, qc_cases_hospital d ,sys_user u
+        where a.is_deleted = 'N' and b.is_deleted = 'N' and  d.is_deleted = 'N'
+        and u.is_deleted = 'N' and u.id = c.modifier
         and a.id = c.cases_entry_id
         and a.mode_id = b.id
         AND c.cases_id = d.cases_id
@@ -694,6 +697,9 @@
         order by b.order_no, c.grade_type desc, a.order_no
     </select>
 
+
+
+
     <select id="getMsgByEntryCode" resultType="com.diagbot.dto.MsgDTO">
         SELECT b.id model_id,b.`name` model_name,
         d.score,d.msg,d.cases_entry_id,d.is_reject,

+ 16 - 0
src/main/resources/mapper/MedBehospitalTypeMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.MedBehospitalTypeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.MedBehospitalType">
+        <id column="id" property="id" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="behospital_code" property="behospitalCode" />
+        <result column="behospital_type" property="behospitalType" />
+        <result column="value" property="value" />
+        <result column="create_time" property="createTime" />
+        <result column="is_deleted" property="isDeleted" />
+    </resultMap>
+
+</mapper>

+ 337 - 0
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -17,6 +17,343 @@
         <result column="check_time" property="checkTime" />
         <result column="status" property="status" />
         <result column="check_type" property="checkType" />
+        <result column="job_creator" property="jobCreator" />
+        <result column="job_creator_name" property="jobCreatorName" />
+        <result column="job_create_time" property="jobCreateTime" />
+        <result column="job_type" property="jobType" />
+        <result column="job_distributor" property="jobDistributor" />
+        <result column="job_distribution_name" property="jobDistributionName" />
+        <result column="job_distribution_time" property="jobDistributionTime" />
     </resultMap>
+    <!--获取核查人员用户科室、姓名、角色-->
+    <select id="getCheckUser" resultType="com.diagbot.dto.CheckUserDTO">
+        SELECT DISTINCT
+        a.id doctorId,
+        a.linkman doctorName,
+        c.dept_id deptId,
+        d.dept_name deptName,
+        b.role_id  roleId
+        from
+        sys_user a,sys_user_role b,sys_user_dept c ,bas_dept_info d
+        where a.id = b.user_id and a.is_deleted = "N" and b.is_deleted = "N" and c.is_deleted = "N" and a.id = c.user_id
+        and d.dept_id = c.dept_id and c.hospital_id = d.hospital_id
+        and c.hospital_id = #{hospitalId}
+        <if test="roleIds !=null and roleIds.size()!=0 and roleId ==null and userId ==null">
+            and b.role_id in
+            <foreach collection="roleIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="roleIds !=null and roleIds.size()!=0 and roleId !=null and userId !=null">
+            and (b.role_id in
+            <foreach collection="roleIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+             or (b.role_id =#{roleId} and  a.id = #{userId}))
+        </if>
+        <if test="deptIds !=null and deptIds.size()!=0">
+            and c.dept_id in
+            <foreach collection="deptIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="deptStations !=null and deptStations.size()!=0">
+            and d.station in
+            <foreach collection="deptStations" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+    <!--通过核查人员id获取核查人员的核查任务数-->
+    <select id="getJobNumByUserId" resultType="com.diagbot.dto.DeptCheckUserDTO">
+        SELECT
+        check_id doctorId,
+        count(*) as jobNum
+        from
+        med_check_info
+        where is_deleted = 'N' and job_distribution_name is not null
+        <if test="jobType != null and jobType != ''">
+            and job_type = #{jobType}
+        </if>
+        <if test="userList !=null">
+            and check_id in
+            <foreach collection="userList" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY check_id
+    </select>
+
+    <!--获取待分配核查任务列表-->
+    <select id="getCheckList" resultType="com.diagbot.dto.CheckJobDTO">
+        SELECT
+        a.behospital_code behospitalCode,
+        a.beh_dept_name behospitalDept,
+        a.doctor_name attendingDoctor,
+        a.leave_hospital_date leaveHospitalDate,
+        a.`name`,
+        b.`value`,
+        a.id
+        from
+        (select
+            a.behospital_code,
+            a.`name`,
+            a.beh_dept_name,
+            a.doctor_name,
+            a.leave_hospital_date,
+            a.hospital_id,
+            a.beh_dept_id,
+            b.id
+            from
+            med_behospital_info a ,med_check_info b
+              where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
+                and b.is_deleted = 'N' and b.job_distribution_name is NULL  and b.`status` = 0
+                <if test="jobType !=null and jobType != ''">
+                    and b.job_type = #{jobType}
+                </if>
+                <if test="startTime != null and startTime != ''">
+                    <![CDATA[ AND b.job_create_time >= #{startTime}]]>
+                </if>
+                <if test="endTime != null and endTime != ''">
+                    <![CDATA[ AND b.job_create_time < #{endTime}]]>
+                </if>
+
+                <if test="behosDateStart != null and behosDateStart != ''">
+                    <![CDATA[ AND a.leave_hospital_date >= #{behosDateStart}]]>
+                </if>
+                <if test="behosDateEnd != null and behosDateEnd != ''">
+                    <![CDATA[ AND a.leave_hospital_date < #{behosDateEnd}]]>
+                 </if>
+                <if test="doctorName !=null and doctorName != ''">
+                    and a.doctor_name = #{doctorName}
+                </if>
+                <if test="behospitalCode !=null and behospitalCode != ''">
+                    and a.behospital_code = #{behospitalCode}
+                </if>
+                <if test="name !=null and name != ''">
+                    and a.`name` LIKE CONCAT('%',#{name},'%')
+                </if>
+                <if test="deptList !=null and deptList.size()!=0 and jobType ==0">
+                    and a.beh_dept_id in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+                <if test="deptList !=null and deptList.size()!=0 and jobType ==1">
+                    and a.beh_dept_id not in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+
+        ) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
+        and a.hospital_id = b.hospital_id and b.is_deleted = 'N' ORDER BY b.`value` DESC ,a.leave_hospital_date DESC
+    </select>
+
+
+    <!--获取指定核查人员的核查任务-->
+    <select id="getCheckListByUserId" resultType="com.diagbot.dto.CheckJobDTO">
+        SELECT
+        a.behospital_code behospitalCode,
+        a.beh_dept_name behospitalDept,
+        a.doctor_name attendingDoctor,
+        a.leave_hospital_date leaveHospitalDate,
+        a.`name`,b.`value`,
+        a.id
+        from
+        (select
+            a.behospital_code,
+            a.`name`,
+            a.beh_dept_name,
+            a.doctor_name,
+            a.leave_hospital_date,
+            a.hospital_id,
+            a.beh_dept_id,
+            b.id
+            from
+            med_behospital_info a ,med_check_info b
+            where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
+            and b.is_deleted = 'N' and b.`status` = 0
+            <if test="startTime != null and startTime != ''">
+                <![CDATA[ AND b.job_create_time >= #{startTime}]]>
+            </if>
+            <if test="endTime != null and endTime != ''">
+                <![CDATA[ AND b.job_create_time < #{endTime}]]>
+            </if>
+
+            <if test="behosDateStart != null and behosDateStart != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{behosDateStart}]]>
+            </if>
+            <if test="behosDateEnd != null and behosDateEnd != ''">
+                <![CDATA[ AND a.leave_hospital_date < #{behosDateEnd}]]>
+            </if>
+            <if test="checkId !=null and checkId != ''">
+                and b.check_id = #{checkId}
+            </if>
+        ) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
+        and a.hospital_id = b.hospital_id and b.is_deleted = 'N' ORDER BY b.`value` DESC ,a.leave_hospital_date DESC
+    </select>
+    <select id="getCheckWorkPage" resultType="com.diagbot.dto.CheckWorkDTO">
+        SELECT
+        mbi.behospital_code behospitalCode,
+        mbi.name,
+        mbi.file_code fileCode,
+        mbi.sex,
+        mhp.age,
+        mbi.beh_dept_name behospitalDept,
+        mbi.leave_hospital_date leaveHospitalDate,
+        mhp.behospital_day_num behospitalDayNum,
+        mbi.doctor_name attendingDoctor,
+        mqi.score_res scoreRes,
+        mqi.level,
+        mbi.diagnose,
+        CASE WHEN mbt.behospital_type='出院病人' THEN '6'
+        WHEN mbt.behospital_type='死亡病人' THEN '6'
+        WHEN mbt.behospital_type='危重病人' THEN '4'
+        WHEN mbt.behospital_type='抢救病人' THEN '5'
+        WHEN mbt.behospital_type='手术病人' THEN '2'
+        WHEN mbt.behospital_type='疑难病人' THEN '3'
+        WHEN mbt.behospital_type='输血病人' THEN '4' ELSE '0' END AS score,
+        CASE WHEN ISNULL(mci.job_create_time) THEN '未生成' ELSE '已生成' END AS creatStatus,
+        mci.job_create_time jobCreateTime,
+        mci.job_creator_name jobCreatorName,
+        mci.check_time checkTime,
+        mci.job_distribution_time jobDistributionTime
+        FROM
+        med_behospital_info mbi
+        LEFT JOIN med_home_page mhp
+        ON mbi.behospital_code=mhp.behospital_code
+        AND mbi.hospital_id = mhp.hospital_id
+        LEFT JOIN med_check_info mci
+        ON mbi.behospital_code = mci.behospital_code
+        AND mbi.hospital_id = mci.hospital_id AND mci.is_deleted = 'N'
+        LEFT JOIN med_qcresult_info mqi
+        ON mbi.behospital_code = mqi.behospital_code
+        AND mbi.hospital_id = mqi.hospital_id AND mqi.is_deleted = 'N'
+        LEFT JOIN med_behospital_type mbt ON mbi.behospital_code = mbt.behospital_code
+        AND mbi.hospital_id = mbt.hospital_id AND mbt.is_deleted = 'N'
+        WHERE mbi.is_deleted = 'N'
+        <if test="startDate != null">
+            <![CDATA[ AND mbi.behospital_date >= #{startDate}]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[ AND mbi.behospital_date < #{endDate}]]>
+        </if>
+        <if test="creatStatus != null and creatStatus == 1">
+            AND mci.job_create_time is not null and mci.check_type = 2
+        </if>
+        <if test="creatStatus != null and creatStatus == 0">
+            AND mci.job_create_time is null
+        </if>
+        <if test="name != null and name != ''">
+            AND mbi.name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND mbi.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="departments !=null and departments.size() !=0">
+            and mbi.beh_dept_id in
+            <foreach collection="departments" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="smallDay != null">
+            <![CDATA[ AND mhp.behospital_day_num >= #{smallDay}]]>
+        </if>
+        <if test="bigDay != null">
+            <![CDATA[ AND mhp.behospital_day_num < #{bigDay}]]>
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND mbi.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND mbi.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="level != null and level != ''">
+            AND mqi.level= #{level}
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            AND mbi.is_placefile = #{isPlacefile}
+        </if>
+    </select>
+
+    <!--通过住院号,取消核查任务-->
+    <update id="deleteBatchCodes">
+        <foreach collection="list" item="item"  separator=";">
+            delete from
+            med_check_info
+            where behospital_code = #{item} and is_deleted = 'N'
+        </foreach>
+    </update>
+
+    <select id="checkedRecordList" resultType="com.diagbot.dto.CheckedRecordListDTO">
+        SELECT *
+        from
+        (select
+        b.behospital_code as behospitalCode,
+        a.`status` as status,
+        b.beh_dept_id as behDeptId,
+        b.beh_dept_name as behDeptName,
+        b.`name` as name,
+        b.file_code as fileCode,
+        b.doctor_name as doctorName,
+        b.leave_hospital_date as leaveHospitalDate,
+        a.job_create_time as jobCreateTime,
+        a.job_distribution_time as jobDistributionTime,
+        a.check_id as checkId,
+        a.check_name as checkName,
+        a.check_time as checkTime,
+        c.`level` as level,
+        c.score_res as scoreRes,
+        case when a.check_type='0' and FIND_IN_SET(b.beh_dept_id,#{currentDeptIds}) then 0 else 1 end as isDel
+        from med_check_info a join med_behospital_info b on a.hospital_id=b.hospital_id and
+        a.behospital_code=b.behospital_code
+        join med_qcresult_info c on b.hospital_id=c.hospital_id and b.behospital_code=c.behospital_code and
+        b.is_deleted='N'
+        where a.hospital_id=#{hospitalId} and a.is_deleted='N'
+        and b.hospital_id=#{hospitalId} and b.is_deleted='N'
+        and c.hospital_id=#{hospitalId}
+        and a.check_id in
+        <foreach collection="currentGeneralUserIds" item="currentGeneralUserId" separator="," close=")" open="(">
+            #{currentGeneralUserId}
+        </foreach>
+        <if test="status!=null">
+            and a.`status`=#{status}
+        </if>
+        <if test="behDeptId!=null and behDeptId!=''">
+            and b.beh_dept_id=#{behDeptId}
+        </if>
+        <if test="name!=null and name!=''">
+            and b.`name` like concat('%',#{name},'%')
+        </if>
+        <if test="behospitalCode!=null and behospitalCode!=''">
+            and b.behospital_code like concat('%',#{behospitalCode},'%')
+        </if>
+        <if test="doctorName!=null and doctorName!=''">
+            and b.doctor_name like concat('%',#{doctorName},'%')
+        </if>
+        <if test="jobDistributionTimeStart!=null">
+            and a.job_distribution_time >= #{jobDistributionTimeStart}
+        </if>
+        <if test="jobDistributionTimeEnd!=null">
+            and #{jobDistributionTimeEnd} >= a.job_distribution_time
+        </if>
+        <if test="checkName!=null and checkName!=''">
+            and a.check_name like concat('%',#{checkName},'%')
+        </if>
+        <if test="level!=null and level!=''">
+            and c.`level`=#{level}
+        </if>
+        <if test="checkJobTypes!=null and checkJobTypes.size>0">
+            and a.job_type in
+            <foreach collection="checkJobTypes" item="checkJobType" separator="," close=")" open="(">
+                #{checkJobType}
+            </foreach>
+        </if>
+        ) tab
+        where isDel>0
+        order by jobDistributionTime desc
+    </select>
 
 </mapper>

+ 46 - 0
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -49,6 +49,52 @@
         and t3.xml_text != ''
     </select>
 
+    <select id="getRecordCount"  resultType="java.lang.Integer">
+        select count(*) as num from
+          (select  DISTINCT behospital_code,mode_id  from med_medical_record where behospital_code in
+                (select  behospital_code from med_behospital_info   where hospital_id = #{hospitalId}
+                <if test="isPlacefile !=null and isPlacefile !=''">
+                    and is_placefile  =#{isPlacefile}
+                </if>
+                <if test="startTime !=null and endTime !=null">
+                    and placefile_date BETWEEN #{startTime} AND #{endTime}
+                </if>
+                )
+                <if test="modeList != null and modeList.size() > 0">
+                    and mode_id in
+                    <foreach collection="modeList" open="(" separator="," close=")" item="item">
+                        '${item}'
+                    </foreach>
+                </if>
+                <if test="start != null and end !=null">
+                    limit #{start},#{end}
+                </if>
+        ) a
+    </select>
+
+
+
+    <select id="getMedicalRecord"  resultType="com.diagbot.dto.MedicalRecordDTO">
+        select  DISTINCT behospital_code,mode_id  from med_medical_record where behospital_code in
+          (select  behospital_code from med_behospital_info   where hospital_id = #{hospitalId}
+            <if test="isPlacefile !=null and isPlacefile !=''">
+                and is_placefile  =#{isPlacefile}
+            </if>
+            <if test="startTime !=null and endTime !=null">
+                and placefile_date BETWEEN #{startTime} AND #{endTime}
+            </if>
+            )
+        <if test="modeList != null and modeList.size() > 0">
+            and mode_id in
+            <foreach collection="modeList" open="(" separator="," close=")" item="item">
+                '${item}'
+            </foreach>
+        </if>
+        <if test="start != null and end !=null">
+            limit #{start},#{end}
+        </if>
+    </select>
+
     <update id="updateBatchByKey">
         <foreach collection="list" item="item"  separator=";">
             update med_medical_record

+ 1 - 0
src/main/resources/mapper/QcresultDetailMapper.xml

@@ -22,6 +22,7 @@
         <result column="creator" property="creator" />
         <result column="modifier" property="modifier" />
         <result column="remark" property="remark" />
+        <result column="explain_info" property="explainInfo" />
     </resultMap>
 
 </mapper>

+ 2 - 2
src/test/java/com/diagbot/CodeGeneration.java

@@ -27,7 +27,7 @@ public class CodeGeneration {
 
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
-        gc.setOutputDir("E://code//mrqcsys");
+        gc.setOutputDir("D://code");
         gc.setFileOverride(true);
         gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
         gc.setEnableCache(false);// XML 二级缓存
@@ -56,7 +56,7 @@ public class CodeGeneration {
         StrategyConfig strategy = new StrategyConfig();
 //        strategy.setTablePrefix(new String[] { "med_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "med_qcresult_info"}); // 需要生成的表
+        strategy.setInclude(new String[] { "med_check_info"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);