Integration Points

About Integration Points 

When getting the data for appointments, if users would want to display additional information per appointment from other modules in Bahmni.

This can be made possible by extending the interface ''AppointmentResponseExtension'' and implementing the run method which takes appointment as input and returns a map of attributes. The returned map values are added to the appointments additional information

How to set up 

This extension code should be added in the implementation specific omods.

1. Add appointments module as required module in the  omod/src/main/resources/config.xml

<require_module>org.openmrs.module.appointments</require_module>

2. Add appointments module dependency in the pom.xml

<dependency>
   <groupId>org.openmrs.module</groupId>
   <artifactId>appointments-omod</artifactId>
   <version>1.0-SNAPSHOT</version>
   <scope>provided</scope>
</dependency>

3. Implement extension point

@Component
public class PatientBedDetails implements AppointmentResponseExtension {
   @Override
   public Map<String, String> run(Appointment appointment) {
       Map<String, String> additionalInfo = new HashMap<>();
       BedManagementService bedManagementService = Context.getService(BedManagementService.class);
       BedDetails bedDetails = bedManagementService.getBedAssignmentDetailsByPatient(appointment.getPatient());
       if(bedDetails!= null) {
           additionalInfo.put("LOCATION_KEY", bedDetails.getPhysicalLocation().getName());
           additionalInfo.put("BED_NUMBER_KEY", bedDetails.getBedNumber());
       }
       return additionalInfo;
   }
}

Note

  1. In the code above , you can use any service to fetch the relevant data from the database
  2. As an Example we taken bedDetails. You can use relevant model, as per the use case, to get the data.





On This Page

The Bahmni documentation is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)