| @@ -61,9 +61,23 @@ public class DBHandler { | |||
| "`Versichertennummer`," + | |||
| "`KassenID`," + | |||
| "`storniert`," + | |||
| "`Ersteller`," + | |||
| "`Letzter Bearbeiter`)" + | |||
| "`Letzter Bearbeiter`" + | |||
| "`Ersteller`)," + | |||
| "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | |||
| private static final String UPDATE_FALL = "UPDATE `fall`" + | |||
| "SET `Aufnahmedatum`=?," + | |||
| "`Entlassungsdatum`=?," + | |||
| "`Vorstelldatum`=?" + | |||
| "`EinweisenderArzt`=?," + | |||
| "Fallart=?," + | |||
| "`Selbsteinweisung`=?," + | |||
| "Hauptdiagnose=?," + | |||
| "`PatientID`=?," + | |||
| "`Versichertennummer`=?," + | |||
| "KassenID=?," + | |||
| "`storniert`=?," + | |||
| "LetzterBearbeiter=?," + | |||
| "WHERE `FallID`=?"; | |||
| private static final String SELECT_DIAGNOSE_BY_ID = "SELECT * FROM `diagnose` WHERE `diagid` = ?"; | |||
| private static final String SELECT_ALL_ICD10CODES = "SELECT * FROM `stammicd10`"; | |||
| private static final String SELECT_ALL_OPSCODES = "SELECT * FROM `stammops`"; | |||
| @@ -176,7 +190,6 @@ public class DBHandler { | |||
| System.out.println(statement.toString()); | |||
| statement.execute(); | |||
| } | |||
| public static List<Station> getAllStationen() throws SQLException { | |||
| @@ -228,7 +241,15 @@ public class DBHandler { | |||
| return fall; | |||
| } | |||
| // TODO: Mach eins aus insert und update (boolean Flag in die Methode) | |||
| // private static void setInsertFall(Fall fall, int mitarbid, boolean isUpdate) { | |||
| public static void insertFall(Fall fall, int mitarbid) throws SQLException { | |||
| /*PreparedStatement statement; | |||
| if (isUpdate) { | |||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_FALL); | |||
| } else { | |||
| statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_FALL); | |||
| }*/ | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(INSERT_FALL); | |||
| if (fall.getAufnahmeDatum() != null) | |||
| @@ -248,8 +269,35 @@ public class DBHandler { | |||
| if (fall.getKasse() != null) | |||
| statement.setInt(10, fall.getKasse().getKassenID()); // KassenID | |||
| statement.setBoolean(11, fall.getStorniert()); // storniert | |||
| statement.setInt(12, mitarbid); // Ersteller | |||
| statement.setInt(13, mitarbid); // Letzter Bearbeiter | |||
| statement.setInt(12, mitarbid); // Letzter Bearbeiter | |||
| // if (!isUpdate) | |||
| statement.setInt(13, mitarbid); // Ersteller | |||
| statement.execute(); | |||
| } | |||
| // TODO: Kann dann weg. | |||
| public static void updateFall(Fall fall, int mitarbid) throws SQLException { | |||
| PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(UPDATE_FALL); | |||
| if (fall.getAufnahmeDatum() != null) | |||
| statement.setTimestamp(1, Timestamp.valueOf(fall.getAufnahmeDatum())); // Aufnahmedatum | |||
| if (fall.getEntlassungsDatum() != null) | |||
| statement.setTimestamp(2, Timestamp.valueOf(fall.getEntlassungsDatum())); // Entlassungsdatum | |||
| if (fall.getVorstellDatum() != null) | |||
| statement.setTimestamp(3, Timestamp.valueOf(fall.getVorstellDatum())); // Vorstelldatum | |||
| if (fall.getEinweisenderArzt() != null) | |||
| statement.setInt(4, fall.getEinweisenderArzt().getMitarbID()); // EinweisenderArzt | |||
| statement.setString(5, fall.getFallArt().id()); // Fallart | |||
| statement.setBoolean(6, fall.getSelbsteinweisung()); // Selbsteinweisung | |||
| if (fall.getHauptDiagnose() != null) | |||
| statement.setInt(7, fall.getHauptDiagnose().getDiagID()); // Hauptdiagnose | |||
| statement.setInt(8, fall.getPatient().getPatID()); // PatientID | |||
| statement.setString(9, fall.getVersichertenNummer()); // Versichertennummer | |||
| if (fall.getKasse() != null) | |||
| statement.setInt(10, fall.getKasse().getKassenID()); // KassenID | |||
| statement.setBoolean(11, fall.getStorniert()); // storniert | |||
| statement.setInt(12, mitarbid); // Letzter Bearbeiter | |||
| statement.execute(); | |||
| } | |||