Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P0C-495:added reminders for patients who wish to reschedule appointments #1349

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading