@peopl-health/nexus 6.8.2 → 6.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -116,6 +116,7 @@ const ALERT_OPERATOR = 'bot:escalationAlert';
|
|
|
116
116
|
const AIRTABLE_TRANSPORT = 'airtable';
|
|
117
117
|
const NOT_RECORDED = 'no se registró en Airtable';
|
|
118
118
|
const RECLASSIFIABLE_STATUSES = [...DOCUMENTING_STATUSES, 'awaiting_doctor'];
|
|
119
|
+
const FOLLOWUP_CALL_STATUSES = [...FOLLOWUP_STATUSES, 'approved', 'needs_intervention'];
|
|
119
120
|
const SAME_URGENCY = 'The review is already at that urgency';
|
|
120
121
|
const STAT_WATCH = 'A stat case is not watched at home; lower its urgency with a reason first';
|
|
121
122
|
const RECLASSIFY_CHANGED = 'The review changed while you were reclassifying it; read it again before changing the urgency';
|
|
@@ -988,6 +989,9 @@ async function appendWithDoctor(id, entry) {
|
|
|
988
989
|
throw httpError(409, STATUS_CONFLICT);
|
|
989
990
|
}
|
|
990
991
|
|
|
992
|
+
// After the decision the call keeps the status; it flags the case and refreshes the follow-up summary, which is where the team reads it.
|
|
993
|
+
const appendInFollowUp = (id, entry) => updateReview(id, FOLLOWUP_CALL_STATUSES, { $push: { callLogs: entry }, $set: { updatedSinceSeen: true, ...redraftAfterCall() } });
|
|
994
|
+
|
|
991
995
|
async function setReviewCases({ id, patientCaseRecordIds, updatedBy, requestId = null } = {}) {
|
|
992
996
|
const reviewId = reviewIdOf(id);
|
|
993
997
|
const operator = requiredText(updatedBy, 'updatedBy');
|
|
@@ -1058,10 +1062,11 @@ async function addCallLog({ id, outcome, notes = null, calledAt = null, loggedBy
|
|
|
1058
1062
|
const review = await (outcome === 'contacted'
|
|
1059
1063
|
? updateReview(reviewId, DOCUMENTING_STATUSES, { $push: { callLogs: entry }, $set: { status: 'documenting', ...redraftAfterCall() } })
|
|
1060
1064
|
: appendKeepingDraft(reviewId, entry))
|
|
1061
|
-
.catch((error) => (error.statusCode === 409 ? appendWithDoctor(reviewId, entry) : Promise.reject(error)))
|
|
1065
|
+
.catch((error) => (error.statusCode === 409 ? appendWithDoctor(reviewId, entry) : Promise.reject(error)))
|
|
1066
|
+
.catch((error) => (error.statusCode === 409 ? appendInFollowUp(reviewId, entry) : Promise.reject(error)));
|
|
1062
1067
|
await audit(review, operator, requestId, { action: 'call_logged', outcome });
|
|
1063
|
-
// Note facts are confirmed only while the case is documented, so none are proposed
|
|
1064
|
-
if (outcome !== 'contacted' || review.status
|
|
1068
|
+
// Note facts are confirmed only while the case is documented, so none are proposed once it reached the doctor.
|
|
1069
|
+
if (outcome !== 'contacted' || !DOCUMENTING_STATUSES.includes(review.status)) return review;
|
|
1065
1070
|
return proposeNoteFacts(review, operator, requestId);
|
|
1066
1071
|
}
|
|
1067
1072
|
|