#24 Update model
This commit is contained in:
parent
700aba10b7
commit
bb63343c2f
5 changed files with 72 additions and 17 deletions
Binary file not shown.
|
@ -67,7 +67,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
"Gespräch",
|
||||
"Der Patient hat enorme Angstgefühle und glaubt, er sei überfallen worden."
|
||||
+ "Ihm seien alle Wertsachen gestohlen worden."
|
||||
+ "Patient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind."
|
||||
+ "Patient beruhigt sich erst, als alle Wertsachen im Zimmer gefunden worden sind.",
|
||||
false
|
||||
));
|
||||
treatments.add(new Treatment(
|
||||
2,
|
||||
|
@ -79,7 +80,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
"Gespräch",
|
||||
"Patient irrt auf der Suche nach gestohlenen Wertsachen durch die Etage "
|
||||
+ "und bezichtigt andere Bewohner des Diebstahls."
|
||||
+ "Patient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel."
|
||||
+ "Patient wird in seinen Raum zurückbegleitet und erhält Beruhigungsmittel.",
|
||||
false
|
||||
));
|
||||
treatments.add(new Treatment(
|
||||
3,
|
||||
|
@ -89,7 +91,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("07:30"),
|
||||
convertStringToLocalTime("08:00"),
|
||||
"Waschen",
|
||||
"Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet."
|
||||
"Patient mit Waschlappen gewaschen und frisch angezogen. Patient gewendet.",
|
||||
false
|
||||
));
|
||||
treatments.add(new Treatment(
|
||||
4,
|
||||
|
@ -99,7 +102,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("15:10"),
|
||||
convertStringToLocalTime("16:00"),
|
||||
"Spaziergang",
|
||||
"Spaziergang im Park, Patient döst im Rollstuhl ein")
|
||||
"Spaziergang im Park, Patient döst im Rollstuhl ein",
|
||||
false)
|
||||
);
|
||||
treatments.add(new Treatment(
|
||||
8,
|
||||
|
@ -109,7 +113,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("15:00"),
|
||||
convertStringToLocalTime("16:00"),
|
||||
"Spaziergang",
|
||||
"Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter")
|
||||
"Parkspaziergang; Patient ist heute lebhafter und hat klare Momente; erzählt von seiner Tochter",
|
||||
false)
|
||||
);
|
||||
treatments.add(new Treatment(
|
||||
9,
|
||||
|
@ -119,7 +124,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("11:00"),
|
||||
convertStringToLocalTime("11:30"),
|
||||
"Waschen",
|
||||
"Waschen per Dusche auf einem Stuhl; Patientin gewendet;")
|
||||
"Waschen per Dusche auf einem Stuhl; Patientin gewendet;",
|
||||
false)
|
||||
);
|
||||
treatments.add(new Treatment(
|
||||
12,
|
||||
|
@ -129,7 +135,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("15:00"),
|
||||
convertStringToLocalTime("15:30"),
|
||||
"Physiotherapie",
|
||||
"Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur")
|
||||
"Übungen zur Stabilisation und Mobilisierung der Rückenmuskulatur",
|
||||
false)
|
||||
);
|
||||
treatments.add(new Treatment(
|
||||
14,
|
||||
|
@ -139,7 +146,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("09:30"),
|
||||
convertStringToLocalTime("10:15"),
|
||||
"KG",
|
||||
"Lympfdrainage"));
|
||||
"Lympfdrainage",
|
||||
false));
|
||||
treatments.add(new Treatment(
|
||||
16,
|
||||
elisabeth,
|
||||
|
@ -148,7 +156,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("13:30"),
|
||||
convertStringToLocalTime("13:45"),
|
||||
"Toilettengang",
|
||||
"Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast")
|
||||
"Hilfe beim Toilettengang; Patientin klagt über Schmerzen beim Stuhlgang. Gabe von Iberogast",
|
||||
false)
|
||||
);
|
||||
treatments.add(new Treatment(
|
||||
17,
|
||||
|
@ -158,7 +167,8 @@ public class TreatmentFixture implements Fixture<Treatment> {
|
|||
convertStringToLocalTime("16:00"),
|
||||
convertStringToLocalTime("17:00"),
|
||||
"KG",
|
||||
"Massage der Extremitäten zur Verbesserung der Durchblutung")
|
||||
"Massage der Extremitäten zur Verbesserung der Durchblutung",
|
||||
true)
|
||||
);
|
||||
|
||||
TreatmentDao dao = DaoFactory.getInstance().createTreatmentDao();
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package de.hitec.nhplus.treatment;
|
||||
|
||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
||||
import de.hitec.nhplus.nurse.Nurse;
|
||||
import de.hitec.nhplus.patient.Patient;
|
||||
import de.hitec.nhplus.utils.DateConverter;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
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.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +19,8 @@ import java.util.StringJoiner;
|
|||
*
|
||||
* @author Bernd Heidemann
|
||||
* @author Dominik Säume
|
||||
* @author Armin Ribic
|
||||
* @author Dorian Nemec
|
||||
*/
|
||||
public class Treatment {
|
||||
private SimpleIntegerProperty id;
|
||||
|
@ -26,6 +31,8 @@ public class Treatment {
|
|||
private final SimpleObjectProperty<LocalTime> end;
|
||||
private final SimpleStringProperty description;
|
||||
private final SimpleStringProperty remarks;
|
||||
private final SimpleBooleanProperty locked;
|
||||
private final int sperrfrist = 10;
|
||||
|
||||
/**
|
||||
* This constructor allows instantiating a {@link Treatment} object,
|
||||
|
@ -50,6 +57,7 @@ public class Treatment {
|
|||
this.end = new SimpleObjectProperty<>(end);
|
||||
this.description = new SimpleStringProperty(description);
|
||||
this.remarks = new SimpleStringProperty(remarks);
|
||||
this.locked = new SimpleBooleanProperty(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +71,8 @@ public class Treatment {
|
|||
LocalTime begin,
|
||||
LocalTime end,
|
||||
String description,
|
||||
String remarks
|
||||
String remarks,
|
||||
Boolean isLocked
|
||||
) {
|
||||
this.id = new SimpleIntegerProperty(id);
|
||||
this.patient = new SimpleObjectProperty<>(patient);
|
||||
|
@ -73,6 +82,19 @@ public class Treatment {
|
|||
this.end = new SimpleObjectProperty<>(end);
|
||||
this.description = new SimpleStringProperty(description);
|
||||
this.remarks = new SimpleStringProperty(remarks);
|
||||
this.locked = new SimpleBooleanProperty(isLocked);
|
||||
}
|
||||
|
||||
public boolean isLocked() {
|
||||
return locked.get();
|
||||
}
|
||||
|
||||
public SimpleBooleanProperty lockedProperty() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
this.locked.set(locked);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
@ -168,4 +190,11 @@ public class Treatment {
|
|||
.add("Remarks: " + this.getRemarks())
|
||||
.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates delete date of treatment.
|
||||
*/
|
||||
public LocalDate calculateDeleteDate() {
|
||||
return DateConverter.convertStringToLocalDate(getDate()).plusYears(sperrfrist);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.sql.Connection;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,6 +21,8 @@ import java.util.List;
|
|||
*
|
||||
* @author Bernd Heidemannn
|
||||
* @author Dominik Säume
|
||||
* @author Armin Ribic
|
||||
* @author Dorian Nemec
|
||||
*/
|
||||
public class TreatmentDao extends DaoImp<Treatment> {
|
||||
|
||||
|
@ -31,8 +34,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
protected PreparedStatement getCreateStatement(Treatment treatment) throws SQLException {
|
||||
final String SQL = """
|
||||
INSERT INTO treatment
|
||||
(patientId, nurseId, date, begin, end, description, remark)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
(patientId, nurseId, date, begin, end, description, remark, isLocked)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
statement.setInt(1, treatment.getPatient().getId());
|
||||
|
@ -42,6 +45,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
statement.setString(5, treatment.getEnd());
|
||||
statement.setString(6, treatment.getDescription());
|
||||
statement.setString(7, treatment.getRemarks());
|
||||
statement.setBoolean(8,treatment.isLocked());
|
||||
return statement;
|
||||
}
|
||||
|
||||
|
@ -63,13 +67,14 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
DateConverter.convertStringToLocalTime(result.getString(5)),
|
||||
DateConverter.convertStringToLocalTime(result.getString(6)),
|
||||
result.getString(7),
|
||||
result.getString(8)
|
||||
result.getString(8),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PreparedStatement getReadAllStatement() throws SQLException {
|
||||
final String SQL = "SELECT * FROM treatment";
|
||||
final String SQL = "SELECT * FROM treatment where isLocked = false";
|
||||
return this.connection.prepareStatement(SQL);
|
||||
}
|
||||
|
||||
|
@ -120,7 +125,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
begin = ?,
|
||||
end = ?,
|
||||
description = ?,
|
||||
remark = ?
|
||||
remark = ?,
|
||||
isLocked = ?
|
||||
WHERE id = ?
|
||||
""";
|
||||
PreparedStatement statement = this.connection.prepareStatement(SQL);
|
||||
|
@ -129,7 +135,8 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
statement.setString(3, treatment.getEnd());
|
||||
statement.setString(4, treatment.getDescription());
|
||||
statement.setString(5, treatment.getRemarks());
|
||||
statement.setInt(6, treatment.getId());
|
||||
statement.setBoolean(6,treatment.isLocked());
|
||||
statement.setInt(7, treatment.getId());
|
||||
return statement;
|
||||
}
|
||||
|
||||
|
@ -141,4 +148,12 @@ public class TreatmentDao extends DaoImp<Treatment> {
|
|||
statement.setInt(1, id);
|
||||
return statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all locked treatments.
|
||||
*/
|
||||
public List<Treatment> readAllLocked() throws SQLException {
|
||||
final String SQL = "SELECT * FROM treatment WHERE isLocked = true";
|
||||
return getListFromResultSet(this.connection.prepareStatement(SQL).executeQuery());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ CREATE TABLE treatment
|
|||
end TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
remark TEXT NOT NULL,
|
||||
isLocked BOOLEAN NOT NULL DEFAULT false,
|
||||
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