use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class TemporalEncodingTest method testChronoFieldSupportDateTimeYYYYMMDD.
public void testChronoFieldSupportDateTimeYYYYMMDD() {
DvDateTime dvDateTime = new DvDateTime("2020-12-12");
DvDateTimeAttributes dateTimeAttributes = DvDateTimeAttributes.instanceFromValue(dvDateTime);
assertTrue(dateTimeAttributes.isDateTimeYYYYMMDD());
assertFalse(dateTimeAttributes.isDateTimeYYYYMMDDHHMMSS());
assertFalse(dateTimeAttributes.isDateTimeYYYYMM());
assertEquals("2020-12-12", dateTimeAttributes.getValueAsProvided().toString());
// GMT: Saturday, December 12, 2020 12:00:00 AM == 1607731200 (https://www.epochconverter.com/)
assertEquals(Long.valueOf(1607731200), dateTimeAttributes.getTimeStamp());
assertEquals(Integer.valueOf(TemporalAttributes.DV_DATE_TIME | TemporalAttributes.YEAR | TemporalAttributes.MONTH_OF_YEAR | TemporalAttributes.DAY_OF_MONTH), dateTimeAttributes.getSupportedChronoFields());
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class TemporalEncodingTest method testChronoFieldSupport3.
public void testChronoFieldSupport3() {
DvDateTime dvDateTime = new DvDateTime("2020-08-19T12:12:12.123Z");
DvDateTimeAttributes dvDateTimeAttributes = DvDateTimeAttributes.instanceFromValue(dvDateTime);
assertTrue(dvDateTimeAttributes.isRmDvDateTime());
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class EventContextValueInserter method insert.
@Override
public void insert(EventContext rmObject, DefaultValues defaultValues) {
if (RMHelper.isEmpty(rmObject.getStartTime()) && defaultValues.containsDefaultValue(DefaultValuePath.TIME)) {
rmObject.setStartTime(new DvDateTime(defaultValues.getDefaultValue(DefaultValuePath.TIME)));
}
if (RMHelper.isEmpty(rmObject.getEndTime()) && defaultValues.containsDefaultValue(DefaultValuePath.END_TIME)) {
rmObject.setEndTime(new DvDateTime(defaultValues.getDefaultValue(DefaultValuePath.END_TIME)));
}
if (RMHelper.isEmpty(rmObject.getHealthCareFacility()) && (defaultValues.containsDefaultValue(DefaultValuePath.HEALTHCARE_FACILITY_NAME) || defaultValues.containsDefaultValue(DefaultValuePath.HEALTHCARE_FACILITY_ID))) {
rmObject.setHealthCareFacility(buildPartyIdentified(defaultValues, DefaultValuePath.HEALTHCARE_FACILITY_NAME, DefaultValuePath.HEALTHCARE_FACILITY_ID, rmObject.getHealthCareFacility()));
}
if (RMHelper.isEmpty(rmObject.getLocation()) && defaultValues.containsDefaultValue(DefaultValuePath.LOCATION)) {
rmObject.setLocation(defaultValues.getDefaultValue(DefaultValuePath.LOCATION));
}
if (RMHelper.isEmpty(rmObject.getSetting()) && defaultValues.containsDefaultValue(DefaultValuePath.SETTING)) {
Setting defaultValue = defaultValues.getDefaultValue(DefaultValuePath.SETTING);
rmObject.setSetting(new DvCodedText(defaultValue.getValue(), defaultValue.toCodePhrase()));
}
if (RMHelper.isEmpty(rmObject.getParticipations()) && defaultValues.containsDefaultValue(DefaultValuePath.PARTICIPATION)) {
rmObject.setParticipations(defaultValues.getDefaultValue(DefaultValuePath.PARTICIPATION));
}
if (rmObject.getParticipations() != null) {
rmObject.getParticipations().stream().map(Participation::getPerformer).filter(Objects::nonNull).map(PartyProxy::getExternalRef).filter(Objects::nonNull).filter(ref -> ref.getId() != null).forEach(ref -> {
if (ref.getNamespace() == null && defaultValues.containsDefaultValue(DefaultValuePath.ID_NAMESPACE)) {
ref.setNamespace(defaultValues.getDefaultValue(DefaultValuePath.ID_NAMESPACE));
}
if (ref.getId() instanceof GenericId && ref.getNamespace() == null && defaultValues.containsDefaultValue(DefaultValuePath.ID_SCHEME)) {
((GenericId) ref.getId()).setScheme(defaultValues.getDefaultValue(DefaultValuePath.ID_SCHEME));
}
});
}
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class TestData method buildTestStationarerVersorgungsfallComposition.
public static StationarerVersorgungsfallComposition buildTestStationarerVersorgungsfallComposition() {
StationarerVersorgungsfallComposition stationarerVersorgungsfallComposition = new StationarerVersorgungsfallComposition();
stationarerVersorgungsfallComposition.setComposer(new PartyIdentified(null, "Test", null));
stationarerVersorgungsfallComposition.setCategoryDefiningCode(Category.EVENT);
stationarerVersorgungsfallComposition.setLanguage(Language.DE);
stationarerVersorgungsfallComposition.setTerritory(Territory.DE);
// context
stationarerVersorgungsfallComposition.setStartTimeValue(new DvDateTime("2020-04-02T12:00:00Z").getValue());
stationarerVersorgungsfallComposition.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
// other_context
stationarerVersorgungsfallComposition.setFalltypDefiningCode(FalltypDefiningCode.VERSORGUNGSFALL);
stationarerVersorgungsfallComposition.setFallKennungValue("45657678");
// openEHR-EHR-ADMIN_ENTRY.admission.v0
AufnahmedatenAdminEntry aufnahmedatenAdminEntry = new AufnahmedatenAdminEntry();
aufnahmedatenAdminEntry.setDatumUhrzeitDerAufnahmeValue(new DvDateTime("2020-04-02T12:00:00Z").getValue());
aufnahmedatenAdminEntry.setLanguage(Language.DE);
aufnahmedatenAdminEntry.setSubject(new PartySelf());
// openEHR-EHR-ADMIN_ENTRY.discharge_summary.v0
EntlassungsdatenAdminEntry entlassungsdatenAdminEntry = new EntlassungsdatenAdminEntry();
entlassungsdatenAdminEntry.setLanguage(Language.DE);
entlassungsdatenAdminEntry.setSubject(new PartySelf());
entlassungsdatenAdminEntry.setKlinischerZustandDesPatientenDefiningCode(KlinischerZustandDesPatientenDefiningCode.UNBESTIMMT);
entlassungsdatenAdminEntry.setDatumUhrzeitDerEntlassungValue(new DvDateTime("2020-04-02T12:00:00Z").getValue());
// assemble
stationarerVersorgungsfallComposition.setAufnahmedaten(aufnahmedatenAdminEntry);
stationarerVersorgungsfallComposition.setEntlassungsdaten(entlassungsdatenAdminEntry);
return stationarerVersorgungsfallComposition;
}
use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.
the class CanonicalEhrQuery1IT method setUp.
@Before
public void setUp() {
actualDvDateTime = new DvDateTime(OffsetDateTime.now());
ehrUUID = openEhrClient.ehrEndpoint().createEhr();
// ehr_status
referenceEhrStatus = openEhrClient.ehrEndpoint().getEhrStatus(ehrUUID).get();
}
Aggregations