|
|
|
@@ -8,6 +8,7 @@ import java.sql.SQLException; |
|
|
|
import java.sql.Statement; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.StringJoiner; |
|
|
|
|
|
|
|
/** |
|
|
|
* Created by nils on 15.11.2015. |
|
|
|
@@ -29,6 +30,7 @@ public class DBHandler { |
|
|
|
private static final String SELECT_ALL_MITARBEITER = "SELECT * FROM `mitarbeiter`"; |
|
|
|
private static final String SELECT_UNTERS_BY_FALLID = "SELECT * FROM `untersuchung` WHERE `fallid` = ?"; |
|
|
|
private static final String SELECT_MITARBEITER_BY_ID = "SELECT * FROM `mitarbeiter` WHERE `mitarbid` = ?"; |
|
|
|
private static final String SELECT_DIAGNOSE_BY_FALLID = "SELECT * FROM `diagnose` WHERE `fallid` = ?"; |
|
|
|
|
|
|
|
public static List<Patient> getAllPatients() throws SQLException { |
|
|
|
Statement statement = MySqlConnFactory.getConnection().createStatement(); |
|
|
|
@@ -71,11 +73,25 @@ public class DBHandler { |
|
|
|
return patient; |
|
|
|
} |
|
|
|
|
|
|
|
public static void updatePatient(Patient patient) throws SQLException { |
|
|
|
public static void updatePatient(Patient patient, int mitarbid) throws SQLException { |
|
|
|
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_PATIENT); |
|
|
|
statement.setString(1, patient.getCave()); |
|
|
|
statement.setString(2, patient.getFamilienstand().toString()); |
|
|
|
// TODO |
|
|
|
statement.setString(1, patient.getCave()); // CAVE |
|
|
|
statement.setString(2, patient.getFamilienstand().toString()); // Familienstand |
|
|
|
statement.setString(3, ""); // Geburtsdatum |
|
|
|
statement.setString(4, patient.getGeburtsname()); // Geburtsname |
|
|
|
statement.setString(5, String.valueOf(patient.getGeschlecht().id())); // Geschlecht |
|
|
|
statement.setInt(6, patient.getKassenID()); // KasseId |
|
|
|
statement.setInt(7, mitarbid); // Letzterbearbeiter |
|
|
|
statement.setString(8, patient.getNachname()); // Nachname |
|
|
|
statement.setString(9, patient.getOrt()); // Ort |
|
|
|
statement.setString(10, patient.getPlz()); // PLZ |
|
|
|
statement.setString(11, patient.getStrasse()); // Strasse |
|
|
|
statement.setString(12, patient.getTelefon()); // telefon |
|
|
|
statement.setString(13, patient.getVersichertennummer()); // versichertennummer |
|
|
|
statement.setString(14, patient.getVorname()); // vorname |
|
|
|
|
|
|
|
statement.executeUpdate(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static List<Station> getAllStationen() throws SQLException { |
|
|
|
@@ -127,8 +143,8 @@ public class DBHandler { |
|
|
|
return fall; |
|
|
|
} |
|
|
|
|
|
|
|
private static Diagnose getDiagnose(int hauptdiagnose, Fall fall) throws SQLException { |
|
|
|
Diagnose diagnose = getDiagnose(hauptdiagnose); |
|
|
|
private static Diagnose getDiagnose(int diagid, Fall fall) throws SQLException { |
|
|
|
Diagnose diagnose = getDiagnose(diagid); |
|
|
|
diagnose.setFall(fall); |
|
|
|
|
|
|
|
return diagnose; |
|
|
|
@@ -274,4 +290,17 @@ public class DBHandler { |
|
|
|
setVersionInformation(untersuchung, rs); |
|
|
|
return untersuchung; |
|
|
|
} |
|
|
|
|
|
|
|
public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { |
|
|
|
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); |
|
|
|
statement.setInt(1, fall.getFallID()); |
|
|
|
ResultSet rs = statement.executeQuery(); |
|
|
|
|
|
|
|
List<Diagnose> diagnosen = new ArrayList<>(); |
|
|
|
while (rs.next()) { |
|
|
|
diagnosen.add(getDiagnose(rs.getInt("diagid"), fall)); |
|
|
|
} |
|
|
|
|
|
|
|
return diagnosen; |
|
|
|
} |
|
|
|
} |