diff --git a/src/app/patient-dashboard/common/patient-dashboard.common.module.ts b/src/app/patient-dashboard/common/patient-dashboard.common.module.ts index cda1544f9..ad035415e 100644 --- a/src/app/patient-dashboard/common/patient-dashboard.common.module.ts +++ b/src/app/patient-dashboard/common/patient-dashboard.common.module.ts @@ -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: [ @@ -293,7 +295,9 @@ import { OtzSnapshotComponent } from './otz-snapshot/otz-snapshot.component'; AddPatientEducationComponent, EditPatientEducationComponent, OvcSnapshotComponent, - OtzSnapshotComponent + OtzSnapshotComponent, + ProjectBeyondComponent, + OtzConsentComponent ], providers: [ { diff --git a/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.css b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.css new file mode 100644 index 000000000..033fec0b6 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.css @@ -0,0 +1,3 @@ +.edit_link:hover { + cursor: pointer; +} diff --git a/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.html b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.html new file mode 100644 index 000000000..8673500a1 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.html @@ -0,0 +1,43 @@ +
+ Change OTZ Consent + + + + + + + + + + + + + + + Add OTZ Consent + + +
+ Patient Consented: {{ + otzClientConsent.value.display + }} + + Consent valid from: + {{ otzClientConsent.dateofConsent }} +
+
diff --git a/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.spec.ts b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.spec.ts new file mode 100644 index 000000000..36818e353 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [OtzConsentComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OtzConsentComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.ts b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.ts new file mode 100644 index 000000000..f2f3ac7aa --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/otz-consent/otz-consent.component.ts @@ -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(); + } + } +} diff --git a/src/app/patient-dashboard/common/patient-info/patient-info.component.html b/src/app/patient-dashboard/common/patient-info/patient-info.component.html index b88973d8d..7519a9f4a 100644 --- a/src/app/patient-dashboard/common/patient-info/patient-info.component.html +++ b/src/app/patient-dashboard/common/patient-info/patient-info.component.html @@ -41,9 +41,11 @@
Highest Education Level

-
Home Visit / Phone / SMS Consent
+
Patient Consent
+ +

diff --git a/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.css b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.css new file mode 100644 index 000000000..033fec0b6 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.css @@ -0,0 +1,3 @@ +.edit_link:hover { + cursor: pointer; +} diff --git a/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.html b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.html new file mode 100644 index 000000000..fe9627c29 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.html @@ -0,0 +1,44 @@ +
+ Change Project Beyond Consent + + + + + + + + + + + + + + + + Add Project Beyond Consent + + + +
+ How do you get ARV medicines? : {{ + pbClientConsent.value.display + }} + + Teleconsultation Consent through phone calls?: + {{ pbClientConsent.teleconConsult }} + + Physical Tracing / Home Visit Consent? + {{ pbClientConsent.deliveryConsent }} + + Delivery of Medicine Consent + {{ pbClientConsent.homevisitConsent }} +
+
diff --git a/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.spec.ts b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.spec.ts new file mode 100644 index 000000000..d9c5c9466 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ProjectBeyondComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProjectBeyondComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.ts b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.ts new file mode 100644 index 000000000..fa0813f92 --- /dev/null +++ b/src/app/patient-dashboard/common/patient-info/project-beyond/project-beyond.component.ts @@ -0,0 +1,123 @@ +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: 'project-beyond-consent', + templateUrl: './project-beyond.component.html', + styleUrls: ['./project-beyond.component.css'] +}) +export class ProjectBeyondComponent implements OnInit { + public pbClientConsent: any = {}; + public pbConceptUuid: any = []; + public pbConsentExist = false; + public pbPatientUuid: any = ''; + public subscription: Subscription; + constructor( + private obsService: ObsResourceService, + private patientService: PatientService, + private router: Router + ) {} + + ngOnInit() { + this.subscription = this.patientService.currentlyLoadedPatientUuid.subscribe( + (uuid) => { + this.pbPatientUuid = uuid; + this.getPBpbClientConsent(); + } + ); + } + getPBpbClientConsent() { + this.pbConceptUuid = [ + 'ab4e94d0-7bec-42fc-94c9-8b291d9e91f7', + '6ef9b8e3-ba2d-4d24-82e4-3afd4ecc3c34', + '0035c116-31c7-48e3-9479-f9931b3ec3c6', + 'aaff0b06-6436-4ab4-8956-070f5d75d9c8' + ]; + const projectBeyondEncounter = 'd50d238b-eef5-4225-ba87-2548ae50b269'; + this.subscription = this.obsService + .getObsPatientObsByConcepts(this.pbPatientUuid, this.pbConceptUuid) + .subscribe((data) => { + const results = data['results']; + console.log('results', results); + if (results.length > 0) { + const encDateTime = results[0].encounter.encounterDatetime; + this.pbClientConsent.dateofConsent = moment(encDateTime).format( + 'DD-MM-YYYY HH-mm' + ); + + this.pbClientConsent.encounterUuid = results[0].encounter.uuid; + results.forEach((element) => { + if (element.encounter.encounterDatetime === encDateTime) { + if (this.pbConceptUuid.includes(element.concept.uuid)) { + if (element.concept.uuid === this.pbConceptUuid[0]) { + this.pbClientConsent.value = element.value; + if (element.value.display === 'NO') { + this.pbClientConsent.styling = 'text-danger'; + } + this.pbConsentExist = true; + } else if ( + element.concept.uuid === this.pbConceptUuid[1] && + element.encounter.encounterType.uuid === + projectBeyondEncounter + ) { + this.pbClientConsent.teleconConsult = element.value.display; + } else if ( + element.concept.uuid === this.pbConceptUuid[2] && + element.encounter.encounterType.uuid === + projectBeyondEncounter + ) { + this.pbClientConsent.homevisitConsent = element.value.display; + } else if ( + element.concept.uuid === this.pbConceptUuid[3] && + element.encounter.encounterType.uuid === + projectBeyondEncounter + ) { + this.pbClientConsent.deliveryConsent = element.value.display; + } else if ( + element.concept.uuid === this.pbConceptUuid[4] && + element.encounter.encounterType.uuid === + projectBeyondEncounter + ) { + this.pbClientConsent.smsTime = moment(element.value).format( + 'HH:mm' + ); + } + } + } + }); + } + }); + } + fillPbConsentForm() { + if (this.pbPatientUuid === undefined || this.pbPatientUuid === null) { + return; + } + if (this.pbConsentExist) { + const consentFormUUID = '1a12eede-98ca-4691-86d3-bbfb564d45c2'; + const url = `/patient-dashboard/patient/${this.pbPatientUuid}/general/general/formentry/${consentFormUUID}`; + this.router.navigate([url], { + queryParams: { + encounter: this.pbClientConsent.encounterUuid, + visitTypeUuid: '' + } + }); + } else { + this.router.navigate([ + '/patient-dashboard/patient/' + + this.pbPatientUuid + + '/general/general/formentry/1a12eede-98ca-4691-86d3-bbfb564d45c2' + ]); + } + } + + // tslint:disable-next-line: use-life-cycle-interface + ngOnDestroy(): void { + if (this.subscription) { + this.subscription.unsubscribe(); + } + } +} diff --git a/src/app/patient-dashboard/common/patient-info/telecare/telecare.component.html b/src/app/patient-dashboard/common/patient-info/telecare/telecare.component.html index 628554606..666fcf3ee 100644 --- a/src/app/patient-dashboard/common/patient-info/telecare/telecare.component.html +++ b/src/app/patient-dashboard/common/patient-info/telecare/telecare.component.html @@ -1,6 +1,9 @@
Change consent Change Home Visit, Phone , SMS + consent @@ -35,7 +38,10 @@ Add consentAdd Home Visit, Phone, SMS + Consent