chore(strip): verwijder kapotte intake-tabs anamnese, onderzoeken en ROM
Opslaan faalde altijd door label/code-mismatch met de database-constraints (reviewbevinding). Tabs komen terug bij de rebuild op het nieuwe datamodel. - tab-mappen anamnese/, examination/, rom/ verwijderd - tabs uit intake-tabs.tsx, server actions uit actions.ts - intake-status API telt de secties niet meer mee (voortgangsring klopt) - Cortex-navigatiedoelen (regex, entity-mapping, prompt) bijgewerkt zodat 'ga naar anamnese' geen 404 meer geeft Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -207,8 +207,8 @@ Je herkent de volgende gebruikersintenties en voert acties uit:
|
|||||||
- Actie: Toon DiagnoseBlock met ICD-10 codes
|
- Actie: Toon DiagnoseBlock met ICD-10 codes
|
||||||
|
|
||||||
- **intake_navigeer** — Navigeer naar intake sectie
|
- **intake_navigeer** — Navigeer naar intake sectie
|
||||||
- Triggers: "ga naar risico", "ga naar diagnose", "ga naar kindcheck", "ga naar anamnese", "open risicotaxatie", "naar behandeladvies"
|
- Triggers: "ga naar risico", "ga naar diagnose", "ga naar kindcheck", "open risicotaxatie", "naar behandeladvies"
|
||||||
- Entities: navigationTarget (risk/diagnosis/kindcheck/anamnese/contacts/examination/rom/behandeladvies)
|
- Entities: navigationTarget (risk/diagnosis/kindcheck/contacts/behandeladvies)
|
||||||
- Required: navigationTarget, actieve patient
|
- Required: navigationTarget, actieve patient
|
||||||
- Actie: Navigeer naar de intake sectie in het EPD
|
- Actie: Navigeer naar de intake sectie in het EPD
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,8 @@ interface IntakeSection {
|
|||||||
|
|
||||||
const INTAKE_SECTIONS: IntakeSection[] = [
|
const INTAKE_SECTIONS: IntakeSection[] = [
|
||||||
{ id: 'contacts', label: 'Contactmomenten', required: false },
|
{ id: 'contacts', label: 'Contactmomenten', required: false },
|
||||||
{ id: 'anamnese', label: 'Anamnese', required: true },
|
|
||||||
{ id: 'risk', label: 'Risicotaxatie', required: true },
|
{ id: 'risk', label: 'Risicotaxatie', required: true },
|
||||||
{ id: 'kindcheck', label: 'Kindcheck', required: true },
|
{ id: 'kindcheck', label: 'Kindcheck', required: true },
|
||||||
{ id: 'examination', label: 'Onderzoek', required: false },
|
|
||||||
{ id: 'rom', label: 'Meetinstrumenten (ROM)', required: false },
|
|
||||||
{ id: 'diagnosis', label: 'Diagnose', required: true },
|
{ id: 'diagnosis', label: 'Diagnose', required: true },
|
||||||
{ id: 'behandeladvies', label: 'Behandeladvies', required: true },
|
{ id: 'behandeladvies', label: 'Behandeladvies', required: true },
|
||||||
];
|
];
|
||||||
@@ -139,41 +136,17 @@ export async function GET(request: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch counts for each section in parallel
|
// Fetch counts for each section in parallel
|
||||||
const [
|
const [contactsResult, riskResult, diagnosisResult] = await Promise.all([
|
||||||
contactsResult,
|
|
||||||
anamneseResult,
|
|
||||||
riskResult,
|
|
||||||
examinationResult,
|
|
||||||
romResult,
|
|
||||||
diagnosisResult,
|
|
||||||
] = await Promise.all([
|
|
||||||
// Contacts (encounters)
|
// Contacts (encounters)
|
||||||
supabase
|
supabase
|
||||||
.from('encounters')
|
.from('encounters')
|
||||||
.select('id', { count: 'exact', head: true })
|
.select('id', { count: 'exact', head: true })
|
||||||
.eq('intake_id', targetIntakeId),
|
.eq('intake_id', targetIntakeId),
|
||||||
// Anamnese
|
|
||||||
supabase
|
|
||||||
.from('anamneses')
|
|
||||||
.select('id', { count: 'exact', head: true })
|
|
||||||
.eq('intake_id', targetIntakeId),
|
|
||||||
// Risk assessments
|
// Risk assessments
|
||||||
supabase
|
supabase
|
||||||
.from('risk_assessments')
|
.from('risk_assessments')
|
||||||
.select('id', { count: 'exact', head: true })
|
.select('id', { count: 'exact', head: true })
|
||||||
.eq('intake_id', targetIntakeId),
|
.eq('intake_id', targetIntakeId),
|
||||||
// Examinations (non-ROM)
|
|
||||||
supabase
|
|
||||||
.from('examinations')
|
|
||||||
.select('id', { count: 'exact', head: true })
|
|
||||||
.eq('intake_id', targetIntakeId)
|
|
||||||
.neq('examination_type', 'ROM'),
|
|
||||||
// ROM examinations
|
|
||||||
supabase
|
|
||||||
.from('examinations')
|
|
||||||
.select('id', { count: 'exact', head: true })
|
|
||||||
.eq('intake_id', targetIntakeId)
|
|
||||||
.eq('examination_type', 'ROM'),
|
|
||||||
// Diagnoses (conditions linked to intake via encounter_id)
|
// Diagnoses (conditions linked to intake via encounter_id)
|
||||||
supabase
|
supabase
|
||||||
.from('conditions')
|
.from('conditions')
|
||||||
@@ -184,11 +157,8 @@ export async function GET(request: NextRequest) {
|
|||||||
// Build section status
|
// Build section status
|
||||||
const sectionCounts: Record<string, number> = {
|
const sectionCounts: Record<string, number> = {
|
||||||
contacts: contactsResult.count || 0,
|
contacts: contactsResult.count || 0,
|
||||||
anamnese: anamneseResult.count || 0,
|
|
||||||
risk: riskResult.count || 0,
|
risk: riskResult.count || 0,
|
||||||
kindcheck: intake.kindcheck_data && Object.keys(intake.kindcheck_data as object).length > 0 ? 1 : 0,
|
kindcheck: intake.kindcheck_data && Object.keys(intake.kindcheck_data as object).length > 0 ? 1 : 0,
|
||||||
examination: examinationResult.count || 0,
|
|
||||||
rom: romResult.count || 0,
|
|
||||||
diagnosis: diagnosisResult.count || 0,
|
diagnosis: diagnosisResult.count || 0,
|
||||||
behandeladvies: intake.treatment_advice && Object.keys(intake.treatment_advice as object).length > 0 ? 1 : 0,
|
behandeladvies: intake.treatment_advice && Object.keys(intake.treatment_advice as object).length > 0 ? 1 : 0,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -186,116 +186,6 @@ export async function deleteRiskAssessment(patientId: string, intakeId: string,
|
|||||||
revalidatePath(buildPath(patientId, intakeId));
|
revalidatePath(buildPath(patientId, intakeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------- Anamneses ----------------
|
|
||||||
export async function getAnamneses(intakeId: string) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { data, error } = await supabase
|
|
||||||
.from('anamneses')
|
|
||||||
.select('*')
|
|
||||||
.eq('intake_id', intakeId)
|
|
||||||
.order('anamnese_date', { ascending: false });
|
|
||||||
if (error) {
|
|
||||||
console.error('getAnamneses error', error);
|
|
||||||
throw new Error('Kon anamneses niet ophalen');
|
|
||||||
}
|
|
||||||
return data || [];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AnamnesePayload {
|
|
||||||
patientId: string;
|
|
||||||
intakeId: string;
|
|
||||||
date: string;
|
|
||||||
type: string;
|
|
||||||
content: string;
|
|
||||||
notes?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createAnamnese(payload: AnamnesePayload) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { error } = await supabase.from('anamneses').insert({
|
|
||||||
intake_id: payload.intakeId,
|
|
||||||
anamnese_date: payload.date,
|
|
||||||
anamnese_type: payload.type,
|
|
||||||
content: payload.content,
|
|
||||||
notes: payload.notes,
|
|
||||||
});
|
|
||||||
if (error) {
|
|
||||||
console.error('createAnamnese error', error);
|
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
|
||||||
revalidatePath(buildPath(payload.patientId, payload.intakeId, 'anamnese'));
|
|
||||||
revalidatePath(buildPath(payload.patientId, payload.intakeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deleteAnamnese(patientId: string, intakeId: string, anamneseId: string) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { error } = await supabase.from('anamneses').delete().eq('id', anamneseId);
|
|
||||||
if (error) {
|
|
||||||
console.error('deleteAnamnese error', error);
|
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
|
||||||
revalidatePath(buildPath(patientId, intakeId, 'anamnese'));
|
|
||||||
revalidatePath(buildPath(patientId, intakeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------- Examinations (including ROM) ----------------
|
|
||||||
export async function getExaminations(intakeId: string) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { data, error } = await supabase
|
|
||||||
.from('examinations')
|
|
||||||
.select('*')
|
|
||||||
.eq('intake_id', intakeId)
|
|
||||||
.order('examination_date', { ascending: false });
|
|
||||||
if (error) {
|
|
||||||
console.error('getExaminations error', error);
|
|
||||||
throw new Error('Kon onderzoeken niet ophalen');
|
|
||||||
}
|
|
||||||
return data || [];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExaminationPayload {
|
|
||||||
patientId: string;
|
|
||||||
intakeId: string;
|
|
||||||
date: string;
|
|
||||||
type: string;
|
|
||||||
findings: string;
|
|
||||||
performer?: string;
|
|
||||||
reason?: string;
|
|
||||||
notes?: string;
|
|
||||||
isRom?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createExamination(payload: ExaminationPayload) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { error } = await supabase.from('examinations').insert({
|
|
||||||
intake_id: payload.intakeId,
|
|
||||||
examination_date: payload.date,
|
|
||||||
examination_type: payload.isRom ? 'ROM' : payload.type,
|
|
||||||
findings: payload.findings,
|
|
||||||
performed_by: payload.performer,
|
|
||||||
reason: payload.reason,
|
|
||||||
notes: payload.notes,
|
|
||||||
});
|
|
||||||
if (error) {
|
|
||||||
console.error('createExamination error', error);
|
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
|
||||||
const tab = payload.isRom ? 'rom' : 'examination';
|
|
||||||
revalidatePath(buildPath(payload.patientId, payload.intakeId, tab));
|
|
||||||
revalidatePath(buildPath(payload.patientId, payload.intakeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deleteExamination(patientId: string, intakeId: string, examinationId: string) {
|
|
||||||
const supabase = await getSupabase();
|
|
||||||
const { error } = await supabase.from('examinations').delete().eq('id', examinationId);
|
|
||||||
if (error) {
|
|
||||||
console.error('deleteExamination error', error);
|
|
||||||
throw new Error(error.message);
|
|
||||||
}
|
|
||||||
revalidatePath(buildPath(patientId, intakeId, 'examination'));
|
|
||||||
revalidatePath(buildPath(patientId, intakeId, 'rom'));
|
|
||||||
revalidatePath(buildPath(patientId, intakeId));
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------- Diagnoses ----------------
|
// ---------------- Diagnoses ----------------
|
||||||
export async function getDiagnoses(intakeId: string) {
|
export async function getDiagnoses(intakeId: string) {
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useState, useTransition } from 'react';
|
|
||||||
import { createAnamnese, deleteAnamnese, type Anamnese } from '../../actions';
|
|
||||||
import { Loader2, Trash2 } from 'lucide-react';
|
|
||||||
import { format } from 'date-fns';
|
|
||||||
import { nl } from 'date-fns/locale';
|
|
||||||
|
|
||||||
const types = [
|
|
||||||
'Psychiatrische anamnese',
|
|
||||||
'Sociale anamnese',
|
|
||||||
'Medische anamnese',
|
|
||||||
'Familieanamnese',
|
|
||||||
'Ontwikkelingsanamnese',
|
|
||||||
'Overig',
|
|
||||||
];
|
|
||||||
|
|
||||||
interface AnamneseManagerProps {
|
|
||||||
patientId: string;
|
|
||||||
intakeId: string;
|
|
||||||
anamneses: Anamnese[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AnamneseManager({ patientId, intakeId, anamneses }: AnamneseManagerProps) {
|
|
||||||
const [form, setForm] = useState({
|
|
||||||
date: '',
|
|
||||||
type: types[0],
|
|
||||||
content: '',
|
|
||||||
notes: '',
|
|
||||||
});
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
const [isPending, startTransition] = useTransition();
|
|
||||||
const [deletingId, setDeletingId] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const handleSubmit = () => {
|
|
||||||
if (!form.date || !form.content) {
|
|
||||||
setError('Datum en inhoud zijn verplicht.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setError(null);
|
|
||||||
startTransition(async () => {
|
|
||||||
try {
|
|
||||||
await createAnamnese({
|
|
||||||
patientId,
|
|
||||||
intakeId,
|
|
||||||
date: form.date,
|
|
||||||
type: form.type,
|
|
||||||
content: form.content,
|
|
||||||
notes: form.notes,
|
|
||||||
});
|
|
||||||
setForm({ ...form, content: '', notes: '' });
|
|
||||||
} catch (err) {
|
|
||||||
setError(err instanceof Error ? err.message : 'Opslaan mislukt');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = (id: string) => {
|
|
||||||
setDeletingId(id);
|
|
||||||
startTransition(async () => {
|
|
||||||
try {
|
|
||||||
await deleteAnamnese(patientId, intakeId, id);
|
|
||||||
} catch (err) {
|
|
||||||
setError(err instanceof Error ? err.message : 'Verwijderen mislukt');
|
|
||||||
} finally {
|
|
||||||
setDeletingId(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="grid grid-cols-1 gap-3">
|
|
||||||
{anamneses.length === 0 && <p className="text-sm text-slate-500">Nog geen anamneses.</p>}
|
|
||||||
{anamneses.map((item) => (
|
|
||||||
<div key={item.id} className="rounded-lg border border-slate-200 p-4 space-y-1">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
<p className="font-medium text-slate-900">{item.anamnese_type}</p>
|
|
||||||
<p className="text-xs text-slate-500">
|
|
||||||
{format(new Date(item.anamnese_date), 'd MMM yyyy', { locale: nl })}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => handleDelete(item.id)}
|
|
||||||
disabled={deletingId === item.id}
|
|
||||||
className="inline-flex items-center gap-1 rounded-md border border-red-200 px-3 py-1.5 text-xs text-red-600"
|
|
||||||
>
|
|
||||||
{deletingId === item.id ? <Loader2 className="h-4 w-4 animate-spin" /> : <Trash2 className="h-4 w-4" />} Verwijder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p className="text-sm text-slate-700 whitespace-pre-line">{item.content}</p>
|
|
||||||
{item.notes && <p className="text-xs text-slate-500">Notities: {item.notes}</p>}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="rounded-lg border border-slate-200 p-4 space-y-3">
|
|
||||||
<h3 className="text-sm font-semibold text-slate-900">Nieuwe anamnese</h3>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
value={form.date}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, date: e.target.value }))}
|
|
||||||
className="h-10 rounded-md border border-slate-300 px-3 text-sm"
|
|
||||||
/>
|
|
||||||
<select
|
|
||||||
value={form.type}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, type: e.target.value }))}
|
|
||||||
className="h-10 rounded-md border border-slate-300 px-3 text-sm"
|
|
||||||
>
|
|
||||||
{types.map((type) => (
|
|
||||||
<option key={type} value={type}>
|
|
||||||
{type}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
<textarea
|
|
||||||
value={form.content}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, content: e.target.value }))}
|
|
||||||
placeholder="Inhoud"
|
|
||||||
className="w-full rounded-md border border-slate-300 px-3 py-2 text-sm"
|
|
||||||
/>
|
|
||||||
<textarea
|
|
||||||
value={form.notes}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, notes: e.target.value }))}
|
|
||||||
placeholder="Notities"
|
|
||||||
className="w-full rounded-md border border-slate-300 px-3 py-2 text-sm"
|
|
||||||
/>
|
|
||||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={handleSubmit}
|
|
||||||
disabled={isPending}
|
|
||||||
className="inline-flex items-center gap-2 rounded-md bg-teal-600 px-4 py-2 text-sm font-medium text-white"
|
|
||||||
>
|
|
||||||
{isPending && <Loader2 className="h-4 w-4 animate-spin" />}
|
|
||||||
Opslaan
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { getAnamneses } from '../actions';
|
|
||||||
import { AnamneseManager } from './components/anamnese-manager';
|
|
||||||
|
|
||||||
export default async function IntakeAnamnesePage({
|
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
params: Promise<{ id: string; intakeId: string }>;
|
|
||||||
}) {
|
|
||||||
const { id, intakeId } = await params;
|
|
||||||
const anamneses = await getAnamneses(intakeId);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div>
|
|
||||||
<h2 className="text-lg font-semibold text-slate-900">Anamnese</h2>
|
|
||||||
<p className="text-sm text-slate-600">
|
|
||||||
Vastleggen van psychiatrische, sociale en andere anamneses.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<AnamneseManager patientId={id} intakeId={intakeId} anamneses={anamneses} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -56,9 +56,6 @@ export function IntakeTabs({ patientId, intakeId }: IntakeTabsProps) {
|
|||||||
{ name: 'Contactmomenten', href: `${baseUrl}/contacts` },
|
{ name: 'Contactmomenten', href: `${baseUrl}/contacts` },
|
||||||
{ name: 'Kindcheck', href: `${baseUrl}/kindcheck` },
|
{ name: 'Kindcheck', href: `${baseUrl}/kindcheck` },
|
||||||
{ name: 'Risicotaxatie', href: `${baseUrl}/risk` },
|
{ name: 'Risicotaxatie', href: `${baseUrl}/risk` },
|
||||||
{ name: 'Anamnese', href: `${baseUrl}/anamnese` },
|
|
||||||
{ name: 'Onderzoeken', href: `${baseUrl}/examination` },
|
|
||||||
{ name: 'ROM', href: `${baseUrl}/rom` },
|
|
||||||
{ name: 'Diagnose', href: `${baseUrl}/diagnosis` },
|
{ name: 'Diagnose', href: `${baseUrl}/diagnosis` },
|
||||||
{ name: 'Behandeladvies', href: `${baseUrl}/behandeladvies` },
|
{ name: 'Behandeladvies', href: `${baseUrl}/behandeladvies` },
|
||||||
], [baseUrl]);
|
], [baseUrl]);
|
||||||
|
|||||||
@@ -1,167 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useState, useTransition } from 'react';
|
|
||||||
import { createExamination, deleteExamination, type Examination } from '../../actions';
|
|
||||||
import { Loader2, Trash2 } from 'lucide-react';
|
|
||||||
import { format } from 'date-fns';
|
|
||||||
import { nl } from 'date-fns/locale';
|
|
||||||
|
|
||||||
const examinationTypes = ['Bloedonderzoek', 'Neuropsychologisch onderzoek', 'Psychodiagnostiek', 'IQ-test', 'Persoonlijkheidsonderzoek', 'Overig'];
|
|
||||||
|
|
||||||
interface ExaminationManagerProps {
|
|
||||||
patientId: string;
|
|
||||||
intakeId: string;
|
|
||||||
examinations: Examination[];
|
|
||||||
isRom?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ExaminationManager({ patientId, intakeId, examinations, isRom }: ExaminationManagerProps) {
|
|
||||||
const filtered = examinations.filter((exam) =>
|
|
||||||
isRom ? exam.examination_type === 'ROM' : exam.examination_type !== 'ROM'
|
|
||||||
);
|
|
||||||
|
|
||||||
const [form, setForm] = useState({
|
|
||||||
date: '',
|
|
||||||
type: examinationTypes[0],
|
|
||||||
performer: '',
|
|
||||||
findings: '',
|
|
||||||
reason: '',
|
|
||||||
notes: '',
|
|
||||||
});
|
|
||||||
const [error, setError] = useState<string | null>(null);
|
|
||||||
const [isPending, startTransition] = useTransition();
|
|
||||||
const [deletingId, setDeletingId] = useState<string | null>(null);
|
|
||||||
|
|
||||||
const handleSubmit = () => {
|
|
||||||
if (!form.date || !form.findings) {
|
|
||||||
setError('Datum en bevindingen zijn verplicht.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setError(null);
|
|
||||||
startTransition(async () => {
|
|
||||||
try {
|
|
||||||
await createExamination({
|
|
||||||
patientId,
|
|
||||||
intakeId,
|
|
||||||
date: form.date,
|
|
||||||
type: form.type,
|
|
||||||
findings: form.findings,
|
|
||||||
performer: form.performer,
|
|
||||||
reason: form.reason,
|
|
||||||
notes: form.notes,
|
|
||||||
isRom,
|
|
||||||
});
|
|
||||||
setForm({ ...form, findings: '', notes: '' });
|
|
||||||
} catch (err) {
|
|
||||||
setError(err instanceof Error ? err.message : 'Opslaan mislukt');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleDelete = (id: string) => {
|
|
||||||
setDeletingId(id);
|
|
||||||
startTransition(async () => {
|
|
||||||
try {
|
|
||||||
await deleteExamination(patientId, intakeId, id);
|
|
||||||
} catch (err) {
|
|
||||||
setError(err instanceof Error ? err.message : 'Verwijderen mislukt');
|
|
||||||
} finally {
|
|
||||||
setDeletingId(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="grid grid-cols-1 gap-3">
|
|
||||||
{filtered.length === 0 && (
|
|
||||||
<p className="text-sm text-slate-500">
|
|
||||||
{isRom ? 'Nog geen ROM-metingen' : 'Nog geen onderzoeken geregistreerd.'}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
{filtered.map((exam) => (
|
|
||||||
<div key={exam.id} className="rounded-lg border border-slate-200 p-4 space-y-1">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
<p className="font-medium text-slate-900">{exam.examination_type}</p>
|
|
||||||
<p className="text-xs text-slate-500">
|
|
||||||
{format(new Date(exam.examination_date), 'd MMM yyyy', { locale: nl })}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => handleDelete(exam.id)}
|
|
||||||
disabled={deletingId === exam.id}
|
|
||||||
className="inline-flex items-center gap-1 rounded-md border border-red-200 px-3 py-1.5 text-xs text-red-600"
|
|
||||||
>
|
|
||||||
{deletingId === exam.id ? <Loader2 className="h-4 w-4 animate-spin" /> : <Trash2 className="h-4 w-4" />} Verwijder
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<p className="text-sm text-slate-700 whitespace-pre-line">{exam.findings}</p>
|
|
||||||
{exam.notes && <p className="text-xs text-slate-500">Notities: {exam.notes}</p>}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="rounded-lg border border-slate-200 p-4 space-y-3">
|
|
||||||
<h3 className="text-sm font-semibold text-slate-900">
|
|
||||||
{isRom ? 'Nieuwe ROM-meting' : 'Nieuw onderzoek'}
|
|
||||||
</h3>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
value={form.date}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, date: e.target.value }))}
|
|
||||||
className="h-10 rounded-md border border-slate-300 px-3 text-sm"
|
|
||||||
/>
|
|
||||||
{!isRom && (
|
|
||||||
<select
|
|
||||||
value={form.type}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, type: e.target.value }))}
|
|
||||||
className="h-10 rounded-md border border-slate-300 px-3 text-sm"
|
|
||||||
>
|
|
||||||
{examinationTypes.map((type) => (
|
|
||||||
<option key={type} value={type}>
|
|
||||||
{type}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
)}
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder={isRom ? 'Instrument / score' : 'Uitgevoerd door'}
|
|
||||||
value={form.performer}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, performer: e.target.value }))}
|
|
||||||
className="h-10 rounded-md border border-slate-300 px-3 text-sm"
|
|
||||||
/>
|
|
||||||
<textarea
|
|
||||||
value={form.findings}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, findings: e.target.value }))}
|
|
||||||
placeholder={isRom ? 'Score en interpretatie' : 'Bevindingen'}
|
|
||||||
className="w-full rounded-md border border-slate-300 px-3 py-2 text-sm"
|
|
||||||
/>
|
|
||||||
<textarea
|
|
||||||
value={form.reason}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, reason: e.target.value }))}
|
|
||||||
placeholder="Reden"
|
|
||||||
className="w-full rounded-md border border-slate-300 px-3 py-2 text-sm"
|
|
||||||
/>
|
|
||||||
<textarea
|
|
||||||
value={form.notes}
|
|
||||||
onChange={(e) => setForm((prev) => ({ ...prev, notes: e.target.value }))}
|
|
||||||
placeholder="Notities"
|
|
||||||
className="w-full rounded-md border border-slate-300 px-3 py-2 text-sm"
|
|
||||||
/>
|
|
||||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={handleSubmit}
|
|
||||||
disabled={isPending}
|
|
||||||
className="inline-flex items-center gap-2 rounded-md bg-teal-600 px-4 py-2 text-sm font-medium text-white"
|
|
||||||
>
|
|
||||||
{isPending && <Loader2 className="h-4 w-4 animate-spin" />}
|
|
||||||
Opslaan
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { getExaminations } from '../actions';
|
|
||||||
import { ExaminationManager } from './components/examination-manager';
|
|
||||||
|
|
||||||
export default async function IntakeExaminationPage({
|
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
params: Promise<{ id: string; intakeId: string }>;
|
|
||||||
}) {
|
|
||||||
const { id, intakeId } = await params;
|
|
||||||
const examinations = await getExaminations(intakeId);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div>
|
|
||||||
<h2 className="text-lg font-semibold text-slate-900">Onderzoeken</h2>
|
|
||||||
<p className="text-sm text-slate-600">
|
|
||||||
Psychodiagnostiek, medische onderzoeken en rapportage.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<ExaminationManager patientId={id} intakeId={intakeId} examinations={examinations} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { getExaminations } from '../actions';
|
|
||||||
import { ExaminationManager } from '../examination/components/examination-manager';
|
|
||||||
|
|
||||||
export default async function IntakeRomPage({
|
|
||||||
params,
|
|
||||||
}: {
|
|
||||||
params: Promise<{ id: string; intakeId: string }>;
|
|
||||||
}) {
|
|
||||||
const { id, intakeId } = await params;
|
|
||||||
const examinations = await getExaminations(intakeId);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div>
|
|
||||||
<h2 className="text-lg font-semibold text-slate-900">ROM-metingen</h2>
|
|
||||||
<p className="text-sm text-slate-600">
|
|
||||||
Registeren van ROM-scores gekoppeld aan deze intake.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<ExaminationManager
|
|
||||||
patientId={id}
|
|
||||||
intakeId={intakeId}
|
|
||||||
examinations={examinations}
|
|
||||||
isRom
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -40,9 +40,6 @@ const INTAKE_TAB_PATHS: Record<string, string> = {
|
|||||||
contacts: 'contacts',
|
contacts: 'contacts',
|
||||||
kindcheck: 'kindcheck',
|
kindcheck: 'kindcheck',
|
||||||
risk: 'risk',
|
risk: 'risk',
|
||||||
anamnese: 'anamnese',
|
|
||||||
examination: 'examination',
|
|
||||||
rom: 'rom',
|
|
||||||
diagnosis: 'diagnosis',
|
diagnosis: 'diagnosis',
|
||||||
behandeladvies: 'behandeladvies',
|
behandeladvies: 'behandeladvies',
|
||||||
};
|
};
|
||||||
@@ -146,7 +143,7 @@ export function CommandCenter() {
|
|||||||
toast({
|
toast({
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
title: 'Navigatie mislukt',
|
title: 'Navigatie mislukt',
|
||||||
description: 'Onbekende sectie. Probeer: risico, diagnose, anamnese.',
|
description: 'Onbekende sectie. Probeer: risico, diagnose, kindcheck.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -685,9 +685,6 @@ export type IntakeTab =
|
|||||||
| 'contacts'
|
| 'contacts'
|
||||||
| 'kindcheck'
|
| 'kindcheck'
|
||||||
| 'risk'
|
| 'risk'
|
||||||
| 'anamnese'
|
|
||||||
| 'examination'
|
|
||||||
| 'rom'
|
|
||||||
| 'diagnosis'
|
| 'diagnosis'
|
||||||
| 'behandeladvies';
|
| 'behandeladvies';
|
||||||
|
|
||||||
@@ -703,10 +700,6 @@ const INTAKE_TAB_KEYWORDS: Record<string, IntakeTab> = {
|
|||||||
'diagnose': 'diagnosis',
|
'diagnose': 'diagnosis',
|
||||||
'diagnoses': 'diagnosis',
|
'diagnoses': 'diagnosis',
|
||||||
'dsm': 'diagnosis',
|
'dsm': 'diagnosis',
|
||||||
// Anamnese
|
|
||||||
'anamnese': 'anamnese',
|
|
||||||
'voorgeschiedenis': 'anamnese',
|
|
||||||
'geschiedenis': 'anamnese',
|
|
||||||
// Contacts
|
// Contacts
|
||||||
'contact': 'contacts',
|
'contact': 'contacts',
|
||||||
'contacten': 'contacts',
|
'contacten': 'contacts',
|
||||||
@@ -714,14 +707,6 @@ const INTAKE_TAB_KEYWORDS: Record<string, IntakeTab> = {
|
|||||||
// Kindcheck
|
// Kindcheck
|
||||||
'kindcheck': 'kindcheck',
|
'kindcheck': 'kindcheck',
|
||||||
'kinderen': 'kindcheck',
|
'kinderen': 'kindcheck',
|
||||||
// Examination
|
|
||||||
'onderzoek': 'examination',
|
|
||||||
'psychiatrisch': 'examination',
|
|
||||||
// ROM
|
|
||||||
'rom': 'rom',
|
|
||||||
'meetinstrumenten': 'rom',
|
|
||||||
'vragenlijst': 'rom',
|
|
||||||
'vragenlijsten': 'rom',
|
|
||||||
// Behandeladvies
|
// Behandeladvies
|
||||||
'behandeladvies': 'behandeladvies',
|
'behandeladvies': 'behandeladvies',
|
||||||
'advies': 'behandeladvies',
|
'advies': 'behandeladvies',
|
||||||
|
|||||||
@@ -170,17 +170,15 @@ const INTENT_PATTERNS: Record<Exclude<CortexIntent, 'unknown'>, PatternConfig[]>
|
|||||||
// Navigation to specific intake tabs/sections
|
// Navigation to specific intake tabs/sections
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?(risico|risicotaxatie)/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?(risico|risicotaxatie)/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?diagnose[ns]?/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?diagnose[ns]?/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?anamnese/i, weight: 1.0 },
|
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?behandelgeschiedenis/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?behandelgeschiedenis/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?medicatie/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?medicatie/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?meetinstrumenten/i, weight: 1.0 },
|
|
||||||
{ pattern: /^ga\s+naar\s+(het\s+)?netwerk/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(het\s+)?netwerk/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?doelen/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?doelen/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?samenvatting/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?samenvatting/i, weight: 1.0 },
|
||||||
// Open patterns
|
// Open patterns
|
||||||
{ pattern: /^open\s+(de\s+)?(risico|diagnose|anamnese|medicatie|netwerk|doelen|samenvatting)/i, weight: 0.95 },
|
{ pattern: /^open\s+(de\s+)?(risico|diagnose|medicatie|netwerk|doelen|samenvatting)/i, weight: 0.95 },
|
||||||
// Show patterns
|
// Show patterns
|
||||||
{ pattern: /^(toon|laat\s+zien)\s+(de\s+)?(risico|diagnose|anamnese|medicatie|netwerk|doelen|samenvatting)/i, weight: 0.9 },
|
{ pattern: /^(toon|laat\s+zien)\s+(de\s+)?(risico|diagnose|medicatie|netwerk|doelen|samenvatting)/i, weight: 0.9 },
|
||||||
],
|
],
|
||||||
|
|
||||||
risico_query: [
|
risico_query: [
|
||||||
|
|||||||
@@ -179,18 +179,15 @@ const INTENT_PATTERNS: Record<Exclude<CortexIntent, 'unknown'>, PatternConfig[]>
|
|||||||
{ pattern: /^ga\s+naar\s+(de\s+)?(risico|risicotaxatie)/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?(risico|risicotaxatie)/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?diagnose/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?diagnose/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?kindcheck/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?kindcheck/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?anamnese/i, weight: 1.0 },
|
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?behandeladvies/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?behandeladvies/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?(rom|vragenlijst)/i, weight: 1.0 },
|
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?onderzoek/i, weight: 1.0 },
|
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?contact/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?contact/i, weight: 1.0 },
|
||||||
{ pattern: /^ga\s+naar\s+(de\s+)?algemeen/i, weight: 1.0 },
|
{ pattern: /^ga\s+naar\s+(de\s+)?algemeen/i, weight: 1.0 },
|
||||||
|
|
||||||
// "Open [sectie]" patterns
|
// "Open [sectie]" patterns
|
||||||
{ pattern: /^open\s+(de\s+)?(risico|diagnose|kindcheck|anamnese)/i, weight: 0.95 },
|
{ pattern: /^open\s+(de\s+)?(risico|diagnose|kindcheck)/i, weight: 0.95 },
|
||||||
|
|
||||||
// "Naar [sectie]" patterns (shorter)
|
// "Naar [sectie]" patterns (shorter)
|
||||||
{ pattern: /^naar\s+(risico|diagnose|kindcheck|anamnese|behandeladvies)/i, weight: 0.9 },
|
{ pattern: /^naar\s+(risico|diagnose|kindcheck|behandeladvies)/i, weight: 0.9 },
|
||||||
],
|
],
|
||||||
|
|
||||||
risico_query: [
|
risico_query: [
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export interface ExtractedEntities {
|
|||||||
time?: string;
|
time?: string;
|
||||||
|
|
||||||
// Intake navigation (MVP)
|
// Intake navigation (MVP)
|
||||||
navigationTarget?: 'contacts' | 'kindcheck' | 'risk' | 'anamnese' | 'examination' | 'rom' | 'diagnosis' | 'behandeladvies';
|
navigationTarget?: 'contacts' | 'kindcheck' | 'risk' | 'diagnosis' | 'behandeladvies';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block sizes
|
// Block sizes
|
||||||
|
|||||||
Reference in New Issue
Block a user