finshed
This commit is contained in:
parent
3b15c593e2
commit
eee9bcd23d
@ -32,6 +32,7 @@ public class MedicalPracticeController implements ChangeObserver<WaitingRoom> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(WaitingRoom subject) {
|
public void update(WaitingRoom subject) {
|
||||||
|
|
||||||
waitingRoomTextField.setText(waitingRoom.getPatients().stream()
|
waitingRoomTextField.setText(waitingRoom.getPatients().stream()
|
||||||
.reduce("", (s, p) -> s + p + "\n", String::concat));
|
.reduce("", (s, p) -> s + p + "\n", String::concat));
|
||||||
preparation.setText(waitingRoom.getPatientInPreparation() == null ? "" : waitingRoom.getPatientInPreparation().toString());
|
preparation.setText(waitingRoom.getPatientInPreparation() == null ? "" : waitingRoom.getPatientInPreparation().toString());
|
||||||
|
|||||||
@ -52,6 +52,12 @@ public class WaitingRoom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addPatient(String name, LocalDateTime appointment, boolean isEmergency) {
|
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);
|
Patient patient = new Patient(name, appointment, isEmergency);
|
||||||
patients.add(patient);
|
patients.add(patient);
|
||||||
patientService.AddPatient(patient);
|
patientService.AddPatient(patient);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class PatientService extends DatabaseUtilsBase implements TableCreation {
|
|||||||
String createTableSmt = "CREATE TABLE Patient (\n" +
|
String createTableSmt = "CREATE TABLE Patient (\n" +
|
||||||
" name VARCHAR(255) NOT NULL PRIMARY KEY,\n" +
|
" name VARCHAR(255) NOT NULL PRIMARY KEY,\n" +
|
||||||
" appointment TIMESTAMP,\n" +
|
" appointment TIMESTAMP,\n" +
|
||||||
" isEmergency BOOLEAN\n" +
|
" isEmergency BOOLEAN NOT NULL\n" +
|
||||||
")";
|
")";
|
||||||
connection.createStatement().executeQuery(createTableSmt);
|
connection.createStatement().executeQuery(createTableSmt);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user