73 门诊医生排班管理

This commit is contained in:
HuangXinQuan
2026-02-03 17:36:29 +08:00
parent 4c14d802c4
commit a434dfdfff
25 changed files with 1635 additions and 353 deletions

View File

@@ -9,7 +9,13 @@ public interface IDoctorScheduleAppService {
R<?> getTodayDoctorScheduleList();
R<?> getDoctorScheduleListByDeptId(Long deptId);
R<?> getDoctorScheduleListByDeptIdAndDateRange(Long deptId, String startDate, String endDate);
R<?> addDoctorSchedule(DoctorSchedule doctorSchedule);
R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule);
R<?> removeDoctorSchedule(Integer doctorScheduleId);
}

View File

@@ -5,4 +5,6 @@ import com.openhis.web.appointmentmanage.dto.SchedulePoolDto;
public interface ISchedulePoolAppService {
R<?> addSchedulePool(SchedulePoolDto schedulePoolDto);
R<?> list(SchedulePoolDto schedulePoolDto);
}

View File

@@ -4,12 +4,23 @@ 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.DoctorSchedule;
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.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Date;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
@@ -19,9 +30,18 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
@Resource
private IDoctorScheduleService doctorScheduleService;
@Resource
private ISchedulePoolService schedulePoolService;
@Resource
private IScheduleSlotService scheduleSlotService;
@Resource
private DoctorScheduleMapper doctorScheduleMapper;
// 转换 LocalDateTime 为 Date 的通用方法
Date now = Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant());
Date tomorrow = Date.from(LocalDateTime.now().plusDays(1).atZone(ZoneId.systemDefault()).toInstant());
@Override
public R<?> getDoctorScheduleList() {
@@ -29,6 +49,26 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
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) {
// 暂时返回所有科室的排班数据,直到我们确定日期范围过滤逻辑
List<DoctorSchedule> list = doctorScheduleService.list(
new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<DoctorSchedule>()
.eq("dept_id", deptId)
);
return R.ok(list);
}
@Transactional
@Override
public R<?> getTodayDoctorScheduleList() {
// 获取今天的日期
@@ -78,6 +118,11 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
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());
@@ -93,28 +138,188 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
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() : false);
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.setDoctorId(doctorSchedule.getDoctorId());
// 不设置id字段让数据库自动生成
// 使用自定义的insertWithoutId方法确保INSERT语句不包含id字段
int result = doctorScheduleMapper.insertWithoutId(newSchedule);
boolean save = result > 0;
if (save) {
// 返回保存后的实体对象,包含数据库生成的ID
return R.ok(newSchedule);
if (result > 0) {
// 创建号源池,并传入正确的医生ID
SchedulePool pool = createSchedulePool(newSchedule, doctorSchedule.getDoctorId());
boolean poolSaved = schedulePoolService.save(pool);
if (poolSaved) {
// 创建号源槽
List<ScheduleSlot> slots = createScheduleSlots(pool.getId().intValue(), 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("保存失败");
return R.fail("保存排班信息失败");
}
}
@Override
public R<?> updateDoctorSchedule(DoctorSchedule doctorSchedule) {
if (ObjectUtil.isEmpty(doctorSchedule) || ObjectUtil.isEmpty(doctorSchedule.getId())) {
return R.fail("医生排班ID不能为空");
}
// 注意:此为核心更新,暂未处理号源池和号源槽的同步更新
int result = doctorScheduleMapper.updateDoctorSchedule(doctorSchedule);
return result > 0 ? R.ok(result) : R.fail("更新排班信息失败");
}
/**
* 创建号源池
*/
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 ? schedule.getRegisterFee() / 100.0 : 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(Integer 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;
}
/**
* 根据星期几计算具体日期(下周的对应星期)
*/
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 && ObjectUtil.isEmpty(doctorScheduleId)) {
if (doctorScheduleId == null) {
return R.fail("排班id不能为空");
}
boolean remove = doctorScheduleService.removeById(doctorScheduleId);
return R.ok(remove);
// 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());
// 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<Integer> 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);
}
}

View File

@@ -39,4 +39,15 @@ public class SchedulePoolAppServiceImpl implements ISchedulePoolAppService {
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));
}
}

View File

@@ -76,7 +76,7 @@ public class TicketAppServiceImpl implements ITicketAppService {
if (result > 0) {
// 4. 预约成功后,更新排班表状态
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(Math.toIntExact(slotId)); // 对应 XML 中的 WHERE id = #{id}
schedule.setId(slotId); // 对应 XML 中的 WHERE id = #{id}
schedule.setIsStopped(true); // 设置为已预约
schedule.setStopReason("booked"); // 设置停用原因
@@ -113,8 +113,8 @@ public class TicketAppServiceImpl implements ITicketAppService {
try {
ticketService.cancelTicket(slotId);
DoctorSchedule schedule = new DoctorSchedule();
schedule.setId(Math.toIntExact(slotId)); // 对应 WHERE id = #{id}
schedule.setIsStopped(false); // 设置为 false (数据库对应 0)
schedule.setId(slotId); // 对应 WHERE id = #{id}
schedule.setIsStopped(false); // 设置为 false
schedule.setStopReason(""); // 将原因清空 (设为空字符串)
// 3. 调用自定义更新方法
int updateCount = doctorScheduleMapper.updateDoctorSchedule(schedule);
@@ -235,7 +235,11 @@ public class TicketAppServiceImpl implements ITicketAppService {
// 日期处理LocalDateTime 转 Date
if (schedule.getCreateTime() != null) {
ZonedDateTime zdt = schedule.getCreateTime().atZone(ZoneId.systemDefault());
// 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()));
}

View File

@@ -22,13 +22,42 @@ public class DoctorScheduleController {
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 R.ok(doctorScheduleAppService.addDoctorSchedule(doctorSchedule));
return doctorScheduleAppService.addDoctorSchedule(doctorSchedule);
}
/*
* 修改医生排班
*
* */
@PutMapping("/update")
public R<?> updateDoctorSchedule(@RequestBody DoctorSchedule doctorSchedule) {
return doctorScheduleAppService.updateDoctorSchedule(doctorSchedule);
}
/*

View File

@@ -4,9 +4,7 @@ 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -20,8 +18,18 @@ public class SchedulePoolController {
* 新增号源
*
* */
@PostMapping("/add")
public R<?> addSchedulePool(@RequestBody SchedulePoolDto schedulePoolDto) {
return R.ok(schedulePoolAppService.addSchedulePool(schedulePoolDto));
return schedulePoolAppService.addSchedulePool(schedulePoolDto);
}
/*
* 查询号源
*
* */
@GetMapping("/list")
public R<?> list(SchedulePoolDto schedulePoolDto) {
return schedulePoolAppService.list(schedulePoolDto);
}
}

View File

@@ -14,19 +14,19 @@ import java.time.LocalTime;
@Data
public class SchedulePoolDto {
/** id */
private Integer id;
private Long id;
/** 业务编号 */
private String poolCode;
/** 医院ID */
private Integer hospitalId;
private Long hospitalId;
/** 科室ID */
private Integer deptId;
private Long deptId;
/** 医生ID */
private Integer doctorId;
private Long doctorId;
/** 医生姓名 */
private String doctorName;
@@ -86,17 +86,23 @@ public class SchedulePoolDto {
private Integer version;
/** 操作人ID */
private Integer opUserId;
private Long opUserId;
/** 备注 */
private String remark;
/** 排班ID */
private Integer scheduleId;
private Long scheduleId;
/** 创建时间 */
private LocalDateTime createTime;
/** 更新时间 */
private LocalDateTime updateTime;
/** 查询开始日期 */
private String queryBeginDate;
/** 查询结束日期 */
private String queryEndDate;
}

View File

@@ -3,6 +3,7 @@ package com.openhis.web.basedatamanage.appservice;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.web.basedatamanage.dto.OrganizationDto;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@@ -67,4 +68,12 @@ public interface IOrganizationAppService {
*/
R<?> inactiveOrg(Long orgId);
/**
* 获取挂号科室列表
*
* @return 挂号科室列表
*/
R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName);
}

View File

@@ -20,6 +20,7 @@ import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
import com.openhis.web.basedatamanage.dto.OrganizationDto;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -285,6 +286,41 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
return String.join(",", dictTexts);
}
/**
* 获取挂号科室列表
*
* @param name 机构/科室名称
* @param orgName 机构名称
* @return 挂号科室列表
*/
@Override
public R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName) {
// 创建查询条件只查询register_flag为1的组织机构
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Organization::getRegisterFlag, 1); // 只获取挂号科室
// 添加名称过滤条件
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like(Organization::getName, name);
}
// 执行查询
List<Organization> organizationList = organizationService.list(queryWrapper);
// 转换为DTO对象并设置字典文本
List<OrganizationDto> organizationDtoList = organizationList.stream().map(org -> {
OrganizationDto dto = new OrganizationDto();
BeanUtils.copyProperties(org, dto);
dto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, dto.getTypeEnum()));
dto.setClassEnum_dictText(formatClassEnumDictText(dto.getClassEnum()));
dto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, dto.getActiveFlag()));
return dto;
}).collect(Collectors.toList());
return R.ok(organizationDtoList);
}
/**
* 校验字段是否为指定类中的有效属性
*/

View File

@@ -130,4 +130,17 @@ public class OrganizationController {
return iOrganizationAppService.inactiveOrg(orgId);
}
/**
* 获取挂号科室列表
*
* @param name 机构/科室名称
* @param orgName 机构名称
* @return 挂号科室列表
*/
@GetMapping("/register-organizations")
public R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName) {
return iOrganizationAppService.getRegisterOrganizations(name, orgName);
}
}

View File

@@ -43,6 +43,22 @@ public interface IDiagTreatMAppService {
R<?> getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request);
/**
* 获取挂号项目列表医保类型为13
*
* @param orgId 科室ID
* @return 挂号项目列表
*/
R<?> getRegistrationItems(Long orgId);
/**
* 获取诊查项目列表医保类型为02
*
* @param orgId 科室ID
* @return 诊查项目列表
*/
R<?> getClinicItems(Long orgId);
/**
* 根据id查询诊疗详情
*

View File

@@ -186,10 +186,24 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
public R<?> getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 临时保存ybType值并从参数对象中移除避免HisQueryUtils构建yb_type条件
String ybTypeValue = null;
if (DiagnosisTreatmentSelParam != null && StringUtils.isNotEmpty(DiagnosisTreatmentSelParam.getYbType())) {
ybTypeValue = DiagnosisTreatmentSelParam.getYbType();
DiagnosisTreatmentSelParam.setYbType(null); // 临时移除防止HisQueryUtils处理
}
// 构建查询条件
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam,
searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
// 如果需要按医保类型过滤如挂号费类型13添加带表别名的条件
if (ybTypeValue != null) {
queryWrapper.eq("T2.yb_type", ybTypeValue);
// 恢复参数对象中的值
DiagnosisTreatmentSelParam.setYbType(ybTypeValue);
}
// 分页查询
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(pageNo, pageSize), queryWrapper);
@@ -211,6 +225,86 @@ public class DiagTreatMAppServiceImpl implements IDiagTreatMAppService {
return R.ok(diseaseTreatmentPage);
}
/**
* 获取挂号项目列表医保类型为13
*
* @param orgId 科室ID
* @return 挂号项目列表
*/
@Override
public R<?> getRegistrationItems(Long orgId) {
// 构建查询条件只查询医保类型为13挂号费的项目
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("T2.yb_type", "13"); // 使用T2表的yb_type字段避免歧义
queryWrapper.eq("T1.delete_flag", "0"); // 只查询未删除的记录
queryWrapper.eq("T2.instance_table", "wor_activity_definition"); // 确保关联正确
// 如果提供了科室ID则过滤该科室的项目
if (orgId != null) {
queryWrapper.eq("T1.org_id", orgId); // 使用机构ID进行过滤
}
// 分页查询,设置一个较大的页大小以获取所有挂号项目
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(1, 100), queryWrapper);
diseaseTreatmentPage.getRecords().forEach(e -> {
// 医保标记枚举类回显赋值
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
// 医保对码标记枚举类回显赋值
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
// 类型枚举类回显赋值
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum()));
// 状态枚举类回显赋值
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
// 划价标记
e.setPricingFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getPricingFlag()));
});
// 返回挂号项目列表
return R.ok(diseaseTreatmentPage);
}
/**
* 获取诊查项目列表医保类型为02
*
* @param orgId 科室ID
* @return 诊查项目列表
*/
@Override
public R<?> getClinicItems(Long orgId) {
// 构建查询条件只查询医保类型为02诊查费的项目
QueryWrapper<DiagnosisTreatmentDto> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("T2.yb_type", "02"); // 使用T2表的yb_type字段避免歧义
queryWrapper.eq("T1.delete_flag", "0"); // 只查询未删除的记录
queryWrapper.eq("T2.instance_table", "wor_activity_definition"); // 确保关联正确
// 如果提供了科室ID则过滤该科室的项目
if (orgId != null) {
queryWrapper.eq("T1.org_id", orgId); // 使用机构ID进行过滤
}
// 分页查询,设置一个较大的页大小以获取所有诊查项目
IPage<DiagnosisTreatmentDto> diseaseTreatmentPage
= activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<DiagnosisTreatmentDto>(1, 100), queryWrapper);
diseaseTreatmentPage.getRecords().forEach(e -> {
// 医保标记枚举类回显赋值
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
// 医保对码标记枚举类回显赋值
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
// 类型枚举类回显赋值
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum()));
// 状态枚举类回显赋值
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
// 划价标记
e.setPricingFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getPricingFlag()));
});
// 返回诊查项目列表
return R.ok(diseaseTreatmentPage);
}
/**
* 根据id查询诊疗详情
*

View File

@@ -154,4 +154,26 @@ public class DiagnosisTreatmentController {
public R<?> validateActivityEdit(Long activityId) {
return diagTreatMAppService.validateActivityEdit(activityId);
}
/**
* 获取挂号项目列表医保类型为13
*
* @param orgId 科室ID
* @return 挂号项目列表
*/
@GetMapping("/registration-items")
public R<?> getRegistrationItems(@RequestParam(required = false) Long orgId) {
return diagTreatMAppService.getRegistrationItems(orgId);
}
/**
* 获取诊查项目列表医保类型为02
*
* @param orgId 科室ID
* @return 诊查项目列表
*/
@GetMapping("/clinic-items")
public R<?> getClinicItems(@RequestParam(required = false) Long orgId) {
return diagTreatMAppService.getClinicItems(orgId);
}
}

View File

@@ -19,6 +19,9 @@ public class DiagnosisTreatmentSelParam {
/** 类型 */
private Integer typeEnum;
/** 医保类型 */
private String ybType;
/** 医保对码标记 */
private Integer ybMatchFlag;

View File

@@ -22,7 +22,8 @@
is_online,
is_stopped,
stop_reason,
dept_id
dept_id,
doctor_id
<if test="createTime != null">, create_time</if>
<if test="updateTime != null">, update_time</if>
) VALUES (
@@ -41,7 +42,8 @@
#{isOnline},
#{isStopped},
#{stopReason},
#{deptId}
#{deptId},
#{doctorId}
<if test="createTime != null">, #{createTime}</if>
<if test="updateTime != null">, #{updateTime}</if>
)
@@ -66,6 +68,7 @@
<if test="isStopped != null">is_stopped = #{isStopped},</if>
<if test="stopReason != null">stop_reason = #{stopReason},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="doctorId != null">doctor_id = #{doctorId},</if>
<if test="updateTime != null">update_time = #{updateTime}</if>
</set>
WHERE id = #{id}

View File

@@ -2,11 +2,13 @@ package com.openhis.appointmentmanage.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.time.LocalTime;
/**
* 医生排班Entity
@@ -16,10 +18,11 @@ import java.time.LocalTime;
@Data
@TableName(value = "adm_doctor_schedule")
@Accessors(chain = true)
public class DoctorSchedule {
@EqualsAndHashCode(callSuper = false)
public class DoctorSchedule extends HisBaseEntity {
/** id - 数据库GENERATED ALWAYS由数据库自动生成插入时不应包含此字段 */
@TableId(type = IdType.NONE)
private Integer id;
private Long id;
/** 星期 */
private String weekday;
@@ -67,11 +70,8 @@ public class DoctorSchedule {
private String stopReason;
/** 关联科室id */
private Integer deptId;
private Long deptId;
/** 创建时间 */
private LocalDateTime createTime;
/** 更新时间 */
private LocalDateTime updateTime;
/** 医生ID - 不映射到数据库表字段,仅作传输使用 */
private Long doctorId;
}

View File

@@ -1,11 +1,15 @@
package com.openhis.appointmentmanage.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
/**
* 号源池Entity
@@ -15,21 +19,23 @@ import java.time.LocalTime;
@Data
@TableName(value = "adm_schedule_pool")
@Accessors(chain = true)
public class SchedulePool {
@EqualsAndHashCode(callSuper = false)
public class SchedulePool extends HisBaseEntity {
/** id */
private Integer id;
@TableId(type = IdType.AUTO)
private Long id;
/** 业务编号 */
private String poolCode;
/** 医院ID */
private Integer hospitalId;
private Long hospitalId;
/** 科室ID */
private Integer deptId;
private Long deptId;
/** 医生ID */
private Integer doctorId;
private Long doctorId;
/** 医生姓名 */
private String doctorName;
@@ -80,26 +86,20 @@ public class SchedulePool {
private String stopReason;
/** 放号时间 */
private LocalDateTime releaseTime;
private Date releaseTime;
/** 截止预约时间 */
private LocalDateTime deadlineTime;
private Date deadlineTime;
/** 乐观锁版本 */
private Integer version;
/** 操作人ID */
private Integer opUserId;
private Long opUserId;
/** 备注 */
private String remark;
/** 排班ID */
private Integer scheduleId;
/** 创建时间 */
private LocalDateTime createTime;
/** 更新时间 */
private LocalDateTime updateTime;
private Long scheduleId;
}

View File

@@ -1,10 +1,13 @@
package com.openhis.appointmentmanage.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.core.common.core.domain.HisBaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.time.LocalTime;
/**
* 号源池明细Entity
@@ -14,8 +17,10 @@ import java.time.LocalTime;
@Data
@TableName(value = "adm_schedule_slot")
@Accessors(chain = true)
public class ScheduleSlot {
@EqualsAndHashCode(callSuper = false)
public class ScheduleSlot extends HisBaseEntity {
/** 明细主键 */
@TableId(type = IdType.AUTO)
private Integer id;
/** 号源池ID */
@@ -32,10 +37,4 @@ public class ScheduleSlot {
/** 预计叫号时间 */
private LocalTime expectTime;
/** 创建时间 */
private LocalDateTime createTime;
/** 更新时间 */
private LocalDateTime updateTime;
}

View File

@@ -2,6 +2,13 @@ package com.openhis.appointmentmanage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.appointmentmanage.domain.SchedulePool;
import io.swagger.models.auth.In;
public interface ISchedulePoolService extends IService<SchedulePool> {
/**
* 根据排班ID创建号源池
* @param scheduledId
* @return
*/
SchedulePool creatSchedulePoolByScheduledId(Integer scheduledId);
}

View File

@@ -8,4 +8,8 @@ import org.springframework.stereotype.Service;
@Service
public class SchedulePoolServiceImpl extends ServiceImpl<SchedulePoolMapper, SchedulePool> implements ISchedulePoolService {
@Override
public SchedulePool creatSchedulePoolByScheduledId(Integer scheduledId) {
return null;
}
}

View File

@@ -0,0 +1,14 @@
import request from '@/utils/request'
/**
* 查询号源池列表
* @param {Object} query - 查询参数
* @returns {Promise}
*/
export function getSchedulePoolList(query) {
return request({
url: '/schedule-pool/list',
method: 'get',
params: query
})
}

View File

@@ -13,6 +13,19 @@ export function addDoctorSchedule(data) {
})
}
/**
* 更新医生排班
* @param {Object} data - 排班数据 (必须包含ID)
* @returns {Promise}
*/
export function updateDoctorSchedule(data) {
return request({
url: '/doctor-schedule/update',
method: 'put',
data: data
})
}
/**
* 删除医生排班
* @param {String|Number} id - 排班记录ID
@@ -37,3 +50,62 @@ export function batchSaveDoctorSchedule(data) {
data: data
})
}
/**
* 获取挂号科室列表
* @param {Object} params - 查询参数
* @returns {Promise}
*/
export function getRegisterOrganizations(params) {
return request({
url: '/base-data-manage/organization/register-organizations',
method: 'get',
params
})
}
/**
* 获取医生排班列表
* @returns {Promise}
*/
export function getDoctorScheduleList() {
return request({
url: '/doctor-schedule/list',
method: 'get'
})
}
/**
* 根据科室ID获取医生排班列表
* @param {Number} deptId - 科室ID
* @returns {Promise}
*/
export function getDoctorScheduleListByDeptId(deptId) {
return request({
url: `/doctor-schedule/list-by-dept/${deptId}`,
method: 'get',
params: {
_t: new Date().getTime() // 添加时间戳防止GET请求缓存
}
})
}
/**
* 根据科室ID和日期范围获取医生排班列表
* @param {Number} deptId - 科室ID
* @param {String} startDate - 开始日期
* @param {String} endDate - 结束日期
* @returns {Promise}
*/
export function getDoctorScheduleListByDeptIdAndDateRange(deptId, startDate, endDate) {
return request({
url: `/doctor-schedule/list-by-dept-and-date`,
method: 'get',
params: {
deptId,
startDate,
endDate,
_t: new Date().getTime() // 添加时间戳防止GET请求缓存
}
})
}

File diff suppressed because it is too large Load Diff

View File

@@ -89,3 +89,21 @@ export function getInitOption(param) {
params: param
})
}
// 获取挂号项目列表
export function getRegistrationItems(params) {
return request({
url: '/data-dictionary/diagnosis-treatment/registration-items',
method: 'get',
params: params
})
}
// 获取诊查项目列表
export function getClinicItems(params) {
return request({
url: '/data-dictionary/diagnosis-treatment/clinic-items',
method: 'get',
params
})
}