ソースを参照

ICD10Codes und OPSCodes verarbeitet.

hapi
コミット
9197941c04
1個のファイルの変更69行の追加6行の削除
  1. +69
    -6
      src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java

+ 69
- 6
src/main/java/de/uniluebeck/mi/projmi6/db/DBHandler.java ファイルの表示

@@ -22,6 +22,10 @@ public class DBHandler {
private static final String SELECT_ALL_STATIONEN = "SELECT * FROM `stammstation`";
private static final String SELECT_FAELLE_BY_PATID = "SELECT * FROM `fall` WHERE `patientid` = ?";
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`";
private static final String SELECT_ICD10CODE_BY_ID = "SELECT * FROM `stammicd10` WHERE `icd10code` = '?' AND `version` = ?";
private static final String SELECT_OPSCODE_BY_ID = "SELECT * FROM `stammops` WHERE `opscode` = '?' AND `version` = ?";

public static List<Patient> getAllPatients() throws SQLException {
Statement statement = MySqlConnFactory.getConnection().createStatement();
@@ -137,16 +141,75 @@ public class DBHandler {
diagnose.setArzt(new Mitarbeiter(rs.getInt("arzt")));
diagnose.setDiagArt(DiagArt.parseInt(rs.getInt("diagart")));
setVersionInformation(diagnose, rs);
diagnose.setIcd10code(new Icd10Code(rs.getString("icd10code"), "", rs.getInt("icd10version"))); // TODO: das geht auch in huebsch
diagnose.setIcd10code(getIcd10Code(rs.getString("icd10code"), rs.getInt("icd10version")));
return diagnose;
}

private static void setVersionInformation(Version t, ResultSet rs) throws SQLException {
t.setErsteller(rs.getInt("ersteller"));
t.setErstellDatumZeit(rs.getTimestamp("erstelldatum").toLocalDateTime());
t.setBearbeiter(rs.getInt("letzterbearbeiter"));
t.setBearbeitetDatumZeit(rs.getTimestamp("letztesbearbeitungsdatum").toLocalDateTime());
private static void setVersionInformation(Version version, ResultSet rs) throws SQLException {
version.setErsteller(rs.getInt("ersteller"));
version.setErstellDatumZeit(rs.getTimestamp("erstelldatum").toLocalDateTime());
version.setBearbeiter(rs.getInt("letzterbearbeiter"));
version.setBearbeitetDatumZeit(rs.getTimestamp("letztesbearbeitungsdatum").toLocalDateTime());
}

public static List<Icd10Code> getAllIcd10Codes() throws SQLException {
Statement statement = MySqlConnFactory.getConnection().createStatement();
ResultSet rs = statement.executeQuery(SELECT_ALL_ICD10CODES);

List<Icd10Code> icd10codes = new ArrayList<>();
while (rs.next()) {
icd10codes.add(getIcd10Code(rs));
}

return icd10codes;
}

private static Icd10Code getIcd10Code(String code, int version) throws SQLException {
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_ICD10CODE_BY_ID);
ResultSet rs;
statement.setString(1, code);
statement.setInt(2, version);
rs = statement.executeQuery();

return getIcd10Code(rs);
}

private static Icd10Code getIcd10Code(ResultSet rs) throws SQLException {
String code = rs.getString("icd10code");
String text = rs.getString("text");
int version = rs.getInt("version");

return new Icd10Code(code, text, version);
}

public static List<OpsCode> getAllOpsCodes() throws SQLException {
Statement statement = MySqlConnFactory.getConnection().createStatement();
ResultSet rs = statement.executeQuery(SELECT_ALL_OPSCODES);

List<OpsCode> opscodes = new ArrayList<>();
while (rs.next()) {
opscodes.add(getOpsCode(rs));
}

return opscodes;
}

public static OpsCode getOpsCode(String code, int version) throws SQLException {
PreparedStatement statement = MySqlConnFactory.getConnection().prepareStatement(SELECT_OPSCODE_BY_ID);
ResultSet rs;
statement.setString(1, code);
statement.setInt(2, version);
rs = statement.executeQuery();

return getOpsCode(rs);
}

private static OpsCode getOpsCode(ResultSet rs) throws SQLException {
String code = rs.getString("opscode");
String text = rs.getString("text");
int version = rs.getInt("version");

return new OpsCode(code, text, version);
}

}

読み込み中…
キャンセル
保存