diff --git a/src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java b/src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java index 532dfbd..96af07a 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java @@ -281,6 +281,12 @@ public class DBHandler { statement.execute(); } + /** + * Gibt Liste aller Stationen aus der DB zurueck. + * + * @return Liste der Stationen + * @throws SQLException + */ public static List getAllStationen() throws SQLException { Statement statement = MySqlConnectionFactory.getConnection().createStatement(); ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); @@ -311,6 +317,13 @@ public class DBHandler { return station; } + /** + * Gibt besondere Eintraege fuer die Stationsubersicht nach Station zurueck. + * + * @param station Station + * @return Liste der Eintraege auf der Station. + * @throws SQLException + */ public static List getStationsUebersichtsItems(String station) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION); statement.setString(1, station); @@ -339,6 +352,13 @@ public class DBHandler { return item; } + /** + * Gibt die Stationshistorie zu einem Fall aus. + * + * @param fall Fall + * @return Liste der StationsHistorie Eintraege. + * @throws SQLException + */ public static List getStationsHistorieByFall(Fall fall) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID); statement.setInt(1, fall.getFallID()); @@ -352,6 +372,13 @@ public class DBHandler { return historie; } + /** + * Erstellt bzw. aktuallisiert einen Eintrag in die Stationshistorie. + * + * @param hist StationsHistorie Objekt + * @param isUpdate true wenn Update. + * @throws SQLException + */ public static void setStationsHistorie(StationsHistorie hist, boolean isUpdate) throws SQLException { PreparedStatement statement; if (isUpdate) { @@ -383,12 +410,25 @@ public class DBHandler { } } + /** + * Entfernt einen StationsHistorie Eintrag aus der Datenbank. + * + * @param hist Zu entfernendes StationsHistorie Objekt + * @throws SQLException + */ public static void delStationsHistorie(StationsHistorie hist) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(DELETE_STATHIST); statement.setInt(1, hist.getStatHistID()); statement.execute(); } + /** + * Gibt einzelnes StationsHistorie Objekt aus einem ResultSet zurueck. + * + * @param rs DB Query Result + * @return StationsHistorie + * @throws SQLException + */ private static StationsHistorie getStationsHistorie(ResultSet rs) throws SQLException { StationsHistorie hist = new StationsHistorie(); @@ -404,6 +444,13 @@ public class DBHandler { return hist; } + /** + * Gibt alle Faelle eines Patienten zuruck. + * + * @param id Patienten ID + * @return Liste aller Faelle. + * @throws SQLException + */ public static List getFaelleByPatID(int id) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); statement.setInt(1, id); @@ -574,6 +621,12 @@ public class DBHandler { } } + /** + * Gibt alle in der DB hinterlegten ICD10 Codes zurueck. + * + * @return Liste aller ICD10 Codes. + * @throws SQLException + */ public static List getAllIcd10Codes() throws SQLException { Statement statement = MySqlConnectionFactory.getConnection().createStatement(); ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); @@ -612,6 +665,12 @@ public class DBHandler { return new Icd10Code(code, text, version); } + /** + * Gibt alle in der Datanbank hinterlegten OPS Codes zurueck. + * + * @return Liste der OPS Codes. + * @throws SQLException + */ public static List getAllOpsCodes() throws SQLException { Statement statement = MySqlConnectionFactory.getConnection().createStatement(); ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); @@ -650,6 +709,12 @@ public class DBHandler { return new OpsCode(code, text, version); } + /** + * Gibt Liste der Mitarbeiter aus der DB zurueck. + * + * @return Liste der Mitarbeiter. + * @throws SQLException + */ public static List getAllMitarbeiter() throws SQLException { Statement statement = MySqlConnectionFactory.getConnection().createStatement(); ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); @@ -753,6 +818,13 @@ public class DBHandler { statement.execute(); } + /** + * Gibt alle Diagnosen zu einem Fall zurueck. + * + * @param fall Fall + * @return Liste der Diagnosen. + * @throws SQLException + */ public static List getDiagnosenByFall(Fall fall) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); statement.setInt(1, fall.getFallID()); @@ -766,6 +838,12 @@ public class DBHandler { return diagnosen; } + /** + * Gibt Liste der hinterlegten Kassen zurueck. + * + * @return Liste der hinterlegten Kassen + * @throws SQLException + */ public static List getAllKassen() throws SQLException { Statement statement = MySqlConnectionFactory.getConnection().createStatement(); ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); @@ -804,6 +882,12 @@ public class DBHandler { return kasse; } + /** + * Speichert Diagnose in die Datenbank. + * + * @param diagnose Diagnose + * @throws SQLException + */ public static void setDiagnose(Diagnose diagnose) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_DIAGNOSE); statement.setInt(1, diagnose.getArzt().getMitarbID()); // `Arzt` @@ -817,6 +901,14 @@ public class DBHandler { statement.execute(); } + /** + * Speichert eine raw HL7 Nachricht in die DB. + * + * @param hl7msg raw HL7 Nachricht + * @param timestamp LocalDateTime + * @param source Source bzw. Destination + * @throws SQLException + */ public static void setHL7Nachricht(String hl7msg, LocalDateTime timestamp, String source) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT); statement.setString(1, hl7msg); @@ -825,10 +917,23 @@ public class DBHandler { statement.execute(); } + /** + * Gibt die letzten 30 HL7 Logeintraege aus der DB zurueck. + * + * @return + * @throws SQLException + */ public static List getLastHL7LogEntries() throws SQLException { return getLastHL7LogEntries(30); } + /** + * Gibt die angegebene Anzahl HL7 Logeintraege aus der DB zurueck. + * + * @param last Anzahl Eintraege + * @return Liste mit HL7LogEntries zurueck. + * @throws SQLException + */ public static List getLastHL7LogEntries(int last) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_LAST_HL7ENTRIES); statement.setInt(1, last); @@ -841,6 +946,12 @@ public class DBHandler { return hl7entries; } + /** + * Speichert eine HL7 Nachricht in der hl7 Log Tabelle. + * + * @param entry HL7 Nachricht + * @throws SQLException + */ public static void setHL7LogEntry(HL7LogEntry entry) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT_); statement.setString(1, entry.getMessage()); @@ -859,6 +970,13 @@ public class DBHandler { return entry; } + /** + * Gibt alle FallIDs eines Patienten zurueck. + * + * @param patid Patienten ID + * @return Liste aller FallIDs + * @throws SQLException + */ public static List getAlleFallIdsByPatID(int patid) throws SQLException { PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FALLIDS_BY_PATID); statement.setInt(1, patid);