|
@@ -0,0 +1,293 @@
|
|
|
+package com.lantone.report.facade;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.lantone.common.dto.report.ExportExcelBehospitalDTO;
|
|
|
+import com.lantone.common.dto.report.ExportExcelDTO;
|
|
|
+import com.lantone.common.dto.report.ExportExcelWideBehospitalDTO;
|
|
|
+import com.lantone.common.dto.report.ExportWideExcelDTO;
|
|
|
+import com.lantone.common.dto.report.QcResultShortDTO;
|
|
|
+import com.lantone.common.exception.ApiException;
|
|
|
+import com.lantone.common.util.ExcelUtils;
|
|
|
+import com.lantone.common.util.ListUtil;
|
|
|
+import com.lantone.common.util.StringUtil;
|
|
|
+import com.lantone.common.util.SysUserUtils;
|
|
|
+import com.lantone.common.vo.report.QcResultPageVO;
|
|
|
+import com.lantone.common.vo.report.QcResultShortPageVO;
|
|
|
+import com.lantone.dblayermbg.facade.report.BehospitalInfoFacade;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class MrQcInfoManagementFacade {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FilterFacade filterFacade;
|
|
|
+ @Autowired
|
|
|
+ private BehospitalInfoFacade behospitalInfoFacade;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 条目缺陷质控评分页(内页)
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QcResultShortDTO> qcResultShortPage(QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
|
|
|
+ IPage<QcResultShortDTO> page = behospitalInfoFacade.getBaseMapper().qcResultShortPage(qcResultShortPageVO);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 条目缺陷病历列表-报表导出
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void qcResultShortPageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ String hospitalId = String.valueOf(SysUserUtils.getCurrentHospitalId());
|
|
|
+ qcResultShortPageVO.setHospitalId(hospitalId);
|
|
|
+ if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
|
|
|
+ && qcResultShortPageVO.getDeptName().equals("全部")) {
|
|
|
+ qcResultShortPageVO.setDeptName("");
|
|
|
+ }
|
|
|
+ Date startDate = qcResultShortPageVO.getStartDate();
|
|
|
+ Date endDate = qcResultShortPageVO.getEndDate();
|
|
|
+ //时间间隔90天
|
|
|
+ long interval = 90 * 24l * 60l * 60l * 1000l;
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException( "截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
+ throw new ApiException( "统计区间不能大于90天");
|
|
|
+ }
|
|
|
+
|
|
|
+ qcResultShortPageVO.setCurrent(1L);
|
|
|
+ qcResultShortPageVO.setSize(Long.MAX_VALUE);
|
|
|
+ qcResultShortPageVO.setSearchCount(false);
|
|
|
+ List<ExportExcelDTO> record = behospitalInfoFacade.getBaseMapper().qcResultShortPageExport(qcResultShortPageVO);
|
|
|
+ String fileName = "缺陷详情质控评分页.xls";
|
|
|
+ ExcelUtils.exportExcelUser(record, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 质控核查统计病历列表-报表
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QcResultShortDTO> qcCheckMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
|
|
|
+ return behospitalInfoFacade.getBaseMapper().qcCheckMRPage(qcResultShortPageVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 质控核查统计病历AB列表导出
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void qcCheckMRPageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ String hospitalId = String.valueOf(SysUserUtils.getCurrentHospitalId());
|
|
|
+ qcResultShortPageVO.setHospitalId(hospitalId);
|
|
|
+ if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
|
|
|
+ && qcResultShortPageVO.getDeptName().equals("全部")) {
|
|
|
+ qcResultShortPageVO.setDeptName("");
|
|
|
+ }
|
|
|
+ Date startDate = qcResultShortPageVO.getStartDate();
|
|
|
+ Date endDate = qcResultShortPageVO.getEndDate();
|
|
|
+
|
|
|
+ //时间间隔7天
|
|
|
+ long interval_7 = 7 * 24 * 60 * 60 * 1000;
|
|
|
+ long interval_90 = 90 * 24 * 60 * 60 * 1000l;
|
|
|
+
|
|
|
+ if("1".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ //时间间隔7天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException( "截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval_7) {
|
|
|
+ throw new ApiException( "统计区间不能大于7天");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //时间间隔90天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException("截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval_90) {
|
|
|
+ throw new ApiException( "统计区间不能大于90天");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ qcResultShortPageVO.setCurrent(1L);
|
|
|
+ qcResultShortPageVO.setSize(Long.MAX_VALUE);
|
|
|
+ qcResultShortPageVO.setSearchCount(false);
|
|
|
+ List<ExportExcelDTO> records = behospitalInfoFacade.getBaseMapper().qcCheckMRPageExport(qcResultShortPageVO);
|
|
|
+ List<ExportWideExcelDTO> resWide = new ArrayList<ExportWideExcelDTO>();
|
|
|
+ if("2".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ resWide = transList(records, resWide);
|
|
|
+ }
|
|
|
+ String fileName = "质控核查病历导出.xls";
|
|
|
+ if("1".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+ if("2".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ ExcelUtils.exportExcelUser(resWide, null, "sheet1", ExportWideExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 病案首页改善率质控评分页(内页)
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QcResultShortDTO> hmImproveMRPage(@Param("qcResultShortPageVO") QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
|
|
|
+ return behospitalInfoFacade.getBaseMapper().hmImproveMRPage(qcResultShortPageVO);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 病案首页合格|不合格病历列表-报表
|
|
|
+ *
|
|
|
+ * @param qcResultPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QcResultShortDTO> badLevelPage(QcResultPageVO qcResultPageVO) {
|
|
|
+ filterFacade.badLevelPageVOSet(qcResultPageVO);
|
|
|
+ return behospitalInfoFacade.getBaseMapper().badLevelPage(qcResultPageVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 病案首页合格|不合格病历列表-报表导出
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void badLevelPagePageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ String hospitalId = String.valueOf(SysUserUtils.getCurrentHospitalId());
|
|
|
+ qcResultShortPageVO.setHospitalId(hospitalId);
|
|
|
+ if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
|
|
|
+ && qcResultShortPageVO.getDeptName().equals("全部")) {
|
|
|
+ qcResultShortPageVO.setDeptName("");
|
|
|
+ }
|
|
|
+ Date startDate = qcResultShortPageVO.getStartDate();
|
|
|
+ Date endDate = qcResultShortPageVO.getEndDate();
|
|
|
+ //时间间隔7天
|
|
|
+ long interval_7 = 7 * 24 * 60 * 60 * 1000;
|
|
|
+ long interval_90 = 90 * 24 * 60 * 60 * 1000l;
|
|
|
+
|
|
|
+ if("1".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ //时间间隔7天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException("截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval_7) {
|
|
|
+ throw new ApiException("统计区间不能大于7天");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //时间间隔90天
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException( "截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval_90) {
|
|
|
+ throw new ApiException("统计区间不能大于90天");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ qcResultShortPageVO.setCurrent(1L);
|
|
|
+ qcResultShortPageVO.setSize(Long.MAX_VALUE);
|
|
|
+ qcResultShortPageVO.setSearchCount(false);
|
|
|
+ List<ExportExcelDTO> records = behospitalInfoFacade.getBaseMapper().badLevelPagePageExport(qcResultShortPageVO);
|
|
|
+ List<ExportWideExcelDTO> resWide = new ArrayList<ExportWideExcelDTO>();
|
|
|
+ if("2".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ resWide = transList(records, resWide);
|
|
|
+ }
|
|
|
+ String fileName = null;
|
|
|
+ if("不合格数".equals(qcResultShortPageVO.getTitleName())){
|
|
|
+ fileName = "病案首页不合格数病历详情页.xls";
|
|
|
+ }else{
|
|
|
+ fileName = "病案首页合格数病历详情页.xls";
|
|
|
+ }
|
|
|
+ if("1".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+ if("2".equals(qcResultShortPageVO.getRadioCheck())){
|
|
|
+ ExcelUtils.exportExcelUser(resWide, null, "sheet1", ExportWideExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<ExportWideExcelDTO> transList(List<ExportExcelDTO>res, List<ExportWideExcelDTO>resWide){
|
|
|
+ if(ListUtil.isNotEmpty(res)){
|
|
|
+ res.forEach(exportExcelDTO->{
|
|
|
+ ExportWideExcelDTO exportWideExcelDTO = new ExportWideExcelDTO();
|
|
|
+ exportWideExcelDTO.setAvgScore(exportExcelDTO.getAvgScore());
|
|
|
+ exportWideExcelDTO.setBehDeptName(exportExcelDTO.getBehDeptName());
|
|
|
+ List<ExportExcelBehospitalDTO> excelBehospitalDTOS = exportExcelDTO.getExcelBehospitalDTOS();
|
|
|
+ List<ExportExcelWideBehospitalDTO> exportExcelWideBehospitalDTOs = new ArrayList<>();
|
|
|
+ excelBehospitalDTOS.forEach(exportExcelBehospitalDTO->{
|
|
|
+ ExportExcelWideBehospitalDTO exportExcelWideBehospitalDTO = new ExportExcelWideBehospitalDTO();
|
|
|
+ exportExcelWideBehospitalDTO.setDoctorName(exportExcelBehospitalDTO.getDoctorName());
|
|
|
+ exportExcelWideBehospitalDTO.setBehospitalCode(exportExcelBehospitalDTO.getBehospitalCode());
|
|
|
+ exportExcelWideBehospitalDTO.setBehospitalDate(exportExcelBehospitalDTO.getBehospitalDate());
|
|
|
+ exportExcelWideBehospitalDTO.setLeaveHospitalDate(exportExcelBehospitalDTO.getLeaveHospitalDate());
|
|
|
+ exportExcelWideBehospitalDTO.setPatName(exportExcelBehospitalDTO.getPatName());
|
|
|
+ exportExcelWideBehospitalDTO.setScore(exportExcelBehospitalDTO.getScore());
|
|
|
+ exportExcelWideBehospitalDTO.setScoreBn(exportExcelBehospitalDTO.getScoreBn());
|
|
|
+ exportExcelWideBehospitalDTOs.add(exportExcelWideBehospitalDTO);
|
|
|
+ });
|
|
|
+ exportWideExcelDTO.setExcelBehospitalDTOS(exportExcelWideBehospitalDTOs);
|
|
|
+ resWide.add(exportWideExcelDTO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resWide;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 时效性|稽查条目病历列表-报表
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<QcResultShortDTO> unModifyMRPage(QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
|
|
|
+ return behospitalInfoFacade.getBaseMapper().unModifyMRPage(qcResultShortPageVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 未整改病历详情页导出
|
|
|
+ *
|
|
|
+ * @param qcResultShortPageVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void unModifyMRPageExport(HttpServletResponse response, QcResultShortPageVO qcResultShortPageVO) {
|
|
|
+ String hospitalId = String.valueOf(SysUserUtils.getCurrentHospitalId());
|
|
|
+ qcResultShortPageVO.setHospitalId(hospitalId);
|
|
|
+ if (StringUtil.isNotBlank(qcResultShortPageVO.getDeptName())
|
|
|
+ && qcResultShortPageVO.getDeptName().equals("全部")) {
|
|
|
+ qcResultShortPageVO.setDeptName("");
|
|
|
+ }
|
|
|
+ Date startDate = qcResultShortPageVO.getStartDate();
|
|
|
+ Date endDate = qcResultShortPageVO.getEndDate();
|
|
|
+ //时间间隔7天
|
|
|
+ long interval = 90 * 24l * 60l * 60l * 1000l;
|
|
|
+ if (endDate.getTime() < startDate.getTime()) {
|
|
|
+ throw new ApiException("截止时间不能小于起始时间");
|
|
|
+ }
|
|
|
+ if (endDate.getTime() - startDate.getTime() > interval) {
|
|
|
+ throw new ApiException("统计区间不能大于90天");
|
|
|
+ }
|
|
|
+
|
|
|
+ qcResultShortPageVO.setCurrent(1L);
|
|
|
+ qcResultShortPageVO.setSize(Long.MAX_VALUE);
|
|
|
+ qcResultShortPageVO.setSearchCount(false);
|
|
|
+ List<ExportExcelDTO> records = behospitalInfoFacade.getBaseMapper().unModifyMRPageExport(qcResultShortPageVO);
|
|
|
+ String fileName = "未整改病历详情页.xls";
|
|
|
+ ExcelUtils.exportExcelUser(records, null, "sheet1", ExportExcelDTO.class, fileName, response);
|
|
|
+ }
|
|
|
+}
|