Skip to content

Commit

Permalink
POC-626: added project beyond consent
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqedme committed Feb 14, 2024
1 parent b6ab85e commit dcaa8a4
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ import { EditPatientEducationComponent } from './patient-info/education/edit-pat
import { OvcSnapshotComponent } from './ovc-snapshot/ovc-snapshot.component';
import { UserDefaultPropertiesService } from 'src/app/user-default-properties/user-default-properties.service';
import { OtzSnapshotComponent } from './otz-snapshot/otz-snapshot.component';
import { ProjectBeyondComponent } from './patient-info/project-beyond/project-beyond.component';
import { OtzConsentComponent } from './patient-info/otz-consent/otz-consent.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -293,7 +295,9 @@ import { OtzSnapshotComponent } from './otz-snapshot/otz-snapshot.component';
AddPatientEducationComponent,
EditPatientEducationComponent,
OvcSnapshotComponent,
OtzSnapshotComponent
OtzSnapshotComponent,
ProjectBeyondComponent,
OtzConsentComponent
],
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.edit_link:hover {
cursor: pointer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<div class="col-md-10 col-lg-10 col-sm-12 col-xs-12">
<a *ngIf="otzConsentExist" (click)="fillOtzConsentForm()" class="edit_link"
><span><i class="fa fa-edit fa-fw"></i> Change OTZ Consent</span></a
>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngIf="otzConsentExist">
<td>
<strong>Patient Consented: </strong
><span class="{{ otzClientConsent.styling }}">{{
otzClientConsent.value.display
}}</span>
</td>
<td *ngIf="otzClientConsent.dateofConsent">
<strong>Consent valid from: </strong>
{{ otzClientConsent.dateofConsent }}
</td>
<!--<td *ngIf="otzClientConsent.dateofConsent">
<strong>SMS consent: </strong>
{{ otzClientConsent.sms }}
</td>
<td *ngIf="otzClientConsent.dateofConsent">
<strong>SMS consented time : </strong>
{{ otzClientConsent.smsTime }}
</td>
<td *ngIf="otzClientConsent.comments">
<strong>Comments : </strong>{{ otzClientConsent.comments }}
</td>-->
</tr>
<tr *ngIf="!otzConsentExist">
<a (click)="fillOtzConsentForm()" class="edit_link"
><span><i class="fa fa-plus fa-fw"></i>Add OTZ Consent </span></a
>
</tr>
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { OtzConsentComponent } from './otz-consent.component';

describe('OtzConsentComponent', () => {
let component: OtzConsentComponent;
let fixture: ComponentFixture<OtzConsentComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [OtzConsentComponent]
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(OtzConsentComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ObsResourceService } from 'src/app/openmrs-api/obs-resource.service';
import { PatientService } from 'src/app/patient-dashboard/services/patient.service';
import { Subscription } from 'rxjs';
import { Router } from '@angular/router';
import * as moment from 'moment/moment';

@Component({
selector: 'otz-consent',
templateUrl: './otz-consent.component.html',
styleUrls: ['./otz-consent.component.css']
})
export class OtzConsentComponent implements OnInit {
public otzClientConsent: any = {};
public otzConceptUuid: any = [];
public otzConsentExist = false;
public otzpatientUuid: any = '';
public subscription: Subscription;
constructor(
private obsService: ObsResourceService,
private patientService: PatientService,
private router: Router
) {}

ngOnInit() {
this.subscription = this.patientService.currentlyLoadedPatientUuid.subscribe(
(uuid) => {
this.otzpatientUuid = uuid;
this.getOtzClientConsent();
}
);
}
getOtzClientConsent() {
this.otzConceptUuid = ['d6f0f5db-3658-47ae-b84e-13a9bc5a9162'];
const otzEncounter = 'b832e5b1-eaf6-401b-ba20-a75208087f9f';
this.subscription = this.obsService
.getObsPatientObsByConcepts(this.otzpatientUuid, this.otzConceptUuid)
.subscribe((data) => {
const results = data['results'];
if (results.length > 0) {
const encDateTime = results[0].encounter.encounterDatetime;
this.otzClientConsent.dateofConsent = moment(encDateTime).format(
'DD-MM-YYYY HH-mm'
);
this.otzClientConsent.encounterUuid = results[0].encounter.uuid;
results.forEach((element) => {
if (element.encounter.encounterDatetime === encDateTime) {
if (this.otzConceptUuid.includes(element.concept.uuid)) {
if (element.concept.uuid === this.otzConceptUuid[0]) {
this.otzClientConsent.value = element.value;
if (element.value.display === 'NO') {
this.otzClientConsent.styling = 'text-danger';
}
this.otzConsentExist = true;
} else if (
element.concept.uuid === this.otzConceptUuid[1] &&
element.encounter.encounterType.uuid === otzEncounter
) {
this.otzClientConsent.comments = element.value;
} else if (
element.concept.uuid === this.otzConceptUuid[2] &&
element.encounter.encounterType.uuid === otzEncounter
) {
this.otzClientConsent.expiryofConsent = moment(
element.value
).format('DD-MM-YYYY HH-mm');
} else if (
element.concept.uuid === this.otzConceptUuid[3] &&
element.encounter.encounterType.uuid === otzEncounter
) {
this.otzClientConsent.sms = element.value.display;
} else if (
element.concept.uuid === this.otzConceptUuid[4] &&
element.encounter.encounterType.uuid === otzEncounter
) {
this.otzClientConsent.smsTime = moment(element.value).format(
'HH:mm'
);
}
}
}
});
}
});
}
fillOtzConsentForm() {
if (this.otzpatientUuid === undefined || this.otzpatientUuid === null) {
return;
}
if (this.otzConsentExist) {
const consentFormUUID = '60f2428f-e998-4efd-81f7-99d793243850';
const url = `/patient-dashboard/patient/${this.otzpatientUuid}/general/general/formentry/${consentFormUUID}`;
this.router.navigate([url], {
queryParams: {
encounter: this.otzClientConsent.encounterUuid,
visitTypeUuid: ''
}
});
} else {
this.router.navigate([
'/patient-dashboard/patient/' +
this.otzpatientUuid +
'/general/general/formentry/60f2428f-e998-4efd-81f7-99d793243850'
]);
}
}
// tslint:disable-next-line: use-life-cycle-interface
ngOnDestroy(): void {
if (this.subscription) {
this.subscription.unsubscribe();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ <h5 class="info_section_title">Highest Education Level</h5>
<hr class="intro-divider patient-info-divider" />
<div class="row patient-info-row">
<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12">
<h5 class="info_section_title">Home Visit / Phone / SMS Consent</h5>
<h5 class="info_section_title">Patient Consent</h5>
</div>
<telecare-consent></telecare-consent>
<project-beyond-consent></project-beyond-consent>
<!--<otz-consent></otz-consent>-->
</div>
<hr class="intro-divider" />
<div class="row patient-info-row">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.edit_link:hover {
cursor: pointer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="col-md-10 col-lg-10 col-sm-12 col-xs-12">
<a *ngIf="pbConsentExist" (click)="fillPbConsentForm()" class="edit_link"
><span
><i class="fa fa-edit fa-fw"></i> Change Project Beyond Consent</span
></a
>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr *ngIf="pbConsentExist">
<td>
<strong>How do you get ARV medicines? : </strong
><span class="{{ pbClientConsent.styling }}">{{
pbClientConsent.value.display
}}</span>
</td>
<td *ngIf="pbClientConsent.teleconConsult">
<strong>Teleconsultation Consent through phone calls?: </strong>
{{ pbClientConsent.teleconConsult }}
</td>
<td *ngIf="pbClientConsent.deliveryConsent">
<strong>Physical Tracing / Home Visit Consent? </strong>
{{ pbClientConsent.deliveryConsent }}
</td>
<td *ngIf="pbClientConsent.homevisitConsent">
<strong>Delivery of Medicine Consent </strong>
{{ pbClientConsent.homevisitConsent }}
</td>
</tr>
<tr *ngIf="!pbConsentExist">
<a (click)="fillPbConsentForm()" class="edit_link"
><span
><i class="fa fa-plus fa-fw"></i>Add Project Beyond Consent
</span></a
>
</tr>
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ProjectBeyondComponent } from './project-beyond.component';

describe('ProjectBeyondComponent', () => {
let component: ProjectBeyondComponent;
let fixture: ComponentFixture<ProjectBeyondComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ProjectBeyondComponent]
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ProjectBeyondComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit dcaa8a4

Please sign in to comment.