Introduction
In DiagnosticReport FHIR resource contains field called "serviceCategory". This filed has zero to one relationship and can take one of values presented in Codes for Diagnostic Service sections.
...
FHIR module is using Handlers to support each type of serviceCategory sections. You can build your own handler and register for handler a particular type of DiagnosticReport.
Workflow
Technical Workflow
Above diagram show the handler hierarchy for the DiagnosticReport.
- Create a handler for particular Diagnostic Service Section with implementing DiagnosticReportHandler interface
- Register handler using Spring injection by ModuleApplicationContext.xml
- RESTfulDiagnosticReportResourceProvider listen to the HTTP requests and invoke appropriate method in DiagnosticReportServiceImpl according to the requested parameters
- Then DiagnosticReportServiceImpl will select the register handler which can fulfill that request and forward it to the DiagnosticReportUtil
- DiagnosticReportUtil trigger the handler and send back the response
How to Create a DiagnosticReportHandler
Requirements
Examples
Laboratory Handler
...
Requirements
- A DiagnosticReportHandler must implement the DiagnosticReportHandler interface
- A DiagnosticReportHandler may extend the AbtractHandler which contains common set of functionalities
- The DiagnosticReportHandler must be registered by Spring with a key
Examples
Laboratory Handler
- Found in the org.openmrs.module.fhir.api.diagnosticreport.handler package
- Extends org.openmrs.module.fhir.api.diagnosticreport.handler
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
package org.openmrs.module.fhir.api.diagnosticreport.handler;
public class LaboratoryHandler extends AbstractHandler implements DiagnosticReportHandler {
private static final String ServiceCategory = "LAB";
public LaboratoryHandler() {
super();
}
public String getServiceCategory() {
return ServiceCategory;
}
public DiagnosticReport getFHIRDiagnosticReportById(String id) {
// Implement code here
}
public List<DiagnosticReport> getFHIRDiagnosticReportBySubjectName(String name) {
// Implement code here
}
public DiagnosticReport saveFHIRDiagnosticReport(DiagnosticReport diagnosticReport) {
// Implement code here
}
public DiagnosticReport updateFHIRDiagnosticReport(DiagnosticReport diagnosticReport, String theId) {
// Implement code here
}
public void retireFHIRDiagnosticReport(String id) {
// Implement code here
}
} |
Register LaboratoryHandler
Register handler in FHIR module ModuleApplicationContext.xml configuration (locate in /api/src/main/resources/moduleApplicationContext.xml).
...