| @@ -45,8 +45,11 @@ public class Main extends Application { | |||||
| fxmlLoader.setControllerFactory(mainController.getControllerFactory()); | fxmlLoader.setControllerFactory(mainController.getControllerFactory()); | ||||
| mainController.setOpsCodes(FXCollections.observableArrayList( | mainController.setOpsCodes(FXCollections.observableArrayList( | ||||
| new OpsCode("1234", "Hallo OPS", 20), | |||||
| new OpsCode("876-3", "Darmspiegelung", 20) | |||||
| DBHandler.getAllOpsCodes() | |||||
| )); | |||||
| mainController.setIcd10Codes(FXCollections.observableArrayList( | |||||
| DBHandler.getAllIcd10Codes() | |||||
| )); | )); | ||||
| mainController.setKassen(FXCollections.observableArrayList( | mainController.setKassen(FXCollections.observableArrayList( | ||||
| @@ -54,9 +57,11 @@ public class Main extends Application { | |||||
| )); | )); | ||||
| mainController.setMitarbeiter(FXCollections.observableArrayList( | mainController.setMitarbeiter(FXCollections.observableArrayList( | ||||
| //TODO | |||||
| DBHandler.getAllMitarbeiter() | |||||
| )); | )); | ||||
| mainController.setStationen(FXCollections.observableArrayList(DBHandler.getAllStationen())); | |||||
| mainController.setStationen(FXCollections.observableArrayList( | |||||
| DBHandler.getAllStationen()) | |||||
| ); | |||||
| Parent root = fxmlLoader.load(); | Parent root = fxmlLoader.load(); | ||||
| @@ -108,7 +108,7 @@ public class FallController { | |||||
| state.isNotEqualTo(State.VIEW) | state.isNotEqualTo(State.VIEW) | ||||
| ); | ); | ||||
| btnFallSave.visibleProperty().bind( | btnFallSave.visibleProperty().bind( | ||||
| state.isEqualTo(State.VIEW) | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | ); | ||||
| btnFallCancel.visibleProperty().bind( | btnFallCancel.visibleProperty().bind( | ||||
| @@ -145,7 +145,8 @@ public class FallController { | |||||
| @FXML | @FXML | ||||
| void clickedFallAbort(ActionEvent event) { | void clickedFallAbort(ActionEvent event) { | ||||
| this.state.set(State.VIEW); | |||||
| copyFallDataIntoField(fallProperty.get()); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| @@ -162,10 +163,15 @@ public class FallController { | |||||
| private void clearFields(){ | private void clearFields(){ | ||||
| dtTmAufnahme.setToCurrentDateTime(); | |||||
| dtTmEntlassung.setToCurrentDateTime(); | |||||
| if(state.get() == State.CREATE) { | |||||
| dtTmAufnahme.setToCurrentDateTime(); | |||||
| dtTmEntlassung.setToCurrentDateTime(); | |||||
| }else{ | |||||
| dtTmAufnahme.setDateTime(null); | |||||
| dtTmEntlassung.setDateTime(null); | |||||
| } | |||||
| fallPatID.setText("<todo>"); //TODO | |||||
| fallPatID.setText(""); //TODO | |||||
| fallCreateTime.setText("<auto>"); | fallCreateTime.setText("<auto>"); | ||||
| fallCreator.setText("<auto>"); | fallCreator.setText("<auto>"); | ||||
| @@ -186,10 +192,7 @@ public class FallController { | |||||
| private void copyFieldDataIntoFall(Fall fall){ | private void copyFieldDataIntoFall(Fall fall){ | ||||
| if(fall==null){ | |||||
| clearFields(); | |||||
| return; | |||||
| } | |||||
| fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | fall.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | ||||
| fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | fall.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | ||||
| @@ -209,14 +212,20 @@ public class FallController { | |||||
| private void copyFallDataIntoField(Fall fall){ | private void copyFallDataIntoField(Fall fall){ | ||||
| if(fall==null){ | |||||
| System.out.println("copyFallDataIntoFiled - Fall ist null"); | |||||
| clearFields(); | |||||
| return; | |||||
| } | |||||
| dtTmAufnahme.setDateTime(fall.getAufnahmeDatum()); | dtTmAufnahme.setDateTime(fall.getAufnahmeDatum()); | ||||
| dtTmEntlassung.setDateTime(fall.getEntlassungsDatum()); | dtTmEntlassung.setDateTime(fall.getEntlassungsDatum()); | ||||
| //fallPatID.setText(fall.getPatient().getVorname()+" "+fall.getPatient().getNachname()); //TODO | |||||
| fallPatID.setText(fallProperty.get().getPatient()+""); //(fall.getPatient().getVorname()+" "+fall.getPatient().getNachname()); //TODO | |||||
| fallCreateTime.setText(fall.getErstellDatumZeit().toString()); | |||||
| fallCreateTime.setText(fall.getErstellDatumZeit() !=null ? fall.getErstellDatumZeit().toString():""); | |||||
| fallCreator.setText(Integer.toString(fall.getErsteller())); | fallCreator.setText(Integer.toString(fall.getErsteller())); | ||||
| fallEditTime.setText(fall.getBearbeitetDatumZeit().toString()); | |||||
| fallEditTime.setText(fall.getBearbeitetDatumZeit()!=null? fall.getBearbeitetDatumZeit().toString():""); | |||||
| fallEditor.setText(Integer.toString(fall.getBearbeiter())); | fallEditor.setText(Integer.toString(fall.getBearbeiter())); | ||||
| // fallEinweisenderArzt.setText(fall.getEinweisenderArzt()); | // fallEinweisenderArzt.setText(fall.getEinweisenderArzt()); | ||||
| @@ -2,6 +2,7 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.*; | import de.uniluebeck.mi.projmi6.model.*; | ||||
| import javafx.beans.binding.Bindings; | |||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| @@ -80,7 +81,7 @@ public class MainController { | |||||
| private SplitPane fallOverview; | private SplitPane fallOverview; | ||||
| @FXML | @FXML | ||||
| private ListView lvFall; | |||||
| private ListView<Fall> lvFall; | |||||
| @FXML | @FXML | ||||
| private TabPane tabPaneFall; | private TabPane tabPaneFall; | ||||
| @@ -200,19 +201,51 @@ public class MainController { | |||||
| patientTablesController.selectedPatientProperty().addListener((observableValue,oldValue,newValue)-> { | patientTablesController.selectedPatientProperty().addListener((observableValue,oldValue,newValue)-> { | ||||
| System.out.println("Neuer Patient gewaehlt"); | |||||
| try { | |||||
| if(newValue==null){ | |||||
| lvFall.setItems(FXCollections.emptyObservableList()); | |||||
| return; | |||||
| } | |||||
| try { | |||||
| List<Fall> faelle = DBHandler.getFaelleByPatID(newValue.getPatID()); | List<Fall> faelle = DBHandler.getFaelleByPatID(newValue.getPatID()); | ||||
| System.out.println(faelle); | System.out.println(faelle); | ||||
| System.out.println("Liste der Faelle hat "+ faelle.size()+ " Eintrage "); | System.out.println("Liste der Faelle hat "+ faelle.size()+ " Eintrage "); | ||||
| lvFall.setItems(FXCollections.observableArrayList(faelle)); | lvFall.setItems(FXCollections.observableArrayList(faelle)); | ||||
| }catch (Exception e){ | }catch (Exception e){ | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| }); | }); | ||||
| fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | |||||
| lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | |||||
| /* untersuchungenController.untersuchungenProperty().bind( | |||||
| Bindings.createObjectBinding(() ->{ | |||||
| Fall selectedFall = lvFall.getSelectionModel().getSelectedItem(); | |||||
| System.out.println("Liste der Untersuchungen ...y"); | |||||
| if(selectedFall==null) return null; | |||||
| List<Untersuchung> untersuchungList = DBHandler.getUntersuchungByFall(selectedFall); | |||||
| System.out.println("Es sind "+untersuchungList.size()+" Untersuchungen vorhanden."); | |||||
| return FXCollections.observableArrayList(untersuchungList); | |||||
| }, lvFall.getSelectionModel().selectedIndexProperty()));*/ | |||||
| lvFall.getSelectionModel().selectedItemProperty().addListener(((observable, oldValue, newValue) -> { | |||||
| System.out.println("Changed choosen Fall"); | |||||
| if(newValue==null) return; | |||||
| try { | |||||
| List<Untersuchung> untersuchungList = DBHandler.getUntersuchungByFall(newValue); | |||||
| System.out.println("untersuchungenList"+untersuchungList); | |||||
| untersuchungenController.untersuchungenProperty().set(FXCollections.observableArrayList(untersuchungList)); | |||||
| }catch(Exception e){ | |||||
| e.printStackTrace(); | |||||
| } | |||||
| })); | |||||
| } | } | ||||
| @@ -226,4 +259,11 @@ public class MainController { | |||||
| fallController.createNewFall(); | fallController.createNewFall(); | ||||
| } | } | ||||
| @FXML | |||||
| private void creationComplete(){ | |||||
| tabFallDiagnose.setDisable(false); | |||||
| tabFallUntersuchungen.setDisable(false); | |||||
| tabFallStationsHistorie.setDisable(false); | |||||
| } | |||||
| } | } | ||||
| @@ -7,6 +7,8 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| import de.uniluebeck.mi.projmi6.Main; | import de.uniluebeck.mi.projmi6.Main; | ||||
| import de.uniluebeck.mi.projmi6.model.*; | import de.uniluebeck.mi.projmi6.model.*; | ||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.ObservableList; | |||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.*; | import javafx.scene.control.*; | ||||
| @@ -47,7 +49,7 @@ public class UntersuchungenController { | |||||
| private Label untsCreateTime; | private Label untsCreateTime; | ||||
| @FXML | @FXML | ||||
| private ListView<?> untsList; | |||||
| private ListView<Untersuchung> untsList; | |||||
| @FXML | @FXML | ||||
| private ComboBox<OpsCode> untsOpsCode; | private ComboBox<OpsCode> untsOpsCode; | ||||
| @@ -55,6 +57,20 @@ public class UntersuchungenController { | |||||
| @FXML | @FXML | ||||
| private ComboBox<Mitarbeiter> untsArzt; | private ComboBox<Mitarbeiter> untsArzt; | ||||
| public ObservableList<Untersuchung> getUntersuchungen() { | |||||
| return untersuchungen.get(); | |||||
| } | |||||
| public SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungenProperty() { | |||||
| return untersuchungen; | |||||
| } | |||||
| public void setUntersuchungen(ObservableList<Untersuchung> untersuchungen) { | |||||
| this.untersuchungen.set(untersuchungen); | |||||
| } | |||||
| private SimpleObjectProperty<ObservableList<Untersuchung>> untersuchungen = new SimpleObjectProperty<>(); | |||||
| public UntersuchungenController (MainController mainController){ | public UntersuchungenController (MainController mainController){ | ||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| @@ -108,9 +108,15 @@ public class DateTimePicker extends HBox { | |||||
| * @param localDateTime The date to be set in the view. | * @param localDateTime The date to be set in the view. | ||||
| */ | */ | ||||
| public void setDateTime(LocalDateTime localDateTime){ | public void setDateTime(LocalDateTime localDateTime){ | ||||
| hourText.setText(Integer.toString(localDateTime.getHour())); | |||||
| minuteText.setText(Integer.toString(localDateTime.getMinute())); | |||||
| datePicker.setValue(LocalDate.from(localDateTime)); | |||||
| if(localDateTime==null){ | |||||
| hourText.setText(""); | |||||
| minuteText.setText(""); | |||||
| datePicker.setValue(null); | |||||
| }else{ | |||||
| hourText.setText(Integer.toString(localDateTime.getHour())); | |||||
| minuteText.setText(Integer.toString(localDateTime.getMinute())); | |||||
| datePicker.setValue(LocalDate.from(localDateTime)); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||