232 预约管理-》门诊预约挂号:打开界面报错且无医生排班预约号源数据

This commit is contained in:
HuangXinQuan
2026-03-26 17:09:08 +08:00
parent 3f0fa3bbb3
commit 11cf88fd49
22 changed files with 1411 additions and 764 deletions

View File

@@ -2,7 +2,9 @@ package com.openhis.web.appointmentmanage.appservice;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.appointmentmanage.dto.TicketQueryDTO;
import com.openhis.web.appointmentmanage.dto.TicketDto;
import com.openhis.appointmentmanage.dto.TicketQueryDTO;
import java.util.Map;
@@ -14,37 +16,53 @@ import java.util.Map;
public interface ITicketAppService {
/**
* 预约号源
* 分页查询门诊号源列表(真分页)
*
* @param params 预约参数
* @param query 查询参数
* @return 结果
*/
R<?> bookTicket(Map<String, Object> params);
R<?> listTicket(TicketQueryDTO query);
/**
* 查询医生余号汇总(基于号源池,不受分页影响)
*
* @param query 查询参数
* @return 结果
*/
R<?> listDoctorAvailability(TicketQueryDTO query);
/**
* 预约号源
*
* @param dto 预约参数
* @return 结果
*/
R<?> bookTicket(com.openhis.appointmentmanage.domain.AppointmentBookDTO dto);
/**
* 取消预约
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
R<?> cancelTicket(Long ticketId);
R<?> cancelTicket(Long slotId);
/**
* 取号
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
R<?> checkInTicket(Long ticketId);
R<?> checkInTicket(Long slotId);
/**
* 停诊
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
R<?> cancelConsultation(Long ticketId);
R<?> cancelConsultation(Long slotId);
/**
* 查询所有号源(用于测试)
*

View File

@@ -274,9 +274,9 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
doctorSchedule.getLimitNumber())
.set(doctorSchedule.getStopReason() != null, SchedulePool::getStopReason, doctorSchedule.getStopReason())
.set(doctorSchedule.getRegType() != null, SchedulePool::getRegType, String.valueOf(doctorSchedule.getRegType()))
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getFee, doctorSchedule.getRegisterFee() / 100.0)
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getFee, Double.valueOf(doctorSchedule.getRegisterFee().toString()))
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getInsurancePrice,
doctorSchedule.getRegisterFee() / 100.0)
Double.valueOf(doctorSchedule.getRegisterFee().toString()))
.update();
}
@@ -306,7 +306,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
// 不设置available_num因为它是数据库生成列
// pool.setAvailableNum(0); // 初始为0稍后更新
pool.setRegType(schedule.getRegisterItem() != null ? schedule.getRegisterItem() : "普通");
pool.setFee(schedule.getRegisterFee() != null ? schedule.getRegisterFee() / 100.0 : 0.0); // 假设数据库中以分为单位存储
pool.setFee(schedule.getRegisterFee() != null ? Double.valueOf(schedule.getRegisterFee().toString()) : 0.0); // 直接使用原始价格
pool.setInsurancePrice(pool.getFee()); // 医保价格暂时与原价相同
// 暂时设置support_channel为空字符串避免JSON类型问题
pool.setSupportChannel("");
@@ -359,7 +359,7 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
// 不设置available_num因为它是数据库生成列
// pool.setAvailableNum(0); // 初始为0稍后更新
pool.setRegType(schedule.getRegisterItem() != null ? schedule.getRegisterItem() : "普通");
pool.setFee(schedule.getRegisterFee() != null ? schedule.getRegisterFee() / 100.0 : 0.0); // 假设数据库中以分为单位存储
pool.setFee(schedule.getRegisterFee() != null ? Double.valueOf(schedule.getRegisterFee().toString()) : 0.0); // 直接使用原始价格
pool.setInsurancePrice(pool.getFee()); // 医保价格暂时与原价相同
// 暂时设置support_channel为空字符串避免JSON类型问题
pool.setSupportChannel("");

View File

@@ -4,28 +4,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.administration.domain.Patient;
import com.openhis.administration.service.IPatientService;
import com.openhis.appointmentmanage.domain.DoctorSchedule;
import com.openhis.appointmentmanage.mapper.DoctorScheduleMapper;
import com.openhis.appointmentmanage.service.IDoctorScheduleService;
import com.openhis.clinical.domain.Order;
import com.openhis.appointmentmanage.mapper.ScheduleSlotMapper;
import com.openhis.clinical.domain.Ticket;
import com.openhis.clinical.mapper.OrderMapper;
import com.openhis.clinical.service.ITicketService;
import com.openhis.web.appointmentmanage.appservice.IDoctorScheduleAppService;
import com.openhis.web.appointmentmanage.appservice.ITicketAppService;
import com.openhis.web.appointmentmanage.dto.TicketDto;
import com.openhis.common.constant.CommonConstants.SlotStatus;
import com.openhis.common.constant.CommonConstants.AppointmentOrderStatus;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 号源管理应用服务实现类
*
@@ -36,73 +29,41 @@ public class TicketAppServiceImpl implements ITicketAppService {
@Resource
private ITicketService ticketService;
@Resource
private ScheduleSlotMapper scheduleSlotMapper;
@Resource
private IPatientService patientService;
@Resource
private IDoctorScheduleAppService doctorScheduleAppService;
@Resource
private DoctorScheduleMapper doctorScheduleMapper;
@Resource
private OrderMapper orderMapper;
private static final Logger log = LoggerFactory.getLogger(TicketAppServiceImpl.class);
/**
* 预约号源
* 预约号源 (重构版:精准锁定单一槽位)
*
* @param params 预约参数
* @param dto 预约参数
* @return 结果
*/
@Override
public R<?> bookTicket(Map<String, Object> params) {
// 1. 获取 ticketId 和 slotId
Long ticketId = null;
Long slotId = null;
if (params.get("ticketId") != null) {
ticketId = Long.valueOf(params.get("ticketId").toString());
public R<?> bookTicket(com.openhis.appointmentmanage.domain.AppointmentBookDTO dto) {
Long slotId = dto.getSlotId();
if (slotId == null) {
return R.fail("参数校验失败:缺少排班槽位唯一标识");
}
if (params.get("slotId") != null) {
slotId = Long.valueOf(params.get("slotId").toString());
}
// 2. 参数校验
if (ticketId == null || slotId == null) {
return R.fail("参数错误ticketId 或 slotId 不能为空");
}
try {
// 3. 执行原有的预约逻辑
int result = ticketService.bookTicket(params);
int result = ticketService.bookTicket(dto);
if (result > 0) {
// 4. 预约成功后,更新排班表状态
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(slotId); // 对应 XML 中的 WHERE id = #{id}
schedule.setIsStopped(true); // 设置为已预约
schedule.setStopReason("booked"); // 设置停用原因
// 执行更新
int updateCount = doctorScheduleMapper.updateDoctorSchedule(schedule);
if (updateCount > 0) {
return R.ok("预约成功并已更新排班状态");
} else {
// 如果更新失败,可能需要根据业务逻辑决定是否回滚预约
return R.ok("预约成功,但排班状态更新失败");
}
} else {
return R.fail("预约失败");
return R.ok("预约成功!号源已安全锁定。");
}
return R.fail("预约挂单核发失败");
} catch (Exception e) {
// e.printStackTrace();
log.error(e.getMessage());
log.error("大厅挂号捕获系统异常", e);
return R.fail("系统异常:" + e.getMessage());
}
}
/**
* 取消预约
* 取消预约 (重构版:精准释放单一槽位)
*
* @param slotId 医生排班ID
* @param slotId 医生槽位排班ID
* @return 结果
*/
@Override
@@ -111,18 +72,8 @@ public class TicketAppServiceImpl implements ITicketAppService {
return R.fail("参数错误");
}
try {
ticketService.cancelTicket(slotId);
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(slotId); // 对应 WHERE id = #{id}
schedule.setIsStopped(false); // 设置为 false
schedule.setStopReason(""); // 将原因清空 (设为空字符串)
// 3. 调用自定义更新方法
int updateCount = doctorScheduleMapper.updateDoctorSchedule(schedule);
if (updateCount > 0) {
return R.ok("取消成功");
} else {
return R.ok("取消成功");
}
int result = ticketService.cancelTicket(slotId);
return R.ok(result > 0 ? "取消成功,号源已重新释放回市场" : "取消失败");
} catch (Exception e) {
return R.fail(e.getMessage());
}
@@ -131,16 +82,16 @@ public class TicketAppServiceImpl implements ITicketAppService {
/**
* 取号
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
@Override
public R<?> checkInTicket(Long ticketId) {
if (ticketId == null) {
public R<?> checkInTicket(Long slotId) {
if (slotId == null) {
return R.fail("参数错误");
}
try {
int result = ticketService.checkInTicket(ticketId);
int result = ticketService.checkInTicket(slotId);
return R.ok(result > 0 ? "取号成功" : "取号失败");
} catch (Exception e) {
return R.fail(e.getMessage());
@@ -150,109 +101,201 @@ public class TicketAppServiceImpl implements ITicketAppService {
/**
* 停诊
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
@Override
public R<?> cancelConsultation(Long ticketId) {
if (ticketId == null) {
public R<?> cancelConsultation(Long slotId) {
if (slotId == null) {
return R.fail("参数错误");
}
try {
int result = ticketService.cancelConsultation(ticketId);
int result = ticketService.cancelConsultation(slotId);
return R.ok(result > 0 ? "停诊成功" : "停诊失败");
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
@Override
public R<?> listAllTickets() {
// 1. 从 AppService 获取排班数据
R<?> response = doctorScheduleAppService.getDoctorScheduleList();
// 获取返回的 List 数据 (假设 R.ok 里的数据是 List<DoctorSchedule>)
List<DoctorSchedule> scheduleList = (List<DoctorSchedule>) response.getData();
public R<?> listTicket(com.openhis.appointmentmanage.dto.TicketQueryDTO query) {
// 1. 防空指针处理
if (query == null) {
query = new com.openhis.appointmentmanage.dto.TicketQueryDTO();
}
// 2. 转换数据为 TicketDto
List<TicketDto> tickets = new ArrayList<>();
// 2. 构造 MyBatis 的分页对象 (传入前端给的当前页和每页条数)
com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.openhis.appointmentmanage.domain.TicketSlotDTO> pageParam = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(
query.getPage(), query.getLimit());
if (scheduleList != null) {
for (DoctorSchedule schedule : scheduleList) {
// 3. 调用刚才写的底层动态 SQL 查询!
com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.openhis.appointmentmanage.domain.TicketSlotDTO> rawPage = scheduleSlotMapper
.selectTicketSlotsPage(pageParam, query);
// 4. 将查出来的数据翻译为前端可以直接渲染的结构
java.util.List<TicketDto> tickets = new java.util.ArrayList<>();
if (rawPage.getRecords() != null) {
for (com.openhis.appointmentmanage.domain.TicketSlotDTO raw : rawPage.getRecords()) {
TicketDto dto = new TicketDto();
// 基础信息映射
dto.setSlot_id(Long.valueOf(schedule.getId())); // Integer 转 Long
dto.setBusNo(String.valueOf(schedule.getId())); // 生成一个业务编号
dto.setDepartment(String.valueOf(schedule.getDeptId())); // 如果有科室名建议关联查询这里暂填ID
dto.setDoctor(schedule.getDoctor());
// 基础字段映射
dto.setSlot_id(raw.getSlotId());
dto.setBusNo(String.valueOf(raw.getSlotId()));
dto.setDoctor(raw.getDoctor());
dto.setDepartment(raw.getDepartmentName()); // 注意以前这里传成了ID导致前端出Bug现在修复成了真正的科室名
dto.setFee(raw.getFee());
dto.setPatientName(raw.getPatientName());
dto.setPatientId(raw.getPatientId() != null ? String.valueOf(raw.getPatientId()) : null);
dto.setPhone(raw.getPhone());
// 号源类型处理:根据挂号项目判断是普通号还是专家号
String registerItem = schedule.getRegisterItem();
if (registerItem != null && registerItem.contains("专家")) {
// 号源类型处理 (底层是1前端要的是expert)
if (raw.getRegType() != null && raw.getRegType() == 1) {
dto.setTicketType("expert");
} else {
dto.setTicketType("general");
}
// 时间处理:格式化为日期+时间范围,如 "2025-12-01 08:00-12:00"
String currentDate = LocalDate.now().toString(); // 或者从schedule中获取具体日期
String timeRange = schedule.getStartTime() + "-" + schedule.getEndTime();
dto.setDateTime(currentDate + " " + timeRange);
LocalTime nowTime = LocalTime.now();
LocalTime endTime = schedule.getEndTime();
String stopReason1 = schedule.getStopReason();
if ("cancelled".equals(stopReason1)||(endTime != null && nowTime.isAfter(endTime))) {
dto.setStatus("已停诊");
}else if (Boolean.TRUE.equals(schedule.getIsStopped())) {
// 获取原因并处理可能的空值
String stopReason = schedule.getStopReason();
// 使用 .equals() 比较内容,并将常量放在前面防止空指针
if ("booked".equals(stopReason)) {
dto.setStatus("已预约");
// --- 新增:获取患者信息 ---
List<Order> Order = orderMapper.selectOrderBySlotId(Long.valueOf(schedule.getId()));
Order latestOrder=Order.get(0);
if (latestOrder != null) {
dto.setPatientName(latestOrder.getPatientName());
dto.setPatientId(String.valueOf(latestOrder.getPatientId()));
dto.setPhone(latestOrder.getPhone());
}
// -----------------------
} else if ("checked".equals(stopReason)) {
dto.setStatus("已取号");
} else {
// 兜底逻辑:如果 is_stopped 为 true 但没有匹配到原因
dto.setStatus("不可预约");
// 拼接就诊时间
if (raw.getScheduleDate() != null && raw.getExpectTime() != null) {
dto.setDateTime(raw.getScheduleDate().toString() + " " + raw.getExpectTime().toString());
try {
dto.setAppointmentDate(
new java.text.SimpleDateFormat("yyyy-MM-dd").parse(raw.getScheduleDate().toString()));
} catch (Exception e) {
dto.setAppointmentDate(new java.util.Date());
}
} else {
// is_stopped 为 false 或 null 时
dto.setStatus("未预约");
}
// 费用处理 (挂号费 + 诊疗费)
int totalFee = schedule.getRegisterFee() + schedule.getDiagnosisFee();
dto.setFee(String.valueOf(totalFee));
// 日期处理LocalDateTime 转 Date
if (schedule.getCreateTime() != null) {
// 1. 先转成 Instant
Instant instant = schedule.getCreateTime().toInstant();
// 2. 结合时区转成 ZonedDateTime
ZonedDateTime zdt = instant.atZone(ZoneId.systemDefault());
// 3. 再转回 Date (如果 DTO 需要的是 Date)
dto.setAppointmentDate(Date.from(zdt.toInstant()));
// 精准状态翻译把底层的1和2翻译回前端能懂的中文
if (Boolean.TRUE.equals(raw.getIsStopped())) {
dto.setStatus("已停诊");
} else {
Integer slotStatus = raw.getSlotStatus();
if (slotStatus != null) {
if (SlotStatus.BOOKED.equals(slotStatus)) {
dto.setStatus(AppointmentOrderStatus.CHECKED_IN.equals(raw.getOrderStatus()) ? "已取号" : "已预约");
} else if (SlotStatus.STOPPED.equals(slotStatus)) {
dto.setStatus("已停诊");
} else {
dto.setStatus("未预约");
}
} else {
dto.setStatus("未预约");
}
}
tickets.add(dto);
}
}
// 3. 封装分页响应结构
Map<String, Object> result = new HashMap<>();
// 5. 按照前端组件需要的【真分页】格式进行包装,并返回
java.util.Map<String, Object> result = new java.util.HashMap<>();
result.put("list", tickets);
result.put("total", rawPage.getTotal()); // 这个 total 就是底层用 COUNT(*) 算出来的真实总条数!
result.put("page", query.getPage());
result.put("limit", query.getLimit());
return R.ok(result);
}
@Override
public R<?> listDoctorAvailability(com.openhis.appointmentmanage.dto.TicketQueryDTO query) {
if (query == null) {
query = new com.openhis.appointmentmanage.dto.TicketQueryDTO();
}
java.util.List<com.openhis.appointmentmanage.domain.DoctorAvailabilityDTO> rawList = scheduleSlotMapper
.selectDoctorAvailabilitySummary(query);
java.util.List<java.util.Map<String, Object>> doctors = new java.util.ArrayList<>();
if (rawList != null) {
for (com.openhis.appointmentmanage.domain.DoctorAvailabilityDTO item : rawList) {
java.util.Map<String, Object> row = new java.util.HashMap<>();
String doctorName = item.getDoctorName();
Long doctorId = item.getDoctorId();
row.put("id", doctorId != null ? String.valueOf(doctorId) : doctorName);
row.put("name", doctorName);
row.put("available", item.getAvailable() == null ? 0 : item.getAvailable());
row.put("type", item.getTicketType() == null ? "general" : item.getTicketType());
doctors.add(row);
}
}
return R.ok(doctors);
}
@Override
public R<?> listAllTickets() {
// 1. 调用最新的 Mapper直接从数据库抽出我们半成品的 DTO强类型
List<com.openhis.appointmentmanage.domain.TicketSlotDTO> rawDtos = scheduleSlotMapper.selectAllTicketSlots();
// 这是真正要发给前端展示的包裹外卖盒
List<TicketDto> tickets = new ArrayList<>();
if (rawDtos != null) {
for (com.openhis.appointmentmanage.domain.TicketSlotDTO raw : rawDtos) {
TicketDto dto = new TicketDto();
// --- 基础字段处理 ---
// 注意:这里已经变成了极其舒服的 .getSlotId() 方法调用,告别魔鬼字符串!
dto.setSlot_id(raw.getSlotId());
dto.setBusNo(String.valueOf(raw.getSlotId())); // 暂时借用真实槽位ID做唯一流水号
dto.setDoctor(raw.getDoctor());
dto.setDepartment(raw.getDepartmentName());
dto.setFee(raw.getFee());
dto.setPatientName(raw.getPatientName());
dto.setPatientId(raw.getPatientId() != null ? String.valueOf(raw.getPatientId()) : null);
dto.setPhone(raw.getPhone());
// --- 号源类型处理 (普通/专家) ---
// 改用底层 adm_doctor_schedule 传来的标准数字字典0=普通1=专家
if (raw.getRegType() != null && raw.getRegType() == 1) {
dto.setTicketType("expert");
} else {
dto.setTicketType("general");
}
// --- 就诊时间严谨拼接 ---
// 拼接出来给前端展示的,如 "2026-03-20 08:30"
if (raw.getScheduleDate() != null && raw.getExpectTime() != null) {
dto.setDateTime(raw.getScheduleDate().toString() + " " + raw.getExpectTime().toString());
try {
dto.setAppointmentDate(
new java.text.SimpleDateFormat("yyyy-MM-dd").parse(raw.getScheduleDate().toString()));
} catch (Exception e) {
dto.setAppointmentDate(new java.util.Date());
}
}
// --- 核心逻辑:精准状态分类 ---
// 第一关:底层硬性停诊拦截
if (Boolean.TRUE.equals(raw.getIsStopped())) {
dto.setStatus("已停诊");
} else {
// 第二关:看独立的细分槽位状态 (0: 可用, 1: 已预约, 2: 已取消...)
Integer slotStatus = raw.getSlotStatus();
if (slotStatus != null) {
if (SlotStatus.BOOKED.equals(slotStatus)) {
dto.setStatus(AppointmentOrderStatus.CHECKED_IN.equals(raw.getOrderStatus()) ? "已取号" : "已预约");
} else if (SlotStatus.STOPPED.equals(slotStatus)) {
dto.setStatus("已停诊"); // 视业务可改回已取消
} else {
dto.setStatus("未预约");
}
} else {
dto.setStatus("未预约");
}
}
tickets.add(dto);
}
}
// 3. 封装分页响应结构并吐给前端
java.util.Map<String, Object> result = new java.util.HashMap<>();
result.put("list", tickets);
result.put("total", tickets.size());
result.put("page", 1);
result.put("limit", 20);
return R.ok(result);
}
@@ -268,7 +311,7 @@ public class TicketAppServiceImpl implements ITicketAppService {
dto.setBusNo(ticket.getBusNo());
dto.setDepartment(ticket.getDepartment());
dto.setDoctor(ticket.getDoctor());
// 处理号源类型转换为英文前端期望的是general或expert
String ticketType = ticket.getTicketType();
if ("普通".equals(ticketType)) {
@@ -278,10 +321,10 @@ public class TicketAppServiceImpl implements ITicketAppService {
} else {
dto.setTicketType(ticketType);
}
// 处理号源时间dateTime
dto.setDateTime(ticket.getTime());
// 处理号源状态(转换为中文)
String status = ticket.getStatus();
switch (status) {
@@ -300,12 +343,12 @@ public class TicketAppServiceImpl implements ITicketAppService {
default:
dto.setStatus(status);
}
dto.setFee(ticket.getFee());
dto.setPatientName(ticket.getPatientName());
dto.setPatientId(ticket.getMedicalCard()); // 就诊卡号
dto.setPhone(ticket.getPhone());
// 获取患者性别
if (ticket.getPatientId() != null) {
Patient patient = patientService.getById(ticket.getPatientId());
@@ -325,7 +368,7 @@ public class TicketAppServiceImpl implements ITicketAppService {
}
}
}
dto.setAppointmentDate(ticket.getAppointmentDate());
dto.setAppointmentTime(ticket.getAppointmentTime());
dto.setDepartmentId(ticket.getDepartmentId());

View File

@@ -3,8 +3,12 @@ package com.openhis.web.appointmentmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.annotation.Anonymous;
import com.core.common.core.domain.R;
import com.openhis.appointmentmanage.domain.AppointmentBookDTO;
import com.openhis.appointmentmanage.dto.TicketQueryDTO;
import com.openhis.web.appointmentmanage.appservice.ITicketAppService;
import com.openhis.web.appointmentmanage.dto.TicketDto;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -19,11 +23,35 @@ import java.util.Map;
@RequestMapping("/appointment/ticket")
public class TicketController {
/**
* 分页查询门诊号源列表 (带多条件过滤)
*
* @param query 查询条件
* @return 分页号源列表
*/
@Anonymous
@PostMapping("/list")
public R<?> listTicket(@RequestBody @Validated TicketQueryDTO query) {
return ticketAppService.listTicket(query);
}
/**
* 查询医生余号汇总(基于号源池,不受分页影响)
*
* @param query 查询条件
* @return 医生余号列表
*/
@Anonymous
@PostMapping("/doctorSummary")
public R<?> listDoctorAvailability(@RequestBody @Validated TicketQueryDTO query) {
return ticketAppService.listDoctorAvailability(query);
}
@Resource
private ITicketAppService ticketAppService;
/**
* 查询所有号源(用于测试)
* 查询所有号源
*
* @return 所有号源列表
*/
@@ -36,44 +64,44 @@ public class TicketController {
/**
* 预约号源
*
* @param params 预约参数
* @param dto 预约参数
* @return 结果
*/
@PostMapping("/book")
public R<?> bookTicket(@RequestBody Map<String, Object> params) {
return ticketAppService.bookTicket(params);
public R<?> bookTicket(@RequestBody @Validated AppointmentBookDTO dto) {
return ticketAppService.bookTicket(dto);
}
/**
* 取消预约
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
@PostMapping("/cancel")
public R<?> cancelTicket(@RequestParam Long ticketId) {
return ticketAppService.cancelTicket(ticketId);
public R<?> cancelTicket(@RequestParam Long slotId) {
return ticketAppService.cancelTicket(slotId);
}
/**
* 取号
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
@PostMapping("/checkin")
public R<?> checkInTicket(@RequestParam Long ticketId) {
return ticketAppService.checkInTicket(ticketId);
public R<?> checkInTicket(@RequestParam Long slotId) {
return ticketAppService.checkInTicket(slotId);
}
/**
* 停诊
*
* @param ticketId 号源ID
* @param slotId 槽位ID
* @return 结果
*/
@PostMapping("/cancelConsultation")
public R<?> cancelConsultation(@RequestParam Long ticketId) {
return ticketAppService.cancelConsultation(ticketId);
public R<?> cancelConsultation(@RequestParam Long slotId) {
return ticketAppService.cancelConsultation(slotId);
}
}

View File

@@ -49,7 +49,7 @@ public class TicketDto {
private String dateTime;
/**
* 状态 (unbooked:未预约, booked:已预约, checked:已取号, cancelled:已取消, locked:已锁定)
* 状态
*/
private String status;