'use client'; /** * PatientCard Component * E4.S2: Naam, leeftijd, alert badge (rood=hoog risico), doorklik */ import Link from 'next/link'; import { AlertTriangle, User, ChevronRight, Activity, FileText, ShieldAlert } from 'lucide-react'; import type { PatientOverzicht } from '@/lib/types/overdracht'; interface PatientCardProps { patient: PatientOverzicht; } function formatPatientName(nameGiven: string[], nameFamily: string): string { const given = nameGiven.join(' '); return `${given} ${nameFamily}`; } function calculateAge(birthDate: string): number { const birth = new Date(birthDate); const today = new Date(); let age = today.getFullYear() - birth.getFullYear(); const monthDiff = today.getMonth() - birth.getMonth(); if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) { age--; } return age; } function getGenderLabel(gender: string): string { switch (gender) { case 'male': return 'M'; case 'female': return 'V'; default: return 'O'; } } export function PatientCard({ patient }: PatientCardProps) { const name = formatPatientName(patient.name_given, patient.name_family); const age = calculateAge(patient.birth_date); const genderLabel = getGenderLabel(patient.gender); const hasAlerts = patient.alerts.total > 0; const hasHighRisk = patient.alerts.high_risk_count > 0; return (
{age} jaar • {genderLabel}