-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC-626: added project beyond consent
- Loading branch information
Showing
11 changed files
with
393 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.edit_link:hover { | ||
cursor: pointer; | ||
} |
43 changes: 43 additions & 0 deletions
43
src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
24 changes: 24 additions & 0 deletions
24
src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
113 changes: 113 additions & 0 deletions
113
src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.edit_link:hover { | ||
cursor: pointer; | ||
} |
44 changes: 44 additions & 0 deletions
44
src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
24 changes: 24 additions & 0 deletions
24
...app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
Oops, something went wrong.