Java Code Examples for org.hl7.fhir.dstu3.model.Identifier#setSystem()

The following examples show how to use org.hl7.fhir.dstu3.model.Identifier#setSystem() . 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: EncounterAccessor.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
public void setConsultationId(DomainResource resource, String consultationId) {
	org.hl7.fhir.dstu3.model.Encounter fhirEncounter = (org.hl7.fhir.dstu3.model.Encounter) resource;
	boolean identifierFound = false;
	List<Identifier> existing = fhirEncounter.getIdentifier();
	for (Identifier existingIdentifier : existing) {
		if (IdentifierSystem.ELEXIS_CONSID.getSystem().equals(existingIdentifier.getSystem())) {
			existingIdentifier.setValue(consultationId);
			identifierFound = true;
			break;
		}
	}
	if (!identifierFound) {
		Identifier identifier = fhirEncounter.addIdentifier();
		identifier.setSystem(IdentifierSystem.ELEXIS_CONSID.getSystem());
		identifier.setValue(consultationId);
	}
}
 
Example 3
Source File: Convert.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public Identifier makeIdentifierFromII(Element e) throws Exception {
	Identifier id = new Identifier();
	String r = e.getAttribute("root");
	String ex;
	if (e.hasAttribute("extension") && Utilities.noString(e.getAttribute("extension"))) {
		if (generateMissingExtensions) 
			ex = UUID.randomUUID().toString();
		else
			throw new Exception("Broken identifier - extension is blank");
	} else 
		ex = e.getAttribute("extension");
     
	if (Utilities.noString(ex)) {
		id.setSystem("urn:ietf:rfc:3986");
		if (isGuid(r)) 
			id.setValue("urn:uuid:"+r);
		else if (UriForOid(r) != null)
			id.setValue(UriForOid(r));
		else 
			id.setValue(UriForOid(r));
	} else {
		if (isGuid(r)) 
			id.setSystem("urn:uuid:"+r);
		else if (UriForOid(r) != null)
			id.setSystem(UriForOid(r));
		else 
			id.setSystem("urn:oid:"+r);
		id.setValue(ex);
	}
	return id;
}
 
Example 4
Source File: TestData.java    From bunsen with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a new Observation for testing.
 *
 * @return a FHIR Observation for testing.
 */
public static Observation newObservation() {
  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);

  CodeableConcept obsCode = new CodeableConcept();

  observation.setCode(obsCode);

  Quantity quantity = new Quantity();
  quantity.setValue(new java.math.BigDecimal("123.45"));
  quantity.setUnit("mm[Hg]");
  quantity.setSystem("http://unitsofmeasure.org");
  observation.setValue(quantity);

  ObservationComponentComponent component = observation.addComponent();

  CodeableConcept code = new CodeableConcept()
      .addCoding(new Coding()
          .setCode("abc")
          .setSystem("PLACEHOLDER"));

  component.setCode(code);

  return observation;
}
 
Example 5
Source File: daoutils.java    From careconnect-reference-implementation with Apache License 2.0 5 votes vote down vote up
public static Identifier getIdentifierStrict(BaseIdentifier2 baseIdentifier, Identifier identifier) {
    if (baseIdentifier.getSystem() != null) identifier.setSystem(baseIdentifier.getSystemValue());
    if (baseIdentifier.getValue() != null) identifier.setValue(baseIdentifier.getValue());
    if (baseIdentifier.getUse() != null) {
        identifier.setUse(baseIdentifier.getIdentifierUse());
    }

    return identifier;
}
 
Example 6
Source File: daoutils.java    From careconnect-reference-implementation with Apache License 2.0 5 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(baseIdentifier.getIdentifierUse());
    }
    if (baseIdentifier.getIdentifierType() != null) {
        identifier.getType()
                .addCoding()
                    .setCode(baseIdentifier.getIdentifierType().getCode())
                    .setDisplay(baseIdentifier.getIdentifierType().getDisplay())
                    .setSystem(baseIdentifier.getIdentifierType().getSystem());
    }
    return identifier;
}
 
Example 7
Source File: ClaimProcessApp.java    From net.jgp.labs.spark with Apache License 2.0 5 votes vote down vote up
@Override
public void call(Row r) throws Exception {

  // Build the claim
  // ---------------

  // CLIENT_ID ....... 0
  // CLIENT_SUB_ID ... 1
  // CLAIM_SK ........ 2
  // CLAIM_NBR ....... 3
  // CLAIM_ADJ_CD,ADJ_FROM_CLAIM_SK,ADJ_FROM_CLAIM_NBR,ADJ_FROM_CLAIM_ADJ_NBR,CLAIM_STS_CD_SK,CLAIM_STS_CD,SYS_SUBSC_SK,SYS_SUBSC_ID,SYS_MBR_SK,SYS_MBR_ID,CLIENT_HIERARCHY_LVL1,CLIENT_HIERARCHY_LVL2,CLIENT_HIERARCHY_LVL3,CLIENT_HIERARCHY_LVL4,MBR_PCP_SK,MBR_PCP_NBR,PROV_SK,PROV_ID,PROV_TP_CD_SK,PROV_TP_CD,PAYEE_SK,PAYEE_ID,PAYEE_TIN,APPROVE_DAY_AMT,ACTUAL_DAY_AMT,CLAIM_BEG_SVC_DT,RECEIVE_DT,PAY_DT,DRG_CD_SK,DRG_CD,SUBMIT_DRG_CD_SK,SUBMIT_DRG_CD,BILL_CLASS_CD,FACILITY_TP_CD,HOSP_FREQ_CD,ADMIT_SRC_CD_SK,ADMIT_SRC_CD,ADMIT_TP_CD_SK,ADMIT_TP_CD,HOSP_ADMIT_DT,HOSP_ADMIT_HR,HOSP_DISCHARGE_DT,HOSP_DISCHARGE_HR,HOSP_DISCHARGE_STS_CD_SK,HOSP_DISCHARGE_STS_CD,ATTENDING_PROV_SK,ATTENDING_PROV_ID,PROV_ADDR_CD_SK,PROV_ADDR_CD,OOA_IND,EDI_REF_ID,CURRENT_IND,SENSTV_DRG_IND,CLIENT_SPECIFIC_TXT1,CLIENT_SPECIFIC_TXT2,CLIENT_SPECIFIC_TXT3,CLIENT_SPECIFIC_TXT4,CLIENT_SPECIFIC_TXT5,CLIENT_SPECIFIC_TXT6,CLIENT_SPECIFIC_TXT7,CLIENT_SPECIFIC_TXT8,CLIENT_SPECIFIC_TXT9,CLIENT_SPECIFIC_TXT10,REC_LOAD_DTTM,REC_LAST_UPD_DTTM,REC_DEL_IND,DRG_CODE_TP_CD,SUBMIT_DRG_CODE_TP_CD,QA_CURRENT_IND
  CodeableConcept cc = new CodeableConcept();
  cc.setUserData("value", r.getString(3)); // TODO check that this is how
                                           // this valued is set here

  Identifier i = new Identifier();
  i.setUse(IdentifierUse.OFFICIAL);
  i.setType(cc);
  i.setSystem("Payer Specific	 Claim Number");
  i.setValue(r.getAs("CLAIM_NBR"));
  // TODO i.setAssigner(value);

  List<Identifier> identifiers = new ArrayList<>();
  identifiers.add(i);

  Claim c = new Claim();
  c.setIdentifier(identifiers);

  // Process/send the claim
  // ----------------------

  // TODO
}
 
Example 8
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;
}
 
Example 9
Source File: LoincToDEConvertor.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private void processLoincCodes() {
	Element row = XMLUtil.getFirstChild(xml.getDocumentElement());
	int i = 0;
	while (row != null) {
		i++;
		if (i % 1000 == 0)
			System.out.print(".");
			String code = col(row, "LOINC_NUM");
			String comp = col(row, "COMPONENT");
			DataElement de = new DataElement();
			de.setId("loinc-"+code);
	    de.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
			bundle.getEntry().add(new BundleEntryComponent().setResource(de));
			Identifier id = new Identifier();
			id.setSystem("http://hl7.org/fhir/commondataelement/loinc");
			id.setValue(code);
			de.addIdentifier(id);
			de.setPublisher("Regenstrief + FHIR Project Team");
			if (!col(row, "STATUS").equals("ACTIVE"))
 				de.setStatus(PublicationStatus.DRAFT); // till we get good at this
			else
				de.setStatus(PublicationStatus.RETIRED);
			de.setDateElement(DateTimeType.now());
			de.setName(comp);
			ElementDefinition dee = de.addElement();

			// PROPERTY	ignore
			// TIME_ASPCT	
			// SYSTEM	
			// SCALE_TYP	
			// METHOD_TYP	
			// dee.getCategory().add(new CodeableConcept().setText(col(row, "CLASS")));
			// SOURCE	
			// DATE_LAST_CHANGED - should be in ?	
			// CHNG_TYPE	
			dee.setComment(col(row , "COMMENTS"));
			if (hasCol(row, "CONSUMER_NAME"))
				dee.addAlias(col(row, "CONSUMER_NAME"));	
			// MOLAR_MASS	
			// CLASSTYPE	
			// FORMULA	
			// SPECIES	
			// EXMPL_ANSWERS	
			// ACSSYM	
			// BASE_NAME - ? this is a relationship	
			// NAACCR_ID	
			// ---------- CODE_TABLE todo	
			// SURVEY_QUEST_TEXT	
			// SURVEY_QUEST_SRC	
			if (hasCol(row, "RELATEDNAMES2")) {
        String n = col(row, "RELATEDNAMES2");
        for (String s : n.split("\\;")) {
					if (!Utilities.noString(s))
						dee.addAlias(s);	
        }
			}
			dee.addAlias(col(row, "SHORTNAME"));	
			// ORDER_OBS	
			// CDISC Code	
			// HL7_FIELD_SUBFIELD_ID	
			//  ------------------ EXTERNAL_COPYRIGHT_NOTICE todo	
			dee.setDefinition(col(row, "LONG_COMMON_NAME"));	
			// HL7_V2_DATATYPE	
			String cc = makeType(col(row, "HL7_V3_DATATYPE"), code);
			if (cc != null)
			  dee.addType().setCode(cc);	
			// todo... CURATED_RANGE_AND_UNITS	
			// todo: DOCUMENT_SECTION	
			// STATUS_REASON	
			// STATUS_TEXT	
			// CHANGE_REASON_PUBLIC	
			// COMMON_TEST_RANK	
			// COMMON_ORDER_RANK	
			// COMMON_SI_TEST_RANK	
			// HL7_ATTACHMENT_STRUCTURE

			// units:
			// UNITSREQUIRED	
			// SUBMITTED_UNITS
			ToolingExtensions.setAllowableUnits(dee, makeUnits(col(row, "EXAMPLE_UNITS"), col(row, "EXAMPLE_UCUM_UNITS")));
			// EXAMPLE_SI_UCUM_UNITS	
		
		row = XMLUtil.getNextSibling(row);
	}
	System.out.println("done");
}