mirror of
https://github.com/temetro/temetro.git
synced 2026-08-28 11:27:40 +00:00
feat: per-patient record history + summary PDF export
Add GET /api/activity/patient/:fileNumber (every audited change on one chart, newest first, readable by any clinic member) and surface it as a Record history timeline in the patient detail sheet. Add a Download summary action that builds a clean, printable one-page clinical summary in the browser (Save as PDF) — no PDF dependency, nothing leaves the server. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,28 @@ export async function recordActivity(params: {
|
||||
}
|
||||
}
|
||||
|
||||
// Lists every audit entry tied to a single patient (by file number), newest
|
||||
// first. Unlike the clinic feed this is NOT scoped to one actor: a patient's
|
||||
// record history should show every clinician who added or changed data on it.
|
||||
export async function listPatientActivity(
|
||||
orgId: string,
|
||||
fileNumber: string,
|
||||
limit = 100,
|
||||
): Promise<ActivityEntry[]> {
|
||||
const rows = await db
|
||||
.select()
|
||||
.from(activityLog)
|
||||
.where(
|
||||
and(
|
||||
eq(activityLog.organizationId, orgId),
|
||||
eq(activityLog.patientFileNumber, fileNumber),
|
||||
),
|
||||
)
|
||||
.orderBy(desc(activityLog.createdAt))
|
||||
.limit(limit);
|
||||
return rows.map(toEntry);
|
||||
}
|
||||
|
||||
// Lists the clinic's audit feed. When `actorId` is given, only that user's own
|
||||
// actions are returned (each employee sees their own activity); admins/owners
|
||||
// call without it to see the whole clinic.
|
||||
|
||||
Reference in New Issue
Block a user