use of org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText in project openEHR_SDK by ehrbase.
the class FlattenerTest method testFlattenEhrbaseMultiOccurrenceDeV1.
@Test
public void testFlattenEhrbaseMultiOccurrenceDeV1() {
Flattener cut = new Flattener(new TestDataTemplateProvider());
EhrbaseMultiOccurrenceDeV1Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseMultiOccurrenceDeV1();
RMObject rmObject = new Unflattener(new TestDataTemplateProvider()).unflatten(bloodPressureSimpleDeV0);
EhrbaseMultiOccurrenceDeV1Composition actual = cut.flatten((Locatable) rmObject, EhrbaseMultiOccurrenceDeV1Composition.class);
assertThat(actual).isNotNull();
assertThat(actual.getBodyTemperature()).size().isEqualTo(2);
BodyTemperatureObservation bodyTemperature1 = actual.getBodyTemperature().get(0);
assertThat(bodyTemperature1.getAnyEvent()).extracting(e -> ((BodyTemperatureAnyEventPointEvent) e).getTemperatureMagnitude()).containsExactlyInAnyOrder(11d, 22d);
BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement1 = bodyTemperature1.getLocationOfMeasurement();
assertThat(locationOfMeasurement1.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvCodedText.class);
assertThat(((BodyTemperatureLocationOfMeasurementDvCodedText) locationOfMeasurement1).getLocationOfMeasurementDefiningCode()).isEqualTo(LocationOfMeasurementDefiningCode.FOREHEAD);
BodyTemperatureObservation bodyTemperature2 = actual.getBodyTemperature().get(1);
BodyTemperatureLocationOfMeasurementChoice locationOfMeasurement2 = bodyTemperature2.getLocationOfMeasurement();
assertThat(locationOfMeasurement2.getClass()).isEqualTo(BodyTemperatureLocationOfMeasurementDvText.class);
assertThat(((BodyTemperatureLocationOfMeasurementDvText) locationOfMeasurement2).getLocationOfMeasurementValue()).isEqualTo("location");
}
use of org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.BodyTemperatureLocationOfMeasurementDvCodedText in project openEHR_SDK by ehrbase.
the class TestData method buildBodyTemperature1.
private static BodyTemperatureObservation buildBodyTemperature1() {
BodyTemperatureObservation bodyTemperature = new BodyTemperatureObservation();
bodyTemperature.setLanguage(Language.DE);
bodyTemperature.setSubject(new PartySelf());
bodyTemperature.setOriginValue(OffsetDateTime.now());
bodyTemperature.setAnyEvent(new ArrayList<>());
BodyTemperatureLocationOfMeasurementDvCodedText locationOfMeasurement = new BodyTemperatureLocationOfMeasurementDvCodedText();
locationOfMeasurement.setLocationOfMeasurementDefiningCode(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.definition.LocationOfMeasurementDefiningCode.FOREHEAD);
bodyTemperature.setLocationOfMeasurement(locationOfMeasurement);
BodyTemperatureAnyEventPointEvent history1 = new BodyTemperatureAnyEventPointEvent();
history1.setTemperatureMagnitude(22d);
history1.setTemperatureUnits("Cel");
history1.setCurrentDayOfMenstrualCycleMagnitude(3l);
history1.setTimeValue(OffsetDateTime.now());
bodyTemperature.getAnyEvent().add(history1);
BodyTemperatureAnyEventPointEvent history2 = new BodyTemperatureAnyEventPointEvent();
history2.setTemperatureMagnitude(11d);
history2.setTemperatureUnits("Cel");
history2.setCurrentDayOfMenstrualCycleMagnitude(3l);
history2.setTimeValue(OffsetDateTime.now());
bodyTemperature.getAnyEvent().add(history2);
return bodyTemperature;
}
Aggregations