private static IdType createId(final Long id, final Long theVersionId) { return new IdType("Patient", "" + id, "" + theVersionId); }
public org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException { org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); copyElement(src, tgt); return tgt; }
@Override public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem) { List<IIdType> valueSetIds; Set<Long> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode))); valueSetIds = new ArrayList<>(); for (Long next : ids) { valueSetIds.add(new IdType("CodeSystem", next)); } return valueSetIds; }
public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(); if (src.hasValue()) tgt.setValue(src.getValue()); copyElement(src, tgt); return tgt; }
@Create public MethodOutcome createPatientResource(@ResourceParam Patient thePatient) { // ..save the resouce.. IdType id = new IdType("123"); // the new databse primary key for this resource // Get the tag list List<Coding> tags = thePatient.getMeta().getTag(); for (Coding tag : tags) { // process/save each tag somehow } return new MethodOutcome(id); } //END SNIPPET: createTags
IdType id = new IdType(nextResource.getSourceReference().getReference()); if (isNotBlank(id.getResourceType())) { switch (id.getResourceType()) {
patient.setId(new IdType("Patient", logicalId, versionId));
@Override public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { return new RuleBuilder() // Authorize patch requests .allow().patch().allRequests().andThen() // Authorize actual writes that patch may perform .allow().write().allResources().inCompartment("Patient", new IdType("Patient/123")).andThen() .build(); } };
org.hl7.fhir.dstu3.model.Resource next = i.getResource(); if (next.getIdElement().isIdPartValidLong()) { next.setIdElement(new IdType("v2-" + next.getIdElement().getIdPart()));
@Read() public Patient getResourceById(@IdParam IdType theId) { Patient retVal = new Patient(); // ...populate... retVal.addIdentifier().setSystem("urn:mrns").setValue("12345"); retVal.addName().setFamily("Smith").addGiven("Tester").addGiven("Q"); // ...etc... // if you know the version ID of the resource, you should set it and HAPI will // include it in a Content-Location header retVal.setId(new IdType("Patient", "123", "2")); return retVal; } //END SNIPPET: read
@SuppressWarnings("unchecked") @Override public <T extends IBaseResource> T fetchResource(FhirContext theContext, Class<T> theClass, String theUri) { IdType id = new IdType(theUri); boolean localReference = false; if (id.hasBaseUrl() == false && id.hasIdPart() == true) {
retVal.setId(new IdType("Patient", "3746", "1"));
/** * @param value The version of the FHIR specification on which this capability statement is based. */ public CapabilityStatement setFhirVersion(String value) { if (this.fhirVersion == null) this.fhirVersion = new IdType(); this.fhirVersion.setValue(value); return this; }
/** * @param value Allows identification of which elements have their cardinalities impacted by the constraint. Will not be referenced for constraints that do not affect cardinality. */ public ElementDefinitionConstraintComponent setKey(String value) { if (this.key == null) this.key = new IdType(); this.key.setValue(value); return this; }
public void clientRead() { //START SNIPPET: clientReadTags IPatientClient client = FhirContext.forDstu2().newRestfulClient(IPatientClient.class, "http://foo/fhir"); Patient patient = client.readPatient(new IdType("1234")); // Access the tag list List<Coding> tagList = patient.getMeta().getTag(); for (Coding next : tagList) { // ..process the tags somehow.. } //END SNIPPET: clientReadTags //START SNIPPET: clientCreateTags Patient newPatient = new Patient(); // Populate the resource object newPatient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setValue("123"); newPatient.addName().setFamily("Jones").addGiven("Frank"); // Populate some tags newPatient.getMeta().addTag("http://animals", "Dog", "Canine Patient"); // TODO: more realistic example newPatient.getMeta().addTag("http://personality", "Friendly", "Friendly"); // TODO: more realistic example // ...invoke the create method on the client... //END SNIPPET: clientCreateTags }
break; case DSTU3: result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion))); break; case DSTU2_1: break; case DSTU3: result.setId(new org.hl7.fhir.dstu3.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId))); break; case DSTU2_1: break; case DSTU3: result.setId(new org.hl7.fhir.dstu3.model.IdType(contentLocation)); break; case DSTU2_1:
.onInstance(new IdType("Patient/123")) .andReturnBundle(Bundle.class) .preferResponseType(MyPatient.class)
return new MethodOutcome(new IdType(theId.getValue()), oo);
/** * @return {@link #actionId} (The element id of the action this is related to.). This is the underlying object with id, value and extensions. The accessor "getActionId" gives direct access to the value */ public IdType getActionIdElement() { if (this.actionId == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create RequestGroupActionRelatedActionComponent.actionId"); else if (Configuration.doAutoCreate()) this.actionId = new IdType(); // bb return this.actionId; }
/** * @return {@link #fhirVersion} (The version of the FHIR specification on which this ImplementationGuide is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 3.0.1 for this version.). This is the underlying object with id, value and extensions. The accessor "getFhirVersion" gives direct access to the value */ public IdType getFhirVersionElement() { if (this.fhirVersion == null) if (Configuration.errorOnAutoCreate()) throw new Error("Attempt to auto-create ImplementationGuide.fhirVersion"); else if (Configuration.doAutoCreate()) this.fhirVersion = new IdType(); // bb return this.fhirVersion; }