|
|
|
@@ -166,9 +166,14 @@ public class StationsHistorieController { |
|
|
|
|
|
|
|
@FXML |
|
|
|
private void clickedSave() { |
|
|
|
|
|
|
|
|
|
|
|
if (getState() == State.CREATE) { |
|
|
|
StationsHistorie stationsHistorie = new StationsHistorie(); |
|
|
|
copyFieldDataIntoStationsHistorie(stationsHistorie); |
|
|
|
if(!validateData(stationsHistorie)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
DBHandler.setStationsHistorie(stationsHistorie, false); |
|
|
|
} catch (SQLException e) { |
|
|
|
@@ -177,6 +182,9 @@ public class StationsHistorieController { |
|
|
|
mainController.refreshCaseData(); |
|
|
|
} else { |
|
|
|
copyFieldDataIntoStationsHistorie(stationsHistorieSelected); |
|
|
|
if(!validateData(stationsHistorieSelected)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
try { |
|
|
|
DBHandler.setStationsHistorie(stationsHistorieSelected, true); |
|
|
|
} catch (SQLException e) { |
|
|
|
@@ -290,11 +298,45 @@ public class StationsHistorieController { |
|
|
|
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); |
|
|
|
stationsHistorie.setStation(cmbStation.getValue()); |
|
|
|
stationsHistorie.setFallID(mainController.getFallController().getFall().getFallID()); |
|
|
|
stationsHistorie.setStationKey(cmbStation.getValue().getStation()); |
|
|
|
if(cmbStation.getValue()!= null){ |
|
|
|
stationsHistorie.setStationKey(cmbStation.getValue().getStation()); |
|
|
|
}else{ |
|
|
|
stationsHistorie.setStationKey(null); |
|
|
|
} |
|
|
|
stationsHistorie.setErsteller(mainController.getCurrentMitarbeiter().getMitarbID()); |
|
|
|
stationsHistorie.setBearbeiter(mainController.getCurrentMitarbeiter().getMitarbID()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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.initModality(Modality.APPLICATION_MODAL); |
|
|
|
alert.showAndWait(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean validateData(StationsHistorie stationsHistorie){ |
|
|
|
if(stationsHistorie.getStationKey()==null){ |
|
|
|
showMessage("Keine Station ausgew\00e4hlt!", "Bitte Station und nicht nur Abteilung ausw\00e4hlen!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if(stationsHistorie.getAufnahmeDatum()==null){ |
|
|
|
showMessage("Aufnahmedatum fehlt!", "Bitte den Beginn des Stationsaufenthalts angeben!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if(stationsHistorie.getEntlassungsDatum() != null && |
|
|
|
stationsHistorie.getAufnahmeDatum().isAfter(stationsHistorie.getEntlassungsDatum())){ |
|
|
|
showMessage("Aufnahmedatum liegt hinter Entlassungsdatum!", "Bitte die eingegebenen Daten nocheinmal kontrollieren!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
private void clearFields(){ |
|
|
|
|
|
|
|
statHistCreateTime.setText(""); |
|
|
|
|