96-门诊医生站会诊申请确认界面和97-门诊会诊申请管理界面全部功能。

This commit is contained in:
weixin_45799331
2026-02-11 14:16:30 +08:00
parent 3ab7ea1898
commit 1747291f41
67 changed files with 213 additions and 6087 deletions

View File

@@ -26,11 +26,11 @@ public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
if (roomName != null && ObjectUtil.isNotEmpty(roomName)) {
clinicRoom.setRoomName(roomName);
}
// 分页查询
Page<ClinicRoom> page = new Page<>(pageNum, pageSize);
Page<ClinicRoom> result = clinicRoomService.selectClinicRoomPage(page, clinicRoom);
return R.ok(result);
}
@@ -58,12 +58,7 @@ public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
if (clinicRoom.getRemarks() != null && clinicRoom.getRemarks().length() > 500) {
return R.fail(400, "备注长度不能超过500个字符");
}
// 检查诊室名称在同卫生机构下是否已存在
if (clinicRoomService.existsByOrgNameAndRoomName(clinicRoom.getOrgName(), clinicRoom.getRoomName())) {
return R.fail(400, "当前卫生机构下已存在该诊室名称");
}
// 新增诊室
int result = clinicRoomService.insertClinicRoom(clinicRoom);
if (result > 0) {
@@ -91,18 +86,13 @@ public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
if (clinicRoom.getRemarks() != null && clinicRoom.getRemarks().length() > 500) {
return R.fail(400, "备注长度不能超过500个字符");
}
// 检查诊室是否存在
ClinicRoom existingClinicRoom = clinicRoomService.selectClinicRoomById(clinicRoom.getId());
if (existingClinicRoom == null) {
return R.fail(404, "诊室不存在");
}
// 检查诊室名称在同卫生机构下是否已存在(排除当前记录)
if (clinicRoomService.existsByOrgNameAndRoomNameExcludeId(clinicRoom.getOrgName(), clinicRoom.getRoomName(), clinicRoom.getId())) {
return R.fail(400, "当前卫生机构下已存在该诊室名称");
}
// 更新诊室
int result = clinicRoomService.updateClinicRoom(clinicRoom);
if (result > 0) {
@@ -119,7 +109,7 @@ public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
if (existingClinicRoom == null) {
return R.fail(404, "诊室不存在");
}
// 删除诊室
int result = clinicRoomService.deleteClinicRoomById(id);
if (result > 0) {

View File

@@ -87,6 +87,30 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
return R.ok(list);
}
@Transactional
@Override
public R<?> getTodayMySchedule() {
// 获取今天的日期
LocalDate today = LocalDate.now();
DayOfWeek dayOfWeek = today.getDayOfWeek();
// 将 Java 的 DayOfWeek 转换为字符串表示
String weekdayStr = convertDayOfWeekToString(dayOfWeek);
// 获取当前登录医生的ID需要从SecurityUtils获取
// 如果没有SecurityUtils可以从参数传入或使用其他方式获取
// Long currentDoctorId = SecurityUtils.getLoginUser().getPractitionerId();
// 查询当前医生今天的排班
LambdaQueryWrapper<DoctorSchedule> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DoctorSchedule::getWeekday, weekdayStr) // 根据星期几查询
// .eq(DoctorSchedule::getDoctorId, currentDoctorId) // 只查询当前医生的排班
.eq(DoctorSchedule::getIsStopped, false); // 只查询未停止的排班
List<DoctorSchedule> list = doctorScheduleService.list(queryWrapper);
return R.ok(list);
}
/**
* 将 DayOfWeek 转换为字符串表示
* @param dayOfWeek DayOfWeek枚举
@@ -113,44 +137,6 @@ 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)) {

View File

@@ -71,39 +71,10 @@ public class TicketAppServiceImpl implements ITicketAppService {
}
try {
// 3. 号源列表来自排班表(adm_doctor_schedule)需确保clinical_ticket中存在对应记录
Ticket existingTicket = ticketService.selectTicketById(ticketId);
if (existingTicket == null) {
DoctorSchedule schedule = doctorScheduleMapper.selectById(slotId);
if (schedule == null) {
return R.fail("排班记录不存在");
}
Ticket newTicket = new Ticket();
newTicket.setId(slotId);
newTicket.setDoctor(schedule.getDoctor());
newTicket.setDepartment(String.valueOf(schedule.getDeptId()));
newTicket.setDoctorId(schedule.getDoctorId());
newTicket.setDepartmentId(schedule.getDeptId());
String registerItem = schedule.getRegisterItem();
if (registerItem != null && registerItem.contains("专家")) {
newTicket.setTicketType("expert");
} else {
newTicket.setTicketType("general");
}
newTicket.setStatus("unbooked");
int totalFee = (schedule.getRegisterFee() != null ? schedule.getRegisterFee() : 0)
+ (schedule.getDiagnosisFee() != null ? schedule.getDiagnosisFee() : 0);
newTicket.setFee(String.valueOf(totalFee));
String timeRange = schedule.getStartTime() + "-" + schedule.getEndTime();
newTicket.setTime(LocalDate.now() + " " + timeRange);
// 使用MyBatis-Plus的save方法支持手动设置ID
ticketService.save(newTicket);
}
// 4. 执行预约逻辑
// 3. 执行原有的预约逻辑
int result = ticketService.bookTicket(params);
if (result > 0) {
// 5. 预约成功后,更新排班表状态
// 4. 预约成功后,更新排班表状态
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(slotId); // 对应 XML 中的 WHERE id = #{id}
schedule.setIsStopped(true); // 设置为已预约
@@ -115,12 +86,14 @@ public class TicketAppServiceImpl implements ITicketAppService {
if (updateCount > 0) {
return R.ok("预约成功并已更新排班状态");
} else {
// 如果更新失败,可能需要根据业务逻辑决定是否回滚预约
return R.ok("预约成功,但排班状态更新失败");
}
} else {
return R.fail("预约失败");
}
} catch (Exception e) {
// e.printStackTrace();
log.error(e.getMessage());
return R.fail("系统异常:" + e.getMessage());
}

View File

@@ -89,13 +89,4 @@ public class DoctorScheduleController {
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
}
/*
* 获取当前登录医生今日排班List
*
* */
@GetMapping("/today-my-schedule")
public R<?> getTodayMySchedule() {
return doctorScheduleAppService.getTodayMySchedule();
}
}