feat(menu): 优化菜单服务性能并新增医生排班功能

- 添加菜单缓存注解以提升查询性能
- 实现菜单完整路径计算优化,解决 N+1 查询问题
- 新增 selectAllMenus 方法供路径计算使用
- 添加今日医生排班查询功能
- 重构前端图标显示逻辑,使用 SVG 图标替代 Element 图标
- 添加前端菜单数据本地缓存机制
- 更新菜单管理界面的表单组件绑定方式
- 新增预约管理、门诊管理和药房管理路由配置
This commit is contained in:
2026-02-02 08:46:33 +08:00
parent 669d669422
commit 5534a71c7d
20 changed files with 1156 additions and 228 deletions

View File

@@ -7,6 +7,8 @@ public interface IDoctorScheduleAppService {
R<?> getDoctorScheduleList();
R<?> getTodayDoctorScheduleList();
R<?> addDoctorSchedule(DoctorSchedule doctorSchedule);
R<?> removeDoctorSchedule(Integer doctorScheduleId);

View File

@@ -1,6 +1,7 @@
package com.openhis.web.appointmentmanage.appservice.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.core.domain.R;
import com.openhis.appointmentmanage.domain.DoctorSchedule;
import com.openhis.appointmentmanage.mapper.DoctorScheduleMapper;
@@ -9,6 +10,8 @@ import com.openhis.web.appointmentmanage.appservice.IDoctorScheduleAppService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
@Service
@@ -26,6 +29,50 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
return R.ok(list);
}
@Override
public R<?> getTodayDoctorScheduleList() {
// 获取今天的日期
LocalDate today = LocalDate.now();
DayOfWeek dayOfWeek = today.getDayOfWeek();
// 将 Java 的 DayOfWeek 转换为字符串表示
String weekdayStr = convertDayOfWeekToString(dayOfWeek);
// 查询今天排班的医生
LambdaQueryWrapper<DoctorSchedule> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DoctorSchedule::getWeekday, weekdayStr) // 根据星期几查询
.eq(DoctorSchedule::getIsStopped, false); // 只查询未停止的排班
List<DoctorSchedule> list = doctorScheduleService.list(queryWrapper);
return R.ok(list);
}
/**
* 将 DayOfWeek 转换为字符串表示
* @param dayOfWeek DayOfWeek枚举
* @return 对应的字符串表示
*/
private String convertDayOfWeekToString(DayOfWeek dayOfWeek) {
switch (dayOfWeek) {
case MONDAY:
return "1"; // 或者 "星期一" 或 "Monday",取决于数据库中的实际存储格式
case TUESDAY:
return "2";
case WEDNESDAY:
return "3";
case THURSDAY:
return "4";
case FRIDAY:
return "5";
case SATURDAY:
return "6";
case SUNDAY:
return "7";
default:
return "1"; // 默认为星期一
}
}
@Override
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
if (ObjectUtil.isEmpty(doctorSchedule)) {

View File

@@ -40,4 +40,13 @@ public class DoctorScheduleController {
return R.ok(doctorScheduleAppService.removeDoctorSchedule(doctorScheduleId));
}
/*
* 获取今日医生排班List
*
* */
@GetMapping("/today")
public R<?> getTodayDoctorScheduleList() {
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
}
}