Forráskód Böngészése

add: 审核端-审核列表导出

Scott 1 éve
szülő
commit
09426a1838

+ 49 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/common/bo/AfterwardsAuditExportResponse.java

@@ -0,0 +1,49 @@
+package org.jeecg.modules.medical.common.bo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @author yaowei
+ * @time 2023/11/14 20:55 星期二
+ * @description '这里写类描述'
+ * @parentProject medical-java
+ */
+@Data
+public class AfterwardsAuditExportResponse implements Serializable {
+    @Excel(name = "住院号", width = 15)
+    @ApiModelProperty(value = "住院号/门诊号")
+    private java.lang.String outpatientNumber;
+
+    @Excel(name = "患者姓名", width = 15)
+    @ApiModelProperty(value = "患者姓名")
+    private java.lang.String patientName;
+
+    @Excel(name = "出院科室", width = 15)
+    @ApiModelProperty(value = "科室名称")
+    private java.lang.String medicalDeptName;
+
+    @Excel(name = "主治医生", width = 15)
+    @ApiModelProperty(value = "医生姓名")
+    private java.lang.String doctorName;
+
+    @Excel(name = "异常多收", width = 15)
+    @ApiModelProperty(value = "异常多收")
+    private BigDecimal errorRelativelyManyAmt;
+
+    @Excel(name = "异常少收", width = 15)
+    private BigDecimal errorRelativelyFewAmt;
+
+    @Excel(name = "审核来源", width = 15)
+    @ApiModelProperty(value = "资料来源")
+    private String auditSource;
+
+    @Excel(name = "审核", width = 15)
+    @ApiModelProperty(value = "审核状态: wait=待分配; process=处理中; finish=已完成")
+    private java.lang.String checkState;
+}

+ 12 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/AfterwardsAuditController.java

@@ -31,6 +31,7 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -69,6 +70,17 @@ public class AfterwardsAuditController extends JeecgController<AfterwardsAudit,
 		 return Result.OK(pageList);
 	 }
 
+	@ApiOperation(value="审核-审核列表导出", notes="审核列表导出")
+	@RequestMapping(value = "/audit/exportXls")
+	public ModelAndView auditExportXls(HttpServletRequest req, AfterwardsAudit afterwardsAudit) {
+		try {
+			return afterwardsAuditService.auditExportXls(req, afterwardsAudit, AfterwardsAuditExportResponse.class, "审核-审核列表");
+//			return violationAnalysisService.midViolateRuleExportXls(req, medicalInsRuleInfoName, projectType,startTime, endTime, MidAuditDetailResponse.class, "事中-规则类型统计");
+		} catch (UnsupportedEncodingException e) {
+			throw new RuntimeException(e);
+		}
+	}
+
 
 
 

+ 4 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/controller/ViolationAnalysisController.java

@@ -25,6 +25,7 @@ import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
 import org.jeecg.modules.medical.service.IAfterwardsAuditDetailService;
 import org.jeecg.modules.medical.service.IAfterwardsAuditService;
 import org.jeecg.modules.medical.service.IViolationAnalysisService;
+import org.jeecg.modules.medical.service.impl.ExportUtilHelperService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -54,6 +55,8 @@ public class ViolationAnalysisController {
     @Autowired
     private IViolationAnalysisService violationAnalysisService;
     @Autowired
+    private ExportUtilHelperService exportUtilHelperService;
+    @Autowired
     private IAdvanceWarningAuditService advanceWarningAuditService;
     @Autowired
     private IAfterwardsAuditService afterwardsAuditService;
@@ -345,7 +348,7 @@ public class ViolationAnalysisController {
                 );
             }
             List<AfterwardsAuditDetail> exportList = afterwardsAuditDetailService.list(queryWrapper);
-            return violationAnalysisService.commonExportXml(item -> AfterwardsAuditDetail.class, "事后-全院稽核统计", exportList);
+            return exportUtilHelperService.commonExportXml(item -> AfterwardsAuditDetail.class, "事后-全院稽核统计", exportList);
         } catch (UnsupportedEncodingException e) {
             throw new RuntimeException(e);
         }

+ 8 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IAfterwardsAuditService.java

@@ -16,7 +16,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
 import org.jeecg.modules.medical.entity.MedicalDoctorAppealRecord;
 import org.jeecg.modules.medical.entity.PrescriptionOrder;
+import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.util.List;
 
@@ -48,6 +51,8 @@ public interface IAfterwardsAuditService extends IService<AfterwardsAudit> {
      */
     IPage<AfterwardsAudit> auditQueryListPage(Page<AfterwardsAudit> page, QueryWrapper<AfterwardsAudit> queryWrapper);
 
+    List<AfterwardsAuditExportResponse> auditQueryList(QueryWrapper<AfterwardsAudit> queryWrapper);
+
     boolean audit(LoginUser loginUser, AuditRequestBO param);
 
     DeptAuditResponse deptAuditPanel(String loginUserName, String doctorName);
@@ -122,4 +127,7 @@ public interface IAfterwardsAuditService extends IService<AfterwardsAudit> {
     BigDecimal statisticsAfterAuditTotal(AfterDeptDetailRequest afterwardsAuditDetail);
 
 
+    ModelAndView auditExportXls(HttpServletRequest req, AfterwardsAudit afterwardsAudit, Class<AfterwardsAuditExportResponse> clazz, String title) throws UnsupportedEncodingException;
+
+
 }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/IViolationAnalysisService.java

@@ -78,7 +78,7 @@ public interface IViolationAnalysisService {
      * @param advanceWarningAuditDetail
      * @return
      */
-    ModelAndView commonExportXml(BiFunction<?, Class<?>> biFunction, String title, List<?> exportList) throws UnsupportedEncodingException;
+    /*ModelAndView commonExportXml(BiFunction<?, Class<?>> biFunction, String title, List<?> exportList) throws UnsupportedEncodingException;*/
 
     ModelAndView auditMidDetailExportXml(HttpServletRequest req, AuditMidDetailListRequest request, Class<AuditMidDetailListResponse> auditMidDetailListResponseClass, String 事中审查统计) throws UnsupportedEncodingException;
 

+ 57 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/AfterwardsAuditServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.medical.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.medical.common.bo.*;
@@ -24,10 +26,7 @@ import org.jeecg.modules.medical.entity.MedicalDoctorAppealRecord;
 import org.jeecg.modules.medical.entity.PrescriptionOrder;
 import org.jeecg.modules.medical.mapper.AfterwardsAuditMapper;
 import org.jeecg.modules.medical.ruleengine.projectcache.HisMedicalProjectCache;
-import org.jeecg.modules.medical.service.IAfterwardsAuditDetailService;
-import org.jeecg.modules.medical.service.IAfterwardsAuditService;
-import org.jeecg.modules.medical.service.IMedicalDoctorAppealRecordService;
-import org.jeecg.modules.medical.service.IPrescriptionOrderService;
+import org.jeecg.modules.medical.service.*;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.entity.SysUserDepart;
@@ -44,7 +43,10 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.web.servlet.ModelAndView;
 
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
@@ -73,6 +75,7 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
 
     private final IAfterwardsAuditDetailService afterwardsAuditDetailService;
     private final IPrescriptionOrderService prescriptionOrderService;
+    private final ExportUtilHelperService exportUtilHelperService;
 
     @Override
     public IPage<ReportAfterQueryResponseBO> departmentStatistics(Page<AfterwardsAudit> page, AfterwardsAudit afterwardsAudit) {
@@ -122,6 +125,41 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
         return auditQueryPageList;
     }
 
+    @Override
+    public List<AfterwardsAuditExportResponse> auditQueryList(QueryWrapper<AfterwardsAudit> queryWrapper) {
+        List<AfterwardsAudit> dataList = this.list(queryWrapper); // TODO 待审核状态默认是空,需要查询为空
+        List<AfterwardsAuditExportResponse> resultList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(dataList)) {
+            resultList = dataList.stream().map(item -> {
+                AfterwardsAuditExportResponse resultItem = new AfterwardsAuditExportResponse();
+                // 计算异常多收-少收
+/*                BigDecimal detailTotalAmt = baseMapper.statisticsErrAmtByAfterwareRecordId(item.getId());
+                item.setErrorRelativelyFewAmt(new BigDecimal("0.00"));
+                item.setErrorRelativelyManyAmt(new BigDecimal("0.00"));
+                if (!StringUtils.hasText(item.getCheckState())) {
+                    item.setCheckState(AfterwardsAuditStatusEnum.wait.getStatus());
+                }
+                if (null != detailTotalAmt) {
+                    if (detailTotalAmt.compareTo(BigDecimal.ZERO) > 0) { // 异常金额大于0,就是多收
+                        item.setErrorRelativelyManyAmt(detailTotalAmt);
+                    } else if (detailTotalAmt.compareTo(BigDecimal.ZERO) < 0) {
+                        item.setErrorRelativelyFewAmt(detailTotalAmt);
+                    }
+                }*/
+                int appealNumber = 0;
+                MedicalDoctorAppealRecord appealRecord = appealRecordService.loadMaxAppealNumber(item.getId(), item.getMedicalDeptCode(), item.getDoctorId());
+                if (null != appealRecord && appealRecord.getAppealNumber() != null) {
+                    appealNumber = appealRecord.getAppealNumber();
+                }
+                item.setAuditNumber(appealNumber);
+                BeanUtil.copyProperties(item, resultItem);
+
+                return resultItem;
+            }).collect(Collectors.toList());
+        }
+        return resultList;
+    }
+
     @Transactional(readOnly = false)
     @Override
     public boolean audit(LoginUser loginUser, AuditRequestBO param) {
@@ -563,4 +601,19 @@ public class AfterwardsAuditServiceImpl extends ServiceImpl<AfterwardsAuditMappe
         return baseMapper.statisticsAfterAuditTotal(afterwardsAuditDetail);
     }
 
+    @Override
+    public ModelAndView auditExportXls(HttpServletRequest req, AfterwardsAudit afterwardsAudit, Class<AfterwardsAuditExportResponse> clazz, String title) throws UnsupportedEncodingException {
+
+        String checkState = afterwardsAudit.getCheckState();
+        if (ObjectUtils.nullSafeEquals(AfterwardsAuditStatusEnum.wait.getStatus(),afterwardsAudit.getCheckState())) {
+            afterwardsAudit.setCheckState(null);
+        }
+        QueryWrapper<AfterwardsAudit> queryWrapper = QueryGenerator.initQueryWrapper(afterwardsAudit, req.getParameterMap());
+        if (ObjectUtils.nullSafeEquals(AfterwardsAuditStatusEnum.wait.getStatus() ,checkState)) {
+            queryWrapper.and(q -> q.isNull( "check_state").or().eq( "check_state", "wait"));
+        }
+        List<AfterwardsAuditExportResponse> exportList = this.auditQueryList(queryWrapper);
+        // 获取数据
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
+    }
 }

+ 57 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/ExportUtilHelperService.java

@@ -0,0 +1,57 @@
+package org.jeecg.modules.medical.service.impl;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.medical.BiFunction;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
+
+/**
+ * @author Scott
+ * @time 2023/11/14 21:25 星期二
+ * @description 'Excel结合jeecg导出服务'
+ * @parentProject medical-java
+ */
+@Slf4j
+@Service
+public class ExportUtilHelperService {
+
+    @Value("${jeecg.path.upload}")
+    protected String upLoadPath;
+    public ModelAndView commonExportXml(BiFunction<?, Class<?>> biFunction, String title, List<?> exportList) throws UnsupportedEncodingException {
+        // Step.1 组装查询条件
+//        QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        // Step.2 获取导出数据
+//        List<T> exportList = service.list(queryWrapper);
+
+        final String noCodeTitle = title + "模板";
+        title = URLEncoder.encode(title, "UTF-8");
+
+        Class<?> process = biFunction.process(null);
+
+        // Step.3 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        //此处设置的filename无效 ,前端会重更新设置一下
+        mv.addObject(NormalExcelConstants.FILE_NAME, title);
+        mv.addObject(NormalExcelConstants.CLASS, process);
+        //update-begin--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
+        ExportParams exportParams=new ExportParams(noCodeTitle + "报表", "导出人:" + sysUser.getRealname(), noCodeTitle);
+        exportParams.setImageBasePath(upLoadPath);
+        exportParams.setType(ExcelType.XSSF);
+        //update-end--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
+        mv.addObject(NormalExcelConstants.PARAMS,exportParams);
+        mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
+        return mv;
+    }
+}

+ 11 - 9
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/service/impl/ViolationAnalysisServiceImpl.java

@@ -76,6 +76,8 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
 
     @Autowired
     private IPrescriptionOrderService prescriptionOrderService;
+    @Autowired
+    private ExportUtilHelperService exportUtilHelperService;
 
     @Value("${jeecg.path.upload}")
     protected String upLoadPath;
@@ -393,7 +395,7 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
 
     }
 
-    @Override
+    /*@Override
     public ModelAndView commonExportXml(BiFunction<?, Class<?>> biFunction, String title, List<?> exportList) throws UnsupportedEncodingException {
         // Step.1 组装查询条件
 //        QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
@@ -419,12 +421,12 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
         mv.addObject(NormalExcelConstants.PARAMS,exportParams);
         mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
         return mv;
-    }
+    }*/
 
     @Override
     public ModelAndView auditMidDetailExportXml(HttpServletRequest req, AuditMidDetailListRequest request, Class<AuditMidDetailListResponse> clazz, String title) throws UnsupportedEncodingException {
         List<AuditMidDetailListResponse> exportList = midIncidentAuditService.loadMidAuditPageList(request);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     @Override
@@ -434,38 +436,38 @@ public class ViolationAnalysisServiceImpl implements IViolationAnalysisService {
         String startTime = request.getStartTime();
         String endTime = request.getEndTime();
         List<MidDeptAuditDetailResponse> exportList = midIncidentAuditDetailService.midDeptAuditList(medicalDeptCode, deptName, startTime, endTime);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     @Override
     public ModelAndView midViolateProjectExportXml(HttpServletRequest req, String projectSearch, String startTime, String endTime, Class<MidAuditViolateProjectStatisticsResponse> clazz, String title) throws UnsupportedEncodingException {
         List<MidAuditViolateProjectStatisticsResponse> exportList = midIncidentAuditDetailService.violateProjectStatisticsList(projectSearch, startTime, endTime);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     @Override
     public ModelAndView midViolateRuleExportXls(HttpServletRequest req, String medicalInsRuleInfoName, String projectType, String startTime, String endTime, Class<MidAuditDetailResponse> clazz, String title) throws UnsupportedEncodingException {
         List<MidAuditDetailResponse> exportList = midIncidentAuditDetailService.midViolateRuleTypePageList(medicalInsRuleInfoName, projectType, startTime, endTime);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
 
     @Override
     public ModelAndView afterDeptExportXls(HttpServletRequest req, AfterwardsAudit afterwardsAudit, Class<ReportAfterQueryResponseBO> clazz, String title) throws UnsupportedEncodingException {
         List<ReportAfterQueryResponseBO> exportList = afterwardsAuditService.departmentStatistics(afterwardsAudit);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     @Override
     public ModelAndView afterProjectExportXls(HttpServletRequest req, String projectCode, String medicalProjectSearch, String startTime, String endTime, Class<MidAuditViolateProjectStatisticsResponse> clazz, String title) throws UnsupportedEncodingException {
         List<MidAuditViolateProjectStatisticsResponse> exportList = afterwardsAuditDetailService.afterViolateProjectStatisticsList(projectCode, medicalProjectSearch, startTime, endTime);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     @Override
     public ModelAndView afterViolateRuleExportXls(HttpServletRequest req, String medicalInsRuleInfoName, String projectType, String startTime, String endTime, Class<MidAuditDetailResponse> clazz, String title) throws UnsupportedEncodingException {
         List<MidAuditDetailResponse> exportList = midIncidentAuditDetailService.afterViolateRuleTypePageList(medicalInsRuleInfoName, projectType, startTime, endTime);
-        return this.commonExportXml(item -> clazz, title, exportList);
+        return exportUtilHelperService.commonExportXml(item -> clazz, title, exportList);
     }
 
     //    @Override