获取当前用户的今日日程
This commit is contained in:
@@ -9,6 +9,8 @@ public interface IDoctorScheduleAppService {
|
||||
|
||||
R<?> getTodayDoctorScheduleList();
|
||||
|
||||
R<?> getTodayMySchedule();
|
||||
|
||||
R<?> getDoctorScheduleListByDeptId(Long deptId);
|
||||
|
||||
R<?> getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate);
|
||||
|
||||
@@ -113,6 +113,44 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getTodayMySchedule() {
|
||||
try {
|
||||
// 获取当前登录用户信息
|
||||
com.core.common.core.domain.model.LoginUser loginUser = com.core.common.utils.SecurityUtils.getLoginUser();
|
||||
Long doctorId = loginUser.getPractitionerId();
|
||||
|
||||
// 如果没有获取到医生ID,尝试使用用户ID
|
||||
if (doctorId == null || doctorId == 0) {
|
||||
doctorId = loginUser.getUserId();
|
||||
System.out.println("Using userId as doctorId: " + doctorId);
|
||||
} else {
|
||||
System.out.println("Using practitionerId as doctorId: " + doctorId);
|
||||
}
|
||||
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
System.out.println("Querying schedule for date: " + today);
|
||||
|
||||
// 查询当前医生今天的排班信息(从SchedulePool表)
|
||||
LambdaQueryWrapper<SchedulePool> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SchedulePool::getScheduleDate, today) // 根据具体日期查询
|
||||
.eq(SchedulePool::getDoctorId, doctorId) // 根据医生ID查询
|
||||
.eq(SchedulePool::getStatus, 1); // 只查询可用的排班
|
||||
|
||||
List<SchedulePool> list = schedulePoolService.list(queryWrapper);
|
||||
System.out.println("Found " + list.size() + " schedules for doctorId: " + doctorId);
|
||||
|
||||
// 为了支持多种日程类型,我们可以在这里整合来自不同数据源的信息
|
||||
// 目前只返回排班信息,但为以后扩展预留空间
|
||||
return R.ok(list);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error getting today's schedule: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return R.fail("获取排班信息失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
|
||||
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
||||
|
||||
@@ -89,4 +89,13 @@ public class DoctorScheduleController {
|
||||
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取当前登录医生今日排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/today-my-schedule")
|
||||
public R<?> getTodayMySchedule() {
|
||||
return doctorScheduleAppService.getTodayMySchedule();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user