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
#1741)

* POC-155: Family testing module does not display elicited contacts on the form

* POC-155: Family testing module does not display elicited contacts on the form

---------

Co-authored-by: Faith Kamau <[email protected]>
  • Loading branch information
Alfred-Mutai and hiqedme authored Jul 19, 2024
1 parent f299779 commit a489e26
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 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
? '3fbc8512-b37b-4bc2-a0f4-8d0ac7955127'
: '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,32 @@ 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();

setTimeout(async () => {
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);
}, 4000);
} else {
this.searchIdentifiers = undefined;
this.birthdate = undefined;
Expand Down Expand Up @@ -347,7 +369,6 @@ export class PatientBannerComponent implements OnInit, OnDestroy, OnChanges {
this.displayContacts = false;
}
public updateContacts() {
console.log('this.patient.uuid ', this.patient.uuid);
const encounterUuid = _.first(this.patientEncounters).uuid;
const familyPartnerHistoryForm = `3fbc8512-b37b-4bc2-a0f4-8d0ac7955127`;
const url = `/patient-dashboard/patient/${this.patient.uuid}/general/general/formentry/${familyPartnerHistoryForm}`;
Expand All @@ -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 a489e26

Please sign in to comment.