From ad1618efec261ac78e6c5c5de527c1a94402348e Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 25 Feb 2026 07:12:24 +0700 Subject: [PATCH] Refactor patients and visits modules - Extract patient utilities to src/lib/utils/patients.js - Split patient page into modular components - Create dedicated visits page and route - Move visit-related modals to visits directory - Add Sidebar navigation for visits --- src/lib/components/Sidebar.svelte | 1 + src/lib/utils/patients.js | 149 ++++ src/routes/(app)/patients/+page.svelte | 695 +++++++----------- src/routes/(app)/patients/OrderCard.svelte | 106 +++ src/routes/(app)/patients/OrderList.svelte | 120 +++ src/routes/(app)/patients/PatientList.svelte | 142 ++++ .../(app)/patients/PatientSearchBar.svelte | 122 +++ src/routes/(app)/visits/+page.svelte | 364 +++++++++ .../VisitADTHistoryModal.svelte | 9 +- src/routes/(app)/visits/VisitCard.svelte | 149 ++++ .../VisitFormModal.svelte | 3 +- src/routes/(app)/visits/VisitList.svelte | 165 +++++ src/routes/(app)/visits/VisitSearchBar.svelte | 130 ++++ 13 files changed, 1699 insertions(+), 456 deletions(-) create mode 100644 src/lib/utils/patients.js create mode 100644 src/routes/(app)/patients/OrderCard.svelte create mode 100644 src/routes/(app)/patients/OrderList.svelte create mode 100644 src/routes/(app)/patients/PatientList.svelte create mode 100644 src/routes/(app)/patients/PatientSearchBar.svelte create mode 100644 src/routes/(app)/visits/+page.svelte rename src/routes/(app)/{patients => visits}/VisitADTHistoryModal.svelte (95%) create mode 100644 src/routes/(app)/visits/VisitCard.svelte rename src/routes/(app)/{patients => visits}/VisitFormModal.svelte (98%) create mode 100644 src/routes/(app)/visits/VisitList.svelte create mode 100644 src/routes/(app)/visits/VisitSearchBar.svelte diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte index b9f4e4c..f9a8c12 100644 --- a/src/lib/components/Sidebar.svelte +++ b/src/lib/components/Sidebar.svelte @@ -180,6 +180,7 @@ function toggleLaboratory() { {#if isOpen && laboratoryExpanded}
Manage patient records and visits
+Search patients and manage lab orders
Patient ID: {selectedPatient.PatientID}
-No visits found
-This patient has no visit records.
-{visit.DiagCode || visit.Diagnosis || '-'}
-Select a patient
-Click on a patient to view their visits
-Are you sure you want to delete patient {patientToDelete?.PatientID}?
++ Delete patient + {deleteModal.patient?.PatientID}? +
This action cannot be undone.
Are you sure you want to delete this visit?
-Visit ID: {visitToDelete?.PVID || visitToDelete?.InternalPVID}
-This action cannot be undone.
-Discharge patient {selectedPatient ? [selectedPatient.Prefix, selectedPatient.NameFirst, selectedPatient.NameMiddle, selectedPatient.NameLast].filter(Boolean).join(' ') : ''}
-Visit ID: {visitToDischarge?.PVID || visitToDischarge?.InternalPVID}
- -This will set the visit End Date and create an A03 (Discharge) ADT record.
-ID: {patient.PatientID}
+No orders found
+This patient has no lab orders.
+Select a patient
+Click "Show Orders" on a patient to view lab orders
+Enter search criteria above
+to find patients
+Manage patient visits, admissions, and transfers
+Discharge visit {dischargeModal.visit?.PVID}?
+ +This will set the visit End Date and create an A03 ADT record.
+Delete visit {deleteModal.visit?.PVID}?
+This action cannot be undone.
+{visit.Diagnosis}
+ {/if} +No visits found
+Use search criteria to find visits
+