chengyao il y a 4 ans
Parent
commit
ee219c5e04

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

@@ -204,6 +204,8 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/print/export/unModifyMRSExportByDept").permitAll()
                 .antMatchers("/consoleByDept/unModifyMRPageByDept").permitAll()
                 .antMatchers("/print/export/unModifyMRPageExportByDept").permitAll()
+                .antMatchers("/consoleByDept/medicalCheckFormKs").permitAll()
+                .antMatchers("/print/export/medicalCheckExportByDept").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -248,6 +248,8 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/print/export/unModifyMRSExportByDept", request)
                 || matchers("/consoleByDept/unModifyMRPageByDept", request)
                 || matchers("/print/export/unModifyMRPageExportByDept", request)
+                || matchers("/consoleByDept/medicalCheckFormKs", request)
+                || matchers("/print/export/medicalCheckExportByDept", request)
                 || matchers("/", request)) {
             return true;
         }

+ 3 - 0
src/main/java/com/diagbot/dto/MedicalCheckDTO.java

@@ -27,6 +27,9 @@ public class MedicalCheckDTO{
     //医生
     private String doctorName;
 
+    //医疗组
+    private String doctorGroup;
+
     //入院记录未24小时内_id
     private String entry_2658_id;
 

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

@@ -0,0 +1,25 @@
+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:cy
+ * @time: 2020/9/9 13:19
+ */
+@Getter
+@Setter
+public class MedicalDeptDTO {
+
+    //科室名称
+    @Excel(name = "科室",width = 18,needMerge = true,orderNum = "1")
+    private String deptName;
+
+    @ExcelCollection(name = "",orderNum = "2")
+    private List<MedicalDoDeptDTO> medicalDoctorExportDTOS;
+}

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

@@ -0,0 +1,25 @@
+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:cy
+ * @time: 2020/9/9 13:19
+ */
+@Getter
+@Setter
+public class MedicalDoDeptDTO {
+
+    //医疗组
+    @Excel(name = "医疗组",needMerge = true,orderNum = "1")
+    private String doctorGroup;
+
+    @ExcelCollection(name = "",orderNum = "2")
+    private List<MedicalSeeByDeptDTO> medicalCheckTitleDTOS;
+}

+ 100 - 0
src/main/java/com/diagbot/dto/MedicalSeeByDeptDTO.java

@@ -0,0 +1,100 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:cy
+ * @time: 2020/9/9 13:19
+ */
+@Getter
+@Setter
+public class MedicalSeeByDeptDTO {
+
+    //主管医生
+    @Excel(name = "主管医生",orderNum = "1")
+    private String doctorName ;
+
+    //入院记录未24小时内
+    @Excel(name = "入院记录24小时内",orderNum = "2")
+    private String ryjlw_24 ;
+
+    //首次病程记录未8小时内
+    @Excel(name = "首次病程记录8小时内",orderNum = "3")
+    private String scbcjlw_8h;
+
+    @Excel( name = "副主任/主任医师首次查房72小时内完成",orderNum = "4")
+    //副主任/主任医师首次查房72小时内未完成
+    private String zrsccfw_72h;
+
+    //入院后未连记3天病程
+    @Excel(name = "入院后连记3天病程(不包括术后首程)",orderNum = "5")
+    private String ryhljbcw_3d;
+
+    //每周至少2次副主任/主任医师查房
+    @Excel(name = "每周至少2次副主任/主任医师查房",orderNum = "6")
+    private String zrcfw_2w;
+
+    //每周至少3次主治医师查房记录
+    @Excel(name = "每周至少3次主治医师查房记录",orderNum = "7")
+    private String zzcfw_3w;
+
+    //抢救记录未6小时内完成
+    @Excel(name = "抢救记录6小时内完成",orderNum = "8")
+    private String qjjlw_6h;
+
+    //会诊记录在会诊申请后未24小时完成
+    @Excel(name = "会诊记录在会诊申请后24小时完成",orderNum = "9")
+    private String hzjlw_24h;
+
+    //术前讨论、术前小结未完成
+    @Excel(name = "术前讨论、术前小结完成",orderNum = "10")
+    private String sqtlxjw;
+
+    //手术记录术后24小时内未完成
+    @Excel(name = "手术记录术后24小时内完成",orderNum = "11")
+    private String sxjlsw_24h;
+
+    //术后首程在术后30分钟内未完成
+    @Excel(name = "术后首程在术后30分钟内完成",orderNum = "12")
+    private String xhscw_30m;
+
+    //术后主刀查房24小时内未完成
+    @Excel(name = "术后主刀查房24小时内完成",orderNum = "13")
+    private String shzdcfw_24h;
+
+    //术后未连记3天病程
+    @Excel(name = "术后连记3天病程(包括术后首程)",orderNum = "14")
+    private String shjbcw_3d;
+
+    //转科后未连记3天病程
+    @Excel(name = "转科后连记3天病程(包括专科记录)",orderNum = "15")
+    private String zkjbcw_3d;
+
+    //转接科记录专科后24小时内未完成
+    @Excel(name = "转接科记录专科后24小时内完成",orderNum = "16")
+    private String zkjlw_24;
+
+    //病危/重患者未每日记录病程
+    @Excel(name = "病危/重患者每日记录病程",orderNum = "17")
+    private String bwzhjlbcw_md;
+
+    //输血后未完成输血记录
+    @Excel(name = "输血后完成输血记录",orderNum = "18")
+    private String sxhwjl;
+
+    //24小时未完成输血后评价
+    @Excel(name = "24小时完成输血后评价",orderNum = "19")
+    private String sxpjw_24;
+
+    //危急值未记录
+    @Excel(name = "危急值记录",orderNum = "20")
+    private String wjzwjl;
+
+    //住院30天未阶段小结
+    @Excel(name = "住院30天阶段小结",orderNum = "21")
+    private String wywwcxj;
+
+}

+ 20 - 0
src/main/java/com/diagbot/facade/ConsoleByDeptExportFacade.java

@@ -357,6 +357,26 @@ public class ConsoleByDeptExportFacade {
         ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelByDeptDTO.class, fileName, response);
     }
 
+    /**
+     * 稽查统计导出-科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public void medicalCheckExportByDept(HttpServletResponse response, FilterMedicalCheckVO filterVO) {
+        filterVO.setCurrent(1L);
+        filterVO.setSize(Long.MAX_VALUE);
+        filterVO.setSearchCount(false);
+        String fileName = null;
+        if ( "1".equals(filterVO.getIsPlacefile())) {
+            fileName = "终末病历稽查表.xls";
+        } else {
+            fileName = "运行病历稽查表.xls";
+        }
+        List<MedicalDeptDTO> records = consoleByDeptFacade.medicalCheckExportByDept(filterVO);
+        ExcelUtils.exportExcel(records, null, "sheet1", MedicalDeptDTO.class, fileName, response, 15.8f);
+    }
+
 
 
     /**

+ 111 - 0
src/main/java/com/diagbot/facade/ConsoleByDeptFacade.java

@@ -829,6 +829,117 @@ public class ConsoleByDeptFacade {
         filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
         return behospitalInfoFacade.unModifyMRByDept(qcResultShortPageVO);
     }
+    /**
+     * 病历稽查表导出-科室
+     *
+     * @param filterVO
+     * @return
+     */
+
+
+    public List<MedicalDeptDTO> medicalCheckExportByDept(@Param("filterVO") FilterMedicalCheckVO filterVO) {
+        filterFacade.getMedicalCheckVOSet(filterVO);
+        List<MedicalDeptDTO> medicalCheck = behospitalInfoFacade.medicalCheckExportByDept(filterVO);
+        return medicalCheck;
+    }
+
+
+
+
+    /**
+     * 病历稽查表(title)-科室
+     *
+     * @param
+     * @return
+     */
+    public List<ColumnDTO> medicalCheckTitleKs() {
+        //病历稽查入参拼接
+        String hospitalId = SysUserUtils.getCurrentHospitalID();
+        //colums
+        QueryWrapper<SysHospitalSet> hospitalSetQueryWrapper = new QueryWrapper<>();
+        hospitalSetQueryWrapper.eq("is_deleted", 'N')
+                .eq("hospital_id", hospitalId)
+                .eq("code", "medical_check_form_ks");
+        List<ColumnDTO> columns = Lists.newLinkedList();
+        SysHospitalSet hospitalSet = sysHospitalSetFacade.getOne(hospitalSetQueryWrapper);
+        if (hospitalSet == null || StringUtil.isBlank(hospitalSet.getValue())) {
+            return columns;
+        }
+
+        //表头生成
+        List<String> columnSet = Arrays.asList(hospitalSet.getValue().split(","));
+        Integer orderNo = 1;
+        ColumnDTO columnDeptId = new ColumnDTO();
+        columnDeptId.setOrderNo(orderNo);
+        columnDeptId.setFieldName("doctorId");
+        columnDeptId.setColumnName("医生编码");
+        columnDeptId.setIsShow(0);
+        columns.add(columnDeptId);
+        orderNo++;
+        ColumnDTO columnDeptName = new ColumnDTO();
+        columnDeptName.setOrderNo(orderNo);
+        columnDeptName.setFieldName("doctorName");
+        columnDeptName.setColumnName("主管医生");
+        columnDeptName.setIsShow(1);
+        columns.add(columnDeptName);
+        orderNo++;
+        ColumnDTO columnMedicalName = new ColumnDTO();
+        columnMedicalName.setOrderNo(orderNo);
+        columnMedicalName.setFieldName("doctorGroup");
+        columnMedicalName.setColumnName("医疗组");
+        columnMedicalName.setIsShow(1);
+        columns.add(columnMedicalName);
+        orderNo++;
+        for (String valueStr : columnSet) {
+            String[] keyValue = valueStr.split("--");
+            if (keyValue != null || keyValue.length > 1) {
+                ColumnDTO columnNum = new ColumnDTO();
+                columnNum.setOrderNo(orderNo);
+                columnNum.setId(Long.valueOf(keyValue[0]));
+                columnNum.setFieldName("entry_" + keyValue[0] + "_name");
+                columnNum.setColumnName(keyValue[1]);
+                columnNum.setIsShow(1);
+                columns.add(columnNum);
+                orderNo++;
+            }
+        }
+
+        return columns;
+    }
+
+    /**
+     * 病历稽查表-科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public IPage<MedicalCheckDTO> getMedicalChecks(@Param("filterVO") FilterMedicalCheckVO filterVO) {
+        filterFacade.getMedicalCheckVOSet(filterVO);
+        //colums
+        QueryWrapper<SysHospitalSet> hospitalSetQueryWrapper = new QueryWrapper<>();
+        hospitalSetQueryWrapper.eq("is_deleted", 'N')
+                .eq("hospital_id", filterVO.getHospitalId())
+                .eq("code", "medical_check_form_ks");
+        SysHospitalSet hospitalSet = sysHospitalSetFacade.getOne(hospitalSetQueryWrapper);
+
+        //表头生成
+        List<String> columnSet = Arrays.asList(hospitalSet.getValue().split(","));
+
+        //目标条目
+        List<Long> casesEntryIds = Lists.newArrayList();
+        //遍历第一个条目
+        for (String valueStr : columnSet) {
+            if (StringUtil.isBlank(valueStr)) {
+                continue;
+            }
+            String[] keyValue = valueStr.split("--");
+            if (keyValue != null || keyValue.length > 1) {
+                casesEntryIds.add(Long.valueOf(keyValue[0]));
+            }
+        }
+        IPage<MedicalCheckDTO> medicalCheck = behospitalInfoFacade.getMedicalCheck(filterVO,casesEntryIds);
+        return medicalCheck;
+    }
 
 
     /**

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

@@ -2082,7 +2082,7 @@ public class ConsoleFacade {
 
 
     /**
-     * 病历稽查表(首页)
+     * 病历稽查表
      *
      * @param filterVO
      * @return

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

@@ -409,6 +409,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<MedicalCheckDTO>  getMedicalCheck(@Param("filterVO")FilterMedicalCheckVO filterVO);
 
+    /**
+     * 病历稽查表-科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public IPage<MedicalCheckDTO>  getMedicalCheckByDept(@Param("filterVO")FilterMedicalCheckVO filterVO);
+
     public List<MedicalCheckIdNameDTO>  getMedicalEntryIds(@Param("casesEntryIds")List<Long> casesEntryIds);
 
     /**
@@ -419,6 +427,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public List<MedicalCheckExportDTO>  getMedicalCheckExport(@Param("filterVO")FilterMedicalCheckVO filterVO);
 
+    /**
+     * 病历稽查表导出-科室
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<MedicalDeptDTO>  medicalCheckExportByDept(@Param("filterVO")FilterMedicalCheckVO filterVO);
+
 
     /**
      * 未整改病历质控评分页(内页)

+ 7 - 0
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -398,6 +398,13 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     List<MedicalCheckExportDTO>  getMedicalCheckExport(FilterMedicalCheckVO filterVO);
 
+    /**
+     * 病历稽查表导出-科室
+     * @return
+     */
+    List<MedicalDeptDTO>  medicalCheckExportByDept(FilterMedicalCheckVO filterVO);
+
+
 
     /**
      * 未整改病历质控评分页(内页)

+ 13 - 1
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -548,7 +548,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      */
     @Override
     public IPage<MedicalCheckDTO> getMedicalCheck(@Param("filterVO") FilterMedicalCheckVO filterVO, @Param("casesEntryIds") List<Long> casesEntryIds) {
-        IPage<MedicalCheckDTO> medicalCheck = baseMapper.getMedicalCheck(filterVO);
+        IPage<MedicalCheckDTO> medicalCheck = baseMapper.getMedicalCheckByDept(filterVO);
         List<MedicalCheckIdNameDTO> medicalEntryIds = baseMapper.getMedicalEntryIds(casesEntryIds);
 
         List<MedicalCheckDTO> records = medicalCheck.getRecords();
@@ -653,6 +653,18 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
         return medicalCheckExport;
 
     }
+    /**
+     * 病历稽查表导出-科室
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<MedicalDeptDTO> medicalCheckExportByDept(@Param("filterVO") FilterMedicalCheckVO filterVO) {
+        List<MedicalDeptDTO> medicalCheckExport = baseMapper.medicalCheckExportByDept(filterVO);
+        return medicalCheckExport;
+
+    }
 
 
     /**

+ 30 - 0
src/main/java/com/diagbot/web/ConsoleByDeptController.java

@@ -480,5 +480,35 @@ public class ConsoleByDeptController {
         return RespDTO.onSuc(consoleByDeptFacade.unModifyMRByDept(qcResultShortPageVO));
     }
 
+    /**
+     * 病历稽查表(title)-科室
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "病历稽查获取title-科室[by:cy]")
+    @PostMapping("/medicalCheckTitleKs")
+    @SysLogger("medicalCheckTitleKs")
+    public RespDTO<List<ColumnDTO>> medicalCheckTitleKs() {
+        return RespDTO.onSuc(consoleByDeptFacade.medicalCheckTitleKs());
+    }
+
+    /**
+     * 病历稽查表-科室
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "病历稽查统计-科室[by:cy]",
+            notes = "name: 科室名称 <br>" +
+                    "asc: 排序(升序) <br>" +
+                    "desc:排序(降序) <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>" +
+                    "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+    @PostMapping("/medicalCheckFormKs")
+    @SysLogger("medicalCheckFormKs")
+    public RespDTO<IPage<MedicalCheckDTO> > getMedicalChecks(@RequestBody @Valid FilterMedicalCheckVO filterVO) {
+        return RespDTO.onSuc(consoleByDeptFacade.getMedicalChecks(filterVO));
+    }
+
     //endregion -----------------------内页接口结束------------------------------
 }

+ 16 - 0
src/main/java/com/diagbot/web/ConsoleByDeptExportController.java

@@ -380,6 +380,22 @@ public class ConsoleByDeptExportController {
         consoleByDeptExportFacade.unModifyExportByDept(response, qcResultShortPageVO);
     }
 
+    /**
+     * 病历稽查统计导出-科室
+     * @param filterVO
+     * @return
+     */
+    @ApiOperation(value = "病历稽查导出-科室[by:cy]",
+            notes =  "name: 科室名称 <br>" +
+                    "startDate: 起始时间 <br>" +
+                    "endDate: 截止时间 <br>" +
+                    "isPlacefile: 是否归档(0:未归档,1:已归档) <br>")
+    @PostMapping("/medicalCheckExportByDept")
+    @SysLogger("medicalCheckExportByDept")
+    public void medicalCheckExportByDept(HttpServletResponse response, @RequestBody @Valid FilterMedicalCheckVO filterVO) {
+        consoleByDeptExportFacade.medicalCheckExportByDept(response, filterVO);
+    }
+
 /**
      * 病历稽查统计(首页)
      * @param filterVO

+ 1 - 1
src/main/java/com/diagbot/web/ConsoleController.java

@@ -781,7 +781,7 @@ public class ConsoleController {
 
 
     /**
-     * 病历稽查表(首页)
+     * 病历稽查表
      * @param filterVO
      * @return
      */

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

@@ -9674,6 +9674,7 @@
     <resultMap id="MedicalCheckMap" type="com.diagbot.dto.MedicalCheckDTO">
         <result column="deptName" property="deptName"/>
         <result column="deptId" property="deptId"/>
+        <result column="doctorGroup" property="doctorGroup"/>
         <result column="doctorName" property="doctorName"/>
         <result column="entry_2658_num" property="entry_2658_num"/>
         <result column="entry_2686_num" property="entry_2686_num"/>
@@ -9697,12 +9698,12 @@
         <result column="entry_2495_num" property="entry_2495_num"/>
     </resultMap>
 
-    <!--    病历稽查表最新sql-->
+    <!--    病历稽查表-->
     <select id="getMedicalCheck" resultMap="MedicalCheckMap">
         SELECT
         a.beh_dept_id AS deptId,
         a.beh_dept_name AS deptName,
-        a.doctor_name as doctorName,
+        a.doctor_name as doctorGroup,
         sum(c.cases_entry_id = 2658) as entry_2658_num,
         sum(c.cases_entry_id = 2686) as entry_2686_num,
         sum(c.cases_entry_id = 2657) as entry_2657_num,
@@ -9740,6 +9741,7 @@
         AND a.hospital_id = e.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = e.dept_id
         AND c.cases_entry_id = d.id
         and a.doctor_id=e.doctor_id
         and e.group_id is not NULL
@@ -9776,6 +9778,204 @@
         a.doctor_id
     </select>
 
+    <!--    病历稽查表-科室-->
+    <select id="getMedicalCheckByDept" resultMap="MedicalCheckMap">
+        SELECT
+        t1.deptId,
+        t1.deptName,
+        t2.doctorGroup,
+        t1.doctorName,
+        t1.entry_2658_num,
+        t1.entry_2686_num,
+        t1.entry_2657_num,
+        t1.entry_3010_num,
+        t1.entry_2655_num,
+        t1.entry_2654_num,
+        t1.entry_2852_num,
+        t1.entry_2287_num,
+        t1.entry_3025_num,
+        t1.entry_2170_num,
+        t1.entry_2930_num,
+        t1.entry_2900_num,
+        t1.entry_2229_num,
+        t1.entry_2217_num,
+        t1.entry_2218_num,
+        t1.entry_2220_num,
+        t1.entry_2486_num,
+        t1.entry_3063_num,
+        t1.entry_3062_num,
+        t1.entry_2495_num
+        from(
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        a.doctor_name as doctorName,
+        e.group_id,
+        sum(c.cases_entry_id = 2658) as entry_2658_num,
+        sum(c.cases_entry_id = 2686) as entry_2686_num,
+        sum(c.cases_entry_id = 2657) as entry_2657_num,
+        sum(c.cases_entry_id = 3010) as entry_3010_num,
+        sum(c.cases_entry_id = 2655) as entry_2655_num,
+        sum(c.cases_entry_id = 2654) as entry_2654_num,
+        sum(c.cases_entry_id = 2852) as entry_2852_num,
+        sum(c.cases_entry_id = 2287) as entry_2287_num,
+        sum(c.cases_entry_id = 3025) as entry_3025_num,
+        sum(c.cases_entry_id = 2170) as entry_2170_num,
+        sum(c.cases_entry_id = 2930) as entry_2930_num,
+        sum(c.cases_entry_id = 2900) as entry_2900_num,
+        sum(c.cases_entry_id = 2229) as entry_2229_num,
+        sum(c.cases_entry_id = 2217) as entry_2217_num,
+        sum(c.cases_entry_id = 2218) as entry_2218_num,
+        sum(c.cases_entry_id = 2220) as entry_2220_num,
+        sum(c.cases_entry_id = 2486) as entry_2486_num,
+        sum(c.cases_entry_id = 3063) as entry_3063_num,
+        sum(c.cases_entry_id = 3062) as entry_3062_num,
+        sum(c.cases_entry_id = 2495) as entry_2495_num
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        bas_doctor_info e,
+        sys_user_dept f
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = f.dept_id
+        AND a.beh_dept_id = e.dept_id
+        AND c.cases_entry_id = d.id
+        and a.doctor_id=e.doctor_id
+        and e.group_id is not NULL
+        AND LENGTH(e.group_id)>0
+        AND a.qc_type_id != 0
+        <if test="filterVO.userId!=null">
+            AND f.user_id = #{filterVO.userId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
+            and a.is_placefile = #{filterVO.isPlacefile}
+        </if>
+        <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
+            AND a.hospital_id = #{filterVO.hospitalId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.deptName != null and filterVO.deptName != ''">
+            AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        e.group_id,
+        a.`doctor_name`)t1,
+        (SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        a.doctor_name as doctorGroup,
+        e.group_id,
+        sum(c.cases_entry_id = 2658) as entry_2658_num,
+        sum(c.cases_entry_id = 2686) as entry_2686_num,
+        sum(c.cases_entry_id = 2657) as entry_2657_num,
+        sum(c.cases_entry_id = 3010) as entry_3010_num,
+        sum(c.cases_entry_id = 2655) as entry_2655_num,
+        sum(c.cases_entry_id = 2654) as entry_2654_num,
+        sum(c.cases_entry_id = 2852) as entry_2852_num,
+        sum(c.cases_entry_id = 2287) as entry_2287_num,
+        sum(c.cases_entry_id = 3025) as entry_3025_num,
+        sum(c.cases_entry_id = 2170) as entry_2170_num,
+        sum(c.cases_entry_id = 2930) as entry_2930_num,
+        sum(c.cases_entry_id = 2900) as entry_2900_num,
+        sum(c.cases_entry_id = 2229) as entry_2229_num,
+        sum(c.cases_entry_id = 2217) as entry_2217_num,
+        sum(c.cases_entry_id = 2218) as entry_2218_num,
+        sum(c.cases_entry_id = 2220) as entry_2220_num,
+        sum(c.cases_entry_id = 2486) as entry_2486_num,
+        sum(c.cases_entry_id = 3063) as entry_3063_num,
+        sum(c.cases_entry_id = 3062) as entry_3062_num,
+        sum(c.cases_entry_id = 2495) as entry_2495_num
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        bas_doctor_info e,
+        sys_user_dept f
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = f.dept_id
+        AND a.beh_dept_id = e.dept_id
+        AND c.cases_entry_id = d.id
+        and a.doctor_id=e.doctor_id
+        and e.group_id is not NULL
+        AND LENGTH(e.group_id)>0
+        AND a.qc_type_id != 0
+        <if test="filterVO.userId!=null">
+            AND f.user_id = #{filterVO.userId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
+            and a.is_placefile = #{filterVO.isPlacefile}
+        </if>
+        <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
+            AND a.hospital_id = #{filterVO.hospitalId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.deptName != null and filterVO.deptName != ''">
+            AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        e.group_id)t2
+        where t1.group_id = t2.group_id
+    </select>
+
     <!--    病历稽查表最新sql、id&&name-->
     <select id="getMedicalEntryIds" resultType="com.diagbot.dto.MedicalCheckIdNameDTO">
         SELECT
@@ -9823,6 +10023,38 @@
         </collection>
     </resultMap>
 
+    <resultMap id="MedicalCheckByDeptMap" type="com.diagbot.dto.MedicalDeptDTO">
+        <result column="deptName" property="deptName"/>
+        <collection property="medicalDoctorExportDTOS" javaType="ArrayList"
+                    ofType="com.diagbot.dto.MedicalDoDeptDTO">
+            <result column="doctorGroup" property="doctorGroup"/>
+            <collection property="medicalCheckTitleDTOS" javaType="ArrayList"
+                        ofType="com.diagbot.dto.MedicalSeeByDeptDTO">
+                <result column="doctorName" property="doctorName"/>
+                <result column="RYJLW_24" property="ryjlw_24"/>
+                <result column="SCBCJLW_8H" property="scbcjlw_8h"/>
+                <result column="ZRSCCFW_72H" property="zrsccfw_72h"/>
+                <result column="RYHLJBCW_3D" property="ryhljbcw_3d"/>
+                <result column="ZRCFW_2W" property="zrcfw_2w"/>
+                <result column="ZZCFW_3W" property="zzcfw_3w"/>
+                <result column="QJJLW_6H" property="qjjlw_6h"/>
+                <result column="HZJLW_24H" property="hzjlw_24h"/>
+                <result column="SQTLXJW" property="sqtlxjw"/>
+                <result column="SXJLSW_24H" property="sxjlsw_24h"/>
+                <result column="XHSCW_30M" property="xhscw_30m"/>
+                <result column="SHZDCFW_24H" property="shzdcfw_24h"/>
+                <result column="SHJBCW_3D" property="shjbcw_3d"/>
+                <result column="ZKJBCW_3D" property="zkjbcw_3d"/>
+                <result column="ZKJLW_24" property="zkjlw_24"/>
+                <result column="BWZHJLBCW_MD" property="bwzhjlbcw_md"/>
+                <result column="SXHWJL" property="sxhwjl"/>
+                <result column="SXPJW_24" property="sxpjw_24"/>
+                <result column="WJZWJL" property="wjzwjl"/>
+                <result column="WYWWCXJ" property="wywwcxj"/>
+            </collection>
+        </collection>
+    </resultMap>
+
     <!--    病历稽查表最新导出-->
     <select id="getMedicalCheckExport" resultMap="MedicalCheckExcelMap">
         SELECT
@@ -9886,6 +10118,7 @@
         AND a.hospital_id = e.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = e.dept_id
         AND c.cases_entry_id = d.id
         and a.doctor_id=e.doctor_id
         and e.group_id is not NULL
@@ -9921,6 +10154,204 @@
         e.group_id
     </select>
 
+    <!--    病历稽查表最新导出-->
+    <select id="medicalCheckExportByDept" resultMap="MedicalCheckByDeptMap">
+        SELECT
+        t1.deptId,
+        t1.deptName,
+        t2.doctorGroup,
+        t1.doctorName,
+        t1.RYJLW_24,
+        t1.SCBCJLW_8H,
+        t1.ZRSCCFW_72H,
+        t1.RYHLJBCW_3D,
+        t1.ZRCFW_2W,
+        t1.ZZCFW_3W,
+        t1.QJJLW_6H,
+        t1.HZJLW_24H,
+        t1.SQTLXJW,
+        t1.SXJLSW_24H,
+        t1.XHSCW_30M,
+        t1.SHZDCFW_24H,
+        t1.SHJBCW_3D,
+        t1.ZKJBCW_3D,
+        t1.ZKJLW_24,
+        t1.BWZHJLBCW_MD,
+        t1.SXHWJL,
+        t1.SXPJW_24,
+        t1.WJZWJL,
+        t1.WYWWCXJ
+        from(
+        SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        a.doctor_name as doctorName,
+        e.group_id,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2658 THEN a.behospital_code else null END ) as RYJLW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2686 THEN a.behospital_code else null END ) as SCBCJLW_8H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2657 THEN a.behospital_code else null END ) as ZRSCCFW_72H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3010 THEN a.behospital_code else null END ) as RYHLJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2655 THEN a.behospital_code else null END ) as ZRCFW_2W,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2654 THEN a.behospital_code else null END ) as ZZCFW_3W,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2852 THEN a.behospital_code else null END ) as QJJLW_6H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2287 THEN a.behospital_code else null END ) as HZJLW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3025 THEN a.behospital_code else null END ) as SQTLXJW,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2170 THEN a.behospital_code else null END ) as SXJLSW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2930 THEN a.behospital_code else null END ) as XHSCW_30M,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2900 THEN a.behospital_code else null END ) as SHZDCFW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2229 THEN a.behospital_code else null END ) as SHJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2217 THEN a.behospital_code else null END ) as ZKJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2218 THEN a.behospital_code else null END ) as ZKJLW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2220 THEN a.behospital_code else null END ) as BWZHJLBCW_MD,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2486 THEN a.behospital_code else null END ) as SXHWJL,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3063 THEN a.behospital_code else null END ) as SXPJW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3062 THEN a.behospital_code else null END ) as WJZWJL,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2495 THEN a.behospital_code else null END ) as WYWWCXJ
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        bas_doctor_info e,
+        sys_user_dept f
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = f.dept_id
+        AND a.beh_dept_id = e.dept_id
+        AND c.cases_entry_id = d.id
+        and a.doctor_id=e.doctor_id
+        and e.group_id is not NULL
+        AND LENGTH(e.group_id)>0
+        AND a.qc_type_id != 0
+        <if test="filterVO.userId!=null">
+            AND f.user_id = #{filterVO.userId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
+            and a.is_placefile = #{filterVO.isPlacefile}
+        </if>
+        <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
+            AND a.hospital_id = #{filterVO.hospitalId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.deptName != null and filterVO.deptName != ''">
+            AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        e.group_id,
+        a.`doctor_name`)t1,
+        (SELECT
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        a.doctor_name as doctorGroup,
+        e.group_id,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2658 THEN a.behospital_code else null END ) as RYJLW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2686 THEN a.behospital_code else null END ) as SCBCJLW_8H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2657 THEN a.behospital_code else null END ) as ZRSCCFW_72H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3010 THEN a.behospital_code else null END ) as RYHLJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2655 THEN a.behospital_code else null END ) as ZRCFW_2W,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2654 THEN a.behospital_code else null END ) as ZZCFW_3W,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2852 THEN a.behospital_code else null END ) as QJJLW_6H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2287 THEN a.behospital_code else null END ) as HZJLW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3025 THEN a.behospital_code else null END ) as SQTLXJW,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2170 THEN a.behospital_code else null END ) as SXJLSW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2930 THEN a.behospital_code else null END ) as XHSCW_30M,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2900 THEN a.behospital_code else null END ) as SHZDCFW_24H,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2229 THEN a.behospital_code else null END ) as SHJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2217 THEN a.behospital_code else null END ) as ZKJBCW_3D,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2218 THEN a.behospital_code else null END ) as ZKJLW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2220 THEN a.behospital_code else null END ) as BWZHJLBCW_MD,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2486 THEN a.behospital_code else null END ) as SXHWJL,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3063 THEN a.behospital_code else null END ) as SXPJW_24,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 3062 THEN a.behospital_code else null END ) as WJZWJL,
+        GROUP_CONCAT(DISTINCT case when c.cases_entry_id = 2495 THEN a.behospital_code else null END ) as WYWWCXJ
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        bas_doctor_info e,
+        sys_user_dept f
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND e.is_deleted = 'N'
+        AND f.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.hospital_id = f.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND a.beh_dept_id = f.dept_id
+        AND a.beh_dept_id = e.dept_id
+        AND c.cases_entry_id = d.id
+        and a.doctor_id=e.doctor_id
+        and e.group_id is not NULL
+        AND LENGTH(e.group_id)>0
+        AND a.qc_type_id != 0
+        <if test="filterVO.userId!=null">
+            AND f.user_id = #{filterVO.userId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
+            and a.is_placefile = #{filterVO.isPlacefile}
+        </if>
+        <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
+            AND a.hospital_id = #{filterVO.hospitalId}
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
+            <if test="filterVO.startDate != null ">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
+            </if>
+            <if test="filterVO.endDate != null ">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
+            </if>
+        </if>
+        <if test="filterVO.deptName != null and filterVO.deptName != ''">
+            AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        e.group_id)t2
+        where t1.group_id = t2.group_id
+    </select>
+
     <!-- 未整改病历统计-->
     <select id="unModifyMRStatistics" resultType="com.diagbot.dto.UnModifyMRDetailDTO" parameterType="com.diagbot.vo.FilterUnModifyMRVO">
         SELECT