use of org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityWithAnyProxy.
@Test
public void testSaveCompositionEntityWithAnyProxy() {
ehr = openEhrClient.ehrEndpoint().createEhr();
GECCOSerologischerBefundComposition composition1 = new GECCOSerologischerBefundComposition();
composition1.setLanguage(Language.DE);
composition1.setTerritory(Territory.DE);
composition1.setCategoryDefiningCode(org.ehrbase.client.classgenerator.shareddefinition.Category.EVENT);
composition1.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
composition1.setComposer(new PartyIdentified(null, "Test", null));
composition1.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
composition1.setParticipations(new ArrayList<>());
composition1.setBefund(new ArrayList<>());
Enhancer enhancerObservation = new Enhancer();
enhancerObservation.setSuperclass(BefundObservation.class);
enhancerObservation.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if (method.getDeclaringClass() != Object.class && method.getName().equals("getLanguage")) {
return Language.EN;
} else {
return proxy.invokeSuper(obj, args);
}
});
BefundObservation befundObservation = (BefundObservation) enhancerObservation.create();
composition1.getBefund().add(befundObservation);
befundObservation.setSubject(new PartySelf());
befundObservation.setJedesEreignis(new ArrayList<>());
// Read will be overwritten by enhancerObservation
befundObservation.setLanguage(Language.DE);
befundObservation.setAnforderungDefiningCode(AnforderungDefiningCode.SARS_COV2_COVID19_AB_PANEL_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
befundObservation.setOriginValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
BefundJedesEreignisPointEvent event = new BefundJedesEreignisPointEvent();
event.setTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
event.setLabortestBezeichnungDefiningCode(LabortestBezeichnungDefiningCode.SEROLOGIC_TEST_PROCEDURE);
event.setVirusnachweistestDefiningCode(VirusnachweistestDefiningCode.SARS_COV2_COVID19_AB_PRESENCE_IN_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
event.setErgebnisStatusValue("registered");
befundObservation.getJedesEreignis().add(event);
Enhancer enhancerProAnalytQuantitativesErgebnisDvCount = new Enhancer();
enhancerProAnalytQuantitativesErgebnisDvCount.setSuperclass(ProAnalytQuantitativesErgebnisDvCount.class);
enhancerProAnalytQuantitativesErgebnisDvCount.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if (method.getDeclaringClass() != Object.class && method.getName().equals("getQuantitativesErgebnisMagnitude")) {
return 33l;
} else {
return proxy.invokeSuper(obj, args);
}
});
ProAnalytQuantitativesErgebnisDvCount quantitativesErgebnis = (ProAnalytQuantitativesErgebnisDvCount) enhancerProAnalytQuantitativesErgebnisDvCount.create();
quantitativesErgebnis.setQuantitativesErgebnisMagnitude(22l);
event.setQuantitativesErgebnis(quantitativesErgebnis);
GECCOSerologischerBefundComposition composition = composition1;
composition = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(composition);
Optional<GECCOSerologischerBefundComposition> actual = openEhrClient.compositionEndpoint(ehr).find(composition.getVersionUid().getUuid(), GECCOSerologischerBefundComposition.class);
assertThat(actual).isPresent();
assertThat(actual.get().getBefund()).size().isEqualTo(1);
BefundObservation actualObservation = actual.get().getBefund().get(0);
assertThat(actualObservation.getLanguage()).isEqualTo(Language.EN);
assertThat(actualObservation.getJedesEreignis()).size().isEqualTo(1);
assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).isNotNull();
assertThat(actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis().getClass()).isEqualTo(ProAnalytQuantitativesErgebnisDvCount.class);
assertThat(((ProAnalytQuantitativesErgebnisDvCount) actualObservation.getJedesEreignis().get(0).getQuantitativesErgebnis()).getQuantitativesErgebnisMagnitude()).isEqualTo(33L);
}
use of org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityWithAny.
@Test
public void testSaveCompositionEntityWithAny() {
ehr = openEhrClient.ehrEndpoint().createEhr();
GECCOSerologischerBefundComposition composition = TestData.buildGeccoSerologischerBefundComposition();
composition = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(composition);
Optional<GECCOSerologischerBefundComposition> actual = openEhrClient.compositionEndpoint(ehr).find(composition.getVersionUid().getUuid(), GECCOSerologischerBefundComposition.class);
assertThat(actual).isPresent();
assertThat(actual.get().getBefund()).size().isEqualTo(1);
assertThat(actual.get().getBefund().get(0).getJedesEreignis()).size().isEqualTo(1);
assertThat(actual.get().getBefund().get(0).getJedesEreignis().get(0).getQuantitativesErgebnis()).isNotNull();
assertThat(actual.get().getBefund().get(0).getJedesEreignis().get(0).getQuantitativesErgebnis().getClass()).isEqualTo(ProAnalytQuantitativesErgebnisDvCount.class);
assertThat(((ProAnalytQuantitativesErgebnisDvCount) actual.get().getBefund().get(0).getJedesEreignis().get(0).getQuantitativesErgebnis()).getQuantitativesErgebnisMagnitude()).isEqualTo(22l);
}
use of org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.GECCOSerologischerBefundComposition in project openEHR_SDK by ehrbase.
the class TestData method buildGeccoSerologischerBefundComposition.
public static GECCOSerologischerBefundComposition buildGeccoSerologischerBefundComposition() {
GECCOSerologischerBefundComposition composition = new GECCOSerologischerBefundComposition();
composition.setLanguage(Language.DE);
composition.setTerritory(Territory.DE);
composition.setCategoryDefiningCode(Category.EVENT);
composition.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
composition.setComposer(new PartyIdentified(null, "Test", null));
composition.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
composition.setParticipations(new ArrayList<>());
composition.setBefund(new ArrayList<>());
var befundObservation = new org.ehrbase.client.classgenerator.examples.geccoserologischerbefundcomposition.definition.BefundObservation();
composition.getBefund().add(befundObservation);
befundObservation.setSubject(new PartySelf());
befundObservation.setJedesEreignis(new ArrayList<>());
befundObservation.setLanguage(Language.DE);
befundObservation.setAnforderungDefiningCode(AnforderungDefiningCode.SARS_COV2_COVID19_AB_PANEL_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
befundObservation.setOriginValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
BefundJedesEreignisPointEvent event = new BefundJedesEreignisPointEvent();
event.setTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
event.setErgebnisStatusValue("registered");
event.setLabortestBezeichnungDefiningCode(LabortestBezeichnungDefiningCode.SEROLOGIC_TEST_PROCEDURE);
event.setVirusnachweistestDefiningCode(VirusnachweistestDefiningCode.SARS_COV2_COVID19_AB_PRESENCE_IN_SERUM_OR_PLASMA_BY_IMMUNOASSAY);
befundObservation.getJedesEreignis().add(event);
ProAnalytQuantitativesErgebnisDvCount quantitativesErgebnis = new ProAnalytQuantitativesErgebnisDvCount();
quantitativesErgebnis.setQuantitativesErgebnisMagnitude(22l);
event.setQuantitativesErgebnis(quantitativesErgebnis);
return composition;
}
Aggregations