需求76 门诊预约挂号

1.就诊卡号与性别显示
2.选中患者优化
3.解决确认报错
This commit is contained in:
HuangShun
2026-02-11 11:44:42 +08:00
parent 2a5a157c57
commit b826afb17c
2 changed files with 113 additions and 50 deletions

View File

@@ -71,10 +71,39 @@ public class TicketAppServiceImpl implements ITicketAppService {
}
try {
// 3. 执行原有的预约逻辑
// 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. 执行预约逻辑
int result = ticketService.bookTicket(params);
if (result > 0) {
// 4. 预约成功后,更新排班表状态
// 5. 预约成功后,更新排班表状态
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(slotId); // 对应 XML 中的 WHERE id = #{id}
schedule.setIsStopped(true); // 设置为已预约
@@ -86,14 +115,12 @@ 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());
}