NOTICKET: CLeanup ToString

Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
Dominik Säume 2024-04-29 17:28:58 +02:00 committed by Snoweuph
parent 661644df76
commit 187988c7ca
4 changed files with 31 additions and 21 deletions

View file

@ -4,6 +4,8 @@ import de.hitec.nhplus.main.Person;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import java.util.StringJoiner;
public class Nurse extends Person {
private SimpleIntegerProperty id;
private final SimpleStringProperty phoneNumber;
@ -50,11 +52,12 @@ public class Nurse extends Person {
@Override
public String toString() {
return new StringBuilder()
.append("Nurse").append(System.lineSeparator())
.append("Firstname: ").append(this.getFirstName()).append(System.lineSeparator())
.append("Surname: ").append(this.getSurname()).append(System.lineSeparator())
.append("PhoneNumber: ").append(this.getPhoneNumber()).append(System.lineSeparator())
return new StringJoiner(System.lineSeparator())
.add("NURSE")
.add("ID: " + this.getId())
.add("Firstname: " + this.getFirstName())
.add("Surname: " + this.getSurname())
.add("PhoneNumber: " + this.getPhoneNumber())
.toString();
}

View file

@ -9,6 +9,7 @@ import javafx.beans.property.SimpleStringProperty;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
public class Patient extends Person {
private SimpleIntegerProperty id;
@ -99,12 +100,14 @@ public class Patient extends Person {
}
public String toString() {
return "Patient" + "\nMNID: " + this.id +
"\nFirstname: " + this.getFirstName() +
"\nSurname: " + this.getSurname() +
"\nBirthday: " + this.dateOfBirth +
"\nCarelevel: " + this.careLevel +
"\nRoomnumber: " + this.roomNumber +
"\n";
return new StringJoiner(System.lineSeparator())
.add("PATIENT")
.add("ID: " + this.getId())
.add("Firstname: " + this.getFirstName())
.add("Surname: " + this.getSurname())
.add("Birthday: " + this.getDateOfBirth())
.add("Carelevel: " + this.getCareLevel())
.add("RoomNumber: " + this.getRoomNumber())
.toString();
}
}

View file

@ -4,6 +4,7 @@ import de.hitec.nhplus.utils.DateConverter;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.StringJoiner;
public class Treatment {
private int id;
@ -84,12 +85,15 @@ public class Treatment {
}
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";
return new StringJoiner(System.lineSeparator())
.add("TREATMENT")
.add("ID: " + this.getId())
.add("PatientID: " + this.getPatientId())
.add("Date: " + this.getDate())
.add("Begin: " + this.getBegin())
.add("End: " + this.getEnd())
.add("Description: " + this.getDescription())
.add("Remarks: " + this.getRemarks())
.toString();
}
}

View file

@ -120,7 +120,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
"end = ?, " +
"description = ?, " +
"remark = ? " +
"WHERE tid = ?";
"WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, treatment.getPatientId());
preparedStatement.setString(2, treatment.getDate());
@ -140,7 +140,7 @@ public class TreatmentDao extends DaoImp<Treatment> {
PreparedStatement preparedStatement = null;
try {
final String SQL =
"DELETE FROM treatment WHERE tid = ?";
"DELETE FROM treatment WHERE id = ?";
preparedStatement = this.connection.prepareStatement(SQL);
preparedStatement.setInt(1, id);
} catch (SQLException exception) {