chore(strip): verwijder behandelplan-module
AI-generatie negeerde de geregistreerde diagnose en ernst — elk plan was generiek (reviewbevinding). Module komt terug bij de rebuild, gekoppeld aan het nieuwe datamodel. - app/epd/patients/[id]/behandelplan/ en /api/behandelplan/ verwijderd - components/behandelplan/ (view, list, forms) verwijderd - lib/ai/behandelplan-prompt.ts, lib/ai/intervention-mapping.ts, lib/types/behandelplan.ts verwijderd - behandelplan-sectie uit patientdashboard, dashboard-API en Cortex patient-dashboard-block - 'Doorzetten naar behandelplan' uit behandeladvies-formulier Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,18 +4,11 @@ import { createClient } from '@/lib/auth/server';
|
||||
import { getPatient } from '@/app/epd/patients/actions';
|
||||
import { getIntakesByPatientId } from '@/app/epd/patients/[id]/intakes/actions';
|
||||
import { getPatientEncounters } from '@/app/epd/agenda/actions';
|
||||
import { getActiveCarePlan } from '@/app/epd/patients/[id]/behandelplan/actions';
|
||||
|
||||
interface RouteParams {
|
||||
params: Promise<{ patientId: string }>;
|
||||
}
|
||||
|
||||
function extractHulpvraag(notes: string | null): string | null {
|
||||
if (!notes) return null;
|
||||
const firstSentence = notes.split(/[.!?]/)[0];
|
||||
return firstSentence.length > 150 ? `${firstSentence.slice(0, 150)}...` : firstSentence;
|
||||
}
|
||||
|
||||
export async function GET(_request: NextRequest, { params }: RouteParams) {
|
||||
try {
|
||||
const { patientId } = await params;
|
||||
@@ -38,26 +31,15 @@ export async function GET(_request: NextRequest, { params }: RouteParams) {
|
||||
return NextResponse.json({ error: 'Patiënt niet gevonden' }, { status: 404 });
|
||||
}
|
||||
|
||||
const [intakes, encounters, carePlan] = await Promise.all([
|
||||
const [intakes, encounters] = await Promise.all([
|
||||
getIntakesByPatientId(patientId).catch(() => []),
|
||||
getPatientEncounters(patientId).catch(() => []),
|
||||
getActiveCarePlan(patientId).catch(() => null),
|
||||
]);
|
||||
|
||||
let hulpvraag: string | null = null;
|
||||
if (carePlan?.based_on_intake_id) {
|
||||
const linkedIntake = intakes.find((intake) => intake.id === carePlan.based_on_intake_id);
|
||||
if (linkedIntake?.notes) {
|
||||
hulpvraag = extractHulpvraag(linkedIntake.notes);
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
patient,
|
||||
intakes,
|
||||
encounters,
|
||||
carePlan,
|
||||
hulpvraag,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Unexpected error in GET /api/patients/[patientId]/dashboard:', error);
|
||||
|
||||
Reference in New Issue
Block a user