|
@@ -1,7 +1,5 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
-import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -24,10 +22,8 @@ import com.diagbot.entity.SysHospitalSet;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
-import com.diagbot.util.EntityUtil;
|
|
|
|
import com.diagbot.util.ExcelUtils;
|
|
import com.diagbot.util.ExcelUtils;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
-import com.diagbot.util.ObjectUtil;
|
|
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.util.SysUserUtils;
|
|
import com.diagbot.vo.EntryStatisticsVO;
|
|
import com.diagbot.vo.EntryStatisticsVO;
|
|
@@ -37,19 +33,13 @@ import com.diagbot.vo.FilterPageVO;
|
|
import com.diagbot.vo.FilterUnModifyMRVO;
|
|
import com.diagbot.vo.FilterUnModifyMRVO;
|
|
import com.diagbot.vo.QcResultShortPageVO;
|
|
import com.diagbot.vo.QcResultShortPageVO;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
-import java.io.IOException;
|
|
|
|
-import java.net.URLEncoder;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 报表导出装饰层
|
|
* @Description: 报表导出装饰层
|
|
@@ -325,63 +315,40 @@ public class ConsoleExportFacade {
|
|
* @param filterUnModifyMRVO
|
|
* @param filterUnModifyMRVO
|
|
*/
|
|
*/
|
|
public void unModifyMRStatisticsExport(HttpServletResponse response, FilterUnModifyMRVO filterUnModifyMRVO) {
|
|
public void unModifyMRStatisticsExport(HttpServletResponse response, FilterUnModifyMRVO filterUnModifyMRVO) {
|
|
- try {
|
|
|
|
- filterFacade.filterUnModifyMRVOSet(filterUnModifyMRVO);
|
|
|
|
- List<ExcelExportEntity> colList = Lists.newLinkedList();
|
|
|
|
|
|
+ filterFacade.filterUnModifyMRVOSet(filterUnModifyMRVO);
|
|
|
|
+ List<ExcelExportEntity> colList = Lists.newLinkedList();
|
|
/* ExcelExportEntity deptIdCol = new ExcelExportEntity("科室编码", "deptId");
|
|
/* ExcelExportEntity deptIdCol = new ExcelExportEntity("科室编码", "deptId");
|
|
deptIdCol.setWidth(20);
|
|
deptIdCol.setWidth(20);
|
|
colList.add(deptIdCol);*/
|
|
colList.add(deptIdCol);*/
|
|
- ExcelExportEntity deptNameCol = new ExcelExportEntity("科室名称", "deptName");
|
|
|
|
- deptNameCol.setWidth(50);
|
|
|
|
- colList.add(deptNameCol);
|
|
|
|
|
|
+ ExcelExportEntity deptNameCol = new ExcelExportEntity("科室名称", "deptName");
|
|
|
|
+ deptNameCol.setWidth(50);
|
|
|
|
+ colList.add(deptNameCol);
|
|
|
|
|
|
- QueryWrapper<SysHospitalSet> hospitalSetQueryWrapper = new QueryWrapper<>();
|
|
|
|
- hospitalSetQueryWrapper.eq("is_deleted", 'N')
|
|
|
|
- .eq("hospital_id", filterUnModifyMRVO.getHospitalId())
|
|
|
|
- .eq("code", "unmodify_mr_entry");
|
|
|
|
- SysHospitalSet hospitalSet = sysHospitalSetFacade.getOne(hospitalSetQueryWrapper);
|
|
|
|
- //缺陷条目未维护
|
|
|
|
- if (hospitalSet == null || StringUtil.isBlank(hospitalSet.getValue())) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "未整改病历条目未设置");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<String> columnSet = Arrays.asList(hospitalSet.getValue().split(","));
|
|
|
|
- for (String valueStr : columnSet) {
|
|
|
|
- String[] keyValue = valueStr.split("--");
|
|
|
|
- if (keyValue != null || keyValue.length > 1) {
|
|
|
|
- ExcelExportEntity entryCol = new ExcelExportEntity(keyValue[1], "entry_" + keyValue[0] + "_num");
|
|
|
|
- entryCol.setWidth(20);
|
|
|
|
- colList.add(entryCol);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ QueryWrapper<SysHospitalSet> hospitalSetQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ hospitalSetQueryWrapper.eq("is_deleted", 'N')
|
|
|
|
+ .eq("hospital_id", filterUnModifyMRVO.getHospitalId())
|
|
|
|
+ .eq("code", "unmodify_mr_entry");
|
|
|
|
+ SysHospitalSet hospitalSet = sysHospitalSetFacade.getOne(hospitalSetQueryWrapper);
|
|
|
|
+ //缺陷条目未维护
|
|
|
|
+ if (hospitalSet == null || StringUtil.isBlank(hospitalSet.getValue())) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "未整改病历条目未设置");
|
|
|
|
+ }
|
|
|
|
|
|
- Map<String, String> keyNameMap = EntityUtil.makeMapWithKeyValue(colList, "key", "name");
|
|
|
|
- UnModifyMRDTO unModifyMRDTO = consoleFacade.unModifyMRStatistics(filterUnModifyMRVO);
|
|
|
|
- List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
|
|
|
- List<Object> data = Lists.newLinkedList();
|
|
|
|
- if (unModifyMRDTO != null && ListUtil.isNotEmpty(unModifyMRDTO.getData())) {
|
|
|
|
- data = unModifyMRDTO.getData();
|
|
|
|
- //存储表格中的每一行数据
|
|
|
|
- Map<String, Object> valMap = null;
|
|
|
|
- for (Object obj : data) {
|
|
|
|
- valMap = new HashMap<>(colList.size());
|
|
|
|
- for (Map.Entry<String, String> keyName : keyNameMap.entrySet()) {
|
|
|
|
- valMap.put(keyName.getKey(), ObjectUtil.getValueByKey(obj, keyName.getKey()));
|
|
|
|
- }
|
|
|
|
- list.add(valMap);
|
|
|
|
- }
|
|
|
|
|
|
+ List<String> columnSet = Arrays.asList(hospitalSet.getValue().split(","));
|
|
|
|
+ for (String valueStr : columnSet) {
|
|
|
|
+ String[] keyValue = valueStr.split("--");
|
|
|
|
+ if (keyValue != null || keyValue.length > 1) {
|
|
|
|
+ ExcelExportEntity entryCol = new ExcelExportEntity(keyValue[1], "entry_" + keyValue[0] + "_num");
|
|
|
|
+ entryCol.setWidth(20);
|
|
|
|
+ colList.add(entryCol);
|
|
}
|
|
}
|
|
- Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, "sheet1"), colList,
|
|
|
|
- list);
|
|
|
|
- response.setCharacterEncoding("UTF-8");
|
|
|
|
- response.setHeader("content-Type", "application/vnd.ms-excel");
|
|
|
|
- String fileName = "未整改病历统计.xls";
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
|
|
|
- workbook.write(response.getOutputStream());
|
|
|
|
- workbook.close();
|
|
|
|
-
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导出Excel异常");
|
|
|
|
}
|
|
}
|
|
|
|
+ UnModifyMRDTO unModifyMRDTO = consoleFacade.unModifyMRStatistics(filterUnModifyMRVO);
|
|
|
|
+ List<Object> data = Lists.newLinkedList();
|
|
|
|
+ if (unModifyMRDTO != null && ListUtil.isNotEmpty(unModifyMRDTO.getData())) {
|
|
|
|
+ data = unModifyMRDTO.getData();
|
|
|
|
+ }
|
|
|
|
+ String fileName = "未整改病历统计.xls";
|
|
|
|
+ ExcelUtils.exportExcelDynamicCol(colList, data, null, "sheet1", fileName, response);
|
|
}
|
|
}
|
|
}
|
|
}
|