Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Current »

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.

When the "serviceCategory" field is not presented in FHIR resource instance, those requests are handled by Default Service section.

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.

How to Create a DiagnosticReportHandler

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
LaboratoryHandler.java
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).

moduleApplicationContext.xml
 <bean parent="serviceContext">
        <property name="moduleService">
            <list>
                <value>org.openmrs.module.fhir.api.DiagnosticReportService</value>
                <bean
                        class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                    <property name="transactionManager">
                        <ref bean="transactionManager"/>
                    </property>
                    <property name="target">
                        <bean class="org.openmrs.module.fhir.api.impl.DiagnosticReportServiceImpl">
                            <property name="dao">
                                <bean class="org.openmrs.module.fhir.api.db.hibernate.HibernateFHIRDAO">
                                    <property name="sessionFactory">
                                        <ref bean="sessionFactory"/>
                                    </property>
                                </bean>
                            </property>
                            <property name="handlers">
                                <map>
                                    <entry>
                                        <key><value>DefaultDiagnosticReportHandler</value></key>
                                        <bean class="org.openmrs.module.fhir.api.diagnosticreport.handler.DefaultDiagnosticReportHandler"/>
                                    </entry>
                                    <entry>
                                        <key><value>LaboratoryHandler</value></key>
                                        <bean class="org.openmrs.module.fhir.api.diagnosticreport.handler.LaboratoryHandler"/>
                                    </entry>
                                </map>
                            </property>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>
    </bean>


List of Handlers

Following is a list of currently implemented handlers for Different type of Diagnostic Service sections;

 

 

  • No labels