feat(menu): 优化菜单路径唯一性校验并更新前端界面

- 在SysLoginController中添加optionMap数据返回
- 添加JSQLParser依赖支持MyBatis Plus功能
- 实现selectMenuByPathExcludeId方法用于排除当前菜单的路径唯一性校验
- 在SysMenuServiceImpl中添加日志记录并优化路径唯一性判断逻辑
- 在SysMenuMapper.xml中添加LIMIT 1限制并实现排除ID查询
- 在前端路由中注释患者管理相关路由配置
- 在用户store中添加optionMap配置项并优先从optionMap获取医院名称
- 重构检查项目设置页面的操作按钮样式为统一的圆形按钮设计
- 更新检查项目设置页面的导航栏样式和交互体验
- 优化门诊记录页面的搜索条件和表格展示功能
- 添加性别和状态筛选条件并改进数据加载逻辑
This commit is contained in:
2026-01-03 23:47:09 +08:00
parent 61f4020487
commit 0c35044231
54 changed files with 5871 additions and 510 deletions

View File

@@ -0,0 +1,18 @@
package com.openhis.web.service;
import com.openhis.web.dto.HomeStatisticsDto;
/**
* 首页统计Service接口
*
* @author system
* @date 2025-12-31
*/
public interface IHomeStatisticsService {
/**
* 获取首页统计数据
*
* @return 首页统计数据
*/
HomeStatisticsDto getHomeStatistics();
}

View File

@@ -0,0 +1,122 @@
package com.openhis.web.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.core.common.utils.DateUtils;
import com.core.common.utils.SecurityUtils;
import com.openhis.administration.domain.Encounter;
import com.openhis.administration.domain.EncounterParticipant;
import com.openhis.administration.domain.Patient;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IEncounterParticipantService;
import com.openhis.administration.service.IEncounterService;
import com.openhis.administration.service.IPatientService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.enums.ParticipantType;
import com.openhis.web.dto.HomeStatisticsDto;
import com.openhis.web.service.IHomeStatisticsService;
import com.openhis.web.patientmanage.mapper.PatientManageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Arrays;
/**
* 首页统计Service业务层处理
*
* @author system
* @date 2025-12-31
*/
@Service
public class HomeStatisticsServiceImpl implements IHomeStatisticsService {
@Autowired
private IEncounterService encounterService;
@Autowired
private IEncounterParticipantService encounterParticipantService;
@Autowired
private IPractitionerService practitionerService;
@Autowired
private PatientManageMapper patientManageMapper;
@Autowired
private IPatientService patientService;
/**
* 获取首页统计数据
*
* @return 首页统计数据
*/
@Override
public HomeStatisticsDto getHomeStatistics() {
HomeStatisticsDto statistics = new HomeStatisticsDto();
// 获取当前登录用户ID
Long userId = SecurityUtils.getUserId();
// 查询当前用户对应的医生信息
LambdaQueryWrapper<Practitioner> practitionerQuery = new LambdaQueryWrapper<>();
practitionerQuery.eq(Practitioner::getUserId, userId);
// 使用list()避免TooManyResultsException异常然后取第一个记录
List<Practitioner> practitionerList = practitionerService.list(practitionerQuery);
Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
int totalPatients = 0;
// 如果当前用户是医生,查询该医生接诊和被挂号的所有患者
if (practitioner != null) {
// 查询该医生作为接诊医生ADMITTER, code="1"和挂号医生REGISTRATION_DOCTOR, code="12"的所有就诊记录的患者ID
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
practitioner.getId(),
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()));
totalPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0;
} else {
// 如果不是医生,查询所有患者(与患者管理页面逻辑保持一致)
LambdaQueryWrapper<Patient> patientQuery = new LambdaQueryWrapper<>();
patientQuery.eq(Patient::getDeleteFlag, "0");
List<Patient> patientList = patientService.list(patientQuery);
totalPatients = patientList != null ? patientList.size() : 0;
}
statistics.setTotalPatients(totalPatients);
// 查询昨日在院患者数量(暂时简化处理)
// TODO: 应该从历史记录表中查询昨天的实际在院患者数
int yesterdayPatients = totalPatients; // 这里应该是从历史表中查询昨天的数据
statistics.setYesterdayPatients(yesterdayPatients);
// 计算相对前日的百分比
double patientTrend = calculateTrend(totalPatients, yesterdayPatients);
statistics.setPatientTrend(patientTrend);
// 今日收入和预约等其他统计暂时设为0后续从相应表查询
statistics.setTodayRevenue("¥ 0");
statistics.setYesterdayRevenue("¥ 0");
statistics.setRevenueTrend(0.0);
statistics.setTodayAppointments(0);
statistics.setYesterdayAppointments(0);
statistics.setAppointmentTrend(0.0);
statistics.setPendingApprovals(0);
return statistics;
}
/**
* 计算相对前日的百分比变化
*
* @param todayValue 今天的值
* @param yesterdayValue 昨天的值
* @return 百分比变化(正数表示增长,负数表示下降)
*/
private double calculateTrend(double todayValue, double yesterdayValue) {
if (yesterdayValue == 0) {
return todayValue > 0 ? 100.0 : 0.0;
}
return ((todayValue - yesterdayValue) / yesterdayValue) * 100;
}
}