#32: Make Consistent Naming
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
parent
afe306a364
commit
1827e8caf6
20 changed files with 187 additions and 118 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="nursingHome.db" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
||||
<data-source source="LOCAL" name="Database" uuid="5a5b8be1-080b-4129-b89d-42f1ea832b90">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
|
|
35
.idea/sqlDataSources.xml
Normal file
35
.idea/sqlDataSources.xml
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DdlMappings">
|
||||
<mapping uuid="6de31afe-6f51-4d57-ac29-b95200cc6a68" name="Database Mapping">
|
||||
<data-sources db="5a5b8be1-080b-4129-b89d-42f1ea832b90" ddl="82842a6c-e549-4bc0-9743-9bdb8b472dfc" />
|
||||
<scope>
|
||||
<node negative="1">
|
||||
<node kind="database" negative="1">
|
||||
<node kind="schema" negative="1" />
|
||||
</node>
|
||||
<node kind="schema" qname="main" />
|
||||
</node>
|
||||
</scope>
|
||||
</mapping>
|
||||
</component>
|
||||
<component name="SqlDataSourceStorage">
|
||||
<option name="dataSources">
|
||||
<list>
|
||||
<State>
|
||||
<option name="id" value="82842a6c-e549-4bc0-9743-9bdb8b472dfc" />
|
||||
<option name="name" value="NHPlus DDL" />
|
||||
<option name="dbmsName" value="SQLITE" />
|
||||
<option name="urls">
|
||||
<array>
|
||||
<option value="file://$PROJECT_DIR$/src/main/resources/de/hitec/nhplus/patient/database/Patient.sql" />
|
||||
<option value="file://$PROJECT_DIR$/src/main/resources/de/hitec/nhplus/treatment/database/Treatment.sql" />
|
||||
<option value="file://$PROJECT_DIR$/src/main/resources/de/hitec/nhplus/nurse/database/Nurse.sql" />
|
||||
</array>
|
||||
</option>
|
||||
<option name="outLayout" value="File per object by schema.groovy" />
|
||||
</State>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
|
@ -4,11 +4,11 @@ import javafx.beans.property.SimpleStringProperty;
|
|||
|
||||
public abstract class Person {
|
||||
private final SimpleStringProperty firstName;
|
||||
private final SimpleStringProperty surname;
|
||||
private final SimpleStringProperty surName;
|
||||
|
||||
public Person(String firstName, String surname) {
|
||||
public Person(String firstName, String surName) {
|
||||
this.firstName = new SimpleStringProperty(firstName);
|
||||
this.surname = new SimpleStringProperty(surname);
|
||||
this.surName = new SimpleStringProperty(surName);
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
|
@ -23,15 +23,15 @@ public abstract class Person {
|
|||
this.firstName.set(firstName);
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname.get();
|
||||
public String getSurName() {
|
||||
return surName.get();
|
||||
}
|
||||
|
||||
public SimpleStringProperty surnameProperty() {
|
||||
return surname;
|
||||
public SimpleStringProperty surNameProperty() {
|
||||
return surName;
|
||||
}
|
||||
|
||||
public void setSurname(String surname) {
|
||||
this.surname.set(surname);
|
||||
public void setSurName(String surName) {
|
||||
this.surName.set(surName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ import java.sql.SQLException;
|
|||
|
||||
public class AllNurseController {
|
||||
@FXML
|
||||
public TextField textFieldSurname;
|
||||
public TextField textFieldSurName;
|
||||
@FXML
|
||||
public TextField textFieldFirstname;
|
||||
public TextField textFieldFirstName;
|
||||
@FXML
|
||||
public TextField textFieldPhoneNumber;
|
||||
@FXML
|
||||
|
@ -33,7 +33,7 @@ public class AllNurseController {
|
|||
@FXML
|
||||
private TableColumn<Nurse, String> columnFirstName;
|
||||
@FXML
|
||||
private TableColumn<Nurse, String> columnSurname;
|
||||
private TableColumn<Nurse, String> columnSurName;
|
||||
@FXML
|
||||
private TableColumn<Nurse, String> columnPhoneNumber;
|
||||
|
||||
|
@ -48,8 +48,8 @@ public class AllNurseController {
|
|||
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
||||
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname"));
|
||||
this.columnSurname.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
this.columnSurName.setCellValueFactory(new PropertyValueFactory<>("surName"));
|
||||
this.columnSurName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
|
||||
this.columnPhoneNumber.setCellValueFactory(new PropertyValueFactory<>("phoneNumber"));
|
||||
|
@ -60,15 +60,15 @@ public class AllNurseController {
|
|||
this.buttonAdd.setDisable(true);
|
||||
ChangeListener<String> inputNewNurseValidationListener = (observableValue, oldText, newText)->
|
||||
{
|
||||
boolean isValid = isValidFirstName(this.textFieldFirstname.getText())
|
||||
&& isValidSurName(this.textFieldSurname.getText())
|
||||
boolean isValid = isValidFirstName(this.textFieldFirstName.getText())
|
||||
&& isValidSurName(this.textFieldSurName.getText())
|
||||
&& isValidPhoneNumber(this.textFieldPhoneNumber.getText());
|
||||
|
||||
AllNurseController.this.buttonAdd.setDisable(!isValid);
|
||||
};
|
||||
|
||||
this.textFieldFirstname.textProperty().addListener(inputNewNurseValidationListener);
|
||||
this.textFieldSurname.textProperty().addListener(inputNewNurseValidationListener);
|
||||
this.textFieldFirstName.textProperty().addListener(inputNewNurseValidationListener);
|
||||
this.textFieldSurName.textProperty().addListener(inputNewNurseValidationListener);
|
||||
this.textFieldPhoneNumber.textProperty().addListener(inputNewNurseValidationListener);
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ public class AllNurseController {
|
|||
}
|
||||
@FXML
|
||||
public void handleAdd(){
|
||||
String surname=this.textFieldSurname.getText();
|
||||
String firstName=this.textFieldFirstname.getText();
|
||||
String surname=this.textFieldSurName.getText();
|
||||
String firstName=this.textFieldFirstName.getText();
|
||||
String phoneNumber=this.textFieldPhoneNumber.getText();
|
||||
try {
|
||||
this.dao.create(new Nurse(firstName, surname, phoneNumber));
|
||||
|
@ -97,8 +97,8 @@ public class AllNurseController {
|
|||
}
|
||||
|
||||
private void clearTextfields() {
|
||||
this.textFieldFirstname.clear();
|
||||
this.textFieldSurname.clear();
|
||||
this.textFieldFirstName.clear();
|
||||
this.textFieldSurName.clear();
|
||||
this.textFieldPhoneNumber.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@ public class Nurse extends Person {
|
|||
|
||||
public Nurse(
|
||||
String firstName,
|
||||
String surname,
|
||||
String surName,
|
||||
String phoneNumber
|
||||
) {
|
||||
super(firstName, surname);
|
||||
super(firstName, surName);
|
||||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
}
|
||||
|
||||
public Nurse(
|
||||
int id,
|
||||
String firstName,
|
||||
String surname,
|
||||
String surName,
|
||||
String phoneNumber
|
||||
) {
|
||||
super(firstName, surname);
|
||||
super(firstName, surName);
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.phoneNumber = new SimpleStringProperty(phoneNumber);
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ public class Nurse extends Person {
|
|||
return new StringJoiner(System.lineSeparator())
|
||||
.add("NURSE")
|
||||
.add("ID: " + this.getId())
|
||||
.add("Firstname: " + this.getFirstName())
|
||||
.add("Surname: " + this.getSurname())
|
||||
.add("FirstName: " + this.getFirstName())
|
||||
.add("SurName: " + this.getSurName())
|
||||
.add("PhoneNumber: " + this.getPhoneNumber())
|
||||
.toString();
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
protected PreparedStatement getCreateStatement(Nurse nurse) throws SQLException {
|
||||
final String SQL = """
|
||||
INSERT INTO nurse
|
||||
(firstname, surname, phoneNumber)
|
||||
(firstName, surName, phoneNumber)
|
||||
VALUES (?, ?, ?)
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
statement.setString(1, nurse.getFirstName());
|
||||
statement.setString(2, nurse.getSurname());
|
||||
statement.setString(2, nurse.getSurName());
|
||||
statement.setString(3, nurse.getPhoneNumber());
|
||||
return statement;
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ public class NurseDao extends DaoImp<Nurse> {
|
|||
protected PreparedStatement getUpdateStatement(Nurse nurse) throws SQLException {
|
||||
final String SQL = """
|
||||
UPDATE nurse SET
|
||||
firstname = ?,
|
||||
surname = ?,
|
||||
firstName = ?,
|
||||
surName = ?,
|
||||
phoneNumber = ?
|
||||
WHERE id = ?
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
statement.setString(1, nurse.getFirstName());
|
||||
statement.setString(2, nurse.getSurname());
|
||||
statement.setString(2, nurse.getSurName());
|
||||
statement.setString(3, nurse.getPhoneNumber());
|
||||
statement.setInt(4, nurse.getId());
|
||||
return statement;
|
||||
|
|
|
@ -28,7 +28,7 @@ public class AllPatientController {
|
|||
@FXML
|
||||
private TableColumn<Patient, String> columnFirstName;
|
||||
@FXML
|
||||
private TableColumn<Patient, String> columnSurname;
|
||||
private TableColumn<Patient, String> columnSurName;
|
||||
@FXML
|
||||
private TableColumn<Patient, String> columnDateOfBirth;
|
||||
@FXML
|
||||
|
@ -40,7 +40,7 @@ public class AllPatientController {
|
|||
@FXML
|
||||
private Button buttonAdd;
|
||||
@FXML
|
||||
private TextField textFieldSurname;
|
||||
private TextField textFieldSurName;
|
||||
@FXML
|
||||
private TextField textFieldFirstName;
|
||||
@FXML
|
||||
|
@ -61,8 +61,8 @@ public class AllPatientController {
|
|||
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
|
||||
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname"));
|
||||
this.columnSurname.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
this.columnSurName.setCellValueFactory(new PropertyValueFactory<>("surName"));
|
||||
this.columnSurName.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
||||
this.columnDateOfBirth.setCellValueFactory(new PropertyValueFactory<>("dateOfBirth"));
|
||||
this.columnDateOfBirth.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||
|
@ -89,7 +89,7 @@ public class AllPatientController {
|
|||
{
|
||||
boolean isValid = isValidDate(this.textFieldDateOfBirth.getText())
|
||||
&& isValidFirstName(this.textFieldFirstName.getText())
|
||||
&& isValidSurName(this.textFieldSurname.getText())
|
||||
&& isValidSurName(this.textFieldSurName.getText())
|
||||
&& isValidDate(this.textFieldDateOfBirth.getText())
|
||||
&& isValidCareLevel(this.textFieldCareLevel.getText())
|
||||
&& isValidRoomNumber(textFieldRoomNumber.getText());
|
||||
|
@ -97,7 +97,7 @@ public class AllPatientController {
|
|||
AllPatientController.this.buttonAdd.setDisable(!isValid);
|
||||
};
|
||||
|
||||
this.textFieldSurname.textProperty().addListener(inputNewPatientValidationListener);
|
||||
this.textFieldSurName.textProperty().addListener(inputNewPatientValidationListener);
|
||||
this.textFieldFirstName.textProperty().addListener(inputNewPatientValidationListener);
|
||||
this.textFieldDateOfBirth.textProperty().addListener(inputNewPatientValidationListener);
|
||||
this.textFieldCareLevel.textProperty().addListener(inputNewPatientValidationListener);
|
||||
|
@ -124,7 +124,7 @@ public class AllPatientController {
|
|||
event.getTableView().refresh();
|
||||
return;
|
||||
}
|
||||
event.getRowValue().setSurname(newSurName);
|
||||
event.getRowValue().setSurName(newSurName);
|
||||
this.doUpdate(event);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ public class AllPatientController {
|
|||
|
||||
@FXML
|
||||
public void handleAdd() {
|
||||
String surname = this.textFieldSurname.getText();
|
||||
String surname = this.textFieldSurName.getText();
|
||||
String firstName = this.textFieldFirstName.getText();
|
||||
String birthday = this.textFieldDateOfBirth.getText();
|
||||
LocalDate date = DateConverter.convertStringToLocalDate(birthday);
|
||||
|
@ -215,7 +215,7 @@ public class AllPatientController {
|
|||
|
||||
private void clearTextfields() {
|
||||
this.textFieldFirstName.clear();
|
||||
this.textFieldSurname.clear();
|
||||
this.textFieldSurName.clear();
|
||||
this.textFieldDateOfBirth.clear();
|
||||
this.textFieldCareLevel.clear();
|
||||
this.textFieldRoomNumber.clear();
|
||||
|
|
|
@ -20,12 +20,12 @@ public class Patient extends Person {
|
|||
|
||||
public Patient(
|
||||
String firstName,
|
||||
String surname,
|
||||
String surName,
|
||||
LocalDate dateOfBirth,
|
||||
String careLevel,
|
||||
String roomNumber
|
||||
) {
|
||||
super(firstName, surname);
|
||||
super(firstName, surName);
|
||||
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
|
||||
this.careLevel = new SimpleStringProperty(careLevel);
|
||||
this.roomNumber = new SimpleStringProperty(roomNumber);
|
||||
|
@ -34,12 +34,12 @@ public class Patient extends Person {
|
|||
public Patient(
|
||||
int id,
|
||||
String firstName,
|
||||
String surname,
|
||||
String surName,
|
||||
LocalDate dateOfBirth,
|
||||
String careLevel,
|
||||
String roomNumber
|
||||
) {
|
||||
super(firstName, surname);
|
||||
super(firstName, surName);
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.dateOfBirth = new SimpleStringProperty(DateConverter.convertLocalDateToString(dateOfBirth));
|
||||
this.careLevel = new SimpleStringProperty(careLevel);
|
||||
|
@ -103,8 +103,8 @@ public class Patient extends Person {
|
|||
return new StringJoiner(System.lineSeparator())
|
||||
.add("PATIENT")
|
||||
.add("ID: " + this.getId())
|
||||
.add("Firstname: " + this.getFirstName())
|
||||
.add("Surname: " + this.getSurname())
|
||||
.add("FirstName: " + this.getFirstName())
|
||||
.add("SurName: " + this.getSurName())
|
||||
.add("Birthday: " + this.getDateOfBirth())
|
||||
.add("Carelevel: " + this.getCareLevel())
|
||||
.add("RoomNumber: " + this.getRoomNumber())
|
||||
|
|
|
@ -21,12 +21,12 @@ public class PatientDao extends DaoImp<Patient> {
|
|||
protected PreparedStatement getCreateStatement(Patient patient) throws SQLException {
|
||||
final String SQL = """
|
||||
INSERT INTO patient
|
||||
(firstname, surname, dateOfBirth, carelevel, roomnumber)
|
||||
(firstName, surName, dateOfBirth, careLevel, roomNumber)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
statement.setString(1, patient.getFirstName());
|
||||
statement.setString(2, patient.getSurname());
|
||||
statement.setString(2, patient.getSurName());
|
||||
statement.setString(3, patient.getDateOfBirth());
|
||||
statement.setString(4, patient.getCareLevel());
|
||||
statement.setString(5, patient.getRoomNumber());
|
||||
|
@ -71,16 +71,16 @@ public class PatientDao extends DaoImp<Patient> {
|
|||
protected PreparedStatement getUpdateStatement(Patient patient) throws SQLException {
|
||||
final String SQL = """
|
||||
UPDATE patient SET
|
||||
firstname = ?,
|
||||
surname = ?,
|
||||
firstName = ?,
|
||||
surName = ?,
|
||||
dateOfBirth = ?,
|
||||
carelevel = ?,
|
||||
roomnumber = ?,
|
||||
careLevel = ?,
|
||||
roomNumber = ?,
|
||||
WHERE id = ?
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
statement.setString(1, patient.getFirstName());
|
||||
statement.setString(2, patient.getSurname());
|
||||
statement.setString(2, patient.getSurName());
|
||||
statement.setString(3, patient.getDateOfBirth());
|
||||
statement.setString(4, patient.getCareLevel());
|
||||
statement.setString(5, patient.getRoomNumber());
|
||||
|
|
|
@ -5,6 +5,8 @@ import de.hitec.nhplus.datastorage.DaoFactory;
|
|||
import de.hitec.nhplus.patient.Patient;
|
||||
import de.hitec.nhplus.patient.database.PatientDao;
|
||||
import de.hitec.nhplus.treatment.database.TreatmentDao;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
|
@ -28,7 +30,7 @@ public class AllTreatmentController {
|
|||
private TableColumn<Treatment, Integer> columnId;
|
||||
|
||||
@FXML
|
||||
private TableColumn<Treatment, Integer> columnPatientId;
|
||||
private TableColumn<Treatment, String> columnPatientName;
|
||||
|
||||
@FXML
|
||||
private TableColumn<Treatment, String> columnDate;
|
||||
|
@ -59,7 +61,12 @@ public class AllTreatmentController {
|
|||
comboBoxPatientSelection.getSelectionModel().select(0);
|
||||
|
||||
this.columnId.setCellValueFactory(new PropertyValueFactory<>("id"));
|
||||
this.columnPatientId.setCellValueFactory(new PropertyValueFactory<>("patientId"));
|
||||
this.columnPatientName.setCellValueFactory(
|
||||
cellData -> {
|
||||
Patient patient = cellData.getValue().getPatient();
|
||||
return new SimpleStringProperty(patient.getSurName() + ", " + patient.getFirstName());
|
||||
}
|
||||
);
|
||||
this.columnDate.setCellValueFactory(new PropertyValueFactory<>("date"));
|
||||
this.columnBegin.setCellValueFactory(new PropertyValueFactory<>("begin"));
|
||||
this.columnEnd.setCellValueFactory(new PropertyValueFactory<>("end"));
|
||||
|
@ -93,7 +100,7 @@ public class AllTreatmentController {
|
|||
patientList = (ArrayList<Patient>) dao.readAll();
|
||||
this.patientSelection.add("alle");
|
||||
for (Patient patient : patientList) {
|
||||
this.patientSelection.add(patient.getSurname());
|
||||
this.patientSelection.add(patient.getSurName());
|
||||
}
|
||||
} catch (SQLException exception) {
|
||||
exception.printStackTrace();
|
||||
|
@ -127,7 +134,7 @@ public class AllTreatmentController {
|
|||
|
||||
private Patient searchInList(String surname) {
|
||||
for (Patient patient : this.patientList) {
|
||||
if (patient.getSurname().equals(surname)) {
|
||||
if (patient.getSurName().equals(surname)) {
|
||||
return patient;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,94 +2,121 @@ package de.hitec.nhplus.treatment;
|
|||
|
||||
import de.hitec.nhplus.patient.Patient;
|
||||
import de.hitec.nhplus.utils.DateConverter;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class Treatment {
|
||||
private int id;
|
||||
private final Patient patient;
|
||||
private LocalDate date;
|
||||
private LocalTime begin;
|
||||
private LocalTime end;
|
||||
private String description;
|
||||
private String remarks;
|
||||
private SimpleIntegerProperty id;
|
||||
private final SimpleObjectProperty<Patient> patient;
|
||||
private final SimpleObjectProperty<LocalDate> date;
|
||||
private final SimpleObjectProperty<LocalTime> begin;
|
||||
private final SimpleObjectProperty<LocalTime> end;
|
||||
private final SimpleStringProperty description;
|
||||
private final SimpleStringProperty remarks;
|
||||
|
||||
public Treatment(Patient patient, LocalDate date, LocalTime begin,
|
||||
LocalTime end, String description, String remarks) {
|
||||
this.patient = patient;
|
||||
this.date = date;
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
this.description = description;
|
||||
this.remarks = remarks;
|
||||
this.patient = new SimpleObjectProperty<>(patient);
|
||||
this.date = new SimpleObjectProperty<>(date);
|
||||
this.begin = new SimpleObjectProperty<>(begin);
|
||||
this.end = new SimpleObjectProperty<>(end);
|
||||
this.description = new SimpleStringProperty(description);
|
||||
this.remarks = new SimpleStringProperty(remarks);
|
||||
}
|
||||
|
||||
public Treatment(int id, Patient patient, LocalDate date, LocalTime begin,
|
||||
LocalTime end, String description, String remarks) {
|
||||
this.id = id;
|
||||
this.patient = patient;
|
||||
this.date = date;
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
this.description = description;
|
||||
this.remarks = remarks;
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.patient = new SimpleObjectProperty<>(patient);
|
||||
this.date = new SimpleObjectProperty<>(date);
|
||||
this.begin = new SimpleObjectProperty<>(begin);
|
||||
this.end = new SimpleObjectProperty<>(end);
|
||||
this.description = new SimpleStringProperty(description);
|
||||
this.remarks = new SimpleStringProperty(remarks);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
return id.getValue();
|
||||
}
|
||||
|
||||
public Patient getPatient() {
|
||||
return this.patient;
|
||||
return patient.getValue();
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date.toString();
|
||||
return date.getValue().toString();
|
||||
}
|
||||
|
||||
public String getBegin() {
|
||||
return begin.toString();
|
||||
return begin.getValue().toString();
|
||||
}
|
||||
|
||||
public String getEnd() {
|
||||
return end.toString();
|
||||
return end.getValue().toString();
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = DateConverter.convertStringToLocalDate(date);
|
||||
this.date.set(DateConverter.convertStringToLocalDate(date));
|
||||
}
|
||||
|
||||
public void setBegin(LocalTime begin) {
|
||||
this.begin = begin;
|
||||
this.begin.set(begin);
|
||||
}
|
||||
|
||||
public void setEnd(LocalTime end) {
|
||||
this.end = end;
|
||||
this.end.set(end);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
return description.getValue();
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
this.description.set(description);
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks.getValue();
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<Patient> patientProperty() {
|
||||
return patient;
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<LocalDate> dateProperty() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<LocalTime> beginProperty() {
|
||||
return begin;
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<LocalTime> endProperty() {
|
||||
return end;
|
||||
}
|
||||
|
||||
public SimpleStringProperty descriptionProperty() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public SimpleStringProperty remarksProperty() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
this.remarks.set(remarks);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringJoiner(System.lineSeparator())
|
||||
.add("TREATMENT")
|
||||
.add("ID: " + this.getId())
|
||||
.add("Patient: " + this.getPatient().getSurname() + " " + this.getPatient().getFirstName())
|
||||
.add("Patient: " + this.getPatient().getSurName() + " " + this.getPatient().getFirstName())
|
||||
.add("Date: " + this.getDate())
|
||||
.add("Begin: " + this.getBegin())
|
||||
.add("End: " + this.getEnd())
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TreatmentModalController {
|
|||
|
||||
private void showData() {
|
||||
this.labelFirstName.setText(patient.getFirstName());
|
||||
this.labelSurname.setText(patient.getSurname());
|
||||
this.labelSurname.setText(patient.getSurName());
|
||||
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
||||
this.datePicker.setValue(date);
|
||||
this.textFieldBegin.setText(this.treatment.getBegin());
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
protected PreparedStatement getCreateStatement(Treatment treatment) throws SQLException {
|
||||
final String SQL = """
|
||||
INSERT INTO treatment
|
||||
(patientId, treatment_date, begin, end, description, remark)
|
||||
(patientId, date, begin, end, description, remark)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
|
@ -88,7 +88,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
final String SQL = """
|
||||
UPDATE treatment SET
|
||||
patientId = ?,
|
||||
treatment_date = ?,
|
||||
date = ?,
|
||||
begin = ?,
|
||||
end = ?,
|
||||
description = ?,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
text="ID"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnSurname"
|
||||
fx:id="columnSurName"
|
||||
minWidth="140.0"
|
||||
text="Nachname"
|
||||
/>
|
||||
|
@ -51,12 +51,12 @@
|
|||
<Insets right="8.0"/>
|
||||
</padding>
|
||||
<TextField
|
||||
fx:id="textFieldSurname"
|
||||
fx:id="textFieldSurName"
|
||||
prefWidth="200.0"
|
||||
promptText="Nachname"
|
||||
/>
|
||||
<TextField
|
||||
fx:id="textFieldFirstname"
|
||||
fx:id="textFieldFirstName"
|
||||
prefWidth="200.0"
|
||||
promptText="Vorname"
|
||||
/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS nurse
|
||||
CREATE TABLE nurse
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
firstname TEXT NOT NULL,
|
||||
surname TEXT NOT NULL,
|
||||
firstName TEXT NOT NULL,
|
||||
surName TEXT NOT NULL,
|
||||
phoneNumber TEXT NOT NULL
|
||||
)
|
|
@ -23,7 +23,7 @@
|
|||
text="ID"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnSurname"
|
||||
fx:id="columnSurName"
|
||||
minWidth="140.0"
|
||||
onEditCommit="#handleOnEditSurname"
|
||||
text="Nachname"
|
||||
|
@ -90,7 +90,7 @@
|
|||
GridPane.rowIndex="0"
|
||||
GridPane.columnIndex="1"
|
||||
prefWidth="200.0"
|
||||
fx:id="textFieldSurname"
|
||||
fx:id="textFieldSurName"
|
||||
promptText="Nachname"
|
||||
/>
|
||||
<TextField
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
CREATE TABLE patient
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
firstname TEXT NOT NULL,
|
||||
surname TEXT NOT NULL,
|
||||
firstName TEXT NOT NULL,
|
||||
surName TEXT NOT NULL,
|
||||
dateOfBirth TEXT NOT NULL,
|
||||
carelevel TEXT NOT NULL,
|
||||
roomnumber TEXT NOT NULL
|
||||
careLevel TEXT NOT NULL,
|
||||
roomNumber TEXT NOT NULL
|
||||
);
|
|
@ -24,9 +24,9 @@
|
|||
text="ID"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnPatientId"
|
||||
minWidth="40.0"
|
||||
text="PatientID"
|
||||
fx:id="columnPatientName"
|
||||
minWidth="80.0"
|
||||
text="Patient"
|
||||
/>
|
||||
<TableColumn
|
||||
fx:id="columnDate"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
CREATE TABLE IF NOT EXISTS treatment
|
||||
CREATE TABLE treatment
|
||||
(
|
||||
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,
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
patientId INTEGER NOT NULL,
|
||||
date TEXT NOT NULL,
|
||||
begin TEXT NOT NULL,
|
||||
end TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
remark TEXT NOT NULL,
|
||||
FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE
|
||||
)
|
Loading…
Reference in a new issue