|
|
@@ -506,12 +506,12 @@ public class DBHandler { |
|
|
* @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. |
|
|
* @param isUpdate {@code true} wenn der Datensatz bereits existiert, sonst {@code false}. |
|
|
* @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. |
|
|
* @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. |
|
|
*/ |
|
|
*/ |
|
|
public static void setFall(Fall fall, int mitarbid, boolean isUpdate) throws SQLException { |
|
|
|
|
|
|
|
|
public static int setFall(Fall fall, int mitarbid, boolean isUpdate) throws SQLException { |
|
|
PreparedStatement statement; |
|
|
PreparedStatement statement; |
|
|
if (isUpdate) { |
|
|
if (isUpdate) { |
|
|
statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_FALL); |
|
|
statement = MySqlConnectionFactory.getConnection().prepareStatement(UPDATE_FALL); |
|
|
} else { |
|
|
} else { |
|
|
statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_FALL); |
|
|
|
|
|
|
|
|
statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_FALL, Statement.RETURN_GENERATED_KEYS); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (fall.getAufnahmeDatum() != null) { |
|
|
if (fall.getAufnahmeDatum() != null) { |
|
|
@@ -562,6 +562,16 @@ public class DBHandler { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
statement.execute(); |
|
|
statement.execute(); |
|
|
|
|
|
|
|
|
|
|
|
if (!isUpdate) { |
|
|
|
|
|
ResultSet genkeys = statement.getGeneratedKeys(); |
|
|
|
|
|
while (genkeys.next()) { |
|
|
|
|
|
return genkeys.getInt(1); |
|
|
|
|
|
} |
|
|
|
|
|
return -1; // Sollte nie vorkommen. |
|
|
|
|
|
} else { |
|
|
|
|
|
return fall.getFallID(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@@ -571,8 +581,8 @@ public class DBHandler { |
|
|
* @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. |
|
|
* @param mitarbid {@link Mitarbeiter#mitarbID} des aktuellen Benutzers/Mitarbeiters. |
|
|
* @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. |
|
|
* @throws SQLException wenn Fehler bei der SQL Verarbeitung auftreten. |
|
|
*/ |
|
|
*/ |
|
|
public static void setFall(Fall fall, int mitarbid) throws SQLException { |
|
|
|
|
|
setFall(fall, mitarbid, false); |
|
|
|
|
|
|
|
|
public static int setFall(Fall fall, int mitarbid) throws SQLException { |
|
|
|
|
|
return setFall(fall, mitarbid, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static Diagnose getDiagnose(int diagid, Fall fall) throws SQLException { |
|
|
private static Diagnose getDiagnose(int diagid, Fall fall) throws SQLException { |
|
|
|