diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/IDoctorScheduleAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/IDoctorScheduleAppService.java index d2eececd..b8d9e2df 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/IDoctorScheduleAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/IDoctorScheduleAppService.java @@ -9,6 +9,8 @@ public interface IDoctorScheduleAppService { R getTodayDoctorScheduleList(); + R getTodayMySchedule(); + R getDoctorScheduleListByDeptId(Long deptId); R getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/DoctorScheduleAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/DoctorScheduleAppServiceImpl.java index df765713..d8cf9bad 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/DoctorScheduleAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/appservice/impl/DoctorScheduleAppServiceImpl.java @@ -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 queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SchedulePool::getScheduleDate, today) // 根据具体日期查询 + .eq(SchedulePool::getDoctorId, doctorId) // 根据医生ID查询 + .eq(SchedulePool::getStatus, 1); // 只查询可用的排班 + + List 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)) { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/controller/DoctorScheduleController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/controller/DoctorScheduleController.java index 77ab066a..2a7e8bf6 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/controller/DoctorScheduleController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/appointmentmanage/controller/DoctorScheduleController.java @@ -89,4 +89,13 @@ public class DoctorScheduleController { return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList()); } + /* + * 获取当前登录医生今日排班List + * + * */ + @GetMapping("/today-my-schedule") + public R getTodayMySchedule() { + return doctorScheduleAppService.getTodayMySchedule(); + } + } diff --git a/openhis-ui-vue3/src/api/appointmentmanage/doctorSchedule.js b/openhis-ui-vue3/src/api/appointmentmanage/doctorSchedule.js index 31634aec..fb919dd7 100644 --- a/openhis-ui-vue3/src/api/appointmentmanage/doctorSchedule.js +++ b/openhis-ui-vue3/src/api/appointmentmanage/doctorSchedule.js @@ -8,6 +8,14 @@ export function getTodayDoctorScheduleList() { }) } +// 获取当前登录医生今日排班列表 +export function getTodayMySchedule() { + return request({ + url: '/doctor-schedule/today-my-schedule', + method: 'get' + }) +} + // 获取医生排班列表 export function getDoctorScheduleList() { return request({ diff --git a/openhis-ui-vue3/src/views/index.vue b/openhis-ui-vue3/src/views/index.vue index 7de230a8..5d7251ce 100644 --- a/openhis-ui-vue3/src/views/index.vue +++ b/openhis-ui-vue3/src/views/index.vue @@ -122,6 +122,9 @@ {{ item.tag }} +
+ +
@@ -136,7 +139,7 @@ import { getHomeStatistics, getPendingEmrCount } from '@/api/home' import { listTodo } from '@/api/workflow/task.js' import { getCurrentUserConfig } from '@/api/system/userConfig' import { listMenu, getMenuFullPath } from '@/api/system/menu' -import { getTodayDoctorScheduleList } from '@/api/appointmentmanage/doctorSchedule' +import { getTodayMySchedule } from '@/api/appointmentmanage/doctorSchedule' import { ElDivider } from 'element-plus' import { User, @@ -902,27 +905,27 @@ const getTaskIcon = (category) => { const fetchScheduleList = async () => { try { console.log('Fetching schedule list...') - const response = await getTodayDoctorScheduleList() + const response = await getTodayMySchedule() if (response.code === 200) { // 将API返回的数据转换为前端所需的格式 const scheduleData = response.data.map((schedule, index) => { // 根据排班类型设置标签类型 let tagType = 'info' - if (schedule.weekday) { - tagType = schedule.weekday.toLowerCase() + if (schedule.shift) { + tagType = schedule.shift.toLowerCase() } else if (schedule.timePeriod) { tagType = schedule.timePeriod.toLowerCase() } // 确定标题 - const title = schedule.doctor ? `${schedule.doctor}医生排班` : '医生排班' + const title = schedule.doctorName ? `${schedule.doctorName}医生排班` : '医生排班' // 确定位置 - const location = schedule.clinic || schedule.deptId || '未知科室' + const location = schedule.clinicRoom || schedule.deptId || '未知科室' return { id: schedule.id || index, - time: schedule.startTime || '未知时间', + time: schedule.startTime ? `${schedule.startTime}-${schedule.endTime}` : '未知时间', title: title, location: location, type: tagType, @@ -1373,6 +1376,14 @@ onUnmounted(() => { color: #409eff; } + .empty-schedule { + display: flex; + justify-content: center; + align-items: center; + padding: 40px 20px; + min-height: 200px; + } + .schedule-content { flex: 1; margin: 0 16px;