private Identifier readAsIdentifier(Element item) { Identifier r = new Identifier(); r.setSystem(item.getNamedChildValue("system")); r.setValue(item.getNamedChildValue("value")); return r; }
Element identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier"); vs.setPublisher(identifier.getAttribute("authority")); vs.addIdentifier(new Identifier().setValue(identifier.getAttribute("uid"))); List<Element> authors = new ArrayList<Element>(); XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors); identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier"); cs.setPublisher(identifier.getAttribute("authority")); cs.setIdentifier(new Identifier().setValue(identifier.getAttribute("uid"))); cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH); authors = new ArrayList<Element>();
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 void clientRead() { //START SNIPPET: clientReadTags IPatientClient client = FhirContext.forDstu2().newRestfulClient(IPatientClient.class, "http://foo/fhir"); Patient patient = client.readPatient(new IdType("1234")); // Access the tag list List<Coding> tagList = patient.getMeta().getTag(); for (Coding next : tagList) { // ..process the tags somehow.. } //END SNIPPET: clientReadTags //START SNIPPET: clientCreateTags Patient newPatient = new Patient(); // Populate the resource object newPatient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setValue("123"); newPatient.addName().setFamily("Jones").addGiven("Frank"); // Populate some tags newPatient.getMeta().addTag("http://animals", "Dog", "Canine Patient"); // TODO: more realistic example newPatient.getMeta().addTag("http://personality", "Friendly", "Friendly"); // TODO: more realistic example // ...invoke the create method on the client... //END SNIPPET: clientCreateTags }
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");
/** * Sets the MRN criterion. * * @param mrn MRN. */ public void setMRN(String mrn) { this.mrn = new Identifier(); this.mrn.setType(FhirTerminology.IDENT_MRN); this.mrn.setValue(mrn); }
/** * Sets the SSN criterion. * * @param ssn SSN. */ public void setSSN(String ssn) { this.ssn = new Identifier(); this.ssn.setType(FhirTerminology.IDENT_SSN); this.ssn.setValue(ssn); }
/** * Sets the DEA criterion. * * @param dea DEA. */ public void setDEA(String dea) { this.dea = new Identifier(); this.dea.setType(FhirTerminology.IDENT_DEA); this.dea.setValue(dea); }
/** * Sets the SSN criterion. * * @param ssn SSN. */ public void setSSN(String ssn) { this.ssn = new Identifier(); this.ssn.setType(FhirTerminology.IDENT_SSN); this.ssn.setValue(ssn); }
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 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 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; }
protected AuditEvent.AuditEventSourceComponent auditSourceIdentificationToEventSource(AuditSourceIdentificationType asit) { AuditEvent.AuditEventSourceComponent source = new AuditEvent.AuditEventSourceComponent() .setSite(asit.getAuditEnterpriseSiteID()) .setIdentifier(new Identifier().setValue(asit.getAuditSourceID())); asit.getAuditSourceType().forEach(ast -> source.addType(codedValueTypeToCoding(ast))); return source; }
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); } }