Skip to content

Commit

Permalink
BAH-3978 | Upgrade FHIR 2 Module version to 2.1.0 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 authored Jun 22, 2024
1 parent cd08081 commit 08455c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.openmrs.api.PatientService;
import org.openmrs.api.context.Context;
import org.openmrs.module.fhir2.api.FhirConditionService;
import org.openmrs.module.fhir2.api.search.param.ConditionSearchParams;
import org.openmrs.module.fhir2.api.translators.ConceptTranslator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -111,10 +112,11 @@ private void addExistingActiveConditions(Bundle conditionsBundle, String patient
referenceParam.setValue(patientUuid);
referenceAndListParam.addValue(new ReferenceOrListParam().add(referenceParam));

IBundleProvider iBundleProvider = fhirConditionService.searchConditions(referenceAndListParam, null,
null, null, null,
ConditionSearchParams conditionSearchParams = new ConditionSearchParams(referenceAndListParam, null,
null, null, null, null,
null);
null, null, null, null);

IBundleProvider iBundleProvider = fhirConditionService.searchConditions(conditionSearchParams);

for (IBaseResource conditionBaseResource : iBundleProvider.getAllResources()) {
Condition fhirCondition = parser.parseResource(Condition.class, parser.encodeResourceToString(conditionBaseResource));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void shouldIncludeActiveDiagnoses_whenPatientHasOneSavedActiveDiagnosis_o
List<Obs> visitDiagnosesObs = getVisitDiagnosesObs(false);

when(patientService.getPatientByUuid(anyString())).thenReturn(patient);
when(fhirConditionService.searchConditions(any(), any(), any(), any(), any(), any(), any(), any(), any(),any())).thenReturn(iBundleProvider);
when(fhirConditionService.searchConditions(any())).thenReturn(iBundleProvider);
when(obsService.getObservationsByPersonAndConcept(any(), any())).thenReturn(visitDiagnosesObs);
when(conceptTranslator.toFhirResource(any())).thenReturn(getCodeableConcept());

Expand Down Expand Up @@ -134,7 +134,7 @@ public void shouldIncludeActiveConditionsAndIncludeCodingSystemForBahmni_whenPat
IBundleProvider iBundleProvider = new SimpleBundleProvider(Arrays.asList(activeConditionResource, inactiveConditionResource));

when(patientService.getPatientByUuid(anyString())).thenReturn(patient);
when(fhirConditionService.searchConditions(any(), any(), any(), any(), any(), any(), any(), any(), any(),any())).thenReturn(iBundleProvider);
when(fhirConditionService.searchConditions(any())).thenReturn(iBundleProvider);
when(obsService.getObservationsByPersonAndConcept(any(), any())).thenReturn(Collections.EMPTY_LIST);
when(conceptService.getConceptByUuid("74827482-4ff0-0305-1990-000000000001")).thenReturn(getMockConcept());

Expand All @@ -154,7 +154,7 @@ public void shouldFilterOutInactiveDiagnoses_whenPatientHasOneInactiveDiagnosis_
List<Obs> visitDiagnosesObs = getInactiveVisitDiagnosesObs();

when(patientService.getPatientByUuid(anyString())).thenReturn(patient);
when(fhirConditionService.searchConditions(any(), any(), any(), any(), any(), any(), any(), any(), any(),any())).thenReturn(iBundleProvider);
when(fhirConditionService.searchConditions(any())).thenReturn(iBundleProvider);
when(obsService.getObservationsByPersonAndConcept(any(), any())).thenReturn(visitDiagnosesObs);

Bundle conditionBundle = conditionsRequestBuilder.build(mockRequestBundle);
Expand All @@ -172,7 +172,7 @@ public void shouldIncludeActiveDiagnosesAndRenameDiagnosisNameToShortName_whenPa
List<Obs> visitDiagnosesObs = getVisitDiagnosesObs(true);

when(patientService.getPatientByUuid(anyString())).thenReturn(patient);
when(fhirConditionService.searchConditions(any(), any(), any(), any(), any(), any(), any(), any(), any(),any())).thenReturn(iBundleProvider);
when(fhirConditionService.searchConditions(any())).thenReturn(iBundleProvider);
when(obsService.getObservationsByPersonAndConcept(any(), any())).thenReturn(visitDiagnosesObs);
when(conceptTranslator.toFhirResource(any())).thenReturn(getCodeableConcept());

Expand Down Expand Up @@ -245,4 +245,4 @@ private Concept getMockConcept() {
malariaConcept.setUuid("74827482-4ff0-0305-1990-000000000001");
return malariaConcept;
}
}
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</developers>
<properties>
<openmrsPlatformVersion>2.5.11</openmrsPlatformVersion>
<openmrsFhir2Version>1.8.0</openmrsFhir2Version>
<openmrsFhir2Version>2.1.0</openmrsFhir2Version>
<webServicesVersion>2.39.0</webServicesVersion>
<powerMockVersion>2.0.9</powerMockVersion>
<mockitoVersion>3.5.11</mockitoVersion>
Expand Down Expand Up @@ -325,4 +325,4 @@
</profile>
</profiles>

</project>
</project>

0 comments on commit 08455c0

Please sign in to comment.