From a67e177c9e0a6c8eaefa530c0d158fd93a385fe1 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 8 Sep 2023 10:03:42 +0300 Subject: [PATCH 1/7] POC-397: fixes --- .../etl-api/hiv-patient-clinical-summary-resource.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts b/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts index 1ecfe5b6b..3526f24c6 100644 --- a/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts +++ b/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts @@ -22,7 +22,7 @@ export class HivPatientClinicalSummaryResourceService { const params: HttpParams = new HttpParams() .set('startIndex', '0') .set('limit', '20') - .set('isHEIActive', isHEIActive ? isHEIActive.toSting() : ''); + .set('isHEIActive', isHEIActive ? isHEIActive.toString() : ''); return this.http.get(api, { params: params }); } From 2d8bcff5c885b6602bdbf6885577d4f333ad900f Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 8 Sep 2023 13:06:13 +0300 Subject: [PATCH 2/7] POC-397: fixes --- .../patient-side-nav-routes.factory.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts index 1da3937ca..4af3fa9e8 100644 --- a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts +++ b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; import { RoutesProviderService } from '../../../shared/dynamic-route/route-config-provider.service'; import { RouteModel } from '../../../shared/dynamic-route/route.model'; import { Patient } from '../../../models/patient.model'; +import * as Moment from 'moment'; @Injectable() export class PatientRoutesFactory { constructor(public routesProvider: RoutesProviderService) {} @@ -16,6 +17,19 @@ export class PatientRoutesFactory { patientRoutesConfig = this.processSharedRoutes(patientRoutesConfig); const routes: RouteModel[] = []; + if (Moment().diff(Moment(patient.person.birthdate), 'months') <= 18) { + patientRoutesConfig.sharedRoutes.hiv[3] = { + url: 'hiv-summary', + label: 'HEI Summary', + icon: 'fa fa-child' + }; + } else { + patientRoutesConfig.sharedRoutes.hiv[3] = { + url: 'hiv-summary', + label: 'HIV Summary', + icon: 'fa fa-child' + }; + } if (Array.isArray(patientRoutesConfig['programs'])) { for (const program of patientRoutesConfig.programs) { if ( @@ -62,10 +76,6 @@ export class PatientRoutesFactory { model.renderingInfo = { icon: 'fa fa-square-o' }; - if (routInfo.programUuid === 'a8e7c30d-6d2f-401c-bb52-d4433689a36b') { - routInfo.routes[3].label = 'HEI Summary'; - routInfo.routes[3].icon = 'fa fa-child'; - } this.createProgramChildRoutes(routInfo.routes, model); return model; } From 362beacb439752880a82d38067ea445e1a54dfd5 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 8 Sep 2023 15:12:57 +0300 Subject: [PATCH 3/7] POC-397: fixes --- .../etl-api/hiv-patient-clinical-summary-resource.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts b/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts index 3526f24c6..4780dfb6e 100644 --- a/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts +++ b/src/app/etl-api/hiv-patient-clinical-summary-resource.service.ts @@ -22,7 +22,7 @@ export class HivPatientClinicalSummaryResourceService { const params: HttpParams = new HttpParams() .set('startIndex', '0') .set('limit', '20') - .set('isHEIActive', isHEIActive ? isHEIActive.toString() : ''); + .set('isHEIActive', (isHEIActive as any) as string); return this.http.get(api, { params: params }); } From 4ded07e4c10ba9fe19098b8289f0a18bb2aca03e Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 8 Sep 2023 16:12:39 +0300 Subject: [PATCH 4/7] POC-397: fixes --- .../lab-order-search-post.component.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/lab-order-search/lab-order-search-post.component.ts b/src/app/lab-order-search/lab-order-search-post.component.ts index 4475e4ff5..bcd6ca1c2 100644 --- a/src/app/lab-order-search/lab-order-search-post.component.ts +++ b/src/app/lab-order-search/lab-order-search-post.component.ts @@ -128,14 +128,13 @@ export class LabOrderSearchPostComponent implements OnInit, OnChanges { this.processPatientIdentifiers().then((identifiers: any) => { this.patientIdentifers = identifiers; }); - this.isHEIActive = this.order.patient.enrolledPrograms.some((program) => { - return ( - program.programUuid === 'a8e7c30d-6d2f-401c-bb52-d4433689a36b' && - program.isEnrolled === true - ); - }); this.patient = this.order.patient; this.person = new Person(this.order.patient.person); + if (Moment().diff(Moment(this.person.birthdate), 'months') <= 18) { + this.isHEIActive = true; + } else { + this.isHEIActive = false; + } this.searchIdentifiers = this.labOrdersSearchHelperService.searchIdentifiers( this.order.patient.identifiers ); From 7261a36b40c833dd2c80e3796f7d11beb1b7be2d Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 8 Sep 2023 16:49:01 +0300 Subject: [PATCH 5/7] POC-397: fixes --- .../patient-side-nav/patient-side-nav-routes.factory.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts index 4af3fa9e8..c75be2f6b 100644 --- a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts +++ b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts @@ -17,6 +17,7 @@ export class PatientRoutesFactory { patientRoutesConfig = this.processSharedRoutes(patientRoutesConfig); const routes: RouteModel[] = []; + console.log('conf: ', patientRoutesConfig); if (Moment().diff(Moment(patient.person.birthdate), 'months') <= 18) { patientRoutesConfig.sharedRoutes.hiv[3] = { url: 'hiv-summary', @@ -27,7 +28,7 @@ export class PatientRoutesFactory { patientRoutesConfig.sharedRoutes.hiv[3] = { url: 'hiv-summary', label: 'HIV Summary', - icon: 'fa fa-child' + icon: 'fa fa-medkit' }; } if (Array.isArray(patientRoutesConfig['programs'])) { From 9f84c27ed7c35ee0b696a3dcff5ee4dc131c5884 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 11 Sep 2023 09:14:26 +0300 Subject: [PATCH 6/7] POC-397: fixes --- .../patient-side-nav/patient-side-nav-routes.factory.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts index c75be2f6b..523d713bf 100644 --- a/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts +++ b/src/app/navigation/side-navigation/patient-side-nav/patient-side-nav-routes.factory.ts @@ -17,7 +17,6 @@ export class PatientRoutesFactory { patientRoutesConfig = this.processSharedRoutes(patientRoutesConfig); const routes: RouteModel[] = []; - console.log('conf: ', patientRoutesConfig); if (Moment().diff(Moment(patient.person.birthdate), 'months') <= 18) { patientRoutesConfig.sharedRoutes.hiv[3] = { url: 'hiv-summary', From abd52e7d53318ef101e085ea258851fef6770f60 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 12 Sep 2023 10:55:58 +0300 Subject: [PATCH 7/7] POC-397: fix clinical notes --- .../clinical-notes-resource.service.ts | 7 +++- .../clinical-notes.component.ts | 41 ++++++++++++------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/app/etl-api/clinical-notes-resource.service.ts b/src/app/etl-api/clinical-notes-resource.service.ts index 7a10bb3ce..59260434b 100644 --- a/src/app/etl-api/clinical-notes-resource.service.ts +++ b/src/app/etl-api/clinical-notes-resource.service.ts @@ -15,7 +15,8 @@ export class ClinicalNotesResourceService { public getClinicalNotes( patientUuid: string, startIndex: number, - limit: number + limit: number, + isHEIActive: boolean ) { const api = this.appSettingsService.getEtlServer() + @@ -32,7 +33,9 @@ export class ClinicalNotesResourceService { const params: HttpParams = new HttpParams() .set('startIndex', (startIndex as any) as string) - .set('limit', (limit as any) as string); + .set('limit', (limit as any) as string) + .set('includeNonClinicalEncounter', 'false') + .set('isHEIActive', (isHEIActive as any) as string); return this.http.get(api, { params: params }); } diff --git a/src/app/patient-dashboard/common/clinical-notes/clinical-notes.component.ts b/src/app/patient-dashboard/common/clinical-notes/clinical-notes.component.ts index 9d030d231..c6d9bb6c4 100644 --- a/src/app/patient-dashboard/common/clinical-notes/clinical-notes.component.ts +++ b/src/app/patient-dashboard/common/clinical-notes/clinical-notes.component.ts @@ -6,6 +6,8 @@ import { AppFeatureAnalytics } from '../../../shared/app-analytics/app-feature-a import { ClinicalNotesResourceService } from '../../../etl-api/clinical-notes-resource.service'; import { ClinicalNotesHelperService } from './clinical-notes.helper'; import { Subscription } from 'rxjs'; +import { PatientResourceService } from 'src/app/openmrs-api/patient-resource.service'; +import * as Moment from 'moment'; @Component({ selector: 'app-clinical-notes', @@ -25,6 +27,8 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy { public notes: Array = []; + public isHEIActive = false; + private helper: ClinicalNotesHelperService; private subscription: Subscription; @@ -36,7 +40,8 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy { constructor( private route: ActivatedRoute, private notesResource: ClinicalNotesResourceService, - private appFeatureAnalytics: AppFeatureAnalytics + private appFeatureAnalytics: AppFeatureAnalytics, + private patientResourceService: PatientResourceService ) { this.helper = new ClinicalNotesHelperService(); } @@ -51,16 +56,24 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy { this.subscription = this.route.parent.params.subscribe((params: Params) => { this.patientUuid = params['patient_uuid']; - this.getNotes(0, 10, (err, notes) => { - if (err) { - console.error(err); - return; - } - - this.notes = notes; - - this.fetching = false; - }); + this.patientResourceService + .getPatientByUuid(this.patientUuid) + .subscribe((result) => { + this.isHEIActive = + Moment().diff(Moment(result.person.birthdate), 'months') <= 18 + ? true + : false; + this.getNotes(0, 10, this.isHEIActive, (err, notes) => { + if (err) { + console.error(err); + return; + } + + this.notes = notes; + + this.fetching = false; + }); + }); }); } @@ -76,7 +89,7 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy { this.fetching = false; - this.getNotes(this.nextStartIndex, 10, (err, notes) => { + this.getNotes(this.nextStartIndex, 10, this.isHEIActive, (err, notes) => { if (err) { console.error(err); return; @@ -92,9 +105,9 @@ export class ClinicalNotesComponent implements OnInit, OnDestroy { }); } - public getNotes(startIndex: number, limit: number, cb) { + public getNotes(startIndex: number, limit: number, isHEIACTIVE: boolean, cb) { this.isBusy = this.notesResource - .getClinicalNotes(this.patientUuid, startIndex, limit) + .getClinicalNotes(this.patientUuid, startIndex, limit, this.isHEIActive) .pipe(take(1)) .subscribe( (data: any) => {