Explorar el Código

FallProperty des FallControllers angepasst

Patientenliste wird beim Erstellen eines neuen Patienten neu geladen
Patientenladen aus eigenem Task
testBranch
Johannes hace 10 años
padre
commit
d454e8a862
Se han modificado 5 ficheros con 90 adiciones y 33 borrados
  1. +3
    -2
      src/main/java/de/uniluebeck/mi/projmi6/Main.java
  2. +7
    -5
      src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java
  3. +7
    -6
      src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java
  4. +5
    -3
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java
  5. +68
    -17
      src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java

+ 3
- 2
src/main/java/de/uniluebeck/mi/projmi6/Main.java Ver fichero

@@ -13,6 +13,7 @@ import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
@@ -63,7 +64,7 @@ public class Main extends Application {
DBHandler.getAllStationen())
);

System.out.printf("Lade GUI...");
System.out.println("Lade GUI...");
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getClassLoader().getResource("main.fxml"));
fxmlLoader.setControllerFactory(mainController.getControllerFactory());
@@ -121,7 +122,7 @@ public class Main extends Application {
Text gruppe6 = new Text("Gruppe 06");
gruppe6.setFont(Font.font(20));

VBox root = new VBox(gruppe6, new ImageView(icon), kis);
VBox root = new VBox(gruppe6, new ImageView(icon), kis);
root.setSpacing(20);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 400, 400);


+ 7
- 5
src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java Ver fichero

@@ -155,16 +155,18 @@ public class FallController {

@FXML
void clickedFallSave(ActionEvent event) {
copyFieldDataIntoFall(fallProperty.get());
if (this.state.get() == State.CREATE) {
Fall fall = new Fall();
copyFieldDataIntoFall(fall);
try {
DBHandler.setFall(fallProperty.get(), mainController.currentMitarbeiterProperty().get().getMitarbID());
DBHandler.setFall(fall, mainController.getCurrentMitarbeiter().getMitarbID());
//TODO Reload Faelle for Patient im MainController
} catch (SQLException e) {
e.printStackTrace();
}
} else {
try {
DBHandler.setFall(fallProperty.get(), mainController.currentMitarbeiterProperty().get().getMitarbID(), true);
DBHandler.setFall(fallProperty.get(), mainController.getCurrentMitarbeiter().getMitarbID(), true);
} catch (SQLException e) {
e.printStackTrace();
}
@@ -179,8 +181,8 @@ public class FallController {
clearFields();
this.state.set(State.CREATE);
// TODO: Jojo: Kannst Du das wieder heile machen? :D
fallProperty.unbind();
fallProperty.set(new Fall());
// fallProperty.unbind();
// fallProperty.set(new Fall());
}




+ 7
- 6
src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java Ver fichero

@@ -7,6 +7,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.scene.control.*;
import javafx.util.Callback;
@@ -35,6 +36,7 @@ public class MainController {

@FXML
private ProgressIndicator progressIndicator;

@FXML
private Button btnFallCreate;

@@ -121,14 +123,14 @@ public class MainController {

public void increaseParallelTaskCount(){
parallelTaskCount++;
if(parallelTaskCount>0){
if(parallelTaskCount>0 && progressIndicator!=null){
progressIndicator.setVisible(true);
}
}

public void decreaseParallelTaskCount(){
parallelTaskCount++;
if(parallelTaskCount<=0){
parallelTaskCount--;
if(parallelTaskCount<=0 && progressIndicator!=null){
parallelTaskCount = 0;
progressIndicator.setVisible(false);
}
@@ -157,9 +159,6 @@ public class MainController {
System.out.println(faelle);
System.out.println("Liste der Faelle hat "+ faelle.size()+ " Eintrage ");
lvFall.setItems(FXCollections.observableArrayList(faelle));



}catch (Exception e){
e.printStackTrace();
}
@@ -202,6 +201,8 @@ public class MainController {
}




@FXML
private void clickedCreateFall(){
tabFallDiagnose.setDisable(true);


+ 5
- 3
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java Ver fichero

@@ -109,12 +109,12 @@ public class PatientEditorController {
patFamilienstand.setValue(patient.getFamilienstand());
patGeschlecht.setValue(patient.getGeschlecht());
patVersicherungsnummer.setText(patient.getVersichertennummer());
for (Kasse kasse : patVersicherung.getItems())
for (Kasse kasse : patVersicherung.getItems()) {
if (kasse.getKassenID() == patient.getKassenID()) {
patVersicherung.getSelectionModel().select(kasse);
break;
}
}
patCave.setText(patient.getCave());

patCreator.setText(Integer.toString(patient.getErsteller()));
@@ -195,6 +195,8 @@ public class PatientEditorController {
copyFieldDataIntoPatient(patient);
try {
DBHandler.insertPatient(patient, mainController.getCurrentMitarbeiter().getMitarbID());
mainController.getPatientTablesController().updatePatientsFromDb();
((Stage) patNachname.getScene().getWindow()).close();
} catch (SQLException e) {
e.printStackTrace();
}
@@ -202,11 +204,11 @@ public class PatientEditorController {
copyFieldDataIntoPatient(patient);
try {
DBHandler.updatePatient(patient, mainController.getCurrentMitarbeiter().getMitarbID());
((Stage) patNachname.getScene().getWindow()).close();
} catch (SQLException e) {
e.printStackTrace();
}
}
((Stage) patNachname.getScene().getWindow()).close();
}

@FXML


+ 68
- 17
src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java Ver fichero

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


Cargando…
Cancelar
Guardar