mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
fix: appointment clinic relation — save clinicId, query clinic.clinicName for branch column
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -297,6 +297,7 @@ export const AppointmentForm = ({
|
|||||||
doctorId: doctor,
|
doctorId: doctor,
|
||||||
reasonForVisit: chiefComplaint || null,
|
reasonForVisit: chiefComplaint || null,
|
||||||
...(resolvedPatientId ? { patientId: resolvedPatientId } : {}),
|
...(resolvedPatientId ? { patientId: resolvedPatientId } : {}),
|
||||||
|
...(clinic ? { clinicId: clinic } : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,8 +27,11 @@ type AppointmentRecord = {
|
|||||||
fullName: { firstName: string; lastName: string } | null;
|
fullName: { firstName: string; lastName: string } | null;
|
||||||
phones: { primaryPhoneNumber: string } | null;
|
phones: { primaryPhoneNumber: string } | null;
|
||||||
} | null;
|
} | null;
|
||||||
|
clinic: {
|
||||||
|
clinicName: string;
|
||||||
|
} | null;
|
||||||
doctor: {
|
doctor: {
|
||||||
clinic: { clinicName: string } | null;
|
id: string;
|
||||||
} | null;
|
} | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -58,7 +61,8 @@ const QUERY = `{ appointments(first: 100, orderBy: [{ scheduledAt: DescNullsLast
|
|||||||
id scheduledAt durationMin appointmentType status
|
id scheduledAt durationMin appointmentType status
|
||||||
doctorName department reasonForVisit
|
doctorName department reasonForVisit
|
||||||
patient { id fullName { firstName lastName } phones { primaryPhoneNumber } }
|
patient { id fullName { firstName lastName } phones { primaryPhoneNumber } }
|
||||||
doctor { id clinic { clinicName } }
|
clinic { clinicName }
|
||||||
|
doctor { id }
|
||||||
} } } }`;
|
} } } }`;
|
||||||
|
|
||||||
const formatDate = (iso: string): string => formatDateOnly(iso);
|
const formatDate = (iso: string): string => formatDateOnly(iso);
|
||||||
@@ -103,7 +107,7 @@ export const AppointmentsPage = () => {
|
|||||||
const phone = a.patient?.phones?.primaryPhoneNumber ?? '';
|
const phone = a.patient?.phones?.primaryPhoneNumber ?? '';
|
||||||
const doctor = (a.doctorName ?? '').toLowerCase();
|
const doctor = (a.doctorName ?? '').toLowerCase();
|
||||||
const dept = (a.department ?? '').toLowerCase();
|
const dept = (a.department ?? '').toLowerCase();
|
||||||
const branch = (a.doctor?.clinic?.clinicName ?? '').toLowerCase();
|
const branch = (a.clinic?.clinicName ?? '').toLowerCase();
|
||||||
return patientName.includes(q) || phone.includes(q) || doctor.includes(q) || dept.includes(q) || branch.includes(q);
|
return patientName.includes(q) || phone.includes(q) || doctor.includes(q) || dept.includes(q) || branch.includes(q);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -177,7 +181,7 @@ export const AppointmentsPage = () => {
|
|||||||
? `${appt.patient.fullName?.firstName ?? ''} ${appt.patient.fullName?.lastName ?? ''}`.trim() || 'Unknown'
|
? `${appt.patient.fullName?.firstName ?? ''} ${appt.patient.fullName?.lastName ?? ''}`.trim() || 'Unknown'
|
||||||
: 'Unknown';
|
: 'Unknown';
|
||||||
const phone = appt.patient?.phones?.primaryPhoneNumber ?? '';
|
const phone = appt.patient?.phones?.primaryPhoneNumber ?? '';
|
||||||
const branch = appt.doctor?.clinic?.clinicName ?? '—';
|
const branch = appt.clinic?.clinicName ?? '—';
|
||||||
const statusLabel = STATUS_LABELS[appt.status ?? ''] ?? appt.status ?? '—';
|
const statusLabel = STATUS_LABELS[appt.status ?? ''] ?? appt.status ?? '—';
|
||||||
const statusColor = STATUS_COLORS[appt.status ?? ''] ?? 'gray';
|
const statusColor = STATUS_COLORS[appt.status ?? ''] ?? 'gray';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user