|
|
|
@@ -3,6 +3,8 @@ package de.uniluebeck.mi.projmi6.controller; |
|
|
|
/** |
|
|
|
* 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.model.Patient; |
|
|
|
import de.uniluebeck.mi.projmi6.model.Station; |
|
|
|
@@ -14,6 +16,7 @@ import javafx.beans.property.ReadOnlyObjectProperty; |
|
|
|
import javafx.beans.property.SimpleObjectProperty; |
|
|
|
import javafx.collections.FXCollections; |
|
|
|
import javafx.collections.ObservableList; |
|
|
|
import javafx.concurrent.Task; |
|
|
|
import javafx.fxml.FXML; |
|
|
|
import javafx.fxml.FXMLLoader; |
|
|
|
import javafx.scene.Parent; |
|
|
|
@@ -28,6 +31,8 @@ import java.io.IOException; |
|
|
|
import java.rmi.server.ExportException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* Controller class. |
|
|
|
@@ -91,22 +96,22 @@ public class PatientTablesController{ |
|
|
|
private TableView<StationsUebersichtsItem> tblStationOverview; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatPatId; |
|
|
|
private TableColumn<StationsUebersichtsItem, Integer> colStatPatId; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatFullName; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatGebDatum; |
|
|
|
private TableColumn<StationsUebersichtsItem, LocalDate> colStatGebDatum; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatAlter; |
|
|
|
private TableColumn<StationsUebersichtsItem, Integer> colStatAlter; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatAufnahmedatum; |
|
|
|
private TableColumn<StationsUebersichtsItem, LocalDate> colStatAufnahmedatum; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private TableColumn<StationsUebersichtsItem, String> colStatEntlassungsdatum; |
|
|
|
private TableColumn<StationsUebersichtsItem, LocalDate> colStatEntlassungsdatum; |
|
|
|
|
|
|
|
@FXML |
|
|
|
private Tab stationOverviewTab; |
|
|
|
@@ -180,12 +185,24 @@ public class PatientTablesController{ |
|
|
|
|
|
|
|
|
|
|
|
private void initColumnsStation(){ |
|
|
|
colStatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIdProperty().asString()); |
|
|
|
colStatPatId.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patId")); |
|
|
|
colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); |
|
|
|
colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty().asString()); |
|
|
|
colStatAlter.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patAgeProperty().asString()); |
|
|
|
colStatAufnahmedatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationAufnahmeProperty().asString()); |
|
|
|
colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty().asString()); |
|
|
|
colStatGebDatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patBirthdateProperty()); |
|
|
|
colStatAlter.setCellValueFactory(new PropertyValueFactory<StationsUebersichtsItem, Integer>("patAge")); |
|
|
|
colStatAufnahmedatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationAufnahmeProperty()); |
|
|
|
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)); |
|
|
|
} |
|
|
|
|
|
|
|
@FXML |
|
|
|
@@ -228,17 +245,51 @@ public class PatientTablesController{ |
|
|
|
|
|
|
|
|
|
|
|
public void updatePatientsFromDb(){ |
|
|
|
ObservableList<Patient> patientList = null; |
|
|
|
try { |
|
|
|
patientList = FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); |
|
|
|
} catch (SQLException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
tblPatientOverview.setItems(patientList); |
|
|
|
//if(!loadPatientsTask.isRunning()) { |
|
|
|
lblTablePatientEmpty.setText("Daten werden geladen..."); |
|
|
|
tblPatientOverview.setItems(null); |
|
|
|
|
|
|
|
mainController.increaseParallelTaskCount(); |
|
|
|
|
|
|
|
|
|
|
|
Task<List<Patient>>loadPatientsTask = new Task<List<Patient>>(){ |
|
|
|
|
|
|
|
@Override |
|
|
|
protected List<Patient> call() throws Exception { |
|
|
|
return FXCollections.<Patient>observableArrayList(DBHandler.getAllPatients()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void succeeded() { |
|
|
|
super.succeeded(); |
|
|
|
tblPatientOverview.setItems(FXCollections.observableArrayList(this.getValue())); |
|
|
|
lblTablePatientEmpty.setText("Es sind keine Patienten in der Datenbank"); |
|
|
|
mainController.decreaseParallelTaskCount(); |
|
|
|
System.out.println("Patientenlsite erfolgreich aus Task geladen!"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void failed() { |
|
|
|
super.failed(); |
|
|
|
mainController.decreaseParallelTaskCount(); |
|
|
|
tblPatientOverview.setItems(null); |
|
|
|
lblTablePatientEmpty.setText("Ein Fehler ist aufgetreten: "+this.getException()); |
|
|
|
if(getException()!=null){ |
|
|
|
getException().printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
Thread thread = new Thread(loadPatientsTask); |
|
|
|
thread.setDaemon(true); |
|
|
|
thread.start(); |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ObjectBinding<Patient> patientObjectBinding = null; |
|
|
|
|
|
|
|
public ObjectBinding<Patient> selectedPatientProperty(){ |
|
|
|
|