diff --git a/db/nursingHome.db b/db/nursingHome.db index 73842f5..beb720f 100644 Binary files a/db/nursingHome.db and b/db/nursingHome.db differ diff --git a/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java index c993dcb..3594afd 100644 --- a/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/LockedTreatmentController.java @@ -22,6 +22,7 @@ import java.time.LocalDate; /** * Controller for all locked treatments. + * * @author Armin Ribic * @author Dorian Nemec */ @@ -49,7 +50,7 @@ public class LockedTreatmentController { * This method allows initializing a {@link LockedNurseController} object * that is called after the binding of all the fields. */ - public void initialize(){ + public void initialize() { this.readAllAndShowInTableView(); this.columnId.setCellValueFactory(new PropertyValueFactory<>("id")); @@ -67,8 +68,8 @@ public class LockedTreatmentController { return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName()); } ); - this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty("coming soon") - ); + this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty(DateConverter.convertLocalDateToString(cellData.getValue().calculateDeleteDate()))); + this.tableView.setItems(this.treatments); } @@ -85,8 +86,7 @@ public class LockedTreatmentController { } @FXML - private void unlockTreatment() - { + private void unlockTreatment() { Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem(); if (selectedItem == null) { return; diff --git a/src/main/java/de/hitec/nhplus/treatment/Treatment.java b/src/main/java/de/hitec/nhplus/treatment/Treatment.java index 949df4f..d78364b 100644 --- a/src/main/java/de/hitec/nhplus/treatment/Treatment.java +++ b/src/main/java/de/hitec/nhplus/treatment/Treatment.java @@ -1,5 +1,6 @@ package de.hitec.nhplus.treatment; +import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.nurse.Nurse; import de.hitec.nhplus.patient.Patient; import de.hitec.nhplus.utils.DateConverter; @@ -10,6 +11,7 @@ import javafx.beans.property.SimpleStringProperty; import java.time.LocalDate; import java.time.LocalTime; +import java.util.List; import java.util.StringJoiner; /** @@ -185,4 +187,9 @@ public class Treatment { .add("Remarks: " + this.getRemarks()) .toString(); } + + public LocalDate calculateDeleteDate() { + LocalDate delteDate = DateConverter.convertStringToLocalDate(getDate()).plusYears(10); + return delteDate; + } } diff --git a/src/main/java/de/hitec/nhplus/treatment/database/TreatmentDao.java b/src/main/java/de/hitec/nhplus/treatment/database/TreatmentDao.java index c5fb88c..20c63f0 100644 --- a/src/main/java/de/hitec/nhplus/treatment/database/TreatmentDao.java +++ b/src/main/java/de/hitec/nhplus/treatment/database/TreatmentDao.java @@ -11,6 +11,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @@ -151,4 +152,5 @@ public class TreatmentDao extends DaoImp { return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery()); } + }