Compare commits

...

10 commits

Author SHA1 Message Date
dba043ec1b
NOTICKET: Mergin Structure of Refactor & Nurse Module Together
All checks were successful
Quality Check / Qualty Check (push) Successful in 11s
Quality Check / Qualty Check (pull_request) Successful in 12s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:49:23 +02:00
f17f4d1d5e
NOTICKET: Cleanup Treatment Views and Controllers
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:52 +02:00
d53e67806f
NOTICKET: Cleanup Views to look Better & Be easier to work with
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:52 +02:00
b2dca20ac4
NOTICKET: Cleanup
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:52 +02:00
a3cbf3a940
NOTICKET: Cleanup Views
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:52 +02:00
3a58ea5206
NOTICKET: Cleanup ID Naming
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:52 +02:00
a13dd63662
NOTICKET: Update Package Structure
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-29 14:42:46 +02:00
fe86475633 Merge pull request '#16 story/pfleger-modul-grundimplementierung' (#20) from story/pfleger-modul-grundimplementierung into main
All checks were successful
Quality Check / Qualty Check (push) Successful in 8s
Reviewed-on: #20
Reviewed-by: SZUT-Armin <arminribic@web.de>
2024-04-29 11:48:18 +00:00
2bd06fab41
#16: Setup Controller and View
All checks were successful
Quality Check / Qualty Check (push) Successful in 8s
Quality Check / Qualty Check (pull_request) Successful in 8s
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-27 23:47:07 +02:00
4a9dace345
#16: Setup Nurse Model, DAO & Fixtures
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
2024-04-27 23:46:14 +02:00
39 changed files with 1355 additions and 1283 deletions

View file

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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" />
</component>
</project>

Binary file not shown.

View file

@ -6,7 +6,7 @@ import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.control.TabPane;
import javafx.stage.Stage;
import java.io.IOException;
@ -23,12 +23,12 @@ public class Main extends Application {
public void mainWindow() {
try {
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);
this.primaryStage.setTitle("NHPlus");
this.primaryStage.setScene(scene);
this.primaryStage.setResizable(false);
this.primaryStage.setResizable(true);
this.primaryStage.show();
this.primaryStage.setOnCloseRequest(event -> {

View file

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

View file

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

View file

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

View file

@ -6,11 +6,11 @@ import java.util.List;
public interface Dao<T> {
void create(T t) throws SQLException;
T read(long key) throws SQLException;
T read(int id) throws SQLException;
List<T> readAll() throws SQLException;
void update(T t) throws SQLException;
void deleteById(long key) throws SQLException;
void deleteById(int id) throws SQLException;
}

View file

@ -1,5 +1,9 @@
package de.hitec.nhplus.datastorage;
import de.hitec.nhplus.nurse.NurseDao;
import de.hitec.nhplus.patient.PatientDao;
import de.hitec.nhplus.treatment.TreatmentDao;
public class DaoFactory {
private static DaoFactory instance;
@ -21,4 +25,8 @@ public class DaoFactory {
public PatientDao createPatientDAO() {
return new PatientDao(ConnectionBuilder.getConnection());
}
public NurseDao createNurseDAO() {
return new NurseDao(ConnectionBuilder.getConnection());
}
}

View file

@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.List;
public abstract class DaoImp<T> implements Dao<T> {
protected Connection connection;
protected final Connection connection;
public DaoImp(Connection connection) {
this.connection = connection;
@ -17,7 +17,7 @@ public abstract class DaoImp<T> implements Dao<T> {
}
@Override
public T read(long key) throws SQLException {
public T read(int key) throws SQLException {
T object = null;
ResultSet result = getReadByIDStatement(key).executeQuery();
if (result.next()) {
@ -37,7 +37,7 @@ public abstract class DaoImp<T> implements Dao<T> {
}
@Override
public void deleteById(long key) throws SQLException {
public void deleteById(int key) throws SQLException {
getDeleteStatement(key).executeUpdate();
}
@ -47,11 +47,11 @@ public abstract class DaoImp<T> implements Dao<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 getUpdateStatement(T t);
protected abstract PreparedStatement getDeleteStatement(long key);
protected abstract PreparedStatement getDeleteStatement(int key);
}

View file

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

View file

@ -1,7 +1,7 @@
package de.hitec.nhplus.fixtures;
import de.hitec.nhplus.datastorage.ConnectionBuilder;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.patient.Patient;
import java.sql.Connection;
import java.util.Map;
@ -23,6 +23,12 @@ public class Fixtures
treatmentFixture.dropTable(connection);
treatmentFixture.setupTable(connection);
treatmentFixture.load();
NurseFixture nurseFixture = new NurseFixture();
nurseFixture.dropTable(connection);
nurseFixture.setupTable(connection);
nurseFixture.load();
} catch (Exception exception){
System.out.println(exception.getMessage());
}

View file

@ -0,0 +1,65 @@
package de.hitec.nhplus.fixtures;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.nurse.NurseDao;
import de.hitec.nhplus.nurse.Nurse;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class NurseFixture implements Fixture<Nurse> {
@Override
public void dropTable(Connection connection) {
try (Statement statement = connection.createStatement()) {
statement.execute("DROP TABLE nurse");
} catch (SQLException exception) {
System.out.println(exception.getMessage());
}
}
@Override
public void setupTable(Connection connection) {
final String SQL = "CREATE TABLE IF NOT EXISTS nurse (" +
"tid INTEGER PRIMARY KEY AUTOINCREMENT, " +
"firstname TEXT NOT NULL, " +
"surname TEXT NOT NULL, " +
"phoneNumber TEXT NOT NULL" +
");";
try (Statement statement = connection.createStatement()) {
statement.execute(SQL);
} catch (SQLException exception) {
System.out.println(exception.getMessage());
}
}
@Override
public Map<String, Nurse> load() throws SQLException {
List<Nurse> nurses = new ArrayList<>();
nurses.add(new Nurse(
"Ole",
"Kück",
"0123456789"
));
nurses.add(new Nurse(
"Armin",
"Armout",
"9876543210"
));
NurseDao dao = DaoFactory.getDaoFactory().createNurseDAO();
for(Nurse nurse : nurses){
dao.create(nurse);
}
Map<String, Nurse> nursesByName = new HashMap<>();
for (Nurse nurse : dao.readAll()){
nursesByName.put(nurse.getFirstName(), nurse);
}
return nursesByName;
}
}

View file

@ -1,8 +1,8 @@
package de.hitec.nhplus.fixtures;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.PatientDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.patient.PatientDao;
import de.hitec.nhplus.patient.Patient;
import java.sql.Connection;
import java.sql.SQLException;
@ -32,7 +32,7 @@ public class PatientFixture implements Fixture<Patient>
public void setupTable(Connection connection)
{
final String SQL = "CREATE TABLE IF NOT EXISTS patient (" +
" pid INTEGER PRIMARY KEY AUTOINCREMENT, " +
" id INTEGER PRIMARY KEY AUTOINCREMENT, " +
" firstname TEXT NOT NULL, " +
" surname TEXT NOT NULL, " +
" dateOfBirth TEXT NOT NULL, " +

View file

@ -1,9 +1,9 @@
package de.hitec.nhplus.fixtures;
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.treatment.TreatmentDao;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.treatment.Treatment;
import java.sql.Connection;
import java.sql.SQLException;
@ -18,7 +18,7 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime;
public class TreatmentFixture implements Fixture<Treatment>
{
private Map<String, Patient> patientsByName;
private final 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)
{
final String SQL = "CREATE TABLE IF NOT EXISTS treatment (" +
" tid INTEGER PRIMARY KEY AUTOINCREMENT, " +
" pid INTEGER NOT NULL, " +
" id INTEGER PRIMARY KEY AUTOINCREMENT, " +
" patientId INTEGER NOT NULL, " +
" treatment_date TEXT NOT NULL, " +
" begin TEXT NOT NULL, " +
" end TEXT NOT NULL, " +
" description 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())
@ -73,7 +73,7 @@ public class TreatmentFixture implements Fixture<Treatment>
treatments.add(new Treatment(
1,
seppl.getPid(),
seppl.getId(),
convertStringToLocalDate("2023-06-03"),
convertStringToLocalTime("11:00"),
convertStringToLocalTime("15:00"),
@ -84,7 +84,7 @@ public class TreatmentFixture implements Fixture<Treatment>
));
treatments.add(new Treatment(
2,
seppl.getPid(),
seppl.getId(),
convertStringToLocalDate("2023-06-05"),
convertStringToLocalTime("11:00"),
convertStringToLocalTime("12:30"),
@ -95,7 +95,7 @@ public class TreatmentFixture implements Fixture<Treatment>
));
treatments.add(new Treatment(
3,
martina.getPid(),
martina.getId(),
convertStringToLocalDate("2023-06-04"),
convertStringToLocalTime("07:30"),
convertStringToLocalTime("08:00"),
@ -104,7 +104,7 @@ public class TreatmentFixture implements Fixture<Treatment>
));
treatments.add(new Treatment(
4,
seppl.getPid(),
seppl.getId(),
convertStringToLocalDate("2023-06-06"),
convertStringToLocalTime("15:10"),
convertStringToLocalTime("16:00"),
@ -113,7 +113,7 @@ public class TreatmentFixture implements Fixture<Treatment>
);
treatments.add(new Treatment(
8,
seppl.getPid(),
seppl.getId(),
convertStringToLocalDate("2023-06-08"),
convertStringToLocalTime("15:00"),
convertStringToLocalTime("16:00"),
@ -122,7 +122,7 @@ public class TreatmentFixture implements Fixture<Treatment>
);
treatments.add(new Treatment(
9,
martina.getPid(),
martina.getId(),
convertStringToLocalDate("2023-06-07"),
convertStringToLocalTime("11:00"),
convertStringToLocalTime("11:30"),
@ -131,7 +131,7 @@ public class TreatmentFixture implements Fixture<Treatment>
);
treatments.add(new Treatment(
12,
hans.getPid(),
hans.getId(),
convertStringToLocalDate("2023-06-08"),
convertStringToLocalTime("15:00"),
convertStringToLocalTime("15:30"),
@ -140,7 +140,7 @@ public class TreatmentFixture implements Fixture<Treatment>
);
treatments.add(new Treatment(
14,
ahmet.getPid(),
ahmet.getId(),
convertStringToLocalDate("2023-08-24"),
convertStringToLocalTime("09:30"),
convertStringToLocalTime("10:15"),
@ -148,7 +148,7 @@ public class TreatmentFixture implements Fixture<Treatment>
"Lympfdrainage"));
treatments.add(new Treatment(
16,
elisabeth.getPid(),
elisabeth.getId(),
convertStringToLocalDate("2023-08-31"),
convertStringToLocalTime("13:30"),
convertStringToLocalTime("13:45"),
@ -157,7 +157,7 @@ public class TreatmentFixture implements Fixture<Treatment>
);
treatments.add(new Treatment(
17,
elisabeth.getPid(),
elisabeth.getId(),
convertStringToLocalDate("2023-09-01"),
convertStringToLocalTime("16:00"),
convertStringToLocalTime("17:00"),
@ -169,7 +169,7 @@ public class TreatmentFixture implements Fixture<Treatment>
Map<String, Treatment> treatmentsById = new HashMap<>();
for (Treatment treatment : treatments){
dao.create(treatment);
treatmentsById.put(String.valueOf(treatment.getTid()), treatment);
treatmentsById.put(String.valueOf(treatment.getId()), treatment);
}
return treatmentsById;
}

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

View file

@ -1,4 +1,4 @@
package de.hitec.nhplus.model;
package de.hitec.nhplus.main;
import javafx.beans.property.SimpleStringProperty;

View file

@ -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";
}
}

View file

@ -0,0 +1,57 @@
package de.hitec.nhplus.nurse;
import de.hitec.nhplus.datastorage.DaoFactory;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import java.sql.SQLException;
public class AllNurseController {
@FXML
private TableView<Nurse> tableView;
@FXML
private TableColumn<Nurse, Long> columnId;
@FXML
private TableColumn<Nurse, String> columnFirstName;
@FXML
private TableColumn<Nurse, String> columnSurname;
@FXML
private TableColumn<Nurse, String> columnPhoneNumber;
private final ObservableList<Nurse> nurses = FXCollections.observableArrayList();
private NurseDao dao;
public void initialize() {
this.readAllAndSHowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("nid"));
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname"));
this.columnSurname.setCellFactory(TextFieldTableCell.forTableColumn());
this.columnPhoneNumber.setCellValueFactory(new PropertyValueFactory<>("phoneNumber"));
this.columnPhoneNumber.setCellFactory(TextFieldTableCell.forTableColumn());
this.tableView.setItems(this.nurses);
}
private void readAllAndSHowInTableView(){
this.nurses.clear();
this.dao = DaoFactory.getDaoFactory().createNurseDAO();
try {
this.nurses.addAll(this.dao.readAll());
}catch (SQLException exception){
exception.printStackTrace();
}
}
}

View file

@ -0,0 +1,50 @@
package de.hitec.nhplus.nurse;
import de.hitec.nhplus.main.Person;
import javafx.beans.property.SimpleLongProperty;
import javafx.beans.property.SimpleStringProperty;
public class Nurse extends Person {
private SimpleLongProperty nid;
private final SimpleStringProperty phoneNumber;
public Nurse(
String firstName,
String surname,
String phoneNumber
) {
super(firstName, surname);
this.phoneNumber = new SimpleStringProperty(phoneNumber);
}
public Nurse(
long nid,
String firstName,
String surname,
String phoneNumber
) {
super(firstName, surname);
this.nid = new SimpleLongProperty(nid);
this.phoneNumber = new SimpleStringProperty(phoneNumber);
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber.set(phoneNumber);
}
public long getNid() {
return nid.get();
}
public SimpleLongProperty nidProperty() {
return nid;
}
public String getPhoneNumber() {
return phoneNumber.get();
}
public SimpleStringProperty phoneNumberProperty() {
return phoneNumber;
}
}

View file

@ -0,0 +1,115 @@
package de.hitec.nhplus.nurse;
import de.hitec.nhplus.datastorage.DaoImp;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class NurseDao extends DaoImp<Nurse> {
public NurseDao(Connection connection) {
super(connection);
}
@Override
protected PreparedStatement getCreateStatement(Nurse nurse) {
PreparedStatement preparedStatement = null;
try {
final String SQL = "INSERT INTO nurse (firstname, surname, phoneNumber)" +
"VALUES (?, ?, ?)";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setString(1, nurse.getFirstName());
preparedStatement.setString(2, nurse.getSurname());
preparedStatement.setString(3, nurse.getPhoneNumber());
} catch (SQLException exception) {
exception.printStackTrace();
}
return preparedStatement;
}
@Override
protected PreparedStatement getReadByIDStatement(int nid) {
PreparedStatement preparedStatement = null;
try {
final String SQL = "SELECT * FROM nurse WHERE nid = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, nid);
} catch (SQLException exception) {
exception.printStackTrace();
}
return preparedStatement;
}
@Override
protected Nurse getInstanceFromResultSet(ResultSet result) throws SQLException {
return new Nurse(
result.getLong(1),
result.getString(2),
result.getString(3),
result.getString(4)
);
}
@Override
protected PreparedStatement getReadAllStatement() {
PreparedStatement statement = null;
try {
final String SQL = "SELECT * FROM nurse";
statement = this.connection.prepareStatement(SQL);
} catch (SQLException exception) {
exception.printStackTrace();
}
return statement;
}
@Override
protected ArrayList<Nurse> getListFromResultSet(ResultSet result) throws SQLException {
ArrayList<Nurse> list = new ArrayList<>();
while (result.next()) {
list.add(new Nurse(
result.getLong(1),
result.getString(2),
result.getString(3),
result.getString(4)
));
}
return list;
}
@Override
protected PreparedStatement getUpdateStatement(Nurse nurse) {
PreparedStatement preparedStatement = null;
try {
final String SQL =
"UPDATE nurse SET " +
"firstname = ?, " +
"surname = ?, " +
"phoneNumber = ?, " +
"WHERE nid = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setString(1, nurse.getFirstName());
preparedStatement.setString(2, nurse.getSurname());
preparedStatement.setString(3, nurse.getPhoneNumber());
preparedStatement.setLong(4, nurse.getNid());
} catch (SQLException exception) {
exception.printStackTrace();
}
return preparedStatement;
}
@Override
protected PreparedStatement getDeleteStatement(int nid) {
PreparedStatement preparedStatement = null;
try {
final String SQL = "DELETE FROM nurse WHERE nid = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, nid);
} catch (SQLException exception) {
exception.printStackTrace();
}
return preparedStatement;
}
}

View file

@ -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.PatientDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.utils.DateConverter;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
@ -57,7 +55,7 @@ public class AllPatientController {
public void initialize() {
this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("pid"));
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
@ -82,9 +80,7 @@ public class AllPatientController {
.getSelectionModel()
.selectedItemProperty()
.addListener((observableValue, oldPatient, newPatient) ->
{
AllPatientController.this.buttonDelete.setDisable(newPatient == null);
}
AllPatientController.this.buttonDelete.setDisable(newPatient == null)
);
this.buttonAdd.setDisable(true);
@ -191,7 +187,7 @@ public class AllPatientController {
Patient selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
try {
DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getPid());
DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getId());
this.tableView.getItems().remove(selectedItem);
} catch (SQLException exception) {
exception.printStackTrace();

View file

@ -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 javafx.beans.property.SimpleLongProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
* Patients live in a NURSING home and are treated by nurses.
*/
public class Patient extends Person {
private SimpleLongProperty pid;
private SimpleIntegerProperty id;
private final SimpleStringProperty dateOfBirth;
private final SimpleStringProperty careLevel;
private final SimpleStringProperty roomNumber;
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(
String firstName,
String surname,
@ -41,19 +30,8 @@ public class Patient extends Person {
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(
long pid,
int id,
String firstName,
String surname,
LocalDate dateOfBirth,
@ -61,18 +39,18 @@ public class Patient extends Person {
String roomNumber
) {
super(firstName, surname);
this.pid = new SimpleLongProperty(pid);
this.id = new SimpleIntegerProperty(id);
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
this.careLevel = new SimpleStringProperty(careLevel);
this.roomNumber = new SimpleStringProperty(roomNumber);
}
public long getPid() {
return pid.get();
public int getId() {
return id.get();
}
public SimpleLongProperty pidProperty() {
return pid;
public SimpleIntegerProperty pidProperty() {
return id;
}
public String getDateOfBirth() {
@ -83,11 +61,6 @@ public class Patient extends Person {
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) {
this.dateOfBirth.set(dateOfBirth);
}
@ -117,13 +90,6 @@ public class Patient extends Person {
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) {
if (this.allTreatments.contains(treatment)) {
return false;
@ -133,7 +99,7 @@ public class Patient extends Person {
}
public String toString() {
return "Patient" + "\nMNID: " + this.pid +
return "Patient" + "\nMNID: " + this.id +
"\nFirstname: " + this.getFirstName() +
"\nSurname: " + this.getSurname() +
"\nBirthday: " + this.dateOfBirth +

View file

@ -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 java.sql.*;
import java.time.LocalDate;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
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> {
/**
* 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) {
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
protected PreparedStatement getCreateStatement(Patient patient) {
PreparedStatement preparedStatement = null;
@ -46,31 +33,19 @@ public class PatientDao extends DaoImp<Patient> {
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
protected PreparedStatement getReadByIDStatement(long pid) {
protected PreparedStatement getReadByIDStatement(int id) {
PreparedStatement preparedStatement = null;
try {
final String SQL = "SELECT * FROM patient WHERE pid = ?";
final String SQL = "SELECT * FROM patient WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setLong(1, pid);
preparedStatement.setInt(1, id);
} catch (SQLException exception) {
exception.printStackTrace();
}
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
protected Patient getInstanceFromResultSet(ResultSet result) throws SQLException {
return new Patient(
@ -82,11 +57,6 @@ public class PatientDao extends DaoImp<Patient> {
result.getString(6));
}
/**
* Generates a <code>PreparedStatement</code> to query all patients.
*
* @return <code>PreparedStatement</code> to query all patients.
*/
@Override
protected PreparedStatement getReadAllStatement() {
PreparedStatement statement = null;
@ -99,33 +69,22 @@ public class PatientDao extends DaoImp<Patient> {
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
protected ArrayList<Patient> getListFromResultSet(ResultSet result) throws SQLException {
ArrayList<Patient> list = new ArrayList<>();
while (result.next()) {
LocalDate date = DateConverter.convertStringToLocalDate(result.getString(4));
Patient patient = new Patient(result.getInt(1), result.getString(2),
result.getString(3), date,
result.getString(5), result.getString(6));
Patient patient = new Patient(
result.getInt(1),
result.getString(2),
result.getString(3),
DateConverter.convertStringToLocalDate(result.getString(4)),
result.getString(5),
result.getString(6));
list.add(patient);
}
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
protected PreparedStatement getUpdateStatement(Patient patient) {
PreparedStatement preparedStatement = null;
@ -137,33 +96,27 @@ public class PatientDao extends DaoImp<Patient> {
"dateOfBirth = ?, " +
"carelevel = ?, " +
"roomnumber = ?, " +
"WHERE pid = ?";
"WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setString(1, patient.getFirstName());
preparedStatement.setString(2, patient.getSurname());
preparedStatement.setString(3, patient.getDateOfBirth());
preparedStatement.setString(4, patient.getCareLevel());
preparedStatement.setString(5, patient.getRoomNumber());
preparedStatement.setLong(6, patient.getPid());
preparedStatement.setInt(6, patient.getId());
} catch (SQLException exception) {
exception.printStackTrace();
}
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
protected PreparedStatement getDeleteStatement(long pid) {
protected PreparedStatement getDeleteStatement(int id) {
PreparedStatement preparedStatement = null;
try {
final String SQL = "DELETE FROM patient WHERE pid = ?";
final String SQL = "DELETE FROM patient WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setLong(1, pid);
preparedStatement.setInt(1, id);
} catch (SQLException exception) {
exception.printStackTrace();
}

View file

@ -1,11 +1,9 @@
package de.hitec.nhplus.controller;
package de.hitec.nhplus.treatment;
import de.hitec.nhplus.Main;
import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.PatientDao;
import de.hitec.nhplus.datastorage.TreatmentDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.model.Treatment;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.patient.PatientDao;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
@ -13,15 +11,14 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
public class AllTreatmentController
{
public class AllTreatmentController {
@FXML
private TableView<Treatment> tableView;
@ -30,7 +27,7 @@ public class AllTreatmentController
private TableColumn<Treatment, Integer> columnId;
@FXML
private TableColumn<Treatment, Integer> columnPid;
private TableColumn<Treatment, Integer> columnPatientId;
@FXML
private TableColumn<Treatment, String> columnDate;
@ -55,14 +52,13 @@ public class AllTreatmentController
private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
private ArrayList<Patient> patientList;
public void initialize()
{
public void initialize() {
readAllAndShowInTableView();
comboBoxPatientSelection.setItems(patientSelection);
comboBoxPatientSelection.getSelectionModel().select(0);
this.columnId.setCellValueFactory(new PropertyValueFactory<>("tid"));
this.columnPid.setCellValueFactory(new PropertyValueFactory<>("pid"));
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
this.columnPatientId.setCellValueFactory(new PropertyValueFactory<>("patientId"));
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
@ -74,83 +70,64 @@ public class AllTreatmentController
.getSelectionModel()
.selectedItemProperty()
.addListener((observableValue, oldTreatment, newTreatment) ->
{
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null);
}
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)
);
this.createComboBoxData();
}
public void readAllAndShowInTableView()
{
public void readAllAndShowInTableView() {
this.treatments.clear();
comboBoxPatientSelection.getSelectionModel().select(0);
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
try
{
try {
this.treatments.addAll(dao.readAll());
} catch (SQLException exception)
{
} catch (SQLException exception) {
exception.printStackTrace();
}
}
private void createComboBoxData()
{
private void createComboBoxData() {
PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO();
try
{
try {
patientList = (ArrayList<Patient>) dao.readAll();
this.patientSelection.add("alle");
for (Patient patient : patientList)
{
for (Patient patient : patientList) {
this.patientSelection.add(patient.getSurname());
}
} catch (SQLException exception)
{
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleComboBox()
{
public void handleComboBox() {
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
this.treatments.clear();
this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
if (selectedPatient.equals("alle"))
{
try
{
if (selectedPatient.equals("alle")) {
try {
this.treatments.addAll(this.dao.readAll());
} catch (SQLException exception)
{
} catch (SQLException exception) {
exception.printStackTrace();
}
}
Patient patient = searchInList(selectedPatient);
if (patient != null)
{
try
{
this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getPid()));
} catch (SQLException exception)
{
if (patient != null) {
try {
this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getId()));
} catch (SQLException exception) {
exception.printStackTrace();
}
}
}
private Patient searchInList(String surname)
{
for (Patient patient : this.patientList)
{
if (patient.getSurname().equals(surname))
{
private Patient searchInList(String surname) {
for (Patient patient : this.patientList) {
if (patient.getSurname().equals(surname)) {
return patient;
}
}
@ -158,30 +135,24 @@ public class AllTreatmentController
}
@FXML
public void handleDelete()
{
public void handleDelete() {
int index = this.tableView.getSelectionModel().getSelectedIndex();
Treatment t = this.treatments.remove(index);
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
try
{
dao.deleteById(t.getTid());
} catch (SQLException exception)
{
try {
dao.deleteById(t.getId());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleNewTreatment()
{
try
{
public void handleNewTreatment() {
try {
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
Patient patient = searchInList(selectedPatient);
newTreatmentWindow(patient);
} catch (NullPointerException exception)
{
} catch (NullPointerException exception) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information");
alert.setHeaderText("Patient für die Behandlung fehlt!");
@ -191,12 +162,10 @@ public class AllTreatmentController
}
@FXML
public void handleMouseClick()
{
public void handleMouseClick() {
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();
Treatment treatment = this.treatments.get(index);
treatmentWindow(treatment);
@ -204,47 +173,75 @@ public class AllTreatmentController
});
}
public void newTreatmentWindow(Patient patient)
{
try
{
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/NewTreatmentView.fxml"));
AnchorPane pane = loader.load();
public void newTreatmentWindow(Patient patient) {
try {
FXMLLoader loader = new FXMLLoader(
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
);
BorderPane pane = loader.load();
Scene scene = new Scene(pane);
// the primary stage should stay in the background
Stage stage = new Stage();
NewTreatmentController controller = loader.getController();
controller.initialize(this, stage, patient);
TreatmentModalController controller = loader.getController();
controller.initialize(
this,
stage,
null,
patient
);
stage.setScene(scene);
stage.setResizable(false);
stage.setTitle("NHPlus - Neue Behandlung");
stage.setResizable(true);
stage.setAlwaysOnTop(true);
stage.showAndWait();
} catch (IOException exception)
{
} catch (IOException exception) {
exception.printStackTrace();
}
}
public void treatmentWindow(Treatment treatment)
{
try
{
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/TreatmentView.fxml"));
AnchorPane pane = loader.load();
public void treatmentWindow(Treatment treatment) {
try {
FXMLLoader loader = new FXMLLoader(
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
);
BorderPane pane = loader.load();
Scene scene = new Scene(pane);
// the primary stage should stay in the background
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.setResizable(false);
stage.setTitle("NHPlus - Behandlung");
stage.setResizable(true);
stage.setAlwaysOnTop(true);
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();
}
}

View 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";
}
}

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

View file

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

View file

@ -1,16 +1,21 @@
module de.hitec.nhplus {
requires javafx.controls;
requires javafx.fxml;
requires org.controlsfx.controls;
requires java.sql;
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.controller;
exports de.hitec.nhplus.model;
opens de.hitec.nhplus to javafx.fxml;
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;
exports de.hitec.nhplus.nurse;
opens de.hitec.nhplus.nurse to javafx.base, javafx.fxml;
}

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0" AnchorPane.bottomAnchor="70.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="80.0">
<columns>
<TableColumn fx:id="colID" maxWidth="1200.0" minWidth="5.0" prefWidth="5.0" text="ID" />
<TableColumn fx:id="colSurname" maxWidth="7500.0" minWidth="20.0" prefWidth="100.0" text="Nachname" />
<TableColumn fx:id="colFirstName" maxWidth="7500.0" prefWidth="75.0" text="Vorname" />
<TableColumn fx:id="colTelephone" maxWidth="7500.0" prefWidth="75.0" text="Telefon" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy>
</TableView>
<HBox layoutX="420.0" layoutY="450.0" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0">
<children>
<TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname" />
<TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname" />
<TextField fx:id="txfTelephone" prefWidth="160.0" promptText="Telefonnummer" />
<Button fx:id="btnAdd" mnemonicParsing="false" prefWidth="90.0" text="Hinzufügen" />
<Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen" />
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" 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="Pfleger/innen" textAlignment="CENTER">
<font>
<Font size="36.0" />
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0" />
</padding>
</AnchorPane>

View file

@ -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>

View file

@ -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>

View file

@ -1,4 +1 @@
.vBox{
-fx-background-color: navy;
-fx-border-color: rgb(142, 142, 142);
}
/* https://materialui.co/colors */

View file

@ -1,25 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<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">
<left>
<VBox id="vBox" alignment="CENTER" spacing="50.0" styleClass="vBox" stylesheets="@Application.css" BorderPane.alignment="CENTER">
<children>
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllPatient" prefWidth="105.0" text="Patienten/innen">
<VBox.margin>
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
</VBox.margin>
<opaqueInsets>
<Insets />
</opaqueInsets></Button>
<Button alignment="CENTER" contentDisplay="CENTER" mnemonicParsing="false" onAction="#handleShowAllTreatments" prefWidth="105.0" text="Behandlungen">
<VBox.margin>
<Insets bottom="50.0" left="10.0" right="10.0" top="50.0" />
</VBox.margin></Button>
</children>
</VBox>
</left>
</BorderPane>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<TabPane
tabClosingPolicy="UNAVAILABLE"
xmlns="http://javafx.com/javafx/17.0.2-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="de.hitec.nhplus.main.MainWindowController"
>
<Tab fx:id="patientTab" text="Patienten">
<AnchorPane fx:id="patientPage"/>
</Tab>
<Tab fx:id="treatmentTab" text="Behandlungen">
<AnchorPane fx:id="treatmentPage"/>
</Tab>
</TabPane>

View file

@ -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>

View file

@ -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>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="500.0" prefWidth="855.0" xmlns="http://javafx.com/javafx/10.0.2-internal"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.nurse.AllNurseController">
<children>
<TableView fx:id="tableView" editable="true" layoutX="31.0" layoutY="40.0" AnchorPane.bottomAnchor="70.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" prefWidth="100.0" text="Nachname"/>
<TableColumn fx:id="columnFirstName" maxWidth="7500.0" prefWidth="75.0" text="Vorname"/>
<TableColumn fx:id="columnPhoneNumber" maxWidth="7500.0" prefWidth="75.0" text="Telefonnummer"/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
<HBox layoutX="420.0" layoutY="450.0" spacing="10.0" AnchorPane.bottomAnchor="15.0" AnchorPane.leftAnchor="15.0"
AnchorPane.rightAnchor="15.0">
<children>
<TextField fx:id="txfSurname" prefHeight="26.0" prefWidth="220.0" promptText="Nachname"/>
<TextField fx:id="txfFirstname" prefHeight="26.0" prefWidth="220.0" promptText="Vorname"/>
<TextField fx:id="txfPhoneNumber" prefWidth="160.0" promptText="Telefonnummer"/>
<Button fx:id="btnAdd" mnemonicParsing="false" prefWidth="90.0" text="Hinzufügen"/>
<Button fx:id="btnDelete" mnemonicParsing="false" prefWidth="90.0" text="Löschen"/>
</children>
</HBox>
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" 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="Pfleger/innen"
textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
</children>
<padding>
<Insets top="10.0"/>
</padding>
</AnchorPane>

View 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>

View file

@ -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>

View 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>