org.hl7.fhir.dstu3.model.Period Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.Period.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Convert.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public Period makePeriodFromIVL(Element ivl) throws Exception { if (ivl == null) return null; Period p = new Period(); Element low = cda.getChild(ivl, "low"); if (low != null) p.setStartElement(makeDateTimeFromTS(low)); Element high = cda.getChild(ivl, "high"); if (high != null) p.setEndElement(makeDateTimeFromTS(high)); if (p.getStartElement() != null || p.getEndElement() != null) return p; else return null; }
Example #2
Source File: ObservationAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public Optional<LocalDateTime> getEffectiveTime(DomainResource resource){ org.hl7.fhir.dstu3.model.Observation fhirObservation = (org.hl7.fhir.dstu3.model.Observation) resource; Type effective = fhirObservation.getEffective(); if (effective instanceof DateTimeType) { return Optional.of(getLocalDateTime(((DateTimeType) effective).getValue())); } else if (effective instanceof Period) { Date start = ((Period) effective).getStart(); if (start != null) { return Optional.of(getLocalDateTime(start)); } Date end = ((Period) effective).getEnd(); if (end != null) { return Optional.of(getLocalDateTime(end)); } } return Optional.empty(); }
Example #3
Source File: HQMFProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
private void addMeasurePeriod(XMLBuilder2 xml, Period p) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); xml.root().elem("controlVariable").elem("measurePeriod").elem("id").a("extension", "measureperiod") .a("root", "cfe828b5-ce93-4354-b137-77b0aeb41dd6").up().elem("code").a("code", "MSRTP") .a("codeSystem", "2.16.840.1.113883.5.4").elem("originalText").a("value", "Measurement Period").up() .up().elem("value").a("xsi:type", "PIVL_TS").elem("phase").a("highClosed", "true") .a("lowClosed", "true").elem("low").a("value", sdf.format(p.getStart())).up().elem("width") .a("unit", "a").a("value", "1").a("xsi:type", "PQ").up().up().elem("period").a("unit", "a") .a("value", "1"); }
Example #4
Source File: MeasureReportBuilder.java From cqf-ruler with Apache License 2.0 | 5 votes |
public MeasureReportBuilder buildPeriod(Interval period) { this.complexProperty.setPeriod( new Period() .setStart((Date) period.getStart()) .setEnd((Date) period.getEnd()) ); return this; }
Example #5
Source File: EncounterAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public Optional<LocalDateTime> getStartTime(DomainResource resource){ org.hl7.fhir.dstu3.model.Encounter fhirEncounter = (org.hl7.fhir.dstu3.model.Encounter) resource; Period period = fhirEncounter.getPeriod(); if (period != null && period.getStart() != null) { return Optional.of(getLocalDateTime(period.getStart())); } return Optional.empty(); }
Example #6
Source File: EncounterAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public Optional<LocalDateTime> getEndTime(DomainResource resource){ org.hl7.fhir.dstu3.model.Encounter fhirEncounter = (org.hl7.fhir.dstu3.model.Encounter) resource; Period period = fhirEncounter.getPeriod(); if (period != null && period.getEnd() != null) { return Optional.of(getLocalDateTime(period.getEnd())); } return Optional.empty(); }
Example #7
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
public static String displayPeriod(Period p) { String s = !p.hasStart() ? "??" : p.getStartElement().toHumanDisplay(); s = s + " --> "; return s + (!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay()); }
Example #8
Source File: NamingSystemEntityToFHIRNamingSystemTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public NamingSystem transform(final NamingSystemEntity namingSystemEntity) { final NamingSystem namingSystem = new NamingSystem(); namingSystem.setId(namingSystemEntity.getId().toString()); namingSystem.setStatus(namingSystemEntity.getStatus()); if (namingSystemEntity.getName() != null) { namingSystem.setName(namingSystemEntity.getName()); } namingSystem.setStatus(namingSystemEntity.getStatus()); for (NamingSystemUniqueId uniqueId : namingSystemEntity.getNamingSystemUniqueIds()) { NamingSystem.NamingSystemUniqueIdComponent uniqueIdComponent = namingSystem.addUniqueId(); if (uniqueId.getIdentifierType() != null) { uniqueIdComponent.setType(uniqueId.getIdentifierType()); } if (uniqueId.getValue() != null) { uniqueIdComponent.setValue(uniqueId.getValue()); } if (uniqueId.getPreferred() != null) { uniqueIdComponent.setPreferred(uniqueId.getPreferred()); } if (uniqueId.getComment() != null) { uniqueIdComponent.setComment(uniqueId.getComment()); } if (uniqueId.getPeriodStart() != null || uniqueId.getPeriodEnd() != null) { Period period = new Period(); if (uniqueId.getPeriodStart() != null ) { period.setStart(uniqueId.getPeriodStart()); } if (uniqueId.getPeriodEnd() != null) { period.setEnd(uniqueId.getPeriodEnd()); } uniqueIdComponent.setPeriod(period); } } return namingSystem; }
Example #9
Source File: FhirStu3.java From synthea with Apache License 2.0 | 4 votes |
/** * Map the given CarePlan to a FHIR CarePlan resource, and add it to the given Bundle. * * @param personEntry The Entry for the Person * @param bundle Bundle to add the CarePlan to * @param encounterEntry Current Encounter entry * @param carePlan The CarePlan to map to FHIR and add to the bundle * @return The added Entry */ private static BundleEntryComponent careplan(BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, CarePlan carePlan) { org.hl7.fhir.dstu3.model.CarePlan careplanResource = new org.hl7.fhir.dstu3.model.CarePlan(); careplanResource.setIntent(CarePlanIntent.ORDER); careplanResource.setSubject(new Reference(personEntry.getFullUrl())); careplanResource.setContext(new Reference(encounterEntry.getFullUrl())); Code code = carePlan.codes.get(0); careplanResource.addCategory(mapCodeToCodeableConcept(code, SNOMED_URI)); CarePlanActivityStatus activityStatus; GoalStatus goalStatus; Period period = new Period().setStart(new Date(carePlan.start)); careplanResource.setPeriod(period); if (carePlan.stop != 0L) { period.setEnd(new Date(carePlan.stop)); careplanResource.setStatus(CarePlanStatus.COMPLETED); activityStatus = CarePlanActivityStatus.COMPLETED; goalStatus = GoalStatus.ACHIEVED; } else { careplanResource.setStatus(CarePlanStatus.ACTIVE); activityStatus = CarePlanActivityStatus.INPROGRESS; goalStatus = GoalStatus.INPROGRESS; } if (!carePlan.activities.isEmpty()) { for (Code activity : carePlan.activities) { CarePlanActivityComponent activityComponent = new CarePlanActivityComponent(); CarePlanActivityDetailComponent activityDetailComponent = new CarePlanActivityDetailComponent(); activityDetailComponent.setStatus(activityStatus); activityDetailComponent.setCode(mapCodeToCodeableConcept(activity, SNOMED_URI)); activityComponent.setDetail(activityDetailComponent); careplanResource.addActivity(activityComponent); } } if (!carePlan.reasons.isEmpty()) { // Only one element in list Code reason = carePlan.reasons.get(0); for (BundleEntryComponent entry : bundle.getEntry()) { if (entry.getResource().fhirType().equals("Condition")) { Condition condition = (Condition) entry.getResource(); // Only one element in list Coding coding = condition.getCode().getCoding().get(0); if (reason.code.equals(coding.getCode())) { careplanResource.addAddresses().setReference(entry.getFullUrl()); } } } } for (JsonObject goal : carePlan.goals) { BundleEntryComponent goalEntry = caregoal(bundle, goalStatus, goal); careplanResource.addGoal().setReference(goalEntry.getFullUrl()); } return newEntry(bundle, careplanResource); }
Example #10
Source File: PeriodBuilder.java From cqf-ruler with Apache License 2.0 | 4 votes |
public PeriodBuilder() { super(new Period()); }
Example #11
Source File: IdentifierBuilder.java From cqf-ruler with Apache License 2.0 | 4 votes |
public IdentifierBuilder buildPeriod(Period period) { complexProperty.setPeriod(period); return this; }