Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Code Block
languagexml
<require_module>org.openmrs.module.appointments</require_module>

2. Add appointments module dependency in the pom.xml

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

3. Implement extension point

Code Block
languagejava
@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;
   }
}


Info
titleNote
  1. Use 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.






Panel
titleOn This Page

Table of Contents