Skip to content

Commit

Permalink
POC-155: Family testing module does not display elicited contacts on …
Browse files Browse the repository at this point in the history
…the form
  • Loading branch information
Alfred-Mutai committed May 20, 2024
1 parent 69e9cf5 commit 0e41563
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/app/etl-api/family-testing-resource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ export class FamilyTestingService {
);
}

public getPatientEncounters(patientUuid: string) {
const familyTestingEncounterTypeUuid =
'975ae894-7660-4224-b777-468c2e710a2a';
public getPatientEncounters(
patientUuid: string,
isFamilyTestingEncounter: boolean
) {
const familyTestingEncounterTypeUuid = isFamilyTestingEncounter
? '975ae894-7660-4224-b777-468c2e710a2a'
: '5a58f6f5-f5a6-47eb-a644-626abd83f83b';
return this.http.get(
`${this.amrsUrl()}encounter?patient=${patientUuid}&encounterType=${familyTestingEncounterTypeUuid}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class PatientBannerComponent implements OnInit, OnDestroy, OnChanges {
public isPatientEligibleForOtz = false;
public isPatientVerified = false;
public verificationStatus = false;
private isFamilyTestingEncounter = false;
modalRef: BsModalRef;
modalConfig = {
backdrop: true,
Expand Down Expand Up @@ -121,11 +122,31 @@ export class PatientBannerComponent implements OnInit, OnDestroy, OnChanges {
);
this.getHIVPatient(_.filter(patient.enrolledPrograms, 'isEnrolled'));
this.familyTestingService
.getPatientEncounters(this.patient.uuid)
.getPatientEncounters(this.patient.uuid, true)
.subscribe((response: any) => {
this.familyTestingEncounterUuid = _.first<any>(response.results);
if (response.results && response.results.length > 0) {
this.isFamilyTestingEncounter = true;
this.familyTestingEncounterUuid = _.first<any>(
response.results
);
} else {
this.isFamilyTestingEncounter = false;
}
});
this.getPatientEncounters();

if (!this.isFamilyTestingEncounter) {
this.familyTestingService
.getPatientEncounters(this.patient.uuid, false)
.subscribe((response: any) => {
if (response.results && response.results.length > 0) {
this.familyTestingEncounterUuid = _.first<any>(
response.results
);
}
});
}

this.getPatientEncounters(this.isFamilyTestingEncounter);
} else {
this.searchIdentifiers = undefined;
this.birthdate = undefined;
Expand Down Expand Up @@ -361,9 +382,10 @@ export class PatientBannerComponent implements OnInit, OnDestroy, OnChanges {
this.displayContacts = false;
}

public getPatientEncounters() {
const familyAndPartnerTestingFormUuid =
'3fbc8512-b37b-4bc2-a0f4-8d0ac7955127';
public getPatientEncounters(isFamilyTestingEncounter: boolean) {
const familyAndPartnerTestingFormUuid = isFamilyTestingEncounter
? '3fbc8512-b37b-4bc2-a0f4-8d0ac7955127'
: '8b196bad-6ee5-4290-b1be-101539e04290';
this.encounterResourceService
.getEncountersByPatientUuid(this.patient.uuid, false, null)
.pipe(take(1))
Expand Down

0 comments on commit 0e41563

Please sign in to comment.