| @@ -7,6 +7,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 de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.event.ActionEvent; | import javafx.event.ActionEvent; | ||||
| @@ -93,6 +94,16 @@ public class FallController { | |||||
| CREATE, EDIT, VIEW | CREATE, EDIT, VIEW | ||||
| } | } | ||||
| public State getState() { | |||||
| return state.get(); | |||||
| } | |||||
| public ReadOnlyObjectProperty<State> stateProperty() { | |||||
| return state; | |||||
| } | |||||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | ||||
| @@ -102,19 +113,8 @@ public class FallController { | |||||
| fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); | fallFallart.setItems(FXCollections.observableArrayList(FallArt.values())); | ||||
| fallKasse.setItems(mainController.getStammdaten().getKassen()); | fallKasse.setItems(mainController.getStammdaten().getKassen()); | ||||
| btnFallEnableEdit.visibleProperty().bind( | |||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||||
| ); | |||||
| btnFallAbort.visibleProperty().bind( | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | |||||
| btnFallSave.visibleProperty().bind( | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | |||||
| btnFallCancel.visibleProperty().bind( | |||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||||
| ); | |||||
| initButtons(); | |||||
| fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); | fallFields.disableProperty().bind(state.isEqualTo(State.VIEW)); | ||||
| @@ -123,8 +123,40 @@ public class FallController { | |||||
| copyFallDataIntoField(fallProperty.get()); | copyFallDataIntoField(fallProperty.get()); | ||||
| } | } | ||||
| })); | })); | ||||
| state.addListener((observable, oldValue, newValue) -> { | |||||
| if(newValue==State.EDIT || newValue == State.CREATE){ | |||||
| mainController.lockForEdit(MainController.TabName.OVERVIEW); | |||||
| }else{ | |||||
| mainController.unlockFromEdit(); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| /** | |||||
| * Hide the buttons depending on controller state. | |||||
| */ | |||||
| private void initButtons(){ | |||||
| btnFallEnableEdit.managedProperty().bind( | |||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||||
| ); | |||||
| btnFallEnableEdit.visibleProperty().bind(btnFallEnableEdit.managedProperty()); | |||||
| btnFallAbort.managedProperty().bind( | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | |||||
| btnFallAbort.visibleProperty().bind(btnFallAbort.managedProperty()); | |||||
| btnFallSave.managedProperty().bind( | |||||
| state.isNotEqualTo(State.VIEW) | |||||
| ); | |||||
| btnFallSave.visibleProperty().bind(btnFallSave.managedProperty()); | |||||
| btnFallCancel.managedProperty().bind( | |||||
| state.isEqualTo(State.VIEW).and(fallProperty.isNotNull()) | |||||
| ); | |||||
| btnFallCancel.visibleProperty().bind(btnFallCancel.managedProperty()); | |||||
| } | |||||
| public void editFall(){ | public void editFall(){ | ||||
| @@ -139,15 +171,13 @@ public class FallController { | |||||
| @FXML | @FXML | ||||
| void clickedFallCancel(ActionEvent event) { | void clickedFallCancel(ActionEvent event) { | ||||
| this.state.set(State.VIEW); | |||||
| copyFallDataIntoField(fallProperty.get()); | |||||
| //Fall Stornieren... | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| void clickedFallAbort(ActionEvent event) { | void clickedFallAbort(ActionEvent event) { | ||||
| this.state.set(State.VIEW); | this.state.set(State.VIEW); | ||||
| copyFallDataIntoField(fallProperty.get()); | copyFallDataIntoField(fallProperty.get()); | ||||
| mainController.fallCreationComplete(); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| @@ -157,21 +187,20 @@ public class FallController { | |||||
| copyFieldDataIntoFall(fall); | copyFieldDataIntoFall(fall); | ||||
| try { | try { | ||||
| DBHandler.setFall(fall, mainController.getCurrentMitarbeiter().getMitarbID()); | DBHandler.setFall(fall, mainController.getCurrentMitarbeiter().getMitarbID()); | ||||
| //TODO Reload Faelle for Patient im MainController | |||||
| } catch (SQLException e) { | } catch (SQLException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } else { | } else { | ||||
| try { | try { | ||||
| DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true); | DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true); | ||||
| } catch (SQLException e) { | } catch (SQLException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| } | } | ||||
| } | } | ||||
| mainController.fallCreationComplete(); | |||||
| this.state.set(State.VIEW); | this.state.set(State.VIEW); | ||||
| //TODO Update/create in db | |||||
| mainController.refreshCasesFromDb(mainController.getPatientTablesController().getSelectedPatient()); | |||||
| } | } | ||||
| public void createNewFall() { | public void createNewFall() { | ||||
| @@ -188,10 +217,6 @@ public class FallController { | |||||
| } | } | ||||
| } | } | ||||
| fallVersichertennummer.setText(patient.getVersichertennummer()); | fallVersichertennummer.setText(patient.getVersichertennummer()); | ||||
| // TODO: Jojo: Kannst Du das wieder heile machen? :D | |||||
| // fallProperty.unbind(); | |||||
| // fallProperty.set(new Fall()); | |||||
| } | } | ||||
| @@ -208,10 +233,10 @@ public class FallController { | |||||
| fallPatID.setText(""); //TODO | fallPatID.setText(""); //TODO | ||||
| fallCreateTime.setText("<auto>"); | |||||
| fallCreator.setText("<auto>"); | |||||
| fallEditTime.setText("<auto>"); | |||||
| fallEditor.setText("<auto>"); | |||||
| fallCreateTime.setText(""); | |||||
| fallCreator.setText(""); | |||||
| fallEditTime.setText(""); | |||||
| fallEditor.setText(""); | |||||
| fallEinweisenderArzt.setText(""); | fallEinweisenderArzt.setText(""); | ||||
| fallSelbsteinweisung.setSelected(false); | fallSelbsteinweisung.setSelected(false); | ||||
| @@ -234,7 +259,7 @@ public class FallController { | |||||
| fall.setSelbsteinweisung(true); | fall.setSelbsteinweisung(true); | ||||
| fall.setEinweisenderArzt(null); | fall.setEinweisenderArzt(null); | ||||
| }else{ | }else{ | ||||
| // fall.setEinweisenderArzt(fallEinweisenderArzt.getText()); TODO | |||||
| //fall.setEinweisenderArzt(fallEinweisenderArzt.getText()); TODO | |||||
| fall.setSelbsteinweisung(false); | fall.setSelbsteinweisung(false); | ||||
| } | } | ||||
| fall.setVersichertenNummer(fallVersichertennummer.getText()); | fall.setVersichertenNummer(fallVersichertennummer.getText()); | ||||
| @@ -29,9 +29,6 @@ public class MainController { | |||||
| private UntersuchungenController untersuchungenController; | private UntersuchungenController untersuchungenController; | ||||
| private int parallelTaskCount = 0; | private int parallelTaskCount = 0; | ||||
| @FXML | @FXML | ||||
| @@ -53,35 +50,35 @@ public class MainController { | |||||
| private TabPane tabPaneFall; | private TabPane tabPaneFall; | ||||
| @FXML | @FXML | ||||
| private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie ; | |||||
| private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie; | |||||
| private Stammdaten stammdaten = new Stammdaten(); | private Stammdaten stammdaten = new Stammdaten(); | ||||
| private Callback<Class<?>, Object> controllerFactory = clazz -> { | private Callback<Class<?>, Object> controllerFactory = clazz -> { | ||||
| if(clazz.equals(MainController.class)) { | |||||
| if (clazz.equals(MainController.class)) { | |||||
| return this; | return this; | ||||
| }else if(clazz.equals(FallController.class)){ | |||||
| } else if (clazz.equals(FallController.class)) { | |||||
| return fallController; | return fallController; | ||||
| }else if(clazz.equals(DiagnoseController.class)){ | |||||
| } else if (clazz.equals(DiagnoseController.class)) { | |||||
| return diagnoseController; | return diagnoseController; | ||||
| }else if(clazz.equals(PatientTablesController.class)){ | |||||
| } else if (clazz.equals(PatientTablesController.class)) { | |||||
| return patientTablesController; | return patientTablesController; | ||||
| }else if(clazz.equals(SettingsController.class)){ | |||||
| return settingsController; | |||||
| } else if(clazz.equals(UntersuchungenController.class)) { | |||||
| } else if (clazz.equals(SettingsController.class)) { | |||||
| return settingsController; | |||||
| } else if (clazz.equals(UntersuchungenController.class)) { | |||||
| return untersuchungenController; | return untersuchungenController; | ||||
| }else if(clazz.equals(StationsHistorieController.class)){ | |||||
| } else if (clazz.equals(StationsHistorieController.class)) { | |||||
| return stationsHistorieController; | return stationsHistorieController; | ||||
| }else { | |||||
| System.err.println("Keine Controller-Klasse des Typs "+clazz+" gefunden!!!"); | |||||
| } else { | |||||
| System.err.println("Keine Controller-Klasse des Typs " + clazz + " gefunden!!!"); | |||||
| return null; | return null; | ||||
| } | } | ||||
| }; | }; | ||||
| public MainController(){ | |||||
| public MainController() { | |||||
| fallController = new FallController(this); | fallController = new FallController(this); | ||||
| diagnoseController = new DiagnoseController(this); | diagnoseController = new DiagnoseController(this); | ||||
| patientTablesController = new PatientTablesController(this); | patientTablesController = new PatientTablesController(this); | ||||
| @@ -91,47 +88,45 @@ public class MainController { | |||||
| } | } | ||||
| public Stammdaten getStammdaten(){ | |||||
| return stammdaten; | |||||
| public Stammdaten getStammdaten() { | |||||
| return stammdaten; | |||||
| } | } | ||||
| public Callback<Class<?>, Object> getControllerFactory(){ | |||||
| public Callback<Class<?>, Object> getControllerFactory() { | |||||
| return controllerFactory; | return controllerFactory; | ||||
| } | } | ||||
| public FallController getFallController(){ | |||||
| public FallController getFallController() { | |||||
| return fallController; | return fallController; | ||||
| } | } | ||||
| public DiagnoseController getDiagnoseController(){ | |||||
| public DiagnoseController getDiagnoseController() { | |||||
| return diagnoseController; | return diagnoseController; | ||||
| } | } | ||||
| public PatientTablesController getPatientTablesController(){ | |||||
| return patientTablesController; | |||||
| public PatientTablesController getPatientTablesController() { | |||||
| return patientTablesController; | |||||
| } | } | ||||
| public SettingsController getSettingsController(){ | |||||
| public SettingsController getSettingsController() { | |||||
| return settingsController; | return settingsController; | ||||
| } | } | ||||
| public UntersuchungenController getUntersuchungenController(){ | |||||
| return untersuchungenController; | |||||
| public UntersuchungenController getUntersuchungenController() { | |||||
| return untersuchungenController; | |||||
| } | } | ||||
| public void increaseParallelTaskCount(){ | |||||
| public void increaseParallelTaskCount() { | |||||
| parallelTaskCount++; | parallelTaskCount++; | ||||
| if(parallelTaskCount>0 && progressIndicator!=null){ | |||||
| if (parallelTaskCount > 0 && progressIndicator != null) { | |||||
| progressIndicator.setVisible(true); | progressIndicator.setVisible(true); | ||||
| } | } | ||||
| } | } | ||||
| public void decreaseParallelTaskCount(){ | |||||
| public void decreaseParallelTaskCount() { | |||||
| parallelTaskCount--; | parallelTaskCount--; | ||||
| if(parallelTaskCount<=0 && progressIndicator!=null){ | |||||
| if (parallelTaskCount <= 0 && progressIndicator != null) { | |||||
| parallelTaskCount = 0; | parallelTaskCount = 0; | ||||
| progressIndicator.setVisible(false); | progressIndicator.setVisible(false); | ||||
| } | } | ||||
| @@ -142,36 +137,32 @@ public class MainController { | |||||
| private Label lvFallPlaceholder; | private Label lvFallPlaceholder; | ||||
| private Task<List<Fall>> loadFallTask = null; | private Task<List<Fall>> loadFallTask = null; | ||||
| private ChangeListener<Patient> onPatientChanged = (observableValue,oldValue,newValue)-> { | |||||
| public void refreshCasesFromDb(Patient patient) { | |||||
| lvFall.setItems(null); //clear list | lvFall.setItems(null); //clear list | ||||
| if(newValue==null){ // If no patient is selected | |||||
| if (patient == null) { // If no patient is selected | |||||
| lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | ||||
| return; | return; | ||||
| } | } | ||||
| if(loadFallTask!=null && loadFallTask.isRunning()){ | |||||
| if (loadFallTask != null && loadFallTask.isRunning()) { | |||||
| loadFallTask.cancel(); | loadFallTask.cancel(); | ||||
| } | } | ||||
| loadFallTask = new Task<List<Fall>>() { | loadFallTask = new Task<List<Fall>>() { | ||||
| @Override | @Override | ||||
| protected List<Fall> call() throws Exception { | protected List<Fall> call() throws Exception { | ||||
| return DBHandler.getFaelleByPatID(newValue.getPatID()); | |||||
| return DBHandler.getFaelleByPatID(patient.getPatID()); | |||||
| } | } | ||||
| @Override | @Override | ||||
| protected void succeeded() { | protected void succeeded() { | ||||
| super.succeeded(); | super.succeeded(); | ||||
| if(isCancelled()){ | |||||
| System.out.println("Task wurde gecancelt"); | |||||
| if (isCancelled()) { | |||||
| return; | return; | ||||
| } | } | ||||
| lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | lvFallPlaceholder.setText("Keine F\u00e4lle vorhanden!"); | ||||
| @@ -199,20 +190,24 @@ public class MainController { | |||||
| Thread thread = new Thread(loadFallTask); | Thread thread = new Thread(loadFallTask); | ||||
| thread.setDaemon(true); | thread.setDaemon(true); | ||||
| thread.start(); | thread.start(); | ||||
| }; | |||||
| } | |||||
| @FXML | @FXML | ||||
| private void initialize(){ | |||||
| private void initialize() { | |||||
| //Init user data. | //Init user data. | ||||
| cmbUserChoose.itemsProperty().bind(this.getStammdaten().mitarbeiterProperty()); | cmbUserChoose.itemsProperty().bind(this.getStammdaten().mitarbeiterProperty()); | ||||
| cmbUserChoose.getSelectionModel().select(0); // TODO: Bessere Loesung finden. | cmbUserChoose.getSelectionModel().select(0); // TODO: Bessere Loesung finden. | ||||
| //Disable the right side if no case is selected. | //Disable the right side if no case is selected. | ||||
| fallOverview.disableProperty().bind(patientTablesController.selectedPatientProperty().isNull()); | |||||
| fallOverview.disableProperty().bind(patientTablesController.selectedPatientProperty().isNull() | |||||
| .and(fallController.stateProperty().isNotEqualTo(FallController.State.CREATE))); | |||||
| //Load the cases async if patient changes | //Load the cases async if patient changes | ||||
| patientTablesController.selectedPatientProperty().addListener(onPatientChanged); | |||||
| patientTablesController.selectedPatientProperty().addListener((observableValue, oldValue, newValue) -> { | |||||
| refreshCasesFromDb(newValue); | |||||
| }); | |||||
| lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | lvFall.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); | ||||
| @@ -220,19 +215,19 @@ public class MainController { | |||||
| fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | fallController.fallPropertyProperty().bind(lvFall.getSelectionModel().selectedItemProperty()); | ||||
| lvFall.getSelectionModel().selectedItemProperty().addListener(onCaseChanged); | |||||
| lvFall.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) ->{ | |||||
| refreshCaseData(newValue); | |||||
| }); | |||||
| } | } | ||||
| private Task<Void> loadCaseData = null; | private Task<Void> loadCaseData = null; | ||||
| private ChangeListener<Fall> onCaseChanged = (observable, oldValue, newValue) -> { | |||||
| if(loadCaseData!=null && loadCaseData.isRunning()){ | |||||
| private void refreshCaseData(Fall fall){ | |||||
| if (loadCaseData != null && loadCaseData.isRunning()) { | |||||
| loadCaseData.cancel(); | loadCaseData.cancel(); | ||||
| } | } | ||||
| @@ -241,42 +236,43 @@ public class MainController { | |||||
| tabFallStationsHistorie.setDisable(true); | tabFallStationsHistorie.setDisable(true); | ||||
| tabFallUntersuchungen.setDisable(true); | tabFallUntersuchungen.setDisable(true); | ||||
| if(newValue==null) { | |||||
| if (fall == null) { | |||||
| tabPaneFall.setDisable(true); | tabPaneFall.setDisable(true); | ||||
| System.out.println("TODO: Clear tables cuz fall = null!"); | System.out.println("TODO: Clear tables cuz fall = null!"); | ||||
| //fallController.c | //fallController.c | ||||
| return; | return; | ||||
| } | } | ||||
| if(newValue==null){ // If no patient is selected | |||||
| if (fall == null) { // If no patient is selected | |||||
| //lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | //lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); | ||||
| return; | return; | ||||
| } | } | ||||
| loadCaseData = new Task<Void>() { | loadCaseData = new Task<Void>() { | ||||
| List<Untersuchung> untersuchungList; | List<Untersuchung> untersuchungList; | ||||
| List<Diagnose> diagnoseList; | List<Diagnose> diagnoseList; | ||||
| List<StationsHistorie> stationsHistorieList; | List<StationsHistorie> stationsHistorieList; | ||||
| @Override | @Override | ||||
| protected Void call() throws Exception { | protected Void call() throws Exception { | ||||
| untersuchungList = DBHandler.getUntersuchungByFall(newValue); | |||||
| diagnoseList = DBHandler.getDiagnosenByFall(newValue); | |||||
| //stationsHistorieList = | |||||
| untersuchungList = DBHandler.getUntersuchungByFall(fall); | |||||
| diagnoseList = DBHandler.getDiagnosenByFall(fall); | |||||
| stationsHistorieList = DBHandler.getStationsHistorieByFall(fall); | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | @Override | ||||
| protected void succeeded() { | protected void succeeded() { | ||||
| super.succeeded(); | super.succeeded(); | ||||
| if(isCancelled()){ | |||||
| if (isCancelled()) { | |||||
| System.out.println("Task wurde gecancelt"); | System.out.println("Task wurde gecancelt"); | ||||
| return; | return; | ||||
| } | } | ||||
| untersuchungenController.setUntersuchungen(FXCollections.observableArrayList(untersuchungList)); | untersuchungenController.setUntersuchungen(FXCollections.observableArrayList(untersuchungList)); | ||||
| diagnoseController.setDiagnosen(FXCollections.observableArrayList(diagnoseList)); | diagnoseController.setDiagnosen(FXCollections.observableArrayList(diagnoseList)); | ||||
| stationsHistorieController.setStationsHistorie(FXCollections.observableArrayList(stationsHistorieList)); | |||||
| tabPaneFall.setDisable(false); | tabPaneFall.setDisable(false); | ||||
| tabFallDiagnose.setDisable(false); | tabFallDiagnose.setDisable(false); | ||||
| @@ -304,33 +300,81 @@ public class MainController { | |||||
| thread.setDaemon(true); | thread.setDaemon(true); | ||||
| thread.start(); | thread.start(); | ||||
| increaseParallelTaskCount(); | increaseParallelTaskCount(); | ||||
| }; | |||||
| } | |||||
| public void refreshCaseData(){ | |||||
| refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); | |||||
| } | |||||
| @FXML | @FXML | ||||
| private void clickedCreateFall(){ | |||||
| private void clickedCreateFall() { | |||||
| // tabFallDiagnose.setDisable(true); | |||||
| // tabFallUntersuchungen.setDisable(true); | |||||
| // tabFallStationsHistorie.setDisable(true); | |||||
| // tabPaneFall.getSelectionModel().select(tabFallOverview); | |||||
| // patientTablesController.getPatientOverviewTabPane().setDisable(true); | |||||
| // | |||||
| // | |||||
| fallController.createNewFall(); | |||||
| lockForEdit(TabName.OVERVIEW); | |||||
| } | |||||
| public Fall getFall(){ | |||||
| return lvFall.getSelectionModel().getSelectedItem(); | |||||
| } | |||||
| public enum TabName { | |||||
| OVERVIEW, DIAGNOSE, UNTERSUCHUNG, STATIONSHISTORIE; | |||||
| } | |||||
| public void lockForEdit(TabName exclude) { | |||||
| tabFallDiagnose.setDisable(true); | tabFallDiagnose.setDisable(true); | ||||
| tabFallUntersuchungen.setDisable(true); | tabFallUntersuchungen.setDisable(true); | ||||
| tabFallStationsHistorie.setDisable(true); | tabFallStationsHistorie.setDisable(true); | ||||
| tabPaneFall.getSelectionModel().select(tabFallOverview); | |||||
| tabFallOverview.setDisable(true); | |||||
| lvFall.setDisable(true); | |||||
| btnFallCreate.setDisable(true); | |||||
| patientTablesController.getPatientOverviewTabPane().setDisable(true); | patientTablesController.getPatientOverviewTabPane().setDisable(true); | ||||
| switch (exclude) { | |||||
| case OVERVIEW: | |||||
| tabFallOverview.setDisable(false); | |||||
| break; | |||||
| case DIAGNOSE: | |||||
| tabFallDiagnose.setDisable(false); | |||||
| break; | |||||
| case UNTERSUCHUNG: | |||||
| tabFallUntersuchungen.setDisable(false); | |||||
| break; | |||||
| case STATIONSHISTORIE: | |||||
| tabFallStationsHistorie.setDisable(false); | |||||
| default: | |||||
| break; | |||||
| } | |||||
| fallController.createNewFall(); | |||||
| } | } | ||||
| public void fallCreationComplete(){ | |||||
| public void unlockFromEdit() { | |||||
| tabFallDiagnose.setDisable(false); | tabFallDiagnose.setDisable(false); | ||||
| tabFallUntersuchungen.setDisable(false); | tabFallUntersuchungen.setDisable(false); | ||||
| tabFallStationsHistorie.setDisable(false); | tabFallStationsHistorie.setDisable(false); | ||||
| tabFallOverview.setDisable(false); | |||||
| patientTablesController.getPatientOverviewTabPane().setDisable(false); | patientTablesController.getPatientOverviewTabPane().setDisable(false); | ||||
| lvFall.setDisable(false); | |||||
| btnFallCreate.setDisable(false); | |||||
| } | } | ||||
| public Mitarbeiter getCurrentMitarbeiter(){ | |||||
| public Mitarbeiter getCurrentMitarbeiter() { | |||||
| return cmbUserChoose.getValue(); | return cmbUserChoose.getValue(); | ||||
| } | } | ||||
| public ReadOnlyObjectProperty<Mitarbeiter> currentMitarbeiterProperty(){ | |||||
| public ReadOnlyObjectProperty<Mitarbeiter> currentMitarbeiterProperty() { | |||||
| return cmbUserChoose.valueProperty(); | return cmbUserChoose.valueProperty(); | ||||
| } | } | ||||
| @@ -0,0 +1,47 @@ | |||||
| package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | |||||
| * Created by 630030 on 19.11.15. | |||||
| */ | |||||
| import java.io.IOException; | |||||
| import java.util.Map; | |||||
| import ca.uhn.hl7v2.DefaultHapiContext; | |||||
| import ca.uhn.hl7v2.HL7Exception; | |||||
| import ca.uhn.hl7v2.model.Message; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplication; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationException; | |||||
| /** | |||||
| * Application class for receiving ADT^A01 messages | |||||
| */ | |||||
| public class OurReceiverApplication implements ReceivingApplication | |||||
| { | |||||
| /** | |||||
| * {@inheritDoc} | |||||
| */ | |||||
| public boolean canProcess(Message theIn) { | |||||
| return true; | |||||
| } | |||||
| /** | |||||
| * {@inheritDoc} | |||||
| */ | |||||
| public Message processMessage(Message message, Map<String, Object> theMetadata) throws ReceivingApplicationException, HL7Exception { | |||||
| String encodedMessage = new DefaultHapiContext().getPipeParser().encode(message); | |||||
| System.out.println("Received message:\n" + encodedMessage + "\n\n"); | |||||
| // Now generate a simple acknowledgment message and return it | |||||
| try { | |||||
| return message.generateACK(); | |||||
| } catch (IOException e) { | |||||
| throw new HL7Exception(e); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -3,19 +3,16 @@ package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | /** | ||||
| * Created by Johannes on 12.11.15. | * Created by Johannes on 12.11.15. | ||||
| */ | */ | ||||
| import ca.uhn.hl7v2.model.v251.segment.LOC; | |||||
| import com.sun.org.apache.bcel.internal.generic.LoadClass; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | import de.uniluebeck.mi.projmi6.db.DBHandler; | ||||
| import de.uniluebeck.mi.projmi6.model.Patient; | import de.uniluebeck.mi.projmi6.model.Patient; | ||||
| import de.uniluebeck.mi.projmi6.model.Station; | import de.uniluebeck.mi.projmi6.model.Station; | ||||
| import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; | import de.uniluebeck.mi.projmi6.model.StationsUebersichtsItem; | ||||
| import javafx.beans.binding.Bindings; | import javafx.beans.binding.Bindings; | ||||
| import javafx.beans.binding.ObjectBinding; | import javafx.beans.binding.ObjectBinding; | ||||
| import javafx.beans.property.ObjectProperty; | |||||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.FXCollections; | import javafx.collections.FXCollections; | ||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| import javafx.collections.transformation.FilteredList; | |||||
| import javafx.concurrent.Task; | import javafx.concurrent.Task; | ||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||
| @@ -28,112 +25,86 @@ import javafx.stage.Modality; | |||||
| import javafx.stage.Stage; | import javafx.stage.Stage; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.rmi.server.ExportException; | |||||
| import java.sql.SQLException; | |||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||
| import java.time.LocalDateTime; | |||||
| import java.util.List; | import java.util.List; | ||||
| /** | /** | ||||
| * Controller class. | * Controller class. | ||||
| */ | */ | ||||
| public class PatientTablesController{ | |||||
| public class PatientTablesController { | |||||
| @FXML | |||||
| Button btnStatRefresh; | |||||
| private MainController mainController; | private MainController mainController; | ||||
| @FXML | @FXML | ||||
| private Label lblTablePatientEmpty; | private Label lblTablePatientEmpty; | ||||
| @FXML | @FXML | ||||
| private Label lblTableStationEmpty; | private Label lblTableStationEmpty; | ||||
| @FXML | @FXML | ||||
| private Button btnPatCreate; | private Button btnPatCreate; | ||||
| @FXML | @FXML | ||||
| private Button btnPatEdit; | private Button btnPatEdit; | ||||
| @FXML | @FXML | ||||
| private TableView<Patient> tblPatientOverview; | private TableView<Patient> tblPatientOverview; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatPatId; | private TableColumn<Patient, String> colPatPatId; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatGeburtsname; | private TableColumn<Patient, String> colPatGeburtsname; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatNachname; | private TableColumn<Patient, String> colPatNachname; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatVorname; | private TableColumn<Patient, String> colPatVorname; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, LocalDate> colPatGebDatum; | private TableColumn<Patient, LocalDate> colPatGebDatum; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatStrasse; | private TableColumn<Patient, String> colPatStrasse; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatPlz; | private TableColumn<Patient, String> colPatPlz; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatOrt; | private TableColumn<Patient, String> colPatOrt; | ||||
| @FXML | @FXML | ||||
| private TableColumn<Patient, String> colPatCave; | private TableColumn<Patient, String> colPatCave; | ||||
| @FXML | @FXML | ||||
| private ToggleButton btnEntlassenePatientenZeigen; | private ToggleButton btnEntlassenePatientenZeigen; | ||||
| @FXML | @FXML | ||||
| private ComboBox<Station> cmbStationenFilter; | private ComboBox<Station> cmbStationenFilter; | ||||
| @FXML | @FXML | ||||
| private TableView<StationsUebersichtsItem> tblStationOverview; | private TableView<StationsUebersichtsItem> tblStationOverview; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, Integer> colStatPatId; | private TableColumn<StationsUebersichtsItem, Integer> colStatPatId; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, String> colStatFullName; | private TableColumn<StationsUebersichtsItem, String> colStatFullName; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatGebDatum; | private TableColumn<StationsUebersichtsItem, LocalDate> colStatGebDatum; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, Integer> colStatAlter; | private TableColumn<StationsUebersichtsItem, Integer> colStatAlter; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatAufnahmedatum; | private TableColumn<StationsUebersichtsItem, LocalDate> colStatAufnahmedatum; | ||||
| @FXML | @FXML | ||||
| private TableColumn<StationsUebersichtsItem, LocalDate> colStatEntlassungsdatum; | private TableColumn<StationsUebersichtsItem, LocalDate> colStatEntlassungsdatum; | ||||
| @FXML | @FXML | ||||
| private Tab stationOverviewTab; | private Tab stationOverviewTab; | ||||
| public TabPane getPatientOverviewTabPane() { | |||||
| return patientOverviewTabPane; | |||||
| } | |||||
| @FXML | @FXML | ||||
| private Tab patientOverviewTab; | private Tab patientOverviewTab; | ||||
| @FXML | @FXML | ||||
| private TabPane patientOverviewTabPane; | |||||
| private TabPane patientOverviewTabPane; | |||||
| private ObservableList<StationsUebersichtsItem> stationsUebersicht = FXCollections.observableArrayList(); | |||||
| private FilteredList<StationsUebersichtsItem> stationsUebersichtsItemFilteredList = new FilteredList<StationsUebersichtsItem>(stationsUebersicht, | |||||
| item -> item.getStationEntlassung() == null || !item.getStationEntlassung().isAfter(LocalDate.now())); | |||||
| private Task loadStationsHistorieTask = null; | |||||
| private Task loadPatientTask = null; | |||||
| @FXML | |||||
| private Button btnPatRefresh; | |||||
| private ObjectBinding<Patient> patientObjectBinding = null; | |||||
| public PatientTablesController(MainController mainController){ | |||||
| public PatientTablesController(MainController mainController) { | |||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| public TabPane getPatientOverviewTabPane() { | |||||
| return patientOverviewTabPane; | |||||
| } | |||||
| @FXML | @FXML | ||||
| public void initialize() { | public void initialize() { | ||||
| @@ -141,34 +112,41 @@ public class PatientTablesController{ | |||||
| tblPatientOverview.setRowFactory(tableView -> { | tblPatientOverview.setRowFactory(tableView -> { | ||||
| TableRow<Patient> tableRow = new TableRow<>(); | TableRow<Patient> tableRow = new TableRow<>(); | ||||
| tableRow.setOnMouseClicked(event -> { | tableRow.setOnMouseClicked(event -> { | ||||
| if(event.getClickCount()==2 && (!tableRow.isEmpty())){ | |||||
| if (event.getClickCount() == 2 && (!tableRow.isEmpty())) { | |||||
| Patient patient = tableRow.getItem(); | Patient patient = tableRow.getItem(); | ||||
| showEditWindow(patient); | showEditWindow(patient); | ||||
| } | } | ||||
| }); | }); | ||||
| return tableRow; | |||||
| return tableRow; | |||||
| }); | }); | ||||
| lblTablePatientEmpty.setText("Liste ist leer."); | lblTablePatientEmpty.setText("Liste ist leer."); | ||||
| lblTableStationEmpty.setText("Daten werden geladen..."); | |||||
| tblStationOverview.disableProperty().bind(cmbStationenFilter.valueProperty().isNull()); | |||||
| cmbStationenFilter.itemsProperty().bind(mainController.getStammdaten().stationenProperty()); | cmbStationenFilter.itemsProperty().bind(mainController.getStammdaten().stationenProperty()); | ||||
| patientObjectBinding = Bindings.<Patient>createObjectBinding(() ->{ | |||||
| return patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab) | |||||
| ? tblPatientOverview.getSelectionModel().getSelectedItem() | |||||
| : null; //(Patient)tblStationOverview.getSelectionModel().getSelectedItem(); //TODO | |||||
| patientObjectBinding = Bindings.<Patient>createObjectBinding(() -> { | |||||
| if (patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)) { | |||||
| return tblPatientOverview.getSelectionModel().getSelectedItem(); | |||||
| } else if (tblStationOverview.getSelectionModel().getSelectedItem() == null) { | |||||
| return null; | |||||
| } else { | |||||
| int selectedPatId = tblStationOverview.getSelectionModel().getSelectedItem().getPatId(); | |||||
| Patient selectedPatient = tblPatientOverview.getItems().stream().filter(p -> p.getPatID() == selectedPatId).findFirst().orElse(null); | |||||
| return selectedPatient; | |||||
| } | |||||
| }, tblPatientOverview.getSelectionModel().selectedItemProperty(), | }, tblPatientOverview.getSelectionModel().selectedItemProperty(), | ||||
| tblStationOverview.getSelectionModel().selectedItemProperty(), | tblStationOverview.getSelectionModel().selectedItemProperty(), | ||||
| patientOverviewTabPane.getSelectionModel().selectedItemProperty()); | patientOverviewTabPane.getSelectionModel().selectedItemProperty()); | ||||
| initColumnsPatient(); | initColumnsPatient(); | ||||
| initColumnsStation(); | initColumnsStation(); | ||||
| updatePatientsFromDb(); | updatePatientsFromDb(); | ||||
| } | } | ||||
| private void initColumnsPatient(){ | |||||
| private void initColumnsPatient() { | |||||
| colPatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIDProperty().asString()); | colPatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIDProperty().asString()); | ||||
| colPatGeburtsname.setCellValueFactory(new PropertyValueFactory<>("geburtsname")); | colPatGeburtsname.setCellValueFactory(new PropertyValueFactory<>("geburtsname")); | ||||
| colPatNachname.setCellValueFactory(new PropertyValueFactory<>("nachname")); | colPatNachname.setCellValueFactory(new PropertyValueFactory<>("nachname")); | ||||
| @@ -176,15 +154,14 @@ public class PatientTablesController{ | |||||
| colPatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().geburtsdatumProperty()); | colPatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().geburtsdatumProperty()); | ||||
| colPatStrasse.setCellValueFactory(cellDataFeatures -> { | colPatStrasse.setCellValueFactory(cellDataFeatures -> { | ||||
| Patient patient = cellDataFeatures.getValue(); | Patient patient = cellDataFeatures.getValue(); | ||||
| return Bindings.concat(patient.strasseProperty(), " ", patient.hausnummerProperty()); | |||||
| return Bindings.concat(patient.strasseProperty(), " ", patient.hausnummerProperty()); | |||||
| }); | }); | ||||
| colPatPlz.setCellValueFactory(new PropertyValueFactory<>("plz")); | colPatPlz.setCellValueFactory(new PropertyValueFactory<>("plz")); | ||||
| colPatOrt.setCellValueFactory(new PropertyValueFactory<>("ort")); | colPatOrt.setCellValueFactory(new PropertyValueFactory<>("ort")); | ||||
| colPatCave.setCellValueFactory(new PropertyValueFactory<>("cave")); | colPatCave.setCellValueFactory(new PropertyValueFactory<>("cave")); | ||||
| } | } | ||||
| private void initColumnsStation(){ | |||||
| private void initColumnsStation() { | |||||
| colStatPatId.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patId")); | colStatPatId.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patId")); | ||||
| colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); | colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); | ||||
| colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty()); | colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty()); | ||||
| @@ -193,46 +170,45 @@ public class PatientTablesController{ | |||||
| colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty()); | colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty()); | ||||
| StationsUebersichtsItem stationsUebersichtsItem = new StationsUebersichtsItem(); | |||||
| stationsUebersichtsItem.setPatId(12212); | |||||
| stationsUebersichtsItem.setFallId(1223); | |||||
| stationsUebersichtsItem.setPatAge(80); | |||||
| stationsUebersichtsItem.setPatBirthdate(LocalDate.of(1935, 9, 22)); | |||||
| stationsUebersichtsItem.setPatName("Wurst, Hans"); | |||||
| stationsUebersichtsItem.setStationAufnahme(LocalDate.of(1980, 8, 17)); | |||||
| stationsUebersichtsItem.setStationEntlassung(LocalDate.of(1981, 2, 1)); | |||||
| tblStationOverview.setItems(FXCollections.observableArrayList(stationsUebersichtsItem)); | |||||
| cmbStationenFilter.valueProperty().addListener((observableValue, oldValue, newValue) -> { | |||||
| updateStationsHistorieFromDb(); | |||||
| }); | |||||
| tblStationOverview.itemsProperty().bind(Bindings.createObjectBinding(() -> { | |||||
| if (btnEntlassenePatientenZeigen.isSelected()) { | |||||
| return stationsUebersicht; | |||||
| } else { | |||||
| return stationsUebersichtsItemFilteredList; | |||||
| } | |||||
| }, btnEntlassenePatientenZeigen.selectedProperty())); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedCreatePatient (){ | |||||
| private void clickedCreatePatient() { | |||||
| showEditWindow(null); | showEditWindow(null); | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedEditPatient(){ | |||||
| private void clickedEditPatient() { | |||||
| showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); | showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); | ||||
| } | } | ||||
| private void showEditWindow(Patient patient){ | |||||
| private void showEditWindow(Patient patient) { | |||||
| FXMLLoader fxmlLoader = new FXMLLoader(); | FXMLLoader fxmlLoader = new FXMLLoader(); | ||||
| fxmlLoader.setLocation(getClass().getClassLoader().getResource("patient_edit.fxml")); | fxmlLoader.setLocation(getClass().getClassLoader().getResource("patient_edit.fxml")); | ||||
| PatientEditorController patientEditorController = new PatientEditorController(mainController); | PatientEditorController patientEditorController = new PatientEditorController(mainController); | ||||
| fxmlLoader.setControllerFactory(clazz -> patientEditorController); | fxmlLoader.setControllerFactory(clazz -> patientEditorController); | ||||
| Parent root = null; | Parent root = null; | ||||
| try{ | |||||
| try { | |||||
| root = fxmlLoader.load(); | root = fxmlLoader.load(); | ||||
| }catch (IOException e){ | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| return; | return; | ||||
| } | } | ||||
| Stage stage = new Stage(); | Stage stage = new Stage(); | ||||
| stage.setTitle(patient==null ? "Neuen Patienten erstellen": "Patient bearbeiten"); | |||||
| stage.setTitle(patient == null ? "Neuen Patienten erstellen" : "Patient bearbeiten"); | |||||
| stage.setScene(new Scene(root, 600, 600)); | stage.setScene(new Scene(root, 600, 600)); | ||||
| stage.getIcons().add(new Image("icon.png")); | stage.getIcons().add(new Image("icon.png")); | ||||
| @@ -243,75 +219,129 @@ public class PatientTablesController{ | |||||
| stage.show(); | stage.show(); | ||||
| } | } | ||||
| public void updatePatientsFromDb() { | |||||
| if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | |||||
| System.out.println("Patienten werden bereits geladen."); | |||||
| return; | |||||
| } | |||||
| public void updatePatientsFromDb(){ | |||||
| if(this.loadPatientTask != null && this.loadPatientTask.isRunning()) { | |||||
| System.out.println("Patienten werden bereits geladen."); | |||||
| return; | |||||
| } | |||||
| btnPatRefresh.setDisable(true); | |||||
| btnPatRefresh.setDisable(true); | |||||
| tblPatientOverview.setItems(null); | |||||
| tblPatientOverview.setItems(null); | |||||
| mainController.increaseParallelTaskCount(); | |||||
| mainController.increaseParallelTaskCount(); | |||||
| lblTablePatientEmpty.setText("Liste wird geladen..."); | |||||
| lblTablePatientEmpty.setText("Liste wird geladen..."); | |||||
| Task<List<Patient>> loadPatientsTask = new Task<List<Patient>>() { | |||||
| Task<List<Patient>>loadPatientsTask = new Task<List<Patient>>(){ | |||||
| @Override | |||||
| protected List<Patient> call() throws Exception { | |||||
| return FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); | |||||
| } | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Liste ist leer."); | |||||
| tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue())); | |||||
| mainController.decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected List<Patient> call() throws Exception { | |||||
| return FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Laden fehlgeschlagen!"); | |||||
| mainController.decreaseParallelTaskCount(); | |||||
| tblPatientOverview.setItems(null); | |||||
| if (getException() != null) { | |||||
| getException().printStackTrace(); | |||||
| } | } | ||||
| } | |||||
| }; | |||||
| this.loadPatientTask = loadPatientsTask; | |||||
| Thread thread = new Thread(loadPatientsTask); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| } | |||||
| @FXML | |||||
| private void clickedRefreshStation() { | |||||
| updateStationsHistorieFromDb(); | |||||
| } | |||||
| public void updateStationsHistorieFromDb() { | |||||
| if (this.loadStationsHistorieTask != null) { | |||||
| loadStationsHistorieTask.cancel(); | |||||
| } | |||||
| lblTableStationEmpty.setText("Liste wird geladen..."); | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Liste ist leer."); | |||||
| tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue())); | |||||
| btnStatRefresh.setDisable(true); | |||||
| stationsUebersicht.clear(); | |||||
| mainController.increaseParallelTaskCount(); | |||||
| Task<List<StationsUebersichtsItem>> loadStatHist = new Task<List<StationsUebersichtsItem>>() { | |||||
| @Override | |||||
| protected List<StationsUebersichtsItem> call() throws Exception { | |||||
| return FXCollections.<StationsUebersichtsItem>observableArrayList( | |||||
| DBHandler.getStationsUebersichtsItems(cmbStationenFilter.getValue().getStation())); | |||||
| } | |||||
| @Override | |||||
| protected void succeeded() { | |||||
| super.succeeded(); | |||||
| if (!isCancelled()) { | |||||
| lblTableStationEmpty.setText("Liste ist leer."); | |||||
| stationsUebersicht.setAll(this.getValue()); | |||||
| btnStatRefresh.setDisable(false); | |||||
| mainController.decreaseParallelTaskCount(); | mainController.decreaseParallelTaskCount(); | ||||
| } | } | ||||
| } | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| btnPatRefresh.setDisable(false); | |||||
| lblTablePatientEmpty.setText("Laden fehlgeschlagen!"); | |||||
| @Override | |||||
| protected void cancelled() { | |||||
| super.cancelled(); | |||||
| mainController.decreaseParallelTaskCount(); | |||||
| } | |||||
| @Override | |||||
| protected void failed() { | |||||
| super.failed(); | |||||
| if (!isCancelled()) { | |||||
| lblTableStationEmpty.setText("Laden fehlgeschlagen!"); | |||||
| getException().printStackTrace(); | |||||
| btnStatRefresh.setDisable(false); | |||||
| mainController.decreaseParallelTaskCount(); | mainController.decreaseParallelTaskCount(); | ||||
| tblPatientOverview.setItems(null); | |||||
| if(getException()!=null){ | |||||
| getException().printStackTrace(); | |||||
| } | |||||
| } | } | ||||
| }; | |||||
| this.loadPatientTask = loadPatientsTask; | |||||
| } | |||||
| }; | |||||
| this.loadStationsHistorieTask = loadStatHist; | |||||
| Thread thread = new Thread(loadPatientsTask); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| Thread thread = new Thread(loadStationsHistorieTask); | |||||
| thread.setDaemon(true); | |||||
| thread.start(); | |||||
| } | } | ||||
| private Task loadPatientTask = null; | |||||
| @FXML | @FXML | ||||
| private Button btnPatRefresh; | |||||
| @FXML | |||||
| private void clickedRefreshPatient(){ | |||||
| private void clickedRefreshPatient() { | |||||
| updatePatientsFromDb(); | updatePatientsFromDb(); | ||||
| } | } | ||||
| private ObjectBinding<Patient> patientObjectBinding = null; | |||||
| public ObjectBinding<Patient> selectedPatientProperty(){ | |||||
| public ObjectBinding<Patient> selectedPatientProperty() { | |||||
| return patientObjectBinding; | return patientObjectBinding; | ||||
| } | } | ||||
| public Patient getSelectedPatient(){ | |||||
| public Patient getSelectedPatient() { | |||||
| return selectedPatientProperty().get(); | return selectedPatientProperty().get(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,230 @@ | |||||
| package de.uniluebeck.mi.projmi6.controller; | |||||
| /** | |||||
| * Created by 630030 on 19.11.15. | |||||
| */ | |||||
| import java.io.IOException; | |||||
| import java.util.Map; | |||||
| import ca.uhn.hl7v2.DefaultHapiContext; | |||||
| import ca.uhn.hl7v2.HL7Exception; | |||||
| import ca.uhn.hl7v2.HapiContext; | |||||
| import ca.uhn.hl7v2.app.Connection; | |||||
| import ca.uhn.hl7v2.app.ConnectionListener; | |||||
| import ca.uhn.hl7v2.app.HL7Service; | |||||
| import ca.uhn.hl7v2.app.Initiator; | |||||
| import ca.uhn.hl7v2.llp.LLPException; | |||||
| import ca.uhn.hl7v2.model.Message; | |||||
| import ca.uhn.hl7v2.parser.Parser; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplication; | |||||
| import ca.uhn.hl7v2.protocol.ReceivingApplicationExceptionHandler; | |||||
| public class SendAndReceiveMessage { | |||||
| public static void main(String[] args) throws Exception { | |||||
| } | |||||
| public void sendMessage(){ | |||||
| /* | |||||
| * The following section of code establishes a server listening | |||||
| * on port 1011 for new connections, and then "handles" them by | |||||
| */ | |||||
| int port = 1011; // The port to listen on | |||||
| boolean useTls = false; // Don't use TLS/SSL | |||||
| HapiContext context = new DefaultHapiContext(); | |||||
| HL7Service server = context.newServer(port, useTls); | |||||
| /* | |||||
| * Create a client, which will connect to our waiting | |||||
| * server and send messages to it. | |||||
| */ | |||||
| // A connection object represents a socket attached to an HL7 server | |||||
| Connection connection = null; | |||||
| try { | |||||
| connection = context.newClient("localhost", port, useTls); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| // Create a message to send | |||||
| String msg = "MSH|^~\\&|HIS|RIH|EKG|EKG|199904140038||ADT^A01|12345|P|2.2\r" | |||||
| + "PID|0001|00009874|00001122|A00977|SMITH^JOHN^M|MOM|19581119|F|NOTREAL^LINDA^M|C|564 SPRING ST^^NEEDHAM^MA^02494^US|0002|(818)565-1551|(425)828-3344|E|S|C|0000444444|252-00-4414||||SA|||SA||||NONE|V1|0001|I|D.ER^50A^M110^01|ER|P00055|11B^M011^02|070615^BATMAN^GEORGE^L|555888^NOTREAL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^NOTREAL^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|199904101200||||5555112333|||666097^NOTREAL^MANNY^P\r" | |||||
| + "NK1|0222555|NOTREAL^JAMES^R|FA|STREET^OTHER STREET^CITY^ST^55566|(222)111-3333|(888)999-0000|||||||ORGANIZATION\r" | |||||
| + "PV1|0001|I|D.ER^1F^M950^01|ER|P000998|11B^M011^02|070615^BATMAN^GEORGE^L|555888^OKNEL^BOB^K^DR^MD|777889^NOTREAL^SAM^T^DR^MD^PHD|ER|D.WT^1A^M010^01|||ER|AMB|02|070615^VOICE^BILL^L|ER|000001916994|D||||||||||||||||GDD|WA|NORM|02|O|02|E.IN^02D^M090^01|E.IN^01D^M080^01|199904072124|199904101200|||||5555112333|||666097^DNOTREAL^MANNY^P\r" | |||||
| + "PV2|||0112^TESTING|55555^PATIENT IS NORMAL|NONE|||19990225|19990226|1|1|TESTING|555888^NOTREAL^BOB^K^DR^MD||||||||||PROD^003^099|02|ER||NONE|19990225|19990223|19990316|NONE\r" | |||||
| + "AL1||SEV|001^POLLEN\r" | |||||
| + "GT1||0222PL|NOTREAL^BOB^B||STREET^OTHER STREET^CITY^ST^77787|(444)999-3333|(222)777-5555||||MO|111-33-5555||||NOTREAL GILL N|STREET^OTHER STREET^CITY^ST^99999|(111)222-3333\r" | |||||
| + "IN1||022254P|4558PD|BLUE CROSS|STREET^OTHER STREET^CITY^ST^00990||(333)333-6666||221K|LENIX|||19980515|19990515|||PATIENT01 TEST D||||||||||||||||||02LL|022LP554"; | |||||
| Parser p = context.getPipeParser(); | |||||
| Message adt = null; | |||||
| try { | |||||
| adt = p.parse(msg); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| // The initiator is used to transmit unsolicited messages | |||||
| Initiator initiator = connection.getInitiator(); | |||||
| Message response = null; | |||||
| try { | |||||
| response = initiator.sendAndReceive(adt); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } catch (LLPException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| String responseString = null; | |||||
| try { | |||||
| responseString = p.encode(response); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| System.out.println("Received response:\n" + responseString); | |||||
| /* | |||||
| * MSH|^~\&|||||20070218200627.515-0500||ACK|54|P|2.2 MSA|AA|12345 | |||||
| */ | |||||
| /* | |||||
| * If you want to send another message to the same destination, it's fine | |||||
| * to ask the context again for a client to attach to the same host/port. | |||||
| * The context will be smart about it and return the same (already | |||||
| * connected) client Connection instance, assuming it hasn't been closed. | |||||
| */ | |||||
| try { | |||||
| connection = context.newClient("localhost", port, useTls); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| initiator = connection.getInitiator(); | |||||
| try { | |||||
| response = initiator.sendAndReceive(adt); | |||||
| } catch (HL7Exception e) { | |||||
| e.printStackTrace(); | |||||
| } catch (LLPException e) { | |||||
| e.printStackTrace(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| /* | |||||
| * Close the connection when you are done with it. | |||||
| */ | |||||
| connection.close(); | |||||
| // Stop the receiving server and client | |||||
| server.stopAndWait(); | |||||
| } | |||||
| public void receiveMessage(){ | |||||
| /* | |||||
| * The following section of code establishes a server listening | |||||
| * on port 1011 for new connections, and then "handles" them by | |||||
| */ | |||||
| int port = 1011; // The port to listen on | |||||
| boolean useTls = false; // Don't use TLS/SSL | |||||
| HapiContext context = new DefaultHapiContext(); | |||||
| HL7Service server = context.newServer(port, useTls); | |||||
| /* | |||||
| * The server may have any number of "application" objects registered to | |||||
| * handle messages. We are going to create an application to listen to | |||||
| * BAR^P05 messages. | |||||
| */ | |||||
| ReceivingApplication handler = new OurReceiverApplication(); | |||||
| server.registerApplication("BAR", "P05", handler); | |||||
| /* | |||||
| *We want to be notified any time a new connection comes in or is | |||||
| * lost, so we register a connection listener | |||||
| */ | |||||
| server.registerConnectionListener(new MyConnectionListener()); | |||||
| /* | |||||
| * We want to be notified any processing failures when receiving, | |||||
| * processing, or responding to messages with the server, so we | |||||
| * register an exception handler. */ | |||||
| server.setExceptionHandler(new MyExceptionHandler()); | |||||
| // Start the server listening for messages | |||||
| try { | |||||
| server.startAndWait(); | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Connection listener which is notified whenever a new | |||||
| * connection comes in or is lost | |||||
| */ | |||||
| public static class MyConnectionListener implements ConnectionListener { | |||||
| public void connectionReceived(Connection theC) { | |||||
| System.out.println("New connection received: " + theC.getRemoteAddress().toString()); | |||||
| } | |||||
| public void connectionDiscarded(Connection theC) { | |||||
| System.out.println("Lost connection from: " + theC.getRemoteAddress().toString()); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * Exception handler which is notified any time | |||||
| */ | |||||
| public static class MyExceptionHandler implements ReceivingApplicationExceptionHandler { | |||||
| /** | |||||
| * Process an exception. | |||||
| * | |||||
| * @param theIncomingMessage | |||||
| * the incoming message. This is the raw message which was | |||||
| * received from the external system | |||||
| * @param theIncomingMetadata | |||||
| * Any metadata that accompanies the incoming message. See {@link ca.uhn.hl7v2.protocol.Transportable#getMetadata()} | |||||
| * @param theOutgoingMessage | |||||
| * the outgoing message. The response NAK message generated by | |||||
| * HAPI. | |||||
| * @param theE | |||||
| * the exception which was received | |||||
| * @return The new outgoing message. This can be set to the value provided | |||||
| * by HAPI in <code>outgoingMessage</code>, or may be replaced with | |||||
| * another message. <b>This method may not return <code>null</code></b>. | |||||
| */ | |||||
| public String processException(String theIncomingMessage, Map<String, Object> theIncomingMetadata, String theOutgoingMessage, Exception theE) throws HL7Exception { | |||||
| /* | |||||
| * Here you can do any processing you like. If you want to change | |||||
| * the response (NAK) message which will be returned you may do | |||||
| * so, or just return the NAK which HAPI already created (theOutgoingMessage) | |||||
| */ | |||||
| return theOutgoingMessage; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,14 +1,25 @@ | |||||
| package de.uniluebeck.mi.projmi6.controller; | package de.uniluebeck.mi.projmi6.controller; | ||||
| import de.uniluebeck.mi.projmi6.model.Fall; | |||||
| import de.uniluebeck.mi.projmi6.db.DBHandler; | |||||
| import de.uniluebeck.mi.projmi6.model.Station; | |||||
| import de.uniluebeck.mi.projmi6.model.StationsHistorie; | import de.uniluebeck.mi.projmi6.model.StationsHistorie; | ||||
| import de.uniluebeck.mi.projmi6.model.Untersuchung; | |||||
| import de.uniluebeck.mi.projmi6.view.DateTimePicker; | import de.uniluebeck.mi.projmi6.view.DateTimePicker; | ||||
| import javafx.beans.binding.Bindings; | |||||
| import javafx.beans.property.ReadOnlyObjectProperty; | |||||
| import javafx.beans.property.SimpleObjectProperty; | |||||
| import javafx.collections.FXCollections; | |||||
| import javafx.collections.ObservableList; | |||||
| import javafx.collections.transformation.FilteredList; | |||||
| import javafx.event.ActionEvent; | |||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Button; | |||||
| import javafx.scene.control.Label; | |||||
| import javafx.scene.control.TableColumn; | |||||
| import javafx.scene.control.TableView; | |||||
| import javafx.scene.control.*; | |||||
| import javafx.scene.control.cell.PropertyValueFactory; | |||||
| import javafx.scene.layout.GridPane; | |||||
| import java.sql.SQLException; | |||||
| import java.time.LocalDate; | |||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| /** | /** | ||||
| * Created by 631806 on 12.11.15. | * Created by 631806 on 12.11.15. | ||||
| @@ -18,46 +29,180 @@ public class StationsHistorieController { | |||||
| /** | /** | ||||
| * The station history that is shown in the edit window, or null if a new station history should be created. | * The station history that is shown in the edit window, or null if a new station history should be created. | ||||
| */ | */ | ||||
| private StationsHistorie stationsHistorie = null; | |||||
| private StationsHistorie stationsHistorieSelected = null; | |||||
| private MainController mainController; | private MainController mainController; | ||||
| @FXML | @FXML | ||||
| private TableView<?>tblStationsHistorie; | |||||
| private TableView<StationsHistorie>tblStationsHistorie; | |||||
| @FXML | @FXML | ||||
| private Button btnStatHistCancel, btnStatHistSave; | private Button btnStatHistCancel, btnStatHistSave; | ||||
| @FXML | @FXML | ||||
| private Label statHistCreator, statHistCreatTime, statHistEditor, statHistEditTime; | |||||
| private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime; | |||||
| @FXML | |||||
| private TableColumn<StationsHistorie,String> colStatHistStation; | |||||
| @FXML | @FXML | ||||
| private TableColumn<?,?> colStatHistAbteilung, colStatHistStation, colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; | |||||
| private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; | |||||
| @FXML | @FXML | ||||
| private DateTimePicker dtTmAufnahme, dtTmEntlassung; | private DateTimePicker dtTmAufnahme, dtTmEntlassung; | ||||
| @FXML | |||||
| private ComboBox<Station> cmbStation; | |||||
| @FXML | |||||
| private ComboBox<String> cmbAbteilung; | |||||
| public StationsHistorieController(MainController mainController){ | public StationsHistorieController(MainController mainController){ | ||||
| this.mainController = mainController; | this.mainController = mainController; | ||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedCancel(){ | |||||
| private void clickedEdit() { | |||||
| this.state.set(State.EDIT); | |||||
| } | |||||
| public enum State { | |||||
| CREATE, EDIT, VIEW | |||||
| } | |||||
| public State getState() { | |||||
| return state.get(); | |||||
| } | |||||
| public ReadOnlyObjectProperty<State> stateProperty() { | |||||
| return state; | |||||
| } | |||||
| SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW); | |||||
| public void setStationsHistorie(ObservableList<StationsHistorie> stationsHistorie) { | |||||
| this.stationsHistorie.set(stationsHistorie); | |||||
| } | |||||
| private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie = | |||||
| new SimpleObjectProperty<>(); | |||||
| @FXML | |||||
| GridPane fields; | |||||
| @FXML | |||||
| private void initialize() { | |||||
| initColumns(); | |||||
| initStationsFilter(); | |||||
| fields.disableProperty().bind(stateProperty().isEqualTo(State.VIEW)); | |||||
| state.addListener((observable, oldValue, newValue) -> { | |||||
| if(newValue == State.CREATE || newValue == State.EDIT){ | |||||
| mainController.lockForEdit(MainController.TabName.STATIONSHISTORIE); | |||||
| }else{ | |||||
| mainController.unlockFromEdit(); | |||||
| } | |||||
| }); | |||||
| tblStationsHistorie.itemsProperty().bind(stationsHistorie); | |||||
| tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> { | |||||
| setStationsHistorieSelected(newValue); | |||||
| }); | |||||
| } | |||||
| @FXML | |||||
| public Button btnStatHistAbort; | |||||
| private void initStationsFilter(){ | |||||
| final String any = "beliebig"; | |||||
| List<String> abteilungen = mainController.getStammdaten().getStationen().stream() | |||||
| .map(stat->stat.getAbteilung()).distinct().collect(Collectors.toList()); | |||||
| cmbAbteilung.setItems(FXCollections.observableArrayList(abteilungen)); | |||||
| cmbAbteilung.getItems().add(0, any); | |||||
| cmbAbteilung.getSelectionModel().select(0); | |||||
| btnStatHistCancel.visibleProperty().bind(state.isEqualTo(State.VIEW).and(tblStationsHistorie.getSelectionModel().selectedItemProperty().isNotNull())); | |||||
| btnStatHistSave.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); | |||||
| btnStatHistAbort.visibleProperty().bind(state.isEqualTo(State.VIEW).not()); | |||||
| btnStatHistEdit.visibleProperty().bind(state.isEqualTo(State.VIEW)); | |||||
| tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { | |||||
| setStationsHistorieSelected(newValue); | |||||
| }); | |||||
| FilteredList<Station> stationenFiltered = new FilteredList<Station>(mainController.getStammdaten().getStationen()); | |||||
| stationenFiltered.predicateProperty().bind(Bindings.createObjectBinding(() -> { | |||||
| if(cmbAbteilung.getValue()==null || cmbAbteilung.getValue().equals(any)){ | |||||
| return p->true; | |||||
| } | |||||
| return p -> p.getAbteilung().equals(cmbAbteilung.getValue()); | |||||
| },cmbAbteilung.valueProperty())); | |||||
| cmbStation.setItems(stationenFiltered); | |||||
| } | |||||
| @FXML | |||||
| Button btnStatHistEdit; | |||||
| @FXML | |||||
| private void clickedCancel(){ | |||||
| // this.state.set(State.VIEW); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedSave(){ | private void clickedSave(){ | ||||
| if(getState()==State.CREATE){ | |||||
| StationsHistorie stationsHistorie = new StationsHistorie(); | |||||
| copyFieldDataIntoStationsHistorie(stationsHistorie); | |||||
| try { | |||||
| DBHandler.setStationsHistorie(stationsHistorie,false); | |||||
| } catch (SQLException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| mainController.refreshCaseData(); | |||||
| } | |||||
| } | |||||
| @FXML | |||||
| private void clickedAbort(){ | |||||
| state.set(State.VIEW); | |||||
| copyStationsHistorieDataIntoFields(); | |||||
| } | } | ||||
| @FXML | @FXML | ||||
| private void clickedCreateAufenthalt(){ | private void clickedCreateAufenthalt(){ | ||||
| this.state.set(State.CREATE); | |||||
| setStationsHistorieSelected(null); | |||||
| } | |||||
| public ObservableList<StationsHistorie> getStationsHistorie() { | |||||
| return stationsHistorie.get(); | |||||
| } | } | ||||
| public void setStationsHistorie(StationsHistorie stationsHistorie){ | |||||
| this.stationsHistorie = stationsHistorie; | |||||
| public SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorieProperty() { | |||||
| return stationsHistorie; | |||||
| } | |||||
| public void setStationsHistorieSelected(StationsHistorie stationsHistorie){ | |||||
| this.stationsHistorieSelected=stationsHistorie; | |||||
| if(stationsHistorie==null){ | if(stationsHistorie==null){ | ||||
| clearFields(); | clearFields(); | ||||
| }else { | }else { | ||||
| @@ -66,47 +211,57 @@ public class StationsHistorieController { | |||||
| } | } | ||||
| private void copyStationsHistorieDataIntoFields(){ | |||||
| // colStatHistAbteilung.setText(stationsHistorie.get()); | |||||
| // colStatHistStation.setText(stationsHistorie.getStation()); | |||||
| // colStatHistAufnahmeDatum.setDateTime(stationsHistorie.getAufnahmeDatum()); | |||||
| // colStatHistEntlassungsDatum.setDateTime(stationsHistorie.getEntlassungsDatum()); | |||||
| // dtTmAufnahme=setDateTime(stationsHistorie.getAufnahmeDatum()); | |||||
| // dtTmEntlassung=setDateTime(stationsHistorie.getEntlassungsDatum()); | |||||
| statHistCreator.setText(Integer.toString(stationsHistorie.getErsteller())); | |||||
| statHistCreatTime.setText(stationsHistorie.getErstellDatumZeit().toString()); | |||||
| statHistEditor.setText(Integer.toString(stationsHistorie.getBearbeiter())); | |||||
| statHistEditTime.setText(stationsHistorie.getBearbeitetDatumZeit().toString()); | |||||
| private void initColumns(){ | |||||
| // colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, String>()); | |||||
| colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum")); | |||||
| colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum")); | |||||
| //colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>()); | |||||
| // | |||||
| } | } | ||||
| private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ | |||||
| if(stationsHistorie==null){ | |||||
| private void copyStationsHistorieDataIntoFields(){ | |||||
| if(stationsHistorieSelected==null){ | |||||
| clearFields(); | clearFields(); | ||||
| return; | return; | ||||
| } | } | ||||
| // stationsHistorie.set(colStatHistAbteilung.getText()); | |||||
| // stationsHistorie.setStation(colStatHistStation.getText()); | |||||
| // stationsHistorie.setAufnahmeDatum(colStatHistAufnahmeDatum.getDateTime()); | |||||
| // stationsHistorie.getEntlassungsDatum(colStatHistEntlassungsDatum.getDateTime()); | |||||
| stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | |||||
| // stationsHistorie.getEntlassungsDatum(dtTmEntlassung.getDateTime()); | |||||
| //TODO cmbStation.setValue | |||||
| dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum()); | |||||
| dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum()); | |||||
| statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller())); | |||||
| if(stationsHistorieSelected.getErstellDatumZeit()!=null){ | |||||
| statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString()); | |||||
| } | |||||
| statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter())); | |||||
| if(stationsHistorieSelected.getBearbeitetDatumZeit()!=null){ | |||||
| statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString()); | |||||
| } | |||||
| } | |||||
| private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ | |||||
| stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); | |||||
| stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); | |||||
| stationsHistorie.setStation(cmbStation.getValue()); | |||||
| stationsHistorie.setFallID(mainController.getFall().getFallID()); | |||||
| stationsHistorie.setStationKey(cmbStation.getValue().getStation()); | |||||
| } | } | ||||
| private void clearFields(){ | private void clearFields(){ | ||||
| //statHistCreateTime.setText("<auto>"); | |||||
| //statHistCreator.setText("<auto>"); | |||||
| //statHistEditTime.setText("<auto>"); | |||||
| // statHistEditor.setText("<auto>"); | |||||
| statHistCreateTime.setText(""); | |||||
| statHistCreator.setText(""); | |||||
| statHistEditTime.setText(""); | |||||
| statHistEditor.setText(""); | |||||
| cmbAbteilung.setValue(null); | |||||
| cmbStation.setValue(null); | |||||
| colStatHistAbteilung.setText(""); | |||||
| colStatHistStation.setText(""); | |||||
| // colStatHistAufnahmeDatum.setDateTime(null); | |||||
| // colStatHistEntlassungsDatum.setDateTime(null); | |||||
| dtTmAufnahme.setDateTime(null); | dtTmAufnahme.setDateTime(null); | ||||
| dtTmEntlassung.setDateTime(null); | |||||
| dtTmEntlassung.setDateTime(null); | |||||
| } | } | ||||
| } | } | ||||
| @@ -48,7 +48,9 @@ public class DBHandler { | |||||
| "`LetzterBearbeiter`," + | "`LetzterBearbeiter`," + | ||||
| "`Ersteller`)" + | "`Ersteller`)" + | ||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | ||||
| private static final String SELECT_ALL_STATIONEN = "SELECT * FROM `stammstation`"; | |||||
| private static final String SELECT_ALL_STATIONEN = "SELECT *,`r`.`abteilung` AS abteilung " + | |||||
| "FROM `stammstation` s " + | |||||
| "INNER JOIN `relfachrichtungstation` r ON s.station = r.station"; | |||||
| private static final String SELECT_FAELLE_BY_PATID = "SELECT * FROM `fall` WHERE `patientid` = ?"; | private static final String SELECT_FAELLE_BY_PATID = "SELECT * FROM `fall` WHERE `patientid` = ?"; | ||||
| private static final String INSERT_FALL = "INSERT INTO `fall`" + | private static final String INSERT_FALL = "INSERT INTO `fall`" + | ||||
| "(`Aufnahmedatum`," + | "(`Aufnahmedatum`," + | ||||
| @@ -95,7 +97,7 @@ public class DBHandler { | |||||
| "`LetzterBearbeiter`," + | "`LetzterBearbeiter`," + | ||||
| "`Ersteller`)" + | "`Ersteller`)" + | ||||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; | "VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; | ||||
| private static final String UPDATE_UNTERSUCHUNG = "UPDATE `untersuchung`" + | |||||
| private static final String UPDATE_UNTERSUCHUNG = "UPDATE `untersuchung` " + | |||||
| "SET `DurchfuehrenderArzt`=?," + | "SET `DurchfuehrenderArzt`=?," + | ||||
| "`FallID`=?," + | "`FallID`=?," + | ||||
| "`OPSCode`=?," + | "`OPSCode`=?," + | ||||
| @@ -108,7 +110,33 @@ public class DBHandler { | |||||
| private static final String SELECT_DIAGNOSE_BY_FALLID = "SELECT * FROM `diagnose` WHERE `fallid` = ?"; | private static final String SELECT_DIAGNOSE_BY_FALLID = "SELECT * FROM `diagnose` WHERE `fallid` = ?"; | ||||
| private static final String SELECT_ALL_KASSEN = "SELECT * FROM `kasse`"; | private static final String SELECT_ALL_KASSEN = "SELECT * FROM `kasse`"; | ||||
| private static final String SELECT_KASSE_BY_KASSENID = "SELECT * FROM `kasse` WHERE `kasse`.`KassenID` = ?"; | private static final String SELECT_KASSE_BY_KASSENID = "SELECT * FROM `kasse` WHERE `kasse`.`KassenID` = ?"; | ||||
| private static final String SELECT_STATHIST_BY_STATION = "SELECT * FROM `stationshistorie` WHERE `stationshistorie`.`Station` = ?"; | |||||
| private static final String SELECT_STATHIST_BY_FALLID = "SELECT * FROM `stationshistorie` WHERE `stationshistorie`.`fallid` = ?"; | |||||
| private static final String SELECT_STATUBERITEMS_BY_STATION = "SELECT p.id AS patid," + | |||||
| "concat(p.nachname, ', ', p.vorname) AS patname," + | |||||
| "p.geburtsdatum AS dob," + | |||||
| "timestampdiff(YEAR, p.geburtsdatum, curdate()) AS patage," + | |||||
| "f.aufnahmedatum AS aufnahme," + | |||||
| "f.entlassungsdatum AS entlassung," + | |||||
| "f.fallid AS fallid " + | |||||
| "FROM stationshistorie s " + | |||||
| "INNER JOIN fall f ON s.fallid = f.fallid " + | |||||
| "INNER JOIN patient p ON f.patientid = p.id " + | |||||
| "WHERE s.station = ?"; | |||||
| private static final String INSERT_STATHISTENTRY = "INSERT INTO `stationshistorie`" + | |||||
| "(`Aufnahmedatum`," + | |||||
| "`Entlassungsdatum`," + | |||||
| "`FallID`," + | |||||
| "`LetzterBearbeiter`," + | |||||
| "`Station`," + | |||||
| "`Ersteller`)" + | |||||
| "VALUES (?, ?, ?, ?, ?, ?)"; | |||||
| private static final String UPDATE_STATHISTENTRY = "UPDATE `stationshistorie` " + | |||||
| "SET `Aufnahmedatum`=?," + | |||||
| "`Entlassungsdatum`=?," + | |||||
| "`FallID`=?," + | |||||
| "`LetzterBearbeiter`=?," + | |||||
| "`Station`=? " + | |||||
| "WHERE `StatHistID`=?"; | |||||
| /** | /** | ||||
| * Gibt alle {@link Patient} aus der DB zurueck. | * Gibt alle {@link Patient} aus der DB zurueck. | ||||
| @@ -117,7 +145,7 @@ public class DBHandler { | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | ||||
| */ | */ | ||||
| public static List<Patient> getAllPatients() throws SQLException { | public static List<Patient> getAllPatients() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_PATIENTS); | ResultSet rs = statement.executeQuery(SELECT_ALL_PATIENTS); | ||||
| List<Patient> patients = new ArrayList<>(); | List<Patient> patients = new ArrayList<>(); | ||||
| @@ -166,7 +194,7 @@ public class DBHandler { | |||||
| // TODO: Never used. | // TODO: Never used. | ||||
| public static Patient getPatient(int id) throws SQLException { | public static Patient getPatient(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_PATIENT_BY_ID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_PATIENT_BY_ID); | |||||
| ResultSet rs; | ResultSet rs; | ||||
| statement.setInt(1, id); | statement.setInt(1, id); | ||||
| rs = statement.executeQuery(); | rs = statement.executeQuery(); | ||||
| @@ -185,9 +213,9 @@ public class DBHandler { | |||||
| public static void setPatient(Patient patient, int mitarbid, boolean isUpdate) throws SQLException { | public static void setPatient(Patient patient, int mitarbid, boolean isUpdate) throws SQLException { | ||||
| PreparedStatement statement; | PreparedStatement statement; | ||||
| if (isUpdate) { | if (isUpdate) { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_PATIENT); | |||||
| } else { | } else { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_PATIENT); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_PATIENT); | |||||
| } | } | ||||
| statement.setString(1, patient.getCave()); // CAVE | statement.setString(1, patient.getCave()); // CAVE | ||||
| @@ -225,7 +253,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Station> getAllStationen() throws SQLException { | public static List<Station> getAllStationen() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); | ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); | ||||
| List<Station> stationen = new ArrayList<>(); | List<Station> stationen = new ArrayList<>(); | ||||
| @@ -249,15 +277,44 @@ public class DBHandler { | |||||
| station.setBezeichnung(rs.getString("bezeichnung")); | station.setBezeichnung(rs.getString("bezeichnung")); | ||||
| station.setBezeichnungLang(rs.getString("bezeichnunglang")); | station.setBezeichnungLang(rs.getString("bezeichnunglang")); | ||||
| station.setStationstyp(rs.getInt("stationstyp")); | station.setStationstyp(rs.getInt("stationstyp")); | ||||
| station.setAbteilung(rs.getString("abteilung")); | |||||
| return station; | return station; | ||||
| } | } | ||||
| public static List<StationsHistorie> getStationsHistorieByStation(String station) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_STATION); | |||||
| public static List<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION); | |||||
| statement.setString(1, station); | statement.setString(1, station); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| List<StationsUebersichtsItem> statUeberItems = new ArrayList<>(); | |||||
| while (rs.next()) { | |||||
| statUeberItems.add(getStatUeberItem(rs)); | |||||
| } | |||||
| return statUeberItems; | |||||
| } | |||||
| private static StationsUebersichtsItem getStatUeberItem(ResultSet rs) throws SQLException { | |||||
| StationsUebersichtsItem item = new StationsUebersichtsItem(); | |||||
| item.setFallId(rs.getInt("fallid")); | |||||
| item.setPatId(rs.getInt("patid")); | |||||
| item.setPatName(rs.getString("patname")); | |||||
| item.setPatAge(rs.getInt("patage")); | |||||
| item.setPatBirthdate(rs.getDate("dob").toLocalDate()); | |||||
| if (rs.getDate("aufnahme") != null) { | |||||
| item.setStationAufnahme(rs.getDate("aufnahme").toLocalDate()); | |||||
| } | |||||
| if (rs.getDate("entlassung") != null) { | |||||
| item.setStationEntlassung(rs.getDate("entlassung").toLocalDate()); | |||||
| } | |||||
| return item; | |||||
| } | |||||
| public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException { | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID); | |||||
| statement.setInt(1, fall.getFallID()); | |||||
| ResultSet rs = statement.executeQuery(); | |||||
| List<StationsHistorie> historie = new ArrayList<>(); | List<StationsHistorie> historie = new ArrayList<>(); | ||||
| while (rs.next()) { | while (rs.next()) { | ||||
| historie.add(getStationsHistorie(rs)); | historie.add(getStationsHistorie(rs)); | ||||
| @@ -266,6 +323,37 @@ public class DBHandler { | |||||
| return historie; | return historie; | ||||
| } | } | ||||
| public static void setStationsHistorie(StationsHistorie hist, boolean isUpdate) throws SQLException { | |||||
| PreparedStatement statement; | |||||
| if (isUpdate) { | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_STATHISTENTRY); | |||||
| } else { | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_STATHISTENTRY); | |||||
| } | |||||
| if (hist.getAufnahmeDatum() != null) { | |||||
| statement.setTimestamp(1, Timestamp.valueOf(hist.getAufnahmeDatum())); // `Aufnahmedatum` | |||||
| } else { | |||||
| statement.setTimestamp(1, null); | |||||
| } | |||||
| if (hist.getEntlassungsDatum() != null) { | |||||
| statement.setTimestamp(2, Timestamp.valueOf(hist.getEntlassungsDatum())); // `Entlassungsdatum` | |||||
| } else { | |||||
| statement.setTimestamp(2, null); | |||||
| } | |||||
| statement.setInt(3, hist.getFallID()); // `FallID` | |||||
| statement.setInt(4, hist.getBearbeiter()); // `LetzterBearbeiter` | |||||
| statement.setString(5, hist.getStationKey()); // `Station` | |||||
| if (isUpdate) { | |||||
| statement.setInt(6, hist.getStatHistID()); // `StatHistID` | |||||
| statement.executeUpdate(); | |||||
| } else { | |||||
| statement.setInt(6, hist.getErsteller()); // `Ersteller` | |||||
| statement.execute(); | |||||
| } | |||||
| } | |||||
| private static StationsHistorie getStationsHistorie(ResultSet rs) throws SQLException { | private static StationsHistorie getStationsHistorie(ResultSet rs) throws SQLException { | ||||
| StationsHistorie hist = new StationsHistorie(); | StationsHistorie hist = new StationsHistorie(); | ||||
| @@ -285,7 +373,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Fall> getFaelleByPatID(int id) throws SQLException { | public static List<Fall> getFaelleByPatID(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | |||||
| statement.setInt(1, id); | statement.setInt(1, id); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| @@ -331,7 +419,7 @@ public class DBHandler { | |||||
| /** | /** | ||||
| * Fuehrt {@code INSERT} bei einem neuen Datensatz und {@code UPDATE} bei einem existierenden Datensatz aus. | * Fuehrt {@code INSERT} bei einem neuen Datensatz und {@code UPDATE} bei einem existierenden Datensatz aus. | ||||
| * | * | ||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | ||||
| * @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. | * @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. | ||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | ||||
| @@ -339,9 +427,9 @@ public class DBHandler { | |||||
| public static void setFall(Fall fall, int mitarbid, boolean isUpdate) throws SQLException { | public static void setFall(Fall fall, int mitarbid, boolean isUpdate) throws SQLException { | ||||
| PreparedStatement statement; | PreparedStatement statement; | ||||
| if (isUpdate) { | if (isUpdate) { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_FALL); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_FALL); | |||||
| } else { | } else { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_FALL); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_FALL); | |||||
| } | } | ||||
| if (fall.getAufnahmeDatum() != null) { | if (fall.getAufnahmeDatum() != null) { | ||||
| @@ -396,7 +484,8 @@ public class DBHandler { | |||||
| /** | /** | ||||
| * Fuehrt {@code INSERT} eines neuen Datensatz durch. | * Fuehrt {@code INSERT} eines neuen Datensatz durch. | ||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * | |||||
| * @param fall zu verarbeitender Datensatz. | |||||
| * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | * @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. | ||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | ||||
| */ | */ | ||||
| @@ -412,7 +501,7 @@ public class DBHandler { | |||||
| } | } | ||||
| private static Diagnose getDiagnose(int id) throws SQLException { | private static Diagnose getDiagnose(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_ID); | |||||
| statement.setInt(1, id); | statement.setInt(1, id); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| @@ -450,7 +539,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); | ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); | ||||
| List<Icd10Code> icd10codes = new ArrayList<>(); | List<Icd10Code> icd10codes = new ArrayList<>(); | ||||
| @@ -462,7 +551,7 @@ public class DBHandler { | |||||
| } | } | ||||
| private static Icd10Code getIcd10Code(String code, int version) throws SQLException { | private static Icd10Code getIcd10Code(String code, int version) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_ICD10CODE_BY_ID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_ICD10CODE_BY_ID); | |||||
| ResultSet rs; | ResultSet rs; | ||||
| statement.setString(1, code); | statement.setString(1, code); | ||||
| statement.setInt(2, version); | statement.setInt(2, version); | ||||
| @@ -488,7 +577,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<OpsCode> getAllOpsCodes() throws SQLException { | public static List<OpsCode> getAllOpsCodes() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); | ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); | ||||
| List<OpsCode> opscodes = new ArrayList<>(); | List<OpsCode> opscodes = new ArrayList<>(); | ||||
| @@ -500,7 +589,7 @@ public class DBHandler { | |||||
| } | } | ||||
| private static OpsCode getOpsCode(String code, int version) throws SQLException { | private static OpsCode getOpsCode(String code, int version) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID); | |||||
| ResultSet rs; | ResultSet rs; | ||||
| statement.setString(1, code); | statement.setString(1, code); | ||||
| statement.setInt(2, version); | statement.setInt(2, version); | ||||
| @@ -526,7 +615,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Mitarbeiter> getAllMitarbeiter() throws SQLException { | public static List<Mitarbeiter> getAllMitarbeiter() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); | ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); | ||||
| List<Mitarbeiter> mitarbeiters = new ArrayList<>(); | List<Mitarbeiter> mitarbeiters = new ArrayList<>(); | ||||
| @@ -538,7 +627,7 @@ public class DBHandler { | |||||
| } | } | ||||
| private static Mitarbeiter getMitarbeiter(int id) throws SQLException { | private static Mitarbeiter getMitarbeiter(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_MITARBEITER_BY_ID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_MITARBEITER_BY_ID); | |||||
| ResultSet rs; | ResultSet rs; | ||||
| statement.setInt(1, id); | statement.setInt(1, id); | ||||
| rs = statement.executeQuery(); | rs = statement.executeQuery(); | ||||
| @@ -571,7 +660,7 @@ public class DBHandler { | |||||
| * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | * @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. | ||||
| */ | */ | ||||
| public static List<Untersuchung> getUntersuchungByFall(Fall fall) throws SQLException { | public static List<Untersuchung> getUntersuchungByFall(Fall fall) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_UNTERS_BY_FALLID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_UNTERS_BY_FALLID); | |||||
| statement.setInt(1, fall.getFallID()); | statement.setInt(1, fall.getFallID()); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| @@ -606,9 +695,9 @@ public class DBHandler { | |||||
| public static void setUntersuchung(Untersuchung untersuchung, int mitarbid, boolean isUpdate) throws SQLException { | public static void setUntersuchung(Untersuchung untersuchung, int mitarbid, boolean isUpdate) throws SQLException { | ||||
| PreparedStatement statement; | PreparedStatement statement; | ||||
| if (isUpdate) { | if (isUpdate) { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_UNTERSUCHUNG); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_UNTERSUCHUNG); | |||||
| } else { | } else { | ||||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_UNTERSUCHUNG); | |||||
| statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_UNTERSUCHUNG); | |||||
| } | } | ||||
| statement.setInt(1, untersuchung.getDurchfuehrenderArzt().getMitarbID()); // DurchfuehrenderArzt | statement.setInt(1, untersuchung.getDurchfuehrenderArzt().getMitarbID()); // DurchfuehrenderArzt | ||||
| @@ -626,7 +715,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { | public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | |||||
| statement.setInt(1, fall.getFallID()); | statement.setInt(1, fall.getFallID()); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| @@ -639,7 +728,7 @@ public class DBHandler { | |||||
| } | } | ||||
| public static List<Kasse> getAllKassen() throws SQLException { | public static List<Kasse> getAllKassen() throws SQLException { | ||||
| Statement statement = MySqlConnFactory.getConnection().createStatement(); | |||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | |||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); | ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); | ||||
| List<Kasse> kassen = new ArrayList<>(); | List<Kasse> kassen = new ArrayList<>(); | ||||
| @@ -651,7 +740,7 @@ public class DBHandler { | |||||
| } | } | ||||
| private static Kasse getKasse(int kassenid) throws SQLException { | private static Kasse getKasse(int kassenid) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_KASSE_BY_KASSENID); | |||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_KASSE_BY_KASSENID); | |||||
| statement.setInt(1, kassenid); | statement.setInt(1, kassenid); | ||||
| ResultSet rs = statement.executeQuery(); | ResultSet rs = statement.executeQuery(); | ||||
| @@ -7,14 +7,14 @@ import java.sql.SQLException; | |||||
| /** | /** | ||||
| * MySQL Connection Factory. | * MySQL Connection Factory. | ||||
| */ | */ | ||||
| public class MySqlConnFactory { | |||||
| public class MySqlConnectionFactory { | |||||
| public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01"; | public static final String URL = "jdbc:mysql://141.83.20.84:3306/pmiw15g06_v01"; | ||||
| public static final String USER = "pmiw15g06"; | public static final String USER = "pmiw15g06"; | ||||
| public static final String PASS = "AX3yQSYJSH43PrSz"; | public static final String PASS = "AX3yQSYJSH43PrSz"; | ||||
| public static final String DRIVER = "com.mysql.jdbc.Driver"; | public static final String DRIVER = "com.mysql.jdbc.Driver"; | ||||
| private static MySqlConnFactory instance = new MySqlConnFactory(); | |||||
| private static MySqlConnectionFactory instance = new MySqlConnectionFactory(); | |||||
| private MySqlConnFactory() { | |||||
| private MySqlConnectionFactory() { | |||||
| try { | try { | ||||
| Class.forName(DRIVER); | Class.forName(DRIVER); | ||||
| } catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
| @@ -6,7 +6,7 @@ import javafx.beans.property.SimpleStringProperty; | |||||
| /** | /** | ||||
| * Created by 627933 on 12.11.15. | * Created by 627933 on 12.11.15. | ||||
| */ | */ | ||||
| public class Mitarbeiter { | |||||
| public class Mitarbeiter implements Comparable { | |||||
| private SimpleStringProperty anrede = new SimpleStringProperty(this, "anrede"); | private SimpleStringProperty anrede = new SimpleStringProperty(this, "anrede"); | ||||
| private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweisenderArzt"); | private SimpleStringProperty einweisenderArzt = new SimpleStringProperty(this, "einweisenderArzt"); | ||||
| private SimpleStringProperty fachrichtung = new SimpleStringProperty(this, "fachrichtung"); | private SimpleStringProperty fachrichtung = new SimpleStringProperty(this, "fachrichtung"); | ||||
| @@ -30,172 +30,177 @@ public class Mitarbeiter { | |||||
| return anrede.get(); | return anrede.get(); | ||||
| } | } | ||||
| public SimpleStringProperty anredeProperty() { | |||||
| return anrede; | |||||
| } | |||||
| public void setAnrede(String anrede) { | public void setAnrede(String anrede) { | ||||
| this.anrede.set(anrede); | this.anrede.set(anrede); | ||||
| } | } | ||||
| public String getEinweisenderArzt() { | |||||
| return einweisenderArzt.get(); | |||||
| public SimpleStringProperty anredeProperty() { | |||||
| return anrede; | |||||
| } | } | ||||
| public SimpleStringProperty einweisenderArztProperty() { | |||||
| return einweisenderArzt; | |||||
| public String getEinweisenderArzt() { | |||||
| return einweisenderArzt.get(); | |||||
| } | } | ||||
| public void setEinweisenderArzt(String einweisenderArzt) { | public void setEinweisenderArzt(String einweisenderArzt) { | ||||
| this.einweisenderArzt.set(einweisenderArzt); | this.einweisenderArzt.set(einweisenderArzt); | ||||
| } | } | ||||
| public String getFachrichtung() { | |||||
| return fachrichtung.get(); | |||||
| public SimpleStringProperty einweisenderArztProperty() { | |||||
| return einweisenderArzt; | |||||
| } | } | ||||
| public SimpleStringProperty fachrichtungProperty() { | |||||
| return fachrichtung; | |||||
| public String getFachrichtung() { | |||||
| return fachrichtung.get(); | |||||
| } | } | ||||
| public void setFachrichtung(String fachrichtung) { | public void setFachrichtung(String fachrichtung) { | ||||
| this.fachrichtung.set(fachrichtung); | this.fachrichtung.set(fachrichtung); | ||||
| } | } | ||||
| public String getFachrichtungKurz() { | |||||
| return fachrichtungKurz.get(); | |||||
| public SimpleStringProperty fachrichtungProperty() { | |||||
| return fachrichtung; | |||||
| } | } | ||||
| public SimpleStringProperty fachrichtungKurzProperty() { | |||||
| return fachrichtungKurz; | |||||
| public String getFachrichtungKurz() { | |||||
| return fachrichtungKurz.get(); | |||||
| } | } | ||||
| public void setFachrichtungKurz(String fachrichtungKurz) { | public void setFachrichtungKurz(String fachrichtungKurz) { | ||||
| this.fachrichtungKurz.set(fachrichtungKurz); | this.fachrichtungKurz.set(fachrichtungKurz); | ||||
| } | } | ||||
| public String getLand() { | |||||
| return land.get(); | |||||
| public SimpleStringProperty fachrichtungKurzProperty() { | |||||
| return fachrichtungKurz; | |||||
| } | } | ||||
| public SimpleStringProperty landProperty() { | |||||
| return land; | |||||
| public String getLand() { | |||||
| return land.get(); | |||||
| } | } | ||||
| public void setLand(String land) { | public void setLand(String land) { | ||||
| this.land.set(land); | this.land.set(land); | ||||
| } | } | ||||
| public int getMitarbID() { | |||||
| return mitarbID.get(); | |||||
| public SimpleStringProperty landProperty() { | |||||
| return land; | |||||
| } | } | ||||
| public SimpleIntegerProperty mitarbIDProperty() { | |||||
| return mitarbID; | |||||
| public int getMitarbID() { | |||||
| return mitarbID.get(); | |||||
| } | } | ||||
| public void setMitarbID(int mitarbID) { | public void setMitarbID(int mitarbID) { | ||||
| this.mitarbID.set(mitarbID); | this.mitarbID.set(mitarbID); | ||||
| } | } | ||||
| public String getNachname() { | |||||
| return nachname.get(); | |||||
| public SimpleIntegerProperty mitarbIDProperty() { | |||||
| return mitarbID; | |||||
| } | } | ||||
| public SimpleStringProperty nachnameProperty() { | |||||
| return nachname; | |||||
| public String getNachname() { | |||||
| return nachname.get(); | |||||
| } | } | ||||
| public void setNachname(String nachname) { | public void setNachname(String nachname) { | ||||
| this.nachname.set(nachname); | this.nachname.set(nachname); | ||||
| } | } | ||||
| public String getPlz() { | |||||
| return plz.get(); | |||||
| public SimpleStringProperty nachnameProperty() { | |||||
| return nachname; | |||||
| } | } | ||||
| public SimpleStringProperty plzProperty() { | |||||
| return plz; | |||||
| public String getPlz() { | |||||
| return plz.get(); | |||||
| } | } | ||||
| public void setPlz(String plz) { | public void setPlz(String plz) { | ||||
| this.plz.set(plz); | this.plz.set(plz); | ||||
| } | } | ||||
| public String getStadt() { | |||||
| return stadt.get(); | |||||
| public SimpleStringProperty plzProperty() { | |||||
| return plz; | |||||
| } | } | ||||
| public SimpleStringProperty stadtProperty() { | |||||
| return stadt; | |||||
| public String getStadt() { | |||||
| return stadt.get(); | |||||
| } | } | ||||
| public void setStadt(String stadt) { | public void setStadt(String stadt) { | ||||
| this.stadt.set(stadt); | this.stadt.set(stadt); | ||||
| } | } | ||||
| public String getStrasse1() { | |||||
| return strasse1.get(); | |||||
| public SimpleStringProperty stadtProperty() { | |||||
| return stadt; | |||||
| } | } | ||||
| public SimpleStringProperty strasse1Property() { | |||||
| return strasse1; | |||||
| public String getStrasse1() { | |||||
| return strasse1.get(); | |||||
| } | } | ||||
| public void setStrasse1(String strasse1) { | public void setStrasse1(String strasse1) { | ||||
| this.strasse1.set(strasse1); | this.strasse1.set(strasse1); | ||||
| } | } | ||||
| public String getStrasse2() { | |||||
| return strasse2.get(); | |||||
| public SimpleStringProperty strasse1Property() { | |||||
| return strasse1; | |||||
| } | } | ||||
| public SimpleStringProperty strasse2Property() { | |||||
| return strasse2; | |||||
| public String getStrasse2() { | |||||
| return strasse2.get(); | |||||
| } | } | ||||
| public void setStrasse2(String strasse2) { | public void setStrasse2(String strasse2) { | ||||
| this.strasse2.set(strasse2); | this.strasse2.set(strasse2); | ||||
| } | } | ||||
| public String getTelefon() { | |||||
| return telefon.get(); | |||||
| public SimpleStringProperty strasse2Property() { | |||||
| return strasse2; | |||||
| } | } | ||||
| public SimpleStringProperty telefonProperty() { | |||||
| return telefon; | |||||
| public String getTelefon() { | |||||
| return telefon.get(); | |||||
| } | } | ||||
| public void setTelefon(String telefon) { | public void setTelefon(String telefon) { | ||||
| this.telefon.set(telefon); | this.telefon.set(telefon); | ||||
| } | } | ||||
| public String getTitel() { | |||||
| return titel.get(); | |||||
| public SimpleStringProperty telefonProperty() { | |||||
| return telefon; | |||||
| } | } | ||||
| public SimpleStringProperty titelProperty() { | |||||
| return titel; | |||||
| public String getTitel() { | |||||
| return titel.get(); | |||||
| } | } | ||||
| public void setTitel(String titel) { | public void setTitel(String titel) { | ||||
| this.titel.set(titel); | this.titel.set(titel); | ||||
| } | } | ||||
| public String getVorname() { | |||||
| return vorname.get(); | |||||
| public SimpleStringProperty titelProperty() { | |||||
| return titel; | |||||
| } | } | ||||
| public SimpleStringProperty vornameProperty() { | |||||
| return vorname; | |||||
| public String getVorname() { | |||||
| return vorname.get(); | |||||
| } | } | ||||
| public void setVorname(String vorname) { | public void setVorname(String vorname) { | ||||
| this.vorname.set(vorname); | this.vorname.set(vorname); | ||||
| } | } | ||||
| public SimpleStringProperty vornameProperty() { | |||||
| return vorname; | |||||
| } | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return getNachname() + ", " + getVorname(); | return getNachname() + ", " + getVorname(); | ||||
| } | } | ||||
| @Override | |||||
| public int compareTo(Object o) { | |||||
| return nachname.get().compareTo(((Mitarbeiter) o).getNachname()); | |||||
| } | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package de.uniluebeck.mi.projmi6.model; | package de.uniluebeck.mi.projmi6.model; | ||||
| import javafx.beans.property.SimpleObjectProperty; | import javafx.beans.property.SimpleObjectProperty; | ||||
| import javafx.collections.FXCollections; | |||||
| import javafx.collections.ObservableList; | import javafx.collections.ObservableList; | ||||
| /** | /** | ||||
| @@ -17,60 +18,62 @@ public class Stammdaten { | |||||
| return opsCodes.get(); | return opsCodes.get(); | ||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<OpsCode>> opsCodesProperty() { | |||||
| return opsCodes; | |||||
| public void setOpsCodes(ObservableList<OpsCode> opsCodes) { | |||||
| this.opsCodesProperty().set(opsCodes); | |||||
| } | } | ||||
| public void setOpsCodes(ObservableList<OpsCode> opsCodes){ | |||||
| this.opsCodesProperty().set(opsCodes); | |||||
| public SimpleObjectProperty<ObservableList<OpsCode>> opsCodesProperty() { | |||||
| return opsCodes; | |||||
| } | } | ||||
| public ObservableList<Icd10Code> getIcd10Codes() { | public ObservableList<Icd10Code> getIcd10Codes() { | ||||
| return icd10Codes.get(); | return icd10Codes.get(); | ||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||||
| return icd10Codes; | |||||
| } | |||||
| public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | public void setIcd10Codes(ObservableList<Icd10Code> icd10Codes) { | ||||
| this.icd10Codes.set(icd10Codes); | this.icd10Codes.set(icd10Codes); | ||||
| } | } | ||||
| public ObservableList<Station> getStationen() { | |||||
| return stationen.get(); | |||||
| public SimpleObjectProperty<ObservableList<Icd10Code>> icd10CodesProperty() { | |||||
| return icd10Codes; | |||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Station>> stationenProperty() { | |||||
| return stationen; | |||||
| public ObservableList<Station> getStationen() { | |||||
| return stationen.get(); | |||||
| } | } | ||||
| public void setStationen(ObservableList<Station> stationen) { | public void setStationen(ObservableList<Station> stationen) { | ||||
| FXCollections.sort(stationen); | |||||
| this.stationen.set(stationen); | this.stationen.set(stationen); | ||||
| } | } | ||||
| public ObservableList<Mitarbeiter> getMitarbeiter() { | |||||
| return mitarbeiter.get(); | |||||
| public SimpleObjectProperty<ObservableList<Station>> stationenProperty() { | |||||
| return stationen; | |||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiterProperty() { | |||||
| return mitarbeiter; | |||||
| public ObservableList<Mitarbeiter> getMitarbeiter() { | |||||
| return mitarbeiter.get(); | |||||
| } | } | ||||
| public void setMitarbeiter(ObservableList<Mitarbeiter> mitarbeiter) { | public void setMitarbeiter(ObservableList<Mitarbeiter> mitarbeiter) { | ||||
| FXCollections.sort(mitarbeiter); | |||||
| this.mitarbeiter.set(mitarbeiter); | this.mitarbeiter.set(mitarbeiter); | ||||
| } | } | ||||
| public ObservableList<Kasse> getKassen() { | |||||
| return kassen.get(); | |||||
| public SimpleObjectProperty<ObservableList<Mitarbeiter>> mitarbeiterProperty() { | |||||
| return mitarbeiter; | |||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Kasse>> kassenProperty() { | |||||
| return kassen; | |||||
| public ObservableList<Kasse> getKassen() { | |||||
| return kassen.get(); | |||||
| } | } | ||||
| public void setKassen(ObservableList<Kasse> kassen) { | public void setKassen(ObservableList<Kasse> kassen) { | ||||
| this.kassen.set(kassen); | this.kassen.set(kassen); | ||||
| } | } | ||||
| public SimpleObjectProperty<ObservableList<Kasse>> kassenProperty() { | |||||
| return kassen; | |||||
| } | |||||
| } | } | ||||
| @@ -6,63 +6,80 @@ import javafx.beans.property.SimpleStringProperty; | |||||
| /** | /** | ||||
| * Created by 630030 on 12.11.15. | * Created by 630030 on 12.11.15. | ||||
| */ | */ | ||||
| public class Station { | |||||
| public class Station implements Comparable { | |||||
| private SimpleStringProperty bezeichnung = new SimpleStringProperty(this, "bezeichnung"); | private SimpleStringProperty bezeichnung = new SimpleStringProperty(this, "bezeichnung"); | ||||
| private SimpleStringProperty bezeichnungLang = new SimpleStringProperty(this, "bezeichnungLang"); | private SimpleStringProperty bezeichnungLang = new SimpleStringProperty(this, "bezeichnungLang"); | ||||
| private SimpleStringProperty station = new SimpleStringProperty(this, "station"); | private SimpleStringProperty station = new SimpleStringProperty(this, "station"); | ||||
| private SimpleIntegerProperty stationstyp = new SimpleIntegerProperty( this, "stationstyp"); | |||||
| private SimpleIntegerProperty stationstyp = new SimpleIntegerProperty(this, "stationstyp"); | |||||
| private SimpleStringProperty abteilung = new SimpleStringProperty(this, "abteilung"); | |||||
| public String getAbteilung() { | |||||
| return abteilung.get(); | |||||
| } | |||||
| public String getBezeichnung() { | |||||
| return bezeichnung.get(); | |||||
| public void setAbteilung(String abteilung) { | |||||
| this.abteilung.set(abteilung); | |||||
| } | } | ||||
| public SimpleStringProperty bezeichnungProperty() { | |||||
| return bezeichnung; | |||||
| public SimpleStringProperty abteilungProperty() { | |||||
| return abteilung; | |||||
| } | |||||
| public String getBezeichnung() { | |||||
| return bezeichnung.get(); | |||||
| } | } | ||||
| public void setBezeichnung(String bezeichnung) { | public void setBezeichnung(String bezeichnung) { | ||||
| this.bezeichnung.set(bezeichnung); | this.bezeichnung.set(bezeichnung); | ||||
| } | } | ||||
| public String getBezeichnungLang() { | |||||
| return bezeichnungLang.get(); | |||||
| public SimpleStringProperty bezeichnungProperty() { | |||||
| return bezeichnung; | |||||
| } | } | ||||
| public SimpleStringProperty bezeichnungLangProperty() { | |||||
| return bezeichnungLang; | |||||
| public String getBezeichnungLang() { | |||||
| return bezeichnungLang.get(); | |||||
| } | } | ||||
| public void setBezeichnungLang(String bezeichnungLang) { | public void setBezeichnungLang(String bezeichnungLang) { | ||||
| this.bezeichnungLang.set(bezeichnungLang); | this.bezeichnungLang.set(bezeichnungLang); | ||||
| } | } | ||||
| public String getStation() { | |||||
| return station.get(); | |||||
| public SimpleStringProperty bezeichnungLangProperty() { | |||||
| return bezeichnungLang; | |||||
| } | } | ||||
| public SimpleStringProperty stationProperty() { | |||||
| return station; | |||||
| public String getStation() { | |||||
| return station.get(); | |||||
| } | } | ||||
| public void setStation(String station) { | public void setStation(String station) { | ||||
| this.station.set(station); | this.station.set(station); | ||||
| } | } | ||||
| public int getStationstyp() { | |||||
| return stationstyp.get(); | |||||
| public SimpleStringProperty stationProperty() { | |||||
| return station; | |||||
| } | } | ||||
| public SimpleIntegerProperty stationstypProperty() { | |||||
| return stationstyp; | |||||
| public int getStationstyp() { | |||||
| return stationstyp.get(); | |||||
| } | } | ||||
| public void setStationstyp(int stationstyp) { | public void setStationstyp(int stationstyp) { | ||||
| this.stationstyp.set(stationstyp); | this.stationstyp.set(stationstyp); | ||||
| } | } | ||||
| public SimpleIntegerProperty stationstypProperty() { | |||||
| return stationstyp; | |||||
| } | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return getBezeichnung(); | return getBezeichnung(); | ||||
| } | } | ||||
| @Override | |||||
| public int compareTo(Object o) { | |||||
| return bezeichnung.get().compareTo(((Station) o).getBezeichnung()); | |||||
| } | |||||
| } | } | ||||
| @@ -12,33 +12,35 @@ public class StationsHistorie extends Version { | |||||
| private SimpleObjectProperty<LocalDateTime> aufnahmeDatum = new SimpleObjectProperty<>(this, "aufnahmeDatum"); | private SimpleObjectProperty<LocalDateTime> aufnahmeDatum = new SimpleObjectProperty<>(this, "aufnahmeDatum"); | ||||
| private SimpleObjectProperty<LocalDateTime> entlassungsDatum = new SimpleObjectProperty<>(this, "entlassungsDatum"); | private SimpleObjectProperty<LocalDateTime> entlassungsDatum = new SimpleObjectProperty<>(this, "entlassungsDatum"); | ||||
| private Fall fall; | private Fall fall; | ||||
| private int fallID; // platte Objektstruktur! | |||||
| private Station station; | private Station station; | ||||
| private String stationKey; // platte Objektstruktur! | |||||
| private SimpleIntegerProperty StatHistID = new SimpleIntegerProperty(this, "stathistid"); | private SimpleIntegerProperty StatHistID = new SimpleIntegerProperty(this, "stathistid"); | ||||
| public LocalDateTime getAufnahmeDatum() { | public LocalDateTime getAufnahmeDatum() { | ||||
| return aufnahmeDatum.get(); | return aufnahmeDatum.get(); | ||||
| } | } | ||||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||||
| return aufnahmeDatum; | |||||
| } | |||||
| public void setAufnahmeDatum(LocalDateTime aufnahmeDatum) { | public void setAufnahmeDatum(LocalDateTime aufnahmeDatum) { | ||||
| this.aufnahmeDatum.set(aufnahmeDatum); | this.aufnahmeDatum.set(aufnahmeDatum); | ||||
| } | } | ||||
| public LocalDateTime getEntlassungsDatum() { | |||||
| return entlassungsDatum.get(); | |||||
| public SimpleObjectProperty<LocalDateTime> aufnahmeDatumProperty() { | |||||
| return aufnahmeDatum; | |||||
| } | } | ||||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||||
| return entlassungsDatum; | |||||
| public LocalDateTime getEntlassungsDatum() { | |||||
| return entlassungsDatum.get(); | |||||
| } | } | ||||
| public void setEntlassungsDatum(LocalDateTime entlassungsDatum) { | public void setEntlassungsDatum(LocalDateTime entlassungsDatum) { | ||||
| this.entlassungsDatum.set(entlassungsDatum); | this.entlassungsDatum.set(entlassungsDatum); | ||||
| } | } | ||||
| public SimpleObjectProperty<LocalDateTime> entlassungsDatumProperty() { | |||||
| return entlassungsDatum; | |||||
| } | |||||
| public Fall getFall() { | public Fall getFall() { | ||||
| return fall; | return fall; | ||||
| } | } | ||||
| @@ -59,11 +61,27 @@ public class StationsHistorie extends Version { | |||||
| return StatHistID.get(); | return StatHistID.get(); | ||||
| } | } | ||||
| public void setStatHistID(int statHistID) { | |||||
| this.StatHistID.set(statHistID); | |||||
| } | |||||
| public SimpleIntegerProperty statHistIDProperty() { | public SimpleIntegerProperty statHistIDProperty() { | ||||
| return StatHistID; | return StatHistID; | ||||
| } | } | ||||
| public void setStatHistID(int statHistID) { | |||||
| this.StatHistID.set(statHistID); | |||||
| public int getFallID() { | |||||
| return fallID; | |||||
| } | |||||
| public void setFallID(int fallID) { | |||||
| this.fallID = fallID; | |||||
| } | |||||
| public String getStationKey() { | |||||
| return stationKey; | |||||
| } | |||||
| public void setStationKey(String stationKey) { | |||||
| this.stationKey = stationKey; | |||||
| } | } | ||||
| } | } | ||||
| @@ -14,30 +14,16 @@ | |||||
| <children> | <children> | ||||
| <Label text="Patient:"/> | <Label text="Patient:"/> | ||||
| <Label fx:id="fallPatID" text="John Doe (PatID = XXX)" GridPane.columnIndex="1"/> | <Label fx:id="fallPatID" text="John Doe (PatID = XXX)" GridPane.columnIndex="1"/> | ||||
| <Label text="Aufnahmedatum:" GridPane.rowIndex="1"/> | <Label text="Aufnahmedatum:" GridPane.rowIndex="1"/> | ||||
| <!-- <HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> | |||||
| <children> | |||||
| <DatePicker fx:id="fallAufnDate"/> | |||||
| <TextField fx:id="fallAufnTime" prefColumnCount="5" promptText="HH:MM"/> | |||||
| <Button fx:id="btnFallAufnNow" mnemonicParsing="false" onAction="#clickedFallAufnNow" | |||||
| text="Jetzt"/> | |||||
| </children> | |||||
| <GridPane.margin> | |||||
| <Insets/> | |||||
| </GridPane.margin> | |||||
| </HBox>--> | |||||
| <DateTimePicker GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="dtTmAufnahme" /> | <DateTimePicker GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="dtTmAufnahme" /> | ||||
| <Label text="Entlassungsdatum:" GridPane.rowIndex="2"/> | <Label text="Entlassungsdatum:" GridPane.rowIndex="2"/> | ||||
| <!--<HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="2"> | |||||
| <children> | |||||
| <DatePicker fx:id="fallEntlDate"/> | |||||
| <TextField fx:id="fallEntlTime" prefColumnCount="5" promptText="HH:MM"/> | |||||
| <Button fx:id="btnFallEntlNow" mnemonicParsing="false" onAction="#clickedFallEntlNow" | |||||
| text="Jetzt"/> | |||||
| </children> | |||||
| </HBox>--> | |||||
| <DateTimePicker GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="dtTmEntlassung" /> | <DateTimePicker GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="dtTmEntlassung" /> | ||||
| <Label text="Versichertennummer:" GridPane.rowIndex="3"/> | <Label text="Versichertennummer:" GridPane.rowIndex="3"/> | ||||
| <TextField fx:id="fallVersichertennummer" GridPane.columnIndex="1" GridPane.rowIndex="3"/> | |||||
| <Label text="Einweisender Arzt:" GridPane.rowIndex="4"/> | <Label text="Einweisender Arzt:" GridPane.rowIndex="4"/> | ||||
| <HBox alignment="CENTER_LEFT" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="4"> | <HBox alignment="CENTER_LEFT" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="4"> | ||||
| <children> | <children> | ||||
| @@ -46,11 +32,13 @@ | |||||
| <CheckBox fx:id="fallSelbsteinweisung" mnemonicParsing="false" text="Selbsteinweisung"/> | <CheckBox fx:id="fallSelbsteinweisung" mnemonicParsing="false" text="Selbsteinweisung"/> | ||||
| </children> | </children> | ||||
| </HBox> | </HBox> | ||||
| <Label text="Fallart:" GridPane.rowIndex="5"/> | <Label text="Fallart:" GridPane.rowIndex="5"/> | ||||
| <ComboBox fx:id="fallFallart" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5"/> | <ComboBox fx:id="fallFallart" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="5"/> | ||||
| <Label text="Kasse:" GridPane.rowIndex="6"/> | <Label text="Kasse:" GridPane.rowIndex="6"/> | ||||
| <ComboBox fx:id="fallKasse" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/> | |||||
| <TextField fx:id="fallVersichertennummer" GridPane.columnIndex="1" GridPane.rowIndex="3"/> | |||||
| <ComboBox fx:id="fallKasse" prefWidth="250.0" GridPane.columnIndex="1" GridPane.rowIndex="6"/> | |||||
| <Label text="Hauptdiagnose:" GridPane.rowIndex="7"/> | <Label text="Hauptdiagnose:" GridPane.rowIndex="7"/> | ||||
| <ComboBox fx:id="fallHauptdiagnose" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="7"/> | <ComboBox fx:id="fallHauptdiagnose" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="7"/> | ||||
| </children> | </children> | ||||
| @@ -58,9 +58,10 @@ | |||||
| <children> | <children> | ||||
| <ToolBar prefHeight="40.0" prefWidth="200.0"> | <ToolBar prefHeight="40.0" prefWidth="200.0"> | ||||
| <items> | <items> | ||||
| <Label text="Station:" /> | |||||
| <ComboBox fx:id="cmbStationenFilter" prefWidth="150.0" promptText="Stationen" /> | |||||
| <ComboBox fx:id="cmbStationenFilter" prefWidth="250.0" promptText="Station auswählen..." /> | |||||
| <ToggleButton fx:id="btnEntlassenePatientenZeigen" mnemonicParsing="false" text="Entlassene Patienten zeigen" /> | <ToggleButton fx:id="btnEntlassenePatientenZeigen" mnemonicParsing="false" text="Entlassene Patienten zeigen" /> | ||||
| <Pane HBox.hgrow="ALWAYS" /> | |||||
| <Button fx:id="btnStatRefresh" text="Liste aktualisieren" onAction="#clickedRefreshStation"/> | |||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <SplitPane prefHeight="160.0" prefWidth="200.0" VBox.vgrow="ALWAYS"> | <SplitPane prefHeight="160.0" prefWidth="200.0" VBox.vgrow="ALWAYS"> | ||||
| @@ -19,19 +19,21 @@ | |||||
| <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" onAction="#clickedCreateAufenthalt"/> | <Button mnemonicParsing="false" text="Neuen Aufenthalt erstellen" onAction="#clickedCreateAufenthalt"/> | ||||
| </items> | </items> | ||||
| </ToolBar> | </ToolBar> | ||||
| <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie"> | |||||
| <TableView prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" fx:id="tblStationsHistorie" > | |||||
| <columns> | <columns> | ||||
| <TableColumn prefWidth="75.0" text="Abteilung" fx:id="colStatHistAbteilung"/> | |||||
| <TableColumn prefWidth="75.0" text="Station" fx:id="colStatHistStation"/> | <TableColumn prefWidth="75.0" text="Station" fx:id="colStatHistStation"/> | ||||
| <TableColumn prefWidth="75.0" text="Aufnahme" fx:id="colStatHistAufnahmeDatum"/> | <TableColumn prefWidth="75.0" text="Aufnahme" fx:id="colStatHistAufnahmeDatum"/> | ||||
| <TableColumn prefWidth="75.0" text="Entlassung" fx:id="colStatHistEntlassungsDatum"/> | <TableColumn prefWidth="75.0" text="Entlassung" fx:id="colStatHistEntlassungsDatum"/> | ||||
| </columns> | </columns> | ||||
| <columnResizePolicy> | |||||
| <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> | |||||
| </columnResizePolicy> | |||||
| </TableView> | </TableView> | ||||
| </children> | </children> | ||||
| </VBox> | </VBox> | ||||
| <VBox> | <VBox> | ||||
| <children> | <children> | ||||
| <GridPane VBox.vgrow="ALWAYS"> | |||||
| <GridPane VBox.vgrow="ALWAYS" fx:id="fields"> | |||||
| <columnConstraints> | <columnConstraints> | ||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | ||||
| <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> | ||||
| @@ -44,17 +46,22 @@ | |||||
| </rowConstraints> | </rowConstraints> | ||||
| <children> | <children> | ||||
| <Label text="Abteilung:"/> | <Label text="Abteilung:"/> | ||||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" fx:id="cmbAbteilung"/> | |||||
| <Label text="Station:" GridPane.rowIndex="1"/> | <Label text="Station:" GridPane.rowIndex="1"/> | ||||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="cmbStation"/> | |||||
| <Label text="Aufnahmedatum / -Zeit:" GridPane.rowIndex="2" /> | <Label text="Aufnahmedatum / -Zeit:" GridPane.rowIndex="2" /> | ||||
| <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="dtTmAufnahme"/> | <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="2" fx:id="dtTmAufnahme"/> | ||||
| <Label text="Entlassungsdatum/ -Zeit:" GridPane.rowIndex="3"/> | <Label text="Entlassungsdatum/ -Zeit:" GridPane.rowIndex="3"/> | ||||
| <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="3" fx:id="dtTmEntlassung"/> | <DateTimePicker GridPane.columnIndex="1" GridPane.rowIndex="3" fx:id="dtTmEntlassung"/> | ||||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1"/> | |||||
| <ComboBox prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1"/> | |||||
| </children> | </children> | ||||
| </GridPane> | </GridPane> | ||||
| <HBox alignment="CENTER_RIGHT"> | <HBox alignment="CENTER_RIGHT"> | ||||
| <children> | <children> | ||||
| <Button mnemonicParsing="false" text="Bearbeiten" onAction="#clickedEdit" fx:id="btnStatHistEdit"/> | |||||
| <Button mnemonicParsing="false" text="Abbrechen" onAction="#clickedAbort" fx:id="btnStatHistAbort"/> | |||||
| <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | <Button mnemonicParsing="false" text="Speichern" onAction="#clickedSave" fx:id="btnStatHistSave"/> | ||||
| <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | <Button disable="true" mnemonicParsing="false" text="Eintrag entfernen" fx:id="btnStatHistCancel" onAction="#clickedCancel"/> | ||||
| </children> | </children> | ||||