forked from Bahmni/default-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-1093 : Tele-consultation feature merge (Bahmni#44)
* SM: add github actions placeholder for stream3/master * Added missing "steps:" * SM: test yml * SM: renamed github actions workflow * SM: pipeline build project * CON-19 | Gracil/Hamza | Add isTeleconsultationEnabled field to the appointment module * SM: dirty file to trigger github actions * Packaging instruction added to README file * [Kaleeaswari] Script to create java package and push to octopus library * [Kaleeaswari] Script to create java package and push to octopus library * [Kaleeaswari] Script to create java package and push to octopus library * [Kaleeaswari] Script to create java package and push to octopus library * [Kaleeaswari] Script to create java package and push to octopus library * [Kaleeaswari] Fixing github actions ci file syntax issues * [Kaleeaswari] Fixing github actions ci file syntax issues * [Kaleeaswari] [WIP] Package appointments jar to octopus * [Kaleeaswari] [WIP] Package appointments jar to octopus * [Kaleeaswari] [WIP] Package appointments jar to octopus * [Kaleeaswari] [WIP] Package appointments jar to octopus * [Kaleeaswari] [WIP] Fixing java jar location in server * [Kaleeaswari] [WIP] Adding deployment script * [Kaleeaswari] Deploying app to the environment - Extracting test to separate task * SM, DL: templated/standardised octo CLI commands * Removing mvn test so that strange maven behaviour is overlooked * Removing mvn test so that strange maven behaviour is overlooked * Temporary test to see if changes are reflected in app on env * Revert temp test * [Hamza] Email link to patient when teleconsultation enabled * [Hamza][Bahmni#91] Email sent to patient based on template (tests pending) * [Hamza][Bahmni#91] Implemented email content variation (with/without provider) * [Hamza][Bahmni#56] Add email-notification dependency through S3 bucket * [Hamza][Bahmni#56] Dependency for email pulled from S3 bucket via pom.xml * [vishal] add rename isTeleconsulationEnabled to teleconslutation * [vishal] remove unused column is-teleconsultation-enabled * Monica/Natheesh | Bahmni#119 Addressed no email id attribute and relevant changes. Co-authored-by: Natheeshkumar <[email protected]> * Shankar: Adding appointment_service UUID to query to fetch upcoming appointments * Praveena/Swati - 95 - Fix liquibase migration error on load * Praveena | Removed github actions before merging to Bahmni product * Praveena|Swati - Modified dependency repo for Email notification * Revert "Praveena | Removed github actions before merging to Bahmni product" This reverts commit 5449b92d7f0f888faaf9eb0c825538f6432ed03a. * Praveena | Removed github actions before merging to Bahmni product * Swati/Praveena- implementation of review comments * Swati/Praveena: Review comments changes * Swati/Praveena: Review comments changes * Praveena/Swati | Teleconsultation review comments Co-authored-by: Steve M <[email protected]> Co-authored-by: smorris-TW <[email protected]> Co-authored-by: Gracil Benedict <[email protected]> Co-authored-by: Katia Bondar <[email protected]> Co-authored-by: kaleeaswari <[email protected]> Co-authored-by: Deedee <deedee> Co-authored-by: Hamza <[email protected]> Co-authored-by: Hamza <[email protected]> Co-authored-by: Monica Rajendran <[email protected]> Co-authored-by: Natheeshkumar <[email protected]> Co-authored-by: Shanky <[email protected]> Co-authored-by: swatigogia2020 <[email protected]>
- Loading branch information
1 parent
fa22355
commit fa6b5a1
Showing
27 changed files
with
579 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
openmrs-module-appointments | ||
========================== | ||
Openmrs Module Appointment Backend | ||
================================= | ||
This repository acts as the back end for the **Bahmni Appointment Scheduling**. | ||
|
||
## Packaging | ||
```mvn clean package -Duser.timezone=IST``` | ||
|
||
Description | ||
----------- | ||
Module for scheduling and managing appointments. | ||
|
||
The output is the OMOD file: | ||
```openmrs-module-appointments/omod/target/appointments-[VERSION].omod``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ain/java/org/openmrs/module/appointments/event/TeleconsultationAppointmentSavedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.openmrs.module.appointments.event; | ||
|
||
import org.openmrs.module.appointments.model.Appointment; | ||
import org.springframework.context.ApplicationEvent; | ||
|
||
public class TeleconsultationAppointmentSavedEvent extends ApplicationEvent { | ||
private Appointment appointment; | ||
|
||
public TeleconsultationAppointmentSavedEvent(Appointment appointment) { | ||
super(appointment); | ||
this.appointment = appointment; | ||
} | ||
|
||
public Appointment getAppointment() { | ||
return appointment; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...g/openmrs/module/appointments/service/TeleconsultationAppointmentNotificationService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.openmrs.module.appointments.service; | ||
|
||
import org.bahmni.module.email.notification.EmailNotificationException; | ||
import org.openmrs.module.appointments.model.Appointment; | ||
|
||
public interface TeleconsultationAppointmentNotificationService { | ||
void sendTeleconsultationAppointmentLinkEmail(Appointment appointment) throws EmailNotificationException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
.../module/appointments/service/impl/TeleconsultationAppointmentNotificationServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.openmrs.module.appointments.service.impl; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.bahmni.module.email.notification.EmailNotificationException; | ||
import org.bahmni.module.email.notification.service.EmailNotificationService; | ||
import org.openmrs.Patient; | ||
import org.openmrs.PersonAttribute; | ||
import org.openmrs.api.context.Context; | ||
import org.openmrs.module.appointments.model.Appointment; | ||
import org.openmrs.module.appointments.model.AppointmentProvider; | ||
import org.openmrs.module.appointments.service.TeleconsultationAppointmentNotificationService; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Calendar; | ||
import java.util.Date; | ||
|
||
public class TeleconsultationAppointmentNotificationServiceImpl implements TeleconsultationAppointmentNotificationService { | ||
private final static String EMAIL_SUBJECT = "teleconsultation.appointment.email.subject"; | ||
private final static String EMAIL_BODY = "teleconsultation.appointment.email.body"; | ||
|
||
private Log log = LogFactory.getLog(this.getClass()); | ||
|
||
private EmailNotificationService emailNotificationService; | ||
|
||
private TeleconsultationAppointmentService teleconsultationAppointmentService = new TeleconsultationAppointmentService(); | ||
|
||
public TeleconsultationAppointmentNotificationServiceImpl() {} | ||
public TeleconsultationAppointmentNotificationServiceImpl( | ||
EmailNotificationService emailNotificationService) { | ||
this.emailNotificationService = emailNotificationService; | ||
} | ||
|
||
public void sendTeleconsultationAppointmentLinkEmail(Appointment appointment) throws EmailNotificationException { | ||
String link = teleconsultationAppointmentService.getTeleconsultationURL(appointment); | ||
Patient patient = appointment.getPatient(); | ||
PersonAttribute patientEmailAttribute = patient.getAttribute("email"); | ||
if (patientEmailAttribute != null) { | ||
String email = patientEmailAttribute.getValue(); | ||
String patientName = appointment.getPatient().getGivenName(); | ||
String doctor = ""; | ||
if(appointment.getProviders() != null) { | ||
AppointmentProvider provider = appointment.getProviders().iterator().next(); | ||
doctor = " with Dr. " + provider.getProvider().getPerson().getGivenName(); | ||
} | ||
Date appointmentStart = appointment.getStartDateTime(); | ||
String day = new SimpleDateFormat("EEEE").format(appointmentStart); | ||
String date = new SimpleDateFormat("dd/MM/yy").format(appointmentStart); | ||
String time = new SimpleDateFormat("hh:mm a").format(appointmentStart); | ||
emailNotificationService.send( | ||
Context.getMessageSourceService().getMessage(EMAIL_SUBJECT, null, null), | ||
Context.getMessageSourceService().getMessage( | ||
EMAIL_BODY, | ||
new Object[]{ | ||
patientName, | ||
doctor, | ||
day, | ||
date, | ||
time, | ||
link | ||
}, | ||
null | ||
), | ||
new String[] { email }, | ||
null, | ||
null); | ||
} else { | ||
log.warn("Attempting to send an email to a patient without an email address"); | ||
} | ||
} | ||
|
||
public void setEmailNotificationService(EmailNotificationService emailNotificationService) { | ||
this.emailNotificationService = emailNotificationService; | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...enmrs/module/appointments/service/impl/TeleconsultationAppointmentSavedEventListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.openmrs.module.appointments.service.impl; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.bahmni.module.email.notification.EmailNotificationException; | ||
import org.openmrs.module.appointments.event.TeleconsultationAppointmentSavedEvent; | ||
import org.openmrs.module.appointments.service.TeleconsultationAppointmentNotificationService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class TeleconsultationAppointmentSavedEventListener implements ApplicationListener<TeleconsultationAppointmentSavedEvent> { | ||
|
||
private Log log = LogFactory.getLog(this.getClass()); | ||
|
||
@Autowired | ||
private TeleconsultationAppointmentNotificationService emailNotificationService; | ||
|
||
public TeleconsultationAppointmentSavedEventListener() {} | ||
public TeleconsultationAppointmentSavedEventListener(TeleconsultationAppointmentNotificationService emailNotificationService) { | ||
this.emailNotificationService = emailNotificationService; | ||
} | ||
|
||
@Override | ||
public void onApplicationEvent(TeleconsultationAppointmentSavedEvent event) { | ||
try { | ||
emailNotificationService.sendTeleconsultationAppointmentLinkEmail(event.getAppointment()); | ||
} catch (EmailNotificationException e) { | ||
log.error("Unable to send teleconsultation appointment email notification", e); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...java/org/openmrs/module/appointments/service/impl/TeleconsultationAppointmentService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.openmrs.module.appointments.service.impl; | ||
|
||
import org.openmrs.module.appointments.model.Appointment; | ||
|
||
public class TeleconsultationAppointmentService { | ||
|
||
private final static String BASE_URL = "https://meet.jit.si/"; | ||
|
||
public String getTeleconsultationURL(Appointment appointment) { | ||
return BASE_URL + appointment.getUuid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
${project.parent.artifactId}.title=Bahmni Appointment Scheduling | ||
|
||
teleconsultation.appointment.email.subject=Teleconsultation appointment confirmed | ||
teleconsultation.appointment.email.body=Hi {0},\ | ||
<p>Your teleconsultation appointment{1} has been confirmed!<br>\ | ||
The appointment time is on <b>{2}, {3} at {4}</b>.<br>\ | ||
The teleconsultation link is: <a href="{5}">{5}</a><br>\ | ||
If you have any questions, please reach out to hospital administration for assistance.<br>\ | ||
See you soon! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
UPDATE global_property | ||
SET property_value= "SELECT | ||
app_service.uuid, | ||
app_service.name AS `DASHBOARD_APPOINTMENTS_SERVICE_KEY`, | ||
app_service_type.name AS `DASHBOARD_APPOINTMENTS_SERVICE_TYPE_KEY`, | ||
DATE_FORMAT(start_date_time, \"%d/%m/%Y\") AS `DASHBOARD_APPOINTMENTS_DATE_KEY`, | ||
CONCAT(DATE_FORMAT(start_date_time, \"%l:%i %p\"), \" - \", DATE_FORMAT(end_date_time, \"%l:%i %p\")) AS `DASHBOARD_APPOINTMENTS_SLOT_KEY`, | ||
CONCAT(pn.given_name, ' ', pn.family_name) AS `DASHBOARD_APPOINTMENTS_PROVIDER_KEY`, | ||
pa.status AS `DASHBOARD_APPOINTMENTS_STATUS_KEY` | ||
FROM | ||
patient_appointment pa | ||
JOIN person p ON p.person_id = pa.patient_id AND pa.voided IS FALSE | ||
JOIN appointment_service app_service | ||
ON app_service.appointment_service_id = pa.appointment_service_id AND app_service.voided IS FALSE | ||
LEFT JOIN provider prov ON prov.provider_id = pa.provider_id AND prov.retired IS FALSE | ||
LEFT JOIN person_name pn ON pn.person_id = prov.person_id AND pn.voided IS FALSE | ||
LEFT JOIN appointment_service_type app_service_type | ||
ON app_service_type.appointment_service_type_id = pa.appointment_service_type_id | ||
WHERE p.uuid = ${patientUuid} AND | ||
start_date_time >= CURDATE() AND | ||
(app_service_type.voided IS FALSE OR app_service_type.voided IS NULL) | ||
ORDER BY start_date_time ASC;" | ||
WHERE property='bahmni.sqlGet.upComingAppointments' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.