Jelajahi Sumber

稽查统计数据导出格式修改

chengyao 4 tahun lalu
induk
melakukan
2ef4dda664

+ 30 - 0
src/main/java/com/diagbot/dto/MedicalCheckExportDTO.java

@@ -0,0 +1,30 @@
+package com.diagbot.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:cy
+ * @time: 2020/9/9 13:19
+ */
+@Getter
+@Setter
+public class MedicalCheckExportDTO  {
+
+
+    //科室名称
+
+    @Excel(name = "科室",needMerge = true, width = 18)
+    private String deptName;
+
+    @ExcelCollection(name = "")
+    private List<MedicalCheckTitleDTO> medicalCheckTitleDTOS;
+
+}

+ 116 - 0
src/main/java/com/diagbot/dto/MedicalCheckTitleDTO.java

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

+ 18 - 24
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -3,22 +3,7 @@ package com.diagbot.facade;
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.AverageStatisticsDTO;
-import com.diagbot.dto.AverageStatisticsFeeDTO;
-import com.diagbot.dto.AverageStatisticsFeeMonthDTO;
-import com.diagbot.dto.AverageStatisticsMonthDTO;
-import com.diagbot.dto.EntryNumDTO;
-import com.diagbot.dto.EntryNumGroupDTO;
-import com.diagbot.dto.EntryStatisticsDTO;
-import com.diagbot.dto.ExportExcelDTO;
-import com.diagbot.dto.HomePageImproveDTO;
-import com.diagbot.dto.HomePageNumDTO;
-import com.diagbot.dto.LevelStatisticsDTO;
-import com.diagbot.dto.LevelStatisticsTZDTO;
-import com.diagbot.dto.NumDTO;
-import com.diagbot.dto.QcResultPercentDTO;
-import com.diagbot.dto.ReBeHosDTO;
-import com.diagbot.dto.UnModifyMRDTO;
+import com.diagbot.dto.*;
 import com.diagbot.entity.SysHospitalSet;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
@@ -27,13 +12,7 @@ import com.diagbot.util.ExcelUtils;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
-import com.diagbot.vo.EntryStatisticsVO;
-import com.diagbot.vo.FilterOrderVO;
-import com.diagbot.vo.FilterPageByAverageVO;
-import com.diagbot.vo.FilterPageVO;
-import com.diagbot.vo.FilterUnModifyMRVO;
-import com.diagbot.vo.QcResultShortPageVO;
-import com.diagbot.vo.ReBeHosPageVO;
+import com.diagbot.vo.*;
 import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -87,6 +66,21 @@ public class ConsoleExportFacade {
         ExcelUtils.exportExcel(page.getRecords(), null, "sheet1", EntryNumDTO.class, fileName, response, 12.8f);
     }
 
+    /**
+     * 运行病历稽查统计导出(首页)
+     *
+     * @param filterVO
+     * @return
+     */
+    public void medicalCheckExport(HttpServletResponse response, FilterMedicalCheckVO filterVO) {
+        filterVO.setCurrent(1L);
+        filterVO.setSize(Long.MAX_VALUE);
+        filterVO.setSearchCount(false);
+        List<MedicalCheckExportDTO> records = consoleFacade.medicalCheckExport(filterVO);
+        String fileName = "病历稽查统计表.xls";
+        ExcelUtils.exportExcelUser(records, null, "sheet1", MedicalCheckExportDTO.class, fileName, response);
+    }
+
     /**
      * 各科室缺陷占比(组合)
      *
@@ -445,4 +439,4 @@ public class ConsoleExportFacade {
         String fileName = "质控核查病历导出.xls";
         ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
     }
-}
+}

+ 152 - 0
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -1290,6 +1290,158 @@ public class ConsoleFacade {
         return behospitalInfoFacade.qcCheckMRPage(qcResultShortPageVO);
     }
 
+/*
+    */
+/**
+     * 运行病历稽查表导出(首页)
+     *
+     * @param filterVO
+     * @return
+     */
+
+
+public List<MedicalCheckExportDTO> medicalCheckExport(@Param("filterVO") FilterMedicalCheckVO filterVO) {
+    //filterFacade.getMedicalCheckVOSet(filterVO);
+    filterVO.setHospitalId("2");
+    //colums
+    QueryWrapper<SysHospitalSet> hospitalSetQueryWrapper = new QueryWrapper<>();
+    hospitalSetQueryWrapper.eq("is_deleted", 'N')
+            .eq("hospital_id", filterVO.getHospitalId())
+            .eq("code", "medical_check_form");
+    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]));
+        }
+    }
+
+    List<MedicalCheckExportDTO> medicalCheck = behospitalInfoFacade.getMedicalCheckExport(filterVO,casesEntryIds);
+    List<MedicalCheckExportDTO> medicalExportDTOS = new ArrayList<MedicalCheckExportDTO>();
+    //获取的数据一对多:一个科室对应医生/多个条目title
+     //目标id集取出
+
+    //遍历结果集中的每一条数据
+    for (MedicalCheckExportDTO record : medicalCheck) {
+        //创建稽查条目数据实体类
+        MedicalCheckExportDTO medicalCheckExportDTO = new MedicalCheckExportDTO();
+        //设置科室名称
+        medicalCheckExportDTO.setDeptName(record.getDeptName());
+        //实体类中的子集合
+        List<MedicalCheckTitleDTO> medicalTitles=  new ArrayList<MedicalCheckTitleDTO>();
+
+       //map集合来对查询出来的条目id进行统计出现的次数来确定统计的数量
+        Map<String, Object> targetMap = new HashMap<String, Object>();
+//        每条数据的目标id集,和面来判断统计次数
+        String casesEntryId = null;
+        //获取医生名称/目标条目集合在循环里面
+        List<MedicalCheckTitleDTO> medicalCheckTitleDTOS = record.getMedicalCheckTitleDTOS();
+        for (MedicalCheckTitleDTO medicalCheckTitleDTO : medicalCheckTitleDTOS) {
+            //子集合的实体类
+            MedicalCheckTitleDTO medicalTitleDTOS =  new MedicalCheckTitleDTO();
+            medicalTitleDTOS.setDoctorName(medicalCheckTitleDTO.getDoctorName());
+//            获取目标数据子集合的n条数据
+             casesEntryId = medicalCheckTitleDTO.getCasesEntryId();
+            String[] split = casesEntryId.split(",");
+            for (String num : split) {
+                if (!targetMap.containsKey(num)) {
+                    targetMap.put(num, 1);
+                } else {
+                    targetMap.put(num, (Object) ((Integer) targetMap.get(num) + 1));
+                }
+            }
+            Set<Map.Entry<String, Object>> entries = targetMap.entrySet();
+            for (Map.Entry<String, Object> entry : entries) {
+                String key = entry.getKey();
+                if(key.equals(MedicalCheckEnum.RYJLW_24.getStatus())){
+                    medicalTitleDTOS.setRyjlw_24((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SCBCJLW_8H.getStatus())){
+                    medicalTitleDTOS.setScbcjlw_8h((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.ZRSCCFW_72H.getStatus())){
+                    medicalTitleDTOS.setZrcfw_2w((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.RYHLJBCW_3D.getStatus())){
+                    medicalTitleDTOS.setRyhljbcw_3d((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.ZRCFW_2W.getStatus())){
+                    medicalTitleDTOS.setZrcfw_2w((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.ZZCFW_3W.getStatus())){
+                    medicalTitleDTOS.setZzcfw_3w((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.QJJLW_6H.getStatus())){
+                    medicalTitleDTOS.setQjjlw_6h((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.HZJLW_24H.getStatus())){
+                    medicalTitleDTOS.setHzjlw_24h((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SQTLXJW.getStatus())){
+                    medicalTitleDTOS.setSqtlxjw((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SXJLSW_24H.getStatus())){
+                    medicalTitleDTOS.setSxjlsw_24h((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.XHSCW_30M.getStatus())){
+                    medicalTitleDTOS.setXhscw_30m((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SHZDCFW_24H.getStatus())){
+                    medicalTitleDTOS.setShzdcfw_24h((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SHJBCW_3D.getStatus())){
+                    medicalTitleDTOS.setShjbcw_3d((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.ZKJBCW_3D.getStatus())){
+                    medicalTitleDTOS.setZkjbcw_3d((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.ZKJLW_24.getStatus())){
+                    medicalTitleDTOS.setZkjlw_24((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.BWZHJLBCW_MD.getStatus())){
+                    medicalTitleDTOS.setBwzhjlbcw_md((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SXHWJL.getStatus())){
+                    medicalTitleDTOS.setSxhwjl((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.SXPJW_24.getStatus())){
+                    medicalTitleDTOS.setSxpjw_24((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.WJZWJL.getStatus())){
+                    medicalTitleDTOS.setWjzwjl((Integer)entry.getValue());
+                }
+                if(key.equals(MedicalCheckEnum.WYWWCXJ.getStatus())){
+                    medicalTitleDTOS.setWywwcxj((Integer)entry.getValue());
+                }
+            }
+            //    实体类子集合中添加tile数据,在循环中完成
+            medicalTitles.add(medicalTitleDTOS);
+
+        }
+
+
+
+        //子集合数据填充完毕,在实体类中赋值
+        medicalCheckExportDTO.setMedicalCheckTitleDTOS(medicalTitles);
+        //循环一条添加一条数据
+        medicalExportDTOS.add(medicalCheckExportDTO); //正确的
+    }
+
+    return medicalExportDTOS;
+}
+
+
+
     /**
      * 运行病历稽查表(首页)
      *

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

@@ -332,6 +332,14 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      */
     public IPage<MedicalCheckDTO>  getMedicalCheck(@Param("filterVO")FilterMedicalCheckVO filterVO, @Param("infos")List<Long> infos);
 
+    /**
+     * 运行病历稽查表导出
+     *
+     * @param filterVO
+     * @return
+     */
+    public List<MedicalCheckExportDTO>  getMedicalCheckExport(@Param("filterVO")FilterMedicalCheckVO filterVO, @Param("infos")List<Long> infos);
+
 
     /**
      * 未整改病历质控评分页(内页)

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

@@ -315,6 +315,12 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      */
     IPage<MedicalCheckDTO>  getMedicalCheck(FilterMedicalCheckVO filterVO,List<Long>casesEntryIds);
 
+    /**
+     * 运行病历稽查表导出
+     * @return
+     */
+    List<MedicalCheckExportDTO>  getMedicalCheckExport(FilterMedicalCheckVO filterVO,List<Long>casesEntryIds);
+
 
     /**
      * 未整改病历质控评分页(内页)

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

@@ -468,6 +468,19 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
 
     }
 
+    /**
+     * 运行病历稽查表导出
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public List<MedicalCheckExportDTO> getMedicalCheckExport(@Param("filterVO") FilterMedicalCheckVO filterVO,@Param("casesEntryIds") List<Long>casesEntryIds) {
+        List<MedicalCheckExportDTO> medicalCheckExport = baseMapper.getMedicalCheckExport(filterVO, casesEntryIds);
+        return medicalCheckExport;
+
+    }
+
 
 
     /**

+ 77 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -2731,6 +2731,16 @@
         </collection>
     </resultMap>
 
+    <resultMap id="MedicalCheckExcelMap" type="com.diagbot.dto.MedicalCheckExportDTO">
+        <result column="deptName" property="deptName"/>
+        <collection property="medicalCheckTitleDTOS"
+                    ofType="com.diagbot.dto.MedicalCheckTitleDTO">
+            <result column="casesEntryId" property="casesEntryId"/>
+            <result column="casesEntryName" property="casesEntryName"/>
+            <result column="doctorName" property="doctorName"/>
+        </collection>
+    </resultMap>
+
     <select id="exportExcel" resultMap="ExportExcelMap">
         SELECT DISTINCT
         t1.beh_dept_name AS behDeptName,
@@ -6416,6 +6426,7 @@
         f1.behDeptId = f2.behDeptId
         AND f1.behDeptName = f2.behDeptName
     </select>
+
     <!--    运行病历稽查表-->
     <select id="getMedicalCheck" resultType="com.diagbot.dto.MedicalCheckDTO">
         SELECT
@@ -6480,6 +6491,72 @@
         a.doctor_name
     </select>
 
+
+
+    <!--    运行病历稽查表导出-->
+    <select id="getMedicalCheckExport" resultMap="MedicalCheckExcelMap">
+        SELECT
+        DISTINCT a.file_code as fileCode,
+        a.doctor_name as doctorName,
+        a.beh_dept_id AS deptId,
+        a.beh_dept_name AS deptName,
+        group_concat(d.id) AS casesEntryId,
+        group_concat(d.NAME) AS casesEntryName
+        FROM
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d
+        WHERE
+        a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        AND a.hospital_id = c.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_entry_id = d.id
+        AND a.qc_type_id != 0
+        AND d.id in
+        <if test="infos != null and infos.size() > 0">
+            <foreach collection="infos" open="(" separator="," close=")" item="item">
+                ${item}
+            </foreach>
+        </if>
+        <if test="infos = null || infos.size() == 0">
+            and b.info in('000000ASDQWEZXC@#$%')
+        </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.name != null and filterVO.name != ''">
+            AND a.beh_dept_name like CONCAT('%', #{filterVO.name}, '%')
+        </if>
+        GROUP BY
+        a.beh_dept_id,
+        a.doctor_name
+    </select>
+
     <!-- 未整改病历统计-->
     <select id="unModifyMRStatistics" resultType="com.diagbot.dto.UnModifyMRDetailDTO" parameterType="com.diagbot.vo.FilterUnModifyMRVO">
         SELECT