获取当前用户的今日日程
This commit is contained in:
@@ -9,6 +9,8 @@ public interface IDoctorScheduleAppService {
|
|||||||
|
|
||||||
R<?> getTodayDoctorScheduleList();
|
R<?> getTodayDoctorScheduleList();
|
||||||
|
|
||||||
|
R<?> getTodayMySchedule();
|
||||||
|
|
||||||
R<?> getDoctorScheduleListByDeptId(Long deptId);
|
R<?> getDoctorScheduleListByDeptId(Long deptId);
|
||||||
|
|
||||||
R<?> getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate);
|
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
|
@Override
|
||||||
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
|
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
|
||||||
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
||||||
|
|||||||
@@ -89,4 +89,13 @@ public class DoctorScheduleController {
|
|||||||
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
|
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 获取当前登录医生今日排班List
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@GetMapping("/today-my-schedule")
|
||||||
|
public R<?> getTodayMySchedule() {
|
||||||
|
return doctorScheduleAppService.getTodayMySchedule();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ export function getTodayDoctorScheduleList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取当前登录医生今日排班列表
|
||||||
|
export function getTodayMySchedule() {
|
||||||
|
return request({
|
||||||
|
url: '/doctor-schedule/today-my-schedule',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取医生排班列表
|
// 获取医生排班列表
|
||||||
export function getDoctorScheduleList() {
|
export function getDoctorScheduleList() {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -122,6 +122,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-tag :type="item.type" size="small">{{ item.tag }}</el-tag>
|
<el-tag :type="item.type" size="small">{{ item.tag }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="scheduleList.length === 0" class="empty-schedule">
|
||||||
|
<el-empty description="暂无今日日程" :image-size="60" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -136,7 +139,7 @@ import { getHomeStatistics, getPendingEmrCount } from '@/api/home'
|
|||||||
import { listTodo } from '@/api/workflow/task.js'
|
import { listTodo } from '@/api/workflow/task.js'
|
||||||
import { getCurrentUserConfig } from '@/api/system/userConfig'
|
import { getCurrentUserConfig } from '@/api/system/userConfig'
|
||||||
import { listMenu, getMenuFullPath } from '@/api/system/menu'
|
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 { ElDivider } from 'element-plus'
|
||||||
import {
|
import {
|
||||||
User,
|
User,
|
||||||
@@ -902,27 +905,27 @@ const getTaskIcon = (category) => {
|
|||||||
const fetchScheduleList = async () => {
|
const fetchScheduleList = async () => {
|
||||||
try {
|
try {
|
||||||
console.log('Fetching schedule list...')
|
console.log('Fetching schedule list...')
|
||||||
const response = await getTodayDoctorScheduleList()
|
const response = await getTodayMySchedule()
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
// 将API返回的数据转换为前端所需的格式
|
// 将API返回的数据转换为前端所需的格式
|
||||||
const scheduleData = response.data.map((schedule, index) => {
|
const scheduleData = response.data.map((schedule, index) => {
|
||||||
// 根据排班类型设置标签类型
|
// 根据排班类型设置标签类型
|
||||||
let tagType = 'info'
|
let tagType = 'info'
|
||||||
if (schedule.weekday) {
|
if (schedule.shift) {
|
||||||
tagType = schedule.weekday.toLowerCase()
|
tagType = schedule.shift.toLowerCase()
|
||||||
} else if (schedule.timePeriod) {
|
} else if (schedule.timePeriod) {
|
||||||
tagType = schedule.timePeriod.toLowerCase()
|
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 {
|
return {
|
||||||
id: schedule.id || index,
|
id: schedule.id || index,
|
||||||
time: schedule.startTime || '未知时间',
|
time: schedule.startTime ? `${schedule.startTime}-${schedule.endTime}` : '未知时间',
|
||||||
title: title,
|
title: title,
|
||||||
location: location,
|
location: location,
|
||||||
type: tagType,
|
type: tagType,
|
||||||
@@ -1373,6 +1376,14 @@ onUnmounted(() => {
|
|||||||
color: #409eff;
|
color: #409eff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.empty-schedule {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 40px 20px;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
.schedule-content {
|
.schedule-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin: 0 16px;
|
margin: 0 16px;
|
||||||
|
|||||||
Reference in New Issue
Block a user