Skip to content

Commit

Permalink
added reminders for patients who wish to reschedule appointments
Browse files Browse the repository at this point in the history
  • Loading branch information
Angie-540 committed Nov 15, 2023
1 parent e48e087 commit 001a0c7
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 @@ -305,6 +313,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 @@ -1001,8 +1001,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 @@ -1044,6 +1063,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 @@ -1072,8 +1094,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 001a0c7

Please sign in to comment.