医疗互助补助模块1.1

This commit is contained in:
2026-09-15 09:54:47 +08:00
parent f441623aec
commit 782426a428
4 changed files with 37 additions and 13 deletions
@@ -43,13 +43,14 @@ public class MedicalMutualAidSummaryController {
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按申请提交时间所在年份过滤
* @return 汇总分页数据
*/
@At("/summary/page")
@ApiOperation("查询医疗互助汇总")
@SaCheckPermission("medicalMutualAid.apply.summary")
public Result page(PageForm pageForm, String deptName, String userName, Integer joinYear) {
return Result.success(medicalMutualAidApplyService.summaryPage(pageForm, deptName, userName, joinYear));
public Result page(PageForm pageForm, String deptName, String userName, Integer joinYear, Integer submitYear) {
return Result.success(medicalMutualAidApplyService.summaryPage(pageForm, deptName, userName, joinYear, submitYear));
}
/**
@@ -58,14 +59,15 @@ public class MedicalMutualAidSummaryController {
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按申请提交时间所在年份过滤
* @param response HTTP 响应
*/
@At("/summary/exportExcel")
@Ok("void")
@ApiOperation("导出医疗互助汇总")
@SaCheckPermission("medicalMutualAid.apply.summary")
public void exportExcel(String deptName, String userName, Integer joinYear, HttpServletResponse response) {
Workbook workbook = medicalMutualAidApplyService.exportSummary(deptName, userName, joinYear);
public void exportExcel(String deptName, String userName, Integer joinYear, Integer submitYear, HttpServletResponse response) {
Workbook workbook = medicalMutualAidApplyService.exportSummary(deptName, userName, joinYear, submitYear);
CommonDownloadUtil.download("医疗互助汇总.xlsx", workbook, response);
}
}
@@ -114,9 +114,10 @@ public interface MedicalMutualAidApplyService extends BaseService<MutualApply> {
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按提交时间所属年份过滤
* @return 汇总分页列表
*/
Pagination<NutMap> summaryPage(PageForm pageForm, String deptName, String userName, Integer joinYear);
Pagination<NutMap> summaryPage(PageForm pageForm, String deptName, String userName, Integer joinYear, Integer submitYear);
/**
* 导出医疗互助汇总,导出字段与汇总页面展示列保持一致,动态补助区间按当前查询结果生成。
@@ -124,7 +125,8 @@ public interface MedicalMutualAidApplyService extends BaseService<MutualApply> {
* @param deptName 所在单位
* @param userName 姓名
* @param joinYear 加入年份
* @param submitYear 申报年份,按提交时间所属年份过滤
* @return Excel 工作簿
*/
Workbook exportSummary(String deptName, String userName, Integer joinYear);
Workbook exportSummary(String deptName, String userName, Integer joinYear, Integer submitYear);
}
@@ -51,6 +51,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
@@ -345,8 +347,8 @@ public class MedicalMutualAidApplyServiceImpl extends BaseServiceImpl<MutualAppl
* 汇总页先返回审核通过的申请数据,并携带动态补助明细列表,前端按明细动态展示列。
*/
@Override
public Pagination<NutMap> summaryPage(PageForm pageForm, String deptName, String userName, Integer joinYear) {
Cnd cnd = buildSummaryCnd(deptName, userName, joinYear);
public Pagination<NutMap> summaryPage(PageForm pageForm, String deptName, String userName, Integer joinYear, Integer submitYear) {
Cnd cnd = buildSummaryCnd(deptName, userName, joinYear, submitYear);
Pagination<MutualApply> page = listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd.desc("auditTime"));
List<NutMap> rows = page.getList().stream()
.map(this::buildSummaryRow)
@@ -358,8 +360,8 @@ public class MedicalMutualAidApplyServiceImpl extends BaseServiceImpl<MutualAppl
* 按汇总页当前展示列导出 Excel,动态补助区间列由当前查询结果中的补助明细生成。
*/
@Override
public Workbook exportSummary(String deptName, String userName, Integer joinYear) {
List<MutualApply> applies = query(buildSummaryCnd(deptName, userName, joinYear).desc("auditTime"));
public Workbook exportSummary(String deptName, String userName, Integer joinYear, Integer submitYear) {
List<MutualApply> applies = query(buildSummaryCnd(deptName, userName, joinYear, submitYear).desc("auditTime"));
List<String> rangeNames = collectSummaryRangeNames(applies);
List<ExcelExportEntity> exportEntities = buildSummaryExportEntities(rangeNames);
List<Map<String, Object>> exportRows = buildSummaryExportRows(applies, rangeNames);
@@ -592,7 +594,7 @@ public class MedicalMutualAidApplyServiceImpl extends BaseServiceImpl<MutualAppl
/**
* 构建汇总查询条件,列表和导出共用该条件,保证页面展示与 Excel 导出数据范围一致。
*/
private Cnd buildSummaryCnd(String deptName, String userName, Integer joinYear) {
private Cnd buildSummaryCnd(String deptName, String userName, Integer joinYear, Integer submitYear) {
Cnd cnd = Cnd.where("status", "=", 1);
if (StrUtil.isNotBlank(deptName)) {
cnd.and(Cnd.likeEX("deptName", StrUtil.trim(deptName)));
@@ -603,9 +605,21 @@ public class MedicalMutualAidApplyServiceImpl extends BaseServiceImpl<MutualAppl
if (joinYear != null) {
cnd.and("joinYear", "=", joinYear);
}
if (submitYear != null) {
Date startDate = toStartDate(submitYear);
Date endDate = toStartDate(submitYear + 1);
cnd.and("submitTime", ">=", startDate).and("submitTime", "<", endDate);
}
return cnd;
}
/**
* 将年度转换为该年第一天零点时间,汇总页按提交时间区间过滤,避免在数据库字段上套函数影响索引。
*/
private Date toStartDate(Integer year) {
return Date.from(LocalDate.of(year, 1, 1).atStartOfDay(ZoneId.systemDefault()).toInstant());
}
/**
* 收集导出数据中出现过的补助区间名称,顺序按明细排序和首次出现顺序保持稳定。
*/
@@ -25,6 +25,9 @@ layout("/layouts/platform.html"){
<el-form-item label="加入年份">
<el-date-picker v-model="searchForm.joinYear" type="year" value-format="yyyy" placeholder="请选择加入年份" style="width: 220px"></el-date-picker>
</el-form-item>
<el-form-item label="申报时间">
<el-date-picker v-model="searchForm.submitYear" type="year" value-format="yyyy" placeholder="请选择申报时间" style="width: 220px"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadPage">查询</el-button>
<el-button @click="resetSearch">重置</el-button>
@@ -78,7 +81,7 @@ layout("/layouts/platform.html"){
totalCount: 0,
tableHeight: 360,
apiBase: "${base!}/platform/medicalMutualAid/apply/summary",
searchForm: { deptName: "", userName: "", joinYear: "" },
searchForm: { deptName: "", userName: "", joinYear: "", submitYear: String(new Date().getFullYear()) },
pageForm: { pageNumber: 1, pageSize: 10 }
}
},
@@ -135,7 +138,7 @@ layout("/layouts/platform.html"){
this.scheduleTableLayout()
},
resetSearch() {
this.searchForm = { deptName: "", userName: "", joinYear: "" }
this.searchForm = { deptName: "", userName: "", joinYear: "", submitYear: String(new Date().getFullYear()) }
this.pageForm.pageNumber = 1
this.loadPage()
},
@@ -150,6 +153,9 @@ layout("/layouts/platform.html"){
if (this.searchForm.joinYear) {
params.push("joinYear=" + encodeURIComponent(this.searchForm.joinYear))
}
if (this.searchForm.submitYear) {
params.push("submitYear=" + encodeURIComponent(this.searchForm.submitYear))
}
window.open(this.apiBase + "/exportExcel" + (params.length ? "?" + params.join("&") : ""))
},
formatMoney(value) {