feat(check-all-eligibility) - specific aptmnt status added
This commit is contained in:
@@ -647,9 +647,23 @@ router.post(
|
||||
// Update patient status based on seleniumResult.eligibility
|
||||
const newStatus =
|
||||
seleniumResult?.eligibility === "Y" ? "ACTIVE" : "INACTIVE";
|
||||
|
||||
// 1. updating patient
|
||||
await storage.updatePatient(updatedPatient.id, { status: newStatus });
|
||||
resultItem.patientUpdateStatus = `Patient status updated to ${newStatus}`;
|
||||
|
||||
// 2. updating appointment status - for aptmnt page
|
||||
try {
|
||||
await storage.updateAppointment(Number(apt.id), {
|
||||
eligibilityStatus: newStatus,
|
||||
});
|
||||
resultItem.appointmentUpdateStatus = `Appointment eligibility set to ${newStatus}`;
|
||||
} catch (apptUpdateErr: any) {
|
||||
resultItem.warning =
|
||||
(resultItem.warning ? resultItem.warning + " | " : "") +
|
||||
`Failed to update appointment eligibility: ${apptUpdateErr?.message ?? String(apptUpdateErr)}`;
|
||||
}
|
||||
|
||||
// If PDF exists, upload to PdfGroup (ELIGIBILITY_STATUS)
|
||||
if (
|
||||
seleniumResult?.pdf_path &&
|
||||
|
||||
@@ -71,7 +71,7 @@ interface ScheduledAppointment {
|
||||
id?: number;
|
||||
patientId: number;
|
||||
patientName: string;
|
||||
patientStatus: PatientStatus;
|
||||
eligibilityStatus: PatientStatus;
|
||||
staffId: number;
|
||||
date: string | Date;
|
||||
startTime: string | Date;
|
||||
@@ -403,10 +403,12 @@ export default function AppointmentsPage() {
|
||||
).map((apt) => {
|
||||
// Find patient name
|
||||
const patient = patientsFromDay.find((p) => p.id === apt.patientId);
|
||||
|
||||
const patientName = patient
|
||||
? `${patient.firstName} ${patient.lastName}`
|
||||
: "Unknown Patient";
|
||||
const patientStatus = patient?.status;
|
||||
|
||||
const eligibilityStatus = (apt as any).eligibilityStatus as PatientStatus;
|
||||
|
||||
const staffId = Number(apt.staffId ?? 1);
|
||||
|
||||
@@ -422,7 +424,7 @@ export default function AppointmentsPage() {
|
||||
const processed = {
|
||||
...apt,
|
||||
patientName,
|
||||
patientStatus,
|
||||
eligibilityStatus,
|
||||
staffId,
|
||||
status: apt.status ?? null,
|
||||
date: formatLocalDate(apt.date),
|
||||
@@ -621,7 +623,7 @@ export default function AppointmentsPage() {
|
||||
onContextMenu={(e) => handleContextMenu(e, appointment.id ?? 0)}
|
||||
>
|
||||
<PatientStatusBadge
|
||||
status={appointment.patientStatus ?? "UNKNOWN"}
|
||||
status={appointment.eligibilityStatus ?? "UNKNOWN"}
|
||||
className="pointer-events-auto" // ensure tooltip works
|
||||
size={30} // bump size up from 10 → 14
|
||||
/>
|
||||
|
||||
@@ -85,6 +85,8 @@ model Appointment {
|
||||
status String @default("scheduled") // "scheduled", "completed", "cancelled", "no-show"
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
eligibilityStatus PatientStatus @default(UNKNOWN)
|
||||
|
||||
patient Patient @relation(fields: [patientId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
staff Staff? @relation(fields: [staffId], references: [id])
|
||||
|
||||
Reference in New Issue
Block a user