|
|
@@ -16,6 +16,9 @@ import java.util.List; |
|
|
|
|
|
|
|
|
public class MainController { |
|
|
public class MainController { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* The subcontroller instances |
|
|
|
|
|
*/ |
|
|
private FallController fallController; |
|
|
private FallController fallController; |
|
|
private DiagnoseController diagnoseController; |
|
|
private DiagnoseController diagnoseController; |
|
|
private PatientTablesController patientTablesController; |
|
|
private PatientTablesController patientTablesController; |
|
|
@@ -26,6 +29,9 @@ public class MainController { |
|
|
private MessageController messageController; |
|
|
private MessageController messageController; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* The number of JavaFX tasks that is currently running. |
|
|
|
|
|
*/ |
|
|
private int parallelTaskCount = 0; |
|
|
private int parallelTaskCount = 0; |
|
|
|
|
|
|
|
|
@FXML |
|
|
@FXML |
|
|
@@ -49,10 +55,20 @@ public class MainController { |
|
|
@FXML |
|
|
@FXML |
|
|
private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie; |
|
|
private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie; |
|
|
|
|
|
|
|
|
|
|
|
@FXML |
|
|
|
|
|
private Label lvFallPlaceholder; |
|
|
|
|
|
|
|
|
|
|
|
private Task<List<Fall>> loadFallTask = null; |
|
|
|
|
|
|
|
|
|
|
|
private Task<Void> loadCaseData = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Stammdaten stammdaten = new Stammdaten(); |
|
|
private Stammdaten stammdaten = new Stammdaten(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Controller factory for the FXMLLoader |
|
|
|
|
|
*/ |
|
|
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; |
|
|
@@ -78,11 +94,14 @@ public class MainController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Remembers the cases to show after the cases are loaded. |
|
|
|
|
|
* Set by the {@link #selectPatientAndFallId(Patient, int)} |
|
|
|
|
|
*/ |
|
|
private int fallIdToShow = -1; |
|
|
private int fallIdToShow = -1; |
|
|
@FXML |
|
|
|
|
|
private Label lvFallPlaceholder; |
|
|
|
|
|
private Task<List<Fall>> loadFallTask = null; |
|
|
|
|
|
private Task<Void> loadCaseData = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MainController() { |
|
|
public MainController() { |
|
|
fallController = new FallController(this); |
|
|
fallController = new FallController(this); |
|
|
@@ -95,42 +114,73 @@ public class MainController { |
|
|
messageController = new MessageController(this); |
|
|
messageController = new MessageController(this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the Stammdaten |
|
|
|
|
|
*/ |
|
|
public Stammdaten getStammdaten() { |
|
|
public Stammdaten getStammdaten() { |
|
|
return stammdaten; |
|
|
return stammdaten; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the controller factory. |
|
|
|
|
|
* The controller factory returns instances of the subcontroller that are created by this controller. |
|
|
|
|
|
*/ |
|
|
public Callback<Class<?>, Object> getControllerFactory() { |
|
|
public Callback<Class<?>, Object> getControllerFactory() { |
|
|
return controllerFactory; |
|
|
return controllerFactory; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the case controller |
|
|
|
|
|
*/ |
|
|
public FallController getFallController() { |
|
|
public FallController getFallController() { |
|
|
return fallController; |
|
|
return fallController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the diagnosis controller |
|
|
|
|
|
*/ |
|
|
public DiagnoseController getDiagnoseController() { |
|
|
public DiagnoseController getDiagnoseController() { |
|
|
return diagnoseController; |
|
|
return diagnoseController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the patient tables controller |
|
|
|
|
|
*/ |
|
|
public PatientTablesController getPatientTablesController() { |
|
|
public PatientTablesController getPatientTablesController() { |
|
|
return patientTablesController; |
|
|
return patientTablesController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the settings controller |
|
|
|
|
|
*/ |
|
|
public SettingsController getSettingsController() { |
|
|
public SettingsController getSettingsController() { |
|
|
return settingsController; |
|
|
return settingsController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the examinations controller |
|
|
|
|
|
*/ |
|
|
public UntersuchungenController getUntersuchungenController() { |
|
|
public UntersuchungenController getUntersuchungenController() { |
|
|
return untersuchungenController; |
|
|
return untersuchungenController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the hl7 message controller |
|
|
|
|
|
*/ |
|
|
public MessageController getMessageController() { |
|
|
public MessageController getMessageController() { |
|
|
return messageController; |
|
|
return messageController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Getter for the HL7 message log controller |
|
|
|
|
|
*/ |
|
|
public LogController getLogController() { |
|
|
public LogController getLogController() { |
|
|
return logController; |
|
|
return logController; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Increase the counter of tasks running. Makes the spinning progress view visible. |
|
|
|
|
|
*/ |
|
|
public void increaseParallelTaskCount() { |
|
|
public void increaseParallelTaskCount() { |
|
|
parallelTaskCount++; |
|
|
parallelTaskCount++; |
|
|
if (parallelTaskCount > 0 && progressIndicator != null) { |
|
|
if (parallelTaskCount > 0 && progressIndicator != null) { |
|
|
@@ -138,6 +188,9 @@ public class MainController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Decreases the counter of tasks running. Makes the progress view invisible if none is running. |
|
|
|
|
|
*/ |
|
|
public void decreaseParallelTaskCount() { |
|
|
public void decreaseParallelTaskCount() { |
|
|
parallelTaskCount--; |
|
|
parallelTaskCount--; |
|
|
if (parallelTaskCount <= 0 && progressIndicator != null) { |
|
|
if (parallelTaskCount <= 0 && progressIndicator != null) { |
|
|
@@ -146,6 +199,11 @@ public class MainController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Opens a patient and specific case in the window. |
|
|
|
|
|
* @param patient The patient to be shown. |
|
|
|
|
|
* @param fallId The case number of the patient. |
|
|
|
|
|
*/ |
|
|
public void selectPatientAndFallId(Patient patient, int fallId) { |
|
|
public void selectPatientAndFallId(Patient patient, int fallId) { |
|
|
if (patientTablesController.getSelectedPatient() == patient |
|
|
if (patientTablesController.getSelectedPatient() == patient |
|
|
&& !loadFallTask.isRunning()) { |
|
|
&& !loadFallTask.isRunning()) { |
|
|
@@ -157,6 +215,10 @@ public class MainController { |
|
|
patientTablesController.selectPatient(patient); |
|
|
patientTablesController.selectPatient(patient); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Opens a specific case by id. |
|
|
|
|
|
* @param id The case id |
|
|
|
|
|
*/ |
|
|
private void selectFallById(int id) { |
|
|
private void selectFallById(int id) { |
|
|
if (lvFall.getItems() == null) { |
|
|
if (lvFall.getItems() == null) { |
|
|
return; |
|
|
return; |
|
|
@@ -168,10 +230,13 @@ public class MainController { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Starts a task that loads all cases for the given patient and displays them |
|
|
|
|
|
* Stops other running tasks if necessary. |
|
|
|
|
|
* @param patient The patient whose cases will be loaded. |
|
|
|
|
|
*/ |
|
|
public void refreshCasesFromDb(Patient patient) { |
|
|
public void refreshCasesFromDb(Patient patient) { |
|
|
lvFall.setItems(null); //clear list |
|
|
lvFall.setItems(null); //clear list |
|
|
|
|
|
|
|
|
@@ -229,6 +294,10 @@ public class MainController { |
|
|
thread.start(); |
|
|
thread.start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* FXMLLoaders initialize()-method |
|
|
|
|
|
*/ |
|
|
@FXML |
|
|
@FXML |
|
|
private void initialize() { |
|
|
private void initialize() { |
|
|
//Init user data. |
|
|
//Init user data. |
|
|
@@ -255,6 +324,7 @@ public class MainController { |
|
|
refreshCaseData(newValue); |
|
|
refreshCaseData(newValue); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//Custom cell factory to highlight the canceled cases. |
|
|
lvFall.setCellFactory(lv -> { |
|
|
lvFall.setCellFactory(lv -> { |
|
|
return new ListCell<Fall>() { |
|
|
return new ListCell<Fall>() { |
|
|
@Override |
|
|
@Override |
|
|
@@ -281,6 +351,11 @@ public class MainController { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Loads all the data that belongs to a specific case (diagnosis, ward history, examinations) |
|
|
|
|
|
* and sets the data in the correlating controllers. |
|
|
|
|
|
* @param fall The case whose correlationg data will be loaded |
|
|
|
|
|
*/ |
|
|
private void refreshCaseData(Fall fall) { |
|
|
private void refreshCaseData(Fall fall) { |
|
|
if (loadCaseData != null && loadCaseData.isRunning()) { |
|
|
if (loadCaseData != null && loadCaseData.isRunning()) { |
|
|
loadCaseData.cancel(); |
|
|
loadCaseData.cancel(); |
|
|
@@ -359,24 +434,26 @@ public class MainController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Reloads the data to the case that is currently selected. |
|
|
|
|
|
*/ |
|
|
public void refreshCaseData() { |
|
|
public void refreshCaseData() { |
|
|
refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); |
|
|
refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* EventHandler for the {@link #btnFallCreate} |
|
|
|
|
|
*/ |
|
|
@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(); |
|
|
fallController.createNewFall(); |
|
|
lockForEdit(TabName.OVERVIEW); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
public Fall getFall() { |
|
|
public Fall getFall() { |
|
|
return lvFall.getSelectionModel().getSelectedItem(); |
|
|
return lvFall.getSelectionModel().getSelectedItem(); |
|
|
} |
|
|
} |
|
|
|