体检管理:添加确认统计报表

This commit is contained in:
2026-04-28 15:05:42 +08:00
parent 1e20367c38
commit ef903b11df
8 changed files with 309 additions and 4 deletions
@@ -189,11 +189,17 @@ public class HealthCheckupListController {
.add("auditTime", DateUtil.date())
.add("auditUser", SecurityUtil.getUserId()),
Cnd.where("projectId", "=", projectId).and("unionId", "=", unionId));
dao.update(HealthCheckupUser.class, Chain.make("isAudit", true),
Cnd.where("projectId", "=", projectId).and("unionId", "=", unionId));
} else {
dao.update(HealthCheckupUnionConfirm.class, Chain.make("isAudit", null)
.add("auditTime", null)
.add("auditUser", null),
Cnd.where("projectId", "=", projectId).and("unionId", "=", unionId));
dao.update(HealthCheckupUser.class, Chain.make("isAudit", null),
Cnd.where("projectId", "=", projectId).and("unionId", "=", unionId));
}
return Result.success();
}
@@ -0,0 +1,44 @@
package com.budwk.app.zhgh.dayofficework.healthCheckup.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupPersonConfirmStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName HealthCheckupPersonConfirmStatisticsController
* @Description 工会确认情况统计
* @Author Codex
* @Date 2026/4/28
*/
@IocBean
@Ok("json:full")
@Api(tags = "体检人员确认情况统计")
@At("/platform/healthCheckup/statistics/personconfirm")
public class HealthCheckupPersonConfirmStatisticsController {
@Inject
private HealthCheckupPersonConfirmStatisticsService healthCheckupPersonConfirmStatisticsService;
@At("")
@Ok("beetl:/platform/zhgh/dayofficework/healthCheckup/personconfirm/index.html")
@SaCheckPermission("healthCheckup.personconfirm")
public void index() {
}
@At
@ApiOperation("工会确认情况分页统计")
@SaCheckPermission("healthCheckup.personconfirm")
public Result pageData(PageForm pageForm, Integer year, String projectId, String unionId) {
// 统计报表按年度、体检项目查询,工会条件选填,统一返回分页结果供前端表格展示。
Pagination statistics = healthCheckupPersonConfirmStatisticsService.personConfirmPageData(pageForm.getPageNumber(), pageForm.getPageSize(), year, projectId, unionId);
return Result.success(statistics);
}
}
@@ -73,7 +73,6 @@ public class HealthCheckupSingleController {
public void index() {
}
@At
@ApiOperation("首页查询")
@SaCheckPermission("healthCheckup.statisticsSingle")
@@ -445,4 +444,7 @@ public class HealthCheckupSingleController {
return Result.success("不存在未体检人员");
}
}
}
@@ -101,7 +101,7 @@ public class HealthCheckupUser extends BaseModel implements Serializable {
private String personType;
@Column
@Comment("确认状态")
@Comment("确认状态(用户选择体检医院确认)")
@ColDefine(type = ColType.CHAR)
@Default("0")
private String confirmStatus;
@@ -122,5 +122,8 @@ public class HealthCheckupUser extends BaseModel implements Serializable {
@ColDefine(type = ColType.TEXT)
private String bz;
@Column
@Comment("是否确认")
@ColDefine(type = ColType.BOOLEAN)
private Boolean isAudit;
}
@@ -0,0 +1,26 @@
package com.budwk.app.zhgh.dayofficework.healthCheckup.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupUser;
/**
* @ClassName HealthCheckupPersonConfirmStatisticsService
* @Description 工会人员确认情况统计
* @Author Codex
* @Date 2026/4/28
*/
public interface HealthCheckupPersonConfirmStatisticsService extends BaseService<HealthCheckupUser> {
/**
* 工会确认情况分页统计
*
* @param pageNumber 页码
* @param pageSize 页大小
* @param year 年度
* @param projectId 体检项目
* @param unionId 工会
* @return 统计分页结果
*/
Pagination personConfirmPageData(Integer pageNumber, Integer pageSize, Integer year, String projectId, String unionId);
}
@@ -0,0 +1,60 @@
package com.budwk.app.zhgh.dayofficework.healthCheckup.service.impl;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.dayofficework.healthCheckup.model.HealthCheckupUser;
import com.budwk.app.zhgh.dayofficework.healthCheckup.service.HealthCheckupPersonConfirmStatisticsService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
/**
* @ClassName HealthCheckupPersonConfirmStatisticsServiceImpl
* @Description 工会人员确认情况统计实现
* @Author Codex
* @Date 2026/4/28
*/
@IocBean(args = {"refer:dao"})
public class HealthCheckupPersonConfirmStatisticsServiceImpl extends BaseServiceImpl<HealthCheckupUser> implements HealthCheckupPersonConfirmStatisticsService {
public HealthCheckupPersonConfirmStatisticsServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination personConfirmPageData(Integer pageNumber, Integer pageSize, Integer year, String projectId, String unionId) {
// 统计以系统工会为主表,保证未报名的工会也会显示在列表中。
Sql sql = Sqls.create("""
SELECT
su.id AS unionId,
su.name AS unionName,
COUNT(CASE WHEN hcp.id IS NOT NULL THEN hcu.id END) AS totalCount,
SUM(CASE WHEN hcp.id IS NOT NULL AND hcu.isAudit = '1' THEN 1 ELSE 0 END) AS confirmedCount,
SUM(CASE WHEN hcp.id IS NOT NULL AND hcu.id IS NOT NULL AND (hcu.isAudit IS NULL OR hcu.isAudit <> '1') THEN 1 ELSE 0 END) AS unconfirmedCount,
CASE
WHEN COUNT(CASE WHEN hcp.id IS NOT NULL THEN hcu.id END) > 0
AND COUNT(CASE WHEN hcp.id IS NOT NULL THEN hcu.id END) = SUM(CASE WHEN hcp.id IS NOT NULL AND hcu.isAudit = '1' THEN 1 ELSE 0 END) THEN '已完成'
ELSE '未完成'
END AS completeStatus
FROM sys_union su
LEFT JOIN health_checkup_user hcu ON hcu.unionId = su.id
AND hcu.delFlag = 0
AND hcu.projectId = @projectId
LEFT JOIN health_checkup_project hcp ON hcp.id = hcu.projectId
AND hcp.delFlag = 0
AND hcp.year = @year
$condition
""").setParam("projectId", projectId).setParam("year", year);
Cnd cnd = Cnd.NEW();
cnd.andEX("su.id", "=", unionId);
cnd.groupBy("su.id,su.name");
cnd.asc("completeStatus");
cnd.asc("su.unionCode");
sql.setCondition(cnd);
// isAudit 存在于 health_checkup_user 中,只要还有未确认人员,该工会状态就显示未完成。
// 排序按报名总人数倒序,人数相同时再按工会编码升序,保证列表顺序稳定。
return listPageMap(pageNumber, pageSize, sql);
}
}
@@ -127,7 +127,6 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl<HealthChecku
return listMap(sql);
}
@Override
public List<NutMap> receivePageDataColumns(String projectId) {
List<NutMap> labelList = new ArrayList<>();
@@ -0,0 +1,165 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div class="platform" id="app" v-cloak>
<guava ref="guava">
<el-card shadow="never">
<search @search="doSearch">
<search-item label="年度">
<el-date-picker
clearable
@change="yearChange"
placeholder="选择年"
style="width: 100%;"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</search-item>
<search-item label="体检项目">
<el-select @change="doSearch"
clearable
style="width: 100%;"
v-model="pageForm.projectId">
<el-option :key="item.id" :label="item.name" :value="item.id"
v-for="item in projectOptions"></el-option>
</el-select>
</search-item>
<search-item label="所属工会">
<el-select placeholder="请选择所属工会"
v-model="pageForm.unionId"
style="width: 100%;"
:clearable="clearable"
filterable
@change="doSearch">
<el-option v-for="item in unions"
:label="item.name"
:value="item.id"
:key="item.id"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="工会确认情况统计"></table-tool>
<el-table :data="tableData"
:size="tableSize"
@sort-change="pageOrder"
class="vi-table"
ref="table"
row-key="unionId"
style="width: 100%"
v-loading="tableLoading">
<el-table-column label="序号" type="index" width="80px" :index="indexMethod" align="center" header-align="center"></el-table-column>
<el-table-column
v-for="column in tableColumns"
:key="column.prop"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
min-width="120px"
show-overflow-tooltip>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
</div>
<script>
new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
clearable: false,
tableData: [],
unions: [],
projectOptions: [],
pageForm: {
year: moment().format('YYYY'),
projectId: '',
unionId: '',
pageNumber: 1,
pageSize: 10,
totalCount: 0
},
tableColumns: [
{prop: 'unionName', label: '工会名称'},
{prop: 'totalCount', label: '体检总人数'},
{prop: 'confirmedCount', label: '已确认总人数'},
{prop: 'unconfirmedCount', label: '未确认总人数'},
{prop: 'completeStatus', label: '确认完成状态'}
],
}
},
methods: {
yearChange() {
// 年度切换后重新加载该年度下的体检项目,并默认定位到第一条可用项目。
return this.$axios.post('/platform/healthCheckup/project/mange/getHealthCheckupProject', {year: this.pageForm.year}).then((resp) => {
if (resp.code === 0) {
this.projectOptions = resp.data || []
if (this.projectOptions.length > 0) {
this.$set(this.pageForm, 'projectId', this.projectOptions[0].id)
} else {
this.$set(this.pageForm, 'projectId', '')
}
this.doSearch()
} else {
this.notifyError(resp.msg)
}
})
},
pageData() {
if (!this.pageForm.year || !this.pageForm.projectId) {
this.tableData = []
this.pageForm.totalCount = 0
return Promise.resolve()
}
this.tableLoading = true
return this.$axios.post(loc() + '/pageData', this.pageForm).then((resp) => {
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
this.$nextTick(function () {
if (this.$refs.table) {
this.$refs.table.doLayout()
}
})
} else {
this.notifyError(resp.msg)
}
}).finally(() => {
this.tableLoading = false
})
},
doSearch() {
this.pageForm.pageNumber = 1
return this.pageData()
},
async init() {
if (this.$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN'])) {
this.unions = await this.$businessTool.listUnion()
this.clearable = true
} else {
// 普通工会管理员只查询本人所属工会,避免跨工会查看统计数据。
this.unions = await this.$businessTool.listUnion(this.$store.state.user.union.id)
if (this.unions && this.unions.length > 0) {
this.$set(this.pageForm, 'unionId', this.unions[0].id)
}
}
await this.yearChange()
}
},
created() {
this.init()
}
})
</script>
<!--#
}
#-->