summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt1
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt10
-rw-r--r--src/main/kotlin/dev/dnpm/etl/processor/services/ResponseProcessor.kt2
-rw-r--r--src/main/resources/db/migration/mariadb/V0_16_3_1__ExpectedFollowUpCount.sql2
-rw-r--r--src/main/resources/db/migration/postgresql/V0_16_3_1__ExpectedFollowUpCount.sql2
5 files changed, 15 insertions, 2 deletions
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 67f450f..d62a503 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/monitoring/Request.kt
@@ -54,6 +54,7 @@ data class Request(
@Embedded.Nullable var report: Report? = null,
@Column("submission_accepted") var submissionAccepted: Boolean = false,
@Column("followup_count") var followupCount: Int = 0,
+ @Column("expected_followup_count") var expectedFollowupCount: Int = 0,
) {
constructor(
uuid: RequestId,
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
index 00e6b73..e545644 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt
@@ -113,6 +113,10 @@ class RequestProcessor(
}
}
+ val maxFollowUpCount = this.requestService.allRequestsByPatientPseudonym(request.patientPseudonym())
+ .maxByOrNull { it.followupCount }
+ ?.followupCount ?: -1
+
if (
appConfigProperties.postInitialSubmissionBlock &&
hasSuccessfulInitialSubmission(request.patientPseudonym()) &&
@@ -128,7 +132,8 @@ class RequestProcessor(
submissionType = submissionType,
status = RequestStatus.BLOCKED_INITIAL,
tan = Tan(request.content.metadata?.transferTan.orEmpty()),
- followupCount = request.content.followUps?.size ?: 0,
+ followupCount = maxFollowUpCount,
+ expectedFollowupCount = request.content.followUps?.size ?: 0,
)
)
// Exit - no further processing
@@ -166,7 +171,8 @@ class RequestProcessor(
submissionType = submissionType,
status = RequestStatus.UNKNOWN,
tan = Tan(request.content.metadata?.transferTan.orEmpty()),
- followupCount = request.content.followUps?.size ?: 0,
+ followupCount = maxFollowUpCount,
+ expectedFollowupCount = request.content.followUps?.size ?: 0,
)
)
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/ResponseProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/ResponseProcessor.kt
index 947ec17..2818e00 100644
--- a/src/main/kotlin/dev/dnpm/etl/processor/services/ResponseProcessor.kt
+++ b/src/main/kotlin/dev/dnpm/etl/processor/services/ResponseProcessor.kt
@@ -53,10 +53,12 @@ class ResponseProcessor(
Report(
"Keine Probleme erkannt",
)
+ it.followupCount = it.expectedFollowupCount
}
RequestStatus.WARNING -> {
it.report = Report("Warnungen über mangelhafte Daten", event.body.orElse(""))
+ it.followupCount = it.expectedFollowupCount
}
RequestStatus.ERROR -> {
diff --git a/src/main/resources/db/migration/mariadb/V0_16_3_1__ExpectedFollowUpCount.sql b/src/main/resources/db/migration/mariadb/V0_16_3_1__ExpectedFollowUpCount.sql
new file mode 100644
index 0000000..ded8172
--- /dev/null
+++ b/src/main/resources/db/migration/mariadb/V0_16_3_1__ExpectedFollowUpCount.sql
@@ -0,0 +1,2 @@
+ALTER TABLE request ADD COLUMN expected_followup_count int DEFAULT 0;
+UPDATE request SET expected_followup_count = -1; \ No newline at end of file
diff --git a/src/main/resources/db/migration/postgresql/V0_16_3_1__ExpectedFollowUpCount.sql b/src/main/resources/db/migration/postgresql/V0_16_3_1__ExpectedFollowUpCount.sql
new file mode 100644
index 0000000..ded8172
--- /dev/null
+++ b/src/main/resources/db/migration/postgresql/V0_16_3_1__ExpectedFollowUpCount.sql
@@ -0,0 +1,2 @@
+ALTER TABLE request ADD COLUMN expected_followup_count int DEFAULT 0;
+UPDATE request SET expected_followup_count = -1; \ No newline at end of file