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

Add ability to display documents based on communicationRequest subject #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions resources/seeds/Search/subject-id-or-communication-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: subject-id-or-communication-request
where: |-
{{table}}.id IN
(
SELECT t.id from
(
SELECT qr.id from questionnaireresponse as qr
WHERE resource#>>'{subject,id}' = {{param}}
OR
resource#>>'{subject,id}' IN
(
SELECT id from communicationrequest
WHERE resource#>>'{subject,id}'={{param}}
)
) as t
)

format: "?"
resource:
id: QuestionnaireResponse
resourceType: Entity
id: QuestionnaireResponse.subject-id-or-communication-request
resourceType: Search
2 changes: 1 addition & 1 deletion src/containers/DocumentsList/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function usePatientDocuments(patient: Patient, encounter?: Reference, con
}
}
const qrResponse = await getFHIRResources<QuestionnaireResponse>('QuestionnaireResponse', {
subject: patient.id,
'subject-id-or-communication-request': patient.id,
questionnaire: questionnaires.join(','),
encounter: encounter ? parseFHIRReference(encounter).id : undefined,
_sort: '-authored',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function usePatientDocumentDetails(patientId: string) {
const mappedResponse = mapSuccess(
await getFHIRResources<QuestionnaireResponse | Encounter>('QuestionnaireResponse', {
id: qrId,
subject: patientId,
'subject-id-or-communication-request': patientId,
_include: ['QuestionnaireResponse:encounter:Encounter'],
}),
(bundle) => ({
Expand Down
Loading