Compare commits
6 commits
dba043ec1b
...
fcca90288c
Author | SHA1 | Date | |
---|---|---|---|
fcca90288c | |||
765d0c8dd2 | |||
8cb52b4162 | |||
1cbe39b481 | |||
b83f3e3ccd | |||
1ebd9ee318 |
33 changed files with 1007 additions and 1240 deletions
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="SqlDialectMappings">
|
<component name="SqlDialectMappings">
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/datastorage/TreatmentDao.java" dialect="GenericSQL" />
|
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/patient/PatientDao.java" dialect="GenericSQL" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java" dialect="GenericSQL" />
|
||||||
<file url="PROJECT" dialect="SQLite" />
|
<file url="PROJECT" dialect="SQLite" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
Binary file not shown.
|
@ -6,7 +6,7 @@ import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.control.TabPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -23,12 +23,12 @@ public class Main extends Application {
|
||||||
public void mainWindow() {
|
public void mainWindow() {
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/MainWindowView.fxml"));
|
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/MainWindowView.fxml"));
|
||||||
BorderPane pane = loader.load();
|
TabPane pane = loader.load();
|
||||||
|
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
this.primaryStage.setTitle("NHPlus");
|
this.primaryStage.setTitle("NHPlus");
|
||||||
this.primaryStage.setScene(scene);
|
this.primaryStage.setScene(scene);
|
||||||
this.primaryStage.setResizable(false);
|
this.primaryStage.setResizable(true);
|
||||||
this.primaryStage.show();
|
this.primaryStage.show();
|
||||||
|
|
||||||
this.primaryStage.setOnCloseRequest(event -> {
|
this.primaryStage.setOnCloseRequest(event -> {
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
package de.hitec.nhplus.controller;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.Main;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MainWindowController {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private BorderPane mainBorderPane;
|
|
||||||
@FXML
|
|
||||||
public void initialize() {
|
|
||||||
handleShowAllPatient(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private void handleShowAllPatient(ActionEvent event) {
|
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/AllPatientView.fxml"));
|
|
||||||
try {
|
|
||||||
mainBorderPane.setCenter(loader.load());
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private void handleShowAllTreatments(ActionEvent event) {
|
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/AllTreatmentView.fxml"));
|
|
||||||
try {
|
|
||||||
mainBorderPane.setCenter(loader.load());
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,140 +0,0 @@
|
||||||
package de.hitec.nhplus.controller;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
|
||||||
import de.hitec.nhplus.datastorage.TreatmentDao;
|
|
||||||
import de.hitec.nhplus.model.Patient;
|
|
||||||
import de.hitec.nhplus.model.Treatment;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
import javafx.beans.value.ChangeListener;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.util.StringConverter;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
import static de.hitec.nhplus.utils.Validator.*;
|
|
||||||
|
|
||||||
public class NewTreatmentController
|
|
||||||
{
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelFirstName;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelSurname;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldBegin;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldEnd;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldDescription;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextArea textAreaRemarks;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private DatePicker datePicker;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Button buttonAdd;
|
|
||||||
|
|
||||||
private AllTreatmentController controller;
|
|
||||||
private Patient patient;
|
|
||||||
private Stage stage;
|
|
||||||
|
|
||||||
public void initialize(AllTreatmentController controller, Stage stage, Patient patient)
|
|
||||||
{
|
|
||||||
this.controller = controller;
|
|
||||||
this.patient = patient;
|
|
||||||
this.stage = stage;
|
|
||||||
|
|
||||||
this.buttonAdd.setDisable(true);
|
|
||||||
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
|
||||||
{
|
|
||||||
boolean isValid = isValidDate(this.datePicker.getValue())
|
|
||||||
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
|
||||||
&& isValidDescription(this.textFieldDescription.getText());
|
|
||||||
|
|
||||||
NewTreatmentController.this.buttonAdd.setDisable(!isValid);
|
|
||||||
};
|
|
||||||
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
|
|
||||||
{
|
|
||||||
boolean isValid = isValidDate(this.datePicker.getValue())
|
|
||||||
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
|
||||||
&& isValidDescription(this.textFieldDescription.getText());
|
|
||||||
|
|
||||||
NewTreatmentController.this.buttonAdd.setDisable(!isValid);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.textFieldBegin.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
|
||||||
this.textFieldEnd.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
|
||||||
this.textFieldDescription.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
|
||||||
this.textAreaRemarks.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
|
||||||
this.datePicker.valueProperty().addListener(inputNewTreatmentDateValidationListener);
|
|
||||||
|
|
||||||
this.datePicker.setConverter(new StringConverter<>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String toString(LocalDate localDate)
|
|
||||||
{
|
|
||||||
return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDate fromString(String localDate)
|
|
||||||
{
|
|
||||||
if (!isValidDate(localDate))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return DateConverter.convertStringToLocalDate(localDate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.showPatientData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showPatientData()
|
|
||||||
{
|
|
||||||
this.labelFirstName.setText(patient.getFirstName());
|
|
||||||
this.labelSurname.setText(patient.getSurname());
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleAdd()
|
|
||||||
{
|
|
||||||
LocalDate date = this.datePicker.getValue();
|
|
||||||
LocalTime begin = DateConverter.convertStringToLocalTime(textFieldBegin.getText());
|
|
||||||
LocalTime end = DateConverter.convertStringToLocalTime(textFieldEnd.getText());
|
|
||||||
String description = textFieldDescription.getText();
|
|
||||||
String remarks = textAreaRemarks.getText();
|
|
||||||
Treatment treatment = new Treatment(patient.getPid(), date, begin, end, description, remarks);
|
|
||||||
createTreatment(treatment);
|
|
||||||
controller.readAllAndShowInTableView();
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createTreatment(Treatment treatment)
|
|
||||||
{
|
|
||||||
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dao.create(treatment);
|
|
||||||
} catch (SQLException exception)
|
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleCancel()
|
|
||||||
{
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,122 +0,0 @@
|
||||||
package de.hitec.nhplus.controller;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
|
||||||
import de.hitec.nhplus.datastorage.PatientDao;
|
|
||||||
import de.hitec.nhplus.datastorage.TreatmentDao;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import de.hitec.nhplus.model.Patient;
|
|
||||||
import de.hitec.nhplus.model.Treatment;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
import static de.hitec.nhplus.utils.Validator.*;
|
|
||||||
|
|
||||||
public class TreatmentController {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelPatientName;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelCareLevel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldBegin;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldEnd;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldDescription;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextArea textAreaRemarks;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private DatePicker datePicker;
|
|
||||||
|
|
||||||
private AllTreatmentController controller;
|
|
||||||
private Stage stage;
|
|
||||||
private Patient patient;
|
|
||||||
private Treatment treatment;
|
|
||||||
|
|
||||||
public void initializeController(AllTreatmentController controller, Stage stage, Treatment treatment) {
|
|
||||||
this.stage = stage;
|
|
||||||
this.controller= controller;
|
|
||||||
|
|
||||||
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
|
||||||
try {
|
|
||||||
this.patient = pDao.read((int) treatment.getPid());
|
|
||||||
this.treatment = treatment;
|
|
||||||
showData();
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showData(){
|
|
||||||
this.labelPatientName.setText(patient.getSurname()+", "+patient.getFirstName());
|
|
||||||
this.labelCareLevel.setText(patient.getCareLevel());
|
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
|
||||||
this.datePicker.setValue(date);
|
|
||||||
this.textFieldBegin.setText(this.treatment.getBegin());
|
|
||||||
this.textFieldEnd.setText(this.treatment.getEnd());
|
|
||||||
this.textFieldDescription.setText(this.treatment.getDescription());
|
|
||||||
this.textAreaRemarks.setText(this.treatment.getRemarks());
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleChange(){
|
|
||||||
LocalDate newDate = this.datePicker.getValue();
|
|
||||||
if(!isValidDate(newDate)){
|
|
||||||
showValidationError("Date");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String newDescription = textFieldDescription.getText();
|
|
||||||
if(!isValidDescription(newDescription)){
|
|
||||||
showValidationError("Description");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String newBegin = textFieldBegin.getText();
|
|
||||||
String newEnd = textFieldEnd.getText();
|
|
||||||
if(!isValidTimeRange(newBegin, newEnd)){
|
|
||||||
showValidationError("Time Range");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String newRemarks = textAreaRemarks.getText();
|
|
||||||
if(!isValidDescription(newRemarks)){
|
|
||||||
showValidationError("Remarks");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.treatment.setDate(newDate.toString());
|
|
||||||
this.treatment.setDescription(newDescription);
|
|
||||||
this.treatment.setBegin(newBegin);
|
|
||||||
this.treatment.setEnd(newEnd);
|
|
||||||
this.treatment.setRemarks(newRemarks);
|
|
||||||
|
|
||||||
doUpdate();
|
|
||||||
controller.readAllAndShowInTableView();
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doUpdate(){
|
|
||||||
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
|
||||||
try {
|
|
||||||
dao.update(treatment);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleCancel(){
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,11 +6,11 @@ import java.util.List;
|
||||||
public interface Dao<T> {
|
public interface Dao<T> {
|
||||||
void create(T t) throws SQLException;
|
void create(T t) throws SQLException;
|
||||||
|
|
||||||
T read(long key) throws SQLException;
|
T read(int id) throws SQLException;
|
||||||
|
|
||||||
List<T> readAll() throws SQLException;
|
List<T> readAll() throws SQLException;
|
||||||
|
|
||||||
void update(T t) throws SQLException;
|
void update(T t) throws SQLException;
|
||||||
|
|
||||||
void deleteById(long key) throws SQLException;
|
void deleteById(int id) throws SQLException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package de.hitec.nhplus.datastorage;
|
package de.hitec.nhplus.datastorage;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.patient.PatientDao;
|
||||||
|
import de.hitec.nhplus.treatment.TreatmentDao;
|
||||||
|
|
||||||
public class DaoFactory {
|
public class DaoFactory {
|
||||||
|
|
||||||
private static DaoFactory instance;
|
private static DaoFactory instance;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class DaoImp<T> implements Dao<T> {
|
public abstract class DaoImp<T> implements Dao<T> {
|
||||||
protected Connection connection;
|
protected final Connection connection;
|
||||||
|
|
||||||
public DaoImp(Connection connection) {
|
public DaoImp(Connection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
@ -17,7 +17,7 @@ public abstract class DaoImp<T> implements Dao<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T read(long key) throws SQLException {
|
public T read(int key) throws SQLException {
|
||||||
T object = null;
|
T object = null;
|
||||||
ResultSet result = getReadByIDStatement(key).executeQuery();
|
ResultSet result = getReadByIDStatement(key).executeQuery();
|
||||||
if (result.next()) {
|
if (result.next()) {
|
||||||
|
@ -37,7 +37,7 @@ public abstract class DaoImp<T> implements Dao<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteById(long key) throws SQLException {
|
public void deleteById(int key) throws SQLException {
|
||||||
getDeleteStatement(key).executeUpdate();
|
getDeleteStatement(key).executeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,11 @@ public abstract class DaoImp<T> implements Dao<T> {
|
||||||
|
|
||||||
protected abstract PreparedStatement getCreateStatement(T t);
|
protected abstract PreparedStatement getCreateStatement(T t);
|
||||||
|
|
||||||
protected abstract PreparedStatement getReadByIDStatement(long key);
|
protected abstract PreparedStatement getReadByIDStatement(int key);
|
||||||
|
|
||||||
protected abstract PreparedStatement getReadAllStatement();
|
protected abstract PreparedStatement getReadAllStatement();
|
||||||
|
|
||||||
protected abstract PreparedStatement getUpdateStatement(T t);
|
protected abstract PreparedStatement getUpdateStatement(T t);
|
||||||
|
|
||||||
protected abstract PreparedStatement getDeleteStatement(long key);
|
protected abstract PreparedStatement getDeleteStatement(int key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,209 +0,0 @@
|
||||||
package de.hitec.nhplus.datastorage;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.model.Treatment;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements the Interface <code>DaoImp</code>. Overrides methods to generate specific <code>PreparedStatements</code>,
|
|
||||||
* to execute the specific SQL Statements.
|
|
||||||
*/
|
|
||||||
public class TreatmentDao extends DaoImp<Treatment> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The constructor initiates an object of <code>TreatmentDao</code> and passes the connection to its super class.
|
|
||||||
*
|
|
||||||
* @param connection Object of <code>Connection</code> to execute the SQL-statements.
|
|
||||||
*/
|
|
||||||
public TreatmentDao(Connection connection) {
|
|
||||||
super(connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to persist the given object of <code>Treatment</code>.
|
|
||||||
*
|
|
||||||
* @param treatment Object of <code>Treatment</code> to persist.
|
|
||||||
* @return <code>PreparedStatement</code> to insert the given patient.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected PreparedStatement getCreateStatement(Treatment treatment) {
|
|
||||||
PreparedStatement preparedStatement = null;
|
|
||||||
try {
|
|
||||||
final String SQL = "INSERT INTO treatment (pid, treatment_date, begin, end, description, remark) " +
|
|
||||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
|
||||||
preparedStatement.setLong(1, treatment.getPid());
|
|
||||||
preparedStatement.setString(2, treatment.getDate());
|
|
||||||
preparedStatement.setString(3, treatment.getBegin());
|
|
||||||
preparedStatement.setString(4, treatment.getEnd());
|
|
||||||
preparedStatement.setString(5, treatment.getDescription());
|
|
||||||
preparedStatement.setString(6, treatment.getRemarks());
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return preparedStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to query a treatment by a given treatment id (tid).
|
|
||||||
*
|
|
||||||
* @param tid Treatment id to query.
|
|
||||||
* @return <code>PreparedStatement</code> to query the treatment.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected PreparedStatement getReadByIDStatement(long tid) {
|
|
||||||
PreparedStatement preparedStatement = null;
|
|
||||||
try {
|
|
||||||
final String SQL = "SELECT * FROM treatment WHERE tid = ?";
|
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
|
||||||
preparedStatement.setLong(1, tid);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return preparedStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a <code>ResultSet</code> of one treatment to an object of <code>Treatment</code>.
|
|
||||||
*
|
|
||||||
* @param result ResultSet with a single row. Columns will be mapped to an object of class <code>Treatment</code>.
|
|
||||||
* @return Object of class <code>Treatment</code> with the data from the resultSet.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Treatment getInstanceFromResultSet(ResultSet result) throws SQLException {
|
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(result.getString(3));
|
|
||||||
LocalTime begin = DateConverter.convertStringToLocalTime(result.getString(4));
|
|
||||||
LocalTime end = DateConverter.convertStringToLocalTime(result.getString(5));
|
|
||||||
return new Treatment(result.getLong(1), result.getLong(2),
|
|
||||||
date, begin, end, result.getString(6), result.getString(7));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to query all treatments.
|
|
||||||
*
|
|
||||||
* @return <code>PreparedStatement</code> to query all treatments.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected PreparedStatement getReadAllStatement() {
|
|
||||||
PreparedStatement statement = null;
|
|
||||||
try {
|
|
||||||
final String SQL = "SELECT * FROM treatment";
|
|
||||||
statement = this.connection.prepareStatement(SQL);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return statement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a <code>ResultSet</code> of all treatments to an <code>ArrayList</code> with objects of class
|
|
||||||
* <code>Treatment</code>.
|
|
||||||
*
|
|
||||||
* @param result ResultSet with all rows. The columns will be mapped to objects of class <code>Treatment</code>.
|
|
||||||
* @return <code>ArrayList</code> with objects of class <code>Treatment</code> of all rows in the
|
|
||||||
* <code>ResultSet</code>.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected ArrayList<Treatment> getListFromResultSet(ResultSet result) throws SQLException {
|
|
||||||
ArrayList<Treatment> list = new ArrayList<Treatment>();
|
|
||||||
while (result.next()) {
|
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(result.getString(3));
|
|
||||||
LocalTime begin = DateConverter.convertStringToLocalTime(result.getString(4));
|
|
||||||
LocalTime end = DateConverter.convertStringToLocalTime(result.getString(5));
|
|
||||||
Treatment treatment = new Treatment(result.getLong(1), result.getLong(2),
|
|
||||||
date, begin, end, result.getString(6), result.getString(7));
|
|
||||||
list.add(treatment);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to query all treatments of a patient with a given patient id (pid).
|
|
||||||
*
|
|
||||||
* @param pid Patient id to query all treatments referencing this id.
|
|
||||||
* @return <code>PreparedStatement</code> to query all treatments of the given patient id (pid).
|
|
||||||
*/
|
|
||||||
private PreparedStatement getReadAllTreatmentsOfOnePatientByPid(long pid) {
|
|
||||||
PreparedStatement preparedStatement = null;
|
|
||||||
try {
|
|
||||||
final String SQL = "SELECT * FROM treatment WHERE pid = ?";
|
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
|
||||||
preparedStatement.setLong(1, pid);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return preparedStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Queries all treatments of a given patient id (pid) and maps the results to an <code>ArrayList</code> with
|
|
||||||
* objects of class <code>Treatment</code>.
|
|
||||||
*
|
|
||||||
* @param pid Patient id to query all treatments referencing this id.
|
|
||||||
* @return <code>ArrayList</code> with objects of class <code>Treatment</code> of all rows in the
|
|
||||||
* <code>ResultSet</code>.
|
|
||||||
*/
|
|
||||||
public List<Treatment> readTreatmentsByPid(long pid) throws SQLException {
|
|
||||||
ResultSet result = getReadAllTreatmentsOfOnePatientByPid(pid).executeQuery();
|
|
||||||
return getListFromResultSet(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to update the given treatment, identified
|
|
||||||
* by the id of the treatment (tid).
|
|
||||||
*
|
|
||||||
* @param treatment Treatment object to update.
|
|
||||||
* @return <code>PreparedStatement</code> to update the given treatment.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected PreparedStatement getUpdateStatement(Treatment treatment) {
|
|
||||||
PreparedStatement preparedStatement = null;
|
|
||||||
try {
|
|
||||||
final String SQL =
|
|
||||||
"UPDATE treatment SET " +
|
|
||||||
"pid = ?, " +
|
|
||||||
"treatment_date = ?, " +
|
|
||||||
"begin = ?, " +
|
|
||||||
"end = ?, " +
|
|
||||||
"description = ?, " +
|
|
||||||
"remark = ? " +
|
|
||||||
"WHERE tid = ?";
|
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
|
||||||
preparedStatement.setLong(1, treatment.getPid());
|
|
||||||
preparedStatement.setString(2, treatment.getDate());
|
|
||||||
preparedStatement.setString(3, treatment.getBegin());
|
|
||||||
preparedStatement.setString(4, treatment.getEnd());
|
|
||||||
preparedStatement.setString(5, treatment.getDescription());
|
|
||||||
preparedStatement.setString(6, treatment.getRemarks());
|
|
||||||
preparedStatement.setLong(7, treatment.getTid());
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return preparedStatement;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to delete a treatment with the given id.
|
|
||||||
*
|
|
||||||
* @param tid Id of the Treatment to delete.
|
|
||||||
* @return <code>PreparedStatement</code> to delete treatment with the given id.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected PreparedStatement getDeleteStatement(long tid) {
|
|
||||||
PreparedStatement preparedStatement = null;
|
|
||||||
try {
|
|
||||||
final String SQL =
|
|
||||||
"DELETE FROM treatment WHERE tid = ?";
|
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
|
||||||
preparedStatement.setLong(1, tid);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
return preparedStatement;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.hitec.nhplus.fixtures;
|
package de.hitec.nhplus.fixtures;
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.ConnectionBuilder;
|
import de.hitec.nhplus.datastorage.ConnectionBuilder;
|
||||||
import de.hitec.nhplus.model.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package de.hitec.nhplus.fixtures;
|
package de.hitec.nhplus.fixtures;
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.datastorage.PatientDao;
|
import de.hitec.nhplus.patient.PatientDao;
|
||||||
import de.hitec.nhplus.model.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -32,7 +32,7 @@ public class PatientFixture implements Fixture<Patient>
|
||||||
public void setupTable(Connection connection)
|
public void setupTable(Connection connection)
|
||||||
{
|
{
|
||||||
final String SQL = "CREATE TABLE IF NOT EXISTS patient (" +
|
final String SQL = "CREATE TABLE IF NOT EXISTS patient (" +
|
||||||
" pid INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
" id INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
||||||
" firstname TEXT NOT NULL, " +
|
" firstname TEXT NOT NULL, " +
|
||||||
" surname TEXT NOT NULL, " +
|
" surname TEXT NOT NULL, " +
|
||||||
" dateOfBirth TEXT NOT NULL, " +
|
" dateOfBirth TEXT NOT NULL, " +
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package de.hitec.nhplus.fixtures;
|
package de.hitec.nhplus.fixtures;
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.datastorage.TreatmentDao;
|
import de.hitec.nhplus.treatment.TreatmentDao;
|
||||||
import de.hitec.nhplus.model.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.model.Treatment;
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -18,7 +18,7 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime;
|
||||||
|
|
||||||
public class TreatmentFixture implements Fixture<Treatment>
|
public class TreatmentFixture implements Fixture<Treatment>
|
||||||
{
|
{
|
||||||
private Map<String, Patient> patientsByName;
|
private final Map<String, Patient> patientsByName;
|
||||||
|
|
||||||
public TreatmentFixture(Map<String, Patient> patientsByName)
|
public TreatmentFixture(Map<String, Patient> patientsByName)
|
||||||
{
|
{
|
||||||
|
@ -41,14 +41,14 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
public void setupTable(Connection connection)
|
public void setupTable(Connection connection)
|
||||||
{
|
{
|
||||||
final String SQL = "CREATE TABLE IF NOT EXISTS treatment (" +
|
final String SQL = "CREATE TABLE IF NOT EXISTS treatment (" +
|
||||||
" tid INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
" id INTEGER PRIMARY KEY AUTOINCREMENT, " +
|
||||||
" pid INTEGER NOT NULL, " +
|
" patientId INTEGER NOT NULL, " +
|
||||||
" treatment_date TEXT NOT NULL, " +
|
" treatment_date TEXT NOT NULL, " +
|
||||||
" begin TEXT NOT NULL, " +
|
" begin TEXT NOT NULL, " +
|
||||||
" end TEXT NOT NULL, " +
|
" end TEXT NOT NULL, " +
|
||||||
" description TEXT NOT NULL, " +
|
" description TEXT NOT NULL, " +
|
||||||
" remark TEXT NOT NULL," +
|
" remark TEXT NOT NULL," +
|
||||||
" FOREIGN KEY (pid) REFERENCES patient (pid) ON DELETE CASCADE " +
|
" FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE " +
|
||||||
");";
|
");";
|
||||||
|
|
||||||
try (Statement statement = connection.createStatement())
|
try (Statement statement = connection.createStatement())
|
||||||
|
@ -73,7 +73,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
|
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
1,
|
1,
|
||||||
seppl.getPid(),
|
seppl.getId(),
|
||||||
convertStringToLocalDate("2023-06-03"),
|
convertStringToLocalDate("2023-06-03"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
|
@ -84,7 +84,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
));
|
));
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
2,
|
2,
|
||||||
seppl.getPid(),
|
seppl.getId(),
|
||||||
convertStringToLocalDate("2023-06-05"),
|
convertStringToLocalDate("2023-06-05"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("12:30"),
|
convertStringToLocalTime("12:30"),
|
||||||
|
@ -95,7 +95,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
));
|
));
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
3,
|
3,
|
||||||
martina.getPid(),
|
martina.getId(),
|
||||||
convertStringToLocalDate("2023-06-04"),
|
convertStringToLocalDate("2023-06-04"),
|
||||||
convertStringToLocalTime("07:30"),
|
convertStringToLocalTime("07:30"),
|
||||||
convertStringToLocalTime("08:00"),
|
convertStringToLocalTime("08:00"),
|
||||||
|
@ -104,7 +104,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
));
|
));
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
4,
|
4,
|
||||||
seppl.getPid(),
|
seppl.getId(),
|
||||||
convertStringToLocalDate("2023-06-06"),
|
convertStringToLocalDate("2023-06-06"),
|
||||||
convertStringToLocalTime("15:10"),
|
convertStringToLocalTime("15:10"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
|
@ -113,7 +113,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
);
|
);
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
8,
|
8,
|
||||||
seppl.getPid(),
|
seppl.getId(),
|
||||||
convertStringToLocalDate("2023-06-08"),
|
convertStringToLocalDate("2023-06-08"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
|
@ -122,7 +122,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
);
|
);
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
9,
|
9,
|
||||||
martina.getPid(),
|
martina.getId(),
|
||||||
convertStringToLocalDate("2023-06-07"),
|
convertStringToLocalDate("2023-06-07"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("11:30"),
|
convertStringToLocalTime("11:30"),
|
||||||
|
@ -131,7 +131,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
);
|
);
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
12,
|
12,
|
||||||
hans.getPid(),
|
hans.getId(),
|
||||||
convertStringToLocalDate("2023-06-08"),
|
convertStringToLocalDate("2023-06-08"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
convertStringToLocalTime("15:30"),
|
convertStringToLocalTime("15:30"),
|
||||||
|
@ -140,7 +140,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
);
|
);
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
14,
|
14,
|
||||||
ahmet.getPid(),
|
ahmet.getId(),
|
||||||
convertStringToLocalDate("2023-08-24"),
|
convertStringToLocalDate("2023-08-24"),
|
||||||
convertStringToLocalTime("09:30"),
|
convertStringToLocalTime("09:30"),
|
||||||
convertStringToLocalTime("10:15"),
|
convertStringToLocalTime("10:15"),
|
||||||
|
@ -148,7 +148,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
"Lympfdrainage"));
|
"Lympfdrainage"));
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
16,
|
16,
|
||||||
elisabeth.getPid(),
|
elisabeth.getId(),
|
||||||
convertStringToLocalDate("2023-08-31"),
|
convertStringToLocalDate("2023-08-31"),
|
||||||
convertStringToLocalTime("13:30"),
|
convertStringToLocalTime("13:30"),
|
||||||
convertStringToLocalTime("13:45"),
|
convertStringToLocalTime("13:45"),
|
||||||
|
@ -157,7 +157,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
);
|
);
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
17,
|
17,
|
||||||
elisabeth.getPid(),
|
elisabeth.getId(),
|
||||||
convertStringToLocalDate("2023-09-01"),
|
convertStringToLocalDate("2023-09-01"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
convertStringToLocalTime("17:00"),
|
convertStringToLocalTime("17:00"),
|
||||||
|
@ -169,7 +169,7 @@ public class TreatmentFixture implements Fixture<Treatment>
|
||||||
Map<String, Treatment> treatmentsById = new HashMap<>();
|
Map<String, Treatment> treatmentsById = new HashMap<>();
|
||||||
for (Treatment treatment : treatments){
|
for (Treatment treatment : treatments){
|
||||||
dao.create(treatment);
|
dao.create(treatment);
|
||||||
treatmentsById.put(String.valueOf(treatment.getTid()), treatment);
|
treatmentsById.put(String.valueOf(treatment.getId()), treatment);
|
||||||
}
|
}
|
||||||
return treatmentsById;
|
return treatmentsById;
|
||||||
}
|
}
|
||||||
|
|
60
src/main/java/de/hitec/nhplus/main/MainWindowController.java
Normal file
60
src/main/java/de/hitec/nhplus/main/MainWindowController.java
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
package de.hitec.nhplus.main;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.Main;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.layout.AnchorPane;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class MainWindowController {
|
||||||
|
@FXML
|
||||||
|
private AnchorPane patientPage;
|
||||||
|
@FXML
|
||||||
|
private Tab patientTab;
|
||||||
|
@FXML
|
||||||
|
private AnchorPane treatmentPage;
|
||||||
|
@FXML
|
||||||
|
private Tab treatmentTab;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
loadPatientPage();
|
||||||
|
loadTreatmentsPage();
|
||||||
|
|
||||||
|
patientTab.setOnSelectionChanged(event -> loadPatientPage());
|
||||||
|
treatmentTab.setOnSelectionChanged(event -> loadTreatmentsPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadPatientPage() {
|
||||||
|
try {
|
||||||
|
BorderPane patientsPane = FXMLLoader.load(
|
||||||
|
Main.class.getResource("/de/hitec/nhplus/patient/AllPatientView.fxml")
|
||||||
|
);
|
||||||
|
patientPage.getChildren().setAll(patientsPane);
|
||||||
|
AnchorPane.setTopAnchor(patientsPane, 0d);
|
||||||
|
AnchorPane.setBottomAnchor(patientsPane, 0d);
|
||||||
|
AnchorPane.setLeftAnchor(patientsPane, 0d);
|
||||||
|
AnchorPane.setRightAnchor(patientsPane, 0d);
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadTreatmentsPage() {
|
||||||
|
try {
|
||||||
|
BorderPane treatmentsPane = FXMLLoader.load(
|
||||||
|
Main.class.getResource("/de/hitec/nhplus/treatment/AllTreatmentView.fxml")
|
||||||
|
);
|
||||||
|
treatmentPage.getChildren().setAll(treatmentsPane);
|
||||||
|
AnchorPane.setTopAnchor(treatmentsPane, 0d);
|
||||||
|
AnchorPane.setBottomAnchor(treatmentsPane, 0d);
|
||||||
|
AnchorPane.setLeftAnchor(treatmentsPane, 0d);
|
||||||
|
AnchorPane.setRightAnchor(treatmentsPane, 0d);
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package de.hitec.nhplus.model;
|
package de.hitec.nhplus.main;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
package de.hitec.nhplus.model;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
public class Treatment {
|
|
||||||
private long tid;
|
|
||||||
private final long pid;
|
|
||||||
private LocalDate date;
|
|
||||||
private LocalTime begin;
|
|
||||||
private LocalTime end;
|
|
||||||
private String description;
|
|
||||||
private String remarks;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to initiate an object of class <code>Treatment</code> with the given parameter. Use this constructor
|
|
||||||
* to initiate objects, which are not persisted yet, because it will not have a treatment id (tid).
|
|
||||||
*
|
|
||||||
* @param pid Id of the treated patient.
|
|
||||||
* @param date Date of the Treatment.
|
|
||||||
* @param begin Time of the start of the treatment in format "hh:MM"
|
|
||||||
* @param end Time of the end of the treatment in format "hh:MM".
|
|
||||||
* @param description Description of the treatment.
|
|
||||||
* @param remarks Remarks to the treatment.
|
|
||||||
*/
|
|
||||||
public Treatment(long pid, LocalDate date, LocalTime begin,
|
|
||||||
LocalTime end, String description, String remarks) {
|
|
||||||
this.pid = pid;
|
|
||||||
this.date = date;
|
|
||||||
this.begin = begin;
|
|
||||||
this.end = end;
|
|
||||||
this.description = description;
|
|
||||||
this.remarks = remarks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to initiate an object of class <code>Treatment</code> with the given parameter. Use this constructor
|
|
||||||
* to initiate objects, which are already persisted and have a treatment id (tid).
|
|
||||||
*
|
|
||||||
* @param tid Id of the treatment.
|
|
||||||
* @param pid Id of the treated patient.
|
|
||||||
* @param date Date of the Treatment.
|
|
||||||
* @param begin Time of the start of the treatment in format "hh:MM"
|
|
||||||
* @param end Time of the end of the treatment in format "hh:MM".
|
|
||||||
* @param description Description of the treatment.
|
|
||||||
* @param remarks Remarks to the treatment.
|
|
||||||
*/
|
|
||||||
public Treatment(long tid, long pid, LocalDate date, LocalTime begin,
|
|
||||||
LocalTime end, String description, String remarks) {
|
|
||||||
this.tid = tid;
|
|
||||||
this.pid = pid;
|
|
||||||
this.date = date;
|
|
||||||
this.begin = begin;
|
|
||||||
this.end = end;
|
|
||||||
this.description = description;
|
|
||||||
this.remarks = remarks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTid() {
|
|
||||||
return tid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getPid() {
|
|
||||||
return this.pid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDate() {
|
|
||||||
return date.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBegin() {
|
|
||||||
return begin.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEnd() {
|
|
||||||
return end.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(String date) {
|
|
||||||
this.date = DateConverter.convertStringToLocalDate(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBegin(String begin) {
|
|
||||||
this.begin = DateConverter.convertStringToLocalTime(begin);;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnd(String end) {
|
|
||||||
this.end = DateConverter.convertStringToLocalTime(end);;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemarks() {
|
|
||||||
return remarks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemarks(String remarks) {
|
|
||||||
this.remarks = remarks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
|
||||||
return "\nBehandlung" + "\nTID: " + this.tid +
|
|
||||||
"\nPID: " + this.pid +
|
|
||||||
"\nDate: " + this.date +
|
|
||||||
"\nBegin: " + this.begin +
|
|
||||||
"\nEnd: " + this.end +
|
|
||||||
"\nDescription: " + this.description +
|
|
||||||
"\nRemarks: " + this.remarks + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,6 @@
|
||||||
package de.hitec.nhplus.controller;
|
package de.hitec.nhplus.patient;
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.datastorage.PatientDao;
|
|
||||||
import de.hitec.nhplus.model.Patient;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
@ -57,7 +55,7 @@ public class AllPatientController {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
this.readAllAndShowInTableView();
|
this.readAllAndShowInTableView();
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("pid"));
|
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
|
|
||||||
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
||||||
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
|
@ -82,9 +80,7 @@ public class AllPatientController {
|
||||||
.getSelectionModel()
|
.getSelectionModel()
|
||||||
.selectedItemProperty()
|
.selectedItemProperty()
|
||||||
.addListener((observableValue, oldPatient, newPatient) ->
|
.addListener((observableValue, oldPatient, newPatient) ->
|
||||||
{
|
AllPatientController.this.buttonDelete.setDisable(newPatient == null)
|
||||||
AllPatientController.this.buttonDelete.setDisable(newPatient == null);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.buttonAdd.setDisable(true);
|
this.buttonAdd.setDisable(true);
|
||||||
|
@ -191,7 +187,7 @@ public class AllPatientController {
|
||||||
Patient selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
Patient selectedItem = this.tableView.getSelectionModel().getSelectedItem();
|
||||||
if (selectedItem != null) {
|
if (selectedItem != null) {
|
||||||
try {
|
try {
|
||||||
DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getPid());
|
DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getId());
|
||||||
this.tableView.getItems().remove(selectedItem);
|
this.tableView.getItems().remove(selectedItem);
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
|
@ -1,33 +1,22 @@
|
||||||
package de.hitec.nhplus.model;
|
package de.hitec.nhplus.patient;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.main.Person;
|
||||||
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
import javafx.beans.property.SimpleLongProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* Patients live in a NURSING home and are treated by nurses.
|
|
||||||
*/
|
|
||||||
public class Patient extends Person {
|
public class Patient extends Person {
|
||||||
private SimpleLongProperty pid;
|
private SimpleIntegerProperty id;
|
||||||
private final SimpleStringProperty dateOfBirth;
|
private final SimpleStringProperty dateOfBirth;
|
||||||
private final SimpleStringProperty careLevel;
|
private final SimpleStringProperty careLevel;
|
||||||
private final SimpleStringProperty roomNumber;
|
private final SimpleStringProperty roomNumber;
|
||||||
private final List<Treatment> allTreatments = new ArrayList<>();
|
private final List<Treatment> allTreatments = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to initiate an object of class <code>Patient</code> with the given parameter. Use this constructor
|
|
||||||
* to initiate objects, which are not persisted yet, because it will not have a patient id (pid).
|
|
||||||
*
|
|
||||||
* @param firstName First name of the patient.
|
|
||||||
* @param surname Last name of the patient.
|
|
||||||
* @param dateOfBirth Date of birth of the patient.
|
|
||||||
* @param careLevel Care level of the patient.
|
|
||||||
* @param roomNumber Room number of the patient.
|
|
||||||
*/
|
|
||||||
public Patient(
|
public Patient(
|
||||||
String firstName,
|
String firstName,
|
||||||
String surname,
|
String surname,
|
||||||
|
@ -41,19 +30,8 @@ public class Patient extends Person {
|
||||||
this.roomNumber = new SimpleStringProperty(roomNumber);
|
this.roomNumber = new SimpleStringProperty(roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor to initiate an object of class <code>Patient</code> with the given parameter. Use this constructor
|
|
||||||
* to initiate objects, which are already persisted and have a patient id (pid).
|
|
||||||
*
|
|
||||||
* @param pid Patient id.
|
|
||||||
* @param firstName First name of the patient.
|
|
||||||
* @param surname Last name of the patient.
|
|
||||||
* @param dateOfBirth Date of birth of the patient.
|
|
||||||
* @param careLevel Care level of the patient.
|
|
||||||
* @param roomNumber Room number of the patient.
|
|
||||||
*/
|
|
||||||
public Patient(
|
public Patient(
|
||||||
long pid,
|
int id,
|
||||||
String firstName,
|
String firstName,
|
||||||
String surname,
|
String surname,
|
||||||
LocalDate dateOfBirth,
|
LocalDate dateOfBirth,
|
||||||
|
@ -61,18 +39,18 @@ public class Patient extends Person {
|
||||||
String roomNumber
|
String roomNumber
|
||||||
) {
|
) {
|
||||||
super(firstName, surname);
|
super(firstName, surname);
|
||||||
this.pid = new SimpleLongProperty(pid);
|
this.id = new SimpleIntegerProperty(id);
|
||||||
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
|
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
|
||||||
this.careLevel = new SimpleStringProperty(careLevel);
|
this.careLevel = new SimpleStringProperty(careLevel);
|
||||||
this.roomNumber = new SimpleStringProperty(roomNumber);
|
this.roomNumber = new SimpleStringProperty(roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPid() {
|
public int getId() {
|
||||||
return pid.get();
|
return id.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleLongProperty pidProperty() {
|
public SimpleIntegerProperty pidProperty() {
|
||||||
return pid;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDateOfBirth() {
|
public String getDateOfBirth() {
|
||||||
|
@ -83,11 +61,6 @@ public class Patient extends Person {
|
||||||
return dateOfBirth;
|
return dateOfBirth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the given string as new <code>birthOfDate</code>.
|
|
||||||
*
|
|
||||||
* @param dateOfBirth as string in the following format: YYYY-MM-DD.
|
|
||||||
*/
|
|
||||||
public void setDateOfBirth(String dateOfBirth) {
|
public void setDateOfBirth(String dateOfBirth) {
|
||||||
this.dateOfBirth.set(dateOfBirth);
|
this.dateOfBirth.set(dateOfBirth);
|
||||||
}
|
}
|
||||||
|
@ -117,13 +90,6 @@ public class Patient extends Person {
|
||||||
this.roomNumber.set(roomNumber);
|
this.roomNumber.set(roomNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a treatment to the list of treatments, if the list does not already contain the treatment.
|
|
||||||
*
|
|
||||||
* @param treatment Treatment to add.
|
|
||||||
* @return False, if the treatment was already part of the list, else true.
|
|
||||||
*/
|
|
||||||
public boolean add(Treatment treatment) {
|
public boolean add(Treatment treatment) {
|
||||||
if (this.allTreatments.contains(treatment)) {
|
if (this.allTreatments.contains(treatment)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -133,7 +99,7 @@ public class Patient extends Person {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Patient" + "\nMNID: " + this.pid +
|
return "Patient" + "\nMNID: " + this.id +
|
||||||
"\nFirstname: " + this.getFirstName() +
|
"\nFirstname: " + this.getFirstName() +
|
||||||
"\nSurname: " + this.getSurname() +
|
"\nSurname: " + this.getSurname() +
|
||||||
"\nBirthday: " + this.dateOfBirth +
|
"\nBirthday: " + this.dateOfBirth +
|
|
@ -1,33 +1,20 @@
|
||||||
package de.hitec.nhplus.datastorage;
|
package de.hitec.nhplus.patient;
|
||||||
|
|
||||||
import de.hitec.nhplus.model.Patient;
|
import de.hitec.nhplus.datastorage.DaoImp;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
import java.time.LocalDate;
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements the Interface <code>DaoImp</code>. Overrides methods to generate specific <code>PreparedStatements</code>,
|
|
||||||
* to execute the specific SQL Statements.
|
|
||||||
*/
|
|
||||||
public class PatientDao extends DaoImp<Patient> {
|
public class PatientDao extends DaoImp<Patient> {
|
||||||
|
|
||||||
/**
|
|
||||||
* The constructor initiates an object of <code>PatientDao</code> and passes the connection to its super class.
|
|
||||||
*
|
|
||||||
* @param connection Object of <code>Connection</code> to execute the SQL-statements.
|
|
||||||
*/
|
|
||||||
public PatientDao(Connection connection) {
|
public PatientDao(Connection connection) {
|
||||||
super(connection);
|
super(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to persist the given object of <code>Patient</code>.
|
|
||||||
*
|
|
||||||
* @param patient Object of <code>Patient</code> to persist.
|
|
||||||
* @return <code>PreparedStatement</code> to insert the given patient.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getCreateStatement(Patient patient) {
|
protected PreparedStatement getCreateStatement(Patient patient) {
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
|
@ -46,31 +33,19 @@ public class PatientDao extends DaoImp<Patient> {
|
||||||
return preparedStatement;
|
return preparedStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to query a patient by a given patient id (pid).
|
|
||||||
*
|
|
||||||
* @param pid Patient id to query.
|
|
||||||
* @return <code>PreparedStatement</code> to query the patient.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getReadByIDStatement(long pid) {
|
protected PreparedStatement getReadByIDStatement(int id) {
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
try {
|
try {
|
||||||
final String SQL = "SELECT * FROM patient WHERE pid = ?";
|
final String SQL = "SELECT * FROM patient WHERE id = ?";
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
preparedStatement.setLong(1, pid);
|
preparedStatement.setInt(1, id);
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
return preparedStatement;
|
return preparedStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a <code>ResultSet</code> of one patient to an object of <code>Patient</code>.
|
|
||||||
*
|
|
||||||
* @param result ResultSet with a single row. Columns will be mapped to an object of class <code>Patient</code>.
|
|
||||||
* @return Object of class <code>Patient</code> with the data from the resultSet.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Patient getInstanceFromResultSet(ResultSet result) throws SQLException {
|
protected Patient getInstanceFromResultSet(ResultSet result) throws SQLException {
|
||||||
return new Patient(
|
return new Patient(
|
||||||
|
@ -82,11 +57,6 @@ public class PatientDao extends DaoImp<Patient> {
|
||||||
result.getString(6));
|
result.getString(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to query all patients.
|
|
||||||
*
|
|
||||||
* @return <code>PreparedStatement</code> to query all patients.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getReadAllStatement() {
|
protected PreparedStatement getReadAllStatement() {
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
|
@ -99,33 +69,22 @@ public class PatientDao extends DaoImp<Patient> {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Maps a <code>ResultSet</code> of all patients to an <code>ArrayList</code> of <code>Patient</code> objects.
|
|
||||||
*
|
|
||||||
* @param result ResultSet with all rows. The Columns will be mapped to objects of class <code>Patient</code>.
|
|
||||||
* @return <code>ArrayList</code> with objects of class <code>Patient</code> of all rows in the
|
|
||||||
* <code>ResultSet</code>.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ArrayList<Patient> getListFromResultSet(ResultSet result) throws SQLException {
|
protected ArrayList<Patient> getListFromResultSet(ResultSet result) throws SQLException {
|
||||||
ArrayList<Patient> list = new ArrayList<>();
|
ArrayList<Patient> list = new ArrayList<>();
|
||||||
while (result.next()) {
|
while (result.next()) {
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(result.getString(4));
|
Patient patient = new Patient(
|
||||||
Patient patient = new Patient(result.getInt(1), result.getString(2),
|
result.getInt(1),
|
||||||
result.getString(3), date,
|
result.getString(2),
|
||||||
result.getString(5), result.getString(6));
|
result.getString(3),
|
||||||
|
DateConverter.convertStringToLocalDate(result.getString(4)),
|
||||||
|
result.getString(5),
|
||||||
|
result.getString(6));
|
||||||
list.add(patient);
|
list.add(patient);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to update the given patient, identified
|
|
||||||
* by the id of the patient (pid).
|
|
||||||
*
|
|
||||||
* @param patient Patient object to update.
|
|
||||||
* @return <code>PreparedStatement</code> to update the given patient.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getUpdateStatement(Patient patient) {
|
protected PreparedStatement getUpdateStatement(Patient patient) {
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
|
@ -137,33 +96,27 @@ public class PatientDao extends DaoImp<Patient> {
|
||||||
"dateOfBirth = ?, " +
|
"dateOfBirth = ?, " +
|
||||||
"carelevel = ?, " +
|
"carelevel = ?, " +
|
||||||
"roomnumber = ?, " +
|
"roomnumber = ?, " +
|
||||||
"WHERE pid = ?";
|
"WHERE id = ?";
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
preparedStatement.setString(1, patient.getFirstName());
|
preparedStatement.setString(1, patient.getFirstName());
|
||||||
preparedStatement.setString(2, patient.getSurname());
|
preparedStatement.setString(2, patient.getSurname());
|
||||||
preparedStatement.setString(3, patient.getDateOfBirth());
|
preparedStatement.setString(3, patient.getDateOfBirth());
|
||||||
preparedStatement.setString(4, patient.getCareLevel());
|
preparedStatement.setString(4, patient.getCareLevel());
|
||||||
preparedStatement.setString(5, patient.getRoomNumber());
|
preparedStatement.setString(5, patient.getRoomNumber());
|
||||||
preparedStatement.setLong(6, patient.getPid());
|
preparedStatement.setInt(6, patient.getId());
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
return preparedStatement;
|
return preparedStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a <code>PreparedStatement</code> to delete a patient with the given id.
|
|
||||||
*
|
|
||||||
* @param pid Id of the patient to delete.
|
|
||||||
* @return <code>PreparedStatement</code> to delete patient with the given id.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected PreparedStatement getDeleteStatement(long pid) {
|
protected PreparedStatement getDeleteStatement(int id) {
|
||||||
PreparedStatement preparedStatement = null;
|
PreparedStatement preparedStatement = null;
|
||||||
try {
|
try {
|
||||||
final String SQL = "DELETE FROM patient WHERE pid = ?";
|
final String SQL = "DELETE FROM patient WHERE id = ?";
|
||||||
preparedStatement = this.connection.prepareStatement(SQL);
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
preparedStatement.setLong(1, pid);
|
preparedStatement.setInt(1, id);
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
package de.hitec.nhplus.controller;
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
import de.hitec.nhplus.Main;
|
import de.hitec.nhplus.Main;
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.datastorage.PatientDao;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.datastorage.TreatmentDao;
|
import de.hitec.nhplus.patient.PatientDao;
|
||||||
import de.hitec.nhplus.model.Patient;
|
|
||||||
import de.hitec.nhplus.model.Treatment;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
@ -13,15 +11,14 @@ import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class AllTreatmentController
|
public class AllTreatmentController {
|
||||||
{
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Treatment> tableView;
|
private TableView<Treatment> tableView;
|
||||||
|
@ -30,7 +27,7 @@ public class AllTreatmentController
|
||||||
private TableColumn<Treatment, Integer> columnId;
|
private TableColumn<Treatment, Integer> columnId;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Treatment, Integer> columnPid;
|
private TableColumn<Treatment, Integer> columnPatientId;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Treatment, String> columnDate;
|
private TableColumn<Treatment, String> columnDate;
|
||||||
|
@ -55,14 +52,13 @@ public class AllTreatmentController
|
||||||
private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
|
private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
|
||||||
private ArrayList<Patient> patientList;
|
private ArrayList<Patient> patientList;
|
||||||
|
|
||||||
public void initialize()
|
public void initialize() {
|
||||||
{
|
|
||||||
readAllAndShowInTableView();
|
readAllAndShowInTableView();
|
||||||
comboBoxPatientSelection.setItems(patientSelection);
|
comboBoxPatientSelection.setItems(patientSelection);
|
||||||
comboBoxPatientSelection.getSelectionModel().select(0);
|
comboBoxPatientSelection.getSelectionModel().select(0);
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("tid"));
|
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
this.columnPid.setCellValueFactory(new PropertyValueFactory<>("pid"));
|
this.columnPatientId.setCellValueFactory(new PropertyValueFactory<>("patientId"));
|
||||||
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
||||||
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
|
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
|
||||||
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
|
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
|
||||||
|
@ -74,83 +70,64 @@ public class AllTreatmentController
|
||||||
.getSelectionModel()
|
.getSelectionModel()
|
||||||
.selectedItemProperty()
|
.selectedItemProperty()
|
||||||
.addListener((observableValue, oldTreatment, newTreatment) ->
|
.addListener((observableValue, oldTreatment, newTreatment) ->
|
||||||
{
|
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)
|
||||||
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.createComboBoxData();
|
this.createComboBoxData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readAllAndShowInTableView()
|
public void readAllAndShowInTableView() {
|
||||||
{
|
|
||||||
this.treatments.clear();
|
this.treatments.clear();
|
||||||
comboBoxPatientSelection.getSelectionModel().select(0);
|
comboBoxPatientSelection.getSelectionModel().select(0);
|
||||||
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
this.treatments.addAll(dao.readAll());
|
this.treatments.addAll(dao.readAll());
|
||||||
} catch (SQLException exception)
|
} catch (SQLException exception) {
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createComboBoxData()
|
private void createComboBoxData() {
|
||||||
{
|
|
||||||
PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO();
|
PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
patientList = (ArrayList<Patient>) dao.readAll();
|
patientList = (ArrayList<Patient>) dao.readAll();
|
||||||
this.patientSelection.add("alle");
|
this.patientSelection.add("alle");
|
||||||
for (Patient patient : patientList)
|
for (Patient patient : patientList) {
|
||||||
{
|
|
||||||
this.patientSelection.add(patient.getSurname());
|
this.patientSelection.add(patient.getSurname());
|
||||||
}
|
}
|
||||||
} catch (SQLException exception)
|
} catch (SQLException exception) {
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleComboBox()
|
public void handleComboBox() {
|
||||||
{
|
|
||||||
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
||||||
this.treatments.clear();
|
this.treatments.clear();
|
||||||
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
|
|
||||||
if (selectedPatient.equals("alle"))
|
if (selectedPatient.equals("alle")) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
this.treatments.addAll(this.dao.readAll());
|
this.treatments.addAll(this.dao.readAll());
|
||||||
} catch (SQLException exception)
|
} catch (SQLException exception) {
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Patient patient = searchInList(selectedPatient);
|
Patient patient = searchInList(selectedPatient);
|
||||||
if (patient != null)
|
if (patient != null) {
|
||||||
{
|
try {
|
||||||
try
|
this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getId()));
|
||||||
{
|
} catch (SQLException exception) {
|
||||||
this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getPid()));
|
|
||||||
} catch (SQLException exception)
|
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Patient searchInList(String surname)
|
private Patient searchInList(String surname) {
|
||||||
{
|
for (Patient patient : this.patientList) {
|
||||||
for (Patient patient : this.patientList)
|
if (patient.getSurname().equals(surname)) {
|
||||||
{
|
|
||||||
if (patient.getSurname().equals(surname))
|
|
||||||
{
|
|
||||||
return patient;
|
return patient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,30 +135,24 @@ public class AllTreatmentController
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleDelete()
|
public void handleDelete() {
|
||||||
{
|
|
||||||
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
||||||
Treatment t = this.treatments.remove(index);
|
Treatment t = this.treatments.remove(index);
|
||||||
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
try
|
try {
|
||||||
{
|
dao.deleteById(t.getId());
|
||||||
dao.deleteById(t.getTid());
|
} catch (SQLException exception) {
|
||||||
} catch (SQLException exception)
|
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleNewTreatment()
|
public void handleNewTreatment() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
||||||
Patient patient = searchInList(selectedPatient);
|
Patient patient = searchInList(selectedPatient);
|
||||||
newTreatmentWindow(patient);
|
newTreatmentWindow(patient);
|
||||||
} catch (NullPointerException exception)
|
} catch (NullPointerException exception) {
|
||||||
{
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
alert.setTitle("Information");
|
alert.setTitle("Information");
|
||||||
alert.setHeaderText("Patient für die Behandlung fehlt!");
|
alert.setHeaderText("Patient für die Behandlung fehlt!");
|
||||||
|
@ -191,12 +162,10 @@ public class AllTreatmentController
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleMouseClick()
|
public void handleMouseClick() {
|
||||||
{
|
|
||||||
tableView.setOnMouseClicked(event ->
|
tableView.setOnMouseClicked(event ->
|
||||||
{
|
{
|
||||||
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null))
|
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null)) {
|
||||||
{
|
|
||||||
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
||||||
Treatment treatment = this.treatments.get(index);
|
Treatment treatment = this.treatments.get(index);
|
||||||
treatmentWindow(treatment);
|
treatmentWindow(treatment);
|
||||||
|
@ -204,47 +173,75 @@ public class AllTreatmentController
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void newTreatmentWindow(Patient patient)
|
public void newTreatmentWindow(Patient patient) {
|
||||||
{
|
try {
|
||||||
try
|
FXMLLoader loader = new FXMLLoader(
|
||||||
{
|
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/NewTreatmentView.fxml"));
|
);
|
||||||
AnchorPane pane = loader.load();
|
BorderPane pane = loader.load();
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
|
|
||||||
// the primary stage should stay in the background
|
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
|
|
||||||
NewTreatmentController controller = loader.getController();
|
TreatmentModalController controller = loader.getController();
|
||||||
controller.initialize(this, stage, patient);
|
controller.initialize(
|
||||||
|
this,
|
||||||
|
stage,
|
||||||
|
null,
|
||||||
|
patient
|
||||||
|
);
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(false);
|
stage.setTitle("NHPlus - Neue Behandlung");
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
stage.showAndWait();
|
stage.showAndWait();
|
||||||
} catch (IOException exception)
|
} catch (IOException exception) {
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void treatmentWindow(Treatment treatment)
|
public void treatmentWindow(Treatment treatment) {
|
||||||
{
|
try {
|
||||||
try
|
FXMLLoader loader = new FXMLLoader(
|
||||||
{
|
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/TreatmentView.fxml"));
|
);
|
||||||
AnchorPane pane = loader.load();
|
BorderPane pane = loader.load();
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
|
|
||||||
// the primary stage should stay in the background
|
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
TreatmentController controller = loader.getController();
|
|
||||||
controller.initializeController(this, stage, treatment);
|
TreatmentModalController controller = loader.getController();
|
||||||
|
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
||||||
|
controller.initialize(
|
||||||
|
this,
|
||||||
|
stage,
|
||||||
|
treatment,
|
||||||
|
pDao.read(treatment.getPatientId())
|
||||||
|
);
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(false);
|
stage.setTitle("NHPlus - Behandlung");
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
stage.showAndWait();
|
stage.showAndWait();
|
||||||
} catch (IOException exception)
|
} catch (IOException | SQLException exception) {
|
||||||
{
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createTreatment(Treatment treatment) {
|
||||||
|
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
|
try {
|
||||||
|
dao.create(treatment);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateTreatment(Treatment treatment) {
|
||||||
|
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
|
try {
|
||||||
|
dao.update(treatment);
|
||||||
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
95
src/main/java/de/hitec/nhplus/treatment/Treatment.java
Normal file
95
src/main/java/de/hitec/nhplus/treatment/Treatment.java
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
public class Treatment {
|
||||||
|
private int id;
|
||||||
|
private final int patientId;
|
||||||
|
private LocalDate date;
|
||||||
|
private LocalTime begin;
|
||||||
|
private LocalTime end;
|
||||||
|
private String description;
|
||||||
|
private String remarks;
|
||||||
|
|
||||||
|
public Treatment(int patientId, LocalDate date, LocalTime begin,
|
||||||
|
LocalTime end, String description, String remarks) {
|
||||||
|
this.patientId = patientId;
|
||||||
|
this.date = date;
|
||||||
|
this.begin = begin;
|
||||||
|
this.end = end;
|
||||||
|
this.description = description;
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Treatment(int id, int patientId, LocalDate date, LocalTime begin,
|
||||||
|
LocalTime end, String description, String remarks) {
|
||||||
|
this.id = id;
|
||||||
|
this.patientId = patientId;
|
||||||
|
this.date = date;
|
||||||
|
this.begin = begin;
|
||||||
|
this.end = end;
|
||||||
|
this.description = description;
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPatientId() {
|
||||||
|
return this.patientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDate() {
|
||||||
|
return date.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBegin() {
|
||||||
|
return begin.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnd() {
|
||||||
|
return end.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(String date) {
|
||||||
|
this.date = DateConverter.convertStringToLocalDate(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBegin(LocalTime begin) {
|
||||||
|
this.begin = begin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd(LocalTime end) {
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemarks() {
|
||||||
|
return remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemarks(String remarks) {
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "\nBehandlung" + "\nID: " + this.id +
|
||||||
|
"\nPatient ID: " + this.patientId +
|
||||||
|
"\nDate: " + this.date +
|
||||||
|
"\nBegin: " + this.begin +
|
||||||
|
"\nEnd: " + this.end +
|
||||||
|
"\nDescription: " + this.description +
|
||||||
|
"\nRemarks: " + this.remarks + "\n";
|
||||||
|
}
|
||||||
|
}
|
151
src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java
Normal file
151
src/main/java/de/hitec/nhplus/treatment/TreatmentDao.java
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.datastorage.DaoImp;
|
||||||
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
|
|
||||||
|
public TreatmentDao(Connection connection) {
|
||||||
|
super(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PreparedStatement getCreateStatement(Treatment treatment) {
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
final String SQL = "INSERT INTO treatment (patientId, treatment_date, begin, end, description, remark) " +
|
||||||
|
"VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
|
preparedStatement.setInt(1, treatment.getPatientId());
|
||||||
|
preparedStatement.setString(2, treatment.getDate());
|
||||||
|
preparedStatement.setString(3, treatment.getBegin());
|
||||||
|
preparedStatement.setString(4, treatment.getEnd());
|
||||||
|
preparedStatement.setString(5, treatment.getDescription());
|
||||||
|
preparedStatement.setString(6, treatment.getRemarks());
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return preparedStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PreparedStatement getReadByIDStatement(int id) {
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
final String SQL = "SELECT * FROM treatment WHERE id = ?";
|
||||||
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
|
preparedStatement.setInt(1, id);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return preparedStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Treatment getInstanceFromResultSet(ResultSet result) throws SQLException {
|
||||||
|
return new Treatment(
|
||||||
|
result.getInt(1),
|
||||||
|
result.getInt(2),
|
||||||
|
DateConverter.convertStringToLocalDate(result.getString(3)),
|
||||||
|
DateConverter.convertStringToLocalTime(result.getString(4)),
|
||||||
|
DateConverter.convertStringToLocalTime(result.getString(5)),
|
||||||
|
result.getString(6),
|
||||||
|
result.getString(7)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PreparedStatement getReadAllStatement() {
|
||||||
|
PreparedStatement statement = null;
|
||||||
|
try {
|
||||||
|
final String SQL = "SELECT * FROM treatment";
|
||||||
|
statement = this.connection.prepareStatement(SQL);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ArrayList<Treatment> getListFromResultSet(ResultSet result) throws SQLException {
|
||||||
|
ArrayList<Treatment> list = new ArrayList<>();
|
||||||
|
while (result.next()) {
|
||||||
|
Treatment treatment = new Treatment(
|
||||||
|
result.getInt(1),
|
||||||
|
result.getInt(2),
|
||||||
|
DateConverter.convertStringToLocalDate(result.getString(3)),
|
||||||
|
DateConverter.convertStringToLocalTime(result.getString(4)),
|
||||||
|
DateConverter.convertStringToLocalTime(result.getString(5)),
|
||||||
|
result.getString(6),
|
||||||
|
result.getString(7)
|
||||||
|
);
|
||||||
|
list.add(treatment);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PreparedStatement getReadAllTreatmentsOfOnePatientByPid(int patientId) {
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
final String SQL = "SELECT * FROM treatment WHERE patientId = ?";
|
||||||
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
|
preparedStatement.setInt(1, patientId);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return preparedStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Treatment> readTreatmentsByPid(int patientId) throws SQLException {
|
||||||
|
ResultSet result = getReadAllTreatmentsOfOnePatientByPid(patientId).executeQuery();
|
||||||
|
return getListFromResultSet(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PreparedStatement getUpdateStatement(Treatment treatment) {
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
final String SQL =
|
||||||
|
"UPDATE treatment SET " +
|
||||||
|
"patientId = ?, " +
|
||||||
|
"treatment_date = ?, " +
|
||||||
|
"begin = ?, " +
|
||||||
|
"end = ?, " +
|
||||||
|
"description = ?, " +
|
||||||
|
"remark = ? " +
|
||||||
|
"WHERE tid = ?";
|
||||||
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
|
preparedStatement.setInt(1, treatment.getPatientId());
|
||||||
|
preparedStatement.setString(2, treatment.getDate());
|
||||||
|
preparedStatement.setString(3, treatment.getBegin());
|
||||||
|
preparedStatement.setString(4, treatment.getEnd());
|
||||||
|
preparedStatement.setString(5, treatment.getDescription());
|
||||||
|
preparedStatement.setString(6, treatment.getRemarks());
|
||||||
|
preparedStatement.setInt(7, treatment.getId());
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return preparedStatement;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PreparedStatement getDeleteStatement(int id) {
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
final String SQL =
|
||||||
|
"DELETE FROM treatment WHERE tid = ?";
|
||||||
|
preparedStatement = this.connection.prepareStatement(SQL);
|
||||||
|
preparedStatement.setInt(1, id);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
return preparedStatement;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.patient.Patient;
|
||||||
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
import static de.hitec.nhplus.utils.Validator.*;
|
||||||
|
|
||||||
|
public class TreatmentModalController {
|
||||||
|
@FXML
|
||||||
|
private Label labelFirstName;
|
||||||
|
@FXML
|
||||||
|
private Label labelSurname;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldBegin;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldEnd;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldDescription;
|
||||||
|
@FXML
|
||||||
|
private TextArea textAreaRemarks;
|
||||||
|
@FXML
|
||||||
|
private DatePicker datePicker;
|
||||||
|
@FXML
|
||||||
|
private Button buttonSave;
|
||||||
|
private AllTreatmentController controller;
|
||||||
|
private Stage stage;
|
||||||
|
private Patient patient;
|
||||||
|
private Treatment treatment;
|
||||||
|
private boolean isNewTreatment = false;
|
||||||
|
|
||||||
|
public void initialize(AllTreatmentController controller, Stage stage, Treatment treatment, Patient patient) {
|
||||||
|
this.controller = controller;
|
||||||
|
this.stage = stage;
|
||||||
|
this.patient = patient;
|
||||||
|
if (treatment == null) {
|
||||||
|
isNewTreatment = true;
|
||||||
|
LocalTime currentTime = LocalTime.now();
|
||||||
|
this.treatment = new Treatment(
|
||||||
|
patient.getId(),
|
||||||
|
LocalDate.now(),
|
||||||
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
this.buttonSave.setDisable(true);
|
||||||
|
} else {
|
||||||
|
this.treatment = treatment;
|
||||||
|
}
|
||||||
|
showData();
|
||||||
|
|
||||||
|
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
||||||
|
{
|
||||||
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
|
this.buttonSave.setDisable(!isValid);
|
||||||
|
};
|
||||||
|
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
|
||||||
|
{
|
||||||
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
|
this.buttonSave.setDisable(!isValid);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.textFieldBegin.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
||||||
|
this.textFieldEnd.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
||||||
|
this.textFieldDescription.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
||||||
|
this.textAreaRemarks.textProperty().addListener(inputNewTreatmentTextValidationListener);
|
||||||
|
this.datePicker.valueProperty().addListener(inputNewTreatmentDateValidationListener);
|
||||||
|
|
||||||
|
this.datePicker.setConverter(new StringConverter<>() {
|
||||||
|
@Override
|
||||||
|
public String toString(LocalDate localDate) {
|
||||||
|
return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDate fromString(String localDate) {
|
||||||
|
if (!isValidDate(localDate)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return DateConverter.convertStringToLocalDate(localDate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showData() {
|
||||||
|
this.labelFirstName.setText(patient.getFirstName());
|
||||||
|
this.labelSurname.setText(patient.getSurname());
|
||||||
|
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
||||||
|
this.datePicker.setValue(date);
|
||||||
|
this.textFieldBegin.setText(this.treatment.getBegin());
|
||||||
|
this.textFieldEnd.setText(this.treatment.getEnd());
|
||||||
|
this.textFieldDescription.setText(this.treatment.getDescription());
|
||||||
|
this.textAreaRemarks.setText(this.treatment.getRemarks());
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void handleSave() {
|
||||||
|
LocalDate newDate = this.datePicker.getValue();
|
||||||
|
LocalTime newBegin = DateConverter.convertStringToLocalTime(textFieldBegin.getText());
|
||||||
|
LocalTime newEnd = DateConverter.convertStringToLocalTime(textFieldEnd.getText());
|
||||||
|
String newDescription = textFieldDescription.getText();
|
||||||
|
String newRemarks = textAreaRemarks.getText();
|
||||||
|
|
||||||
|
this.treatment.setDate(newDate.toString());
|
||||||
|
this.treatment.setDescription(newDescription);
|
||||||
|
this.treatment.setBegin(newBegin);
|
||||||
|
this.treatment.setEnd(newEnd);
|
||||||
|
this.treatment.setRemarks(newRemarks);
|
||||||
|
|
||||||
|
if (isNewTreatment) {
|
||||||
|
controller.createTreatment(treatment);
|
||||||
|
} else {
|
||||||
|
controller.updateTreatment(treatment);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.readAllAndShowInTableView();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void handleCancel() {
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Treatment getTreatment() {
|
||||||
|
return treatment;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,18 @@
|
||||||
module de.hitec.nhplus {
|
module de.hitec.nhplus {
|
||||||
requires javafx.controls;
|
requires javafx.controls;
|
||||||
requires javafx.fxml;
|
requires javafx.fxml;
|
||||||
|
|
||||||
requires org.controlsfx.controls;
|
|
||||||
requires java.sql;
|
requires java.sql;
|
||||||
requires org.xerial.sqlitejdbc;
|
requires org.xerial.sqlitejdbc;
|
||||||
|
|
||||||
opens de.hitec.nhplus to javafx.fxml;
|
|
||||||
opens de.hitec.nhplus.controller to javafx.fxml;
|
|
||||||
opens de.hitec.nhplus.model to javafx.base;
|
|
||||||
|
|
||||||
exports de.hitec.nhplus;
|
exports de.hitec.nhplus;
|
||||||
exports de.hitec.nhplus.controller;
|
opens de.hitec.nhplus to javafx.fxml;
|
||||||
exports de.hitec.nhplus.model;
|
|
||||||
|
exports de.hitec.nhplus.main;
|
||||||
|
opens de.hitec.nhplus.main to javafx.base, javafx.fxml;
|
||||||
|
|
||||||
|
exports de.hitec.nhplus.patient;
|
||||||
|
opens de.hitec.nhplus.patient to javafx.base, javafx.fxml;
|
||||||
|
|
||||||
|
exports de.hitec.nhplus.treatment;
|
||||||
|
opens de.hitec.nhplus.treatment to javafx.base, javafx.fxml;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.control.TableColumn?>
|
|
||||||
<?import javafx.scene.control.TableView?>
|
|
||||||
<?import javafx.scene.control.TextField?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
|
|
||||||
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.AllPatientController">
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="120.0" prefHeight="287.0" prefWidth="825.0" AnchorPane.bottomAnchor="100.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="columnId" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID" />
|
|
||||||
<TableColumn fx:id="columnSurname" maxWidth="7500.0" minWidth="20.0" onEditCommit="#handleOnEditSurname" prefWidth="100.0" text="Nachname" />
|
|
||||||
<TableColumn fx:id="columnFirstName" maxWidth="7500.0" onEditCommit="#handleOnEditFirstname" prefWidth="75.0" text="Vorname" />
|
|
||||||
<TableColumn fx:id="columnDateOfBirth" maxWidth="7500.0" onEditCommit="#handleOnEditDateOfBirth" prefWidth="75.0" text="Geburtstag" />
|
|
||||||
<TableColumn fx:id="columnCareLevel" onEditCommit="#handleOnEditCareLevel" prefWidth="75.0" text="Pflegegrad" />
|
|
||||||
<TableColumn fx:id="columnRoomNumber" onEditCommit="#handleOnEditRoomNumber" prefWidth="75.0" text="Raum" />
|
|
||||||
</columns>
|
|
||||||
<columnResizePolicy>
|
|
||||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
|
||||||
</columnResizePolicy>
|
|
||||||
</TableView>
|
|
||||||
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
|
|
||||||
<children>
|
|
||||||
<GridPane hgap="10.0" vgap="10.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0" />
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0" />
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="textFieldFirstName" minWidth="200.0" prefHeight="26.0" prefWidth="200.0" promptText="Vorname" />
|
|
||||||
<TextField fx:id="textFieldSurname" minWidth="200.0" prefHeight="26.0" prefWidth="200.0" promptText="Nachname" GridPane.columnIndex="1" />
|
|
||||||
<TextField fx:id="textFieldDateOfBirth" minWidth="160.0" prefWidth="160.0" promptText="Geburtstag" GridPane.columnIndex="2" />
|
|
||||||
<TextField fx:id="textFieldCareLevel" prefHeight="26.0" prefWidth="200.0" promptText="Pflegegrad" GridPane.rowIndex="1" />
|
|
||||||
<TextField fx:id="textFieldRoomNumber" prefHeight="26.0" prefWidth="200.0" promptText="Raum" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets right="10.0" />
|
|
||||||
</padding>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</HBox.margin>
|
|
||||||
</GridPane>
|
|
||||||
<HBox alignment="TOP_CENTER" prefWidth="190.0" spacing="10.0">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" prefWidth="90.0" text="Hinzufügen" />
|
|
||||||
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="90.0" text="Löschen" />
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Patienten/innen" textAlignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0" />
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets top="10.0" />
|
|
||||||
</padding>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,70 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Button?>
|
|
||||||
<?import javafx.scene.control.ComboBox?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
|
||||||
<?import javafx.scene.control.TableColumn?>
|
|
||||||
<?import javafx.scene.control.TableView?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.layout.ColumnConstraints?>
|
|
||||||
<?import javafx.scene.layout.GridPane?>
|
|
||||||
<?import javafx.scene.layout.HBox?>
|
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
|
|
||||||
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.AllTreatmentController">
|
|
||||||
<children>
|
|
||||||
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="35.0" onMouseClicked="#handleMouseClick" prefHeight="364.0" prefWidth="825.0" AnchorPane.bottomAnchor="75.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
|
|
||||||
<columns>
|
|
||||||
<TableColumn fx:id="columnId" maxWidth="-1.0" minWidth="40.0" prefWidth="50.0" text="ID" />
|
|
||||||
<TableColumn fx:id="columnPid" maxWidth="-1.0" minWidth="100.0" prefWidth="120.0" text="PatientID" />
|
|
||||||
<TableColumn fx:id="columnDate" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Datum" />
|
|
||||||
<TableColumn fx:id="columnBegin" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Beginn" />
|
|
||||||
<TableColumn fx:id="columnEnd" maxWidth="-1.0" minWidth="140.0" prefWidth="150.0" text="Ende" />
|
|
||||||
<TableColumn fx:id="columnDescription" maxWidth="-1.0" minWidth="200.0" prefWidth="300.0" text="Kurzbeschreibung" />
|
|
||||||
</columns>
|
|
||||||
<columnResizePolicy>
|
|
||||||
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
|
|
||||||
</columnResizePolicy>
|
|
||||||
</TableView>
|
|
||||||
<HBox layoutX="623.0" layoutY="419.3999938964844" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
|
|
||||||
<children>
|
|
||||||
<GridPane hgap="10.0" vgap="10.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0" />
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0" />
|
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0" />
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Button fx:id="buttonNewTreament" mnemonicParsing="false" onAction="#handleNewTreatment" prefWidth="200.0" text="neue Behandlung anlegen" GridPane.columnIndex="1" />
|
|
||||||
<ComboBox fx:id="comboBoxPatientSelection" minWidth="160.0" onAction="#handleComboBox" prefWidth="200.0" />
|
|
||||||
<Button fx:id="buttonDelete" mnemonicParsing="false" onAction="#handleDelete" prefWidth="200.0" text="Löschen" GridPane.columnIndex="2" />
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets right="10.0" />
|
|
||||||
</padding>
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</HBox.margin>
|
|
||||||
</GridPane>
|
|
||||||
<HBox prefWidth="190.0" spacing="10.0" />
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="15.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlungen" textAlignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0" />
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets top="10.0" />
|
|
||||||
</padding>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,4 +1 @@
|
||||||
.vBox{
|
/* https://materialui.co/colors */
|
||||||
-fx-background-color: navy;
|
|
||||||
-fx-border-color: rgb(142, 142, 142);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.*?>
|
<?import javafx.scene.control.Tab?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.TabPane?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<TabPane
|
||||||
<BorderPane fx:id="mainBorderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="688.0" prefWidth="926.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.MainWindowController">
|
tabClosingPolicy="UNAVAILABLE"
|
||||||
<left>
|
xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||||
<VBox id="vBox" alignment="CENTER" spacing="50.0" styleClass="vBox" stylesheets="@Application.css" BorderPane.alignment="CENTER">
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
<children>
|
fx:controller="de.hitec.nhplus.main.MainWindowController"
|
||||||
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllPatient" prefWidth="105.0" text="Patienten/innen">
|
>
|
||||||
<VBox.margin>
|
<Tab fx:id="patientTab" text="Patienten">
|
||||||
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
|
<AnchorPane fx:id="patientPage"/>
|
||||||
</VBox.margin>
|
</Tab>
|
||||||
<opaqueInsets>
|
<Tab fx:id="treatmentTab" text="Behandlungen">
|
||||||
<Insets />
|
<AnchorPane fx:id="treatmentPage"/>
|
||||||
</opaqueInsets></Button>
|
</Tab>
|
||||||
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllTreatments" prefWidth="105.0" text="Behandlungen">
|
</TabPane>
|
||||||
<VBox.margin>
|
|
||||||
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
|
|
||||||
</VBox.margin></Button>
|
|
||||||
</children>
|
|
||||||
</VBox>
|
|
||||||
</left>
|
|
||||||
</BorderPane>
|
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
<AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.NewTreatmentController">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="5.0"
|
|
||||||
AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Neue Behandlung"
|
|
||||||
textAlignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0"
|
|
||||||
AnchorPane.topAnchor="100.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Label text="Vorname:">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Nachname:" GridPane.columnIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Datum:" GridPane.rowIndex="3">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="3">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Beginn:" GridPane.rowIndex="4">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Ende" GridPane.columnIndex="2" GridPane.rowIndex="4">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
<TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="textFieldEnd" maxWidth="192.0" prefWidth="150.0" promptText="hh:mm"
|
|
||||||
GridPane.columnIndex="3" GridPane.rowIndex="4"/>
|
|
||||||
<DatePicker fx:id="datePicker" prefWidth="192.0" promptText="yyyy-mm-dd" GridPane.columnIndex="1"
|
|
||||||
GridPane.rowIndex="3"/>
|
|
||||||
<Label fx:id="labelFirstName" text="Vorname" GridPane.columnIndex="1"/>
|
|
||||||
<Label fx:id="labelSurname" text="Nachname" GridPane.columnIndex="3"/>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0"
|
|
||||||
AnchorPane.rightAnchor="50.0">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" text="Anlegen"/>
|
|
||||||
<Button fx:id="buttonCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false"
|
|
||||||
onAction="#handleCancel" text="Abbruch"/>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0"
|
|
||||||
AnchorPane.topAnchor="265.0"/>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
<AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/11.0.1"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.TreatmentController">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0"
|
|
||||||
AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlung"
|
|
||||||
textAlignment="CENTER">
|
|
||||||
<font>
|
|
||||||
<Font size="36.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0"
|
|
||||||
AnchorPane.topAnchor="100.0">
|
|
||||||
<columnConstraints>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
|
|
||||||
</columnConstraints>
|
|
||||||
<rowConstraints>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
|
||||||
<children>
|
|
||||||
<Label text="Patient:">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Pflegestufe:" GridPane.columnIndex="2">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Datum:" GridPane.rowIndex="3">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="3">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Beginn:" GridPane.rowIndex="4">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Ende" GridPane.columnIndex="2" GridPane.rowIndex="4">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
<TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="textFieldEnd" promptText="hh:mm" maxWidth="192.0" prefWidth="150.0"
|
|
||||||
GridPane.columnIndex="3"
|
|
||||||
GridPane.rowIndex="4"/>
|
|
||||||
<DatePicker fx:id="datePicker" prefWidth="192.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
|
||||||
<Label fx:id="labelPatientName" text="Name" GridPane.columnIndex="1"/>
|
|
||||||
<Label fx:id="labelCareLevel" text="Pflegestufe" GridPane.columnIndex="3"/>
|
|
||||||
</children>
|
|
||||||
</GridPane>
|
|
||||||
<HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0"
|
|
||||||
AnchorPane.rightAnchor="50.0">
|
|
||||||
<children>
|
|
||||||
<Button fx:id="btnChange" mnemonicParsing="false" onAction="#handleChange" text="Ändern"/>
|
|
||||||
<Button fx:id="btnCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false"
|
|
||||||
onAction="#handleCancel" text="Abbruch"/>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0"
|
|
||||||
AnchorPane.topAnchor="265.0"/>
|
|
||||||
</children>
|
|
||||||
</AnchorPane>
|
|
140
src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml
Normal file
140
src/main/resources/de/hitec/nhplus/patient/AllPatientView.fxml
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<BorderPane
|
||||||
|
xmlns="http://javafx.com/javafx/11.0.1"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="de.hitec.nhplus.patient.AllPatientController"
|
||||||
|
>
|
||||||
|
<padding>
|
||||||
|
<Insets top="8" left="8" bottom="8" right="8"/>
|
||||||
|
</padding>
|
||||||
|
<center>
|
||||||
|
<TableView
|
||||||
|
fx:id="tableView"
|
||||||
|
editable="true"
|
||||||
|
>
|
||||||
|
<columns>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnId"
|
||||||
|
minWidth="40.0"
|
||||||
|
text="ID"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnSurname"
|
||||||
|
minWidth="140.0"
|
||||||
|
onEditCommit="#handleOnEditSurname"
|
||||||
|
text="Nachname"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnFirstName"
|
||||||
|
minWidth="140.0"
|
||||||
|
onEditCommit="#handleOnEditFirstname"
|
||||||
|
text="Vorname"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnDateOfBirth"
|
||||||
|
minWidth="140.0"
|
||||||
|
onEditCommit="#handleOnEditDateOfBirth"
|
||||||
|
text="Geburtstag"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnCareLevel"
|
||||||
|
minWidth="140.0"
|
||||||
|
onEditCommit="#handleOnEditCareLevel"
|
||||||
|
prefWidth="75.0"
|
||||||
|
text="Pflegegrad"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnRoomNumber"
|
||||||
|
minWidth="140.0"
|
||||||
|
onEditCommit="#handleOnEditRoomNumber"
|
||||||
|
text="Raum"
|
||||||
|
/>
|
||||||
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
|
||||||
|
</columnResizePolicy>
|
||||||
|
</TableView>
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<BorderPane>
|
||||||
|
<BorderPane.margin>
|
||||||
|
<Insets top="8.0"/>
|
||||||
|
</BorderPane.margin>
|
||||||
|
<center>
|
||||||
|
<GridPane hgap="8.0" vgap="8.0">
|
||||||
|
<padding>
|
||||||
|
<Insets right="8.0"/>
|
||||||
|
</padding>
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS"/>
|
||||||
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS" />
|
||||||
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
|
</rowConstraints>
|
||||||
|
<TextField
|
||||||
|
fx:id="textFieldFirstName"
|
||||||
|
minWidth="200.0"
|
||||||
|
prefHeight="26.0"
|
||||||
|
prefWidth="200.0"
|
||||||
|
promptText="Vorname"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
fx:id="textFieldSurname"
|
||||||
|
minWidth="200.0"
|
||||||
|
prefHeight="26.0"
|
||||||
|
prefWidth="200.0"
|
||||||
|
promptText="Nachname"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
fx:id="textFieldDateOfBirth"
|
||||||
|
minWidth="160.0"
|
||||||
|
prefWidth="160.0"
|
||||||
|
promptText="Geburtstag"
|
||||||
|
GridPane.columnIndex="2"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
fx:id="textFieldCareLevel"
|
||||||
|
prefHeight="26.0"
|
||||||
|
prefWidth="200.0"
|
||||||
|
promptText="Pflegegrad"
|
||||||
|
GridPane.rowIndex="1"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
fx:id="textFieldRoomNumber"
|
||||||
|
prefHeight="26.0"
|
||||||
|
prefWidth="200.0"
|
||||||
|
promptText="Raum"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="1"
|
||||||
|
/>
|
||||||
|
</GridPane>
|
||||||
|
</center>
|
||||||
|
<right>
|
||||||
|
<VBox spacing="8.0">
|
||||||
|
<Button
|
||||||
|
fx:id="buttonAdd"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleAdd"
|
||||||
|
prefWidth="90.0"
|
||||||
|
text="Hinzufügen"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
fx:id="buttonDelete"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleDelete"
|
||||||
|
prefWidth="90.0"
|
||||||
|
text="Löschen"
|
||||||
|
/>
|
||||||
|
</VBox>
|
||||||
|
</right>
|
||||||
|
</BorderPane>
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<BorderPane
|
||||||
|
xmlns="http://javafx.com/javafx/11.0.1"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="de.hitec.nhplus.treatment.AllTreatmentController"
|
||||||
|
>
|
||||||
|
<padding>
|
||||||
|
<Insets top="8" left="8" bottom="8" right="8"/>
|
||||||
|
</padding>
|
||||||
|
<center>
|
||||||
|
<TableView
|
||||||
|
fx:id="tableView"
|
||||||
|
editable="true"
|
||||||
|
onMouseClicked="#handleMouseClick"
|
||||||
|
>
|
||||||
|
<columns>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnId"
|
||||||
|
minWidth="40.0"
|
||||||
|
text="ID"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnPatientId"
|
||||||
|
minWidth="40.0"
|
||||||
|
text="PatientID"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnDate"
|
||||||
|
maxWidth="-1.0"
|
||||||
|
minWidth="140.0"
|
||||||
|
prefWidth="150.0"
|
||||||
|
text="Datum"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnBegin"
|
||||||
|
minWidth="140.0"
|
||||||
|
text="Beginn"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnEnd"
|
||||||
|
minWidth="140.0"
|
||||||
|
text="Ende"
|
||||||
|
/>
|
||||||
|
<TableColumn
|
||||||
|
fx:id="columnDescription"
|
||||||
|
minWidth="200.0"
|
||||||
|
text="Kurzbeschreibung"
|
||||||
|
/>
|
||||||
|
</columns>
|
||||||
|
<columnResizePolicy>
|
||||||
|
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
|
||||||
|
</columnResizePolicy>
|
||||||
|
</TableView>
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<BorderPane>
|
||||||
|
<BorderPane.margin>
|
||||||
|
<Insets top="8.0"/>
|
||||||
|
</BorderPane.margin>
|
||||||
|
<center>
|
||||||
|
<HBox spacing="8.0">
|
||||||
|
<ComboBox
|
||||||
|
fx:id="comboBoxPatientSelection"
|
||||||
|
minWidth="160.0"
|
||||||
|
onAction="#handleComboBox"
|
||||||
|
prefWidth="200.0"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleNewTreatment"
|
||||||
|
prefWidth="200.0"
|
||||||
|
text="neue Behandlung anlegen"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
/>
|
||||||
|
</HBox>
|
||||||
|
</center>
|
||||||
|
<right>
|
||||||
|
<Button
|
||||||
|
fx:id="buttonDelete"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleDelete"
|
||||||
|
prefWidth="200.0"
|
||||||
|
text="Löschen"
|
||||||
|
GridPane.columnIndex="2"
|
||||||
|
/>
|
||||||
|
</right>
|
||||||
|
</BorderPane>
|
||||||
|
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
127
src/main/resources/de/hitec/nhplus/treatment/TreatmentModal.fxml
Normal file
127
src/main/resources/de/hitec/nhplus/treatment/TreatmentModal.fxml
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<BorderPane
|
||||||
|
xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="de.hitec.nhplus.treatment.TreatmentModalController"
|
||||||
|
>
|
||||||
|
<padding>
|
||||||
|
<Insets top="8" left="8" bottom="8" right="8"/>
|
||||||
|
</padding>
|
||||||
|
<top>
|
||||||
|
<GridPane hgap="8.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="ALWAYS"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
</rowConstraints>
|
||||||
|
<!-- Row 0-->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Vorname:"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="labelFirstName" text="Vorname"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Nachname:"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="labelSurname"
|
||||||
|
text="Nachname"
|
||||||
|
/>
|
||||||
|
<!-- Row 2 -->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Datum:"
|
||||||
|
/>
|
||||||
|
<DatePicker
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="datePicker"
|
||||||
|
promptText="yyyy-mm-dd"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Beschreibung:"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
fx:id="textFieldDescription"
|
||||||
|
/>
|
||||||
|
<!-- Row 3 -->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Beginn:"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
fx:id="textFieldBegin"
|
||||||
|
promptText="hh:mm"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Ende"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
fx:id="textFieldEnd"
|
||||||
|
promptText="hh:mm"
|
||||||
|
/>
|
||||||
|
</GridPane>
|
||||||
|
</top>
|
||||||
|
<center>
|
||||||
|
<HBox spacing="8.0">
|
||||||
|
<BorderPane.margin>
|
||||||
|
<Insets top="8.0"/>
|
||||||
|
</BorderPane.margin>
|
||||||
|
<TextArea
|
||||||
|
fx:id="textAreaRemarks"
|
||||||
|
HBox.hgrow="ALWAYS"
|
||||||
|
/>
|
||||||
|
<VBox>
|
||||||
|
<Button
|
||||||
|
fx:id="buttonSave"
|
||||||
|
prefWidth="90"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleSave"
|
||||||
|
text="Speichern"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
prefWidth="90"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleCancel"
|
||||||
|
text="Abbrechen"
|
||||||
|
/>
|
||||||
|
</VBox>
|
||||||
|
</HBox>
|
||||||
|
</center>
|
||||||
|
</BorderPane>
|
Loading…
Reference in a new issue