This commit is contained in:
Jonas Hinterdorfer 2025-03-27 12:53:34 +01:00
parent 3b15c593e2
commit eee9bcd23d
3 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,7 @@ public class MedicalPracticeController implements ChangeObserver<WaitingRoom> {
@Override
public void update(WaitingRoom subject) {
waitingRoomTextField.setText(waitingRoom.getPatients().stream()
.reduce("", (s, p) -> s + p + "\n", String::concat));
preparation.setText(waitingRoom.getPatientInPreparation() == null ? "" : waitingRoom.getPatientInPreparation().toString());

View File

@ -52,6 +52,12 @@ public class WaitingRoom {
}
public void addPatient(String name, LocalDateTime appointment, boolean isEmergency) {
if((this.patientUndergoingTreatment != null && this.patientUndergoingTreatment.getName().equals(name)) ||
this.patients.stream().anyMatch(x -> x.getName().equals(name)))
{
return;
}
Patient patient = new Patient(name, appointment, isEmergency);
patients.add(patient);
patientService.AddPatient(patient);

View File

@ -16,7 +16,7 @@ public class PatientService extends DatabaseUtilsBase implements TableCreation {
String createTableSmt = "CREATE TABLE Patient (\n" +
" name VARCHAR(255) NOT NULL PRIMARY KEY,\n" +
" appointment TIMESTAMP,\n" +
" isEmergency BOOLEAN\n" +
" isEmergency BOOLEAN NOT NULL\n" +
")";
connection.createStatement().executeQuery(createTableSmt);
}