Search in sources :

Example 31 with DvDateTime

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());
}
Also used : DvDateTimeAttributes(org.ehrbase.serialisation.attributes.datavalues.datetime.datetime.DvDateTimeAttributes) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 32 with DvDateTime

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());
}
Also used : DvDateTimeAttributes(org.ehrbase.serialisation.attributes.datavalues.datetime.datetime.DvDateTimeAttributes) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 33 with DvDateTime

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));
            }
        });
    }
}
Also used : PartyProxy(com.nedap.archie.rm.generic.PartyProxy) Objects(java.util.Objects) EventContext(com.nedap.archie.rm.composition.EventContext) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) RMHelper(org.ehrbase.serialisation.walker.RMHelper) DefaultValuePath(org.ehrbase.serialisation.walker.defaultvalues.DefaultValuePath) GenericId(com.nedap.archie.rm.support.identification.GenericId) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Participation(com.nedap.archie.rm.generic.Participation) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) Setting(org.ehrbase.client.classgenerator.shareddefinition.Setting) GenericId(com.nedap.archie.rm.support.identification.GenericId) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Setting(org.ehrbase.client.classgenerator.shareddefinition.Setting) Objects(java.util.Objects) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 34 with DvDateTime

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;
}
Also used : StationarerVersorgungsfallComposition(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.StationarerVersorgungsfallComposition) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) AufnahmedatenAdminEntry(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.definition.AufnahmedatenAdminEntry) EntlassungsdatenAdminEntry(org.ehrbase.client.classgenerator.examples.stationarerversorgungsfallcomposition.definition.EntlassungsdatenAdminEntry) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) PartySelf(com.nedap.archie.rm.generic.PartySelf)

Example 35 with DvDateTime

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();
}
Also used : DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Aggregations

DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)44 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)11 Test (org.junit.Test)10 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)8 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)7 EventContext (com.nedap.archie.rm.composition.EventContext)6 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)5 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)5 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)5 Composition (com.nedap.archie.rm.composition.Composition)4 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)4 Participation (com.nedap.archie.rm.generic.Participation)4 TemporalAccessor (java.time.temporal.TemporalAccessor)4 Objects (java.util.Objects)4 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)3 DvText (com.nedap.archie.rm.datavalues.DvText)3 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)3 AuditDetails (com.nedap.archie.rm.generic.AuditDetails)3 UUID (java.util.UUID)3 Test (org.junit.jupiter.api.Test)3