Bläddra i källkod

新增医生质控平均分-患者列表(等级)列表页查询、导出功能

songxinlu 3 år sedan
förälder
incheckning
32ea7bcb21

+ 113 - 0
src/main/java/com/diagbot/dto/DoctorAverageLevelDTO.java

@@ -0,0 +1,113 @@
+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.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 医生质控平均分-患者列表(等级)-接口出参
+ * @Author songxl
+ * @Date 2022/4/11 9:20
+ */
+@ApiModel(value = "医生质控平均分-患者列表(等级)-接口出参")
+@Getter
+@Setter
+public class DoctorAverageLevelDTO implements Serializable {
+    private static final long serialVersionUID = 4875168077452918044L;
+
+    @ApiModelProperty(value = "科室")
+    private String behDeptName;
+
+    @ApiModelProperty(value = "主管医生")
+    private String doctorName;
+
+    @ApiModelProperty(value = "住院医生姓名")
+    private String behDoctorName;
+
+    @ApiModelProperty(value = "患者姓名")
+    private String name;
+
+    @ApiModelProperty(value = "档案号")
+    private String fileCode;
+
+    @ApiModelProperty(value = "年龄")
+    private String age = "";
+
+    @ApiModelProperty(value = "入院时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date behospitalDate;
+
+    @ApiModelProperty(value = "出院时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date leaveHospitalDate;
+
+    @ApiModelProperty(value = "最后得分")
+    private Double scoreRes;
+
+    @ApiModelProperty(value = "病历等级")
+    private String level;
+
+    @ApiModelProperty(value = "评分时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date gradeTime;
+
+    @ApiModelProperty(value = "病人住院ID")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "性别")
+    private String sex;
+
+    @ApiModelProperty(value = "出生日期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthday;
+
+    @ApiModelProperty(value = "病区名称")
+    private String wardName;
+
+    @ApiModelProperty(value = "床位号")
+    private String bedCode;
+
+    @ApiModelProperty(value = "疾病名称")
+    private String diagnose;
+
+
+    @ApiModelProperty(value = "病案首页得分")
+    private Double scoreBn;
+
+    @ApiModelProperty(value = "评分类型(1:机器,2:人工)")
+    private String gradeType;
+
+    @ApiModelProperty(value = "主任医生")
+    private String directorDoctorName;
+
+
+
+    @ApiModelProperty(value = "归档时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date placefileDate;
+
+    @ApiModelProperty(value = "病历核查状态")
+    private Integer checkStatus;
+
+    @ApiModelProperty(value = "病案首页核查状态")
+    private Integer mrStatus;
+
+    @ApiModelProperty(value = "病历核查人")
+    private String chName;
+
+    @ApiModelProperty(value = "病案首页核查人")
+    private String mrName;
+
+    @ApiModelProperty(value = "病历核查时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date chTime;
+
+    @ApiModelProperty(value = "病案首页核查时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date mrTime;
+}

+ 36 - 0
src/main/java/com/diagbot/dto/ExportBehospital_7DTO.java

@@ -0,0 +1,36 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/6/2 19:35
+ */
+@Getter
+@Setter
+public class ExportBehospital_7DTO {
+    @Excel(name = "主管医生", needMerge = true)
+    private String doctorName;
+    @Excel(name = "患者姓名", needMerge = true)
+    private String patName;
+    @Excel(name = "住院号", needMerge = true)
+    private String behospitalCode;
+    @Excel(name = "入院时间", needMerge = true, exportFormat = "yyyy/MM/dd")
+    private Date behospitalDate;
+    @Excel(name = "出院时间", needMerge = true, exportFormat = "yyyy/MM/dd")
+    private Date leaveHospitalDate;
+    @Excel(name = "分数", needMerge = true)
+    private Double score;
+    @Excel(name = "病案首页分数", needMerge = true)
+    private Double scoreBn;
+    @ExcelCollection(name = "")
+    private List<ExportCase_7DTO> exportExcelCaseDTOS;
+
+}

+ 31 - 0
src/main/java/com/diagbot/dto/ExportBehospital_90DTO.java

@@ -0,0 +1,31 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/6/2 19:35
+ */
+@Getter
+@Setter
+public class ExportBehospital_90DTO {
+    @Excel(name = "主管医生", needMerge = true)
+    private String doctorName;
+    @Excel(name = "患者姓名", needMerge = true)
+    private String patName;
+    @Excel(name = "住院号", needMerge = true)
+    private String behospitalCode;
+    @Excel(name = "入院时间", needMerge = true, exportFormat = "yyyy/MM/dd")
+    private Date behospitalDate;
+    @Excel(name = "出院时间", needMerge = true, exportFormat = "yyyy/MM/dd")
+    private Date leaveHospitalDate;
+    @Excel(name = "分数", needMerge = true)
+    private Double score;
+    @Excel(name = "病案首页分数", needMerge = true)
+    private Double scoreBn;
+}

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

@@ -0,0 +1,23 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/6/2 19:47
+ */
+@Getter
+@Setter
+public class ExportCase_7DTO {
+    @Excel(name = "模块名称", needMerge = true)
+    private String caseName;
+    @ExcelCollection(name = "")
+    private List<ExportMsg_7DTO> exportExcelMsgDTOS;
+
+}

+ 37 - 0
src/main/java/com/diagbot/dto/ExportDoctorAverageLevel_7DTO.java

@@ -0,0 +1,37 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 医生质控平均分-患者列表(等级)-接口出参
+ * @Author songxl
+ * @Date 2022/4/11 9:20
+ */
+@ApiModel(value = "医生质控平均分-患者列表(等级)-接口出参")
+@Getter
+@Setter
+public class ExportDoctorAverageLevel_7DTO implements Serializable {
+    private static final long serialVersionUID = 4875168077452918044L;
+
+    @ApiModelProperty(value = "科室")
+    @Excel(name = "科室", needMerge = true)
+    private String behDeptName;
+
+    @ApiModelProperty(value = "平均分数")
+    @Excel(name = "平均分数", needMerge = true)
+    private Double avgScore;
+
+    @ApiModelProperty(value = "患者信息集合")
+    @ExcelCollection(name = "")
+    private List<ExportBehospital_7DTO> excelBehospitalDTOS;
+}

+ 36 - 0
src/main/java/com/diagbot/dto/ExportDoctorAverageLevel_90DTO.java

@@ -0,0 +1,36 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: 医生质控平均分-患者列表(等级)-接口出参
+ * @Author songxl
+ * @Date 2022/4/11 9:20
+ */
+@ApiModel(value = "医生质控平均分-患者列表(等级)-接口出参")
+@Getter
+@Setter
+public class ExportDoctorAverageLevel_90DTO implements Serializable {
+    private static final long serialVersionUID = 4875168077452918044L;
+
+    @ApiModelProperty(value = "科室")
+    @Excel(name = "科室", needMerge = true)
+    private String behDeptName;
+
+    @Excel(name = "平均分数", needMerge = true)
+    private Double avgScore;
+
+    @ApiModelProperty(value = "科室")
+    @ExcelCollection(name = "" )
+    private List<ExportBehospital_90DTO> excelBehospitalDTOS;
+}

+ 17 - 0
src/main/java/com/diagbot/dto/ExportMsg_7DTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/6/2 19:47
+ */
+@Getter
+@Setter
+public class ExportMsg_7DTO {
+    @Excel(name = "存在问题", isWrap = false)
+    private String msg;
+}

+ 45 - 0
src/main/java/com/diagbot/facade/ConsoleByDoctorFacade.java

@@ -1,8 +1,13 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DoctorAverageLevelDTO;
 import com.diagbot.dto.DoctorAverageStatisticsDTO;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.DateUtil;
 import com.diagbot.util.SysUserUtils;
+import com.diagbot.vo.DoctorAverageLevelVO;
 import com.diagbot.vo.DoctorAverageStatisticsVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -27,4 +32,44 @@ public class ConsoleByDoctorFacade {
         doctorAverageStatisticsVO.setHospitalId(SysUserUtils.getCurrentHospitalID());
         return behospitalInfoFacade.getBaseMapper().doctorAverageStatistics(doctorAverageStatisticsVO);
     }
+
+    /**
+     * 医生质控平均分-患者列表(等级)
+     *
+     * @param doctorAverageLevelVO
+     * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.diagbot.dto.DoctorAverageLevelDTO>
+     */
+    public IPage<DoctorAverageLevelDTO> doctorAverageLevelPage(DoctorAverageLevelVO doctorAverageLevelVO) {
+        doctorAverageLevelPageSet(doctorAverageLevelVO);
+        return behospitalInfoFacade.getBaseMapper().doctorAverageLevelPage(doctorAverageLevelVO);
+    }
+
+    private void doctorAverageLevelPageSet(DoctorAverageLevelVO doctorAverageLevelVO) {
+        //入参验证
+        //入院时间
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getBehosDateStart()) {
+            doctorAverageLevelVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(doctorAverageLevelVO.getBehosDateStart()));
+        }
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getBehosDateEnd()) {
+            doctorAverageLevelVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(doctorAverageLevelVO.getBehosDateEnd(), 1)));
+        }
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getBehosDateStart() && null != doctorAverageLevelVO.getBehosDateEnd()) {
+            if (DateUtil.after(doctorAverageLevelVO.getBehosDateStart(), doctorAverageLevelVO.getBehosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "入院时间的开始时间必须小于结束时间!");
+            }
+        }
+        //出院时间
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getLeaveHosDateStart()) {
+            doctorAverageLevelVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(doctorAverageLevelVO.getLeaveHosDateStart()));
+        }
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getLeaveHosDateEnd()) {
+            doctorAverageLevelVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(doctorAverageLevelVO.getLeaveHosDateEnd(), 1)));
+        }
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getLeaveHosDateStart() && null != doctorAverageLevelVO.getLeaveHosDateEnd()) {
+            if (DateUtil.after(doctorAverageLevelVO.getLeaveHosDateStart(), doctorAverageLevelVO.getLeaveHosDateEnd())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "出院时间的开始时间必须小于结束时间!");
+            }
+        }
+        doctorAverageLevelVO.setHospitalId(Long.parseLong(SysUserUtils.getCurrentHospitalID()));
+    }
 }

+ 109 - 1
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -784,11 +784,119 @@ public class ConsoleExportFacade {
      */
     public void doctorAverageStatisticsExport(HttpServletResponse response, DoctorAverageStatisticsVO doctorAverageStatisticsVO) {
         //1.查询
+        doctorAverageStatisticsVO.setSize(9999999);
         IPage<DoctorAverageStatisticsDTO> page = consoleByDoctorFacade.doctorAverageStatistics(doctorAverageStatisticsVO);
         //2.列表拷贝
         List<ExportDoctorAverageStatisticsDTO> records = BeanUtil.listCopyTo(page.getRecords(), ExportDoctorAverageStatisticsDTO.class);
         //3.导出
         String fileName = "医生质控平均分.xls";
-        ExcelUtils.exportExcel(records, null, "sheet1", ReBeHosDTO.class, fileName, response);
+        ExcelUtils.exportExcel(records, null, "sheet1", ExportDoctorAverageStatisticsDTO.class, fileName, response);
+    }
+
+    /**
+     *  医生质控平均分-患者列表(等级)-导出
+     *
+     * @param response
+     * @param exportDoctorAverageLevelVO
+     * @Return void
+     */
+    public void doctorAverageLevelExport(HttpServletResponse response, ExportDoctorAverageLevelVO exportDoctorAverageLevelVO) {
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        exportDoctorAverageLevelVO.setHospitalId(Long.parseLong(hospitalId));
+        //时间设置
+        exportQcresultVOSet(exportDoctorAverageLevelVO);
+        List<ExportDoctorAverageLevel_7DTO> res = behospitalInfoFacade.getBaseMapper().doctorAverageLevelExport(exportDoctorAverageLevelVO);
+        List<ExportDoctorAverageLevel_90DTO> resWide = new ArrayList<>();
+        if ("2".equals(exportDoctorAverageLevelVO.getRadioCheck())) {
+            resWide = doctorAveragetransList(res, resWide);
+        }
+        String fileName = "抽查住院病历质量情况.xls";
+        response.setContentType("text/html;charset=UTF-8");
+        if ("1".equals(exportDoctorAverageLevelVO.getRadioCheck())) {
+            ExcelUtils.exportExcelUser(res, null, "sheet1", ExportDoctorAverageLevel_7DTO.class, fileName, response);
+        }
+        if ("2".equals(exportDoctorAverageLevelVO.getRadioCheck())) {
+            ExcelUtils.exportExcelUser(resWide, null, "sheet1", ExportDoctorAverageLevel_90DTO.class, fileName, response);
+        }
+    }
+
+    public List<ExportDoctorAverageLevel_90DTO> doctorAveragetransList(List<ExportDoctorAverageLevel_7DTO> res, List<ExportDoctorAverageLevel_90DTO> resWide) {
+        if (ListUtil.isNotEmpty(res)) {
+            res.forEach(exportExcelDTO -> {
+                ExportDoctorAverageLevel_90DTO exportWideExcelDTO = new ExportDoctorAverageLevel_90DTO();
+                exportWideExcelDTO.setAvgScore(exportExcelDTO.getAvgScore());
+                exportWideExcelDTO.setBehDeptName(exportExcelDTO.getBehDeptName());
+                List<ExportBehospital_7DTO> excelBehospitalDTOS = exportExcelDTO.getExcelBehospitalDTOS();
+                List<ExportBehospital_90DTO> exportExcelWideBehospitalDTOs = new ArrayList<>();
+                excelBehospitalDTOS.forEach(exportExcelBehospitalDTO -> {
+                    ExportBehospital_90DTO exportBehospital_90DTO = new ExportBehospital_90DTO();
+                    exportBehospital_90DTO.setDoctorName(exportExcelBehospitalDTO.getDoctorName());
+                    exportBehospital_90DTO.setBehospitalCode(exportExcelBehospitalDTO.getBehospitalCode());
+                    exportBehospital_90DTO.setBehospitalDate(exportExcelBehospitalDTO.getBehospitalDate());
+                    exportBehospital_90DTO.setLeaveHospitalDate(exportExcelBehospitalDTO.getLeaveHospitalDate());
+                    exportBehospital_90DTO.setPatName(exportExcelBehospitalDTO.getPatName());
+                    exportBehospital_90DTO.setScore(exportExcelBehospitalDTO.getScore());
+                    exportBehospital_90DTO.setScoreBn(exportExcelBehospitalDTO.getScoreBn());
+                    exportExcelWideBehospitalDTOs.add(exportBehospital_90DTO);
+                });
+                exportWideExcelDTO.setExcelBehospitalDTOS(exportExcelWideBehospitalDTOs);
+                resWide.add(exportWideExcelDTO);
+            });
+        }
+        return resWide;
+    }
+
+    private void exportQcresultVOSet(ExportDoctorAverageLevelVO doctorAverageLevelVO) {
+        //入参验证
+        long interval_7 = 7 * 24 * 60 * 60 * 1000;
+        long interval_90 = 90 * 24 * 60 * 60 * 1000l;
+        //入院时间
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getBehosDateStart() && null != doctorAverageLevelVO.getBehosDateEnd()) {
+            Date startDate = doctorAverageLevelVO.getBehosDateStart();
+            Date endDate = doctorAverageLevelVO.getBehosDateEnd();
+            if ("1".equals(doctorAverageLevelVO.getRadioCheck())) {
+                //时间间隔7天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_7) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+                }
+            } else {
+                //时间间隔90天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_90) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+                }
+            }
+            doctorAverageLevelVO.setBehosDateStart(DateUtil.getFirstTimeOfDay(doctorAverageLevelVO.getBehosDateStart()));
+            doctorAverageLevelVO.setBehosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(doctorAverageLevelVO.getBehosDateEnd(), 1)));
+        }
+        //出院时间
+        if (null != doctorAverageLevelVO && null != doctorAverageLevelVO.getLeaveHosDateStart() && null != doctorAverageLevelVO.getLeaveHosDateEnd()) {
+            Date startDate = doctorAverageLevelVO.getLeaveHosDateStart();
+            Date endDate = doctorAverageLevelVO.getLeaveHosDateEnd();
+            if ("1".equals(doctorAverageLevelVO.getRadioCheck())) {
+                //时间间隔7天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_7) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于7天");
+                }
+            } else {
+                //时间间隔90天
+                if (endDate.getTime() < startDate.getTime()) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
+                }
+                if (endDate.getTime() - startDate.getTime() > interval_90) {
+                    throw new CommonException(CommonErrorCode.PARAM_ERROR, "统计区间不能大于90天");
+                }
+            }
+            doctorAverageLevelVO.setLeaveHosDateStart(DateUtil.getFirstTimeOfDay(doctorAverageLevelVO.getLeaveHosDateStart()));
+            doctorAverageLevelVO.setLeaveHosDateEnd(DateUtil.getFirstTimeOfDay(DateUtil.addDay(doctorAverageLevelVO.getLeaveHosDateEnd(), 1)));
+        }
     }
 }

+ 17 - 1
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -788,10 +788,26 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
     List<BehospitalInfoAgeDTO> getBehospitalInfoAge(Long hospitalId, List<String> behospitalCodes);
 
     /**
-     *
+     *  医生质控平均分页面统计
      *
      * @param doctorAverageStatisticsVO
      * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.diagbot.dto.DoctorAverageStatisticsDTO>
      */
     IPage<DoctorAverageStatisticsDTO> doctorAverageStatistics(@Param("doctorAverageStatisticsVO") DoctorAverageStatisticsVO doctorAverageStatisticsVO);
+
+    /**
+     *  医生质控平均分-患者列表(等级)
+     *
+     * @param doctorAverageLevelVO
+     * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.diagbot.dto.DoctorAverageLevelDTO>
+     */
+    IPage<DoctorAverageLevelDTO> doctorAverageLevelPage(DoctorAverageLevelVO doctorAverageLevelVO);
+
+    /**
+     * 医生质控平均分-患者列表(等级)-导出
+     *
+     * @param doctorAverageLevelVO
+     * @Return java.util.List<com.diagbot.dto.ExportDoctorAverageLevel_7DTO>
+     */
+    List<ExportDoctorAverageLevel_7DTO> doctorAverageLevelExport(ExportDoctorAverageLevelVO doctorAverageLevelVO);
 }

+ 101 - 0
src/main/java/com/diagbot/vo/DoctorAverageLevelVO.java

@@ -0,0 +1,101 @@
+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 javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 医生质控平均分-患者列表(等级)-接口入参
+ * @Author songxl
+ * @Date 2022/4/11 9:20
+ */
+@ApiModel(value = "医生质控平均分-患者列表(等级)-接口入参")
+@Getter
+@Setter
+public class DoctorAverageLevelVO extends Page implements Serializable {
+    private static final long serialVersionUID = -5082186371197612798L;
+
+    @ApiModelProperty(value = "是否归档(0:未归档,1:已归档)", required = true)
+    @NotBlank(message = "是否归档为空")
+    private String isPlacefile = "1";
+
+    @ApiModelProperty(value = "医院ID",hidden = true)
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "医生姓名")
+    private String doctorName;
+
+    @ApiModelProperty(value = "医生工号")
+    private String doctorCode;
+
+    @ApiModelProperty(value = "病历等级")
+    private String level;
+
+    @ApiModelProperty(value = "病人住院ID")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "档案号")
+    private String fileCode;
+
+    @ApiModelProperty(value = "入院时间开始时间")
+    private Date behosDateStart;
+
+    @ApiModelProperty(value = "入院时间结束时间")
+    private Date behosDateEnd;
+
+    @ApiModelProperty(value = "出院时间开始时间")
+    private Date leaveHosDateStart;
+
+    @ApiModelProperty(value = "出院时间结束时间")
+    private Date leaveHosDateEnd;
+
+
+    @ApiModelProperty(value = "住院科室名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "主诊断")
+    private String diagnose;
+
+    @ApiModelProperty(hidden = true)
+    private Long userId;
+
+    private Long deptId;
+    @ApiModelProperty(value = "统计维度 1-本月,2-本年")
+    private Integer statisticsType;
+
+    @ApiModelProperty(value = "病历核查状态")
+    private Integer checkStatus;
+
+    @ApiModelProperty(value = "病案首页核查状态")
+    private Integer mrStatus;
+
+    @ApiModelProperty(value = "病历核查人")
+    private String chName;
+
+    @ApiModelProperty(value = "病案首页核查人")
+    private String mrName;
+
+    @ApiModelProperty(value = "病历核查开始时间")
+    private Date chTimeStart;
+
+    @ApiModelProperty(value = "病历核查结束时间")
+    private Date chTimeEnd;
+
+    @ApiModelProperty(value = "病案首页核查开始时间")
+    private Date mrTimeStart;
+
+    @ApiModelProperty(value = "病案首页核查结束时间")
+    private Date mrTimeEnd;
+
+    @ApiModelProperty("页面类型 1:评分详情页|2:核查详情页|3:申诉详情页")
+    private String pageType = "1";
+}

+ 4 - 6
src/main/java/com/diagbot/vo/DoctorAverageStatisticsVO.java

@@ -32,18 +32,16 @@ public class DoctorAverageStatisticsVO extends Page implements Serializable {
     @NotBlank(message = "请输入结束时间")
     private String endDate;
 
-    @ApiModelProperty(value = "科室名称", required = true)
-    @NotBlank(message = "科室名称为空")
+    @ApiModelProperty(value = "科室名称 '-'时:传值-0 ")
     private String deptName;
 
-    @ApiModelProperty(value = "科室id", required = true)
-    @NotBlank(message = "科室id为空")
+    @ApiModelProperty(value = "科室id '-'时:传值-0 ")
     private String deptId;
 
-    @ApiModelProperty(value = "医生名称")
+    @ApiModelProperty(value = "医生名称 '-'时:传值-0 ")
     private String doctorName;
 
-    @ApiModelProperty(value = "医生工号")
+    @ApiModelProperty(value = "医生工号 '-'时:传值-0 ")
     private String doctorId;
 
     @ApiModelProperty(value = "医院id", hidden = true)

+ 104 - 0
src/main/java/com/diagbot/vo/ExportDoctorAverageLevelVO.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 javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: 医生质控平均分-患者列表(等级)-导出-接口入参
+ * @Author songxl
+ * @Date 2022/4/11 9:20
+ */
+@ApiModel(value = "医生质控平均分-患者列表(等级)-导出-接口入参")
+@Getter
+@Setter
+public class ExportDoctorAverageLevelVO implements Serializable {
+    private static final long serialVersionUID = -8083335651050625426L;
+
+    @ApiModelProperty(value = "是否归档(0:未归档,1:已归档)", required = true)
+    @NotBlank(message = "是否归档为空")
+    private String isPlacefile = "1";
+
+    @ApiModelProperty(value = "(1-导出7天[含缺陷明细项]  2-导出90天[不含缺陷明细项] )")
+    private String radioCheck = "1";
+
+    @ApiModelProperty(value = "医院ID",hidden = true)
+    private Long hospitalId;
+
+    @ApiModelProperty(value = "医生姓名")
+    private String doctorName;
+
+    @ApiModelProperty(value = "医生工号")
+    private String doctorCode;
+
+    @ApiModelProperty(value = "病历等级")
+    private String level;
+
+    @ApiModelProperty(value = "病人住院ID")
+    private String behospitalCode;
+
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "档案号")
+    private String fileCode;
+
+    @ApiModelProperty(value = "入院时间开始时间")
+    private Date behosDateStart;
+
+    @ApiModelProperty(value = "入院时间结束时间")
+    private Date behosDateEnd;
+
+    @ApiModelProperty(value = "出院时间开始时间")
+    private Date leaveHosDateStart;
+
+    @ApiModelProperty(value = "出院时间结束时间")
+    private Date leaveHosDateEnd;
+
+
+    @ApiModelProperty(value = "住院科室名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "主诊断")
+    private String diagnose;
+
+    @ApiModelProperty(hidden = true)
+    private Long userId;
+
+    private Long deptId;
+    @ApiModelProperty(value = "统计维度 1-本月,2-本年")
+    private Integer statisticsType;
+
+    @ApiModelProperty(value = "病历核查状态")
+    private Integer checkStatus;
+
+    @ApiModelProperty(value = "病案首页核查状态")
+    private Integer mrStatus;
+
+    @ApiModelProperty(value = "病历核查人")
+    private String chName;
+
+    @ApiModelProperty(value = "病案首页核查人")
+    private String mrName;
+
+    @ApiModelProperty(value = "病历核查开始时间")
+    private Date chTimeStart;
+
+    @ApiModelProperty(value = "病历核查结束时间")
+    private Date chTimeEnd;
+
+    @ApiModelProperty(value = "病案首页核查开始时间")
+    private Date mrTimeStart;
+
+    @ApiModelProperty(value = "病案首页核查结束时间")
+    private Date mrTimeEnd;
+
+    @ApiModelProperty("页面类型 1:评分详情页|2:核查详情页|3:申诉详情页")
+    private String pageType = "1";
+}

+ 28 - 3
src/main/java/com/diagbot/web/ConsoleByDoctorController.java

@@ -3,14 +3,14 @@ package com.diagbot.web;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.DoctorAverageLevelDTO;
 import com.diagbot.dto.DoctorAverageStatisticsDTO;
-import com.diagbot.dto.LevelStatisticsDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConsoleByDoctorFacade;
 import com.diagbot.facade.ConsoleExportFacade;
+import com.diagbot.vo.DoctorAverageLevelVO;
 import com.diagbot.vo.DoctorAverageStatisticsVO;
-import com.diagbot.vo.FilterOrderVO;
-import com.diagbot.vo.FilterOrderXYPageVO;
+import com.diagbot.vo.ExportDoctorAverageLevelVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -63,4 +63,29 @@ public class ConsoleByDoctorController {
     public void doctorAverageStatisticsExport(HttpServletResponse response, @RequestBody @Valid DoctorAverageStatisticsVO doctorAverageStatisticsVO) {
         consoleExportFacade.doctorAverageStatisticsExport(response, doctorAverageStatisticsVO);
     }
+    /**
+     * 医生质控平均分-患者列表(等级)
+     *
+     * @param doctorAverageLevelVO
+     * @return
+     */
+    @ApiOperation(value = "医生质控平均分-患者列表(等级)[by:songxl]",
+            notes = "医生质控平均分-患者列表(等级)")
+    @PostMapping("/doctorAverageLevelPage")
+    @SysLogger("doctorAverageLevelPage")
+    public RespDTO<IPage<DoctorAverageLevelDTO>> doctorAverageLevelPage(@RequestBody @Valid DoctorAverageLevelVO doctorAverageLevelVO) {
+        return RespDTO.onSuc(consoleByDoctorFacade.doctorAverageLevelPage(doctorAverageLevelVO));
+    }
+
+    /**
+     * 医生质控平均分-患者列表(等级)-导出
+     *
+     * @param exportDoctorAverageLevelVO
+     * @return
+     */
+    @PostMapping("/doctorAverageLevelExport")
+    @SysLogger("doctorAverageLevelExport")
+    public void doctorAverageLevelExport(HttpServletResponse response, @RequestBody @Valid ExportDoctorAverageLevelVO exportDoctorAverageLevelVO) {
+        consoleExportFacade.doctorAverageLevelExport(response, exportDoctorAverageLevelVO);
+    }
 }

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -2,7 +2,7 @@ spring:
   application:
     name: mrqc-sys
   profiles:
-    active: test
+    active: pre
   main:
     allow-bean-definition-overriding: true
 

+ 365 - 16
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -4550,6 +4550,29 @@
     </resultMap>
 
 
+    <resultMap id="ExportDoctorAverage_7" type="com.diagbot.dto.ExportDoctorAverageLevel_7DTO">
+        <result column="behDeptName" property="behDeptName"/>
+        <result column="avgScore" property="avgScore"/>
+        <collection property="excelBehospitalDTOS"
+                    ofType="com.diagbot.dto.ExportBehospital_7DTO">
+            <result column="doctorName" property="doctorName"/>
+            <result column="patName" property="patName"/>
+            <result column="behospitalCode" property="behospitalCode"/>
+            <result column="behospitalDate" property="behospitalDate"/>
+            <result column="leaveHospitalDate" property="leaveHospitalDate"/>
+            <result column="score" property="score"/>
+            <result column="scoreBn" property="scoreBn"/>
+            <collection property="exportExcelCaseDTOS" ofType="com.diagbot.dto.ExportCase_7DTO">
+                <result column="caseName" property="caseName"/>
+                <collection property="exportExcelMsgDTOS"
+                            ofType="com.diagbot.dto.ExportMsg_7DTO">
+                    <result column="msg" property="msg"/>
+                </collection>
+            </collection>
+        </collection>
+    </resultMap>
+
+
     <select id="exportExcel" resultMap="ExportExcelMap">
         SELECT DISTINCT
         t1.beh_dept_name AS behDeptName,
@@ -19790,28 +19813,28 @@
         <if test="doctorAverageStatisticsVO.hospitalId != null and doctorAverageStatisticsVO.hospitalId != ''">
             AND a.hospital_id = #{doctorAverageStatisticsVO.hospitalId}
         </if>
-        <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != ''">
+        <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != '' and doctorAverageStatisticsVO.deptId != '-0'">
             AND a.beh_dept_id = #{doctorAverageStatisticsVO.deptId}
         </if>
-        <if test="doctorAverageStatisticsVO.deptId == '-'">
+        <if test="doctorAverageStatisticsVO.deptId == '-0'">
             AND (a.beh_dept_id IS NULL OR a.beh_dept_id = '' OR a.beh_dept_id = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != ''">
+        <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != '' and doctorAverageStatisticsVO.deptName != '-0'">
             AND a.beh_dept_name = #{doctorAverageStatisticsVO.deptName}
         </if>
-        <if test="doctorAverageStatisticsVO.deptName == '-'">
+        <if test="doctorAverageStatisticsVO.deptName == '-0'">
             AND (a.beh_dept_name IS NULL OR a.beh_dept_name = '' OR a.beh_dept_name = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != ''">
+        <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != '' and doctorAverageStatisticsVO.doctorId != '-0'">
             AND a.doctor_id LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorId},'%')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorId == '-'">
+        <if test="doctorAverageStatisticsVO.doctorId == '-0'">
             AND (a.doctor_id IS NULL OR a.doctor_id = '' OR a.doctor_id = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != ''">
+        <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != '' and doctorAverageStatisticsVO.doctorName != '-0'">
             AND a.doctor_name LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorName},'%')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorName == '-'">
+        <if test="doctorAverageStatisticsVO.doctorName == '-0'">
             AND (a.doctor_name IS NULL OR a.doctor_name = '' OR a.doctor_name = '-')
         </if>
         <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 0">
@@ -19866,28 +19889,28 @@
         <if test="doctorAverageStatisticsVO.hospitalId != null and doctorAverageStatisticsVO.hospitalId != ''">
             AND a.hospital_id = #{doctorAverageStatisticsVO.hospitalId}
         </if>
-        <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != ''">
+        <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != '' and doctorAverageStatisticsVO.deptId != '-0'">
             AND a.beh_dept_id = #{doctorAverageStatisticsVO.deptId}
         </if>
-        <if test="doctorAverageStatisticsVO.deptId == '-'">
+        <if test="doctorAverageStatisticsVO.deptId == '-0'">
             AND (a.beh_dept_id IS NULL OR a.beh_dept_id = '' OR a.beh_dept_id = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != ''">
+        <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != '' and doctorAverageStatisticsVO.deptName != '-0'">
             AND a.beh_dept_name = #{doctorAverageStatisticsVO.deptName}
         </if>
-        <if test="doctorAverageStatisticsVO.deptName == '-'">
+        <if test="doctorAverageStatisticsVO.deptName == '-0'">
             AND (a.beh_dept_name IS NULL OR a.beh_dept_name = '' OR a.beh_dept_name = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != ''">
+        <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != '' and doctorAverageStatisticsVO.doctorId != '-0'">
             AND a.doctor_id LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorId},'%')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorId == '-'">
+        <if test="doctorAverageStatisticsVO.doctorId == '-0'">
             AND (a.doctor_id IS NULL OR a.doctor_id = '' OR a.doctor_id = '-')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != ''">
+        <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != '' and doctorAverageStatisticsVO.doctorName != '-0'">
             AND a.doctor_name LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorName},'%')
         </if>
-        <if test="doctorAverageStatisticsVO.doctorName == '-'">
+        <if test="doctorAverageStatisticsVO.doctorName == '-0'">
             AND (a.doctor_name IS NULL OR a.doctor_name = '' OR a.doctor_name = '-')
         </if>
         <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 0">
@@ -19917,4 +19940,330 @@
         AND t1.deptId = t2.deptId
         AND t1.deptName = t2.deptName
     </select>
+<!--    医生质控平均分-患者列表(等级)-->
+    <select id="doctorAverageLevelPage" resultType="com.diagbot.dto.DoctorAverageLevelDTO">
+        SELECT * FROM (
+        select   t.*,
+        CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
+        from (
+        select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
+        grade_time,IF(c.age is null, null,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') ))as age,e.score_res as score_bn from med_behospital_info a
+        LEFT JOIN med_qcresult_info b
+        on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
+        left join med_home_page c
+        on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
+        LEFT JOIN med_qcresult_cases e
+        on  a.behospital_code = e.behospital_code
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        ) t
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type in(0,2) ) g
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
+        where t.is_deleted = 'N'
+        <if test="diagnose != null and diagnose != ''">
+            AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and t.beh_dept_name= #{deptName}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            and CONCAT(
+            IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
+            like CONCAT('%',#{doctorName},'%')
+        </if>
+        <if test="name != null and name != ''">
+            and t.name like CONCAT('%',#{name},'%')
+        </if>
+        <if test="doctorCode != null and doctorCode != ''">
+            and (t.doctor_id = #{doctorCode}
+            or t.beh_doctor_id = #{doctorCode}
+            or t.director_doctor_id = #{doctorCode})
+        </if>
+        <if test="fileCode != null and fileCode != ''">
+            and t.file_code like CONCAT('%',#{fileCode},'%')
+        </if>
+        <if test="hospitalId != null">
+            and t.hospital_id = #{hospitalId}
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
+        </if>
+        <if test="leaveHosDateStart != null">
+            <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
+        </if>
+        <if test="leaveHosDateEnd != null">
+            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
+        </if>
+        <if test="level != null and level != ''">
+            and t.level = #{level}
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and t.is_placefile = #{isPlacefile}
+        </if>
+        and t.qc_type_id != 0) p
+        where p.is_deleted="N"
+        <if test="checkStatus != null ">
+            and p.check_status = #{checkStatus}
+        </if>
+        <if test="mrStatus != null ">
+            AND p.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND p.ch_name like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND p.mr_name like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
+        </if>
+    </select>
+    <!--    医生质控平均分-患者列表(等级)-导出-->
+    <select id="doctorAverageLevelExport" resultMap="ExportDoctorAverage_7">
+        SELECT * FROM (
+        SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
+        CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
+        g.check_type AS ch_type,
+        h.check_type AS mr_type,
+        g.check_name AS ch_name,
+        h.check_name AS mr_name,
+        g.check_time AS ch_time,
+        h.check_time AS mr_time
+        FROM (
+        SELECT
+        t1.behDeptId,
+        t1.behDeptName,
+        t1.doctorName,
+        t1.patName,
+        t1.behospitalCode,
+        t1.hospitalId,
+        t1.behospitalDate,
+        t1.leaveHospitalDate,
+        t1.score,
+        <if test="radioCheck !=null and radioCheck == 1">
+            t1.msg,
+            t1.caseName,
+        </if>
+        t1.scoreBn,
+        t2.avgScore
+        FROM
+        (
+        SELECT
+        a.doctor_name AS doctorName,
+        a.`name` AS patName,
+        a.behospital_code AS behospitalCode,
+        a.behospital_date AS behospitalDate,
+        a.leave_hospital_date AS leaveHospitalDate,
+        b.score_res AS score,
+        e.score_res as scoreBn,
+        <if test="radioCheck !=null and radioCheck == 1">
+            c.msg AS msg,
+            d.NAME AS caseName,
+        </if>
+        a.beh_dept_id AS behDeptId,
+        a.beh_dept_name AS behDeptName,
+        a.hospital_id AS hospitalId
+        FROM
+        med_behospital_info a
+        RIGHT JOIN
+        med_qcresult_info b
+        ON a.hospital_id = b.hospital_id
+        AND a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.behospital_code = b.behospital_code
+        <if test="radioCheck !=null and radioCheck == 1">
+            LEFT JOIN
+            med_qcresult_detail c
+            ON c.is_deleted = 'N'
+            AND b.behospital_code = c.behospital_code
+            AND b.hospital_id = c.hospital_id
+            LEFT JOIN
+            qc_cases d
+            on d.is_deleted = 'N'
+            AND c.cases_id = d.id
+        </if>
+        LEFT JOIN med_qcresult_cases e
+        on  b.behospital_code = e.behospital_code
+        and b.hospital_id = e.hospital_id
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        WHERE
+        1=1
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
+        <if test="leaveHosDateStart != null ">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
+        </if>
+        <if test="leaveHosDateEnd != null ">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="level != null and level != ''">
+            AND b.level = #{level}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
+        </if>
+        <if test="doctorCode != null and doctorCode != ''">
+            AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and a.beh_dept_name = #{deptName}
+        </if>
+        <if test="name != null and name != ''">
+            AND a.name like CONCAT('%',#{name},'%')
+        </if>
+        ) t1,
+        (
+        SELECT
+        ROUND( AVG( b.score_res ), 2 ) AS avgScore,
+        a.beh_dept_id AS behDeptId,
+        a.beh_dept_name AS behDeptName
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.behospital_code = b.behospital_code
+        <if test="isPlacefile != null and isPlacefile != ''">
+            and a.is_placefile = #{isPlacefile}
+        </if>
+        <![CDATA[AND a.qc_type_id <>0 ]]>
+        <if test="hospitalId != null and hospitalId != ''">
+            AND a.hospital_id = #{hospitalId}
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="behosDateStart != null">
+            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+        </if>
+        <if test="behosDateEnd != null">
+            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+        </if>
+        <if test="leaveHosDateStart != null ">
+            <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
+        </if>
+        <if test="leaveHosDateEnd != null ">
+            <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="level != null and level != ''">
+            AND b.level = #{level}
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
+            OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
+        </if>
+        <if test="doctorCode != null and doctorCode != ''">
+            AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
+            OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
+        </if>
+        <if test="deptName != null and deptName != ''">
+            and a.beh_dept_name = #{deptName}
+        </if>
+        <if test="name != null and name != ''">
+            AND a.name like CONCAT('%',#{name},'%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.beh_dept_name
+        ) t2
+        WHERE
+        t1.behDeptId = t2.behDeptId
+        AND t1.behDeptName = t2.behDeptName
+        ORDER BY
+        t1.behDeptName,
+        t1.doctorName,
+        t1.patName,
+        <if test="radioCheck !=null and radioCheck == 1">
+            t1.caseName,
+        </if>
+        t1.behospitalCode
+        )tp
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
+        ON tp.behospitalCode = g.behospital_code
+        AND tp.hospitalId = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON tp.behospitalCode = h.behospital_code
+        AND tp.hospitalId = h.hospital_id
+        ) tu
+        WHERE tu.behospitalCode IS NOT NULL
+        <if test="checkStatus != null ">
+            and tu.check_status = #{checkStatus}
+        </if>
+        <if test="mrStatus != null ">
+            AND tu.mr_status = #{mrStatus}
+        </if>
+        <if test="chName != null and chName !=''">
+            AND tu.ch_name like CONCAT('%',#{chName},'%')
+        </if>
+        <if test="mrName != null and mrName !=''">
+            AND tu.mr_name like CONCAT('%',#{mrName},'%')
+        </if>
+        <if test="chTimeStart != null">
+            <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
+        </if>
+        <if test="chTimeEnd != null">
+            <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
+        </if>
+        <if test="mrTimeStart != null">
+            <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
+        </if>
+        <if test="mrTimeEnd != null">
+            <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
+        </if>
+    </select>
 </mapper>