Fix examples
This commit is contained in:
parent
f5bec16cb4
commit
1a24ac2af2
|
@ -7,7 +7,10 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
|
import ca.uhn.fhir.model.dstu2.composite.HumanNameDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Questionnaire.GroupQuestion;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
|
||||||
|
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||||
import ca.uhn.fhir.model.primitive.StringDt;
|
import ca.uhn.fhir.model.primitive.StringDt;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
@ -17,6 +20,20 @@ public class ExtensionsDstu2 {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static void main(String[] args) throws DataFormatException, IOException {
|
public static void main(String[] args) throws DataFormatException, IOException {
|
||||||
|
|
||||||
|
{
|
||||||
|
Questionnaire q= new Questionnaire();
|
||||||
|
GroupQuestion item = q.getGroup().addQuestion();
|
||||||
|
item.setText("Hello");
|
||||||
|
|
||||||
|
ExtensionDt extension = new ExtensionDt(false, "http://hl7.org/fhir/StructureDefinition/translation");
|
||||||
|
item.getTextElement().addUndeclaredExtension(extension);
|
||||||
|
|
||||||
|
extension.addUndeclaredExtension(new ExtensionDt(false, "lang", new CodeDt("es")));
|
||||||
|
extension.addUndeclaredExtension(new ExtensionDt(false, "cont", new StringDt("hola")));
|
||||||
|
|
||||||
|
System.out.println(FhirContext.forDstu2().newJsonParser().setPrettyPrint(true).encodeResourceToString(q));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// START SNIPPET: resourceExtension
|
// START SNIPPET: resourceExtension
|
||||||
// Create an example patient
|
// Create an example patient
|
||||||
|
|
|
@ -617,7 +617,7 @@ public List<DiagnosticReport> getDiagnosticReport(
|
||||||
@RequiredParam(name=DiagnosticReport.SP_IDENTIFIER)
|
@RequiredParam(name=DiagnosticReport.SP_IDENTIFIER)
|
||||||
TokenParam theIdentifier,
|
TokenParam theIdentifier,
|
||||||
|
|
||||||
@IncludeParam(allow= {"DiagnosticReport.subject"})
|
@IncludeParam(allow= {"DiagnosticReport:subject"})
|
||||||
Set<Include> theIncludes ) {
|
Set<Include> theIncludes ) {
|
||||||
|
|
||||||
List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>();
|
List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>();
|
||||||
|
@ -626,7 +626,7 @@ public List<DiagnosticReport> getDiagnosticReport(
|
||||||
DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier);
|
DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier);
|
||||||
|
|
||||||
// If the client has asked for the subject to be included:
|
// If the client has asked for the subject to be included:
|
||||||
if (theIncludes.contains(new Include("DiagnosticReport.subject"))) {
|
if (theIncludes.contains(new Include("DiagnosticReport:subject"))) {
|
||||||
|
|
||||||
// The resource reference should contain the ID of the patient
|
// The resource reference should contain the ID of the patient
|
||||||
IdDt subjectId = report.getSubject().getReference();
|
IdDt subjectId = report.getSubject().getReference();
|
||||||
|
@ -665,7 +665,7 @@ public List<DiagnosticReport> getDiagnosticReport(
|
||||||
@RequiredParam(name=DiagnosticReport.SP_IDENTIFIER)
|
@RequiredParam(name=DiagnosticReport.SP_IDENTIFIER)
|
||||||
TokenParam theIdentifier,
|
TokenParam theIdentifier,
|
||||||
|
|
||||||
@IncludeParam(allow= {"DiagnosticReport.subject"})
|
@IncludeParam(allow= {"DiagnosticReport:subject"})
|
||||||
String theInclude ) {
|
String theInclude ) {
|
||||||
|
|
||||||
List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>();
|
List<DiagnosticReport> retVal = new ArrayList<DiagnosticReport>();
|
||||||
|
@ -674,7 +674,7 @@ public List<DiagnosticReport> getDiagnosticReport(
|
||||||
DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier);
|
DiagnosticReport report = loadSomeDiagnosticReportFromDatabase(theIdentifier);
|
||||||
|
|
||||||
// If the client has asked for the subject to be included:
|
// If the client has asked for the subject to be included:
|
||||||
if ("DiagnosticReport.subject".equals(theInclude)) {
|
if ("DiagnosticReport:subject".equals(theInclude)) {
|
||||||
|
|
||||||
// The resource reference should contain the ID of the patient
|
// The resource reference should contain the ID of the patient
|
||||||
IdDt subjectId = report.getSubject().getReference();
|
IdDt subjectId = report.getSubject().getReference();
|
||||||
|
|
|
@ -49,17 +49,15 @@ import org.junit.AfterClass;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.model.api.*;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.BundleEntry;
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
|
||||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
|
||||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
||||||
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.*;
|
import ca.uhn.fhir.model.dstu2.resource.*;
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Questionnaire.GroupQuestion;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.AnswerFormatEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.AnswerFormatEnum;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.EncounterStateEnum;
|
import ca.uhn.fhir.model.dstu2.valueset.EncounterStateEnum;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.apache.http.client.methods.HttpPost;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.http.entity.StringEntity;
|
import org.apache.http.entity.StringEntity;
|
||||||
import org.hl7.fhir.dstu3.model.*;
|
import org.hl7.fhir.dstu3.model.*;
|
||||||
|
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent;
|
||||||
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
|
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
|
||||||
import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus;
|
import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
|
@ -58,6 +59,7 @@ public class ResourceProviderQuestionnaireResponseDstu3Test extends BaseResource
|
||||||
}
|
}
|
||||||
ourRestServer.registerInterceptor(ourValidatingInterceptor);
|
ourRestServer.registerInterceptor(ourValidatingInterceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue