Fix Bug #550: AI修复
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.AppointmentConfig;
|
||||
|
||||
/**
|
||||
* 预约配置AppService接口
|
||||
*
|
||||
* @author openhis
|
||||
* @date 2026-03-23
|
||||
*/
|
||||
public interface IAppointmentConfigAppService {
|
||||
|
||||
/**
|
||||
* 获取当前机构的预约配置
|
||||
*
|
||||
* @return 预约配置
|
||||
*/
|
||||
R<?> getAppointmentConfig();
|
||||
|
||||
/**
|
||||
* 保存预约配置
|
||||
*
|
||||
* @param appointmentConfig 预约配置
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveAppointmentConfig(AppointmentConfig appointmentConfig);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
|
||||
public interface IClinicRoomAppService {
|
||||
|
||||
/**
|
||||
* 分页查询诊室列表
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param orgName 卫生机构名称
|
||||
* @param roomName 诊室名称
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
R<?> selectClinicRoomPage(Integer pageNum, Integer pageSize, String orgName, String roomName);
|
||||
|
||||
/**
|
||||
* 查询诊室详情
|
||||
* @param id 诊室ID
|
||||
* @return 诊室详情
|
||||
*/
|
||||
R<?> selectClinicRoomById(Long id);
|
||||
|
||||
/**
|
||||
* 新增诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
R<?> insertClinicRoom(ClinicRoom clinicRoom);
|
||||
|
||||
/**
|
||||
* 更新诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
R<?> updateClinicRoom(ClinicRoom clinicRoom);
|
||||
|
||||
/**
|
||||
* 删除诊室
|
||||
* @param id 诊室ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
R<?> deleteClinicRoomById(Long id);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
import com.core.common.core.domain.R;
|
||||
public interface IDeptAppService {
|
||||
|
||||
R<?> getDeptList();
|
||||
|
||||
R<?> searchDept(Integer pageNo, Integer pageSize, String orgName, String deptName);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
|
||||
public interface IDeptAppointmentHoursAppService {
|
||||
|
||||
R<?> getDeptAppthoursList(DeptAppointmentHours deptAppointmentHours, Integer pageNum, Integer pageSize);
|
||||
|
||||
R<?> getDeptAppthoursDetail(Long id);
|
||||
|
||||
R<?> addDeptAppthours(DeptAppointmentHours deptAppointmentHours);
|
||||
|
||||
R<?> updateDeptAppthours(DeptAppointmentHours deptAppointmentHours);
|
||||
|
||||
R<?> deleteDeptAppthours(Long id);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DoctorSchedule;
|
||||
|
||||
public interface IDoctorScheduleAppService {
|
||||
|
||||
R<?> getDoctorScheduleList();
|
||||
|
||||
R<?> getTodayDoctorScheduleList();
|
||||
|
||||
R<?> getTodayMySchedule();
|
||||
|
||||
R<?> getDoctorScheduleListByDeptId(Long deptId);
|
||||
|
||||
R<?> getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate);
|
||||
|
||||
R<?> addDoctorSchedule(DoctorSchedule doctorSchedule);
|
||||
|
||||
R<?> addDoctorScheduleWithDate(DoctorSchedule doctorSchedule, String scheduledDate);
|
||||
|
||||
R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule);
|
||||
|
||||
R<?> removeDoctorSchedule(Integer doctorScheduleId);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.appointmentmanage.dto.SchedulePoolDto;
|
||||
|
||||
public interface ISchedulePoolAppService {
|
||||
R<?> addSchedulePool(SchedulePoolDto schedulePoolDto);
|
||||
|
||||
R<?> list(SchedulePoolDto schedulePoolDto);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice;
|
||||
|
||||
public interface IScheduleSlotAppService {
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 号源管理应用服务接口
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ITicketAppService {
|
||||
|
||||
/**
|
||||
* 分页查询门诊号源列表(真分页)
|
||||
*
|
||||
* @param query 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> listTicket(TicketQueryDTO query);
|
||||
|
||||
/**
|
||||
* 查询医生余号汇总(基于号源池,不受分页影响)
|
||||
*
|
||||
* @param query 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> listDoctorAvailability(TicketQueryDTO query);
|
||||
|
||||
/**
|
||||
* 预约号源
|
||||
*
|
||||
* @param dto 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> bookTicket(com.openhis.appointmentmanage.domain.AppointmentBookDTO dto);
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelTicket(Long slotId);
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> checkInTicket(Long slotId);
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelConsultation(Long slotId);
|
||||
|
||||
/**
|
||||
* 查询所有号源(用于测试)
|
||||
*
|
||||
* @return 所有号源列表
|
||||
*/
|
||||
R<?> listAllTickets();
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.appointmentmanage.domain.AppointmentConfig;
|
||||
import com.openhis.appointmentmanage.service.IAppointmentConfigService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IAppointmentConfigAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 预约配置AppService实现类
|
||||
*
|
||||
* @author openhis
|
||||
* @date 2026-03-23
|
||||
*/
|
||||
@Service
|
||||
public class AppointmentConfigAppServiceImpl implements IAppointmentConfigAppService {
|
||||
|
||||
@Resource
|
||||
private IAppointmentConfigService appointmentConfigService;
|
||||
|
||||
@Override
|
||||
public R<?> getAppointmentConfig() {
|
||||
// 获取当前登录用户的机构ID
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
if (tenantId == null) {
|
||||
return R.fail("获取机构信息失败");
|
||||
}
|
||||
|
||||
AppointmentConfig config = appointmentConfigService.getConfigByTenantId(tenantId);
|
||||
return R.ok(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> saveAppointmentConfig(AppointmentConfig appointmentConfig) {
|
||||
// 获取当前登录用户的机构ID
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||
if (tenantId == null) {
|
||||
return R.fail("获取机构信息失败");
|
||||
}
|
||||
|
||||
// 查询是否已存在配置
|
||||
AppointmentConfig existingConfig = appointmentConfigService.getConfigByTenantId(tenantId);
|
||||
|
||||
if (existingConfig != null) {
|
||||
// 更新现有配置
|
||||
existingConfig.setCancelAppointmentType(appointmentConfig.getCancelAppointmentType());
|
||||
existingConfig.setCancelAppointmentCount(appointmentConfig.getCancelAppointmentCount());
|
||||
existingConfig.setValidFlag(appointmentConfig.getValidFlag());
|
||||
appointmentConfigService.saveOrUpdate(existingConfig);
|
||||
return R.ok(existingConfig);
|
||||
} else {
|
||||
// 新增配置
|
||||
appointmentConfig.setTenantId(tenantId);
|
||||
appointmentConfig.setValidFlag(1);
|
||||
appointmentConfigService.saveOrUpdateConfig(appointmentConfig);
|
||||
return R.ok(appointmentConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
import com.openhis.appointmentmanage.service.IClinicRoomService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IClinicRoomAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class ClinicRoomAppServiceImpl implements IClinicRoomAppService {
|
||||
|
||||
@Resource
|
||||
private IClinicRoomService clinicRoomService;
|
||||
|
||||
@Override
|
||||
public R<?> selectClinicRoomPage(Integer pageNum, Integer pageSize, String orgName, String roomName) {
|
||||
// 构建查询条件
|
||||
ClinicRoom clinicRoom = new ClinicRoom();
|
||||
if (orgName != null && ObjectUtil.isNotEmpty(orgName)) {
|
||||
clinicRoom.setOrgName(orgName);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> selectClinicRoomById(Long id) {
|
||||
ClinicRoom clinicRoom = clinicRoomService.selectClinicRoomById(id);
|
||||
if (clinicRoom == null) {
|
||||
return R.fail(404, "诊室不存在");
|
||||
}
|
||||
return R.ok(clinicRoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> insertClinicRoom(ClinicRoom clinicRoom) {
|
||||
// 数据校验
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getRoomName())) {
|
||||
return R.fail(400, "诊室名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getDepartment())) {
|
||||
return R.fail(400, "科室名称不能为空");
|
||||
}
|
||||
if (clinicRoom.getRoomName().length() > 50) {
|
||||
return R.fail(400, "诊室名称长度不能超过50个字符");
|
||||
}
|
||||
if (clinicRoom.getRemarks() != null && clinicRoom.getRemarks().length() > 500) {
|
||||
return R.fail(400, "备注长度不能超过500个字符");
|
||||
}
|
||||
|
||||
// 新增诊室
|
||||
int result = clinicRoomService.insertClinicRoom(clinicRoom);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "新增成功");
|
||||
} else {
|
||||
return R.fail("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateClinicRoom(ClinicRoom clinicRoom) {
|
||||
// 数据校验
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getId())) {
|
||||
return R.fail(400, "诊室ID不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getRoomName())) {
|
||||
return R.fail(400, "诊室名称不能为空");
|
||||
}
|
||||
if (ObjectUtil.isEmpty(clinicRoom.getDepartment())) {
|
||||
return R.fail(400, "科室名称不能为空");
|
||||
}
|
||||
if (clinicRoom.getRoomName().length() > 50) {
|
||||
return R.fail(400, "诊室名称长度不能超过50个字符");
|
||||
}
|
||||
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, "诊室不存在");
|
||||
}
|
||||
|
||||
// 更新诊室
|
||||
int result = clinicRoomService.updateClinicRoom(clinicRoom);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "修改成功");
|
||||
} else {
|
||||
return R.fail("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> deleteClinicRoomById(Long id) {
|
||||
// 检查诊室是否存在
|
||||
ClinicRoom existingClinicRoom = clinicRoomService.selectClinicRoomById(id);
|
||||
if (existingClinicRoom == null) {
|
||||
return R.fail(404, "诊室不存在");
|
||||
}
|
||||
|
||||
// 删除诊室
|
||||
int result = clinicRoomService.deleteClinicRoomById(id);
|
||||
if (result > 0) {
|
||||
return R.ok(null, "删除成功");
|
||||
} else {
|
||||
return R.fail("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.Dept;
|
||||
import com.openhis.appointmentmanage.service.IDeptService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DeptAppServiceImpl implements IDeptAppService {
|
||||
|
||||
@Resource
|
||||
private IDeptService deptService;
|
||||
|
||||
@Override
|
||||
public R<?> getDeptList() {
|
||||
List<Dept> list = deptService.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> searchDept(Integer pageNo, Integer pageSize, String orgName, String deptName) {
|
||||
LambdaQueryWrapper<Dept> wrapper = new LambdaQueryWrapper<>();
|
||||
if (orgName != null && ObjectUtil.isNotEmpty(orgName)) {
|
||||
wrapper.eq(Dept::getOrgName, orgName);
|
||||
}
|
||||
if (deptName != null && ObjectUtil.isNotEmpty(deptName)) {
|
||||
wrapper.eq(Dept::getDeptName, deptName);
|
||||
}
|
||||
List<Dept> list = deptService.list(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
import com.openhis.appointmentmanage.mapper.DeptAppointmentHoursMapper;
|
||||
import com.openhis.appointmentmanage.service.IDeptAppointmentHoursService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppointmentHoursAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DeptAppointmentHoursAppServiceImpl implements IDeptAppointmentHoursAppService {
|
||||
|
||||
@Resource
|
||||
private IDeptAppointmentHoursService deptAppointmentHoursService;
|
||||
|
||||
@Resource
|
||||
private DeptAppointmentHoursMapper deptAppointmentHoursMapper;
|
||||
|
||||
@Override
|
||||
public R<?> getDeptAppthoursList(DeptAppointmentHours deptAppointmentHours, Integer pageNum, Integer pageSize) {
|
||||
LambdaQueryWrapper<DeptAppointmentHours> wrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(deptAppointmentHours.getInstitution())) {
|
||||
wrapper.eq(DeptAppointmentHours::getInstitution, deptAppointmentHours.getInstitution());
|
||||
}
|
||||
if (StrUtil.isNotBlank(deptAppointmentHours.getDepartment())) {
|
||||
wrapper.eq(DeptAppointmentHours::getDepartment, deptAppointmentHours.getDepartment());
|
||||
}
|
||||
wrapper.orderByDesc(DeptAppointmentHours::getCreatedTime);
|
||||
|
||||
Page<DeptAppointmentHours> page = new Page<>(pageNum, pageSize);
|
||||
Page<DeptAppointmentHours> resultPage = deptAppointmentHoursMapper.selectPage(page, wrapper);
|
||||
|
||||
return R.ok(resultPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getDeptAppthoursDetail(Long id) {
|
||||
if (ObjectUtil.isNull(id)) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
DeptAppointmentHours deptAppointmentHours = deptAppointmentHoursService.getById(id);
|
||||
if (ObjectUtil.isNull(deptAppointmentHours)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
return R.ok(deptAppointmentHours);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDeptAppthours(DeptAppointmentHours deptAppointmentHours) {
|
||||
if (ObjectUtil.isNull(deptAppointmentHours)) {
|
||||
return R.fail("数据不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(deptAppointmentHours.getInstitution())) {
|
||||
return R.fail("所属机构不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(deptAppointmentHours.getDepartment())) {
|
||||
return R.fail("科室名称不能为空");
|
||||
}
|
||||
|
||||
deptAppointmentHours.setCreatedTime(LocalDateTime.now());
|
||||
boolean save = deptAppointmentHoursService.save(deptAppointmentHours);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> updateDeptAppthours(DeptAppointmentHours deptAppointmentHours) {
|
||||
if (ObjectUtil.isNull(deptAppointmentHours) || ObjectUtil.isNull(deptAppointmentHours.getId())) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
|
||||
DeptAppointmentHours existing = deptAppointmentHoursService.getById(deptAppointmentHours.getId());
|
||||
if (ObjectUtil.isNull(existing)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
deptAppointmentHours.setUpdatedTime(LocalDateTime.now());
|
||||
boolean update = deptAppointmentHoursService.updateById(deptAppointmentHours);
|
||||
return R.ok(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> deleteDeptAppthours(Long id) {
|
||||
if (ObjectUtil.isNull(id)) {
|
||||
return R.fail("ID不能为空");
|
||||
}
|
||||
|
||||
DeptAppointmentHours existing = deptAppointmentHoursService.getById(id);
|
||||
if (ObjectUtil.isNull(existing)) {
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
boolean remove = deptAppointmentHoursService.removeById(id);
|
||||
return R.ok(remove);
|
||||
}
|
||||
}
|
||||
@@ -1,532 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.enums.SlotStatus;
|
||||
import com.openhis.appointmentmanage.domain.DoctorSchedule;
|
||||
import com.openhis.appointmentmanage.domain.DoctorScheduleWithDateDto;
|
||||
import com.openhis.appointmentmanage.domain.SchedulePool;
|
||||
import com.openhis.appointmentmanage.domain.ScheduleSlot;
|
||||
import com.openhis.appointmentmanage.mapper.DoctorScheduleMapper;
|
||||
import com.openhis.appointmentmanage.service.IDoctorScheduleService;
|
||||
import com.openhis.appointmentmanage.service.ISchedulePoolService;
|
||||
import com.openhis.appointmentmanage.service.IScheduleSlotService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDoctorScheduleAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
|
||||
@Resource
|
||||
private IDoctorScheduleService doctorScheduleService;
|
||||
|
||||
@Resource
|
||||
private ISchedulePoolService schedulePoolService;
|
||||
|
||||
@Resource
|
||||
private IScheduleSlotService scheduleSlotService;
|
||||
|
||||
@Resource
|
||||
private DoctorScheduleMapper doctorScheduleMapper;
|
||||
|
||||
@Override
|
||||
public R<?> getDoctorScheduleList() {
|
||||
List<DoctorSchedule> list = doctorScheduleService.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getDoctorScheduleListByDeptId(Long deptId) {
|
||||
List<DoctorSchedule> list = doctorScheduleService.list(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<DoctorSchedule>()
|
||||
.eq("dept_id", deptId));
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate) {
|
||||
// 联表查询 adm_doctor_schedule LEFT JOIN adm_schedule_pool,
|
||||
// 通过 schedule_date 获取具体出诊日期,解决按星期匹配导致日期错位的问题
|
||||
List<DoctorScheduleWithDateDto> list = doctorScheduleMapper.selectScheduleWithDateByDeptAndRange(
|
||||
deptId, startDate, endDate);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public R<?> getTodayDoctorScheduleList() {
|
||||
// 联表查询 adm_schedule_pool,按今日具体日期查询排班,替代原来按星期匹配的方式
|
||||
String todayStr = LocalDate.now().toString(); // yyyy-MM-dd
|
||||
List<DoctorScheduleWithDateDto> list = doctorScheduleMapper.selectTodaySchedule(todayStr);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public R<?> getTodayMySchedule() {
|
||||
// 联表查询 adm_schedule_pool,按今日具体日期 + 医生ID 查询个人排班
|
||||
String todayStr = LocalDate.now().toString(); // yyyy-MM-dd
|
||||
|
||||
// 从 SecurityUtils 获取当前登录医生ID
|
||||
Long currentDoctorId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
if (currentDoctorId != null) {
|
||||
List<DoctorScheduleWithDateDto> list = doctorScheduleMapper.selectTodayMySchedule(todayStr,
|
||||
currentDoctorId);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
// 如果未绑定医生,则返回空列表
|
||||
return R.ok(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
|
||||
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
||||
return R.fail("医生排班不能为空");
|
||||
}
|
||||
|
||||
if (doctorSchedule.getLimitNumber() == null || doctorSchedule.getLimitNumber() <= 0) {
|
||||
return R.fail("限号数量必须大于0");
|
||||
}
|
||||
|
||||
// 创建新对象,排除id字段(数据库id列是GENERATED ALWAYS,由数据库自动生成)
|
||||
DoctorSchedule newSchedule = new DoctorSchedule();
|
||||
newSchedule.setWeekday(doctorSchedule.getWeekday());
|
||||
newSchedule.setTimePeriod(doctorSchedule.getTimePeriod());
|
||||
newSchedule.setDoctor(doctorSchedule.getDoctor());
|
||||
newSchedule.setClinic(doctorSchedule.getClinic());
|
||||
newSchedule.setStartTime(doctorSchedule.getStartTime());
|
||||
newSchedule.setEndTime(doctorSchedule.getEndTime());
|
||||
newSchedule.setLimitNumber(doctorSchedule.getLimitNumber());
|
||||
// call_sign_record 字段不能为null,设置默认值为空字符串
|
||||
newSchedule.setCallSignRecord(
|
||||
doctorSchedule.getCallSignRecord() != null ? doctorSchedule.getCallSignRecord() : "");
|
||||
newSchedule.setRegisterItem(doctorSchedule.getRegisterItem() != null ? doctorSchedule.getRegisterItem() : "");
|
||||
newSchedule.setRegisterFee(doctorSchedule.getRegisterFee() != null ? doctorSchedule.getRegisterFee() : 0);
|
||||
newSchedule
|
||||
.setDiagnosisItem(doctorSchedule.getDiagnosisItem() != null ? doctorSchedule.getDiagnosisItem() : "");
|
||||
newSchedule.setDiagnosisFee(doctorSchedule.getDiagnosisFee() != null ? doctorSchedule.getDiagnosisFee() : 0);
|
||||
newSchedule.setIsOnline(doctorSchedule.getIsOnline() != null ? doctorSchedule.getIsOnline() : true);
|
||||
newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false);
|
||||
newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : "");
|
||||
newSchedule.setDeptId(doctorSchedule.getDeptId());
|
||||
newSchedule.setRegType(doctorSchedule.getRegType() != null ? doctorSchedule.getRegType() : 0);
|
||||
newSchedule.setDoctorId(doctorSchedule.getDoctorId());
|
||||
|
||||
// 不设置id字段,让数据库自动生成
|
||||
// 使用自定义的insertWithoutId方法,确保INSERT语句不包含id字段
|
||||
int result = doctorScheduleMapper.insertWithoutId(newSchedule);
|
||||
|
||||
if (result > 0) {
|
||||
// 创建号源池,并传入正确的医生ID
|
||||
SchedulePool pool = createSchedulePool(newSchedule, doctorSchedule.getDoctorId());
|
||||
boolean poolSaved = schedulePoolService.save(pool);
|
||||
|
||||
if (poolSaved) {
|
||||
// 创建号源槽
|
||||
List<ScheduleSlot> slots = createScheduleSlots(pool.getId(), newSchedule.getLimitNumber(),
|
||||
newSchedule.getStartTime(), newSchedule.getEndTime());
|
||||
boolean slotsSaved = scheduleSlotService.saveBatch(slots);
|
||||
|
||||
if (slotsSaved) {
|
||||
// 不更新available_num字段,因为它是数据库生成列
|
||||
// pool.setAvailableNum(newSchedule.getLimitNumber());
|
||||
// schedulePoolService.updateById(pool);
|
||||
|
||||
return R.ok(newSchedule);
|
||||
} else {
|
||||
throw new RuntimeException("创建号源槽失败");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("创建号源池失败");
|
||||
}
|
||||
} else {
|
||||
return R.fail("保存排班信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDoctorScheduleWithDate(DoctorSchedule doctorSchedule, String scheduledDate) {
|
||||
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
||||
return R.fail("医生排班不能为空");
|
||||
}
|
||||
|
||||
if (doctorSchedule.getLimitNumber() == null || doctorSchedule.getLimitNumber() <= 0) {
|
||||
return R.fail("限号数量必须大于0");
|
||||
}
|
||||
|
||||
// 检查结束时间必须大于开始时间
|
||||
if (doctorSchedule.getStartTime() != null && doctorSchedule.getEndTime() != null) {
|
||||
if (!doctorSchedule.getStartTime().isBefore(doctorSchedule.getEndTime())) {
|
||||
return R.fail("结束时间必须大于开始时间");
|
||||
}
|
||||
}
|
||||
|
||||
// 检查时间重叠(同一医生、同一天时间段有重叠)
|
||||
if (doctorSchedule.getDoctorId() != null && scheduledDate != null
|
||||
&& doctorSchedule.getStartTime() != null && doctorSchedule.getEndTime() != null) {
|
||||
LocalDate scheduleDate = LocalDate.parse(scheduledDate);
|
||||
boolean hasOverlap = checkTimeOverlap(
|
||||
doctorSchedule.getDoctorId(),
|
||||
scheduleDate,
|
||||
doctorSchedule.getStartTime(),
|
||||
doctorSchedule.getEndTime()
|
||||
);
|
||||
if (hasOverlap) {
|
||||
return R.fail("该医生在 " + scheduledDate + " 的 "
|
||||
+ doctorSchedule.getStartTime() + "-" + doctorSchedule.getEndTime()
|
||||
+ " 时间段与已有排班重叠,不能重复添加");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建新对象,排除id字段(数据库id列是GENERATED ALWAYS,由数据库自动生成)
|
||||
DoctorSchedule newSchedule = new DoctorSchedule();
|
||||
newSchedule.setWeekday(doctorSchedule.getWeekday());
|
||||
newSchedule.setTimePeriod(doctorSchedule.getTimePeriod());
|
||||
newSchedule.setDoctor(doctorSchedule.getDoctor());
|
||||
newSchedule.setClinic(doctorSchedule.getClinic());
|
||||
newSchedule.setStartTime(doctorSchedule.getStartTime());
|
||||
newSchedule.setEndTime(doctorSchedule.getEndTime());
|
||||
newSchedule.setLimitNumber(doctorSchedule.getLimitNumber());
|
||||
// call_sign_record 字段不能为null,设置默认值为空字符串
|
||||
newSchedule.setCallSignRecord(
|
||||
doctorSchedule.getCallSignRecord() != null ? doctorSchedule.getCallSignRecord() : "");
|
||||
newSchedule.setRegisterItem(doctorSchedule.getRegisterItem() != null ? doctorSchedule.getRegisterItem() : "");
|
||||
newSchedule.setRegisterFee(doctorSchedule.getRegisterFee() != null ? doctorSchedule.getRegisterFee() : 0);
|
||||
newSchedule
|
||||
.setDiagnosisItem(doctorSchedule.getDiagnosisItem() != null ? doctorSchedule.getDiagnosisItem() : "");
|
||||
newSchedule.setDiagnosisFee(doctorSchedule.getDiagnosisFee() != null ? doctorSchedule.getDiagnosisFee() : 0);
|
||||
newSchedule.setIsOnline(doctorSchedule.getIsOnline() != null ? doctorSchedule.getIsOnline() : true);
|
||||
newSchedule.setIsStopped(doctorSchedule.getIsStopped() != null ? doctorSchedule.getIsStopped() : false);
|
||||
newSchedule.setStopReason(doctorSchedule.getStopReason() != null ? doctorSchedule.getStopReason() : "");
|
||||
newSchedule.setDeptId(doctorSchedule.getDeptId());
|
||||
newSchedule.setRegType(doctorSchedule.getRegType() != null ? doctorSchedule.getRegType() : 0);
|
||||
newSchedule.setDoctorId(doctorSchedule.getDoctorId());
|
||||
|
||||
// 不设置id字段,让数据库自动生成
|
||||
// 使用自定义的insertWithoutId方法,确保INSERT语句不包含id字段
|
||||
int result = doctorScheduleMapper.insertWithoutId(newSchedule);
|
||||
|
||||
if (result > 0) {
|
||||
// 创建号源池,并传入正确的医生ID和具体日期
|
||||
SchedulePool pool = createSchedulePoolWithDate(newSchedule, doctorSchedule.getDoctorId(), scheduledDate);
|
||||
boolean poolSaved = schedulePoolService.save(pool);
|
||||
|
||||
if (poolSaved) {
|
||||
// 创建号源槽
|
||||
List<ScheduleSlot> slots = createScheduleSlots(pool.getId(), newSchedule.getLimitNumber(),
|
||||
newSchedule.getStartTime(), newSchedule.getEndTime());
|
||||
boolean slotsSaved = scheduleSlotService.saveBatch(slots);
|
||||
|
||||
if (slotsSaved) {
|
||||
return R.ok(newSchedule);
|
||||
} else {
|
||||
throw new RuntimeException("创建号源槽失败");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("创建号源池失败");
|
||||
}
|
||||
} else {
|
||||
return R.fail("保存排班信息失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule) {
|
||||
if (ObjectUtil.isEmpty(doctorSchedule) || ObjectUtil.isEmpty(doctorSchedule.getId())) {
|
||||
return R.fail("医生排班ID不能为空");
|
||||
}
|
||||
|
||||
int result = doctorScheduleMapper.updateDoctorSchedule(doctorSchedule);
|
||||
if (result <= 0) {
|
||||
return R.fail("更新排班信息失败");
|
||||
}
|
||||
|
||||
// 同步更新号源池,避免查询联表时医生/诊室等字段看起来“未更新”
|
||||
boolean needSyncPool = doctorSchedule.getDoctorId() != null
|
||||
|| doctorSchedule.getDoctor() != null
|
||||
|| doctorSchedule.getClinic() != null
|
||||
|| doctorSchedule.getStartTime() != null
|
||||
|| doctorSchedule.getEndTime() != null
|
||||
|| doctorSchedule.getLimitNumber() != null
|
||||
|| doctorSchedule.getStopReason() != null
|
||||
|| doctorSchedule.getRegType() != null
|
||||
|| doctorSchedule.getRegisterFee() != null
|
||||
|| doctorSchedule.getRegisterItem() != null
|
||||
|| doctorSchedule.getDiagnosisItem() != null
|
||||
|| doctorSchedule.getDiagnosisFee() != null;
|
||||
|
||||
if (needSyncPool) {
|
||||
schedulePoolService.lambdaUpdate()
|
||||
.eq(SchedulePool::getScheduleId, doctorSchedule.getId())
|
||||
.set(doctorSchedule.getDoctorId() != null, SchedulePool::getDoctorId, doctorSchedule.getDoctorId())
|
||||
.set(doctorSchedule.getDoctor() != null, SchedulePool::getDoctorName, doctorSchedule.getDoctor())
|
||||
.set(doctorSchedule.getClinic() != null, SchedulePool::getClinicRoom, doctorSchedule.getClinic())
|
||||
.set(doctorSchedule.getStartTime() != null, SchedulePool::getStartTime, doctorSchedule.getStartTime())
|
||||
.set(doctorSchedule.getEndTime() != null, SchedulePool::getEndTime, doctorSchedule.getEndTime())
|
||||
.set(doctorSchedule.getLimitNumber() != null, SchedulePool::getTotalQuota,
|
||||
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, Double.valueOf(doctorSchedule.getRegisterFee().toString()))
|
||||
.set(doctorSchedule.getRegisterFee() != null, SchedulePool::getInsurancePrice,
|
||||
Double.valueOf(doctorSchedule.getRegisterFee().toString()))
|
||||
.update();
|
||||
}
|
||||
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建号源池
|
||||
*/
|
||||
private SchedulePool createSchedulePool(DoctorSchedule schedule, Long doctorId) {
|
||||
SchedulePool pool = new SchedulePool();
|
||||
// 生成唯一池编码
|
||||
pool.setPoolCode("POOL_" + System.currentTimeMillis());
|
||||
pool.setHospitalId(1L); // 默认医院ID,实际项目中应从上下文获取
|
||||
pool.setDoctorId(doctorId); // 使用正确的医生ID
|
||||
pool.setDoctorName(schedule.getDoctor());
|
||||
pool.setDeptId(schedule.getDeptId());
|
||||
pool.setClinicRoom(schedule.getClinic());
|
||||
// 设置出诊日期,这里假设是下周的对应星期
|
||||
pool.setScheduleDate(calculateScheduleDate(schedule.getWeekday()));
|
||||
pool.setShift(schedule.getTimePeriod());
|
||||
pool.setStartTime(schedule.getStartTime());
|
||||
pool.setEndTime(schedule.getEndTime());
|
||||
pool.setTotalQuota(schedule.getLimitNumber());
|
||||
pool.setBookedNum(0);
|
||||
pool.setLockedNum(0);
|
||||
// 不设置available_num,因为它是数据库生成列
|
||||
// pool.setAvailableNum(0); // 初始为0,稍后更新
|
||||
pool.setRegType(schedule.getRegisterItem() != null ? schedule.getRegisterItem() : "普通");
|
||||
pool.setFee(schedule.getRegisterFee() != null ? Double.valueOf(schedule.getRegisterFee().toString()) : 0.0); // 直接使用原始价格
|
||||
pool.setInsurancePrice(pool.getFee()); // 医保价格暂时与原价相同
|
||||
// 暂时设置support_channel为空字符串,避免JSON类型问题
|
||||
pool.setSupportChannel("");
|
||||
pool.setStatus(1); // 1表示可用
|
||||
|
||||
// 设置时间字段
|
||||
java.util.Date now = new java.util.Date();
|
||||
java.util.Date tomorrow = new java.util.Date(System.currentTimeMillis() + 24 * 60 * 60 * 1000); // 明天的时间
|
||||
|
||||
pool.setReleaseTime(now);
|
||||
pool.setDeadlineTime(tomorrow); // 截止时间为明天
|
||||
pool.setScheduleId(schedule.getId());
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建号源池(使用具体日期)
|
||||
*/
|
||||
private SchedulePool createSchedulePoolWithDate(DoctorSchedule schedule, Long doctorId, String scheduledDateStr) {
|
||||
SchedulePool pool = new SchedulePool();
|
||||
// 生成唯一池编码
|
||||
pool.setPoolCode("POOL_" + System.currentTimeMillis());
|
||||
pool.setHospitalId(1L); // 默认医院ID,实际项目中应从上下文获取
|
||||
pool.setDoctorId(doctorId); // 使用正确的医生ID
|
||||
pool.setDoctorName(schedule.getDoctor());
|
||||
pool.setDeptId(schedule.getDeptId());
|
||||
pool.setClinicRoom(schedule.getClinic());
|
||||
|
||||
// 使用传入的具体日期
|
||||
if (scheduledDateStr != null && !scheduledDateStr.isEmpty()) {
|
||||
try {
|
||||
LocalDate scheduledDate = LocalDate.parse(scheduledDateStr);
|
||||
pool.setScheduleDate(scheduledDate);
|
||||
} catch (Exception e) {
|
||||
// 如果解析失败,回退到原来的计算方式
|
||||
pool.setScheduleDate(calculateScheduleDate(schedule.getWeekday()));
|
||||
}
|
||||
} else {
|
||||
// 如果没有提供具体日期,使用原来的计算方式
|
||||
pool.setScheduleDate(calculateScheduleDate(schedule.getWeekday()));
|
||||
}
|
||||
|
||||
pool.setShift(schedule.getTimePeriod());
|
||||
pool.setStartTime(schedule.getStartTime());
|
||||
pool.setEndTime(schedule.getEndTime());
|
||||
pool.setTotalQuota(schedule.getLimitNumber());
|
||||
pool.setBookedNum(0);
|
||||
pool.setLockedNum(0);
|
||||
// 不设置available_num,因为它是数据库生成列
|
||||
// pool.setAvailableNum(0); // 初始为0,稍后更新
|
||||
pool.setRegType(schedule.getRegisterItem() != null ? schedule.getRegisterItem() : "普通");
|
||||
pool.setFee(schedule.getRegisterFee() != null ? Double.valueOf(schedule.getRegisterFee().toString()) : 0.0); // 直接使用原始价格
|
||||
pool.setInsurancePrice(pool.getFee()); // 医保价格暂时与原价相同
|
||||
// 暂时设置support_channel为空字符串,避免JSON类型问题
|
||||
pool.setSupportChannel("");
|
||||
pool.setStatus(1); // 1表示可用
|
||||
|
||||
// 设置时间字段
|
||||
java.util.Date now = new java.util.Date();
|
||||
java.util.Date tomorrow = new java.util.Date(System.currentTimeMillis() + 24 * 60 * 60 * 1000); // 明天的时间
|
||||
|
||||
pool.setReleaseTime(now);
|
||||
pool.setDeadlineTime(tomorrow); // 截止时间为明天
|
||||
pool.setScheduleId(schedule.getId());
|
||||
|
||||
return pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建号源槽
|
||||
*/
|
||||
private List<ScheduleSlot> createScheduleSlots(Long poolId, Integer limitNumber, LocalTime startTime,
|
||||
LocalTime endTime) {
|
||||
List<ScheduleSlot> slots = new ArrayList<>();
|
||||
|
||||
// 计算时间间隔
|
||||
long totalTimeMinutes = startTime.until(endTime, java.time.temporal.ChronoUnit.MINUTES);
|
||||
long interval = totalTimeMinutes / limitNumber;
|
||||
|
||||
for (int i = 1; i <= limitNumber; i++) {
|
||||
ScheduleSlot slot = new ScheduleSlot();
|
||||
slot.setPoolId(poolId);
|
||||
slot.setSeqNo(i); // 序号
|
||||
slot.setStatus(0); // 0表示可用
|
||||
// 计算预计叫号时间,均匀分布在开始时间和结束时间之间
|
||||
LocalTime expectTime = startTime.plusMinutes(interval * (i - 1));
|
||||
slot.setExpectTime(expectTime);
|
||||
java.util.Date now = new java.util.Date();
|
||||
slot.setCreateTime(now);
|
||||
slot.setUpdateTime(now);
|
||||
|
||||
slots.add(slot);
|
||||
}
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查同一医生、同一天、同时段是否已存在排班
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param scheduleDate 出诊日期
|
||||
* @param timePeriod 时段(上午/下午)
|
||||
* @return true表示存在重复排班,false表示不存在
|
||||
*/
|
||||
// private boolean checkDuplicateSchedule(Long doctorId, LocalDate scheduleDate, String timePeriod) {
|
||||
// return schedulePoolService.lambdaQuery()
|
||||
// .eq(SchedulePool::getDoctorId, doctorId)
|
||||
// .eq(SchedulePool::getScheduleDate, scheduleDate)
|
||||
// .eq(SchedulePool::getShift, timePeriod)
|
||||
// .exists();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 检查同一医生、同一天是否有时间重叠的排班
|
||||
* 重叠判断:startA < endB AND startB < endA(即时间段有交集)
|
||||
*
|
||||
* @param doctorId 医生ID
|
||||
* @param scheduleDate 出诊日期
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return true表示存在时间重叠,false表示不重叠
|
||||
*/
|
||||
private boolean checkTimeOverlap(Long doctorId, LocalDate scheduleDate,
|
||||
LocalTime startTime, LocalTime endTime) {
|
||||
return schedulePoolService.lambdaQuery()
|
||||
.eq(SchedulePool::getDoctorId, doctorId)
|
||||
.eq(SchedulePool::getScheduleDate, scheduleDate)
|
||||
.lt(SchedulePool::getStartTime, endTime) // 已有开始时间 < 新结束时间
|
||||
.gt(SchedulePool::getEndTime, startTime) // 已有结束时间 > 新开始时间
|
||||
.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据星期几计算具体日期(下周的对应星期)
|
||||
*/
|
||||
private LocalDate calculateScheduleDate(String weekday) {
|
||||
// 这里简单实现,实际项目中可能需要更复杂的日期计算逻辑
|
||||
LocalDate today = LocalDate.now();
|
||||
int currentDayOfWeek = today.getDayOfWeek().getValue(); // 1=Monday, 7=Sunday
|
||||
int targetDayOfWeek = getDayOfWeekNumber(weekday); // 假设weekday是中文如"周一"
|
||||
|
||||
// 计算到下周对应星期的天数差
|
||||
int daysToAdd = targetDayOfWeek - currentDayOfWeek + 7; // 加7确保是下周
|
||||
return today.plusDays(daysToAdd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将中文星期转换为数字(1=周一,7=周日)
|
||||
*/
|
||||
private int getDayOfWeekNumber(String weekday) {
|
||||
switch (weekday) {
|
||||
case "周一":
|
||||
return 1;
|
||||
case "周二":
|
||||
return 2;
|
||||
case "周三":
|
||||
return 3;
|
||||
case "周四":
|
||||
return 4;
|
||||
case "周五":
|
||||
return 5;
|
||||
case "周六":
|
||||
return 6;
|
||||
case "周日":
|
||||
return 7;
|
||||
default:
|
||||
return 1; // 默认周一
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public R<?> removeDoctorSchedule(Integer doctorScheduleId) {
|
||||
if (doctorScheduleId == null) {
|
||||
return R.fail("排班id不能为空");
|
||||
}
|
||||
|
||||
// 1. 根据排班ID找到关联的号源池
|
||||
List<SchedulePool> pools = schedulePoolService.list(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<SchedulePool>()
|
||||
.eq("schedule_id", doctorScheduleId));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(pools)) {
|
||||
List<Long> poolIds = pools.stream().map(SchedulePool::getId).collect(java.util.stream.Collectors.toList());
|
||||
|
||||
// 该排班下存在有效患者预约(号源槽:已预约/已锁定/已取号)则禁止删除;已退号、仅可用/已取消槽位不计入
|
||||
long appointmentCount = scheduleSlotService.count(new QueryWrapper<ScheduleSlot>()
|
||||
.in("pool_id", poolIds)
|
||||
.in("status", SlotStatus.BOOKED.getValue(), SlotStatus.LOCKED.getValue(),
|
||||
SlotStatus.CHECKED_IN.getValue()));
|
||||
if (appointmentCount > 0) {
|
||||
return R.fail("该排班已有患者预约,禁止删除!如需取消请先处理患者退预约或使用'停诊'功能。");
|
||||
}
|
||||
|
||||
// 2. 根据号源池ID找到所有关联的号源槽
|
||||
List<ScheduleSlot> slots = scheduleSlotService.list(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<ScheduleSlot>()
|
||||
.in("pool_id", poolIds));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(slots)) {
|
||||
List<Long> slotIds = slots.stream().map(ScheduleSlot::getId)
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
// 3. 逻辑删除所有号源槽
|
||||
scheduleSlotService.removeByIds(slotIds);
|
||||
}
|
||||
|
||||
// 4. 逻辑删除所有号源池
|
||||
schedulePoolService.removeByIds(poolIds);
|
||||
}
|
||||
|
||||
// 5. 逻辑删除主排班记录
|
||||
boolean removed = doctorScheduleService.removeById(doctorScheduleId);
|
||||
|
||||
return R.ok(removed);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.SchedulePool;
|
||||
import com.openhis.appointmentmanage.service.ISchedulePoolService;
|
||||
import com.openhis.web.appointmentmanage.appservice.ISchedulePoolAppService;
|
||||
import com.openhis.web.appointmentmanage.dto.SchedulePoolDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class SchedulePoolAppServiceImpl implements ISchedulePoolAppService {
|
||||
|
||||
@Resource
|
||||
private ISchedulePoolService schedulePoolService;
|
||||
|
||||
@Override
|
||||
public R<?> addSchedulePool(SchedulePoolDto schedulePoolDto) {
|
||||
//1.数据检验
|
||||
if(ObjectUtil.isNull(schedulePoolDto)){
|
||||
return R.fail("号源不能为空");
|
||||
}
|
||||
//2.封装实体
|
||||
SchedulePool schedulePool = new SchedulePool();
|
||||
schedulePool.setHospitalId(schedulePoolDto.getHospitalId());
|
||||
schedulePool.setDeptId(schedulePoolDto.getDeptId());
|
||||
schedulePool.setDoctorId(schedulePoolDto.getDoctorId());
|
||||
schedulePool.setDoctorName(schedulePoolDto.getDoctorName());
|
||||
schedulePool.setScheduleDate(schedulePoolDto.getScheduleDate());
|
||||
schedulePool.setShift(schedulePoolDto.getShift());
|
||||
schedulePool.setStartTime(schedulePoolDto.getStartTime());
|
||||
schedulePool.setEndTime(schedulePoolDto.getEndTime());
|
||||
|
||||
schedulePool.setRegType(schedulePoolDto.getRegType());
|
||||
schedulePool.setFee(schedulePoolDto.getFee());
|
||||
//3.保存
|
||||
boolean save = schedulePoolService.save(schedulePool);
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> list(SchedulePoolDto schedulePoolDto) {
|
||||
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SchedulePool> wrapper =
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
|
||||
wrapper.like(ObjectUtil.isNotEmpty(schedulePoolDto.getDoctorName()), SchedulePool::getDoctorName, schedulePoolDto.getDoctorName());
|
||||
wrapper.eq(ObjectUtil.isNotNull(schedulePoolDto.getDeptId()), SchedulePool::getDeptId, schedulePoolDto.getDeptId());
|
||||
wrapper.ge(ObjectUtil.isNotEmpty(schedulePoolDto.getQueryBeginDate()), SchedulePool::getScheduleDate, schedulePoolDto.getQueryBeginDate());
|
||||
wrapper.le(ObjectUtil.isNotEmpty(schedulePoolDto.getQueryEndDate()), SchedulePool::getScheduleDate, schedulePoolDto.getQueryEndDate());
|
||||
return R.ok(schedulePoolService.list(wrapper));
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
import com.openhis.web.appointmentmanage.appservice.IScheduleSlotAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ScheduleSlotAppServiceImpl implements IScheduleSlotAppService {
|
||||
}
|
||||
@@ -1,490 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.appservice.impl;
|
||||
|
||||
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.mapper.ScheduleSlotMapper;
|
||||
import com.openhis.clinical.domain.Ticket;
|
||||
import com.openhis.clinical.service.ITicketService;
|
||||
import com.openhis.web.appointmentmanage.appservice.ITicketAppService;
|
||||
import com.openhis.web.appointmentmanage.dto.TicketDto;
|
||||
import com.openhis.common.enums.SlotStatus;
|
||||
import com.openhis.common.enums.OrderStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 号源管理应用服务实现类
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class TicketAppServiceImpl implements ITicketAppService {
|
||||
|
||||
@Resource
|
||||
private ITicketService ticketService;
|
||||
@Resource
|
||||
private ScheduleSlotMapper scheduleSlotMapper;
|
||||
@Resource
|
||||
private IPatientService patientService;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(TicketAppServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 预约号源 (重构版:精准锁定单一槽位)
|
||||
*
|
||||
* @param dto 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> bookTicket(com.openhis.appointmentmanage.domain.AppointmentBookDTO dto) {
|
||||
Long slotId = dto.getSlotId();
|
||||
if (slotId == null) {
|
||||
return R.fail("参数校验失败:缺少排班槽位唯一标识");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.bookTicket(dto);
|
||||
if (result > 0) {
|
||||
return R.ok("预约成功!号源已安全锁定。");
|
||||
}
|
||||
return R.fail("预约挂单核发失败");
|
||||
} catch (Exception e) {
|
||||
log.error("大厅挂号捕获系统异常", e);
|
||||
return R.fail("系统异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约 (重构版:精准释放单一槽位)
|
||||
*
|
||||
* @param slotId 医生槽位排班ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelTicket(Long slotId) {
|
||||
if (slotId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.cancelTicket(slotId);
|
||||
return R.ok(result > 0 ? "取消成功,号源已重新释放回市场" : "取消失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> checkInTicket(Long slotId) {
|
||||
if (slotId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.checkInTicket(slotId);
|
||||
return R.ok(result > 0 ? "取号成功" : "取号失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelConsultation(Long slotId) {
|
||||
if (slotId == null) {
|
||||
return R.fail("参数错误");
|
||||
}
|
||||
try {
|
||||
int result = ticketService.cancelConsultation(slotId);
|
||||
return R.ok(result > 0 ? "停诊成功" : "停诊失败");
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> listTicket(com.openhis.appointmentmanage.dto.TicketQueryDTO query) {
|
||||
// 1. 防空指针处理
|
||||
if (query == null) {
|
||||
query = new com.openhis.appointmentmanage.dto.TicketQueryDTO();
|
||||
}
|
||||
normalizeQueryStatus(query);
|
||||
|
||||
// 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());
|
||||
|
||||
// 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(raw.getSlotId());
|
||||
dto.setSeqNo(raw.getSeqNo());
|
||||
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.getMedicalCard());
|
||||
dto.setPhone(raw.getPhone());
|
||||
dto.setIdCard(raw.getIdCard());
|
||||
dto.setDoctorId(raw.getDoctorId());
|
||||
dto.setDepartmentId(raw.getDepartmentId());
|
||||
dto.setRealPatientId(raw.getPatientId());
|
||||
dto.setOrderId(raw.getOrderId());
|
||||
dto.setOrderNo(raw.getOrderNo());
|
||||
|
||||
// 性别处理:直接使用患者表中的 genderEnum
|
||||
Integer genderEnum = raw.getGenderEnum();
|
||||
if (genderEnum != null) {
|
||||
if (Integer.valueOf(1).equals(genderEnum)) {
|
||||
dto.setGender("男");
|
||||
} else if (Integer.valueOf(2).equals(genderEnum)) {
|
||||
dto.setGender("女");
|
||||
} else {
|
||||
dto.setGender("未知");
|
||||
}
|
||||
} else {
|
||||
dto.setGender("未知");
|
||||
}
|
||||
|
||||
if (raw.getRegType() != null && raw.getRegType() == 1) {
|
||||
dto.setTicketType("expert");
|
||||
} else {
|
||||
dto.setTicketType("general");
|
||||
}
|
||||
|
||||
if (raw.getScheduleDate() != null && raw.getExpectTime() != null) {
|
||||
dto.setDateTime(raw.getScheduleDate().toString() + " " + raw.getExpectTime().toString());
|
||||
try {
|
||||
String timeStr = raw.getAppointmentTime() != null ? raw.getAppointmentTime() : (raw.getScheduleDate().toString() + " " + raw.getExpectTime().toString());
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(timeStr.length() > 10 ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
|
||||
java.util.Date date = sdf.parse(timeStr);
|
||||
dto.setAppointmentDate(date);
|
||||
dto.setAppointmentTime(date);
|
||||
} catch (Exception e) {
|
||||
dto.setAppointmentDate(new java.util.Date());
|
||||
}
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(raw.getIsStopped())) {
|
||||
dto.setStatus("已停诊");
|
||||
} else {
|
||||
SlotStatus status = SlotStatus.getByValue(raw.getSlotStatus());
|
||||
if (status != null) {
|
||||
if (status == SlotStatus.LOCKED) {
|
||||
if (OrderStatus.PATIENT_CANCELLED.getValue().equals(raw.getOrderStatus())) {
|
||||
dto.setStatus("已退号");
|
||||
} else {
|
||||
dto.setStatus("已锁定");
|
||||
}
|
||||
} else if (status == SlotStatus.BOOKED) {
|
||||
if (OrderStatus.PATIENT_CANCELLED.getValue().equals(raw.getOrderStatus())) {
|
||||
dto.setStatus("已退号");
|
||||
} else {
|
||||
dto.setStatus("已取号");
|
||||
}
|
||||
} else if (status == SlotStatus.CANCELLED) {
|
||||
dto.setStatus("已停诊");
|
||||
} else if (status == SlotStatus.RETURNED) {
|
||||
dto.setStatus("已退号");
|
||||
} else {
|
||||
dto.setStatus("未预约");
|
||||
}
|
||||
} else {
|
||||
dto.setStatus("未预约");
|
||||
}
|
||||
}
|
||||
|
||||
tickets.add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一状态入参,避免前端状态值大小写/中文/数字差异导致 SQL 条件失效后回全量数据
|
||||
*/
|
||||
/**
|
||||
* 规范前端传入的状态查询参数,映射到 SQL 的 slotStatusNormExpr 值。
|
||||
* 数值映射: 0=待约 1=已约(签到后) 2=锁定(预约后) 3=已签到 4=已停诊 5=已退号
|
||||
*/
|
||||
private void normalizeQueryStatus(com.openhis.appointmentmanage.dto.TicketQueryDTO query) {
|
||||
String rawStatus = query.getStatus();
|
||||
if (rawStatus == null) {
|
||||
return;
|
||||
}
|
||||
String normalized = rawStatus.trim();
|
||||
if (normalized.isEmpty()) {
|
||||
query.setStatus(null);
|
||||
return;
|
||||
}
|
||||
String lower = normalized.toLowerCase(Locale.ROOT);
|
||||
switch (lower) {
|
||||
case "all":
|
||||
case "全部":
|
||||
query.setStatus("all");
|
||||
break;
|
||||
case "unbooked":
|
||||
case "0":
|
||||
case "未预约":
|
||||
query.setStatus("unbooked");
|
||||
break;
|
||||
case "booked":
|
||||
case "1":
|
||||
case "已预约":
|
||||
query.setStatus("booked");
|
||||
break;
|
||||
case "locked":
|
||||
case "2":
|
||||
case "已锁定":
|
||||
query.setStatus("locked");
|
||||
break;
|
||||
case "checked":
|
||||
case "checkin":
|
||||
case "checkedin":
|
||||
case "3":
|
||||
case "已取号":
|
||||
query.setStatus("checked");
|
||||
break;
|
||||
case "cancelled":
|
||||
case "canceled":
|
||||
case "4":
|
||||
case "已停诊":
|
||||
case "已取消":
|
||||
query.setStatus("cancelled");
|
||||
break;
|
||||
case "returned":
|
||||
case "5":
|
||||
case "已退号":
|
||||
query.setStatus("returned");
|
||||
break;
|
||||
default:
|
||||
query.setStatus("__invalid__");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@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.setSeqNo(raw.getSeqNo());
|
||||
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.getMedicalCard());
|
||||
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 {
|
||||
String timeStr = raw.getAppointmentTime() != null ? raw.getAppointmentTime() : (raw.getScheduleDate().toString() + " " + raw.getExpectTime().toString());
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(timeStr.length() > 10 ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
|
||||
java.util.Date date = sdf.parse(timeStr);
|
||||
dto.setAppointmentDate(date);
|
||||
dto.setAppointmentTime(date);
|
||||
} catch (Exception e) {
|
||||
log.error("时间解析失败", e);
|
||||
dto.setAppointmentDate(new java.util.Date());
|
||||
}
|
||||
}
|
||||
|
||||
// --- 核心逻辑:精准状态分类 ---
|
||||
// 第一关:底层硬性停诊拦截
|
||||
if (Boolean.TRUE.equals(raw.getIsStopped())) {
|
||||
dto.setStatus("已停诊");
|
||||
} else {
|
||||
// 第二关:看独立的细分槽位状态 (0: 可用, 1: 已预约, 2: 已锁定...)
|
||||
SlotStatus status = SlotStatus.getByValue(raw.getSlotStatus());
|
||||
if (status != null) {
|
||||
if (status == SlotStatus.LOCKED) {
|
||||
if (OrderStatus.PATIENT_CANCELLED.getValue().equals(raw.getOrderStatus())) {
|
||||
dto.setStatus("已退号");
|
||||
} else {
|
||||
dto.setStatus("已锁定");
|
||||
}
|
||||
} else if (status == SlotStatus.BOOKED) {
|
||||
if (OrderStatus.PATIENT_CANCELLED.getValue().equals(raw.getOrderStatus())) {
|
||||
dto.setStatus("已退号");
|
||||
} else {
|
||||
dto.setStatus("已取号");
|
||||
}
|
||||
} else if (status == SlotStatus.CANCELLED) {
|
||||
dto.setStatus("已停诊");
|
||||
} else if (status == SlotStatus.RETURNED) {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为DTO
|
||||
*
|
||||
* @param ticket 号源实体
|
||||
* @return 号源DTO
|
||||
*/
|
||||
private TicketDto convertToDto(Ticket ticket) {
|
||||
TicketDto dto = new TicketDto();
|
||||
dto.setSlot_id(ticket.getId());
|
||||
dto.setBusNo(ticket.getBusNo());
|
||||
dto.setDepartment(ticket.getDepartment());
|
||||
dto.setDoctor(ticket.getDoctor());
|
||||
|
||||
// 处理号源类型(转换为英文,前端期望的是general或expert)
|
||||
String ticketType = ticket.getTicketType();
|
||||
if ("普通".equals(ticketType)) {
|
||||
dto.setTicketType("general");
|
||||
} else if ("专家".equals(ticketType)) {
|
||||
dto.setTicketType("expert");
|
||||
} else {
|
||||
dto.setTicketType(ticketType);
|
||||
}
|
||||
|
||||
// 处理号源时间(dateTime)
|
||||
dto.setDateTime(ticket.getTime());
|
||||
|
||||
// 处理号源状态(转换为中文)
|
||||
String status = ticket.getStatus();
|
||||
switch (status) {
|
||||
case "unbooked":
|
||||
dto.setStatus("未预约");
|
||||
break;
|
||||
case "booked":
|
||||
dto.setStatus("已预约");
|
||||
break;
|
||||
case "checked":
|
||||
dto.setStatus("已取号");
|
||||
break;
|
||||
case "cancelled":
|
||||
dto.setStatus("已取消");
|
||||
break;
|
||||
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());
|
||||
if (patient != null) {
|
||||
Integer genderEnum = patient.getGenderEnum();
|
||||
if (genderEnum != null) {
|
||||
if (Integer.valueOf(1).equals(genderEnum)) {
|
||||
dto.setGender("男");
|
||||
} else if (Integer.valueOf(2).equals(genderEnum)) {
|
||||
dto.setGender("女");
|
||||
} else {
|
||||
dto.setGender("未知");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dto.setAppointmentDate(ticket.getAppointmentDate());
|
||||
dto.setAppointmentTime(ticket.getAppointmentTime());
|
||||
dto.setDepartmentId(ticket.getDepartmentId());
|
||||
dto.setDoctorId(ticket.getDoctorId());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.ClinicRoom;
|
||||
import com.openhis.web.appointmentmanage.appservice.IClinicRoomAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/appoinment/clinic-room")
|
||||
public class ClinicRoomController {
|
||||
|
||||
@Resource
|
||||
private IClinicRoomAppService clinicRoomAppService;
|
||||
|
||||
/**
|
||||
* 分页查询诊室列表
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @param orgName 卫生机构名称
|
||||
* @param roomName 诊室名称
|
||||
* @return 分页查询结果
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<?> selectClinicRoomPage(
|
||||
@RequestParam(required = true) Integer pageNum,
|
||||
@RequestParam(required = true) Integer pageSize,
|
||||
@RequestParam(required = false) String orgName,
|
||||
@RequestParam(required = false) String roomName) {
|
||||
return clinicRoomAppService.selectClinicRoomPage(pageNum, pageSize, orgName, roomName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询诊室详情
|
||||
* @param id 诊室ID
|
||||
* @return 诊室详情
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> selectClinicRoomById(@PathVariable Long id) {
|
||||
return clinicRoomAppService.selectClinicRoomById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<?> insertClinicRoom(@RequestBody ClinicRoom clinicRoom) {
|
||||
return clinicRoomAppService.insertClinicRoom(clinicRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新诊室
|
||||
* @param clinicRoom 诊室信息
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<?> updateClinicRoom(@RequestBody ClinicRoom clinicRoom) {
|
||||
return clinicRoomAppService.updateClinicRoom(clinicRoom);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除诊室
|
||||
* @param id 诊室ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<?> deleteClinicRoomById(@PathVariable Long id) {
|
||||
return clinicRoomAppService.deleteClinicRoomById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DeptAppointmentHours;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppointmentHoursAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 科室预约工作时间维护 Controller
|
||||
*
|
||||
* @author openhis
|
||||
* @date 2025-12-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appoinment/dept-appthours")
|
||||
public class DeptAppthoursController {
|
||||
|
||||
@Resource
|
||||
private IDeptAppointmentHoursAppService deptAppointmentHoursAppService;
|
||||
|
||||
/**
|
||||
* 获取科室预约工作时间列表
|
||||
*
|
||||
* @param deptAppointmentHours 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页大小
|
||||
* @return 列表数据
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<?> getDeptAppthoursList(
|
||||
DeptAppointmentHours deptAppointmentHours,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
return deptAppointmentHoursAppService.getDeptAppthoursList(deptAppointmentHours, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取科室预约工作时间详情
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 详情数据
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<?> getDeptAppthoursDetail(@PathVariable("id") Long id) {
|
||||
return deptAppointmentHoursAppService.getDeptAppthoursDetail(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增科室预约工作时间
|
||||
*
|
||||
* @param deptAppointmentHours 新增数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping
|
||||
public R<?> addDeptAppthours(@RequestBody DeptAppointmentHours deptAppointmentHours) {
|
||||
return deptAppointmentHoursAppService.addDeptAppthours(deptAppointmentHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改科室预约工作时间
|
||||
*
|
||||
* @param deptAppointmentHours 修改数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping
|
||||
public R<?> updateDeptAppthours(@RequestBody DeptAppointmentHours deptAppointmentHours) {
|
||||
return deptAppointmentHoursAppService.updateDeptAppthours(deptAppointmentHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除科室预约工作时间
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<?> deleteDeptAppthours(@PathVariable("id") Long id) {
|
||||
return deptAppointmentHoursAppService.deleteDeptAppthours(id);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.AppointmentConfig;
|
||||
import com.openhis.web.appointmentmanage.appservice.IAppointmentConfigAppService;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDeptAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dept")
|
||||
public class DeptController {
|
||||
|
||||
@Resource
|
||||
private IDeptAppService deptAppService;
|
||||
|
||||
@Resource
|
||||
private IAppointmentConfigAppService appointmentConfigAppService;
|
||||
|
||||
/*
|
||||
* 获取科室列表
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list")
|
||||
public R<?> getDeptList(){
|
||||
return R.ok(deptAppService.getDeptList());
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询科室
|
||||
*
|
||||
* */
|
||||
@GetMapping("/search")
|
||||
public R<?> searchDept(
|
||||
@RequestParam(required = false,defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(required = false,defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(required = false)String orgName,
|
||||
@RequestParam(required = false)String deptName
|
||||
){
|
||||
return R.ok(deptAppService.searchDept(pageNo,pageSize,orgName,deptName));
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取预约配置
|
||||
*
|
||||
* */
|
||||
@GetMapping("/config")
|
||||
public R<?> getAppointmentConfig(){
|
||||
return appointmentConfigAppService.getAppointmentConfig();
|
||||
}
|
||||
|
||||
/*
|
||||
* 保存预约配置
|
||||
*
|
||||
* */
|
||||
@PostMapping("/config")
|
||||
public R<?> saveAppointmentConfig(@RequestBody AppointmentConfig appointmentConfig){
|
||||
return appointmentConfigAppService.saveAppointmentConfig(appointmentConfig);
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.appointmentmanage.domain.DoctorSchedule;
|
||||
import com.openhis.web.appointmentmanage.appservice.IDoctorScheduleAppService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/doctor-schedule")
|
||||
public class DoctorScheduleController {
|
||||
@Resource
|
||||
private IDoctorScheduleAppService doctorScheduleAppService;
|
||||
|
||||
/*
|
||||
* 获取医生排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list")
|
||||
public R<?> getDoctorScheduleList() {
|
||||
return R.ok(doctorScheduleAppService.getDoctorScheduleList());
|
||||
}
|
||||
|
||||
/*
|
||||
* 根据科室ID获取医生排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list-by-dept/{deptId}")
|
||||
public R<?> getDoctorScheduleListByDeptId(@PathVariable Long deptId) {
|
||||
return R.ok(doctorScheduleAppService.getDoctorScheduleListByDeptId(deptId));
|
||||
}
|
||||
|
||||
/*
|
||||
* 根据科室ID和日期范围获取医生排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list-by-dept-and-date")
|
||||
public R<?> getDoctorScheduleListByDeptIdAndDateRange(@RequestParam Long deptId,
|
||||
@RequestParam String startDate,
|
||||
@RequestParam String endDate) {
|
||||
return R.ok(doctorScheduleAppService.getDoctorScheduleListByDeptIdAndDateRange(deptId, startDate, endDate));
|
||||
}
|
||||
|
||||
/*
|
||||
* 新增医生排班
|
||||
*
|
||||
* */
|
||||
@PostMapping("/add")
|
||||
public R<?> addDoctorSchedule(@RequestBody DoctorSchedule doctorSchedule) {
|
||||
return doctorScheduleAppService.addDoctorSchedule(doctorSchedule);
|
||||
}
|
||||
|
||||
/*
|
||||
* 新增医生排班(带具体日期)
|
||||
* */
|
||||
@PostMapping("/add-with-date")
|
||||
public R<?> addDoctorScheduleWithDate(@RequestBody DoctorSchedule doctorSchedule) {
|
||||
// 从DoctorSchedule对象中获取scheduledDate字段
|
||||
String scheduledDate = doctorSchedule.getScheduledDate();
|
||||
return doctorScheduleAppService.addDoctorScheduleWithDate(doctorSchedule, scheduledDate);
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改医生排班
|
||||
*
|
||||
* */
|
||||
@PutMapping("/update")
|
||||
public R<?> updateDoctorSchedule(@RequestBody DoctorSchedule doctorSchedule) {
|
||||
return doctorScheduleAppService.updateDoctorSchedule(doctorSchedule);
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除医生排班
|
||||
*
|
||||
* */
|
||||
@DeleteMapping("/delete/{doctorScheduleId}")
|
||||
public R<?> removeDoctorSchedule(@PathVariable Integer doctorScheduleId){
|
||||
return doctorScheduleAppService.removeDoctorSchedule(doctorScheduleId);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取今日医生排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/today")
|
||||
public R<?> getTodayDoctorScheduleList() {
|
||||
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取当前登录医生今日排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/today-my-schedule")
|
||||
public R<?> getTodayMySchedule() {
|
||||
return doctorScheduleAppService.getTodayMySchedule();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.appointmentmanage.appservice.ISchedulePoolAppService;
|
||||
import com.openhis.web.appointmentmanage.dto.SchedulePoolDto;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/schedule-pool")
|
||||
public class SchedulePoolController {
|
||||
@Resource
|
||||
private ISchedulePoolAppService schedulePoolAppService;
|
||||
|
||||
/*
|
||||
* 新增号源
|
||||
*
|
||||
* */
|
||||
@PostMapping("/add")
|
||||
public R<?> addSchedulePool(@RequestBody SchedulePoolDto schedulePoolDto) {
|
||||
return schedulePoolAppService.addSchedulePool(schedulePoolDto);
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询号源
|
||||
*
|
||||
* */
|
||||
@GetMapping("/list")
|
||||
public R<?> list(SchedulePoolDto schedulePoolDto) {
|
||||
return schedulePoolAppService.list(schedulePoolDto);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/schedule-slot")
|
||||
public class ScheduleSlotController {
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
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;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 号源管理控制器
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@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 所有号源列表
|
||||
*/
|
||||
@Anonymous
|
||||
@GetMapping("/listAll")
|
||||
public R<?> listAllTickets() {
|
||||
return ticketAppService.listAllTickets();
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约号源
|
||||
*
|
||||
* @param dto 预约参数
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/book")
|
||||
public R<?> bookTicket(@RequestBody @Validated AppointmentBookDTO dto) {
|
||||
return ticketAppService.bookTicket(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消预约
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/cancel")
|
||||
public R<?> cancelTicket(@RequestParam Long slotId) {
|
||||
return ticketAppService.cancelTicket(slotId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取号
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/checkin")
|
||||
public R<?> checkInTicket(@RequestParam Long slotId) {
|
||||
return ticketAppService.checkInTicket(slotId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停诊
|
||||
*
|
||||
* @param slotId 槽位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/cancelConsultation")
|
||||
public R<?> cancelConsultation(@RequestParam Long slotId) {
|
||||
return ticketAppService.cancelConsultation(slotId);
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 号源池Dto
|
||||
*
|
||||
* @date 2025-12-12
|
||||
*/
|
||||
@Data
|
||||
public class SchedulePoolDto {
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 业务编号 */
|
||||
private String poolCode;
|
||||
|
||||
/** 医院ID */
|
||||
private Long hospitalId;
|
||||
|
||||
/** 科室ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 医生ID */
|
||||
private Long doctorId;
|
||||
|
||||
/** 医生姓名 */
|
||||
private String doctorName;
|
||||
|
||||
/** 诊室 */
|
||||
private String clinicRoom;
|
||||
|
||||
/** 出诊日期 */
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
/** 班别 */
|
||||
private String shift;
|
||||
|
||||
/** 开始时间 */
|
||||
private LocalTime startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
private LocalTime endTime;
|
||||
|
||||
/** 总号量 */
|
||||
private Integer totalQuota;
|
||||
|
||||
/** 已约 */
|
||||
private Integer bookedNum;
|
||||
|
||||
/** 铁号数 */
|
||||
private Integer lockedNum;
|
||||
|
||||
/** 剩余号数 */
|
||||
private Integer availableNum;
|
||||
|
||||
/** 号别 */
|
||||
private String regType;
|
||||
|
||||
/** 原价 (元) */
|
||||
private Double fee;
|
||||
|
||||
/** 医保限价 (元) */
|
||||
private Double insurancePrice;
|
||||
|
||||
/** 支持渠道 */
|
||||
private String supportChannel;
|
||||
|
||||
/** 号源状态 */
|
||||
private Integer status;
|
||||
|
||||
/** 停诊原因 */
|
||||
private String stopReason;
|
||||
|
||||
/** 放号时间 */
|
||||
private LocalDateTime releaseTime;
|
||||
|
||||
/** 截止预约时间 */
|
||||
private LocalDateTime deadlineTime;
|
||||
|
||||
/** 乐观锁版本 */
|
||||
private Integer version;
|
||||
|
||||
/** 操作人ID */
|
||||
private Long opUserId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 排班ID */
|
||||
private Long scheduleId;
|
||||
|
||||
/** 创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 查询开始日期 */
|
||||
private String queryBeginDate;
|
||||
|
||||
/** 查询结束日期 */
|
||||
private String queryEndDate;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 号源管理DTO
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TicketDto {
|
||||
|
||||
/**
|
||||
* 号源唯一ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long slot_id;
|
||||
|
||||
/**
|
||||
* 号源序号(对应 adm_schedule_slot.seq_no)
|
||||
*/
|
||||
private Integer seqNo;
|
||||
|
||||
/**
|
||||
* 号源编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 医生姓名
|
||||
*/
|
||||
private String doctor;
|
||||
|
||||
/**
|
||||
* 号源类型 (普通/专家)
|
||||
*/
|
||||
private String ticketType;
|
||||
|
||||
/**
|
||||
* 号源时间
|
||||
*/
|
||||
private String dateTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 挂号费
|
||||
*/
|
||||
private String fee;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 就诊卡号
|
||||
*/
|
||||
private String patientId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 患者性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 预约日期
|
||||
*/
|
||||
private Date appointmentDate;
|
||||
|
||||
/**
|
||||
* 预约时间
|
||||
*/
|
||||
private Date appointmentTime;
|
||||
|
||||
/**
|
||||
* 科室ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long departmentId;
|
||||
|
||||
/**
|
||||
* 医生ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* 真实患者ID(数据库主键,区别于 patientId 存的就诊卡号)
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long realPatientId;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 预约订单ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 预约订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface DeptAppMapper {
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface DoctorScheduleAppMapper {
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SchedulePoolAppMapper {
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.openhis.web.appointmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface ScheduleSlotAppMapper {
|
||||
}
|
||||
Reference in New Issue
Block a user