dak.c2s/frontend/src/hooks/useDashboard.ts
CCS Admin 5da1e523d3 feat: implement Gutachten-Statistik page with KPIs and charts
Add full statistics page replacing placeholder: 4 KPI cards (total, Bestätigung,
Alternative, Uncodiert), stacked bar chart for gutachten types per KW, donut chart
for type distribution, grouped bar chart for therapy changes per KW, and horizontal
bar chart for therapy change reasons. Includes new backend endpoint and service
function combining sheet3/sheet4 data with KPI aggregation. Also adds feature
roadmap todo.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:37:08 +00:00

32 lines
1.1 KiB
TypeScript

import { useQuery } from '@tanstack/react-query'
import api from '@/services/api'
import type { DashboardResponse, YearlyComparisonResponse, TopIcdResponse, GutachtenStatistikResponse } from '@/types'
export function useDashboard(jahr: number) {
return useQuery({
queryKey: ['dashboard', jahr],
queryFn: () => api.get<DashboardResponse>('/reports/dashboard', { params: { jahr } }).then(r => r.data),
})
}
export function useYearlyComparison() {
return useQuery({
queryKey: ['dashboard', 'yearly-comparison'],
queryFn: () => api.get<YearlyComparisonResponse>('/reports/dashboard/yearly-comparison').then(r => r.data),
staleTime: 60_000,
})
}
export function useTopIcd(jahr: number) {
return useQuery({
queryKey: ['dashboard', 'top-icd', jahr],
queryFn: () => api.get<TopIcdResponse>('/reports/dashboard/top-icd', { params: { jahr } }).then(r => r.data),
})
}
export function useGutachtenStatistik(jahr: number) {
return useQuery({
queryKey: ['gutachten-statistik', jahr],
queryFn: () => api.get<GutachtenStatistikResponse>('/reports/gutachten-statistik', { params: { jahr } }).then(r => r.data),
})
}