1
0
mirror of https://github.com/pcvolkmer/mv64e-onkostar-data.git synced 2025-07-02 02:22:54 +00:00

feat: add selection by patient id and tumor id

This commit is contained in:
2025-06-29 13:10:07 +02:00
parent 55ccf8c876
commit 3c9ecaa4d7
3 changed files with 65 additions and 5 deletions

View File

@ -17,7 +17,21 @@ datasource.setPassword("devpass");
var mtbMapper = MtbDataMapper.create(datasource);
var jsonResult = Converter.toJsonString(mtbMapper.getByCaseId("16000123"));
var jsonResult = Converter.toJsonString(
mtbMapper.getByCaseId("16000123")
);
```
Es ist auch möglich, die Daten anhand der Patienten-ID und dem Tumoridentifikator zu ermitteln.
Hierbei wird das letzte Formular `DNPM Klinik/Anamnese` andhand des Anmeldedatums MTB
ausgewählt und verwendet.
```
...
var jsonResult = Converter.toJsonString(
mtbMapper.getLatestByPatientIdAndTumorId("2000123456", 1))
);
```
## Status
@ -31,12 +45,12 @@ var jsonResult = Converter.toJsonString(mtbMapper.getByCaseId("16000123"));
| Systemische Leitlinien-Therapien | ✅ | Siehe auch: https://github.com/dnpm-dip/mtb-model/issues/9 |
| Leitlinien-Prozeduren | ✅ | Siehe auch: https://github.com/dnpm-dip/mtb-model/issues/9 |
| ECOG-Verlauf | ✅ | |
| Tumor-Probem | | |
| vorherige Molekular-Diagnostik | | |
| Histologie-Berichte | | |
| Tumor-Proben | | Aktuell in Arbeit |
| vorherige Molekular-Diagnostik | | Aktuell in Arbeit |
| Histologie-Berichte | | Aktuell in Arbeit |
| IHC-Berichte | | |
| MSI-Befunde | | |
| NGS-Berichte | | |
| NGS-Berichte | | Aktuell in Arbeit |
| MTB-Beschlüsse | ⌛ | Aktuell in Arbeit |
| Follow-Up Verlauf | | |
| Antrag Kostenübernahme | | |

View File

@ -45,6 +45,38 @@ public class KpaCatalogue extends AbstractDataCatalogue {
return result.get(0);
}
/**
* Get latest procedure database id by patient id and tumor id
*
* @param patientId The patients id (not database id)
* @param tumorId The tumor identifier
* @return The procedure id
*/
public int getLatestProcedureIdByPatientIdAndTumor(String patientId, int tumorId) {
var sql = "SELECT prozedur.id FROM dk_dnpm_kpa " +
" JOIN prozedur ON (prozedur.id = dk_dnpm_kpa.id) " +
" JOIN erkrankung_prozedur ON (erkrankung_prozedur.prozedur_id = prozedur.id) " +
" JOIN erkrankung ON (erkrankung_prozedur.erkrankung_id = erkrankung.id) " +
" JOIN patient ON (patient.id = prozedur.patient_id) " +
" WHERE patient.patienten_id = ? AND erkrankung.tumoridentifikator = ? " +
" ORDER BY dk_dnpm_kpa.anmeldedatummtb DESC " +
" LIMIT 1";
var result = this.jdbcTemplate.query(
sql,
(resultSet, i) -> resultSet.getInt(1),
patientId, tumorId);
if (result.isEmpty()) {
throw new DataAccessException(String.format("No record found for patient '%s' and tumor '%d'", patientId, tumorId));
} else if (result.size() > 1) {
// This should not happen due to LIMIT 1
throw new DataAccessException(String.format("Multiple records found for patient '%s' and tumor '%d'", patientId, tumorId));
}
return result.get(0);
}
/**
* Get patient database id by case id
*

View File

@ -131,4 +131,18 @@ public class MtbDataMapper implements DataMapper<Mtb> {
this.catalogueFactory.catalogue(KpaCatalogue.class).getProcedureIdByCaseId(caseId)
);
}
/**
* Loads and maps a Mtb file using the patient id and tumor id
*
* @param patientId The patients id (not database id)
* @param tumorId The tumor identification
* @return The loaded Mtb file
*/
public Mtb getLatestByPatientIdAndTumorId(String patientId, int tumorId) {
return this.getById(
this.catalogueFactory.catalogue(KpaCatalogue.class)
.getLatestProcedureIdByPatientIdAndTumor(patientId, tumorId)
);
}
}