Java源码示例:org.hl7.fhir.dstu3.model.DiagnosticReport
示例1
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam DiagnosticReport diagnosticReport, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) {
resourcePermissionProvider.checkPermission("update");
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
try {
DiagnosticReport newDiagnosticReport = diagnosticReportDao.create(ctx,diagnosticReport, theId, theConditional);
method.setId(newDiagnosticReport.getIdElement());
method.setResource(newDiagnosticReport);
} catch (Exception ex) {
ProviderResponseLibrary.handleException(method,ex);
}
return method;
}
示例2
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam DiagnosticReport diagnosticReport) {
resourcePermissionProvider.checkPermission("create");
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
try {
DiagnosticReport newDiagnosticReport = diagnosticReportDao.create(ctx,diagnosticReport, null,null);
method.setId(newDiagnosticReport.getIdElement());
method.setResource(newDiagnosticReport);
} catch (Exception ex) {
ProviderResponseLibrary.handleException(method,ex);
}
return method;
}
示例3
@Search
public List<DiagnosticReport> search(HttpServletRequest theRequest,
@OptionalParam(name = DiagnosticReport.SP_PATIENT) ReferenceParam patient
, @OptionalParam(name = DiagnosticReport.SP_IDENTIFIER) TokenParam identifier
, @OptionalParam(name = DiagnosticReport.SP_RES_ID) StringParam resid
) {
return diagnosticReportDao.search(ctx,patient,identifier,resid);
}
示例4
@Read()
public DiagnosticReport get(@IdParam IdType diagnosticReportId) {
resourcePermissionProvider.checkPermission("read");
DiagnosticReport diagnosticReport = diagnosticReportDao.read(ctx,diagnosticReportId);
if ( diagnosticReport == null) {
throw OperationOutcomeFactory.buildOperationOutcomeException(
new ResourceNotFoundException("No DiagnosticReport/ " + diagnosticReportId.getIdPart()),
OperationOutcome.IssueType.NOTFOUND);
}
return diagnosticReport;
}
示例5
public boolean generate(ResourceContext rcontext, DomainResource r) throws EOperationOutcome, FHIRException, IOException {
if (rcontext == null)
rcontext = new ResourceContext(null, r);
if (r instanceof ConceptMap) {
return generate(rcontext, (ConceptMap) r); // Maintainer = Grahame
} else if (r instanceof ValueSet) {
return generate(rcontext, (ValueSet) r, true); // Maintainer = Grahame
} else if (r instanceof CodeSystem) {
return generate(rcontext, (CodeSystem) r, true); // Maintainer = Grahame
} else if (r instanceof OperationOutcome) {
return generate(rcontext, (OperationOutcome) r); // Maintainer = Grahame
} else if (r instanceof CapabilityStatement) {
return generate(rcontext, (CapabilityStatement) r); // Maintainer = Grahame
} else if (r instanceof CompartmentDefinition) {
return generate(rcontext, (CompartmentDefinition) r); // Maintainer = Grahame
} else if (r instanceof OperationDefinition) {
return generate(rcontext, (OperationDefinition) r); // Maintainer = Grahame
} else if (r instanceof StructureDefinition) {
return generate(rcontext, (StructureDefinition) r); // Maintainer = Grahame
} else if (r instanceof ImplementationGuide) {
return generate(rcontext, (ImplementationGuide) r); // Maintainer = Lloyd (until Grahame wants to take over . . . :))
} else if (r instanceof DiagnosticReport) {
inject(r, generateDiagnosticReport(new ResourceWrapperDirect(r)), NarrativeStatus.GENERATED); // Maintainer = Grahame
return true;
} else {
StructureDefinition p = null;
if (r.hasMeta())
for (UriType pu : r.getMeta().getProfile())
if (p == null)
p = context.fetchResource(StructureDefinition.class, pu.getValue());
if (p == null)
p = context.fetchResource(StructureDefinition.class, r.getResourceType().toString());
if (p == null)
p = context.fetchTypeDefinition(r.getResourceType().toString().toLowerCase());
if (p != null)
return generateByProfile(r, p, true);
else
return false;
}
}
示例6
public DiagnosticReport.DiagnosticReportStatus getStatus() {
return status;
}
示例7
public DiagnosticReportEntity setStatus(DiagnosticReport.DiagnosticReportStatus status) {
this.status = status;
return this;
}
示例8
List<DiagnosticReportEntity> searchEntity(FhirContext ctx,
@OptionalParam(name = DiagnosticReport.SP_PATIENT) ReferenceParam patient
, @OptionalParam(name = DiagnosticReport.SP_IDENTIFIER) TokenParam identifier
, @OptionalParam(name = DiagnosticReport.SP_RES_ID) StringParam id
);
示例9
@Override
public Class<? extends IBaseResource> getResourceType() {
return DiagnosticReport.class;
}
示例10
@Validate
public MethodOutcome testResource(@ResourceParam DiagnosticReport resource,
@Validate.Mode ValidationModeEnum theMode,
@Validate.Profile String theProfile) {
return resourceTestProvider.testResource(resource,theMode,theProfile);
}
示例11
@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;
}
示例12
@Test
public void testFHIRDSTU2Export() throws Exception {
TestHelper.loadTestProperties();
Generator.DEFAULT_STATE = Config.get("test_state.default", "Massachusetts");
Config.set("exporter.baseDirectory", tempFolder.newFolder().toString());
FhirContext ctx = FhirContext.forDstu2();
IParser parser = ctx.newJsonParser().setPrettyPrint(true);
FhirValidator validator = ctx.newValidator();
validator.setValidateAgainstStandardSchema(true);
validator.setValidateAgainstStandardSchematron(true);
List<String> validationErrors = new ArrayList<String>();
int numberOfPeople = 10;
Generator generator = new Generator(numberOfPeople);
generator.options.overflow = false;
for (int i = 0; i < numberOfPeople; i++) {
int x = validationErrors.size();
TestHelper.exportOff();
Person person = generator.generatePerson(i);
Config.set("exporter.fhir_dstu2.export", "true");
FhirDstu2.TRANSACTION_BUNDLE = person.random.nextBoolean();
String fhirJson = FhirDstu2.convertToFHIRJson(person, System.currentTimeMillis());
// Check that the fhirJSON doesn't contain unresolved SNOMED-CT strings
// (these should have been converted into URIs)
if (fhirJson.contains("SNOMED-CT")) {
validationErrors.add(
"JSON contains unconverted references to 'SNOMED-CT' (should be URIs)");
}
// Now validate the resource...
IBaseResource resource = ctx.newJsonParser().parseResource(fhirJson);
ValidationResult result = validator.validateWithResult(resource);
if (!result.isSuccessful()) {
// If the validation failed, let's crack open the Bundle and validate
// each individual entry.resource to get context-sensitive error
// messages...
Bundle bundle = parser.parseResource(Bundle.class, fhirJson);
for (Entry entry : bundle.getEntry()) {
ValidationResult eresult = validator.validateWithResult(entry.getResource());
if (!eresult.isSuccessful()) {
for (SingleValidationMessage emessage : eresult.getMessages()) {
System.out.println(parser.encodeResourceToString(entry.getResource()));
System.out.println("ERROR: " + emessage.getMessage());
validationErrors.add(emessage.getMessage());
}
}
if (entry.getResource() instanceof DiagnosticReport) {
DiagnosticReport report = (DiagnosticReport) entry.getResource();
if (report.getPerformer().isEmpty()) {
validationErrors.add("Performer is a required field on DiagnosticReport!");
}
}
}
}
int y = validationErrors.size();
if (x != y) {
Exporter.export(person, System.currentTimeMillis());
}
}
assertTrue("Validation of exported FHIR bundle failed: "
+ String.join("|", validationErrors), validationErrors.size() == 0);
}
示例13
List<DiagnosticReport> search(FhirContext ctx,
@OptionalParam(name = DiagnosticReport.SP_PATIENT) ReferenceParam patient
, @OptionalParam(name = DiagnosticReport.SP_IDENTIFIER) TokenParam identifier
, @OptionalParam(name = DiagnosticReport.SP_RES_ID) StringParam id
);
示例14
DiagnosticReport read(FhirContext ctx, IdType theId);
示例15
DiagnosticReport create(FhirContext ctx, DiagnosticReport diagnosticReport, @IdParam IdType theId, @ConditionalUrlParam String theConditional) throws OperationOutcomeException;