Browse Source

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

hapi
630030 10 years ago
parent
commit
b136314f94
6 changed files with 244 additions and 138 deletions
  1. +1
    -1
      src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java
  2. +80
    -70
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java
  3. +80
    -42
      src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java
  4. +49
    -6
      src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java
  5. +29
    -17
      src/main/java/de/uniluebeck/mi/projmi6/model/Station.java
  6. +5
    -2
      src/main/resources/stationshistorie.fxml

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

@@ -264,7 +264,7 @@ public class MainController {
protected Void call() throws Exception { protected Void call() throws Exception {
untersuchungList = DBHandler.getUntersuchungByFall(newValue); untersuchungList = DBHandler.getUntersuchungByFall(newValue);
diagnoseList = DBHandler.getDiagnosenByFall(newValue); diagnoseList = DBHandler.getDiagnosenByFall(newValue);
//stationsHistorieList =
// stationsHistorieList = DBHandler.getStationsHistorieByStation("");
return null; return null;
} }




+ 80
- 70
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java View File

@@ -3,6 +3,7 @@ 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 ca.uhn.hl7v2.model.v251.segment.LOC;
import com.sun.org.apache.bcel.internal.generic.LoadClass; import com.sun.org.apache.bcel.internal.generic.LoadClass;
import de.uniluebeck.mi.projmi6.db.DBHandler; import de.uniluebeck.mi.projmi6.db.DBHandler;
@@ -16,6 +17,7 @@ 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.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;
@@ -37,7 +39,7 @@ import java.util.List;
/** /**
* Controller class. * Controller class.
*/ */
public class PatientTablesController{
public class PatientTablesController {


private MainController mainController; private MainController mainController;


@@ -84,8 +86,6 @@ public class PatientTablesController{
private TableColumn<Patient, String> colPatCave; private TableColumn<Patient, String> colPatCave;






@FXML @FXML
private ToggleButton btnEntlassenePatientenZeigen; private ToggleButton btnEntlassenePatientenZeigen;


@@ -124,29 +124,26 @@ public class PatientTablesController{
private Tab patientOverviewTab; private Tab patientOverviewTab;


@FXML @FXML
private TabPane patientOverviewTabPane;
private TabPane patientOverviewTabPane;




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







@FXML @FXML
public void initialize() { public void initialize() {
btnPatEdit.disableProperty().bind(tblPatientOverview.getSelectionModel().selectedItemProperty().isNull()); btnPatEdit.disableProperty().bind(tblPatientOverview.getSelectionModel().selectedItemProperty().isNull());
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..."); lblTableStationEmpty.setText("Daten werden geladen...");
@@ -154,7 +151,7 @@ public class PatientTablesController{
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) return patientOverviewTabPane.getSelectionModel().getSelectedItem().equals(patientOverviewTab)
? tblPatientOverview.getSelectionModel().getSelectedItem() ? tblPatientOverview.getSelectionModel().getSelectedItem()
: null; //(Patient)tblStationOverview.getSelectionModel().getSelectedItem(); //TODO : null; //(Patient)tblStationOverview.getSelectionModel().getSelectedItem(); //TODO
@@ -162,13 +159,20 @@ public class PatientTablesController{
tblStationOverview.getSelectionModel().selectedItemProperty(), tblStationOverview.getSelectionModel().selectedItemProperty(),
patientOverviewTabPane.getSelectionModel().selectedItemProperty()); patientOverviewTabPane.getSelectionModel().selectedItemProperty());



initColumnsPatient(); initColumnsPatient();
initColumnsStation(); initColumnsStation();


updatePatientsFromDb(); updatePatientsFromDb();
} }


private void initColumnsPatient(){

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() {
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,7 +180,7 @@ 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"));
@@ -184,7 +188,7 @@ public class PatientTablesController{
} }




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 +197,52 @@ 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) -> {
try {
List uebersichtsItems = DBHandler.getStationsUebersichtsItems(newValue.getStation());
stationsUebersicht.setAll(uebersichtsItems);
System.out.println(uebersichtsItems);
} catch (SQLException e) {
e.printStackTrace();
}
});
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"));
@@ -244,53 +254,53 @@ public class PatientTablesController{
} }




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 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 void succeeded() {
super.succeeded();
btnPatRefresh.setDisable(false);
lblTablePatientEmpty.setText("Liste ist leer.");
tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue()));
mainController.decreaseParallelTaskCount();
}


@Override
protected void failed() {
super.failed();
btnPatRefresh.setDisable(false);
lblTablePatientEmpty.setText("Laden fehlgeschlagen!");
mainController.decreaseParallelTaskCount();
tblPatientOverview.setItems(null);
if(getException()!=null){
getException().printStackTrace();
}
@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;
}
};
this.loadPatientTask = loadPatientsTask;


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




@@ -300,17 +310,17 @@ public class PatientTablesController{
private Button btnPatRefresh; private Button btnPatRefresh;


@FXML @FXML
private void clickedRefreshPatient(){
private void clickedRefreshPatient() {
updatePatientsFromDb(); updatePatientsFromDb();
} }


private ObjectBinding<Patient> patientObjectBinding = null; 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();
} }




+ 80
- 42
src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java View File

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


import de.uniluebeck.mi.projmi6.model.Fall;
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.property.SimpleObjectProperty;
import javafx.collections.ObservableList;
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 java.time.LocalDate;


/** /**
* Created by 631806 on 12.11.15. * Created by 631806 on 12.11.15.
@@ -18,29 +19,51 @@ 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>colStatHistAbteilung, 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<?> cmbAbteilung;

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



@FXML
private void initialize() {
cmbStation.setItems(mainController.getStammdaten().getStationen());
tblStationsHistorie.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
setStationsHistorieSelected(newValue);

});
}




@FXML @FXML
private void clickedCancel(){ private void clickedCancel(){


@@ -56,8 +79,22 @@ public class StationsHistorieController {


} }


public void setStationsHistorie(StationsHistorie stationsHistorie){
this.stationsHistorie = stationsHistorie;
public ObservableList<StationsHistorie> getStationsHistorie() {
return stationsHistorie.get();
}

public SimpleObjectProperty<ObservableList<StationsHistorie>> stationsHistorieProperty() {
return stationsHistorie;
}

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

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

public void setStationsHistorieSelected(StationsHistorie stationsHistorie){
if(stationsHistorie==null){ if(stationsHistorie==null){
clearFields(); clearFields();
}else { }else {
@@ -66,47 +103,48 @@ public class StationsHistorieController {


} }



private void initColumns(){
//colStatHistAbteilung.setCellValueFactory();
colStatHistAufnahmeDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("aufnahmeDatum"));
colStatHistEntlassungsDatum.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>("entlassungsDatum"));
//colStatHistStation.setCellValueFactory(new PropertyValueFactory<StationsHistorie, LocalDate>());
//
}

private void copyStationsHistorieDataIntoFields(){ 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());

//TODO cmbStation.setValue

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

statHistCreator.setText(Integer.toString(stationsHistorieSelected.getErsteller()));
statHistCreateTime.setText(stationsHistorieSelected.getErstellDatumZeit().toString());
statHistEditor.setText(Integer.toString(stationsHistorieSelected.getBearbeiter()));
statHistEditTime.setText(stationsHistorieSelected.getBearbeitetDatumZeit().toString());
} }


private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){ private void copyFieldDataIntoStationsHistorie(StationsHistorie stationsHistorie){
if(stationsHistorie==null){
clearFields();
return;
}


// stationsHistorie.set(colStatHistAbteilung.getText());
// stationsHistorie.setStation(colStatHistStation.getText());
// stationsHistorie.setAufnahmeDatum(colStatHistAufnahmeDatum.getDateTime());
// stationsHistorie.getEntlassungsDatum(colStatHistEntlassungsDatum.getDateTime());
//stationsHistorie.s(colStatHistAbteilun);
stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime()); stationsHistorie.setAufnahmeDatum(dtTmAufnahme.getDateTime());
// stationsHistorie.getEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setEntlassungsDatum(dtTmEntlassung.getDateTime());
stationsHistorie.setStation(cmbStation.getValue());
} }


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

+ 49
- 6
src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java View File

@@ -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`," +
@@ -108,7 +110,18 @@ 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 = ?";


/** /**
* Gibt alle {@link Patient} aus der DB zurueck. * Gibt alle {@link Patient} aus der DB zurueck.
@@ -249,15 +262,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 = MySqlConnFactory.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 = MySqlConnFactory.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));
@@ -331,7 +373,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.
@@ -396,7 +438,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.
*/ */


+ 29
- 17
src/main/java/de/uniluebeck/mi/projmi6/model/Station.java View File

@@ -10,57 +10,69 @@ public class Station {
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();


+ 5
- 2
src/main/resources/stationshistorie.fxml View File

@@ -44,13 +44,16 @@
</rowConstraints> </rowConstraints>
<children> <children>
<Label text="Abteilung:"/> <Label text="Abteilung:"/>
<ComboBox disable="true" 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">


Loading…
Cancel
Save