Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/main/java/org/codedifferently/LanAppointment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.codedifferently;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class LanAppointment {

private String patientID;
private LocalDateTime time;
private boolean isCompleted;
//private LocalDate date;

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; }

public String toString() {
return "PatientID: " + patientID +
" | Time: " + time +
" | Completed: " + isCompleted;
}
}
104 changes: 104 additions & 0 deletions src/main/java/org/codedifferently/LanClinicApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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 Complete Appointment");
System.out.println("10 Exit");


System.out.println("Please Select a choice: ");
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":
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;

case "10":
running = false;
break;
}
}

sc.close();
}
}
Loading