Compare commits

...

16 commits

Author SHA1 Message Date
Dorian Nemec
3c1445f430 #24 Implement logic
All checks were successful
Quality Check / Linting Check (push) Successful in 15s
Quality Check / Linting Check (pull_request) Successful in 20s
Quality Check / Javadoc Check (push) Successful in 35s
Quality Check / Javadoc Check (pull_request) Successful in 34s
2024-05-20 06:24:28 +00:00
Dorian Nemec
5dcd2dc2bd #24 Update UI 2024-05-20 06:24:28 +00:00
Dorian Nemec
bb63343c2f #24 Update model 2024-05-20 06:24:28 +00:00
700aba10b7 Merge pull request '#25: Bearbeiten von Pflegern' (#45) from story/pfleger-modul-pfleger-bearbeiten into main
All checks were successful
Quality Check / Linting Check (push) Successful in 18s
Javadoc Deploy / Javadoc (push) Successful in 31s
Quality Check / Javadoc Check (push) Successful in 30s
Reviewed-on: #45
Reviewed-by: SZUT-Ole <ole.kueck@hmmh.de>
2024-05-17 14:05:55 +00:00
47354a4bd9
#25: Implement Editing of Nurses
All checks were successful
Quality Check / Linting Check (push) Successful in 16s
Quality Check / Linting Check (pull_request) Successful in 21s
Quality Check / Javadoc Check (push) Successful in 35s
Quality Check / Javadoc Check (pull_request) Successful in 32s
2024-05-17 16:03:59 +02:00
e4793780fd Merge pull request '#26: Bugfix' (#44) from story/medikamente-modul-medikamente-bearbeiten into main
All checks were successful
Javadoc Deploy / Javadoc (push) Successful in 33s
Quality Check / Linting Check (push) Successful in 12s
Quality Check / Javadoc Check (push) Successful in 21s
Reviewed-on: #44
Reviewed-by: SZUT-Ole <ole.kueck@hmmh.de>
2024-05-17 13:53:14 +00:00
85b6b79d7f #26: Bugfix
All checks were successful
Quality Check / Linting Check (push) Successful in 19s
Quality Check / Linting Check (pull_request) Successful in 21s
Quality Check / Javadoc Check (push) Successful in 36s
Quality Check / Javadoc Check (pull_request) Successful in 34s
2024-05-17 13:51:56 +00:00
3f6625b270 Merge pull request '#26: Medikamente berabeiten' (#43) from story/medikamente-modul-medikamente-bearbeiten into main
All checks were successful
Quality Check / Linting Check (push) Successful in 18s
Javadoc Deploy / Javadoc (push) Successful in 33s
Quality Check / Javadoc Check (push) Successful in 30s
Reviewed-on: #43
Reviewed-by: SZUT-Ole <ole.kueck@hmmh.de>
2024-05-17 13:40:59 +00:00
8496f714d3
#26: Cleanup & Javadoc
All checks were successful
Quality Check / Linting Check (push) Successful in 16s
Quality Check / Linting Check (pull_request) Successful in 21s
Quality Check / Javadoc Check (push) Successful in 37s
Quality Check / Javadoc Check (pull_request) Successful in 33s
2024-05-17 15:35:03 +02:00
ad3bd8ba0a
#26: Implementing Editing of Medications
All checks were successful
Quality Check / Linting Check (push) Successful in 13s
Quality Check / Javadoc Check (push) Successful in 21s
Quality Check / Linting Check (pull_request) Successful in 12s
Quality Check / Javadoc Check (pull_request) Successful in 21s
2024-05-17 15:32:29 +02:00
1d419a6220 Merge pull request '#23 Medikamente Anlegen' (#40) from story/medikamente-modul-medikamente-anlegen into main
All checks were successful
Quality Check / Linting Check (push) Successful in 18s
Javadoc Deploy / Javadoc (push) Successful in 35s
Quality Check / Javadoc Check (push) Successful in 31s
Reviewed-on: #40
Reviewed-by: Dominik Säume <dominik.saeume@hmmh.de>
2024-05-17 12:34:27 +00:00
f3f266e2d8
#23: Javadoc
All checks were successful
Quality Check / Linting Check (push) Successful in 17s
Quality Check / Linting Check (pull_request) Successful in 21s
Quality Check / Javadoc Check (push) Successful in 35s
Quality Check / Javadoc Check (pull_request) Successful in 34s
2024-05-17 14:31:40 +02:00
c5237fed83
#23: Implementing Medication Modal with Validation 2024-05-17 14:28:12 +02:00
71fd693f37
#23: Creating Custom ListCell<T> for Ingredients 2024-05-17 14:27:47 +02:00
c7d60802ab
#23: Creating Medication Modal View 2024-05-17 14:27:31 +02:00
2d64beaece
#23: Fix Medicaiton DAO 2024-05-17 14:26:59 +02:00
25 changed files with 989 additions and 81 deletions

Binary file not shown.

View file

@ -67,7 +67,6 @@ public class MedicationFixture implements Fixture<Medication> {
Ingredient warfarinnatrium = new Ingredient("Warfarinnatrium");
medications.add(new Medication(
1,
"Metformin",
"AstraZeneca",
List.of(
@ -81,7 +80,6 @@ public class MedicationFixture implements Fixture<Medication> {
100
));
medications.add(new Medication(
2,
"Lisinopril",
"Teva Pharmaceuticals",
List.of(
@ -95,7 +93,6 @@ public class MedicationFixture implements Fixture<Medication> {
150
));
medications.add(new Medication(
3,
"Simvastatin",
"Mylan",
List.of(
@ -109,7 +106,6 @@ public class MedicationFixture implements Fixture<Medication> {
80
));
medications.add(new Medication(
4,
"Enoxaparin",
"Sanofi",
List.of(
@ -122,7 +118,6 @@ public class MedicationFixture implements Fixture<Medication> {
120
));
medications.add(new Medication(
5,
"Levothyroxin",
"Sandoz",
List.of(
@ -136,7 +131,6 @@ public class MedicationFixture implements Fixture<Medication> {
90
));
medications.add(new Medication(
6,
"Warfarin",
"Apotex Inc.",
List.of(

View file

@ -67,7 +67,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
"Gespräch",
"Der Patient hat enorme Angstgefühle und glaubt, er sei überfallen worden."
+ "Ihm seien alle Wertsachen gestohlen worden."
+ "Patient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind."
+ "Patient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind.",
false
));
treatments.add(new Treatment(
2,
@ -79,7 +80,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
"Gespräch",
"Patient irrt auf der Suche nach gestohlenen Wertsachen durch die Etage "
+ "und bezichtigt andere Bewohner des Diebstahls."
+ "Patient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel."
+ "Patient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel.",
false
));
treatments.add(new Treatment(
3,
@ -89,7 +91,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("07:30"),
convertStringToLocalTime("08:00"),
"Waschen",
"Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet."
"Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet.",
false
));
treatments.add(new Treatment(
4,
@ -99,7 +102,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("15:10"),
convertStringToLocalTime("16:00"),
"Spaziergang",
"Spaziergang im Park, Patient döst im Rollstuhl ein")
"Spaziergang im Park, Patient döst im Rollstuhl ein",
false)
);
treatments.add(new Treatment(
8,
@ -109,7 +113,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("15:00"),
convertStringToLocalTime("16:00"),
"Spaziergang",
"Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter")
"Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter",
false)
);
treatments.add(new Treatment(
9,
@ -119,7 +124,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("11:00"),
convertStringToLocalTime("11:30"),
"Waschen",
"Waschen per Dusche auf einem Stuhl; Patientin gewendet;")
"Waschen per Dusche auf einem Stuhl; Patientin gewendet;",
false)
);
treatments.add(new Treatment(
12,
@ -129,7 +135,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("15:00"),
convertStringToLocalTime("15:30"),
"Physiotherapie",
"Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur")
"Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur",
false)
);
treatments.add(new Treatment(
14,
@ -139,7 +146,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("09:30"),
convertStringToLocalTime("10:15"),
"KG",
"Lympfdrainage"));
"Lympfdrainage",
false));
treatments.add(new Treatment(
16,
elisabeth,
@ -148,7 +156,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("13:30"),
convertStringToLocalTime("13:45"),
"Toilettengang",
"Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast")
"Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast",
false)
);
treatments.add(new Treatment(
17,
@ -158,7 +167,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
convertStringToLocalTime("16:00"),
convertStringToLocalTime("17:00"),
"KG",
"Massage der Extremitäten zur Verbesserung der Durchblutung")
"Massage der Extremitäten zur Verbesserung der Durchblutung",
true)
);
TreatmentDao dao = DaoFactory.getInstance().createTreatmentDao();

View file

@ -9,6 +9,9 @@ import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import de.hitec.nhplus.treatment.Treatment;
import de.hitec.nhplus.medication.Medication;
import de.hitec.nhplus.patient.Patient;
import java.io.IOException;
import java.util.Objects;
@ -29,10 +32,18 @@ public class MainWindowController {
@FXML
private Tab patientTab;
@FXML
private AnchorPane treatmentPage;
private AnchorPane activeTreatmentPage;
@FXML
private Tab treatmentTab;
@FXML
private TabPane treatmentTabPane;
@FXML
private Tab activeTreatmentTab;
@FXML
private AnchorPane lockedTreatmentPage;
@FXML
private Tab lockedTreatmentTab;
@FXML
private Tab nurseTab;
@FXML
private TabPane nurseTabPane;
@ -58,19 +69,25 @@ public class MainWindowController {
mainTabPane.getSelectionModel().select(patientTab);
patientTab.setOnSelectionChanged(event -> loadPatientPage());
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
nurseTab.setOnSelectionChanged(event -> loadNursePage());
medicationTab.setOnSelectionChanged(event -> loadMedicationPage());
nurseTab.setOnSelectionChanged(event -> loadNursePage());
nurseTabPane.getSelectionModel().select(activeNurseTab);
activeNurseTab.setOnSelectionChanged(event -> loadActiveNursePage());
lockedNurseTab.setOnSelectionChanged(event -> loadLockedNursePage());
treatmentTab.setOnSelectionChanged(event -> loadTreatmentPage());
treatmentTabPane.getSelectionModel().select(activeTreatmentTab);
activeTreatmentTab.setOnSelectionChanged(event -> loadActiveTreatmentPage());
lockedTreatmentTab.setOnSelectionChanged(event -> loadLockedTreatmentPage());
}
/**
* Loads the patient page into its tab.
* Loads the {@link Patient} page into its tab.
*/
private void loadPatientPage() {
try {
@ -88,14 +105,46 @@ public class MainWindowController {
}
/**
* Loads the {@link } page into its tab.
* Loads the {@link Treatment } tab.
*/
private void loadTreatmentsPage() {
private void loadTreatmentPage() {
SelectionModel<Tab> selectionModel = treatmentTabPane.getSelectionModel();
Tab selectedTab = selectionModel.getSelectedItem();
if (selectedTab == activeTreatmentTab) {
loadActiveTreatmentPage();
}
if (selectedTab == lockedTreatmentTab) {
loadLockedTreatmentPage();
}
}
/**
* Loads the active {@link Treatment} page into its tab.
*/
private void loadActiveTreatmentPage() {
try {
BorderPane treatmentsPane = FXMLLoader.load(
BorderPane activeTreatmentPane = FXMLLoader.load(
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml"))
);
treatmentPage.getChildren().setAll(treatmentsPane);
activeTreatmentPage.getChildren().setAll(activeTreatmentPane);
AnchorPane.setTopAnchor(activeTreatmentPane, 0d);
AnchorPane.setBottomAnchor(activeTreatmentPane, 0d);
AnchorPane.setLeftAnchor(activeTreatmentPane, 0d);
AnchorPane.setRightAnchor(activeTreatmentPane, 0d);
} catch (IOException exception) {
exception.printStackTrace();
}
}
/**
* Loads the locked {@link Treatment} page into its tab.
*/
private void loadLockedTreatmentPage() {
try {
BorderPane treatmentsPane = FXMLLoader.load(
Objects.requireNonNull(Main.class.getResource("/de/hitec/nhplus/treatment/LockedTreatmentView.fxml"))
);
lockedTreatmentPage.getChildren().setAll(treatmentsPane);
AnchorPane.setTopAnchor(treatmentsPane, 0d);
AnchorPane.setBottomAnchor(treatmentsPane, 0d);
AnchorPane.setLeftAnchor(treatmentsPane, 0d);
@ -106,15 +155,15 @@ public class MainWindowController {
}
/**
* Loads the nurse page into its tab.
* Loads the {@link Nurse} page into its tab.
*/
private void loadNursePage() {
SelectionModel<Tab> selectionModel = nurseTabPane.getSelectionModel();
Tab selectedTab = selectionModel.getSelectedItem();
if(selectedTab == activeNurseTab){
if (selectedTab == activeNurseTab) {
loadActiveNursePage();
}
if(selectedTab == lockedNurseTab){
if (selectedTab == lockedNurseTab) {
loadLockedNursePage();
}
}
@ -156,7 +205,7 @@ public class MainWindowController {
}
/**
* Loads the medication page into its tab.
* Loads the {@link Medication} page into its tab.
*/
private void loadMedicationPage() {
try {

View file

@ -1,22 +1,35 @@
package de.hitec.nhplus.medication;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.stream.Collectors;
import de.hitec.nhplus.Main;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.medication.database.MedicationDao;
import de.hitec.nhplus.nurse.Nurse;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.treatment.Treatment;
import de.hitec.nhplus.treatment.TreatmentModalController;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.SelectionModel;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import java.sql.SQLException;
import java.util.stream.Collectors;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
/**
* The controller for viewing all {@link Medication}s.
*
* @author Dominik Säume
* @author Ole Kück
*/
public class AllMedicationController {
@FXML
@ -50,14 +63,20 @@ public class AllMedicationController {
this.columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
this.columnManufacturer.setCellValueFactory(new PropertyValueFactory<>("manufacturer"));
this.columnIngredient.setCellValueFactory(
cellData -> new SimpleStringProperty(
cellData
.getValue()
.getIngredients()
cellData -> {
Medication medication = cellData.getValue();
List<Ingredient> ingredients = medication.getIngredients();
if (ingredients.isEmpty()) {
return new SimpleStringProperty("");
}
return new SimpleStringProperty(
ingredients
.stream()
.map(ingredient -> ingredient.getName())
.collect(Collectors.joining("\n"))
));
);
});
this.columnPossibleSideEffects.setCellValueFactory(new PropertyValueFactory<>("possibleSideEffects"));
this.columnAdministrationMethod.setCellValueFactory(new PropertyValueFactory<>("administrationMethod"));
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
@ -76,4 +95,73 @@ public class AllMedicationController {
exception.printStackTrace();
}
}
/**
* Method to save the changes to a {@link Medication}.
*/
public void updateMedication(Medication medication) {
dao = DaoFactory.getInstance().createMedicationDAO();
try {
dao.update(medication);
} catch (SQLException exception) {
exception.printStackTrace();
}
}
/**
* Method to create a new {@link Medication}.
*/
public void createMedication(Medication medication) {
dao = DaoFactory.getInstance().createMedicationDAO();
try {
dao.create(medication);
} catch (SQLException exception) {
exception.printStackTrace();
}
}
/**
* Internal method to create a {@link MedicationModalController MedicationModal}.
*
* @param medication The {@link Medication} which should be edited. Set null to create a new one.
* @param title The Title of the created modal.
*/
public void medicationWindow(Medication medication, String title) {
try {
FXMLLoader loader = new FXMLLoader(
Main.class.getResource("/de/hitec/nhplus/medication/MedicationModal.fxml")
);
BorderPane pane = loader.load();
Scene scene = new Scene(pane);
Stage stage = new Stage();
MedicationModalController controller = loader.getController();
controller.initialize(stage, this, medication);
stage.setScene(scene);
stage.setTitle(title);
stage.setResizable(true);
stage.setAlwaysOnTop(true);
stage.showAndWait();
} catch (IOException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleNewMedication() {
medicationWindow(null, "NHPlus - Neues Medikament");
}
@FXML
public void handleMouseClick() {
tableView.setOnMouseClicked(event -> {
SelectionModel<Medication> selectionModel = tableView.getSelectionModel();
if (event.getClickCount() == 2 && (selectionModel.getSelectedItem() != null)) {
int index = selectionModel.getSelectedIndex();
Medication medication = this.medications.get(index);
medicationWindow(medication, "NHPlus - Medikament");
}
});
}
}

View file

@ -17,7 +17,7 @@ public class Ingredient {
}
public String getName() {
return name.get();
return name.getValue();
}
public SimpleStringProperty nameProperty() {

View file

@ -0,0 +1,104 @@
package de.hitec.nhplus.medication;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Text;
/**
* A custom implementation of the {@link ListCell} for {@link Ingredient}s.
* This implementation contains an automatic resizing of the parent {@link ListView}.
*
* @author Dominik Säume
*/
public class IngredientListCell extends ListCell<Ingredient> {
private final TextField textField;
private final Button deleteButton;
private static final double BUILTIN_BORDER_WIDTH = 1;
private static final double CELL_SPACING = 4;
private static final double CELL_PADDING = 4;
private static final double BUTTON_PADDING_X = 8;
private static final double BUTTON_PADDING_Y = 4;
private final double totalSpacing;
public IngredientListCell() {
this.setPadding(new Insets(CELL_PADDING));
textField = new TextField();
textField.setPromptText("Inhaltsstoff");
textField.textProperty().addListener(this::onTextFieldUpdate);
deleteButton = new Button("-");
deleteButton.setPadding(new Insets(
BUTTON_PADDING_Y,
BUTTON_PADDING_X,
BUTTON_PADDING_Y,
BUTTON_PADDING_X
));
deleteButton.setOnAction(event -> getListView().getItems().remove(getItem()));
// Calculate Delete Button Width
Text textNode = new Text(deleteButton.getText());
textNode.setFont(deleteButton.getFont());
double calculatedDeleteButtonWidth = textNode.getLayoutBounds().getWidth() + BUTTON_PADDING_X * 2;
totalSpacing = BUILTIN_BORDER_WIDTH * 2 // List View
+ CELL_PADDING * 2
+ CELL_SPACING
+ calculatedDeleteButtonWidth;
}
@Override
protected void updateItem(Ingredient item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setGraphic(null);
} else {
String oldText = textField.getText();
String newText = oldText != null && !oldText.isEmpty() ? oldText : item.getName();
textField.setText(newText);
BorderPane cellPane = new BorderPane();
cellPane.setCenter(textField);
cellPane.setRight(deleteButton);
BorderPane.setMargin(deleteButton, new Insets(0, 0, 0, CELL_SPACING));
setGraphic(cellPane);
}
}
/**
* A Callback for use as a Listener for the {@link IngredientListCell#textField}.
*/
private void onTextFieldUpdate(ObservableValue<? extends String> observable, String oldValue, String newValue) {
getItem().setName(textField.getText());
textField.setMinWidth(getTextFieldRequiredWidth(textField));
ListView<Ingredient> listView = getListView();
double max = listView.lookupAll("*")
.stream()
.filter(node -> node instanceof IngredientListCell)
.mapToDouble(node -> getTextFieldRequiredWidth(((IngredientListCell) node).textField))
.max()
.orElse(0);
getListView().setMinWidth(max + totalSpacing);
}
/**
* Internal method to calculate the required width of the {@link IngredientListCell#textField}.
*/
private double getTextFieldRequiredWidth(TextField textField) {
Text textNode = new Text(textField.getText());
textNode.setFont(textField.getFont());
return textNode.getLayoutBounds().getWidth()
+ textField.getPadding().getLeft()
+ textField.getPadding().getRight()
+ BUILTIN_BORDER_WIDTH * 2;
}
}

View file

@ -0,0 +1,141 @@
package de.hitec.nhplus.medication;
import de.hitec.nhplus.treatment.Treatment;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import static de.hitec.nhplus.utils.Validator.*;
/**
* The controller for creating and editing a specific {@link Medication}.
*
* @author Ole Kück
*/
public class MedicationModalController {
@FXML
public ListView<Ingredient> listViewIngredients;
@FXML
public TextField textFieldName;
@FXML
public TextField textFieldManufacturer;
@FXML
public TextField textFieldAdministrationMethod;
@FXML
public TextField textFieldCurrentStock;
@FXML
public TextArea textAreaPossibleSideEffects;
@FXML
public Button buttonSave;
private Stage stage;
private Medication medication;
private final ObservableList<Ingredient> ingredients = FXCollections.observableArrayList();
private AllMedicationController controller;
private boolean isNewMedication = false;
/**
* Initialization method that is called after the binding of all the fields.
*/
@FXML
public void initialize(
Stage stage,
AllMedicationController controller,
Medication medication
) {
this.stage = stage;
this.controller = controller;
if (medication != null) {
this.medication = medication;
} else {
isNewMedication = true;
this.medication = new Medication(
"",
"",
new ArrayList<>(),
"",
"",
0
);
this.buttonSave.setDisable(true);
}
listViewIngredients.setCellFactory(cellData -> new IngredientListCell());
listViewIngredients.setItems(ingredients);
showData();
ChangeListener<String> inputMedicationValidationListener = (observableValue, oldText, newText) -> {
boolean isValid = isValidMedicationName(textFieldName.getText())
&& isValidMedicationManufacturer(textFieldManufacturer.getText())
&& isValidMedicationAdministrationMethod(textFieldAdministrationMethod.getText())
&& isValidStock(textFieldCurrentStock.getText());
this.buttonSave.setDisable(!isValid);
};
this.textFieldName.textProperty().addListener(inputMedicationValidationListener);
this.textFieldManufacturer.textProperty().addListener(inputMedicationValidationListener);
this.textFieldAdministrationMethod.textProperty().addListener(inputMedicationValidationListener);
this.textFieldCurrentStock.textProperty().addListener(inputMedicationValidationListener);
}
/**
* Internal method to show the data in the view.
*/
private void showData() {
ingredients.setAll(medication.getIngredients());
textFieldName.setText(medication.getName());
textFieldManufacturer.setText(medication.getManufacturer());
textFieldAdministrationMethod.setText(medication.getAdministrationMethod());
textFieldCurrentStock.setText(String.valueOf(medication.getCurrentStock()));
textAreaPossibleSideEffects.setText(medication.getPossibleSideEffects());
}
@FXML
public void handleSave() {
this.medication.setName(textFieldName.getText());
this.medication.setManufacturer(textFieldManufacturer.getText());
this.medication.setAdministrationMethod(textFieldAdministrationMethod.getText());
this.medication.setCurrentStock(Integer.parseInt(textFieldCurrentStock.getText()));
this.medication.setPossibleSideEffects(textAreaPossibleSideEffects.getText());
this.medication.setIngredients(ingredients
.stream()
.map(Ingredient::getName)
.distinct()
.filter(Predicate.not(String::isEmpty))
.map(Ingredient::new)
.toList()
);
if (isNewMedication) {
controller.createMedication(medication);
} else {
controller.updateMedication(medication);
}
controller.readAllAndShowInTableView();
stage.close();
}
@FXML
public void handleCancel() {
stage.close();
}
@FXML
public void handleAddIngredient() {
ingredients.add(new Ingredient(""));
}
}

View file

@ -29,6 +29,7 @@ public class MedicationDao implements Dao<Medication> {
@Override
public void create(Medication medication) throws SQLException {
connection.setAutoCommit(false); //Switch to Manual Commit, to do an SQL Transaction
final String medicationSQL = """
INSERT INTO medication
(name, manufacturer, possibleSideEffects, administrationMethod, currentStock)
@ -42,6 +43,15 @@ public class MedicationDao implements Dao<Medication> {
medicationStatement.setInt(5, medication.getCurrentStock());
medicationStatement.execute();
ResultSet generatedKeys = connection.createStatement().executeQuery("SELECT last_insert_rowid()");
connection.commit(); //Finish SQL Transaction
connection.setAutoCommit(true); //Switch back Mode
if (!generatedKeys.next()) {
return;
}
int newId = generatedKeys.getInt(1);
final String ingredientSQL = """
INSERT INTO medication_ingredient
(id, name)
@ -49,7 +59,7 @@ public class MedicationDao implements Dao<Medication> {
""";
for (Ingredient ingredient : medication.getIngredients()) {
PreparedStatement ingredientStatement = this.connection.prepareStatement(ingredientSQL);
ingredientStatement.setInt(1, medication.getId());
ingredientStatement.setInt(1, newId);
ingredientStatement.setString(2, ingredient.getName());
ingredientStatement.execute();
}
@ -90,20 +100,26 @@ public class MedicationDao implements Dao<Medication> {
result.getInt(1),
result.getString(2),
result.getString(3),
List.of(),
new ArrayList<>(),
result.getString(4),
result.getString(5),
result.getInt(6)
);
medications.add(medication);
lastMedicationId = currentMedicationId;
continue;
}
List<Ingredient> ingredients = ingredientMap.computeIfAbsent(currentMedicationId, k -> new ArrayList<>());
ingredients.add(new Ingredient(result.getString(7)));
String ingredientName = result.getString(7);
if(ingredientName == null){
continue;
}
ingredients.add(new Ingredient(ingredientName));
lastMedicationId = currentMedicationId;
}
for (Medication medication : medications) {
List<Ingredient> ingredients = ingredientMap.get(medication.getId());
if(ingredients.isEmpty()){
continue;
}
medication.setIngredients(ingredientMap.get(medication.getId()));
}

View file

@ -22,6 +22,8 @@ import java.sql.SQLException;
*
* @author Dominik Säume
* @author Ole Kück
* @author Armin Ribic
* @author Dorian Nemec
*/
public class AllNurseController {
@FXML
@ -106,6 +108,17 @@ public class AllNurseController {
this.textFieldPhoneNumber.clear();
}
/**
* Internal method that stores the changes in the database.
*/
private void doUpdate(TableColumn.CellEditEvent<Nurse, String> event) {
try {
this.dao.update(event.getRowValue());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleAdd(){
String surname=this.textFieldSurName.getText();
@ -137,4 +150,39 @@ public class AllNurseController {
readAllAndShowInTableView();
}
@FXML
public void handleOnEditSurname(TableColumn.CellEditEvent<Nurse, String> event) {
String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) {
showValidationError("Nachname");
event.getTableView().refresh();
return;
}
event.getRowValue().setSurName(newSurName);
this.doUpdate(event);
}
@FXML
public void handleOnEditFirstname(TableColumn.CellEditEvent<Nurse, String> event) {
String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) {
showValidationError("Vorname");
event.getTableView().refresh();
return;
}
event.getRowValue().setFirstName(newFirstName);
this.doUpdate(event);
}
@FXML
public void handleOnEditPhoneNumber(TableColumn.CellEditEvent<Nurse, String> event) {
String newPhoneNumber = event.getNewValue();
if (!isValidPhoneNumber(newPhoneNumber)) {
showValidationError("Telefonnummer");
event.getTableView().refresh();
return;
}
event.getRowValue().setPhoneNumber(newPhoneNumber);
this.doUpdate(event);
}
}

View file

@ -154,7 +154,7 @@ public class AllPatientController {
public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) {
String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) {
showValidationError("First Name");
showValidationError("Vorname");
event.getTableView().refresh();
return;
}
@ -166,7 +166,7 @@ public class AllPatientController {
public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) {
String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) {
showValidationError("Sur Name");
showValidationError("Nachname");
event.getTableView().refresh();
return;
}
@ -178,7 +178,7 @@ public class AllPatientController {
public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) {
String newDateString = event.getNewValue();
if (!isValidDate(newDateString)) {
showValidationError("Date");
showValidationError("Geburtstag");
event.getTableView().refresh();
return;
}
@ -190,7 +190,7 @@ public class AllPatientController {
public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) {
String newCareLevel = event.getNewValue();
if (!isValidCareLevel(newCareLevel)) {
showValidationError("Care Level");
showValidationError("Pflegegrad");
event.getTableView().refresh();
return;
}
@ -202,7 +202,7 @@ public class AllPatientController {
public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event) {
String newRoomNumber = event.getNewValue();
if (!isValidRoomNumber(newRoomNumber)) {
showValidationError("Room Number");
showValidationError("Raum");
event.getTableView().refresh();
return;
}

View file

@ -20,6 +20,7 @@ import javafx.stage.Stage;
import java.io.IOException;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
/**
@ -27,6 +28,8 @@ import java.util.ArrayList;
*
* @author Bernd Heidemann
* @author Dominik Säume
* @author Armin Ribic
* @author Dorian Nemec
*/
public class AllTreatmentController {
@ -61,7 +64,7 @@ public class AllTreatmentController {
public ComboBox<String> comboBoxNurseSelection;
@FXML
private Button buttonDelete;
private Button buttonLock;
private final ObservableList<Treatment> treatments = FXCollections.observableArrayList();
private TreatmentDao dao;
@ -100,15 +103,16 @@ public class AllTreatmentController {
this.columnDescription.setCellValueFactory(new PropertyValueFactory<>("description"));
this.tableView.setItems(this.treatments);
this.buttonDelete.setDisable(true);
this.buttonLock.setDisable(true);
this.tableView
.getSelectionModel()
.selectedItemProperty()
.addListener((observableValue, oldTreatment, newTreatment) ->
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)
AllTreatmentController.this.buttonLock.setDisable(newTreatment == null)
);
this.createComboBoxData();
}
/**
@ -136,7 +140,7 @@ public class AllTreatmentController {
this.patientSelection.add(patient.getSurName());
}
nurseList = (ArrayList<Nurse>) nurseDao.readAll();
nurseList = (ArrayList<Nurse>) nurseDao.readAllActive();
for (Nurse nurse : nurseList) {
this.nurseSelection.add(nurse.getSurName());
}
@ -258,18 +262,6 @@ public class AllTreatmentController {
}
}
@FXML
public void handleDelete() {
int index = this.tableView.getSelectionModel().getSelectedIndex();
Treatment t = this.treatments.remove(index);
TreatmentDao dao = DaoFactory.getInstance().createTreatmentDao();
try {
dao.delete(t.getId());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleNewTreatment() {
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
@ -316,4 +308,22 @@ public class AllTreatmentController {
});
}
@FXML
public void handleLock(){
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem == null){
return;
}
try {
selectedItem.setLocked(true);
this.dao.update(selectedItem);
}catch (SQLException exception){
exception.printStackTrace();
}
readAllAndShowInTableView();
}
}

View file

@ -0,0 +1,127 @@
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.treatment.database.TreatmentDao;
import de.hitec.nhplus.utils.DateConverter;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* Controller for all locked treatments.
*
* @author Armin Ribic
* @author Dorian Nemec
*/
public class LockedTreatmentController {
@FXML
public Button buttonUnlock;
@FXML
public TableView<Treatment> tableView;
@FXML
public TableColumn<Treatment, Long> columnId;
@FXML
private TableColumn<Treatment, String> columnPatient;
@FXML
private TableColumn<Treatment, String> columnNurse;
@FXML
private TableColumn<Treatment, String> columnDeleteDate;
private final ObservableList<Treatment> treatments = FXCollections.observableArrayList();
private TreatmentDao treatmentDao;
/**
* This method allows initializing a {@link LockedTreatmentController} object
* that is called after the binding of all the fields.
*/
public void initialize() {
this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
this.columnPatient.setCellValueFactory(
cellData -> {
Patient patient = cellData.getValue().getPatient();
return new SimpleStringProperty(patient.getSurName() + ", " + patient.getFirstName());
}
);
this.columnNurse.setCellValueFactory(
cellData -> {
Nurse nurse = cellData.getValue().getNurse();
return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName());
}
);
this.columnDeleteDate.setCellValueFactory(cellData -> new SimpleStringProperty(
DateConverter.convertLocalDateToString(cellData.getValue().calculateDeleteDate())));
this.tableView.setItems(this.treatments);
handleDelete();
}
/**
* Reads all locked {@link Treatment} data and shows it in the table.
*/
private void readAllAndShowInTableView() {
this.treatments.clear();
this.treatmentDao = DaoFactory.getInstance().createTreatmentDao();
try {
this.treatments.addAll(this.treatmentDao.readAllLocked());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML
private void unlockTreatment() {
Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem == null) {
return;
}
try {
selectedItem.setLocked(false);
this.treatmentDao.update(selectedItem);
} catch (SQLException exception) {
exception.printStackTrace();
}
readAllAndShowInTableView();
}
@FXML
public void handleDelete() {
Treatment selecteditem;
LocalDate today = LocalDate.now();
LocalDate deleteDate;
for (Treatment treatment : treatments) {
selecteditem = treatment;
deleteDate = selecteditem.calculateDeleteDate();
if (today.isEqual(deleteDate) || today.isAfter(deleteDate)) {
try {
treatmentDao.delete(selecteditem.getId());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
}
readAllAndShowInTableView();
}
}

View file

@ -1,14 +1,17 @@
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;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
import java.util.StringJoiner;
/**
@ -16,6 +19,8 @@ import java.util.StringJoiner;
*
* @author Bernd Heidemann
* @author Dominik Säume
* @author Armin Ribic
* @author Dorian Nemec
*/
public class Treatment {
private SimpleIntegerProperty id;
@ -26,6 +31,8 @@ public class Treatment {
private final SimpleObjectProperty<LocalTime> end;
private final SimpleStringProperty description;
private final SimpleStringProperty remarks;
private final SimpleBooleanProperty locked;
private final int sperrfrist = 10;
/**
* This constructor allows instantiating a {@link Treatment} object,
@ -50,6 +57,7 @@ public class Treatment {
this.end = new SimpleObjectProperty<>(end);
this.description = new SimpleStringProperty(description);
this.remarks = new SimpleStringProperty(remarks);
this.locked = new SimpleBooleanProperty(false);
}
/**
@ -63,7 +71,8 @@ public class Treatment {
LocalTime begin,
LocalTime end,
String description,
String remarks
String remarks,
Boolean isLocked
) {
this.id = new SimpleIntegerProperty(id);
this.patient = new SimpleObjectProperty<>(patient);
@ -73,6 +82,19 @@ public class Treatment {
this.end = new SimpleObjectProperty<>(end);
this.description = new SimpleStringProperty(description);
this.remarks = new SimpleStringProperty(remarks);
this.locked = new SimpleBooleanProperty(isLocked);
}
public boolean isLocked() {
return locked.get();
}
public SimpleBooleanProperty lockedProperty() {
return locked;
}
public void setLocked(boolean locked) {
this.locked.set(locked);
}
public int getId() {
@ -168,4 +190,11 @@ public class Treatment {
.add("Remarks: " + this.getRemarks())
.toString();
}
/**
* Calculates delete date of treatment.
*/
public LocalDate calculateDeleteDate() {
return DateConverter.convertStringToLocalDate(getDate()).plusYears(sperrfrist);
}
}

View file

@ -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;
@ -20,6 +21,8 @@ import java.util.List;
*
* @author Bernd Heidemannn
* @author Dominik Säume
* @author Armin Ribic
* @author Dorian Nemec
*/
public class TreatmentDao extends DaoImp<Treatment> {
@ -31,8 +34,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
protected PreparedStatement getCreateStatement(Treatment treatment) throws SQLException {
final String SQL = """
INSERT INTO treatment
(patientId, nurseId, date, begin, end, description, remark)
VALUES (?, ?, ?, ?, ?, ?, ?)
(patientId, nurseId, date, begin, end, description, remark, isLocked)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
""";
PreparedStatement statement = this.connection.prepareStatement(SQL);
statement.setInt(1, treatment.getPatient().getId());
@ -42,6 +45,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
statement.setString(5, treatment.getEnd());
statement.setString(6, treatment.getDescription());
statement.setString(7, treatment.getRemarks());
statement.setBoolean(8,treatment.isLocked());
return statement;
}
@ -63,13 +67,14 @@ public class TreatmentDao extends DaoImp<Treatment> {
DateConverter.convertStringToLocalTime(result.getString(5)),
DateConverter.convertStringToLocalTime(result.getString(6)),
result.getString(7),
result.getString(8)
result.getString(8),
false
);
}
@Override
protected PreparedStatement getReadAllStatement() throws SQLException {
final String SQL = "SELECT * FROM treatment";
final String SQL = "SELECT * FROM treatment where isLocked = false";
return this.connection.prepareStatement(SQL);
}
@ -120,7 +125,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
begin = ?,
end = ?,
description = ?,
remark = ?
remark = ?,
isLocked = ?
WHERE id = ?
""";
PreparedStatement statement = this.connection.prepareStatement(SQL);
@ -129,7 +135,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
statement.setString(3, treatment.getEnd());
statement.setString(4, treatment.getDescription());
statement.setString(5, treatment.getRemarks());
statement.setInt(6, treatment.getId());
statement.setBoolean(6,treatment.isLocked());
statement.setInt(7, treatment.getId());
return statement;
}
@ -141,4 +148,12 @@ public class TreatmentDao extends DaoImp<Treatment> {
statement.setInt(1, id);
return statement;
}
/**
* Returns all locked treatments.
*/
public List<Treatment> readAllLocked() throws SQLException {
final String SQL = "SELECT * FROM treatment WHERE isLocked = true";
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
}
}

View file

@ -148,4 +148,46 @@ public class Validator {
public static boolean isValidRoomNumber(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid {@link de.hitec.nhplus.medication.Medication#name Medication name}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationName(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid
* {@link de.hitec.nhplus.medication.Medication#manufacturer Medication manufacturer}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationManufacturer(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid
* {@link de.hitec.nhplus.medication.Medication#administrationMethod Medication administration method}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationAdministrationMethod(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid stock count.
* @param text The {@link String} to validate.
*/
public static boolean isValidStock(String text) {
if (text.isBlank()) {
return false;
}
try {
int stock = Integer.parseInt(text);
return stock >= 0;
} catch (Exception exception) {
return false;
}
}
}

View file

@ -13,7 +13,14 @@
<AnchorPane fx:id="patientPage"/>
</Tab>
<Tab fx:id="treatmentTab" text="Behandlungen">
<AnchorPane fx:id="treatmentPage"/>
<TabPane fx:id="treatmentTabPane" tabClosingPolicy="UNAVAILABLE">
<Tab fx:id="activeTreatmentTab" text="Behandlungen">
<AnchorPane fx:id="activeTreatmentPage"/>
</Tab>
<Tab fx:id="lockedTreatmentTab" text="Gesperrte Behandlungen">
<AnchorPane fx:id="lockedTreatmentPage" />
</Tab>
</TabPane>
</Tab>
<Tab fx:id="nurseTab" text="Pfleger">
<TabPane fx:id="nurseTabPane" tabClosingPolicy="UNAVAILABLE">

View file

@ -12,7 +12,7 @@
<Insets top="8" left="8" right="8" bottom="8"/>
</padding>
<center>
<TableView fx:id="tableView">
<TableView fx:id="tableView" onMouseClicked="#handleMouseClick">
<columns>
<TableColumn
fx:id="columnId"
@ -66,6 +66,7 @@
fx:id="buttonAdd"
mnemonicParsing="false"
prefWidth="90.0"
onAction="#handleNewMedication"
text="Hinzufügen"
/>
<Button

View file

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane
xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.medication.MedicationModalController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<top>
<GridPane hgap="8.0">
<columnConstraints>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="ALWAYS"/>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="ALWAYS"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
</rowConstraints>
<!-- Row 0-->
<Label
GridPane.rowIndex="0"
GridPane.columnIndex="0"
text="Name:"
/>
<TextField
fx:id="textFieldName"
GridPane.rowIndex="0"
GridPane.columnIndex="1"
/>
<Label
GridPane.rowIndex="0"
GridPane.columnIndex="3"
text="Hersteller:"
/>
<TextField
fx:id="textFieldManufacturer"
GridPane.rowIndex="0"
GridPane.columnIndex="4"
/>
<!-- Row 1 -->
<Label
GridPane.rowIndex="1"
GridPane.columnIndex="0"
text="Verabreichungsmethode:"
/>
<TextField
fx:id="textFieldAdministrationMethod"
GridPane.rowIndex="1"
GridPane.columnIndex="1"
/>
<Label
GridPane.rowIndex="1"
GridPane.columnIndex="3"
text="Lagerbestand:"
/>
<TextField
fx:id="textFieldCurrentStock"
GridPane.rowIndex="1"
GridPane.columnIndex="4"
/>
</GridPane>
</top>
<center>
<BorderPane>
<padding>
<Insets top="8" bottom="8"/>
</padding>
<left>
<BorderPane>
<BorderPane.margin>
<Insets right="8"/>
</BorderPane.margin>
<top>
<Label text="Inhaltsstoffe:"/>
</top>
<center>
<ListView fx:id="listViewIngredients" minWidth="200">
<BorderPane.margin>
<Insets top="8"/>
</BorderPane.margin>
</ListView>
</center>
<bottom>
<AnchorPane>
<BorderPane.margin>
<Insets top="8"/>
</BorderPane.margin>
<Button
onAction="#handleAddIngredient"
text="+"
AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0"
/>
</AnchorPane>
</bottom>
</BorderPane>
</left>
<center>
<BorderPane>
<top>
<Label text="Nebenwirkungen"/>
</top>
<center>
<TextArea fx:id="textAreaPossibleSideEffects"/>
</center>
</BorderPane>
</center>
</BorderPane>
</center>
<bottom>
<BorderPane>
<right>
<HBox spacing="8.0">
<Button
fx:id="buttonSave"
prefWidth="90"
mnemonicParsing="false"
onAction="#handleSave"
text="Speichern"
/>
<Button
prefWidth="90"
mnemonicParsing="false"
onAction="#handleCancel"
text="Abbrechen"
/>
</HBox>
</right>
</BorderPane>
</bottom>
</BorderPane>

View file

@ -22,16 +22,19 @@
<TableColumn
fx:id="columnSurName"
minWidth="140.0"
onEditCommit="#handleOnEditSurname"
text="Nachname"
/>
<TableColumn
fx:id="columnFirstName"
minWidth="140.0"
onEditCommit="#handleOnEditFirstname"
text="Vorname"
/>
<TableColumn
fx:id="columnPhoneNumber"
minWidth="140.0"
onEditCommit="#handleOnEditPhoneNumber"
text="Telefonnummer"
/>
</columns>

View file

@ -12,7 +12,11 @@
<Insets top="8" left="8" right="8" bottom="8"/>
</padding>
<center>
<TableView fx:id="tableView" layoutX="31.0" layoutY="40" onMouseClicked="#handleMouseClick" >
<TableView
fx:id="tableView"
layoutX="31.0"
layoutY="40"
onMouseClicked="#handleMouseClick" >
<columns>
<TableColumn
fx:id="columnId"

View file

@ -88,11 +88,11 @@
</center>
<right>
<Button
fx:id="buttonDelete"
fx:id="buttonLock"
mnemonicParsing="false"
onAction="#handleDelete"
onAction="#handleLock"
prefWidth="200.0"
text="Löschen"
text="Sperren"
GridPane.columnIndex="2"
/>
</right>

View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane prefHeight="400.0"
prefWidth="600.0"
xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.treatment.LockedTreatmentController">
<padding>
<Insets bottom="8" left="8" right="8" top="8" />
</padding>
<center>
<TableView
fx:id="tableView"
layoutX="31.0"
layoutY="40">
<columns>
<TableColumn
fx:id="columnId"
minWidth="40.0"
prefWidth="102.0"
text="ID"
/>
<TableColumn
fx:id="columnPatient"
minWidth="40.0"
prefWidth="102.0"
text="Patient"
/>
<TableColumn
fx:id="columnNurse"
minWidth="40.0"
prefWidth="102.0"
text="Pflegekraft"
/>
<TableColumn
fx:id="columnDeleteDate"
minWidth="40.0"
prefWidth="102.0"
text="Geloescht am"
/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
</center>
<bottom>
<BorderPane>
<BorderPane.margin>
<Insets top="8.0"/>
</BorderPane.margin>
<center>
<HBox spacing="8.0">
<padding>
<Insets right="8.0"/>
</padding>
</HBox>
</center>
<right>
<HBox>
<spacing>8.0</spacing>
<Button
fx:id="buttonUnlock"
mnemonicParsing="false"
onAction="#unlockTreatment"
prefWidth="90.0"
text="Entsperren"
/>
</HBox>
</right>
</BorderPane>
</bottom>
</BorderPane>

View file

@ -119,7 +119,7 @@
fx:id="textAreaRemarks"
HBox.hgrow="ALWAYS"
/>
<VBox>
<VBox spacing="8.0">
<Button
fx:id="buttonSave"
prefWidth="90"

View file

@ -8,6 +8,7 @@ CREATE TABLE treatment
end TEXT NOT NULL,
description TEXT NOT NULL,
remark TEXT NOT NULL,
isLocked BOOLEAN NOT NULL DEFAULT false,
FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE,
FOREIGN KEY (nurseId) REFERENCES nurse (id) ON DELETE SET NULL
)