public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); copyElement(src, tgt); return tgt; }
public static org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(); if (src.hasValue()) tgt.setValue(src.getValue()); copyElement(src, tgt); return tgt; }
@SuppressWarnings("unused") public static void creatingContextHl7org() { // START SNIPPET: creatingContextHl7org // Create a context for DSTU3 FhirContext ctx = FhirContext.forDstu3(); // Working with RI structures is similar to how it works with the HAPI structures org.hl7.fhir.dstu3.model.Patient patient = new org.hl7.fhir.dstu3.model.Patient(); patient.addName().addGiven("John").setFamily("Smith"); patient.getBirthDateElement().setValueAsString("1998-02-22"); // Parsing and encoding works the same way too String encoded = ctx.newJsonParser().encodeResourceToString(patient); // END SNIPPET: creatingContextHl7org }
public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); if (src.hasValue()) tgt.setValue(src.getValue()); copyElement(src, tgt); return tgt; }
/** * Creates a new instance by parsing an HL7 v3 format date time string */ public static DateType parseV3(String theV3String) { DateType retVal = new DateType(); retVal.setValueAsV3String(theV3String); return retVal; }
public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException { org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); copyElement(src, tgt); return tgt; }
public ValueSetComposeComponent copy() { ValueSetComposeComponent dst = new ValueSetComposeComponent(); copyValues(dst); dst.lockedDate = lockedDate == null ? null : lockedDate.copy(); dst.inactive = inactive == null ? null : inactive.copy(); if (include != null) { dst.include = new ArrayList<ConceptSetComponent>(); for (ConceptSetComponent i : include) dst.include.add(i.copy()); }; if (exclude != null) { dst.exclude = new ArrayList<ConceptSetComponent>(); for (ConceptSetComponent i : exclude) dst.exclude.add(i.copy()); }; return dst; }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); // Add an extension on the resource pat.addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-importance") .setValue(new CodeableConcept().setText("Patient is a VIP")); // Add an extension on a primitive pat.getBirthDateElement().setValueAsString("1955-02-22"); pat.getBirthDateElement().addExtension() .setUrl("http://hl7.org/fhir/StructureDefinition/patient-birthTime") .setValue(new TimeType("23:30")); IParser parser = FhirContext.forDstu3().newJsonParser().setPrettyPrint(true); System.out.println(parser.encodeResourceToString(pat)); } }
public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); copyElement(src, tgt); return tgt; }
public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); if (src.hasValue()) tgt.setValue(src.getValue()); copyElement(src, tgt); return tgt; }
public Basic copy() { Basic dst = new Basic(); copyValues(dst); if (identifier != null) { dst.identifier = new ArrayList<Identifier>(); for (Identifier i : identifier) dst.identifier.add(i.copy()); }; dst.code = code == null ? null : code.copy(); dst.subject = subject == null ? null : subject.copy(); dst.created = created == null ? null : created.copy(); dst.author = author == null ? null : author.copy(); return dst; }
private void checkDateOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { Element v = answer.getNamedChild("valueDate"); NodeStack ns = stack.push(v, -1, null, null); if (qItem.getOption().size() > 0) { List<DateType> list = new ArrayList<DateType>(); for (QuestionnaireItemOptionComponent components : qItem.getOption()) { try { list.add(components.getValueDateType()); } catch (FHIRException e) { // If it's the wrong type, just keep going } } if (list.isEmpty() && !openChoice) { rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type date"); } else { boolean found = false; for (DateType item : list) { if (item.getValue().equals(v.primitiveValue())) { found = true; break; } } if (!found) { rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The date "+v.primitiveValue()+" is not a valid option"); } } } else hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate date answer option because no option list is provided"); }
public static void main(String[] args) { // START SNIPPET: usage // Create a context. Note that we declare the custom types we'll be using // on the context before actually using them FhirContext ctx = FhirContext.forDstu3(); ctx.registerCustomType(CustomResource.class); ctx.registerCustomType(CustomDatatype.class); // Now let's create an instance of our custom resource type // and populate it with some data CustomResource res = new CustomResource(); // Add some values, including our custom datatype DateType value0 = new DateType("2015-01-01"); res.getTelevision().add(value0); CustomDatatype value1 = new CustomDatatype(); value1.setDate(new DateTimeType(new Date())); value1.setKittens(new StringType("FOO")); res.getTelevision().add(value1); res.setDogs(new StringType("Some Dogs")); // Now let's serialize our instance String output = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(res); System.out.println(output); // END SNIPPET: usage }
public AccidentComponent copy() { AccidentComponent dst = new AccidentComponent(); copyValues(dst); dst.date = date == null ? null : date.copy(); dst.type = type == null ? null : type.copy(); dst.location = location == null ? null : location.copy(); return dst; }
/** * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage. */ public Date getApprovalDate() { return this.approvalDate == null ? null : this.approvalDate.getValue(); }
private List<Base> funcToday(ExecutionContext context, List<Base> focus, ExpressionNode exp) { List<Base> result = new ArrayList<Base>(); result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY)); return result; }
public AccidentComponent copy() { AccidentComponent dst = new AccidentComponent(); copyValues(dst); dst.date = date == null ? null : date.copy(); dst.type = type == null ? null : type.copy(); dst.location = location == null ? null : location.copy(); return dst; }