报表导出功能

This commit is contained in:
jiangs 2026-04-10 16:29:36 +08:00
parent 35b7f74957
commit 121be10ada
5 changed files with 74 additions and 6 deletions

View File

@ -2,17 +2,22 @@ package com.transitPlatForm.transitPF.controller;
import com.transitPlatForm.common.core.controller.BaseController;
import com.transitPlatForm.common.core.page.TableDataInfo;
import com.transitPlatForm.common.utils.poi.ExcelUtil;
import com.transitPlatForm.transitPF.mapper.RegReportMapper;
import com.transitPlatForm.transitPF.pojo.DTO.RegItemVO;
import com.transitPlatForm.common.core.domain.entity.reg.RegTransitSample;
import com.transitPlatForm.transitPF.pojo.VO.ItemReportInfoVO;
import com.transitPlatForm.transitPF.pojo.VO.SampleReportInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
@ -33,7 +38,7 @@ public class RegReportController extends BaseController {
@GetMapping("/sampleTypeCount")
public TableDataInfo getSampleTypeCount(RegTransitSample regTransitSample){
startPage();
List<Map<String, Object>> sampleTypeCountList = regReportMapper.getSampleTypeCount(regTransitSample);
List<SampleReportInfoVO> sampleTypeCountList = regReportMapper.getSampleTypeCount(regTransitSample);
return getDataTable(sampleTypeCountList);
}
@ -41,7 +46,24 @@ public class RegReportController extends BaseController {
@GetMapping("/itemCount")
public TableDataInfo getItemCount(RegItemVO regItemVO){
startPage();
List<Map<String, Object>> itemCountList = regReportMapper.getItemCount(regItemVO);
List<ItemReportInfoVO> itemCountList = regReportMapper.getItemCount(regItemVO);
return getDataTable(itemCountList);
}
@ApiOperation("导出样本数据")
@PostMapping("/exportSample")
public void exportSample(HttpServletResponse response, RegTransitSample regTransitSample){
List<SampleReportInfoVO> sampleReportInfoVOList = regReportMapper.getSampleTypeCount(regTransitSample);
ExcelUtil<SampleReportInfoVO> util = new ExcelUtil<>(SampleReportInfoVO.class);
util.exportExcel(response, sampleReportInfoVOList, "样本统计数据");
}
@ApiOperation("导出项目数据")
@PostMapping("/exportItem")
public void exportItem(HttpServletResponse response, RegItemVO regItemVO){
List<ItemReportInfoVO> itemReportInfoVOList = regReportMapper.getItemCount(regItemVO);
ExcelUtil<ItemReportInfoVO> util = new ExcelUtil<>(ItemReportInfoVO.class);
util.exportExcel(response, itemReportInfoVOList, "项目统计数据");
}
}

View File

@ -2,11 +2,13 @@ package com.transitPlatForm.transitPF.mapper;
import com.transitPlatForm.transitPF.pojo.DTO.RegItemVO;
import com.transitPlatForm.common.core.domain.entity.reg.RegTransitSample;
import com.transitPlatForm.transitPF.pojo.VO.ItemReportInfoVO;
import com.transitPlatForm.transitPF.pojo.VO.SampleReportInfoVO;
import java.util.List;
import java.util.Map;
public interface RegReportMapper {
List<Map<String,Object>> getSampleTypeCount(RegTransitSample regTransitSample);
List<Map<String,Object>> getItemCount(RegItemVO regItemVO);
List<SampleReportInfoVO> getSampleTypeCount(RegTransitSample regTransitSample);
List<ItemReportInfoVO> getItemCount(RegItemVO regItemVO);
}

View File

@ -0,0 +1,24 @@
package com.transitPlatForm.transitPF.pojo.VO;
import com.transitPlatForm.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ItemReportInfoVO {
@Excel(name = "委托机构", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "委托机构")
private String SrcHospName;
@Excel(name = "收费项目代码", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "收费项目代码")
private String SrcOrderItemCode;
@Excel(name = "收费项目名称", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "收费项目名称")
private String SrcOrderItemName;
@Excel(name = "数量", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "数量")
private String sl;
@Excel(name = "金额", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "金额")
private String cost;
@Excel(name = "检测机构", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "检测机构")
private String DstHospName;
}

View File

@ -0,0 +1,20 @@
package com.transitPlatForm.transitPF.pojo.VO;
import com.transitPlatForm.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SampleReportInfoVO {
@Excel(name = "委托机构", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "委托机构")
private String srchospname;
@Excel(name = "标本代码", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "标本代码")
private String sampletypecode;
@Excel(name = "标本名称", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "标本名称")
private String sampletypename;
@Excel(name = "数量", type = Excel.Type.EXPORT, cellType = Excel.ColumnType.STRING, prompt = "数量")
private String sl;
}

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.transitPlatForm.transitPF.mapper.RegReportMapper">
<select id="getSampleTypeCount" resultType="map">
<select id="getSampleTypeCount" resultType="com.transitPlatForm.transitPF.pojo.VO.SampleReportInfoVO">
select srchospname,sampletypecode,sampletypename,count(1) as sl from reg_TransitSample
<where>
<if test="SrcHospName != null and SrcHospName !=''">and SrcHospName = #{SrcHospName}</if>
@ -15,7 +15,7 @@
group by srchospname,sampletypecode,sampletypename
</select>
<select id="getItemCount" resultType="map">
<select id="getItemCount" resultType="com.transitPlatForm.transitPF.pojo.VO.ItemReportInfoVO">
select a.SrcHospName,isnull(b.SrcOrderItemCode,b.orderitemcode) as SrcOrderItemCode,isnull(b.SrcOrderItemName,b.orderitemname) as SrcOrderItemName ,count(1) as sl,b.cost,a.DstHospName from reg_TransitSample a,reg_TransitSample_detail b where a.barcode = b.barcode
<if test="SrcHospName != null and SrcHospName !=''">and SrcHospName = #{SrcHospName}</if>
<if test="SrcOrderItemCode != null and SrcOrderItemCode !=''">and SrcOrderItemCode like '%'+#{SrcOrderItemCode}+'%' </if>