public org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); tgt.setTitle(src.getTitle()); tgt.setCode(convertCodeableConcept(src.getCode())); tgt.setSubject(convertReference(src.getSubject())); tgt.setSource(convertReference(src.getSource())); tgt.setEncounter(convertReference(src.getEncounter())); tgt.setStatus(convertListStatus(src.getStatus())); if (src.hasDate()) tgt.setDate(src.getDate()); tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); tgt.setMode(convertListMode(src.getMode())); if (src.hasNote()) tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); return tgt; }
public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); tgt.setTitle(src.getTitle()); tgt.setCode(convertCodeableConcept(src.getCode())); tgt.setSubject(convertReference(src.getSubject())); tgt.setSource(convertReference(src.getSource())); tgt.setEncounter(convertReference(src.getEncounter())); tgt.setStatus(convertListStatus(src.getStatus())); if (src.hasDate()) tgt.setDate(src.getDate()); tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); tgt.setMode(convertListMode(src.getMode())); for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); return tgt; }
protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) throws Exception { list.getContained().add(ai); String n = nextRef(); ai.setId(n); ListEntryComponent item = new ListResource.ListEntryComponent(); list.getEntry().add(item); item.setItem(Factory.makeReference("#"+n)); return item; }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case -1618432855: return addIdentifier(); case -892481550: return getStatusElement(); case 3357091: return getModeElement(); case 110371416: return getTitleElement(); case 3059181: return getCode(); case -1867885268: return getSubject(); case 1524132147: return getEncounter(); case 3076014: return getDateElement(); case -896505829: return getSource(); case -391079516: return getOrderedBy(); case 3387378: return addNote(); case 96667762: return addEntry(); case 1140135409: return getEmptyReason(); default: return super.makeProperty(hash, name); } }
switch (hash) { case -1618432855: // identifier this.getIdentifier().add(castToIdentifier(value)); // Identifier return value; case -892481550: // status value = new ListStatusEnumFactory().fromType(castToCode(value)); this.status = (Enumeration) value; // Enumeration<ListStatus> return value; case 3357091: // mode value = new ListModeEnumFactory().fromType(castToCode(value)); this.mode = (Enumeration) value; // Enumeration<ListMode> return value; case 110371416: // title this.title = castToString(value); // StringType return value; case 3059181: // code this.code = castToCodeableConcept(value); // CodeableConcept return value; case -1867885268: // subject this.subject = castToReference(value); // Reference return value; case 1524132147: // encounter this.encounter = castToReference(value); // Reference return value; case 3076014: // date this.date = castToDateTime(value); // DateTimeType return value; case -896505829: // source this.source = castToReference(value); // Reference
protected SectionComponent processAdverseReactionsSection(Element section) throws Exception { ListResource list = new ListResource(); for (Element entry : cda.getChildren(section, "entry")) { Element concern = cda.getChild(entry, "act"); if (cda.hasTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30")) { processAllergyProblemAct(list, concern); } else throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(concern)); } // todo: text SectionComponent s = new Composition.SectionComponent(); s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); // todo: check subject s.addEntry(Factory.makeReference(addReference(list, "Allergies, Adverse Reactions, Alerts", makeUUIDReference()))); return s; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("identifier")) { return addIdentifier(); return addNote(); return addEntry();
/** * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist */ public Identifier getIdentifierFirstRep() { if (getIdentifier().isEmpty()) { addIdentifier(); } return getIdentifier().get(0); }
private Resource responseResource(Resource request) { if (request instanceof DocumentManifest) { return new DocumentManifest().setId(UUID.randomUUID().toString()); } else if (request instanceof DocumentReference) { return new DocumentReference().setId(UUID.randomUUID().toString()); } else if (request instanceof ListResource) { return new ListResource().setId(UUID.randomUUID().toString()); } else if (request instanceof Binary) { return new Binary().setId(UUID.randomUUID().toString()); } else { throw new IllegalArgumentException(request + " is not allowed here"); } }
public ListResource copy() { ListResource dst = new ListResource(); copyValues(dst); if (identifier != null) { dst.identifier = new ArrayList<Identifier>(); for (Identifier i : identifier) dst.identifier.add(i.copy()); }; dst.status = status == null ? null : status.copy(); dst.mode = mode == null ? null : mode.copy(); dst.title = title == null ? null : title.copy(); dst.code = code == null ? null : code.copy(); dst.subject = subject == null ? null : subject.copy(); dst.encounter = encounter == null ? null : encounter.copy(); dst.date = date == null ? null : date.copy(); dst.source = source == null ? null : source.copy(); dst.orderedBy = orderedBy == null ? null : orderedBy.copy(); if (note != null) { dst.note = new ArrayList<Annotation>(); for (Annotation i : note) dst.note.add(i.copy()); }; if (entry != null) { dst.entry = new ArrayList<ListEntryComponent>(); for (ListEntryComponent i : entry) dst.entry.add(i.copy()); }; dst.emptyReason = emptyReason == null ? null : emptyReason.copy(); return dst; }
patientReferences.add(getSubjectReference(resource, r -> ((ListResource) r).getSubject())); } else if (!(resource instanceof Binary)) { throw FhirUtils.unprocessableEntity(
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("identifier")) { this.getIdentifier().add(castToIdentifier(value)); } else if (name.equals("status")) { value = new ListStatusEnumFactory().fromType(castToCode(value)); this.status = (Enumeration) value; // Enumeration<ListStatus> } else if (name.equals("mode")) { value = new ListModeEnumFactory().fromType(castToCode(value)); this.mode = (Enumeration) value; // Enumeration<ListMode> } else if (name.equals("title")) { this.title = castToString(value); // StringType } else if (name.equals("code")) { this.code = castToCodeableConcept(value); // CodeableConcept } else if (name.equals("subject")) { this.subject = castToReference(value); // Reference } else if (name.equals("encounter")) { this.encounter = castToReference(value); // Reference } else if (name.equals("date")) { this.date = castToDateTime(value); // DateTimeType } else if (name.equals("source")) { this.source = castToReference(value); // Reference } else if (name.equals("orderedBy")) { this.orderedBy = castToCodeableConcept(value); // CodeableConcept } else if (name.equals("note")) { this.getNote().add(castToAnnotation(value)); } else if (name.equals("entry")) { this.getEntry().add((ListEntryComponent) value); } else if (name.equals("emptyReason")) { this.emptyReason = castToCodeableConcept(value); // CodeableConcept
protected SectionComponent processVitalSignsSection(Element section) throws Exception { ListResource list = new ListResource(); for (Element entry : cda.getChildren(section, "entry")) { Element organizer = cda.getlastChild(entry); if (cda.hasTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26")) { processVitalSignsOrganizer(list, organizer); } else throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(organizer)); } // todo: text SectionComponent s = new Composition.SectionComponent(); s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); // todo: check subject s.addEntry(Factory.makeReference(addReference(list, "Vital Signs", makeUUIDReference()))); return s; }
protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) throws Exception { list.getContained().add(ai); String n = nextRef(); ai.setId(n); ListEntryComponent item = new ListResource.ListEntryComponent(); list.getEntry().add(item); item.setItem(Factory.makeReference("#"+n)); return item; }
public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); copyDomainResource(src, tgt); for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); tgt.setTitle(src.getTitle()); tgt.setCode(convertCodeableConcept(src.getCode())); tgt.setSubject(convertReference(src.getSubject())); tgt.setSource(convertReference(src.getSource())); tgt.setEncounter(convertReference(src.getEncounter())); tgt.setStatus(convertListStatus(src.getStatus())); if (src.hasDate()) tgt.setDate(src.getDate()); tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); tgt.setMode(convertListMode(src.getMode())); for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.setNote(t.getText()); for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); return tgt; }
public org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); tgt.setTitle(src.getTitle()); tgt.setCode(convertCodeableConcept(src.getCode())); tgt.setSubject(convertReference(src.getSubject())); tgt.setSource(convertReference(src.getSource())); tgt.setEncounter(convertReference(src.getEncounter())); tgt.setStatus(convertListStatus(src.getStatus())); if (src.hasDate()) tgt.setDate(src.getDate()); tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); tgt.setMode(convertListMode(src.getMode())); if (src.hasNote()) tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) tgt.addEntry(convertListEntry(t)); return tgt; }
protected SectionComponent processProceduresSection(Element section) throws Exception { ListResource list = new ListResource(); for (Element entry : cda.getChildren(section, "entry")) { Element procedure = cda.getlastChild(entry); if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14")) { processProcedure(list, procedure, ProcedureType.Procedure); } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13")) { processProcedure(list, procedure, ProcedureType.Observation); } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12")) { processProcedure(list, procedure, ProcedureType.Act); } else throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(procedure)); } // todo: text SectionComponent s = new Composition.SectionComponent(); s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); // todo: check subject s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); return s; }
protected SectionComponent processSocialHistorySection(Element section) throws Exception { ListResource list = new ListResource(); for (Element entry : cda.getChildren(section, "entry")) { Element observation = cda.getlastChild(entry); if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.38")) { processSocialObservation(list, observation, SocialHistoryType.SocialHistory); } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.15.3.8")) { processSocialObservation(list, observation, SocialHistoryType.Pregnancy); } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.78")) { processSocialObservation(list, observation, SocialHistoryType.SmokingStatus); } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.85")) { processSocialObservation(list, observation, SocialHistoryType.TobaccoUse); } else throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(observation)); } // todo: text SectionComponent s = new Composition.SectionComponent(); s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); // todo: check subject s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); return s; }