Skip to content

Commit

Permalink
added reminders for patients who wish to reschedule appointments (#1349)
Browse files Browse the repository at this point in the history
Co-authored-by: Drizzentic <[email protected]>
  • Loading branch information
Angie-540 and drizzentic authored Nov 30, 2023
1 parent 7f7578e commit 0a6e1cb
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
18 changes: 18 additions & 0 deletions app/reporting-framework/json-reports/clinical-reminder-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
"joinCondition": "mwl.person_id = t1.person_id"
}
},
{
"table": "etl.pre_appointment_summary",
"alias": "pre_s",
"join": {
"type": "left",
"joinCondition": "mwl.person_id = pre_s.person_id "
}
},
{
"table": "amrs.relationship",
"alias": "t6",
Expand Down Expand Up @@ -335,6 +343,16 @@
"alias": "prediction_generated_date",
"column": "mwl.prediction_generated_date"
},
{
"type": "simple_column",
"alias": "reschedule_appointment",
"column": "pre_s.reschedule_appointment"
},
{
"type": "simple_column",
"alias": "rescheduled_date",
"column": "pre_s.rescheduled_date"
},
{
"type": "simple_column",
"alias": "test_date",
Expand Down
31 changes: 28 additions & 3 deletions service/patient-reminder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,27 @@ function generateAppointmentNoShowUpRiskReminder(data) {
return reminders;
}

function generateAppointmentRescheduledReminder(data) {
let reminders = [];
if (data.reschedule_appointment && data.reschedule_appointment === 'YES') {
if (data.last_encounter_date < data.prediction_generated_date) {
reminders.push({
message:
'Promised to come date is ' +
Moment(data.rescheduled_date).format('DD-MM-YYYY'),
title: 'Appointment reschedule request',
type: 'ml',
display: {
banner: true,
toast: true
}
});
}
}
return reminders;
}

async function generateReminders(etlResults, eidResults) {
// console.log('REMINDERS generateReminders');
let reminders = [];
let patientReminder;
if (etlResults && etlResults.length > 0) {
Expand Down Expand Up @@ -1028,6 +1047,9 @@ async function generateReminders(etlResults, eidResults) {
let appointmentNoShowUpRiskReminder = generateAppointmentNoShowUpRiskReminder(
data
);
let appointmentRescheduledRiskReminder = generateAppointmentRescheduledReminder(
data
);

let currentReminder = [];
if (pending_vl_lab_result.length > 0) {
Expand Down Expand Up @@ -1056,8 +1078,11 @@ async function generateReminders(etlResults, eidResults) {

reminders = reminders.concat(currentReminder);

// Add appointment no show up risk reminder
reminders = reminders.concat(appointmentNoShowUpRiskReminder);
// Add appointment no show up risk reminder and
reminders = reminders.concat(
appointmentNoShowUpRiskReminder,
appointmentRescheduledRiskReminder
);

patientReminder.reminders = reminders;
return patientReminder;
Expand Down

0 comments on commit 0a6e1cb

Please sign in to comment.