| @@ -3,6 +3,7 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | /** | ||||
| * Created by 631806 on 12.11.15. | * Created by 631806 on 12.11.15. | ||||
| */ | */ | ||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.Diagnose; | import de.uniluebeck.mi.projmi6.model.Diagnose; | ||||
| import de.uniluebeck.mi.projmi6.model.Fall; | import de.uniluebeck.mi.projmi6.model.Fall; | ||||
| @@ -20,6 +21,8 @@ import javafx.scene.control.Label; | |||||
| import javafx.scene.control.TextField; | import javafx.scene.control.TextField; | ||||
| import javafx.scene.layout.GridPane; | import javafx.scene.layout.GridPane; | ||||
| import java.sql.SQLException; | |||||
| public class FallController { | public class FallController { | ||||
| private MainController mainController; | private MainController mainController; | ||||
| @@ -152,6 +155,21 @@ public class FallController { | |||||
| @FXML | @FXML | ||||
| void clickedFallSave(ActionEvent event) { | void clickedFallSave(ActionEvent event) { | ||||
| copyFieldDataIntoFall(fallProperty.get()); | |||||
| if (this.state.get() == State.CREATE) { | |||||
| try { | |||||
| DBHandler.setFall(fallProperty.get(), mainController.currentMitarbeiterProperty().get().getMitarbID()); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } else { | |||||
| try { | |||||
| DBHandler.setFall(fallProperty.get(), mainController.currentMitarbeiterProperty().get().getMitarbID(), true); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| mainController.fallCreationComplete(); | mainController.fallCreationComplete(); | ||||
| this.state.set(State.VIEW); | this.state.set(State.VIEW); | ||||
| //TODO Update/create in db | //TODO Update/create in db | ||||
| @@ -160,6 +178,9 @@ public class FallController { | |||||
| public void createNewFall() { | public void createNewFall() { | ||||
| clearFields(); | clearFields(); | ||||
| this.state.set(State.CREATE); | this.state.set(State.CREATE); | ||||
| // TODO: Jojo: Kannst Du das wieder heile machen? :D | |||||
| fallProperty.unbind(); | |||||
| fallProperty.set(new Fall()); | |||||
| } | } | ||||
| @@ -196,6 +217,8 @@ public class FallController { | |||||
| private void copyFieldDataIntoFall(Fall fall){ | private void copyFieldDataIntoFall(Fall fall){ | ||||
| // TODO: Jojo: Soll man das so machen? | |||||
| fall.setPatient(mainController.getPatientTablesController().getSelectedPatient()); | |||||
| fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | ||||
| fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | ||||