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

Feature/deactivate account fix #84

Merged
merged 7 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
10 changes: 7 additions & 3 deletions src/FhirClientProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ export default function FhirClientProvider(props: Props): JSX.Element {
console.log("Using stored patient id ", queryPatientId);
return getFhirData(client, "/Patient/" + queryPatientId).then(
(value: any) => {
return Patient.from(value);
let patient: Patient = Patient.from(value)
let active_patient: Patient = patient.active == true ? patient : undefined;
return active_patient;
}
);
}
// Get the Patient resource
return await client.patient.read().then((value: any) => {
return Patient.from(value);
});
let patient: Patient = Patient.from(value)
let active_patient: Patient = patient.active == true ? patient : undefined;
return active_patient;
});
}

async function getPractitioner(
Expand Down
8 changes: 7 additions & 1 deletion src/components/ScheduleSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ export default class ScheduleSetup extends React.Component<
);
}

if (patient.active != true) {
return new Promise((resolve, reject) =>
reject("The patient is not active.")
);
}

let params = new URLSearchParams({
telecom: `${patient.smsContactPoint}`,
// FIXME
Expand All @@ -488,7 +494,7 @@ export default class ScheduleSetup extends React.Component<
}
}
);
if (patients.find((o) => o.id !== patient.id)) {
if ((patients.find((o) => o.id !== patient.id && o.active == true))) {
// exclude current patient, workaround for above FIXME
reject(
`Phone number is already associated with: ${patients
Expand Down
3 changes: 2 additions & 1 deletion src/model/CommunicationRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ export class CommunicationRequest implements ICommunicationRequest {
sender: Patient | Practitioner = null,
note: string = ""
) {
return this.createNewOutgoingMessage(
let c = this.createNewOutgoingMessage(
messageContent,
patient,
carePlan,
IsaccMessageCategory.isaccManuallySentMessage,
sender,
note
);
return c
}

static createNewOutgoingMessage(
Expand Down
Loading