fix(doctor-report): name a managed record by its display name

The report cover, the PDF author field, the FHIR Patient and the share
page printed `fullName ?? username`, and the collector never read the
display name. A managed record has no way to get a full name, so its
generated `managed-<hex>` login landed on every clinical document made
for it; an own account printed the login instead of its display name.

The collector now resolves the name once (`patientName()`: full name,
display name, login, never a managed record's generated handle) and the
five readers print that one field. `patient.username` and
`patient.fullName` leave the report payload; nothing else read them.
This commit is contained in:
Marc-André Bombeck committed 2026-11-11 19:42:17 +01:00
1 parent aae029d94e
commit 5cf4a7d213
30 files changed
+169 -77

No files matched your search

@@ -42,11 +42,10 @@ const FULL_RECORD = {
end: "2026-01-31T00:00:00.000Z",
},
patient: {
username: "shared-account",
name: "A. Patient",
dateOfBirth: "1980-01-01T00:00:00.000Z",
gender: "FEMALE",
heightCm: 170,
fullName: "A. Patient",
},
practiceName: null,
measurements: {},
@@ -27,7 +27,7 @@ function makeReport(
end: "2026-01-31T00:00:00.000Z",
},
patient: {
username: "tester",
name: "tester",
dateOfBirth: null,
gender: null,
heightCm: null,
@@ -56,7 +56,7 @@ export function PatientIdentitySection({
fmtDate: (iso: string) => string;
}) {
const patient = report.patient;
const name = patient.fullName ?? patient.username ?? null;
const name = patient.name;
const genderKey = patient.gender
? GENDER_LABEL_KEYS[patient.gender]
: undefined;