fix(health): 走查止血 — 患者名显示修复 + 枚举补全 + 医护统计 + 设备选择器
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

后端:
- alert_service: list_alerts 批量查询 patient_name 填充 AlertResponse
- consultation_service: list_sessions 批量查询 patient_name/doctor_name
- erp-ai handler: list_analysis 通过 raw SQL 查询 patient_name

前端:
- AlertList/AlertDashboard: 使用后端返回的 patient_name 替代 ID 截断
- ConsultationDetail: 使用 patient_name/doctor_name 替代 ID 截断
- AiAnalysisList: 使用 patient_name 替代 ID 截断
- constants/health: SEVERITY 补 high/medium, STATUS 补 active
- AdminDashboard: 医护人数改为 API 查询(useStatsData 新增 doctorCount)
- DeviceManage: 患者 ID 输入改为 PatientSelect 搜索选择器
This commit is contained in:
iven
2026-05-04 00:03:40 +08:00
parent 20bd9e8cb4
commit 5140552ff6
14 changed files with 155 additions and 29 deletions

View File

@@ -8,6 +8,7 @@ import {
type HealthDataStats,
type DialysisStatistics,
} from '../../../api/health/points';
import { doctorApi } from '../../../api/health/doctors';
export interface StatsData {
patientStats: PatientStatistics | null;
@@ -16,6 +17,7 @@ export interface StatsData {
pointsStats: PointsStatistics | null;
healthDataStats: HealthDataStats | null;
dialysisStats: DialysisStatistics | null;
doctorCount: number;
loading: boolean;
error: string | null;
refresh: () => void;
@@ -31,6 +33,7 @@ export function useStatsData(): StatsData {
const [pointsStats, setPointsStats] = useState<PointsStatistics | null>(null);
const [healthDataStats, setHealthDataStats] = useState<HealthDataStats | null>(null);
const [dialysisStats, setDialysisStats] = useState<DialysisStatistics | null>(null);
const [doctorCount, setDoctorCount] = useState(0);
const fetchAllStats = useCallback(async () => {
setLoading(true);
@@ -56,9 +59,14 @@ export function useStatsData(): StatsData {
tryFetch(pointsApi.getStatistics, setPointsStats, '积分'),
tryFetch(pointsApi.getHealthDataStats, setHealthDataStats, '健康数据'),
tryFetch(pointsApi.getDialysisStats, setDialysisStats, '透析'),
tryFetch(
async () => { const r = await doctorApi.list({ page: 1, page_size: 1 }); return r.total; },
setDoctorCount,
'医护',
),
]);
if (hasAnyError && errors.length === 6) {
if (hasAnyError && errors.length === 7) {
setError('加载统计数据失败');
}
@@ -70,7 +78,7 @@ export function useStatsData(): StatsData {
}, [fetchAllStats]);
return {
patientStats, consultationStats, followUpStats, pointsStats, healthDataStats, dialysisStats,
patientStats, consultationStats, followUpStats, pointsStats, healthDataStats, dialysisStats, doctorCount,
loading, error, refresh: fetchAllStats,
};
}