org.hl7.fhir.r4.model.Identifier Java Examples

The following examples show how to use org.hl7.fhir.r4.model.Identifier. 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: TestData.java    From bunsen with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a FHIR Observation for testing purposes.
 */
public static Observation newObservation() {

  // Observation based on https://www.hl7.org/FHIR/observation-example-bloodpressure.json.html
  Observation observation = new Observation();

  observation.setId("blood-pressure");

  Identifier identifier = observation.addIdentifier();
  identifier.setSystem("urn:ietf:rfc:3986");
  identifier.setValue("urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281");

  observation.setStatus(Observation.ObservationStatus.FINAL);

  Quantity quantity = new Quantity();
  quantity.setValue(new java.math.BigDecimal("123.45"));
  quantity.setUnit("mm[Hg]");
  observation.setValue(quantity);

  return observation;
}
 
Example #2
Source File: daoutilsR4.java    From careconnect-reference-implementation with Apache License 2.0 6 votes vote down vote up
public static Identifier getIdentifier(BaseIdentifier baseIdentifier, Identifier identifier) {
    if (baseIdentifier.getSystem() != null) identifier.setSystem(baseIdentifier.getSystem().getUri());
    if (baseIdentifier.getValue() != null) identifier.setValue(baseIdentifier.getValue());
    if (baseIdentifier.getUse() != null) {
        identifier.setUse(LibDaoR4.convertIdentifier(baseIdentifier.getIdentifierUse()));

    }
    if (baseIdentifier.getIdentifierType() != null) {
        identifier.getType()
                .addCoding()
                    .setCode(baseIdentifier.getIdentifierType().getCode())
                    .setDisplay(baseIdentifier.getIdentifierType().getDisplay())
                    .setSystem(baseIdentifier.getIdentifierType().getSystem());
    }
    return identifier;
}
 
Example #3
Source File: CodeSystemUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void setOID(CodeSystem cs, String oid) {
  if (!oid.startsWith("urn:oid:"))
     oid = "urn:oid:" + oid;
  if (!cs.hasIdentifier())
    cs.addIdentifier(new Identifier().setSystem("urn:ietf:rfc:3986").setValue(oid));
  else if ("urn:ietf:rfc:3986".equals(cs.getIdentifierFirstRep().getSystem()) && cs.getIdentifierFirstRep().hasValue() && cs.getIdentifierFirstRep().getValue().startsWith("urn:oid:"))
    cs.getIdentifierFirstRep().setValue(oid);
  else
    throw new Error("unable to set OID on code system");
  
}
 
Example #4
Source File: FhirChCrlDocumentBundle.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private void fixAhvIdentifier(Patient subject){
	List<Identifier> identifiers = subject.getIdentifier();
	Optional<Identifier> ahvIdentifier = identifiers.stream()
		.filter(id -> id.getSystem().equals(XidConstants.DOMAIN_AHV)).findFirst();
	subject.getIdentifier().clear();
	ahvIdentifier.ifPresent(ahvId -> {
		Identifier identifier = new Identifier();
		identifier.setSystem("urn:oid:2.16.756.5.32");
		identifier.setValue(ahvId.getValue());
		subject.addIdentifier(identifier);
	});
}
 
Example #5
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Selective support for mapping incoming identifiers. Currently only accepts
 * AHV Number
 * 
 * @param source
 * @param target
 */
private void mapIdentifiers(Patient source, IPatient target) {
	// id must not be mapped (not updateable)
	// patientNumber must not be mapped (not updateable)
	List<Identifier> identifiers = source.getIdentifier();
	for (Identifier identifier : identifiers) {
		if (XidConstants.CH_AHV.equals(identifier.getSystem())) {
			target.addXid(XidConstants.CH_AHV, identifier.getValue(), true);
		}
	}
}
 
Example #6
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private void mapIdentifiersAndPatientNumber(IPatient source, Patient target) {
	List<Identifier> identifiers = contactHelper.getIdentifiers(source);
	identifiers.add(getElexisObjectIdentifier(source));
	String patNr = source.getPatientNr();
	Identifier identifier = new Identifier();
	identifier.setSystem(IdentifierSystem.ELEXIS_PATNR.getSystem());
	identifier.setValue(patNr);
	identifiers.add(identifier);
	target.setIdentifier(identifiers);
}
 
Example #7
Source File: IContactHelper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public List<Identifier> getIdentifiers(IContact contact){
	List<Identifier> ret = new ArrayList<>();
	List<IXid> xids = xidService.getXids(contact);
	for (IXid xid : xids) {
		Identifier identifier = new Identifier();
		identifier.setSystem(xid.getDomain());
		identifier.setValue(xid.getDomainId());
		ret.add(identifier);
	}
	return ret;
}
 
Example #8
Source File: PractitionerIMandatorTransformer.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Optional<Practitioner> getFhirObject(IMandator localObject,SummaryEnum summaryEnum, Set<Include> includes){
	Practitioner practitioner = new Practitioner();
	
	practitioner.setId(new IdDt("Practitioner", localObject.getId()));
	
	List<Identifier> identifiers = contactHelper.getIdentifiers(localObject);
	identifiers.add(getElexisObjectIdentifier(localObject));
	practitioner.setIdentifier(identifiers);
	
	if (localObject.isPerson()) {
		IPerson mandatorPerson = modelService.load(localObject.getId(), IPerson.class).get();
		practitioner.setName(contactHelper.getHumanNames(mandatorPerson));
		practitioner.setGender(contactHelper.getGender(mandatorPerson.getGender()));
		practitioner.setBirthDate(contactHelper.getBirthDate(mandatorPerson));
		
		INamedQuery<IUser> query = modelService.getNamedQuery(IUser.class, "kontakt");
		List<IUser> usersLocal =
			query.executeWithParameters(query.getParameterMap("kontakt", mandatorPerson));
		if (!usersLocal.isEmpty()) {
			practitioner.setActive(usersLocal.get(0).isActive());
		}
	}
	
	practitioner.setAddress(contactHelper.getAddresses(localObject));
	practitioner.setTelecom(contactHelper.getContactPoints(localObject));
	
	return Optional.of(practitioner);
}
 
Example #9
Source File: HQMFProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
private Identifier getIdentifierFor(CqfMeasure m, String identifierCode) {
    for (Identifier i : m.getIdentifier())
    {
        if (i.hasType())
        {
            if(i.getType().getCodingFirstRep().getCode().equalsIgnoreCase(identifierCode)) 
            {
                return i;
            }
        }
    }

    return null;
}
 
Example #10
Source File: HQMFProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
private String resolveSetId(CqfMeasure m) {
    Identifier id = this.getIdentifierFor(m, "hqmf-set-id");
    if (id != null && id.hasValue() && !id.getValue().isEmpty()) {
        return id.getValue();
    }
    
    return m.getName();
}
 
Example #11
Source File: FhirR4.java    From synthea with Apache License 2.0 5 votes vote down vote up
private static Identifier generateIdentifier(String uid) {
  Identifier identifier = new Identifier();
  identifier.setUse(Identifier.IdentifierUse.OFFICIAL);
  identifier.setSystem("urn:ietf:rfc:3986");
  identifier.setValue("urn:oid:" + uid);
  return identifier;
}
 
Example #12
Source File: ValueSetUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #13
Source File: ValueSetUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static String getOID(ValueSet vs) {
  for (Identifier id : vs.getIdentifier()) {
    if ("urn:ietf:rfc:3986".equals(id.getSystem()) && id.hasValue() && id.getValue().startsWith("urn:oid:"))
      return id.getValue().substring(8);
  }
  return null;
}
 
Example #14
Source File: IdentifierBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public IdentifierBuilder() {
    super(new Identifier());
}
 
Example #15
Source File: IdentifierBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public IdentifierBuilder buildUse(Identifier.IdentifierUse use) {
    complexProperty.setUse(use);
    return this;
}
 
Example #16
Source File: IdentifierBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public IdentifierBuilder buildUse(String use) throws FHIRException {
    complexProperty.setUse(Identifier.IdentifierUse.fromCode(use));
    return this;
}
 
Example #17
Source File: ReferenceBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ReferenceBuilder buildIdentifier(Identifier identifier) {
    complexProperty.setIdentifier(identifier);
    return this;
}
 
Example #18
Source File: IFhirTransformer.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
default Identifier getElexisObjectIdentifier(Identifiable dbObject) {
	Identifier identifier = new Identifier();
	identifier.setSystem(IdentifierSystem.ELEXIS_OBJID.getSystem());
	identifier.setValue(dbObject.getId());
	return identifier;
}
 
Example #19
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
public static void addIdentifier(Element element, Identifier value) {
  element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true));       
}
 
Example #20
Source File: IPatientPatientAttributeMapper.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
private Identifier getElexisObjectIdentifier(Identifiable dbObject) {
	Identifier identifier = new Identifier();
	identifier.setSystem(IdentifierSystem.ELEXIS_OBJID.getSystem());
	identifier.setValue(dbObject.getId());
	return identifier;
}
 
Example #21
Source File: ObjectConverter.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
public static Identifier readAsIdentifier(Element item) {
  Identifier r = new Identifier();
  r.setSystem(item.getNamedChildValue("system"));
  r.setValue(item.getNamedChildValue("value"));
  return r;
}