org.hl7.fhir.dstu3.model.Identifier Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.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: EncounterAccessor.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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 #2
Source File: Example01_CreateAPatient.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 6 votes |
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"); }
Example #3
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void processSocialHistorySection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception { scanSection("Social History", section); int i = 0; for (Element c : cda.getChildren(section, "entry")) { Element o = cda.getChild(c, "observation"); Observation obs = new Observation(); obs.setId(context.baseId+"-smoking-"+(i == 0 ? "" : Integer.toString(i))); obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-smokingstatus-dafsmokingstatus"); i++; obs.setSubject(context.subjectRef); obs.setContext(new Reference().setReference("Encounter/"+context.encounter.getId())); obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), new Coding().setSystem("http://loinc.org").setCode("72166-2"))); boolean found = false; for (Element e : cda.getChildren(o, "id")) { Identifier id = convert.makeIdentifierFromII(e); obs.getIdentifier().add(convert.makeIdentifierFromII(e)); } if (!found) { obs.setStatus(ObservationStatus.FINAL); obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(o, "effectiveTime"))); obs.setValue(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "value")), null)); saveResource(obs, "-sh"); } } }
Example #4
Source File: Example01_CreateAPatient.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 6 votes |
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"); }
Example #5
Source File: SparkRowConverterTest.java From bunsen with Apache License 2.0 | 6 votes |
@Test public void testNestedReference() { Identifier practitionerIdentifier = testPatient.getGeneralPractitionerFirstRep().getIdentifier(); Row practitionerIdentifierRow = testPatientDataset .select(functions.explode(functions.col("generalpractitioner"))) .select("col.organizationId", "col.practitionerId", "col.identifier.id", "col.identifier.assigner.reference") .head(); Assert.assertEquals(practitionerIdentifier.getId(), practitionerIdentifierRow.get(2)); Assert.assertEquals(practitionerIdentifier.getAssigner().getReference(), practitionerIdentifierRow.get(3)); }
Example #6
Source File: TestData.java From bunsen with Apache License 2.0 | 6 votes |
/** * 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 #7
Source File: LibDaoR4.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
public static Identifier.IdentifierUse convertIdentifier(org.hl7.fhir.r4.model.Identifier.IdentifierUse use) { switch (use) { case OLD: case SECONDARY: return Identifier.IdentifierUse.SECONDARY; case NULL: return Identifier.IdentifierUse.NULL; case OFFICIAL: return Identifier.IdentifierUse.OFFICIAL; case TEMP: return Identifier.IdentifierUse.TEMP; case USUAL: return Identifier.IdentifierUse.USUAL; } return null; }
Example #8
Source File: LibDaoR4.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
public static org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifier(IdentifierUse use) { switch (use) { case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; case NULL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; } return null; }
Example #9
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private String displayIdentifier(Identifier ii) { String s = Utilities.noString(ii.getValue()) ? "??" : ii.getValue(); if (ii.hasType()) { if (ii.getType().hasText()) s = ii.getType().getText()+" = "+s; else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasDisplay()) s = ii.getType().getCoding().get(0).getDisplay()+" = "+s; else if (ii.getType().hasCoding() && ii.getType().getCoding().get(0).hasCode()) s = lookupCode(ii.getType().getCoding().get(0).getSystem(), ii.getType().getCoding().get(0).getCode())+" = "+s; } if (ii.hasUse()) s = s + " ("+ii.getUse().toString()+")"; return s; }
Example #10
Source File: daoutils.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
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 #11
Source File: LibDaoR4.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public BaseIdentifier setIdentifier(Identifier identifier, BaseIdentifier entityIdentifier) throws OperationOutcomeException { if (identifier.hasType()) { ConceptEntity code = conceptDao.findAddCode(identifier.getType().getCoding().get(0)); if (code != null) { entityIdentifier.setIdentifierType(code); } else { log.info("IdentifierType: Missing System/Code = " + identifier.getType().getCoding().get(0).getSystem() + " code = " + identifier.getType().getCoding().get(0).getCode()); throw new IllegalArgumentException("Missing System/Code = " + identifier.getType().getCoding().get(0).getSystem() + " code = " + identifier.getType().getCoding().get(0).getCode()); } } if (identifier.hasValue()) { entityIdentifier.setValue(daoutilsR4.removeSpace(identifier.getValue())); } if (identifier.hasSystem()) { entityIdentifier.setSystem(codeSystemSvc.findSystem(identifier.getSystem())); } else { entityIdentifier.setSystem(null); } if (identifier.hasUse()) { entityIdentifier.setUse(identifier.getUse()); } return entityIdentifier; }
Example #12
Source File: LibDaoR4.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
public BaseIdentifier setIdentifier(org.hl7.fhir.r4.model.Identifier identifier, BaseIdentifier entityIdentifier) throws OperationOutcomeException { if (identifier.hasType()) { ConceptEntity code = conceptDao.findAddCode(identifier.getType().getCoding().get(0)); if (code != null) { entityIdentifier.setIdentifierType(code); } else { log.info("IdentifierType: Missing System/Code = " + identifier.getType().getCoding().get(0).getSystem() + " code = " + identifier.getType().getCoding().get(0).getCode()); throw new IllegalArgumentException("Missing System/Code = " + identifier.getType().getCoding().get(0).getSystem() + " code = " + identifier.getType().getCoding().get(0).getCode()); } } if (identifier.hasValue()) { entityIdentifier.setValue(daoutilsR4.removeSpace(identifier.getValue())); } if (identifier.hasSystem()) { entityIdentifier.setSystem(codeSystemSvc.findSystem(identifier.getSystem())); } else { entityIdentifier.setSystem(null); } if (identifier.hasUse()) { entityIdentifier.setUse(convertIdentifier(identifier.getUse())); } return entityIdentifier; }
Example #13
Source File: ClaimProcessApp.java From net.jgp.labs.spark with Apache License 2.0 | 5 votes |
@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 #14
Source File: HQMFProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
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 #15
Source File: HQMFProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
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 #16
Source File: TestData.java From bunsen with Apache License 2.0 | 5 votes |
/** * 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 #17
Source File: ValueSetUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
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 #18
Source File: ValueSetUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
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 #19
Source File: daoutils.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
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 #20
Source File: CodeSystemUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
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"); }
Example #21
Source File: CCDAConverter.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
protected void addToIdList(List<Identifier> list, Identifier id) throws Exception { for (Identifier item : list) { if (Comparison.matches(item, id, null)) Comparison.merge(item, id); } list.add(id); }
Example #22
Source File: Convert.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
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 #23
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private Observation processObservation(CDAUtilities cda, Convert convert, Context context, Element o) throws Exception { Observation obs = new Observation(); obs.setId(context.baseId+"-results-"+Integer.toString(context.obsId)); context.obsId++; obs.setSubject(context.subjectRef); obs.setContext(new Reference().setReference("Encounter/"+context.encounter.getId())); obs.setStatus(ObservationStatus.FINAL); obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(o, "effectiveTime"))); obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), null)); obs.setInterpretation(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "interpretationCode")), null)); Element rr = cda.getChild(o, "referenceRange"); if (rr != null) obs.addReferenceRange().setText(cda.getChild(cda.getChild(rr, "observationRange"), "text").getTextContent()); Element v = cda.getChild(o, "value"); String type = v.getAttribute("xsi:type"); if ("ST".equals(type)) { obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-results-dafresultobsother"); obs.setValue(new StringType(v.getTextContent())); } else if ("CD".equals(type)) { obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-results-dafresultobscode"); obs.setValue(inspectCode(convert.makeCodeableConceptFromCD(v), null)); } else if ("PQ".equals(type)) { obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-results-dafresultobsquantity"); String va = cda.getChild(o, "value").getAttribute("value"); if (!Utilities.isDecimal(va, true)) { obs.setDataAbsentReason(inspectCode(new CodeableConcept().setText(va), null)); } else obs.setValue(convert.makeQuantityFromPQ(cda.getChild(o, "value"), null)); } else throw new Exception("Unknown type '"+type+"'"); for (Element e : cda.getChildren(o, "id")) { Identifier id = convert.makeIdentifierFromII(e); obs.getIdentifier().add(id); } saveResource(obs, "-gen"); return obs; }
Example #24
Source File: DiagnosticReportEntityToFHIRDiagnosticReportTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public DiagnosticReport transform(final DiagnosticReportEntity diagnosticReportEntity) { final DiagnosticReport diagnosticReport = new DiagnosticReport(); Meta meta = new Meta(); //.addProfile(CareConnectProfile.Condition_1); if (diagnosticReportEntity.getUpdated() != null) { meta.setLastUpdated(diagnosticReportEntity.getUpdated()); } else { if (diagnosticReportEntity.getCreated() != null) { meta.setLastUpdated(diagnosticReportEntity.getCreated()); } } diagnosticReport.setMeta(meta); diagnosticReport.setId(diagnosticReportEntity.getId().toString()); if (diagnosticReportEntity.getStatus() != null) { diagnosticReport.setStatus(diagnosticReportEntity.getStatus()); } if (diagnosticReportEntity.getPatient() != null) { diagnosticReport .setSubject(new Reference("Patient/"+diagnosticReportEntity.getPatient().getId()) .setDisplay(diagnosticReportEntity.getPatient().getNames().get(0).getDisplayName())); } for (DiagnosticReportIdentifier identifier : diagnosticReportEntity.getIdentifiers()) { Identifier ident = diagnosticReport.addIdentifier(); ident = daoutils.getIdentifier(identifier, ident); } for (DiagnosticReportResult reportResult : diagnosticReportEntity.getResults()) { diagnosticReport.addResult(new Reference("Observation/"+reportResult.getObservation().getId())); } return diagnosticReport; }
Example #25
Source File: BaseIdentifier.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
public void setIdentifierUse(Identifier.IdentifierUse identifierUse) { this.identifierUse = identifierUse; }
Example #26
Source File: PractitionerEntityToFHIRPractitionerTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Practitioner transform(final PractitionerEntity practitionerEntity) { final Practitioner practitioner = new Practitioner(); Meta meta = new Meta().addProfile(CareConnectProfile.Practitioner_1); if (practitionerEntity.getUpdated() != null) { meta.setLastUpdated(practitionerEntity.getUpdated()); } else { if (practitionerEntity.getCreated() != null) { meta.setLastUpdated(practitionerEntity.getCreated()); } } practitioner.setMeta(meta); if (practitionerEntity.getActive() != null) { practitioner.setActive(practitionerEntity.getActive()); } for(PractitionerIdentifier identifier :practitionerEntity.getIdentifiers()) { Identifier ident = practitioner.addIdentifier(); ident = daoutils.getIdentifier(identifier, ident); } practitioner.setId(practitionerEntity.getId().toString()); if (practitionerEntity.getNames().size() > 0) { practitioner.addName() .setFamily(practitionerEntity.getNames().get(0).getFamilyName()) .addGiven(practitionerEntity.getNames().get(0).getGivenName()) .addPrefix(practitionerEntity.getNames().get(0).getPrefix()); } for(int f=0;f<practitionerEntity.getTelecoms().size();f++) { practitioner.addTelecom() .setSystem(practitionerEntity.getTelecoms().get(f).getSystem()) .setValue(practitionerEntity.getTelecoms().get(f).getValue()) .setUse(practitionerEntity.getTelecoms().get(f).getTelecomUse()); } for (PractitionerAddress practitionerAddress : practitionerEntity.getAddresses()){ Address address = addressTransformer.transform(practitionerAddress); practitioner.addAddress(address); } if (practitionerEntity.getGender() !=null) { practitioner.setGender(daoutils.getGender(practitionerEntity.getGender())); } return practitioner; }
Example #27
Source File: SlotEntityToFHIRSlotTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Slot transform(final SlotEntity slotEntity) { final Slot slot = new Slot(); Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1); if (slotEntity.getUpdated() != null) { meta.setLastUpdated(slotEntity.getUpdated()); } else { if (slotEntity.getCreated() != null) { meta.setLastUpdated(slotEntity.getCreated()); } } slot.setMeta(meta); slot.setId(slotEntity.getId().toString()); for(SlotIdentifier identifier : slotEntity.getIdentifiers()) { Identifier ident = slot.addIdentifier(); ident = daoutils.getIdentifier(identifier, ident); } if (slotEntity.getServiceCategory() != null) { slot.getServiceCategory() .addCoding() .setDisplay(slotEntity.getServiceCategory().getDisplay()) .setSystem(slotEntity.getServiceCategory().getSystem()) .setCode(slotEntity.getServiceCategory().getCode()); } if (slotEntity.getAppointmentType() != null) { slot.getAppointmentType() .addCoding() .setDisplay(slotEntity.getAppointmentType().getDisplay()) .setSystem(slotEntity.getAppointmentType().getSystem()) .setCode(slotEntity.getAppointmentType().getCode()); } if (slotEntity.getSchedule() != null) { slot.setSchedule(new Reference("Schedule/"+slotEntity.getSchedule().getId())); } if (slotEntity.getStatus() != null) { slot.setStatus(slotEntity.getStatus()); } if (slotEntity.getStart() != null) { slot.setStart(slotEntity.getStart()); } if (slotEntity.getEnd() != null) { slot.setEnd(slotEntity.getEnd()); } return slot; }
Example #28
Source File: HealthcareServiceEntityToFHIRHealthcareServiceTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public HealthcareService transform(final HealthcareServiceEntity serviceEntity) { final HealthcareService service = new HealthcareService(); Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1); if (serviceEntity.getUpdated() != null) { meta.setLastUpdated(serviceEntity.getUpdated()); } else { if (serviceEntity.getCreated() != null) { meta.setLastUpdated(serviceEntity.getCreated()); } } service.setMeta(meta); service.setId(serviceEntity.getId().toString()); for(HealthcareServiceIdentifier identifier : serviceEntity.getIdentifiers()) { Identifier ident = service.addIdentifier(); ident = daoutils.getIdentifier(identifier, ident); } if (serviceEntity.getActive() != null) { service.setActive(serviceEntity.getActive()); } if (serviceEntity.getName() != null) { service.setName(serviceEntity.getName()); } if (serviceEntity.getComment() != null) { service.setComment(serviceEntity.getComment()); } if (serviceEntity.getCategory() != null) { service.getCategory() .addCoding() .setDisplay(serviceEntity.getCategory().getDisplay()) .setSystem(serviceEntity.getCategory().getSystem()) .setCode(serviceEntity.getCategory().getCode()); } System.out.println("Provided By: " + serviceEntity.getProvidedBy().getId()); if (serviceEntity.getProvidedBy() != null) { service.setProvidedBy(new Reference("Organization/"+serviceEntity.getProvidedBy().getId()).setDisplay(serviceEntity.getProvidedBy().getName())); } for (HealthcareServiceSpecialty serviceSpecialty : serviceEntity.getSpecialties()) { service.addSpecialty() .addCoding() .setCode(serviceSpecialty.getSpecialty().getCode()) .setSystem(serviceSpecialty.getSpecialty().getSystem()) .setDisplay(serviceSpecialty.getSpecialty().getDisplay()); } for (HealthcareServiceLocation serviceLocation : serviceEntity.getLocations()) { service.addLocation(new Reference("Location/"+serviceLocation.getLocation().getId()).setDisplay(serviceLocation.getLocation().getName())); } for (HealthcareServiceTelecom serviceTelecom : serviceEntity.getTelecoms()) { service.addTelecom() .setSystem(serviceTelecom.getSystem()) .setValue(serviceTelecom.getValue()) .setUse(serviceTelecom.getTelecomUse()); } /* for (HealthcareServiceType serviceType : serviceEntity.getTypes()) { service.addType() .addCoding() .setCode(serviceType.getType_().getCode()) .setSystem(serviceType.getType_().getSystem()) .setDisplay(serviceType.getType_().getDisplay()); }*/ return service; }
Example #29
Source File: ScheduleEntityToFHIRScheduleTransformer.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Schedule transform(final ScheduleEntity scheduleEntity) { final Schedule schedule = new Schedule(); Meta meta = new Meta(); //.addProfile(CareConnectProfile.Location_1); if (scheduleEntity.getUpdated() != null) { meta.setLastUpdated(scheduleEntity.getUpdated()); } else { if (scheduleEntity.getCreated() != null) { meta.setLastUpdated(scheduleEntity.getCreated()); } } schedule.setMeta(meta); schedule.setId(scheduleEntity.getId().toString()); for(ScheduleIdentifier identifier : scheduleEntity.getIdentifiers()) { Identifier ident = schedule.addIdentifier(); ident = daoutils.getIdentifier(identifier, ident); } if (scheduleEntity.getActive() != null) { schedule.setActive(scheduleEntity.getActive()); } for(ScheduleActor actor : scheduleEntity.getActors()){ if(actor.getPractitionerRole() != null){ schedule.addActor().setReference("PractitonerRole/"+actor.getPractitionerRole().getId()); } if(actor.getPractitionerEntity() != null){ schedule.addActor().setReference("Practitoner/"+actor.getPractitionerEntity().getId()); } if(actor.getHealthcareServiceEntity() != null){ schedule.addActor().setReference("HealthcareService/"+actor.getHealthcareServiceEntity().getId()); } if(actor.getLocationEntity() != null){ schedule.addActor().setReference("Location/"+actor.getLocationEntity().getId()); } } if (scheduleEntity.getComment() != null) { schedule.setComment(scheduleEntity.getComment()); } if (scheduleEntity.getCategory() != null) { schedule.getServiceCategory() .addCoding() .setDisplay(scheduleEntity.getCategory().getDisplay()) .setSystem(scheduleEntity.getCategory().getSystem()) .setCode(scheduleEntity.getCategory().getCode()); } return schedule; }
Example #30
Source File: GoalDao.java From careconnect-reference-implementation with Apache License 2.0 | 4 votes |
@Override public Goal create(FhirContext ctx, Goal goal, IdType theId, String theConditional) throws OperationOutcomeException { log.debug("Goal.save"); // log.info(ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(encounter)); GoalEntity goalEntity = null; if (goal.hasId()) goalEntity = readEntity(ctx, goal.getIdElement()); if (theConditional != null) { try { if (theConditional.contains("fhir.leedsth.nhs.uk/Id/goal")) { URI uri = new URI(theConditional); String scheme = uri.getScheme(); String host = uri.getHost(); String query = uri.getRawQuery(); log.debug(query); String[] spiltStr = query.split("%7C"); log.debug(spiltStr[1]); List<GoalEntity> results = searchEntity(ctx, null, new TokenParam().setValue(spiltStr[1]).setSystem("https://fhir.leedsth.nhs.uk/Id/goal"),null); for (GoalEntity con : results) { goalEntity = con; break; } } else { log.info("NOT SUPPORTED: Conditional Url = "+theConditional); } } catch (Exception ex) { } } if (goalEntity == null) goalEntity = new GoalEntity(); PatientEntity patientEntity = null; if (goal.hasSubject()) { log.trace(goal.getSubject().getReference()); patientEntity = patientDao.readEntity(ctx, new IdType(goal.getSubject().getReference())); goalEntity.setPatient(patientEntity); } if (goal.hasStatus()) { goalEntity.setStatus(goal.getStatus()); } em.persist(goalEntity); for (Identifier identifier : goal.getIdentifier()) { GoalIdentifier goalIdentifier = null; for (GoalIdentifier orgSearch : goalEntity.getIdentifiers()) { if (identifier.getSystem().equals(orgSearch.getSystemUri()) && identifier.getValue().equals(orgSearch.getValue())) { goalIdentifier = orgSearch; break; } } if (goalIdentifier == null) goalIdentifier = new GoalIdentifier(); goalIdentifier= (GoalIdentifier) libDao.setIdentifier(identifier, goalIdentifier ); goalIdentifier.setGoal(goalEntity); em.persist(goalIdentifier); } return goalEntityToFHIRGoalTransformer.transform(goalEntity); }