feat(menu): 优化菜单服务性能并新增医生排班功能
- 添加菜单缓存注解以提升查询性能 - 实现菜单完整路径计算优化,解决 N+1 查询问题 - 新增 selectAllMenus 方法供路径计算使用 - 添加今日医生排班查询功能 - 重构前端图标显示逻辑,使用 SVG 图标替代 Element 图标 - 添加前端菜单数据本地缓存机制 - 更新菜单管理界面的表单组件绑定方式 - 新增预约管理、门诊管理和药房管理路由配置
This commit is contained in:
@@ -7,6 +7,8 @@ public interface IDoctorScheduleAppService {
|
||||
|
||||
R<?> getDoctorScheduleList();
|
||||
|
||||
R<?> getTodayDoctorScheduleList();
|
||||
|
||||
R<?> addDoctorSchedule(DoctorSchedule doctorSchedule);
|
||||
|
||||
R<?> removeDoctorSchedule(Integer doctorScheduleId);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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.DoctorSchedule;
|
||||
import com.openhis.appointmentmanage.mapper.DoctorScheduleMapper;
|
||||
@@ -9,6 +10,8 @@ import com.openhis.web.appointmentmanage.appservice.IDoctorScheduleAppService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -26,6 +29,50 @@ public class DoctorScheduleAppServiceImpl implements IDoctorScheduleAppService {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getTodayDoctorScheduleList() {
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
DayOfWeek dayOfWeek = today.getDayOfWeek();
|
||||
|
||||
// 将 Java 的 DayOfWeek 转换为字符串表示
|
||||
String weekdayStr = convertDayOfWeekToString(dayOfWeek);
|
||||
|
||||
// 查询今天排班的医生
|
||||
LambdaQueryWrapper<DoctorSchedule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DoctorSchedule::getWeekday, weekdayStr) // 根据星期几查询
|
||||
.eq(DoctorSchedule::getIsStopped, false); // 只查询未停止的排班
|
||||
|
||||
List<DoctorSchedule> list = doctorScheduleService.list(queryWrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 DayOfWeek 转换为字符串表示
|
||||
* @param dayOfWeek DayOfWeek枚举
|
||||
* @return 对应的字符串表示
|
||||
*/
|
||||
private String convertDayOfWeekToString(DayOfWeek dayOfWeek) {
|
||||
switch (dayOfWeek) {
|
||||
case MONDAY:
|
||||
return "1"; // 或者 "星期一" 或 "Monday",取决于数据库中的实际存储格式
|
||||
case TUESDAY:
|
||||
return "2";
|
||||
case WEDNESDAY:
|
||||
return "3";
|
||||
case THURSDAY:
|
||||
return "4";
|
||||
case FRIDAY:
|
||||
return "5";
|
||||
case SATURDAY:
|
||||
return "6";
|
||||
case SUNDAY:
|
||||
return "7";
|
||||
default:
|
||||
return "1"; // 默认为星期一
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> addDoctorSchedule(DoctorSchedule doctorSchedule) {
|
||||
if (ObjectUtil.isEmpty(doctorSchedule)) {
|
||||
|
||||
@@ -40,4 +40,13 @@ public class DoctorScheduleController {
|
||||
return R.ok(doctorScheduleAppService.removeDoctorSchedule(doctorScheduleId));
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取今日医生排班List
|
||||
*
|
||||
* */
|
||||
@GetMapping("/today")
|
||||
public R<?> getTodayDoctorScheduleList() {
|
||||
return R.ok(doctorScheduleAppService.getTodayDoctorScheduleList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.openhis.web.medicationmanagement.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.openhis.domain.DayEndSettlement;
|
||||
import com.openhis.service.IDayEndSettlementService;
|
||||
import com.core.common.core.page.PageDomain;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
/**
|
||||
* 日结结算单Controller
|
||||
*
|
||||
* @author openhis
|
||||
* @date 2025-02-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/medication/dayEndSettlement")
|
||||
public class DayEndSettlementController extends BaseController {
|
||||
@Autowired
|
||||
private IDayEndSettlementService dayEndSettlementService;
|
||||
|
||||
/**
|
||||
* 查询日结结算单列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DayEndSettlement dayEndSettlement, PageDomain pageDomain) {
|
||||
// 使用PageHelper进行分页
|
||||
PageHelper.startPage(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
List<DayEndSettlement> list = dayEndSettlementService.lambdaQuery()
|
||||
.like(StringUtils.isNotBlank(dayEndSettlement.getSettlementNo()), DayEndSettlement::getSettlementNo, dayEndSettlement.getSettlementNo())
|
||||
.eq(StringUtils.isNotBlank(dayEndSettlement.getSettlementType()), DayEndSettlement::getSettlementType, dayEndSettlement.getSettlementType())
|
||||
.eq(dayEndSettlement.getSettlementDate() != null, DayEndSettlement::getSettlementDate, dayEndSettlement.getSettlementDate())
|
||||
.orderByDesc(DayEndSettlement::getId)
|
||||
.list();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日结结算单详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(dayEndSettlementService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增日结结算单
|
||||
*/
|
||||
@Log(title = "日结结算单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DayEndSettlement dayEndSettlement) {
|
||||
return toAjax(dayEndSettlementService.save(dayEndSettlement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改日结结算单
|
||||
*/
|
||||
@Log(title = "日结结算单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DayEndSettlement dayEndSettlement) {
|
||||
return toAjax(dayEndSettlementService.updateById(dayEndSettlement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除日结结算单
|
||||
*/
|
||||
@Log(title = "日结结算单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(dayEndSettlementService.removeByIds(List.of(ids)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user