public HumanName makeNameFromEN(Element e) { if (e == null) return null; HumanName hn = new HumanName(); String use = e.getAttribute("use"); if (use != null) {
private static Patient createPatient(final String name) { final Patient patient = new Patient(); patient.getName().add(new HumanName().setFamily(name)); patient.setId(createId(counter, 1L)); counter++; return patient; }
public HumanName addName() { //3 HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; }
public HumanName addName() { //3 HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; }
public HumanName addName() { //3 HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; }
HumanName t = new HumanName(); if (this.name == null) this.name = new ArrayList<HumanName>(); this.name.add(t); return t; } public Practitioner addName(HumanName t) { //3
public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); if (src.hasText()) tgt.setText(src.getText()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
/** * @return {@link #name} (A name associated with the contact.) */ public HumanName getName() { if (this.name == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create OrganizationContactComponent.name"); else if (Configuration.doAutoCreate()) this.name = new HumanName(); // cc return this.name; }
/** * @return {@link #name} (A name associated with the contact person.) */ public HumanName getName() { if (this.name == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create ContactComponent.name"); else if (Configuration.doAutoCreate()) this.name = new HumanName(); // cc return this.name; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("purpose")) { this.purpose = new CodeableConcept(); return this.purpose; } else if (name.equals("name")) { this.name = new HumanName(); return this.name; } else if (name.equals("telecom")) { return addTelecom(); } else if (name.equals("address")) { this.address = new Address(); return this.address; } else return super.addChild(name); }
/** * @param patientName - * @return fhir human name object for the patient. */ static private HumanName createHumanName( final String patientName ) { final Collection<String> prefixes = Arrays.asList( "Dr. ", "Mr. ", "Mrs. ", "Miss ", "Ms. ", "Sir " ); final HumanName humanName = new HumanName(); humanName.setUse( HumanName.NameUse.USUAL ); String fullName = patientName; for ( String prefix : prefixes ) { if ( patientName.startsWith( prefix ) ) { humanName.addPrefix( prefix ); fullName = patientName.substring( prefix.length() + 1 ); break; } } final int spaceIndex = fullName.indexOf( ' ' ); if ( spaceIndex > 0 ) { humanName.setFamily( fullName.substring( spaceIndex + 1 ) ); humanName.addGiven( fullName.substring( 0, spaceIndex ) ); } else { humanName.addGiven( fullName ); } return humanName; }
public HumanName makeNameFromEN(Element e) { if (e == null) return null; HumanName hn = new HumanName(); String use = e.getAttribute("use"); if (use != null) {
@Override public Base addChild(String name) throws FHIRException { if (name.equals("relationship")) { return addRelationship(); } else if (name.equals("name")) { this.name = new HumanName(); return this.name; } else if (name.equals("telecom")) { return addTelecom(); } else if (name.equals("address")) { this.address = new Address(); return this.address; } else if (name.equals("gender")) { throw new FHIRException("Cannot call addChild on a primitive type Patient.gender"); } else if (name.equals("organization")) { this.organization = new Reference(); return this.organization; } else if (name.equals("period")) { this.period = new Period(); return this.period; } else return super.addChild(name); }
public HumanName copy() { HumanName dst = new HumanName(); copyValues(dst); dst.use = use == null ? null : use.copy(); dst.text = text == null ? null : text.copy(); dst.family = family == null ? null : family.copy(); if (given != null) { dst.given = new ArrayList<StringType>(); for (StringType i : given) dst.given.add(i.copy()); }; if (prefix != null) { dst.prefix = new ArrayList<StringType>(); for (StringType i : prefix) dst.prefix.add(i.copy()); }; if (suffix != null) { dst.suffix = new ArrayList<StringType>(); for (StringType i : suffix) dst.suffix.add(i.copy()); }; dst.period = period == null ? null : period.copy(); return dst; }
@Override public HumanName deserialize(String value) { String pcs[] = value.split("\\" + NAME_DELIM); HumanName result = new HumanName(); int i = 0; if ((value = getComponent(pcs, i++)) != null) { result.setFamily(value); } if ((value = getComponent(pcs, i++)) != null) { result.addGiven(value); } if ((value = getComponent(pcs, i++)) != null) { result.addGiven(value); } if ((value = getComponent(pcs, i++)) != null) { result.addSuffix(value); } if ((value = getComponent(pcs, i++)) != null) { result.addPrefix(value); } if ((value = getComponent(pcs, i++)) != null) { result.addSuffix(value); } if ((value = getComponent(pcs, i++)) != null) { result.getUseElement().setValueAsString(value.toLowerCase()); } return result; }
/** * @return Practitioner representation as the creator/extractor of data */ default Practitioner createPractitioner() { final HumanName name = new HumanName(); name.setUse( HumanName.NameUse.OFFICIAL ); name.setFamily( getFamilyName() ); name.addGiven( getName() ); final ContactPoint contact = new ContactPoint(); contact.setSystem( ContactPoint.ContactPointSystem.EMAIL ); contact.setValue( getContactEmail() ); contact.setUse( ContactPoint.ContactPointUse.WORK ); final Practitioner practitioner = new Practitioner(); String hostname; try { hostname = InetAddress.getLocalHost() .getHostName(); } catch ( UnknownHostException uhE ) { hostname = "UnknownHost"; } practitioner.setId( getFamilyName() + DIVIDER_CHAR + getName() + DIVIDER_CHAR + getVersion() + DIVIDER_CHAR + hostname ); practitioner.setActive( true ); practitioner.addName( name ); practitioner.addTelecom( contact ); return practitioner; }
public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); tgt.setText(src.getText()); for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); copyElement(src, tgt); tgt.setUse(convertNameUse(src.getUse())); if (src.hasText()) tgt.setText(src.getText()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) tgt.setFamily(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) tgt.addGiven(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) tgt.addPrefix(t.getValue()); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) tgt.addSuffix(t.getValue()); tgt.setPeriod(convertPeriod(src.getPeriod())); return tgt; }
@Test public void test() { NameSerializer ns = new NameSerializer(); HumanName name = new HumanName(); name.setFamily("Martin"); name.addGiven("Douglas"); name.addGiven("Kent"); name.addPrefix("Dr."); name.addSuffix("M.D."); name.getUseElement().setValue(NameUse.OFFICIAL); String s = ns.serialize(name); System.out.println(s); HumanName name2 = ns.deserialize(s); assertEquals(name.getFamily(), name2.getFamily()); assertListEquals(name.getGiven(), name2.getGiven()); assertListEquals(name.getPrefix(), name2.getPrefix()); assertListEquals(name.getSuffix(), name2.getSuffix()); assertEquals(name.getUse(), name2.getUse()); }