Skip to content

Commit

Permalink
[26835] isRisk filter hinzugefügt (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daksic28 authored Dec 19, 2024
1 parent 3f5dd92 commit 044320f
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import org.hl7.fhir.r4.model.CodeableConcept;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Reference;

import ch.elexis.core.findings.ICoding;
import ch.elexis.core.findings.IFinding;
import ch.elexis.core.findings.IObservation;
import ch.elexis.core.findings.IObservation.ObservationCategory;
import ch.elexis.core.findings.IObservation.ObservationCode;
import ch.elexis.core.findings.migration.IMigratorService;
import ch.elexis.core.findings.util.FindingsServiceHolder;
import ch.elexis.core.model.IPatient;
Expand All @@ -27,8 +32,9 @@ public static List<Observation> createRiskFactors(Reference patientReference, IP
if (structuredRiskCheck) {
List<IObservation> structuredRisks = FindingsServiceHolder.getiFindingsService()
.getPatientsFindings(sourcePatient.getId(), IObservation.class);

for (IObservation structuredRisk : structuredRisks) {
List<IObservation> filteredRisks = structuredRisks.stream().filter(RiskFactorResource::isRisk)
.collect(Collectors.toList());
for (IObservation structuredRisk : filteredRisks) {
Observation riskFactor = resourceFactory.getResource(structuredRisk, IObservation.class,
Observation.class);
if (riskFactor == null) {
Expand Down Expand Up @@ -76,4 +82,16 @@ private static void applyStandardCodes(Observation riskFactor, Reference patient
.setText(riskDisplay));
riskFactor.setSubject(patientReference);
}
}

private static boolean isRisk(IFinding iFinding) {
if (iFinding instanceof IObservation
&& ((IObservation) iFinding).getCategory() == ObservationCategory.SOCIALHISTORY) {
for (ICoding code : ((IObservation) iFinding).getCoding()) {
if (ObservationCode.ANAM_RISK.isSame(code)) {
return true;
}
}
}
return false;
}
}

0 comments on commit 044320f

Please sign in to comment.