diff --git a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt index 0738650..028b4a3 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt @@ -20,6 +20,8 @@ package dev.dnpm.etl.processor.monitoring import org.springframework.data.annotation.Id +import org.springframework.data.domain.Page +import org.springframework.data.domain.Pageable import org.springframework.data.jdbc.repository.query.Query import org.springframework.data.relational.core.mapping.Embedded import org.springframework.data.relational.core.mapping.Table @@ -59,6 +61,8 @@ interface RequestRepository : CrudRepository, PagingAndSortingRep fun findByUuidEquals(uuid: String): Optional + fun findRequestByPatientId(patientId: String, pageable: Pageable): Page + @Query("SELECT count(*) AS count, status FROM request WHERE type = 'MTB_FILE' GROUP BY status ORDER BY status, count DESC;") fun countStates(): List diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/HomeController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/HomeController.kt index 99b9972..6a256aa 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/HomeController.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/HomeController.kt @@ -40,13 +40,29 @@ class HomeController( ) { @GetMapping - fun index(@PageableDefault(page = 0, size = 20, sort = ["processedAt"], direction = Sort.Direction.DESC) pageable: Pageable, model: Model): String { + fun index( + @PageableDefault(page = 0, size = 20, sort = ["processedAt"], direction = Sort.Direction.DESC) pageable: Pageable, + model: Model + ): String { val requests = requestRepository.findAll(pageable) model.addAttribute("requests", requests) return "index" } + @GetMapping(path = ["patient/{patientId}"]) + fun byPatient( + @PathVariable patientId: String, + @PageableDefault(page = 0, size = 20, sort = ["processedAt"], direction = Sort.Direction.DESC) pageable: Pageable, + model: Model + ): String { + val requests = requestRepository.findRequestByPatientId(patientId, pageable) + model.addAttribute("patientId", patientId) + model.addAttribute("requests", requests) + + return "index" + } + @GetMapping(path = ["/report/{id}"]) fun report(@PathVariable id: RequestId, model: Model): String { val request = requestRepository.findByUuidEquals(id.toString()).orElse(null) ?: throw NotFoundException() diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index c039b33..c8b0ea5 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -9,16 +9,30 @@
-

Letzte Anfragen

+

Alle Anfragen

+ +
+

+ Betreffend Patienten-Pseudonym *** + Alle anzeigen +

+
-
+
Seite [[ ${requests.getNumber() + 1} ]] von [[ ${requests.getTotalPages()} ]]
+
+ + + Seite [[ ${requests.getNumber() + 1} ]] von [[ ${requests.getTotalPages()} ]] + + +
@@ -42,7 +56,12 @@ [[ ${request.uuid} ]] - + +
[[ ${request.patientId} ]] + [[ ${request.patientId} ]] + + [[ ${request.patientId} ]] + ***