一、项目背景:后疫情时代的校园健康管理革新
自2019年新冠疫情爆发以来,校园疫情防控已成为教育系统面临的重要挑战。据统计,全国各级学校每日需要处理数以万计的健康数据,传统的人工登记、纸质报表方式效率低下且易出错。在常态化疫情防控背景下,85%的学校管理者期待通过数字化手段实现精准、高效的疫情管控。
基于Spring Boot的校园疫情防控系统应运而生,系统采用轻量级B/S架构,整合健康监测、出入管理、请假审批、疫情知识普及等全场景服务,构建"管理员监管-学生自主-数据联动"的智能化防控体系,为校园疫情防控提供数字化解决方案,确保师生健康安全。
二、技术架构:校园疫情防控系统的全栈技术选型
项目以"实时性、准确性、安全性"为核心设计理念,采用业界成熟的Java Web技术栈,确保系统稳定运行与快速响应:
| 技术模块 | 具体工具/技术 | 核心作用 |
|---|---|---|
| 后端框架 | Spring Boot 2.x | 快速构建微服务,简化配置,提供完整MVC解决方案 |
| 数据库 | MySQL 8.0 + Redis | MySQL存储业务数据,Redis缓存热点数据和会话信息 |
| 前端技术 | JSP + Bootstrap + JavaScript | 构建响应式界面,适配多终端,优化用户体验 |
| 架构模式 | B/S结构 | 跨平台访问,无需安装客户端,浏览器直接使用 |
| 消息队列 | RabbitMQ | 处理高并发健康数据上报,实现异步削峰 |
| 服务器 | Tomcat 9.0 + Nginx | Tomcat处理业务,Nginx实现负载均衡 |
| 开发工具 | MyEclipse + Navicat | 集成开发环境与数据库管理工具 |
三、项目全流程:6步完成校园疫情防控系统开发
3.1 第一步:需求分析——明确系统核心价值
传统校园疫情防控存在"数据分散、流程繁琐、响应滞后"三大痛点,本系统聚焦"精准、高效、智能",核心需求分为功能性与非功能性两类:
3.1.1 功能性需求
-
双角色权限体系
- 管理员:首页、个人中心、核酸检测管理、体温状态管理、学生管理、学生状态管理、休假申请管理、出入登记管理、疫情知识管理、论坛管理、系统管理;
- 学生:首页、个人中心、学生状态管理、休假申请管理、出入登记管理;
- 前台首页:首页、出入登记、疫情知识、论坛信息、疫情公告、个人中心、后台管理、客服。
-
核心防控功能
- 健康监测:体温状态管理、核酸检测记录、身体状况上报;
- 出入管理:出入登记审批、实时体温记录、行程轨迹追踪;
- 请假管理:休假申请、行程报备、审批流程;
- 知识普及:疫情知识发布、防控指南、政策宣传。
-
应急处理功能
- 异常预警:体温异常、核酸异常自动预警;
- 快速溯源:密接人员快速排查、行程轨迹分析;
- 数据统计:健康数据可视化、疫情态势分析。
3.1.2 非功能性需求
- 系统性能:支持千级用户并发访问,数据上报响应时间<1秒;
- 数据安全:学生健康信息加密存储,权限分级管理;
- 系统可用:99.9%的系统可用性,完善的应急处理机制;
- 实时性:健康数据实时更新,异常情况即时告警。
3.2 第二步:系统设计——构建整体架构
系统采用微服务架构模式,确保各服务模块独立部署、弹性伸缩:
3.2.1 系统总体架构
-
接入层
- API网关:统一入口、身份认证、请求路由;
- 负载均衡:Nginx分发请求,保障系统高可用。
-
业务服务层
- 用户服务:学生信息管理、权限控制;
- 健康服务:体温监测、核酸数据管理;
- 审批服务:出入登记、休假申请审批;
- 消息服务:通知推送、预警提醒。
-
数据支撑层
- MySQL:业务数据持久化存储;
- Redis:热点数据缓存、会话管理;
- Elasticsearch:日志检索、数据统计分析。
3.2.2 核心数据库设计
系统设计多个核心业务表,确保疫情防控数据的完整性和追溯性:
| 表名 | 核心字段 | 作用 |
|---|---|---|
| xuesheng(学生表) | id、xuehao、mima、xueshengxingming、xingbie、touxiang、zhuanye、banji、zhuzhishengfen、shiji、xianqu、shouji、youxiang | 存储学生基本信息与健康档案 |
| xueshengzhuangtai(学生状态表) | id、xuehao、xueshengxingming、xingbie、touxiang、shouji、shentizhuangtai、hesuanjiance、hesuanzhuangtai、tiwen、tiwenzhuangtai、gengxinriqi | 存储学生健康状态数据 |
| churudengji(出入登记表) | id、dengjibiaoti、dengjileixing、dengjineirong、dengjishijian、beizhu、xuehao、xueshengxingming、xingbie、touxiang、shishitiwen、shouji、banji、zhuanye、sfsh、shhf | 存储学生出入校园记录 |
| xiujiashenqing(休假申请表) | id、shenqingbianhao、shenqingbiaoti、shenqingneirong、xiujiatianshu、xingchengchengshi、tujingchengshi、shenqingriqi、beizhu、xuehao、xueshengxingming、touxiang、zhuanye、banji、shouji、sfsh、shhf | 存储学生请假申请记录 |
3.3 第三步:后端核心功能实现——Spring Boot架构
基于Spring Boot框架实现系统核心功能,重点解决"健康监测""出入管理""应急处理"等核心业务场景:
3.3.1 健康状态管理功能实现
@RestController
@RequestMapping("/api/health")
public class HealthStatusController {
@Autowired
private HealthStatusService healthStatusService;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
/**
* 学生上报健康状态
*/
@PostMapping("/report")
public ResponseEntity<?> reportHealthStatus(@RequestBody HealthReportDTO reportDTO) {
try {
// 参数验证
if (StringUtils.isEmpty(reportDTO.getXuehao()) ||
reportDTO.getTiwen() == null) {
return ResponseEntity.badRequest().body("学号和体温不能为空");
}
// 体温异常预警
if (reportDTO.getTiwen() > 37.3) {
// 发送预警通知
healthStatusService.sendTemperatureAlert(reportDTO);
}
HealthStatus healthStatus = new HealthStatus();
healthStatus.setXuehao(reportDTO.getXuehao());
healthStatus.setXueshengxingming(reportDTO.getXueshengxingming());
healthStatus.setXingbie(reportDTO.getXingbie());
healthStatus.setTouxiang(reportDTO.getTouxiang());
healthStatus.setShouji(reportDTO.getShouji());
healthStatus.setShentizhuangtai(reportDTO.getShentizhuangtai());
healthStatus.setHesuanjiance(reportDTO.getHesuanjiance());
healthStatus.setHesuanzhuangtai(reportDTO.getHesuanzhuangtai());
healthStatus.setTiwen(reportDTO.getTiwen());
healthStatus.setTiwenzhuangtai(calculateTemperatureStatus(reportDTO.getTiwen()));
healthStatus.setGengxinriqi(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
healthStatus.setAddtime(new Date());
healthStatusService.saveHealthStatus(healthStatus);
// 更新缓存
String cacheKey = "health_status:" + reportDTO.getXuehao();
redisTemplate.opsForValue().set(cacheKey, healthStatus, Duration.ofHours(1));
return ResponseEntity.ok("健康状态上报成功");
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("健康状态上报失败:" + e.getMessage());
}
}
/**
* 获取学生健康状态
*/
@GetMapping("/status/{xuehao}")
public ResponseEntity<?> getHealthStatus(@PathVariable String xuehao) {
try {
// 先查缓存
String cacheKey = "health_status:" + xuehao;
HealthStatus cachedStatus = (HealthStatus) redisTemplate.opsForValue().get(cacheKey);
if (cachedStatus != null) {
return ResponseEntity.ok(cachedStatus);
}
// 缓存未命中,查询数据库
HealthStatus healthStatus = healthStatusService.getLatestHealthStatus(xuehao);
if (healthStatus != null) {
redisTemplate.opsForValue().set(cacheKey, healthStatus, Duration.ofHours(1));
}
return ResponseEntity.ok(healthStatus);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("获取健康状态失败:" + e.getMessage());
}
}
/**
* 体温状态计算
*/
private String calculateTemperatureStatus(Double temperature) {
if (temperature < 36.0) {
return "体温偏低";
} else if (temperature <= 37.3) {
return "体温正常";
} else if (temperature <= 38.0) {
return "低烧";
} else {
return "高烧";
}
}
/**
* 批量导出健康数据
*/
@GetMapping("/export")
public ResponseEntity<?> exportHealthData(
@RequestParam String startDate,
@RequestParam String endDate,
@RequestParam(required = false) String zhuanye) {
try {
HealthExportQuery query = new HealthExportQuery();
query.setStartDate(startDate);
query.setEndDate(endDate);
query.setZhuanye(zhuanye);
List<HealthExportVO> exportData = healthStatusService.getHealthExportData(query);
// 生成Excel文件
byte[] excelData = healthStatusService.generateHealthReport(exportData);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", "health_report.xlsx");
return new ResponseEntity<>(excelData, headers, HttpStatus.OK);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("导出健康数据失败:" + e.getMessage());
}
}
}
3.3.2 出入登记管理功能实现
@Service
@Transactional
public class AccessRegistrationService {
@Autowired
private AccessRegistrationMapper accessMapper;
@Autowired
private HealthStatusService healthStatusService;
@Autowired
private RabbitTemplate rabbitTemplate;
/**
* 学生出入登记
*/
public AccessRegistration registerAccess(AccessRegisterDTO registerDTO) {
// 验证学生身份
Student student = accessMapper.selectStudentByXuehao(registerDTO.getXuehao());
if (student == null) {
throw new RuntimeException("学生不存在");
}
// 检查健康状态
HealthStatus healthStatus = healthStatusService.getLatestHealthStatus(registerDTO.getXuehao());
if (healthStatus == null) {
throw new RuntimeException("请先上报健康状态");
}
if (!"体温正常".equals(healthStatus.getTiwenzhuangtai())) {
throw new RuntimeException("体温异常,禁止出入");
}
if ("阳性".equals(healthStatus.getHesuanzhuangtai())) {
throw new RuntimeException("核酸检测阳性,禁止出入");
}
AccessRegistration registration = new AccessRegistration();
registration.setDengjibiaoti(generateAccessTitle(registerDTO.getDengjileixing()));
registration.setDengjileixing(registerDTO.getDengjileixing());
registration.setDengjineirong(registerDTO.getDengjineirong());
registration.setDengjishijian(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
registration.setBeizhu(registerDTO.getBeizhu());
registration.setXuehao(registerDTO.getXuehao());
registration.setXueshengxingming(student.getXueshengxingming());
registration.setXingbie(student.getXingbie());
registration.setTouxiang(student.getTouxiang());
registration.setShishitiwen(healthStatus.getTiwen());
registration.setShouji(student.getShouji());
registration.setBanji(student.getBanji());
registration.setZhuanye(student.getZhuanye());
registration.setSfsh("待审核");
registration.setAddtime(new Date());
accessMapper.insertAccessRegistration(registration);
// 发送审核通知
rabbitTemplate.convertAndSend("access.exchange", "access.register", registration);
return registration;
}
/**
* 管理员审核出入登记
*/
public AccessRegistration auditAccess(AccessAuditDTO auditDTO) {
AccessRegistration registration = accessMapper.selectAccessById(auditDTO.getId());
if (registration == null) {
throw new RuntimeException("出入登记记录不存在");
}
registration.setSfsh(auditDTO.getSfsh());
registration.setShhf(auditDTO.getShhf());
accessMapper.updateAccessRegistration(registration);
// 发送审核结果通知
rabbitTemplate.convertAndSend("access.exchange", "access.audit", registration);
return registration;
}
/**
* 生成登记标题
*/
private String generateAccessTitle(String accessType) {
SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
String dateStr = sdf.format(new Date());
if ("入校".equals(accessType)) {
return dateStr + "入校登记";
} else if ("离校".equals(accessType)) {
return dateStr + "离校登记";
} else {
return dateStr + "出入登记";
}
}
/**
* 获取今日出入统计
*/
public AccessStatistics getTodayAccessStatistics() {
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
AccessStatistics statistics = new AccessStatistics();
statistics.setDate(today);
statistics.setTotalAccess(accessMapper.countTodayAccess(today));
statistics.setEnterAccess(accessMapper.countTodayEnterAccess(today));
statistics.setLeaveAccess(accessMapper.countTodayLeaveAccess(today));
statistics.setApprovedAccess(accessMapper.countTodayApprovedAccess(today));
return statistics;
}
}
3.3.3 休假申请管理功能实现
@RestController
@RequestMapping("/api/leave")
public class LeaveApplicationController {
@Autowired
private LeaveApplicationService leaveService;
@Autowired
private HealthStatusService healthStatusService;
/**
* 学生提交休假申请
*/
@PostMapping("/apply")
public ResponseEntity<?> applyLeave(@RequestBody LeaveApplyDTO applyDTO) {
try {
// 参数验证
if (StringUtils.isEmpty(applyDTO.getXuehao()) ||
StringUtils.isEmpty(applyDTO.getShenqingbiaoti())) {
return ResponseEntity.badRequest().body("学号和申请标题不能为空");
}
// 检查健康状态
HealthStatus healthStatus = healthStatusService.getLatestHealthStatus(applyDTO.getXuehao());
if (healthStatus != null && !"体温正常".equals(healthStatus.getTiwenzhuangtai())) {
return ResponseEntity.badRequest().body("体温异常,暂不能申请休假");
}
LeaveApplication application = leaveService.submitLeaveApplication(applyDTO);
return ResponseEntity.ok(application);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("休假申请提交失败:" + e.getMessage());
}
}
/**
* 管理员审批休假申请
*/
@PostMapping("/audit")
public ResponseEntity<?> auditLeave(@RequestBody LeaveAuditDTO auditDTO) {
try {
LeaveApplication application = leaveService.auditLeaveApplication(auditDTO);
return ResponseEntity.ok(application);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("休假申请审批失败:" + e.getMessage());
}
}
/**
* 获取学生休假记录
*/
@GetMapping("/history/{xuehao}")
public ResponseEntity<?> getLeaveHistory(
@PathVariable String xuehao,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int size) {
try {
PageResult<LeaveApplication> result = leaveService.getLeaveHistory(xuehao, page, size);
return ResponseEntity.ok(result);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("获取休假记录失败:" + e.getMessage());
}
}
/**
* 休假申请统计
*/
@GetMapping("/statistics")
public ResponseEntity<?> getLeaveStatistics(
@RequestParam String startDate,
@RequestParam String endDate) {
try {
LeaveStatistics statistics = leaveService.getLeaveStatistics(startDate, endDate);
return ResponseEntity.ok(statistics);
} catch (Exception e) {
return ResponseEntity.internalServerError()
.body("获取休假统计失败:" + e.getMessage());
}
}
}
3.3.4 疫情知识管理功能实现
@Service
@Transactional
public class EpidemicKnowledgeService {
@Autowired
private KnowledgeMapper knowledgeMapper;
/**
* 发布疫情知识
*/
public EpidemicKnowledge publishKnowledge(KnowledgePublishDTO publishDTO) {
EpidemicKnowledge knowledge = new EpidemicKnowledge();
knowledge.setBiaotimingcheng(publishDTO.getBiaotimingcheng());
knowledge.setFenlei(publishDTO.getFenlei());
knowledge.setTupian(publishDTO.getTupian());
knowledge.setShipin(publishDTO.getShipin());
knowledge.setNeirong(publishDTO.getNeirong());
knowledge.setFaburiqi(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
knowledge.setAddtime(new Date());
knowledgeMapper.insertKnowledge(knowledge);
return knowledge;
}
/**
* 获取疫情知识列表
*/
public PageResult<EpidemicKnowledge> getKnowledgeList(KnowledgeQuery query) {
List<EpidemicKnowledge> knowledgeList = knowledgeMapper.selectKnowledgeList(query);
int total = knowledgeMapper.selectKnowledgeCount(query);
return new PageResult<>(knowledgeList, total, query.getPage(), query.getSize());
}
/**
* 搜索疫情知识
*/
public List<EpidemicKnowledge> searchKnowledge(String keyword) {
return knowledgeMapper.searchKnowledge(keyword);
}
/**
* 获取知识分类统计
*/
public List<KnowledgeCategoryStats> getCategoryStatistics() {
return knowledgeMapper.getKnowledgeCategoryStats();
}
}
3.4 第四步:前端界面实现——双角色适配界面
基于JSP + Bootstrap构建适配管理员与学生的差异化界面,遵循"医疗风格、清晰直观"的设计原则:
3.4.1 学生功能界面
- 健康上报:体温录入、身体状况选择、核酸结果上报;
- 出入登记:入校/离校登记、行程报备、审核状态查询;
- 休假申请:请假申请填写、行程轨迹报备、审批进度跟踪;
- 个人中心:健康档案查看、历史记录查询、个人信息维护。
3.4.2 管理员功能界面
- 数据监控:健康数据实时监控、异常预警处理;
- 审批管理:出入登记审核、休假申请审批;
- 统计分析:健康数据统计、出入情况分析、疫情态势评估;
- 系统管理:学生信息管理、疫情知识发布、系统参数配置。
3.5 第五步:系统测试——确保系统稳定可靠
通过全方位测试策略,验证校园疫情防控系统的功能完整性与性能稳定性:
3.5.1 功能测试
设计覆盖核心业务场景的测试用例:
| 测试场景 | 测试用例 | 预期结果 | 实际结果 | 是否通过 |
|---|---|---|---|---|
| 健康上报 | 学生提交体温37.5℃ | 系统预警,状态显示"低烧" | 系统预警,状态显示"低烧" | 是 |
| 出入登记 | 学生提交入校申请 | 生成待审核记录 | 生成待审核记录 | 是 |
| 休假审批 | 管理员审批通过请假 | 申请状态更新为"通过" | 申请状态更新为"通过" | 是 |
| 异常处理 | 核酸阳性学生尝试入校 | 系统拒绝并告警 | 系统拒绝并告警 | 是 |
3.5.2 性能与压力测试
- 并发测试:模拟500学生同时上报健康数据,系统响应正常;
- 数据一致性:健康状态、出入记录等关键数据准确同步;
- 安全测试:敏感信息加密,权限控制有效;
- 容灾测试:数据库故障时系统降级方案正常运作。
3.6 第六步:问题排查与优化——提升系统体验
开发过程中的核心问题及解决方案:
-
问题:高并发健康数据上报性能瓶颈
解决方案:Redis缓存热点数据,消息队列异步处理,数据库连接池优化。 -
问题:异常预警响应不及时
解决方案:建立实时监控机制,集成消息推送,设置多级预警。 -
问题:数据统计分析效率低
解决方案:引入Elasticsearch,建立数据索引,优化查询算法。 -
问题:移动端适配体验差
解决方案:响应式设计优化,PWA技术应用,离线功能支持。
四、毕业设计复盘:经验总结与实践建议
4.1 开发过程中的技术挑战
- 实时性要求:健康数据需要实时更新和预警,对系统性能要求高;
- 数据准确性:疫情防控数据必须准确无误,涉及复杂的验证逻辑;
- 系统稳定性:需要保证7×24小时稳定运行,完善的监控和告警机制;
- 安全性保障:学生健康信息敏感,需要严格的数据安全保护。
4.2 给后续开发者的建议
- 微服务架构:将系统拆分为健康服务、审批服务、消息服务等独立微服务;
- 大数据分析:集成大数据平台,实现疫情态势预测和智能预警;
- 移动端扩展:开发微信小程序,支持移动端健康上报和审批;
- 物联网集成:对接智能测温设备,实现自动体温采集;
- 多租户支持:支持多校区独立管理,数据隔离和权限控制。
五、项目资源与发展展望
5.1 项目核心资源
本项目提供完整的开发与部署资料:
- 后端源码:完整的Spring Boot项目源码(含业务逻辑层实现);
- 前端资源:JSP页面文件、CSS/JS样式、疫情防控主题素材;
- 数据库脚本:MySQL建表语句、初始化数据、测试数据;
- 部署文档:Docker容器化部署方案、性能调优指南;
- API文档:基于Swagger的RESTful接口文档。
5.2 系统扩展方向
- 智能预警:基于AI算法实现疫情传播风险预测;
- 健康码集成:对接政府健康码系统,实现数据互通;
- 疫苗接种:增加疫苗接种记录和管理功能;
- 在线诊疗:集成在线问诊服务,提供医疗支持;
- 应急指挥:建立疫情防控应急指挥平台;
- 数据可视化:疫情数据大屏展示,实时态势感知;
- 多语言支持:支持国际化,适应留学生管理需求。
如果本文对您的Spring Boot学习、校园疫情防控系统相关毕业设计有帮助,欢迎点赞 + 收藏 + 关注,后续会分享更多疫情防控类管理系统项目实战案例!