ソースを参照

核查列表接口

rengb 4 年 前
コミット
0d0ddd7062

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

@@ -242,6 +242,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/medCheckInfo/getCheckListByUserId").permitAll()
                 .antMatchers("/qc/medCheckWork//addCheckWork").permitAll()
                 .antMatchers("/qc/medCheckWork//getUserList").permitAll()
+                .antMatchers("/qc/recCheck/checkedRecordList").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -286,6 +286,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/medCheckInfo/getCheckListByUserId", request)
                 || matchers("/qc/medCheckWork/addCheckWork", request)
                 || matchers("/qc/medCheckWork/getUserList", request)
+                || matchers("/qc/recCheck/checkedRecordList", request)
                 || matchers("/", request)) {
             return true;
         }

+ 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;
+
+}

+ 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: TODO
+ * @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;
+    }
+}
+

+ 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;
+    }
+}
+

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

@@ -0,0 +1,99 @@
+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.MedQcresultDetail;
+import com.diagbot.entity.SysUserDept;
+import com.diagbot.entity.SysUserRole;
+import com.diagbot.enums.CheckJobTypeEnum;
+import com.diagbot.enums.CheckerRoleEnum;
+import com.diagbot.service.MedQcresultDetailService;
+import com.diagbot.util.ListUtil;
+import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.CheckedRecordListVO;
+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());
+    }
+
+}

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

@@ -3,12 +3,14 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.CheckJobDTO;
 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.CheckJobVO;
 import com.diagbot.vo.CheckUserVO;
 import com.diagbot.vo.CheckWorkPageVO;
+import com.diagbot.vo.CheckedRecordListVO;
 
 import java.util.List;
 
@@ -31,4 +33,7 @@ public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
     List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO);
     //取消核查任务
     int deleteBatchCodes(List<String> list);
+
+    IPage<CheckedRecordListDTO> checkedRecordList(CheckedRecordListVO checkedRecordListVO);
+
 }

+ 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;
+
+}

+ 2 - 2
src/main/java/com/diagbot/web/MedCheckInfoController.java

@@ -12,12 +12,12 @@ import com.diagbot.vo.DistributionJobVO;
 import com.diagbot.vo.MedCheckInfoAddVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import jdk.nashorn.internal.ir.annotations.Ignore;
 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;
+import springfox.documentation.annotations.ApiIgnore;
 
 import java.util.List;
 import java.util.Map;
@@ -43,7 +43,7 @@ public class MedCheckInfoController {
             notes = "核查数据接口")
     @PostMapping("/addMedCheckInfo")
     @SysLogger("addMedCheckInfo")
-    @Ignore
+    @ApiIgnore
     public RespDTO<Boolean> addMedCheckInfo(@RequestBody MedCheckInfoAddVO medCheckInfoAddVO) {
         Boolean res = medCheckInfoFacade.addMedCheckInfos(medCheckInfoAddVO);
         return RespDTO.onSuc(res);

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

@@ -0,0 +1,37 @@
+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 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 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);
+    }
+
+}

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

@@ -193,4 +193,73 @@
         </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>