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

POC-703:Added project beyond tag to program snapshot for eligible clIents #1731

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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
<span class="hiv-alert">Jua Mtoto Wako</span>
</p>
</div>
<div
class="alert-div"
*ngIf="isProjectBeyondElligible"
style="display: inline-block"
>
<p
[ngClass]="{
label: true,
'label-warning': true
}"
>
<span class="hiv-alert">Eligible:Project Beyond Enrollment</span>
</p>
</div>
<div *ngIf="!isHEIActive" class="alert-div" style="display: inline-block">
<p [ngClass]="getViralLoadCategory(patientData?.vl_1)">
<span class="hiv-alert" [style.background-color]="viralloadColor"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { OnInit, Component, Input, Output, EventEmitter } from '@angular/core';
import {
OnInit,
Component,
Input,
Output,
EventEmitter,
OnDestroy
} from '@angular/core';

import { Subscription } from 'rxjs';
import { take, finalize } from 'rxjs/operators';
Expand All @@ -15,6 +22,7 @@ import { CervicalCancerScreeningSummaResourceService } from './../../../etl-api/
import { Covid19ResourceService } from './../../../etl-api/covid-19-resource-service';
import { PatientReminderService } from '../../common/patient-reminders/patient-reminders.service';
import { PredictionResourceService } from 'src/app/etl-api/prediction-resource.service';
import { ObsResourceService } from 'src/app/openmrs-api/obs-resource.service';

const mdtProgramUuid = 'c4246ff0-b081-460c-bcc5-b0678012659e';
const stdProgramUuid = '781d85b0-1359-11df-a1f1-0026b9348838';
Expand Down Expand Up @@ -45,7 +53,7 @@ interface Alert {
styleUrls: ['./hiv-program-snapshot.component.css'],
templateUrl: './hiv-program-snapshot.component.html'
})
export class HivProgramSnapshotComponent implements OnInit {
export class HivProgramSnapshotComponent implements OnInit, OnDestroy {
@Input() public set enrolledProgrames(enrolledProgrames) {
this.patientPrograms = enrolledProgrames;
}
Expand Down Expand Up @@ -130,6 +138,11 @@ export class HivProgramSnapshotComponent implements OnInit {
public infant_feeding_method: string;
public reason_cacx_not_done: string = null;

// Project Beyond
public pbConceptUuid = '907c74df-b0a1-416b-848d-87dac8bf20b9';
public subscription: Subscription;
public isProjectBeyondElligible = false;

constructor(
private hivSummaryResourceService: HivSummaryResourceService,
private encounterResourceService: EncounterResourceService,
Expand All @@ -138,7 +151,8 @@ export class HivProgramSnapshotComponent implements OnInit {
private cervicalCancerScreeningSummaryService: CervicalCancerScreeningSummaResourceService,
private covid19Service: Covid19ResourceService,
private predictionResourceService: PredictionResourceService,
private patientReminderService: PatientReminderService
private patientReminderService: PatientReminderService,
private obsService: ObsResourceService
) {}

public ngOnInit() {
Expand All @@ -161,6 +175,7 @@ export class HivProgramSnapshotComponent implements OnInit {
this.patient.person.age > 19
? (this.gbvScreeningLabel = 'GBV Screening')
: (this.gbvScreeningLabel = 'VAC Screening');
this.getPBpbClientConsent(patientUuid);
}
},
0,
Expand All @@ -170,6 +185,12 @@ export class HivProgramSnapshotComponent implements OnInit {
this.getMoriskyScore();
}

public ngOnDestroy() {
if (this.subscription) {
this.subscription.unsubscribe();
}
}

public getHivSummary(patientUuid: string) {
this.loadingData = true;
this.hivSummaryResourceService
Expand Down Expand Up @@ -836,4 +857,15 @@ export class HivProgramSnapshotComponent implements OnInit {
}
return null;
}

public getPBpbClientConsent(pbPatientUuid) {
this.subscription = this.obsService
.getObsPatientObsByConcepts(pbPatientUuid, this.pbConceptUuid)
.subscribe((data) => {
const results = data['results'];
this.isProjectBeyondElligible =
results[0].value.display === 'YES' ? true : false;
console.log('xxxxxxx', results[0].value.display);
});
}
}
Loading