From 750aff65f973f2451ad9a9caf3c545893b97b5d4 Mon Sep 17 00:00:00 2001 From: michaelmoss Date: Thu, 19 Feb 2026 15:47:31 -0500 Subject: [PATCH 01/12] ibitial patient class --- .../org/codedifferently/MichaelPatient.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/main/java/org/codedifferently/MichaelPatient.java diff --git a/src/main/java/org/codedifferently/MichaelPatient.java b/src/main/java/org/codedifferently/MichaelPatient.java new file mode 100644 index 0000000..5e0d85b --- /dev/null +++ b/src/main/java/org/codedifferently/MichaelPatient.java @@ -0,0 +1,27 @@ +package org.codedifferently; + +public class MichaelPatient { + + private String name; + private String ID; + private boolean isCheckedIn; + + MichaelPatient(String Name, String ID, boolean isCheckedIn) { + this.name=Name; + this.ID=ID; + this.isCheckedIn=false; + + + } + + public void setName(String name) { + this.name=name; + + } + + public void setID(String ID) { + this.ID=ID; + + } + +} From 62855f9c836b4b33948ef127950f1620e3a655b0 Mon Sep 17 00:00:00 2001 From: michaelmoss Date: Thu, 19 Feb 2026 16:01:27 -0500 Subject: [PATCH 02/12] initial patient --- src/main/java/org/codedifferently/MichaelPatient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/MichaelPatient.java b/src/main/java/org/codedifferently/MichaelPatient.java index 5e0d85b..3d26b1a 100644 --- a/src/main/java/org/codedifferently/MichaelPatient.java +++ b/src/main/java/org/codedifferently/MichaelPatient.java @@ -23,5 +23,5 @@ public void setID(String ID) { this.ID=ID; } - +// } From ad99b0a46ddd86832703b2471ae3109791534ab8 Mon Sep 17 00:00:00 2001 From: michaelmoss Date: Thu, 19 Feb 2026 16:02:32 -0500 Subject: [PATCH 03/12] initial commit --- src/main/java/org/codedifferently/MichaelPatient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/codedifferently/MichaelPatient.java b/src/main/java/org/codedifferently/MichaelPatient.java index 3d26b1a..de0556c 100644 --- a/src/main/java/org/codedifferently/MichaelPatient.java +++ b/src/main/java/org/codedifferently/MichaelPatient.java @@ -24,4 +24,5 @@ public void setID(String ID) { } // + // } From f089c45921d65f316ca00b335b54df99d50de247 Mon Sep 17 00:00:00 2001 From: atrunz Date: Thu, 19 Feb 2026 16:13:31 -0500 Subject: [PATCH 04/12] demo --- src/main/java/org/codedifferently/MichaelPatient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/MichaelPatient.java b/src/main/java/org/codedifferently/MichaelPatient.java index de0556c..75775dc 100644 --- a/src/main/java/org/codedifferently/MichaelPatient.java +++ b/src/main/java/org/codedifferently/MichaelPatient.java @@ -11,7 +11,7 @@ public class MichaelPatient { this.ID=ID; this.isCheckedIn=false; - +// } public void setName(String name) { From 5d443d1dd28363ae95074737f1c2b8f90fe710fe Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 00:00:09 -0500 Subject: [PATCH 05/12] adding lan patient code --- .../org/codedifferently/LanAppointment.java | 0 .../java/org/codedifferently/LanPatient.java | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/org/codedifferently/LanAppointment.java create mode 100644 src/main/java/org/codedifferently/LanPatient.java diff --git a/src/main/java/org/codedifferently/LanAppointment.java b/src/main/java/org/codedifferently/LanAppointment.java new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/org/codedifferently/LanPatient.java b/src/main/java/org/codedifferently/LanPatient.java new file mode 100644 index 0000000..f37f0cd --- /dev/null +++ b/src/main/java/org/codedifferently/LanPatient.java @@ -0,0 +1,33 @@ +package org.codedifferently; + +import java.util.UUID; + +public class LanPatient { + + private String name; + private String ID; + private boolean isCheckedIn; + + public LanPatient(String name) { + this.name = name; + this.ID = generateID(name); + this.isCheckedIn = false; + } + + private String generateID(String name) { + return name.substring(0,1).toUpperCase() + + UUID.randomUUID().toString().substring(0,5); + } + + public String getName() { return name; } + public String getID() { return ID; } + public boolean isCheckedIn() { return isCheckedIn; } + + public void checkIn() { isCheckedIn = true; } + public void checkOut() { isCheckedIn = false; } + + public String toString() { + return "ID: " + ID + " | Name: " + name + + " | Checked In: " + isCheckedIn; + } +} \ No newline at end of file From 41bb3c3be1bb96a095a78f15de95b69ce328661f Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 00:00:22 -0500 Subject: [PATCH 06/12] adding lan appointment code --- .../org/codedifferently/LanAppointment.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/main/java/org/codedifferently/LanAppointment.java b/src/main/java/org/codedifferently/LanAppointment.java index e69de29..72c0eb4 100644 --- a/src/main/java/org/codedifferently/LanAppointment.java +++ b/src/main/java/org/codedifferently/LanAppointment.java @@ -0,0 +1,28 @@ +package org.codedifferently; + +import java.time.LocalDateTime; + +public class LanAppointment { + + private String patientID; + private LocalDateTime time; + private boolean isCompleted; + + public LanAppointment(String patientID, LocalDateTime time) { + this.patientID = patientID; + this.time = time; + this.isCompleted = false; + } + + public String getPatientID() { return patientID; } + public LocalDateTime getTime() { return time; } + public boolean isCompleted() { return isCompleted; } + + public void complete() { isCompleted = true; } + + public String toString() { + return "PatientID: " + patientID + + " | Time: " + time + + " | Completed: " + isCompleted; + } +} From 6ea212421a8732014802cf8ee269457d33562edb Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 00:03:48 -0500 Subject: [PATCH 07/12] lan clinic code --- .../org/codedifferently/LanClinicSystem.java | 270 ++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 src/main/java/org/codedifferently/LanClinicSystem.java diff --git a/src/main/java/org/codedifferently/LanClinicSystem.java b/src/main/java/org/codedifferently/LanClinicSystem.java new file mode 100644 index 0000000..655ead2 --- /dev/null +++ b/src/main/java/org/codedifferently/LanClinicSystem.java @@ -0,0 +1,270 @@ +package org.codedifferently; + +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.util.*; + +public class LanClinicSystem { + + private ArrayList patients; + private ArrayList appointments; + private HashMap> waitlistMap; + + public LanClinicSystem() { + patients = new ArrayList<>(); + appointments = new ArrayList<>(); + waitlistMap = new HashMap<>(); + } + + // ---------------- PATIENT ---------------- + + public void addPatient(String name) { + LanPatient p = new LanPatient(name); + patients.add(p); + System.out.println("Patient added. ID: " + p.getID()); + } + + public void viewAllPatients() { + if (patients.isEmpty()) { + System.out.println("No patients."); + return; + } + for (LanPatient p : patients) { + System.out.println(p); + } + } + + public LanPatient searchPatient(String input) { + for (LanPatient p : patients) { + if (p.getID().equalsIgnoreCase(input) + || p.getName().equalsIgnoreCase(input)) { + return p; + } + } + return null; + } + + public void checkInPatient(String input) { + LanPatient p = searchPatient(input); + if (p == null) { + System.out.println("Patient not found."); + return; + } + + if (p.isCheckedIn()) { + System.out.println("Already checked in."); + } else { + p.checkIn(); + System.out.println("Checked in."); + } + } + + // ---------------- VALIDATION ---------------- + + private boolean isSlotAvailable(LocalDateTime time) { + for (LanAppointment a : appointments) { + if (a.getTime().equals(time)) return false; + } + return true; + } + + private boolean hasAppointmentSameDay(String patientID, LocalDate date) { + for (LanAppointment a : appointments) { + if (a.getPatientID().equals(patientID) + && a.getTime().toLocalDate().equals(date)) { + return true; + } + } + return false; + } + + // ---------------- SCHEDULE ---------------- + + public void scheduleAppointment(String patientID) { + + Scanner sc = new Scanner(System.in); + DateTimeFormatter formatter = + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + + try { + + LocalDate today = LocalDate.now(); + LocalDate maxDate = today.plusDays(7); + + System.out.print("Enter date (yyyy-MM-dd): "); + LocalDate date = LocalDate.parse(sc.nextLine()); + + if (date.isBefore(today) || date.isAfter(maxDate)) { + System.out.println("Must be within 7 days."); + return; + } + + if (hasAppointmentSameDay(patientID, date)) { + System.out.println("Already has appointment that day."); + return; + } + + ArrayList slots = new ArrayList<>(); + LocalTime start = LocalTime.of(9, 0); + LocalTime end = LocalTime.of(17, 0); + + while (!start.isAfter(end.minusMinutes(30))) { + slots.add(LocalDateTime.of(date, start)); + start = start.plusMinutes(30); + } + + System.out.println("\n--- Time Slots ---"); + for (int i = 0; i < slots.size(); i++) { + LocalDateTime slot = slots.get(i); + + if (isSlotAvailable(slot)) { + System.out.println((i + 1) + ". " + slot.format(formatter) + " (Available)"); + } else { + System.out.println((i + 1) + ". " + slot.format(formatter) + " (Taken)"); + } + } + + System.out.print("Choose slot #: "); + int choice = Integer.parseInt(sc.nextLine()); + + if (choice < 1 || choice > slots.size()) return; + + LocalDateTime chosen = slots.get(choice - 1); + + if (isSlotAvailable(chosen)) { + + appointments.add(new LanAppointment(patientID, chosen)); + System.out.println("Appointment scheduled."); + + } else { + + System.out.print("Join waitlist? (Y/N): "); + String ans = sc.nextLine(); + + if (ans.equalsIgnoreCase("Y")) { + waitlistMap.putIfAbsent(chosen, new LinkedList<>()); + waitlistMap.get(chosen).add(patientID); + System.out.println("Added to waitlist."); + } + } + + } catch (Exception e) { + System.out.println("Invalid input."); + } + } + + // ---------------- CANCEL ---------------- + + public void cancelAppointment(String patientID) { + + Scanner sc = new Scanner(System.in); + DateTimeFormatter formatter = + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + + try { + + System.out.print("Enter date/time: "); + LocalDateTime time = + LocalDateTime.parse(sc.nextLine(), formatter); + + LanAppointment remove = null; + + for (LanAppointment a : appointments) { + if (a.getPatientID().equals(patientID) + && a.getTime().equals(time)) { + remove = a; + break; + } + } + + if (remove == null) { + System.out.println("Not found."); + return; + } + + appointments.remove(remove); + System.out.println("Cancelled."); + + // WAITLIST AUTO FILL + if (waitlistMap.containsKey(time)) { + + Queue queue = waitlistMap.get(time); + + if (!queue.isEmpty()) { + + String next = queue.poll(); + appointments.add(new LanAppointment(next, time)); + + System.out.println("Waitlist patient auto-booked."); + + if (queue.isEmpty()) { + waitlistMap.remove(time); + } + } + } + + } catch (Exception e) { + System.out.println("Invalid format."); + } + } + + // ---------------- COMPLETE ---------------- + + public void completeAppointment(String patientID, LocalDateTime time) { + + for (LanAppointment a : appointments) { + + if (a.getPatientID().equals(patientID) + && a.getTime().equals(time)) { + + LanPatient p = searchPatient(patientID); + + if (!p.isCheckedIn()) { + System.out.println("Patient must check in first."); + return; + } + + a.complete(); + p.checkOut(); + System.out.println("Appointment completed."); + return; + } + } + + System.out.println("Appointment not found."); + } + + // ---------------- VIEW ---------------- + + public void viewSchedule() { + + if (appointments.isEmpty()) { + System.out.println("No appointments."); + return; + } + + appointments.sort(Comparator.comparing(LanAppointment::getTime)); + + for (LanAppointment a : appointments) { + System.out.println(a); + } + } + + public void dailySummary() { + + LocalDate today = LocalDate.now(); + + int total = 0; + int completed = 0; + + for (LanAppointment a : appointments) { + if (a.getTime().toLocalDate().equals(today)) { + total++; + if (a.isCompleted()) completed++; + } + } + + System.out.println("Appointments Today: " + total); + System.out.println("Completed Today: " + completed); + } +} \ No newline at end of file From ad68037994e6c46194d216297558221f7303c5b9 Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 00:04:44 -0500 Subject: [PATCH 08/12] Lan Clinic code --- .../org/codedifferently/LanClinicApp.java | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/main/java/org/codedifferently/LanClinicApp.java diff --git a/src/main/java/org/codedifferently/LanClinicApp.java b/src/main/java/org/codedifferently/LanClinicApp.java new file mode 100644 index 0000000..dcff235 --- /dev/null +++ b/src/main/java/org/codedifferently/LanClinicApp.java @@ -0,0 +1,105 @@ +package org.codedifferently; + +import java.util.Scanner; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class LanClinicApp { + + public static void main(String[] args) { + + LanClinicSystem clinic = new LanClinicSystem(); + Scanner sc = new Scanner(System.in); + + DateTimeFormatter formatter = + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + + boolean running = true; + + while (running) { + + System.out.println("\n=== CLINIC MENU ==="); + System.out.println("1 Add Patient"); + System.out.println("2 View Patients"); + System.out.println("3 Check In Patient"); + System.out.println("4 Search Patient"); + System.out.println("5 Schedule Appointment"); + System.out.println("6 Cancel Appointment"); + System.out.println("7 View Schedule"); + System.out.println("8 Daily Report"); + System.out.println("9 Exit"); + System.out.println("10 Complete Appointment"); + + + System.out.print("Choice: "); + System.out.println("===========================================1"); + String choice = sc.nextLine(); + + switch(choice) { + + case "1": + System.out.print("Name: "); + clinic.addPatient(sc.nextLine()); + break; + + case "2": + clinic.viewAllPatients(); + break; + + case "3": + System.out.print("ID or Name: "); + clinic.checkInPatient(sc.nextLine()); + break; + + case "4": + System.out.println("================================"); + System.out.print("ID or Name: "); + System.out.println(clinic.searchPatient(sc.nextLine())); + break; + + case "5": + System.out.println("================================"); + System.out.print("Patient ID: "); + clinic.scheduleAppointment(sc.nextLine()); + break; + + case "6": + System.out.println("================================="); + System.out.print("Patient ID: "); + clinic.cancelAppointment(sc.nextLine()); + break; + + case "7": + clinic.viewSchedule(); + break; + + case "8": + clinic.dailySummary(); + break; + + case "9": + running = false; + break; + + case "10": + try { + System.out.println("============================="); + System.out.print("Patient ID: "); + String id = sc.nextLine(); + + System.out.print("DateTime yyyy-MM-dd HH:mm: "); + LocalDateTime time = + LocalDateTime.parse(sc.nextLine(), formatter); + + clinic.completeAppointment(id, time); + + } catch(Exception e) { + System.out.println("Invalid format."); + } + break; + } + } + + sc.close(); + } +} From e2e7e5d68c33463582707e48a87b80756f7b8b4a Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 00:07:54 -0500 Subject: [PATCH 09/12] fixed print statement --- src/main/java/org/codedifferently/LanClinicApp.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/codedifferently/LanClinicApp.java b/src/main/java/org/codedifferently/LanClinicApp.java index dcff235..8450309 100644 --- a/src/main/java/org/codedifferently/LanClinicApp.java +++ b/src/main/java/org/codedifferently/LanClinicApp.java @@ -31,8 +31,7 @@ public static void main(String[] args) { System.out.println("10 Complete Appointment"); - System.out.print("Choice: "); - System.out.println("===========================================1"); + System.out.println("Please Select a choice: "); String choice = sc.nextLine(); switch(choice) { From 4ca33155489817a20def4cf79ec5a51fb857b7dc Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 02:56:35 -0500 Subject: [PATCH 10/12] modifying date functionality --- src/main/java/org/codedifferently/LanAppointment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/codedifferently/LanAppointment.java b/src/main/java/org/codedifferently/LanAppointment.java index 72c0eb4..c7308fa 100644 --- a/src/main/java/org/codedifferently/LanAppointment.java +++ b/src/main/java/org/codedifferently/LanAppointment.java @@ -1,5 +1,6 @@ package org.codedifferently; +import java.time.LocalDate; import java.time.LocalDateTime; public class LanAppointment { @@ -7,15 +8,18 @@ public class LanAppointment { private String patientID; private LocalDateTime time; private boolean isCompleted; + private LocalDate date; - public LanAppointment(String patientID, LocalDateTime time) { + public LanAppointment(String patientID, LocalDateTime time, LocalDate date) { this.patientID = patientID; this.time = time; + this.date = date; this.isCompleted = false; } public String getPatientID() { return patientID; } public LocalDateTime getTime() { return time; } + public LocalDate getDate() { return date;} public boolean isCompleted() { return isCompleted; } public void complete() { isCompleted = true; } From a0582c295868c07f5a553849ef4a42c85d26387a Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 02:58:08 -0500 Subject: [PATCH 11/12] commenting out temporarily --- src/main/java/org/codedifferently/LanAppointment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/codedifferently/LanAppointment.java b/src/main/java/org/codedifferently/LanAppointment.java index c7308fa..5a100a4 100644 --- a/src/main/java/org/codedifferently/LanAppointment.java +++ b/src/main/java/org/codedifferently/LanAppointment.java @@ -8,18 +8,18 @@ public class LanAppointment { private String patientID; private LocalDateTime time; private boolean isCompleted; - private LocalDate date; + //private LocalDate date; - public LanAppointment(String patientID, LocalDateTime time, LocalDate date) { + public LanAppointment(String patientID, LocalDateTime time/*, LocalDate date*/) { this.patientID = patientID; this.time = time; - this.date = date; + //this.date = date; this.isCompleted = false; } public String getPatientID() { return patientID; } public LocalDateTime getTime() { return time; } - public LocalDate getDate() { return date;} + // public LocalDate getDate() { return date;} public boolean isCompleted() { return isCompleted; } public void complete() { isCompleted = true; } From 0d43c743eb0fd505b5e86bccd1e70768d0a61dcb Mon Sep 17 00:00:00 2001 From: atrunz Date: Mon, 23 Feb 2026 03:10:09 -0500 Subject: [PATCH 12/12] improved UI by making print preceeding input more desciptive --- src/main/java/org/codedifferently/LanClinicApp.java | 12 ++++++------ .../java/org/codedifferently/LanClinicSystem.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/codedifferently/LanClinicApp.java b/src/main/java/org/codedifferently/LanClinicApp.java index 8450309..0687568 100644 --- a/src/main/java/org/codedifferently/LanClinicApp.java +++ b/src/main/java/org/codedifferently/LanClinicApp.java @@ -27,8 +27,8 @@ public static void main(String[] args) { System.out.println("6 Cancel Appointment"); System.out.println("7 View Schedule"); System.out.println("8 Daily Report"); - System.out.println("9 Exit"); - System.out.println("10 Complete Appointment"); + System.out.println("9 Complete Appointment"); + System.out.println("10 Exit"); System.out.println("Please Select a choice: "); @@ -77,10 +77,6 @@ public static void main(String[] args) { break; case "9": - running = false; - break; - - case "10": try { System.out.println("============================="); System.out.print("Patient ID: "); @@ -96,6 +92,10 @@ public static void main(String[] args) { System.out.println("Invalid format."); } break; + + case "10": + running = false; + break; } } diff --git a/src/main/java/org/codedifferently/LanClinicSystem.java b/src/main/java/org/codedifferently/LanClinicSystem.java index 655ead2..7e5b832 100644 --- a/src/main/java/org/codedifferently/LanClinicSystem.java +++ b/src/main/java/org/codedifferently/LanClinicSystem.java @@ -163,7 +163,7 @@ public void cancelAppointment(String patientID) { try { - System.out.print("Enter date/time: "); + System.out.print("Enter date/time (yyyy-MM-dd HH:mm): "); LocalDateTime time = LocalDateTime.parse(sc.nextLine(), formatter);