private Identifier readAsIdentifier(Element item) { Identifier r = new Identifier(); r.setSystem(item.getNamedChildValue("system")); r.setValue(item.getNamedChildValue("value")); return r; }
patient.addIdentifier().setSystem("urn:mrns").setValue("12345"); patient.addName().setFamily("Smith").addGiven("Tester").addGiven("Q");
p.addIdentifier().setSystem("urn:foo:identifiers").setValue("12345"); p.addTelecom().setSystem(ContactPointSystem.PHONE).setValue("416 123-4567");
@Read() public Patient getResourceById(@IdParam IdType theId) { Patient retVal = new Patient(); // ...populate... retVal.addIdentifier().setSystem("urn:mrns").setValue("12345"); retVal.addName().setFamily("Smith").addGiven("Tester").addGiven("Q"); // ...etc... // if you know the version ID of the resource, you should set it and HAPI will // include it in a Content-Location header retVal.setId(new IdType("Patient", "123", "2")); return retVal; } //END SNIPPET: read
public org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); copyElement(src, tgt); tgt.setUse(convertIdentifierUse(src.getUse())); tgt.setType(convertCodeableConcept(src.getType())); tgt.setSystem(src.getSystem()); tgt.setValue(src.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); tgt.setAssigner(convertReference(src.getAssigner())); return tgt; }
public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); copyElement(src, tgt); tgt.setUse(convertIdentifierUse(src.getUse())); tgt.setType(convertCodeableConcept(src.getType())); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasValue()) tgt.setValue(src.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); tgt.setAssigner(convertReference(src.getAssigner())); return tgt; }
patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135");
public static void setOID(ValueSet vs, String oid) { if (!oid.startsWith("urn:oid:")) oid = "urn:oid:" + oid; for (Identifier id : vs.getIdentifier()) { if ("urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:")) { id.setValue(oid); return; } } vs.addIdentifier().setSystem("urn:ietf:rfc:3986").setValue(oid); }
public static Identifier readAsIdentifier(Element item) { Identifier r = new Identifier(); r.setSystem(item.getNamedChildValue("system")); r.setValue(item.getNamedChildValue("value")); return r; }
private Identifier readAsIdentifier(Element item) { Identifier r = new Identifier(); r.setSystem(item.getNamedChildValue("system")); r.setValue(item.getNamedChildValue("value")); return r; }
public static void main(String[] theArgs) { // Create a resource instance Patient pat = new Patient(); // Add a "name" element HumanName name = pat.addName(); name.setFamily("Simpson").addGiven("Homer").addGiven("J"); // Add an "identifier" element Identifier identifier = pat.addIdentifier(); identifier.setSystem("http://acme.org/MRNs").setValue("7000135"); // Model is designed to be chained pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("12345"); } }
public static void setOID(CodeSystem cs, String oid) { if (!oid.startsWith("urn:oid:")) oid = "urn:oid:" + oid; if (!cs.hasIdentifier()) cs.setIdentifier(new Identifier().setSystem("urn:ietf:rfc:3986").setValue(oid)); else if ("urn:ietf:rfc:3986".equals(cs.getIdentifier().getSystem()) && cs.getIdentifier().hasValue() && cs.getIdentifier().getValue().startsWith("urn:oid:")) cs.getIdentifier().setValue(oid); else throw new Error("unable to set OID on code system"); }
public static void main(String[] theArgs) { // Create a resource instance Patient pat = new Patient(); // Add a "name" element HumanName name = pat.addName(); name.setFamily("Simpson").addGiven("Homer").addGiven("J"); // Add an "identifier" element Identifier identifier = pat.addIdentifier(); identifier.setSystem("http://acme.org/MRNs").setValue("7000135"); // Model is designed to be chained pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("12345"); } }
public static void main(String[] args) { // Create an encounter with an invalid status and no class Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("Jay"); pat.addAddress().addLine("342 Evergreen Terrace").addLine("Springfield"); pat.addIdentifier().setSystem("http://acme.org/mrns").setValue("12345"); // Create a new context and enable the narrative generator FhirContext ctx = FhirContext.forDstu2(); ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator()); String res = ctx.newJsonParser().setPrettyPrint(true).encodeResourceToString(pat); System.out.println(res); }
public static void main(String[] theArgs) { // Create a Patient Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); pat.addTelecom().setUse(ContactPointUse.HOME).setSystem(ContactPointSystem.PHONE).setValue("1 (416) 340-4800"); pat.setGender(AdministrativeGender.MALE); // Create a context FhirContext ctx = FhirContext.forDstu3(); // Create a JSON parser IParser parser = ctx.newJsonParser(); parser.setPrettyPrint(true); String encode = parser.encodeResourceToString(pat); System.out.println(encode); } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); // Enumerated types are provided for many coded elements ContactPoint contact = pat.addTelecom(); contact.setUse(ContactPoint.ContactPointUse.HOME); contact.setSystem(ContactPoint.ContactPointSystem.PHONE); contact.setValue("1 (416) 340-4800"); pat.setGender(Enumerations.AdministrativeGender.MALE); } }
public static void main(String[] theArgs) { Patient pat = new Patient(); pat.addName().setFamily("Simpson").addGiven("Homer").addGiven("J"); pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135"); // Enumerated types are provided for many coded elements ContactPoint contact = pat.addTelecom(); contact.setUse(ContactPoint.ContactPointUse.HOME); contact.setSystem(ContactPoint.ContactPointSystem.PHONE); contact.setValue("1 (416) 340-4800"); pat.setGender(Enumerations.AdministrativeGender.MALE); } }
public org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); copyElement(src, tgt); tgt.setUse(convertIdentifierUse(src.getUse())); tgt.setType(convertCodeableConcept(src.getType())); tgt.setSystem(src.getSystem()); tgt.setValue(src.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); tgt.setAssigner(convertReference(src.getAssigner())); return tgt; }
public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); copyElement(src, tgt); tgt.setUse(convertIdentifierUse(src.getUse())); tgt.setType(convertCodeableConcept(src.getType())); if (src.hasSystem()) tgt.setSystem(src.getSystem()); if (src.hasValue()) tgt.setValue(src.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); tgt.setAssigner(convertReference(src.getAssigner())); return tgt; }