Browse Source

Merge branches 'hapi' and 'master' of gogs.dittberner.it:nils/projmi into hapi

hapi
630030 10 years ago
parent
commit
87dc69732f
13 changed files with 592 additions and 316 deletions
  1. +52
    -27
      src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java
  2. +109
    -65
      src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java
  3. +84
    -64
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java
  4. +132
    -15
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java
  5. +73
    -27
      src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java
  6. +3
    -3
      src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java
  7. +62
    -57
      src/main/java/de/uniluebeck/mi/projmi6/model/Mitarbeiter.java
  8. +23
    -20
      src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java
  9. +6
    -1
      src/main/java/de/uniluebeck/mi/projmi6/model/Station.java
  10. +28
    -10
      src/main/java/de/uniluebeck/mi/projmi6/model/StationsHistorie.java
  11. +9
    -21
      src/main/resources/fall.fxml
  12. +3
    -2
      src/main/resources/patient_tables.fxml
  13. +8
    -4
      src/main/resources/stationshistorie.fxml

+ 52
- 27
src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java View File

@@ -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());


+ 109
- 65
src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java View File

@@ -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 = DBHandler.getStationsHistorieByStation("");
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();
} }




+ 84
- 64
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java View File

@@ -4,17 +4,12 @@ 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.collections.transformation.FilteredList;
@@ -30,10 +25,7 @@ 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;


/** /**
@@ -41,96 +33,78 @@ import java.util.List;
*/ */
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() {
@@ -146,15 +120,21 @@ public class PatientTablesController {
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(() -> { patientObjectBinding = Bindings.<Patient>createObjectBinding(() -> {
return patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)
? tblPatientOverview.getSelectionModel().getSelectedItem()
: null; //(Patient)tblStationOverview.getSelectionModel().getSelectedItem(); //TODO
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());
@@ -166,12 +146,6 @@ public class PatientTablesController {
updatePatientsFromDb(); updatePatientsFromDb();
} }



private ObservableList<StationsUebersichtsItem> stationsUebersicht = FXCollections.observableArrayList();

private FilteredList<StationsUebersichtsItem> stationsUebersichtsItemFilteredList = new FilteredList<StationsUebersichtsItem>(stationsUebersicht,
item -> item.getStationEntlassung() == null || !item.getStationEntlassung().isAfter(LocalDate.now()));

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"));
@@ -187,7 +161,6 @@ public class PatientTablesController {
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());
@@ -198,13 +171,7 @@ public class PatientTablesController {




cmbStationenFilter.valueProperty().addListener((observableValue, oldValue, newValue) -> { cmbStationenFilter.valueProperty().addListener((observableValue, oldValue, newValue) -> {
try {
List uebersichtsItems = DBHandler.getStationsUebersichtsItems(newValue.getStation());
stationsUebersicht.setAll(uebersichtsItems);
System.out.println(uebersichtsItems);
} catch (SQLException e) {
e.printStackTrace();
}
updateStationsHistorieFromDb();
}); });
tblStationOverview.itemsProperty().bind(Bindings.createObjectBinding(() -> { tblStationOverview.itemsProperty().bind(Bindings.createObjectBinding(() -> {
if (btnEntlassenePatientenZeigen.isSelected()) { if (btnEntlassenePatientenZeigen.isSelected()) {
@@ -220,7 +187,6 @@ public class PatientTablesController {
showEditWindow(null); showEditWindow(null);
} }



@FXML @FXML
private void clickedEditPatient() { private void clickedEditPatient() {
showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem());
@@ -253,7 +219,6 @@ public class PatientTablesController {
stage.show(); stage.show();
} }



public void updatePatientsFromDb() { public void updatePatientsFromDb() {
if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) {
System.out.println("Patienten werden bereits geladen."); System.out.println("Patienten werden bereits geladen.");
@@ -303,19 +268,72 @@ public class PatientTablesController {
thread.start(); thread.start();
} }


@FXML
private void clickedRefreshStation() {
updateStationsHistorieFromDb();
}


private Task loadPatientTask = null;
public void updateStationsHistorieFromDb() {
if (this.loadStationsHistorieTask != null) {
loadStationsHistorieTask.cancel();
}
lblTableStationEmpty.setText("Liste wird geladen...");


@FXML
private Button btnPatRefresh;
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();
}
}

@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();
}
}
};
this.loadStationsHistorieTask = loadStatHist;

Thread thread = new Thread(loadStationsHistorieTask);
thread.setDaemon(true);
thread.start();
}


@FXML @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;
} }
@@ -324,4 +342,6 @@ public class PatientTablesController {
return selectedPatientProperty().get(); return selectedPatientProperty().get();
} }




} }

+ 132
- 15
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java View File

@@ -1,15 +1,25 @@
package de.uniluebeck.mi.projmi6.controller; package de.uniluebeck.mi.projmi6.controller;


import de.uniluebeck.mi.projmi6.db.DBHandler;
import de.uniluebeck.mi.projmi6.model.Station; 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.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.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList; 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.*; import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.GridPane;


import java.sql.SQLException;
import java.time.LocalDate; 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.
@@ -33,7 +43,7 @@ public class StationsHistorieController {
private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime; private Label statHistCreator, statHistCreateTime, statHistEditor, statHistEditTime;


@FXML @FXML
private TableColumn<StationsHistorie,String>colStatHistAbteilung, colStatHistStation;
private TableColumn<StationsHistorie,String> colStatHistStation;


@FXML @FXML
private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum; private TableColumn<StationsHistorie,LocalDate> colStatHistAufnahmeDatum, colStatHistEntlassungsDatum;
@@ -45,38 +55,140 @@ public class StationsHistorieController {
private ComboBox<Station> cmbStation; private ComboBox<Station> cmbStation;


@FXML @FXML
private ComboBox<?> cmbAbteilung;
private ComboBox<String> cmbAbteilung;


public StationsHistorieController(MainController mainController){ public StationsHistorieController(MainController mainController){
this.mainController = mainController; this.mainController = mainController;
} }


@FXML
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 @FXML
private void initialize() { private void initialize() {
cmbStation.setItems(mainController.getStammdaten().getStationen());
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) -> { tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
setStationsHistorieSelected(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 @FXML
private void clickedCancel(){ 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() { public ObservableList<StationsHistorie> getStationsHistorie() {
@@ -87,14 +199,10 @@ public class StationsHistorieController {
return stationsHistorie; return stationsHistorie;
} }


public void setStationsHistorieSelected(ObservableList<StationsHistorie> stationsHistorie) {
this.stationsHistorie.set(stationsHistorie);
}


private SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorie = new SimpleObjectProperty<>();


public void setStationsHistorieSelected(StationsHistorie stationsHistorie){ public void setStationsHistorieSelected(StationsHistorie stationsHistorie){
this.stationsHistorieSelected=stationsHistorie;
if(stationsHistorie==null){ if(stationsHistorie==null){
clearFields(); clearFields();
}else { }else {
@@ -105,7 +213,7 @@ public class StationsHistorieController {




private void initColumns(){ private void initColumns(){
//colStatHistAbteilung.setCellValueFactory();
// colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, String>());
colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum")); colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum"));
colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum")); colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum"));
//colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>()); //colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>());
@@ -114,23 +222,32 @@ public class StationsHistorieController {


private void copyStationsHistorieDataIntoFields(){ private void copyStationsHistorieDataIntoFields(){


if(stationsHistorieSelected==null){
clearFields();
return;
}

//TODO cmbStation.setValue //TODO cmbStation.setValue


dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum()); dtTmAufnahme.setDateTime(stationsHistorieSelected.getAufnahmeDatum());
dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum()); dtTmEntlassung.setDateTime(stationsHistorieSelected.getEntlassungsDatum());


statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller())); statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller()));
statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString());
if(stationsHistorieSelected.getErstellDatumZeit()!=null){
statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString());
}
statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter())); statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter()));
statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString());
if(stationsHistorieSelected.getBearbeitetDatumZeit()!=null){
statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString());
}
} }


private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){

//stationsHistorie.s(colStatHistAbteilun);
stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime());
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime()); stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setStation(cmbStation.getValue()); stationsHistorie.setStation(cmbStation.getValue());
stationsHistorie.setFallID(mainController.getFall().getFallID());
stationsHistorie.setStationKey(cmbStation.getValue().getStation());
} }


private void clearFields(){ private void clearFields(){


+ 73
- 27
src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java View File

@@ -48,9 +48,9 @@ public class DBHandler {
"`LetzterBearbeiter`," + "`LetzterBearbeiter`," +
"`Ersteller`)" + "`Ersteller`)" +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
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_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`," +
@@ -97,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`=?," +
@@ -122,6 +122,21 @@ public class DBHandler {
"INNER JOIN fall f ON s.fallid = f.fallid " + "INNER JOIN fall f ON s.fallid = f.fallid " +
"INNER JOIN patient p ON f.patientid = p.id " + "INNER JOIN patient p ON f.patientid = p.id " +
"WHERE s.station = ?"; "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.
@@ -130,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<>();
@@ -179,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();
@@ -198,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
@@ -238,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<>();
@@ -268,7 +283,7 @@ public class DBHandler {
} }


public static List<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException { public static List<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException {
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION);
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();


@@ -296,7 +311,7 @@ public class DBHandler {
} }


public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException { public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException {
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID);
PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID);
statement.setInt(1, fall.getFallID()); statement.setInt(1, fall.getFallID());
ResultSet rs = statement.executeQuery(); ResultSet rs = statement.executeQuery();


@@ -308,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();


@@ -327,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();


@@ -381,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) {
@@ -455,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();


@@ -493,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<>();
@@ -505,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);
@@ -531,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<>();
@@ -543,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);
@@ -569,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<>();
@@ -581,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();
@@ -614,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();


@@ -649,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
@@ -669,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();


@@ -682,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<>();
@@ -694,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();




src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnFactory.java → src/main/java/de/uniluebeck/mi/projmi6/db/MySqlConnectionFactory.java View File

@@ -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) {

+ 62
- 57
src/main/java/de/uniluebeck/mi/projmi6/model/Mitarbeiter.java View File

@@ -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());
}
} }

+ 23
- 20
src/main/java/de/uniluebeck/mi/projmi6/model/Stammdaten.java View File

@@ -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
- 1
src/main/java/de/uniluebeck/mi/projmi6/model/Station.java View File

@@ -6,7 +6,7 @@ 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");
@@ -77,4 +77,9 @@ public class Station {
public String toString() { public String toString() {
return getBezeichnung(); return getBezeichnung();
} }

@Override
public int compareTo(Object o) {
return bezeichnung.get().compareTo(((Station) o).getBezeichnung());
}
} }

+ 28
- 10
src/main/java/de/uniluebeck/mi/projmi6/model/StationsHistorie.java View File

@@ -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;
} }
} }

+ 9
- 21
src/main/resources/fall.fxml View File

@@ -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>


+ 3
- 2
src/main/resources/patient_tables.fxml View File

@@ -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&#228;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">


+ 8
- 4
src/main/resources/stationshistorie.fxml View File

@@ -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,7 +46,7 @@
</rowConstraints> </rowConstraints>
<children> <children>
<Label text="Abteilung:"/> <Label text="Abteilung:"/>
<ComboBox disable="true" prefWidth="150.0" GridPane.columnIndex="1" fx:id="cmbAbteilung"/>
<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"/> <ComboBox prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="1" fx:id="cmbStation"/>
@@ -58,6 +60,8 @@
</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>


Loading…
Cancel
Save