Compare commits
6 commits
001d8bd2ce
...
8506464d4d
Author | SHA1 | Date | |
---|---|---|---|
8506464d4d | |||
a5925e3603 | |||
eeb3630229 | |||
797dd69f63 | |||
87cf330dce | |||
2b6efbc618 |
12 changed files with 104 additions and 235 deletions
Binary file not shown.
|
@ -1,7 +1,6 @@
|
||||||
package de.hitec.nhplus.fixtures;
|
package de.hitec.nhplus.fixtures;
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.ConnectionBuilder;
|
import de.hitec.nhplus.datastorage.ConnectionBuilder;
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
@ -29,17 +28,15 @@ public class Fixtures {
|
||||||
patientFixture.setupTable(connection);
|
patientFixture.setupTable(connection);
|
||||||
Map<String, Patient> patientsByName = patientFixture.load();
|
Map<String, Patient> patientsByName = patientFixture.load();
|
||||||
|
|
||||||
NurseFixture nurseFixture = new NurseFixture();
|
TreatmentFixture treatmentFixture = new TreatmentFixture(patientsByName);
|
||||||
nurseFixture.dropTable(connection);
|
|
||||||
nurseFixture.setupTable(connection);
|
|
||||||
Map<String, Nurse> nursesByName = nurseFixture.load();
|
|
||||||
|
|
||||||
|
|
||||||
TreatmentFixture treatmentFixture = new TreatmentFixture(patientsByName, nursesByName);
|
|
||||||
treatmentFixture.dropTable(connection);
|
treatmentFixture.dropTable(connection);
|
||||||
treatmentFixture.setupTable(connection);
|
treatmentFixture.setupTable(connection);
|
||||||
treatmentFixture.load();
|
treatmentFixture.load();
|
||||||
|
|
||||||
|
NurseFixture nurseFixture = new NurseFixture();
|
||||||
|
nurseFixture.dropTable(connection);
|
||||||
|
nurseFixture.setupTable(connection);
|
||||||
|
nurseFixture.load();
|
||||||
|
|
||||||
MedicationFixture medicationFixture = new MedicationFixture();
|
MedicationFixture medicationFixture = new MedicationFixture();
|
||||||
medicationFixture.dropTable(connection);
|
medicationFixture.dropTable(connection);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.medication.Ingredient;
|
import de.hitec.nhplus.medication.Ingredient;
|
||||||
import de.hitec.nhplus.medication.Medication;
|
import de.hitec.nhplus.medication.Medication;
|
||||||
import de.hitec.nhplus.medication.database.MedicationDao;
|
import de.hitec.nhplus.medication.database.MedicationDao;
|
||||||
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import de.hitec.nhplus.Main;
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.patient.database.PatientDao;
|
import de.hitec.nhplus.patient.database.PatientDao;
|
||||||
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package de.hitec.nhplus.fixtures;
|
||||||
|
|
||||||
import de.hitec.nhplus.Main;
|
import de.hitec.nhplus.Main;
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.treatment.Treatment;
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
import de.hitec.nhplus.treatment.database.TreatmentDao;
|
import de.hitec.nhplus.treatment.database.TreatmentDao;
|
||||||
|
@ -24,11 +23,9 @@ import static de.hitec.nhplus.utils.DateConverter.convertStringToLocalTime;
|
||||||
*/
|
*/
|
||||||
public class TreatmentFixture implements Fixture<Treatment> {
|
public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
private final Map<String, Patient> patientsByName;
|
private final Map<String, Patient> patientsByName;
|
||||||
private final Map<String, Nurse> nursesByName;
|
|
||||||
|
|
||||||
public TreatmentFixture(Map<String, Patient> patientsByName, Map<String, Nurse> nursesByName) {
|
public TreatmentFixture(Map<String, Patient> patientsByName) {
|
||||||
this.patientsByName = patientsByName;
|
this.patientsByName = patientsByName;
|
||||||
this.nursesByName = nursesByName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,13 +51,9 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
Patient ahmet = patientsByName.get("Ahmet");
|
Patient ahmet = patientsByName.get("Ahmet");
|
||||||
Patient elisabeth = patientsByName.get("Elisabeth");
|
Patient elisabeth = patientsByName.get("Elisabeth");
|
||||||
|
|
||||||
Nurse ole = nursesByName.get("Ole");
|
|
||||||
Nurse armin = nursesByName.get("Armin");
|
|
||||||
|
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
1,
|
1,
|
||||||
seppl,
|
seppl,
|
||||||
ole,
|
|
||||||
convertStringToLocalDate("2023-06-03"),
|
convertStringToLocalDate("2023-06-03"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
|
@ -72,7 +65,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
2,
|
2,
|
||||||
seppl,
|
seppl,
|
||||||
armin,
|
|
||||||
convertStringToLocalDate("2023-06-05"),
|
convertStringToLocalDate("2023-06-05"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("12:30"),
|
convertStringToLocalTime("12:30"),
|
||||||
|
@ -84,7 +76,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
3,
|
3,
|
||||||
martina,
|
martina,
|
||||||
ole,
|
|
||||||
convertStringToLocalDate("2023-06-04"),
|
convertStringToLocalDate("2023-06-04"),
|
||||||
convertStringToLocalTime("07:30"),
|
convertStringToLocalTime("07:30"),
|
||||||
convertStringToLocalTime("08:00"),
|
convertStringToLocalTime("08:00"),
|
||||||
|
@ -94,7 +85,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
4,
|
4,
|
||||||
seppl,
|
seppl,
|
||||||
armin,
|
|
||||||
convertStringToLocalDate("2023-06-06"),
|
convertStringToLocalDate("2023-06-06"),
|
||||||
convertStringToLocalTime("15:10"),
|
convertStringToLocalTime("15:10"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
|
@ -104,7 +94,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
8,
|
8,
|
||||||
seppl,
|
seppl,
|
||||||
ole,
|
|
||||||
convertStringToLocalDate("2023-06-08"),
|
convertStringToLocalDate("2023-06-08"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
|
@ -114,7 +103,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
9,
|
9,
|
||||||
martina,
|
martina,
|
||||||
armin,
|
|
||||||
convertStringToLocalDate("2023-06-07"),
|
convertStringToLocalDate("2023-06-07"),
|
||||||
convertStringToLocalTime("11:00"),
|
convertStringToLocalTime("11:00"),
|
||||||
convertStringToLocalTime("11:30"),
|
convertStringToLocalTime("11:30"),
|
||||||
|
@ -124,7 +112,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
12,
|
12,
|
||||||
hans,
|
hans,
|
||||||
armin,
|
|
||||||
convertStringToLocalDate("2023-06-08"),
|
convertStringToLocalDate("2023-06-08"),
|
||||||
convertStringToLocalTime("15:00"),
|
convertStringToLocalTime("15:00"),
|
||||||
convertStringToLocalTime("15:30"),
|
convertStringToLocalTime("15:30"),
|
||||||
|
@ -134,7 +121,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
14,
|
14,
|
||||||
ahmet,
|
ahmet,
|
||||||
ole,
|
|
||||||
convertStringToLocalDate("2023-08-24"),
|
convertStringToLocalDate("2023-08-24"),
|
||||||
convertStringToLocalTime("09:30"),
|
convertStringToLocalTime("09:30"),
|
||||||
convertStringToLocalTime("10:15"),
|
convertStringToLocalTime("10:15"),
|
||||||
|
@ -143,7 +129,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
16,
|
16,
|
||||||
elisabeth,
|
elisabeth,
|
||||||
armin,
|
|
||||||
convertStringToLocalDate("2023-08-31"),
|
convertStringToLocalDate("2023-08-31"),
|
||||||
convertStringToLocalTime("13:30"),
|
convertStringToLocalTime("13:30"),
|
||||||
convertStringToLocalTime("13:45"),
|
convertStringToLocalTime("13:45"),
|
||||||
|
@ -153,7 +138,6 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
||||||
treatments.add(new Treatment(
|
treatments.add(new Treatment(
|
||||||
17,
|
17,
|
||||||
elisabeth,
|
elisabeth,
|
||||||
ole,
|
|
||||||
convertStringToLocalDate("2023-09-01"),
|
convertStringToLocalDate("2023-09-01"),
|
||||||
convertStringToLocalTime("16:00"),
|
convertStringToLocalTime("16:00"),
|
||||||
convertStringToLocalTime("17:00"),
|
convertStringToLocalTime("17:00"),
|
||||||
|
|
|
@ -2,8 +2,6 @@ package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
import de.hitec.nhplus.Main;
|
import de.hitec.nhplus.Main;
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.nurse.database.NurseDao;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.patient.database.PatientDao;
|
import de.hitec.nhplus.patient.database.PatientDao;
|
||||||
import de.hitec.nhplus.treatment.database.TreatmentDao;
|
import de.hitec.nhplus.treatment.database.TreatmentDao;
|
||||||
|
@ -39,9 +37,6 @@ public class AllTreatmentController {
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Treatment, String> columnPatientName;
|
private TableColumn<Treatment, String> columnPatientName;
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TableColumn<Treatment, String> columnNurseName;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Treatment, String> columnDate;
|
private TableColumn<Treatment, String> columnDate;
|
||||||
|
|
||||||
|
@ -57,9 +52,6 @@ public class AllTreatmentController {
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> comboBoxPatientSelection;
|
private ComboBox<String> comboBoxPatientSelection;
|
||||||
|
|
||||||
@FXML
|
|
||||||
public ComboBox<String> comboBoxNurseSelection;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button buttonDelete;
|
private Button buttonDelete;
|
||||||
|
|
||||||
|
@ -67,8 +59,6 @@ public class AllTreatmentController {
|
||||||
private TreatmentDao dao;
|
private TreatmentDao dao;
|
||||||
private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
|
private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
|
||||||
private ArrayList<Patient> patientList;
|
private ArrayList<Patient> patientList;
|
||||||
private final ObservableList<String> nurseSelection = FXCollections.observableArrayList();
|
|
||||||
private ArrayList<Nurse> nurseList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization method that is called after the binding of all the fields.
|
* Initialization method that is called after the binding of all the fields.
|
||||||
|
@ -77,9 +67,7 @@ public class AllTreatmentController {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
readAllAndShowInTableView();
|
readAllAndShowInTableView();
|
||||||
comboBoxPatientSelection.setItems(patientSelection);
|
comboBoxPatientSelection.setItems(patientSelection);
|
||||||
comboBoxPatientSelection.getSelectionModel().select("alle");
|
comboBoxPatientSelection.getSelectionModel().select(0);
|
||||||
|
|
||||||
comboBoxNurseSelection.setItems(nurseSelection);
|
|
||||||
|
|
||||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||||
this.columnPatientName.setCellValueFactory(
|
this.columnPatientName.setCellValueFactory(
|
||||||
|
@ -88,12 +76,6 @@ public class AllTreatmentController {
|
||||||
return new SimpleStringProperty(patient.getSurName() + ", " + patient.getFirstName());
|
return new SimpleStringProperty(patient.getSurName() + ", " + patient.getFirstName());
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.columnNurseName.setCellValueFactory(
|
|
||||||
cellData -> {
|
|
||||||
Nurse nurse = cellData.getValue().getNurse();
|
|
||||||
return new SimpleStringProperty(nurse.getSurName() + ", " + nurse.getFirstName());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
||||||
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
|
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
|
||||||
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
|
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
|
||||||
|
@ -115,6 +97,7 @@ public class AllTreatmentController {
|
||||||
* Internal method to read all data and set it to the table view.
|
* Internal method to read all data and set it to the table view.
|
||||||
*/
|
*/
|
||||||
public void readAllAndShowInTableView() {
|
public void readAllAndShowInTableView() {
|
||||||
|
comboBoxPatientSelection.getSelectionModel().select(0);
|
||||||
this.dao = DaoFactory.getInstance().createTreatmentDao();
|
this.dao = DaoFactory.getInstance().createTreatmentDao();
|
||||||
try {
|
try {
|
||||||
this.treatments.setAll(dao.readAll());
|
this.treatments.setAll(dao.readAll());
|
||||||
|
@ -127,19 +110,13 @@ public class AllTreatmentController {
|
||||||
* Internal method to create the data set for the combobox that is used for creating a new {@link Treatment}.
|
* Internal method to create the data set for the combobox that is used for creating a new {@link Treatment}.
|
||||||
*/
|
*/
|
||||||
private void createComboBoxData() {
|
private void createComboBoxData() {
|
||||||
PatientDao patientDAO = DaoFactory.getInstance().createPatientDAO();
|
PatientDao dao = DaoFactory.getInstance().createPatientDAO();
|
||||||
NurseDao nurseDao = DaoFactory.getInstance().createNurseDAO();
|
|
||||||
try {
|
try {
|
||||||
patientList = (ArrayList<Patient>) patientDAO.readAll();
|
patientList = (ArrayList<Patient>) dao.readAll();
|
||||||
this.patientSelection.add("alle");
|
this.patientSelection.add("alle");
|
||||||
for (Patient patient : patientList) {
|
for (Patient patient : patientList) {
|
||||||
this.patientSelection.add(patient.getSurName());
|
this.patientSelection.add(patient.getSurName());
|
||||||
}
|
}
|
||||||
|
|
||||||
nurseList = (ArrayList<Nurse>) nurseDao.readAll();
|
|
||||||
for (Nurse nurse : nurseList) {
|
|
||||||
this.nurseSelection.add(nurse.getSurName());
|
|
||||||
}
|
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -148,10 +125,10 @@ public class AllTreatmentController {
|
||||||
/**
|
/**
|
||||||
* Internal method to get the {@link Patient} object by its surname.
|
* Internal method to get the {@link Patient} object by its surname.
|
||||||
*
|
*
|
||||||
* @see AllTreatmentController#handleComboBoxPatient
|
* @see AllTreatmentController#handleComboBox
|
||||||
* @see AllTreatmentController#handleNewTreatment
|
* @see AllTreatmentController#handleNewTreatment
|
||||||
*/
|
*/
|
||||||
private Patient searchInPatientList(String surname) {
|
private Patient searchInList(String surname) {
|
||||||
for (Patient patient : this.patientList) {
|
for (Patient patient : this.patientList) {
|
||||||
if (patient.getSurName().equals(surname)) {
|
if (patient.getSurName().equals(surname)) {
|
||||||
return patient;
|
return patient;
|
||||||
|
@ -161,17 +138,49 @@ public class AllTreatmentController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal method to get the {@link Nurse} object by its surname.
|
* Internal method to create a {@link TreatmentModalController TreatmentModal}.
|
||||||
*
|
*
|
||||||
* @see AllTreatmentController#handleNewTreatment
|
* @param treatment The {@link Treatment} which should be edited. Set null to create a new one.
|
||||||
|
* @param title The Title of the created modal.
|
||||||
|
* @param patient The {@link Patient} whose {@link Treatment} this is.
|
||||||
*/
|
*/
|
||||||
private Nurse searchInNurseList(String surname) {
|
public void treatmentWindow(Treatment treatment, String title, Patient patient) {
|
||||||
for (Nurse nurse : this.nurseList) {
|
try {
|
||||||
if (nurse.getSurName().equals(surname)) {
|
FXMLLoader loader = new FXMLLoader(
|
||||||
return nurse;
|
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
||||||
}
|
);
|
||||||
|
BorderPane pane = loader.load();
|
||||||
|
Scene scene = new Scene(pane);
|
||||||
|
Stage stage = new Stage();
|
||||||
|
|
||||||
|
TreatmentModalController controller = loader.getController();
|
||||||
|
controller.initialize(
|
||||||
|
this,
|
||||||
|
stage,
|
||||||
|
treatment,
|
||||||
|
patient
|
||||||
|
);
|
||||||
|
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.setTitle(title);
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
|
stage.showAndWait();
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to create a new {@link Treatment}.
|
||||||
|
*/
|
||||||
|
protected void createTreatment(Treatment treatment) {
|
||||||
|
TreatmentDao dao = DaoFactory.getInstance().createTreatmentDao();
|
||||||
|
try {
|
||||||
|
dao.create(treatment);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,20 +195,8 @@ public class AllTreatmentController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to create a new {@link Treatment}.
|
|
||||||
*/
|
|
||||||
public void createTreatment(Treatment treatment) {
|
|
||||||
TreatmentDao dao = DaoFactory.getInstance().createTreatmentDao();
|
|
||||||
try {
|
|
||||||
dao.create(treatment);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleComboBoxPatient() {
|
public void handleComboBox() {
|
||||||
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
||||||
this.treatments.clear();
|
this.treatments.clear();
|
||||||
this.dao = DaoFactory.getInstance().createTreatmentDao();
|
this.dao = DaoFactory.getInstance().createTreatmentDao();
|
||||||
|
@ -212,51 +209,16 @@ public class AllTreatmentController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Patient patient = searchInPatientList(selectedPatient);
|
Patient patient = searchInList(selectedPatient);
|
||||||
if (patient != null) {
|
if (patient != null) {
|
||||||
try {
|
try {
|
||||||
this.treatments.setAll(this.dao.readTreatmentsByPatient(patient.getId()));
|
this.treatments.setAll(this.dao.readTreatmentsByPid(patient.getId()));
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal method to create a {@link TreatmentModalController TreatmentModal}.
|
|
||||||
*
|
|
||||||
* @param treatment The {@link Treatment} which should be edited. Set null to create a new one.
|
|
||||||
* @param title The Title of the created modal.
|
|
||||||
* @param patient The {@link Patient} whose {@link Treatment} this is.
|
|
||||||
* @param nurse The {@link Nurse} who did the {@link Treatment}.
|
|
||||||
*/
|
|
||||||
public void treatmentWindow(Treatment treatment, String title, Patient patient, Nurse nurse) {
|
|
||||||
try {
|
|
||||||
FXMLLoader loader = new FXMLLoader(
|
|
||||||
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
|
||||||
);
|
|
||||||
BorderPane pane = loader.load();
|
|
||||||
Scene scene = new Scene(pane);
|
|
||||||
Stage stage = new Stage();
|
|
||||||
|
|
||||||
TreatmentModalController controller = loader.getController();
|
|
||||||
controller.initialize(
|
|
||||||
this,
|
|
||||||
stage,
|
|
||||||
treatment,
|
|
||||||
patient,
|
|
||||||
nurse
|
|
||||||
);
|
|
||||||
|
|
||||||
stage.setScene(scene);
|
|
||||||
stage.setTitle(title);
|
|
||||||
stage.setResizable(true);
|
|
||||||
stage.setAlwaysOnTop(true);
|
|
||||||
stage.showAndWait();
|
|
||||||
} catch (IOException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleDelete() {
|
public void handleDelete() {
|
||||||
|
@ -272,31 +234,17 @@ public class AllTreatmentController {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void handleNewTreatment() {
|
public void handleNewTreatment() {
|
||||||
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
try {
|
||||||
Patient patient = searchInPatientList(selectedPatient);
|
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
|
||||||
|
Patient patient = searchInList(selectedPatient);
|
||||||
if(patient == null) {
|
treatmentWindow(null, "NHPlus - Neue Behandlung", patient);
|
||||||
|
} catch (NullPointerException exception) {
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||||
alert.setTitle("Information");
|
alert.setTitle("Information");
|
||||||
alert.setHeaderText("Patient für die Behandlung fehlt!");
|
alert.setHeaderText("Patient für die Behandlung fehlt!");
|
||||||
alert.setContentText("Wählen Sie über die Combobox einen Patienten aus!");
|
alert.setContentText("Wählen Sie über die Combobox einen Patienten aus!");
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String selectedNurse = this.comboBoxNurseSelection.getSelectionModel().getSelectedItem();
|
|
||||||
Nurse nurse = searchInNurseList(selectedNurse);
|
|
||||||
|
|
||||||
if(nurse == null) {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Information");
|
|
||||||
alert.setHeaderText("Pfleger für die Behandlung fehlt!");
|
|
||||||
alert.setContentText("Wählen Sie über die Combobox einen Pfleger aus!");
|
|
||||||
alert.showAndWait();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
treatmentWindow(null, "NHPlus - Neue Behandlung", patient, nurse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -306,14 +254,18 @@ public class AllTreatmentController {
|
||||||
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null)) {
|
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null)) {
|
||||||
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
int index = this.tableView.getSelectionModel().getSelectedIndex();
|
||||||
Treatment treatment = this.treatments.get(index);
|
Treatment treatment = this.treatments.get(index);
|
||||||
treatmentWindow(
|
try {
|
||||||
treatment,
|
treatmentWindow(
|
||||||
"NHPlus - Behandlung",
|
treatment,
|
||||||
treatment.getPatient(),
|
"NHPlus - Behandlung",
|
||||||
treatment.getNurse()
|
DaoFactory.getInstance().createPatientDAO().read(
|
||||||
);
|
treatment.getPatient().getId()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.hitec.nhplus.treatment;
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
|
@ -20,7 +19,6 @@ import java.util.StringJoiner;
|
||||||
public class Treatment {
|
public class Treatment {
|
||||||
private SimpleIntegerProperty id;
|
private SimpleIntegerProperty id;
|
||||||
private final SimpleObjectProperty<Patient> patient;
|
private final SimpleObjectProperty<Patient> patient;
|
||||||
private final SimpleObjectProperty<Nurse> nurse;
|
|
||||||
private final SimpleObjectProperty<LocalDate> date;
|
private final SimpleObjectProperty<LocalDate> date;
|
||||||
private final SimpleObjectProperty<LocalTime> begin;
|
private final SimpleObjectProperty<LocalTime> begin;
|
||||||
private final SimpleObjectProperty<LocalTime> end;
|
private final SimpleObjectProperty<LocalTime> end;
|
||||||
|
@ -36,7 +34,6 @@ public class Treatment {
|
||||||
*/
|
*/
|
||||||
public Treatment(
|
public Treatment(
|
||||||
Patient patient,
|
Patient patient,
|
||||||
Nurse nurse,
|
|
||||||
LocalDate date,
|
LocalDate date,
|
||||||
LocalTime begin,
|
LocalTime begin,
|
||||||
LocalTime end,
|
LocalTime end,
|
||||||
|
@ -44,7 +41,6 @@ public class Treatment {
|
||||||
String remarks
|
String remarks
|
||||||
) {
|
) {
|
||||||
this.patient = new SimpleObjectProperty<>(patient);
|
this.patient = new SimpleObjectProperty<>(patient);
|
||||||
this.nurse = new SimpleObjectProperty<>(nurse);
|
|
||||||
this.date = new SimpleObjectProperty<>(date);
|
this.date = new SimpleObjectProperty<>(date);
|
||||||
this.begin = new SimpleObjectProperty<>(begin);
|
this.begin = new SimpleObjectProperty<>(begin);
|
||||||
this.end = new SimpleObjectProperty<>(end);
|
this.end = new SimpleObjectProperty<>(end);
|
||||||
|
@ -58,7 +54,6 @@ public class Treatment {
|
||||||
public Treatment(
|
public Treatment(
|
||||||
int id,
|
int id,
|
||||||
Patient patient,
|
Patient patient,
|
||||||
Nurse nurse,
|
|
||||||
LocalDate date,
|
LocalDate date,
|
||||||
LocalTime begin,
|
LocalTime begin,
|
||||||
LocalTime end,
|
LocalTime end,
|
||||||
|
@ -67,7 +62,6 @@ public class Treatment {
|
||||||
) {
|
) {
|
||||||
this.id = new SimpleIntegerProperty(id);
|
this.id = new SimpleIntegerProperty(id);
|
||||||
this.patient = new SimpleObjectProperty<>(patient);
|
this.patient = new SimpleObjectProperty<>(patient);
|
||||||
this.nurse = new SimpleObjectProperty<>(nurse);
|
|
||||||
this.date = new SimpleObjectProperty<>(date);
|
this.date = new SimpleObjectProperty<>(date);
|
||||||
this.begin = new SimpleObjectProperty<>(begin);
|
this.begin = new SimpleObjectProperty<>(begin);
|
||||||
this.end = new SimpleObjectProperty<>(end);
|
this.end = new SimpleObjectProperty<>(end);
|
||||||
|
@ -83,10 +77,6 @@ public class Treatment {
|
||||||
return patient.getValue();
|
return patient.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Nurse getNurse() {
|
|
||||||
return nurse.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDate() {
|
public String getDate() {
|
||||||
return date.getValue().toString();
|
return date.getValue().toString();
|
||||||
}
|
}
|
||||||
|
@ -127,10 +117,6 @@ public class Treatment {
|
||||||
return patient;
|
return patient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleObjectProperty<Nurse> nurseProperty() {
|
|
||||||
return nurse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleObjectProperty<LocalDate> dateProperty() {
|
public SimpleObjectProperty<LocalDate> dateProperty() {
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +146,6 @@ public class Treatment {
|
||||||
.add("TREATMENT")
|
.add("TREATMENT")
|
||||||
.add("ID: " + this.getId())
|
.add("ID: " + this.getId())
|
||||||
.add("Patient: " + this.getPatient().getSurName() + ", " + this.getPatient().getFirstName())
|
.add("Patient: " + this.getPatient().getSurName() + ", " + this.getPatient().getFirstName())
|
||||||
.add("Nurse: " + this.getNurse().getSurName() + ", " + this.getNurse().getFirstName())
|
|
||||||
.add("Date: " + this.getDate())
|
.add("Date: " + this.getDate())
|
||||||
.add("Begin: " + this.getBegin())
|
.add("Begin: " + this.getBegin())
|
||||||
.add("End: " + this.getEnd())
|
.add("End: " + this.getEnd())
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package de.hitec.nhplus.treatment;
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
|
@ -20,8 +19,6 @@ import static de.hitec.nhplus.utils.Validator.*;
|
||||||
* @author Dominik Säume
|
* @author Dominik Säume
|
||||||
*/
|
*/
|
||||||
public class TreatmentModalController {
|
public class TreatmentModalController {
|
||||||
@FXML
|
|
||||||
private Label labelNurseName;
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label labelFirstName;
|
private Label labelFirstName;
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -41,30 +38,22 @@ public class TreatmentModalController {
|
||||||
private AllTreatmentController controller;
|
private AllTreatmentController controller;
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
private Patient patient;
|
private Patient patient;
|
||||||
private Nurse nurse;
|
|
||||||
private Treatment treatment;
|
private Treatment treatment;
|
||||||
private boolean isNewTreatment = false;
|
private boolean isNewTreatment = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization method that is called after the binding of all the fields.
|
* Initialization method that is called after the binding of all the fields.
|
||||||
*/
|
*/
|
||||||
public void initialize(
|
@FXML
|
||||||
AllTreatmentController controller,
|
public void initialize(AllTreatmentController controller, Stage stage, Treatment treatment, Patient patient) {
|
||||||
Stage stage,
|
|
||||||
Treatment treatment,
|
|
||||||
Patient patient,
|
|
||||||
Nurse nurse
|
|
||||||
) {
|
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
this.patient = patient;
|
this.patient = patient;
|
||||||
this.nurse = nurse;
|
|
||||||
if (treatment == null) {
|
if (treatment == null) {
|
||||||
isNewTreatment = true;
|
isNewTreatment = true;
|
||||||
LocalTime currentTime = LocalTime.now();
|
LocalTime currentTime = LocalTime.now();
|
||||||
this.treatment = new Treatment(
|
this.treatment = new Treatment(
|
||||||
patient,
|
patient,
|
||||||
nurse,
|
|
||||||
LocalDate.now(),
|
LocalDate.now(),
|
||||||
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
|
@ -80,16 +69,16 @@ public class TreatmentModalController {
|
||||||
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
||||||
{
|
{
|
||||||
boolean isValid = isValidDate(this.datePicker.getValue())
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
&& isValidDescription(this.textFieldDescription.getText());
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
this.buttonSave.setDisable(!isValid);
|
this.buttonSave.setDisable(!isValid);
|
||||||
};
|
};
|
||||||
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
|
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
|
||||||
{
|
{
|
||||||
boolean isValid = isValidDate(this.datePicker.getValue())
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
&& isValidDescription(this.textFieldDescription.getText());
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
this.buttonSave.setDisable(!isValid);
|
this.buttonSave.setDisable(!isValid);
|
||||||
};
|
};
|
||||||
|
@ -116,12 +105,10 @@ public class TreatmentModalController {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal method to show the data in the view.
|
* Internal method to show the data in the view.
|
||||||
*/
|
*/
|
||||||
private void showData() {
|
private void showData() {
|
||||||
this.labelNurseName.setText(nurse.getSurName());
|
|
||||||
this.labelFirstName.setText(patient.getFirstName());
|
this.labelFirstName.setText(patient.getFirstName());
|
||||||
this.labelSurName.setText(patient.getSurName());
|
this.labelSurName.setText(patient.getSurName());
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
||||||
|
|
|
@ -3,7 +3,6 @@ package de.hitec.nhplus.treatment.database;
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||||
import de.hitec.nhplus.datastorage.DaoImp;
|
import de.hitec.nhplus.datastorage.DaoImp;
|
||||||
import de.hitec.nhplus.patient.Patient;
|
import de.hitec.nhplus.patient.Patient;
|
||||||
import de.hitec.nhplus.nurse.Nurse;
|
|
||||||
import de.hitec.nhplus.treatment.Treatment;
|
import de.hitec.nhplus.treatment.Treatment;
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
|
||||||
|
@ -31,17 +30,16 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
protected PreparedStatement getCreateStatement(Treatment treatment) throws SQLException {
|
protected PreparedStatement getCreateStatement(Treatment treatment) throws SQLException {
|
||||||
final String SQL = """
|
final String SQL = """
|
||||||
INSERT INTO treatment
|
INSERT INTO treatment
|
||||||
(patientId, nurseId, date, begin, end, description, remark)
|
(patientId, date, begin, end, description, remark)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||||
statement.setInt(1, treatment.getPatient().getId());
|
statement.setInt(1, treatment.getPatient().getId());
|
||||||
statement.setInt(2, treatment.getNurse().getId());
|
statement.setString(2, treatment.getDate());
|
||||||
statement.setString(3, treatment.getDate());
|
statement.setString(3, treatment.getBegin());
|
||||||
statement.setString(4, treatment.getBegin());
|
statement.setString(4, treatment.getEnd());
|
||||||
statement.setString(5, treatment.getEnd());
|
statement.setString(5, treatment.getDescription());
|
||||||
statement.setString(6, treatment.getDescription());
|
statement.setString(6, treatment.getRemarks());
|
||||||
statement.setString(7, treatment.getRemarks());
|
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +56,11 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
return new Treatment(
|
return new Treatment(
|
||||||
result.getInt(1),
|
result.getInt(1),
|
||||||
DaoFactory.getInstance().createPatientDAO().read(result.getInt(2)),
|
DaoFactory.getInstance().createPatientDAO().read(result.getInt(2)),
|
||||||
DaoFactory.getInstance().createNurseDAO().read(result.getInt(3)),
|
DateConverter.convertStringToLocalDate(result.getString(3)),
|
||||||
DateConverter.convertStringToLocalDate(result.getString(4)),
|
DateConverter.convertStringToLocalTime(result.getString(4)),
|
||||||
DateConverter.convertStringToLocalTime(result.getString(5)),
|
DateConverter.convertStringToLocalTime(result.getString(5)),
|
||||||
DateConverter.convertStringToLocalTime(result.getString(6)),
|
result.getString(6),
|
||||||
result.getString(7),
|
result.getString(7)
|
||||||
result.getString(8)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,25 +86,11 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
* @param patientId The {@link Patient#id ID} of the {@link Patient} whose {@link Treatment}s are to be retrieved.
|
* @param patientId The {@link Patient#id ID} of the {@link Patient} whose {@link Treatment}s are to be retrieved.
|
||||||
* @return A {@link List} of {@link Treatment} objects associated with the specified {@link Patient} ID.
|
* @return A {@link List} of {@link Treatment} objects associated with the specified {@link Patient} ID.
|
||||||
*/
|
*/
|
||||||
public List<Treatment> readTreatmentsByPatient(int patientId) throws SQLException {
|
public List<Treatment> readTreatmentsByPid(int patientId) throws SQLException {
|
||||||
final String SQL = "SELECT * FROM treatment WHERE patientId = ?";
|
final String SQL = "SELECT * FROM treatment WHERE patientId = ?";
|
||||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||||
statement.setInt(1, patientId);
|
statement.setInt(1, patientId);
|
||||||
ResultSet result = statement.executeQuery();
|
|
||||||
return getListFromResultSet(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a list of {@link Treatment}s associated with a specific
|
|
||||||
* {@link Nurse#id patient ID} from the database.
|
|
||||||
*
|
|
||||||
* @param nurseId The {@link Nurse#id ID} of the {@link Nurse} whose {@link Treatment}s are to be retrieved.
|
|
||||||
* @return A {@link List} of {@link Treatment} objects associated with the specified {@link Nurse} ID.
|
|
||||||
*/
|
|
||||||
public List<Treatment> readTreatmentsByNurse(int nurseId) throws SQLException {
|
|
||||||
final String SQL = "SELECT * FROM treatment WHERE nurseId = ?";
|
|
||||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
|
||||||
statement.setInt(1, nurseId);
|
|
||||||
ResultSet result = statement.executeQuery();
|
ResultSet result = statement.executeQuery();
|
||||||
return getListFromResultSet(result);
|
return getListFromResultSet(result);
|
||||||
}
|
}
|
||||||
|
@ -116,6 +99,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
protected PreparedStatement getUpdateStatement(Treatment treatment) throws SQLException {
|
protected PreparedStatement getUpdateStatement(Treatment treatment) throws SQLException {
|
||||||
final String SQL = """
|
final String SQL = """
|
||||||
UPDATE treatment SET
|
UPDATE treatment SET
|
||||||
|
patientId = ?,
|
||||||
date = ?,
|
date = ?,
|
||||||
begin = ?,
|
begin = ?,
|
||||||
end = ?,
|
end = ?,
|
||||||
|
@ -124,12 +108,13 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
||||||
WHERE id = ?
|
WHERE id = ?
|
||||||
""";
|
""";
|
||||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||||
statement.setString(1, treatment.getDate());
|
statement.setInt(1, treatment.getPatient().getId());
|
||||||
statement.setString(2, treatment.getBegin());
|
statement.setString(2, treatment.getDate());
|
||||||
statement.setString(3, treatment.getEnd());
|
statement.setString(3, treatment.getBegin());
|
||||||
statement.setString(4, treatment.getDescription());
|
statement.setString(4, treatment.getEnd());
|
||||||
statement.setString(5, treatment.getRemarks());
|
statement.setString(5, treatment.getDescription());
|
||||||
statement.setInt(6, treatment.getId());
|
statement.setString(6, treatment.getRemarks());
|
||||||
|
statement.setInt(7, treatment.getId());
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
minWidth="80.0"
|
minWidth="80.0"
|
||||||
text="Patient"
|
text="Patient"
|
||||||
/>
|
/>
|
||||||
<TableColumn
|
|
||||||
fx:id="columnNurseName"
|
|
||||||
minWidth="80.0"
|
|
||||||
text="Pflegekraft"
|
|
||||||
/>
|
|
||||||
<TableColumn
|
<TableColumn
|
||||||
fx:id="columnDate"
|
fx:id="columnDate"
|
||||||
maxWidth="-1.0"
|
maxWidth="-1.0"
|
||||||
|
@ -71,11 +66,7 @@
|
||||||
<ComboBox
|
<ComboBox
|
||||||
fx:id="comboBoxPatientSelection"
|
fx:id="comboBoxPatientSelection"
|
||||||
prefWidth="200.0"
|
prefWidth="200.0"
|
||||||
onAction="#handleComboBoxPatient"
|
onAction="#handleComboBox"
|
||||||
/>
|
|
||||||
<ComboBox
|
|
||||||
fx:id="comboBoxNurseSelection"
|
|
||||||
prefWidth="200.0"
|
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
mnemonicParsing="false"
|
mnemonicParsing="false"
|
||||||
|
|
|
@ -30,33 +30,21 @@
|
||||||
<Label
|
<Label
|
||||||
GridPane.rowIndex="0"
|
GridPane.rowIndex="0"
|
||||||
GridPane.columnIndex="0"
|
GridPane.columnIndex="0"
|
||||||
text="Pfleger:"
|
text="Vorname:"
|
||||||
/>
|
/>
|
||||||
<Label
|
<Label
|
||||||
GridPane.rowIndex="0"
|
GridPane.rowIndex="0"
|
||||||
GridPane.columnIndex="1"
|
GridPane.columnIndex="1"
|
||||||
prefWidth="200"
|
prefWidth="200"
|
||||||
fx:id="labelNurseName" text="Pfleger Name"
|
|
||||||
/>
|
|
||||||
<!-- Row 1 -->
|
|
||||||
<Label
|
|
||||||
GridPane.rowIndex="1"
|
|
||||||
GridPane.columnIndex="0"
|
|
||||||
text="Vorname:"
|
|
||||||
/>
|
|
||||||
<Label
|
|
||||||
GridPane.rowIndex="1"
|
|
||||||
GridPane.columnIndex="1"
|
|
||||||
prefWidth="200"
|
|
||||||
fx:id="labelFirstName" text="Vorname"
|
fx:id="labelFirstName" text="Vorname"
|
||||||
/>
|
/>
|
||||||
<Label
|
<Label
|
||||||
GridPane.rowIndex="1"
|
GridPane.rowIndex="0"
|
||||||
GridPane.columnIndex="3"
|
GridPane.columnIndex="3"
|
||||||
text="Nachname:"
|
text="Nachname:"
|
||||||
/>
|
/>
|
||||||
<Label
|
<Label
|
||||||
GridPane.rowIndex="1"
|
GridPane.rowIndex="0"
|
||||||
GridPane.columnIndex="4"
|
GridPane.columnIndex="4"
|
||||||
prefWidth="200"
|
prefWidth="200"
|
||||||
fx:id="labelSurName"
|
fx:id="labelSurName"
|
||||||
|
|
|
@ -2,12 +2,10 @@ CREATE TABLE treatment
|
||||||
(
|
(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
patientId INTEGER NOT NULL,
|
patientId INTEGER NOT NULL,
|
||||||
nurseId INTEGER NOT NULL ,
|
|
||||||
date TEXT NOT NULL,
|
date TEXT NOT NULL,
|
||||||
begin TEXT NOT NULL,
|
begin TEXT NOT NULL,
|
||||||
end TEXT NOT NULL,
|
end TEXT NOT NULL,
|
||||||
description TEXT NOT NULL,
|
description TEXT NOT NULL,
|
||||||
remark TEXT NOT NULL,
|
remark TEXT NOT NULL,
|
||||||
FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE,
|
FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE
|
||||||
FOREIGN KEY (nurseId) REFERENCES nurse (id) ON DELETE SET NULL
|
|
||||||
)
|
)
|
Loading…
Reference in a new issue