From de647a8087fd269d86110ff0c24ca0efde8cd994 Mon Sep 17 00:00:00 2001 From: Johannes Date: Sat, 14 Nov 2015 17:32:53 +0100 Subject: [PATCH] =?UTF-8?q?DateTimePicker=20=C3=BCberall,=20Controller=20w?= =?UTF-8?q?eiter=20entwickelt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mi/projmi6/controller/FallController.java | 19 +-- .../controller/PatientEditorController.java | 179 ++++++++++++--------- .../controller/StationsHistorieController.java | 4 + .../controller/UntersuchungenController.java | 17 +- .../uniluebeck/mi/projmi6/view/DateTimePicker.java | 11 +- src/main/resources/diagnose.fxml | 40 ++--- src/main/resources/fall.fxml | 26 +-- src/main/resources/log.fxml | 4 + src/main/resources/main.fxml | 6 +- src/main/resources/patient_edit.fxml | 15 +- src/main/resources/patient_tables.fxml | 4 + src/main/resources/settings.fxml | 4 + src/main/resources/stationshistorie.fxml | 34 ++-- src/main/resources/style.css | 7 + src/main/resources/untersuchungen.fxml | 20 ++- 15 files changed, 217 insertions(+), 173 deletions(-) diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java index cf6341b..1dec213 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java @@ -3,12 +3,12 @@ package de.uniluebeck.mi.projmi6.controller; /** * Created by 631806 on 12.11.15. */ +import de.uniluebeck.mi.projmi6.view.DateTimePicker; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; -import javafx.scene.control.DatePicker; import javafx.scene.control.Label; import javafx.scene.control.TextField; @@ -26,7 +26,7 @@ public class FallController { } @FXML - private Button btnFallAufnNow; + private DateTimePicker dtTmAufnahme, dtTmEntlassung; @FXML private ComboBox fallFallart; @@ -41,30 +41,15 @@ public class FallController { private Label fallCreator; @FXML - private DatePicker fallEntlDate; - - @FXML - private DatePicker fallAufnDate; - - @FXML private Label fallEditor; @FXML private TextField fallVersichertennummer; @FXML - private Button btnFallEntlNow; - - @FXML - private Label fallEditTime; - - @FXML private Label fallPatID; @FXML - private TextField fallAufnTime; - - @FXML private TextField fallEinweisenderArzt; @FXML diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java index 76dd232..00ac2da 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java @@ -6,24 +6,66 @@ package de.uniluebeck.mi.projmi6.controller; import de.uniluebeck.mi.projmi6.model.Patient; import javafx.collections.FXCollections; import javafx.fxml.FXML; -import javafx.scene.control.Button; -import javafx.scene.control.ComboBox; -import javafx.scene.control.DatePicker; -import javafx.scene.control.Label; -import javafx.scene.control.TextArea; +import javafx.scene.control.*; import javafx.event.ActionEvent; -import javafx.scene.control.TextField; import javafx.stage.Stage; public class PatientEditorController { - // private MainController mainController; - + /** + * The patient that is shown in the edit window, or null if a new patient should be created. + */ private Patient patient = null; - // public PatientEditorController(MainController mainController){ - // this.mainController = mainController; - // } + + @FXML + private Label patChangeTime; + @FXML + private Label patChanger; + @FXML + private Label patCreator; + @FXML + private Label patCreateTime; + + @FXML + private Label patId; + + @FXML + private TextField patVorname; + @FXML + private TextField patGeburtsname; + @FXML + private TextField patNachname; + + @FXML + private TextField patStrasse; + @FXML + private TextField patHausnummer; + @FXML + private TextField patPlz; + @FXML + private TextField patOrt; + + @FXML + private DatePicker patGeburtsdatum; + + @FXML + private ComboBox patFamilienstand; + @FXML + private ComboBox patGeschlecht; + + @FXML + private TextField patVersicherungsnummer; + @FXML + private ComboBox patVersicherung; + + @FXML + private TextArea patCave; + + @FXML + private Button btnPatAbort; + @FXML + private Button btnPatSave; @FXML @@ -44,7 +86,6 @@ public class PatientEditorController { } - private void copyPatientDataIntoFields(){ patId.setText(Integer.toString(patient.getPatID())); patGeburtsname.setText(patient.getGeburtsname()); @@ -67,6 +108,45 @@ public class PatientEditorController { patChangeTime.setText(patient.getBearbeitetDatumZeit()); } + private void showMessage(String title, String message){ + Alert alert = new Alert(Alert.AlertType.INFORMATION); + alert.setTitle("Ung\u00fcltige Daten!"); + alert.setHeaderText(title); + alert.setContentText(message); + + alert.showAndWait(); + } + + private void copyFieldDataIntoPatient(Patient patient){ + + patient.setGeburtsname(patGeburtsname.getText()); + patient.setNachname(patNachname.getText()); + patient.setVorname(patVorname.getText()); + patient.setStrasse(patStrasse.getText()); + patient.setHausnummer(patHausnummer.getText()); + patient.setPlz(patPlz.getText()); + patient.setOrt(patOrt.getText()); + patient.setGeburtsdatum(patGeburtsdatum.getValue()); + patient.setFamilienstand(patFamilienstand.getValue()); + patient.setGeschlecht(patient.getGeschlecht()); + patient.setVersichertennummer(patVersicherungsnummer.getText()); + //patient.setVersicherung TODO + patient.setCave(patCave.getText()); + } + + + private boolean validateData(){ + if(!patPlz.getText().matches("[0-9]{5}")){ + showMessage("Die eingegebene PLZ ist ung\u00fcltig!", + "Postleitzahlen m\u00fcssen aus exakt 5 Ziffern bestehen!"); + return false; + } + + return true; + } + + + private void clearFields(){ patId.setText(""); patGeburtsname.setText(""); @@ -89,72 +169,21 @@ public class PatientEditorController { patChangeTime.setText(""); } - - - - @FXML - private Label patChangeTime; - - @FXML - private Button btnPatAbort; - - @FXML - private TextField patVersicherungsnummer; - - @FXML - private ComboBox patVersicherung; - - @FXML - private Label patChanger; - - @FXML - private TextField patOrt; - - @FXML - private Label patId; - - @FXML - private TextField patHausnummer; - - @FXML - private Button btnPatSave; - - @FXML - private TextField patPlz; - - @FXML - private ComboBox patFamilienstand; - - @FXML - private TextField patStrasse; - - @FXML - private TextField patVorname; - - @FXML - private TextArea patCave; - - @FXML - private ComboBox patGeschlecht; - - @FXML - private Label patCreator; - - @FXML - private TextField patGeburtsname; - - @FXML - private DatePicker patGeburtsdatum; - - @FXML - private Label patCreateTime; - - @FXML - private TextField patNachname; - @FXML void clickedSave(ActionEvent event) { + if(!validateData()){ + return; + } + if(patient==null){ + patient = new Patient(); + copyFieldDataIntoPatient(patient); + //Create new db entry TODO + }else{ + copyFieldDataIntoPatient(patient); + //Update db entry... TODO + } + ((Stage)patNachname.getScene().getWindow()).close(); } @FXML diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java index ec0ae1c..b3cd9b0 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java @@ -1,5 +1,6 @@ package de.uniluebeck.mi.projmi6.controller; +import de.uniluebeck.mi.projmi6.view.DateTimePicker; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; @@ -24,6 +25,9 @@ public class StationsHistorieController { @FXML private TableColumn colStatHistAbteilung, colStatHistStation, colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; + @FXML + private DateTimePicker dtTmAufnahme, dtTmEntlassung; + public StationsHistorieController(MainController mainController){ this.mainController = mainController; } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java index 5a6f65e..4d8a966 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java @@ -5,6 +5,8 @@ package de.uniluebeck.mi.projmi6.controller; */ import de.uniluebeck.mi.projmi6.Main; +import de.uniluebeck.mi.projmi6.model.Mitarbeiter; +import de.uniluebeck.mi.projmi6.view.DateTimePicker; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.*; @@ -26,7 +28,7 @@ public class UntersuchungenController { private Button btnUntsCreate; @FXML - private TextField untsZeit; + private DateTimePicker dtTmUntersuchungszeitpunkt; @FXML private Button btnUntsSave; @@ -44,19 +46,13 @@ public class UntersuchungenController { private Label untsCreateTime; @FXML - private DatePicker untsDatum; - - @FXML private ListView untsList; @FXML private ComboBox untsOpsCode; @FXML - private Button btnUntsNow; - - @FXML - private ComboBox untsArzt; + private ComboBox untsArzt; @FXML void clickedUntsCreate(ActionEvent event) { @@ -64,11 +60,6 @@ public class UntersuchungenController { } @FXML - void clickedUntsNow(ActionEvent event) { - - } - - @FXML void clickedUntsAbort(ActionEvent event) { } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java index 60cf514..d8d7988 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java @@ -27,8 +27,6 @@ import java.time.LocalDateTime; */ public class DateTimePicker extends HBox { private DatePicker datePicker = new DatePicker(); - //private ComboBox hourPicker = new ComboBox<>(); - // private ComboBox minutePicker = new ComboBox<>(); private NumberTextField hourText = new NumberTextField(); private NumberTextField minuteText = new NumberTextField(); private Button btnNow = new Button("Jetzt"); @@ -40,7 +38,7 @@ public class DateTimePicker extends HBox { * Empty constructor for the FXMLLoader. */ public DateTimePicker(){ - this.setAlignment(Pos.CENTER); + this.setAlignment(Pos.CENTER_LEFT); hourText.setOnKeyReleased(event ->{ if(hourText.getCaretPosition()>=2){ int hour = Integer.parseInt(hourText.getText()); @@ -88,15 +86,18 @@ public class DateTimePicker extends HBox { HBox timePicker = new HBox(hourText, colon,minuteText); timePicker.maxHeightProperty().bind(datePicker.heightProperty()); - timePicker.setMaxWidth(140); + timePicker.setMinWidth(55); + timePicker.setMaxWidth(70); timePicker.getStyleClass().add("button"); //Set Now-Button action btnNow.setOnAction(event -> setToCurrentDateTime()); - + //Make it large enough to read the text + btnNow.setMinWidth(50); //Add the subcomponents to the view. this.getChildren().addAll(datePicker,timePicker,btnNow); + this.setSpacing(5); } diff --git a/src/main/resources/diagnose.fxml b/src/main/resources/diagnose.fxml index afc557a..136e49a 100644 --- a/src/main/resources/diagnose.fxml +++ b/src/main/resources/diagnose.fxml @@ -7,6 +7,7 @@ + @@ -55,29 +56,32 @@ - - - + + + - - - - - - - + + + + + + + + + + diff --git a/src/main/resources/fall.fxml b/src/main/resources/fall.fxml index 5ebdb75..492b3bd 100644 --- a/src/main/resources/fall.fxml +++ b/src/main/resources/fall.fxml @@ -6,14 +6,16 @@ - + + + @@ -128,4 +133,7 @@ + + + diff --git a/src/main/resources/log.fxml b/src/main/resources/log.fxml index d2fe473..720960c 100644 --- a/src/main/resources/log.fxml +++ b/src/main/resources/log.fxml @@ -5,6 +5,7 @@ + @@ -21,4 +22,7 @@ + + + diff --git a/src/main/resources/main.fxml b/src/main/resources/main.fxml index 85fa615..d26217b 100644 --- a/src/main/resources/main.fxml +++ b/src/main/resources/main.fxml @@ -6,7 +6,8 @@ - + + @@ -81,4 +82,7 @@ + + + diff --git a/src/main/resources/patient_edit.fxml b/src/main/resources/patient_edit.fxml index d5eb6e5..ed79f0f 100644 --- a/src/main/resources/patient_edit.fxml +++ b/src/main/resources/patient_edit.fxml @@ -6,6 +6,7 @@ + @@ -104,8 +105,8 @@ @@ -128,11 +129,17 @@ + + + + + + diff --git a/src/main/resources/patient_tables.fxml b/src/main/resources/patient_tables.fxml index cf36915..4ab4bc2 100644 --- a/src/main/resources/patient_tables.fxml +++ b/src/main/resources/patient_tables.fxml @@ -6,6 +6,7 @@ + @@ -85,4 +86,7 @@ + + + diff --git a/src/main/resources/settings.fxml b/src/main/resources/settings.fxml index 1847269..9327d4d 100644 --- a/src/main/resources/settings.fxml +++ b/src/main/resources/settings.fxml @@ -7,6 +7,7 @@ + @@ -93,4 +94,7 @@ + + + diff --git a/src/main/resources/stationshistorie.fxml b/src/main/resources/stationshistorie.fxml index 8ad4d80..e72953c 100644 --- a/src/main/resources/stationshistorie.fxml +++ b/src/main/resources/stationshistorie.fxml @@ -43,26 +43,12 @@ -