| @@ -281,6 +281,12 @@ public class DBHandler { | |||||
| statement.execute(); | statement.execute(); | ||||
| } | } | ||||
| /** | |||||
| * Gibt Liste aller Stationen aus der DB zurueck. | |||||
| * | |||||
| * @return Liste der Stationen | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Station> getAllStationen() throws SQLException { | public static List<Station> getAllStationen() throws SQLException { | ||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); | ResultSet rs = statement.executeQuery(SELECT_ALL_STATIONEN); | ||||
| @@ -311,6 +317,13 @@ public class DBHandler { | |||||
| return station; | 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<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException { | public static List<StationsUebersichtsItem> getStationsUebersichtsItems(String station) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATUBERITEMS_BY_STATION); | ||||
| statement.setString(1, station); | statement.setString(1, station); | ||||
| @@ -339,6 +352,13 @@ public class DBHandler { | |||||
| return item; | return item; | ||||
| } | } | ||||
| /** | |||||
| * Gibt die Stationshistorie zu einem Fall aus. | |||||
| * | |||||
| * @param fall Fall | |||||
| * @return Liste der StationsHistorie Eintraege. | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException { | public static List<StationsHistorie> getStationsHistorieByFall(Fall fall) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_STATHIST_BY_FALLID); | ||||
| statement.setInt(1, fall.getFallID()); | statement.setInt(1, fall.getFallID()); | ||||
| @@ -352,6 +372,13 @@ public class DBHandler { | |||||
| return historie; | 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 { | public static void setStationsHistorie(StationsHistorie hist, boolean isUpdate) throws SQLException { | ||||
| PreparedStatement statement; | PreparedStatement statement; | ||||
| if (isUpdate) { | 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 { | public static void delStationsHistorie(StationsHistorie hist) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(DELETE_STATHIST); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(DELETE_STATHIST); | ||||
| statement.setInt(1, hist.getStatHistID()); | statement.setInt(1, hist.getStatHistID()); | ||||
| statement.execute(); | 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 { | private static StationsHistorie getStationsHistorie(ResultSet rs) throws SQLException { | ||||
| StationsHistorie hist = new StationsHistorie(); | StationsHistorie hist = new StationsHistorie(); | ||||
| @@ -404,6 +444,13 @@ public class DBHandler { | |||||
| return hist; | return hist; | ||||
| } | } | ||||
| /** | |||||
| * Gibt alle Faelle eines Patienten zuruck. | |||||
| * | |||||
| * @param id Patienten ID | |||||
| * @return Liste aller Faelle. | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Fall> getFaelleByPatID(int id) throws SQLException { | public static List<Fall> getFaelleByPatID(int id) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FAELLE_BY_PATID); | ||||
| statement.setInt(1, id); | 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<Icd10Code> getAllIcd10Codes() throws SQLException { | public static List<Icd10Code> getAllIcd10Codes() throws SQLException { | ||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); | ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES); | ||||
| @@ -612,6 +665,12 @@ public class DBHandler { | |||||
| return new Icd10Code(code, text, version); | 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<OpsCode> getAllOpsCodes() throws SQLException { | public static List<OpsCode> getAllOpsCodes() throws SQLException { | ||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); | ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES); | ||||
| @@ -650,6 +709,12 @@ public class DBHandler { | |||||
| return new OpsCode(code, text, version); | return new OpsCode(code, text, version); | ||||
| } | } | ||||
| /** | |||||
| * Gibt Liste der Mitarbeiter aus der DB zurueck. | |||||
| * | |||||
| * @return Liste der Mitarbeiter. | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Mitarbeiter> getAllMitarbeiter() throws SQLException { | public static List<Mitarbeiter> getAllMitarbeiter() throws SQLException { | ||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); | ResultSet rs = statement.executeQuery(SELECT_ALL_MITARBEITER); | ||||
| @@ -753,6 +818,13 @@ public class DBHandler { | |||||
| statement.execute(); | statement.execute(); | ||||
| } | } | ||||
| /** | |||||
| * Gibt alle Diagnosen zu einem Fall zurueck. | |||||
| * | |||||
| * @param fall Fall | |||||
| * @return Liste der Diagnosen. | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { | public static List<Diagnose> getDiagnosenByFall(Fall fall) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_DIAGNOSE_BY_FALLID); | ||||
| statement.setInt(1, fall.getFallID()); | statement.setInt(1, fall.getFallID()); | ||||
| @@ -766,6 +838,12 @@ public class DBHandler { | |||||
| return diagnosen; | return diagnosen; | ||||
| } | } | ||||
| /** | |||||
| * Gibt Liste der hinterlegten Kassen zurueck. | |||||
| * | |||||
| * @return Liste der hinterlegten Kassen | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Kasse> getAllKassen() throws SQLException { | public static List<Kasse> getAllKassen() throws SQLException { | ||||
| Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | Statement statement = MySqlConnectionFactory.getConnection().createStatement(); | ||||
| ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); | ResultSet rs = statement.executeQuery(SELECT_ALL_KASSEN); | ||||
| @@ -804,6 +882,12 @@ public class DBHandler { | |||||
| return kasse; | return kasse; | ||||
| } | } | ||||
| /** | |||||
| * Speichert Diagnose in die Datenbank. | |||||
| * | |||||
| * @param diagnose Diagnose | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static void setDiagnose(Diagnose diagnose) throws SQLException { | public static void setDiagnose(Diagnose diagnose) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_DIAGNOSE); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_DIAGNOSE); | ||||
| statement.setInt(1, diagnose.getArzt().getMitarbID()); // `Arzt` | statement.setInt(1, diagnose.getArzt().getMitarbID()); // `Arzt` | ||||
| @@ -817,6 +901,14 @@ public class DBHandler { | |||||
| statement.execute(); | 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 { | public static void setHL7Nachricht(String hl7msg, LocalDateTime timestamp, String source) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT); | ||||
| statement.setString(1, hl7msg); | statement.setString(1, hl7msg); | ||||
| @@ -825,10 +917,23 @@ public class DBHandler { | |||||
| statement.execute(); | statement.execute(); | ||||
| } | } | ||||
| /** | |||||
| * Gibt die letzten 30 HL7 Logeintraege aus der DB zurueck. | |||||
| * | |||||
| * @return | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<HL7LogEntry> getLastHL7LogEntries() throws SQLException { | public static List<HL7LogEntry> getLastHL7LogEntries() throws SQLException { | ||||
| return getLastHL7LogEntries(30); | 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<HL7LogEntry> getLastHL7LogEntries(int last) throws SQLException { | public static List<HL7LogEntry> getLastHL7LogEntries(int last) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_LAST_HL7ENTRIES); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_LAST_HL7ENTRIES); | ||||
| statement.setInt(1, last); | statement.setInt(1, last); | ||||
| @@ -841,6 +946,12 @@ public class DBHandler { | |||||
| return hl7entries; | 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 { | public static void setHL7LogEntry(HL7LogEntry entry) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT_); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(INSERT_HL7NACHRICHT_); | ||||
| statement.setString(1, entry.getMessage()); | statement.setString(1, entry.getMessage()); | ||||
| @@ -859,6 +970,13 @@ public class DBHandler { | |||||
| return entry; | return entry; | ||||
| } | } | ||||
| /** | |||||
| * Gibt alle FallIDs eines Patienten zurueck. | |||||
| * | |||||
| * @param patid Patienten ID | |||||
| * @return Liste aller FallIDs | |||||
| * @throws SQLException | |||||
| */ | |||||
| public static List<Integer> getAlleFallIdsByPatID(int patid) throws SQLException { | public static List<Integer> getAlleFallIdsByPatID(int patid) throws SQLException { | ||||
| PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FALLIDS_BY_PATID); | PreparedStatement statement = MySqlConnectionFactory.getConnection().prepareStatement(SELECT_FALLIDS_BY_PATID); | ||||
| statement.setInt(1, patid); | statement.setInt(1, patid); | ||||