From 43c4cb49ae0f31c468d530e7a0bf2f4c6027eb65 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:58:29 +0300 Subject: [PATCH 1/3] Poc 352 (#1662) * POC-352 * [POC-539-fix] dna pcr snapshot (#1674) * POC-352: suggested changes --------- Co-authored-by: Angie-540 Co-authored-by: Henry Korir <5462699+henrykorir@users.noreply.github.com> Co-authored-by: Drizzentic --- ...c-dashboard-pmtct-rri-report.component.css | 0 ...-dashboard-pmtct-rri-report.component.html | 9 + ...ic-dashboard-pmtct-rri-report.component.ts | 37 ++++ .../hiv/hiv-program.module.ts | 4 + .../hiv/hiv-program.routes.ts | 32 +++ src/app/etl-api/etl-api.module.ts | 2 + .../pmtct-calhiv-rri-report.service.spec.ts | 18 ++ .../pmtct-calhiv-rri-report.service.ts | 66 ++++++ .../hei-indicators-filter.component.ts | 1 - .../hei-indicators-report.component.ts | 2 +- src/app/hiv-care-lib/hiv-care-lib.module.ts | 15 ++ .../pmtct-calhiv-filter.component.html | 103 ++++++++++ .../pmtct-calhiv-filter.component.ts | 107 ++++++++++ .../pmtct-calhiv-patient-list.component.html | 39 ++++ .../pmtct-calhiv-patient-list.component.ts | 192 ++++++++++++++++++ .../pmtct-calhiv-pdf-view.component.css | 32 +++ .../pmtct-calhiv-pdf-view.component.html | 61 ++++++ .../pmtct-calhiv-pdf-view.component.ts | 122 +++++++++++ .../pmtct-calhiv-rri-report.component.css | 46 +++++ .../pmtct-calhiv-rri-report.component.html | 53 +++++ .../pmtct-calhiv-rri-report.component.spec.ts | 24 +++ .../pmtct-calhiv-rri-report.component.ts | 123 +++++++++++ .../pmtct-calhiv-tabular.component.css | 0 .../pmtct-calhiv-tabular.component.html | 19 ++ .../pmtct-calhiv-tabular.component.ts | 122 +++++++++++ .../schema/clinic.dashboard.conf.json | 6 + 26 files changed, 1233 insertions(+), 2 deletions(-) create mode 100644 src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.css create mode 100644 src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.html create mode 100644 src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.ts create mode 100644 src/app/etl-api/pmtct-calhiv-rri-report.service.spec.ts create mode 100644 src/app/etl-api/pmtct-calhiv-rri-report.service.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.html create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.html create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.css create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.html create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.css create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.html create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.spec.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.ts create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.css create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.html create mode 100644 src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.ts diff --git a/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.css b/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.html b/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.html new file mode 100644 index 000000000..fed7a99f1 --- /dev/null +++ b/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.html @@ -0,0 +1,9 @@ +
+
+
+ +
+
+
diff --git a/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.ts b/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.ts new file mode 100644 index 000000000..fec066426 --- /dev/null +++ b/src/app/clinic-dashboard/hiv/clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component.ts @@ -0,0 +1,37 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import { ClinicDashboardCacheService } from '../../services/clinic-dashboard-cache.service'; + +@Component({ + selector: 'clinic-dashboard-pmtct-rri-report', + templateUrl: './clinic-dashboard-pmtct-rri-report.component.html', + styleUrls: ['./clinic-dashboard-pmtct-rri-report.component.css'] +}) +export class ClinicDashboardPmtctRriReportComponent implements OnInit { + public selectedClinic = ''; + private subs: Subscription[] = []; + public routeSub: Subscription; + + constructor( + private _router: Router, + private _route: ActivatedRoute, + private _clinicDashboardCacheService: ClinicDashboardCacheService + ) {} + + public ngOnInit() { + this.routeSub = this._route.parent.parent.params.subscribe((params) => { + this._clinicDashboardCacheService.setCurrentClinic( + params['location_uuid'] + ); + }); + + const sub = this._clinicDashboardCacheService + .getCurrentClinic() + .subscribe((location) => { + this.selectedClinic = location; + }); + + this.subs.push(sub); + } +} diff --git a/src/app/clinic-dashboard/hiv/hiv-program.module.ts b/src/app/clinic-dashboard/hiv/hiv-program.module.ts index 5923f61ce..fdafbd2fd 100644 --- a/src/app/clinic-dashboard/hiv/hiv-program.module.ts +++ b/src/app/clinic-dashboard/hiv/hiv-program.module.ts @@ -70,6 +70,8 @@ import { ClinicDashboardRetentionReportComponent } from './retention-report/clin import { ClinicDashboardCaseManagementComponent } from './case-management/clinic-dashboard-case-management.component'; import { PrepReportComponent } from './prep-report/prep-report.component'; import { ClinicDashboardHeiReportComponent } from './clinic-dashboard-hei-indicators-report/clinic-dashboard-hei-report.component'; +import { ClinicDashboardPmtctRriReportComponent } from './clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component'; + import { HIVListsMicroFrontendComponent } from './hiv-lists-microfrontend-report/hiv-lists-microfrontend.component'; import { FamilyTestingComponent } from './family-testing/family-testing.component'; import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2-multiselect-dropdown'; @@ -133,6 +135,7 @@ import { PreAppointmentOutreachComponent } from '../general/pre-appointment-outr RangeSliderComponent, RouterModule, ClinicDashboardHeiReportComponent, + ClinicDashboardPmtctRriReportComponent, ClinicDashboardGainsAndLossesComponent, MOH412ClinicDashboardComponent, MOH412ClinicDashboardPatientListComponent, @@ -175,6 +178,7 @@ import { PreAppointmentOutreachComponent } from '../general/pre-appointment-outr ClinicDashboardCaseManagementComponent, PrepReportComponent, ClinicDashboardHeiReportComponent, + ClinicDashboardPmtctRriReportComponent, HIVListsMicroFrontendComponent, FamilyTestingComponent, ClinicDashboardGainsAndLossesComponent, diff --git a/src/app/clinic-dashboard/hiv/hiv-program.routes.ts b/src/app/clinic-dashboard/hiv/hiv-program.routes.ts index 7071527a3..2c14ee45b 100644 --- a/src/app/clinic-dashboard/hiv/hiv-program.routes.ts +++ b/src/app/clinic-dashboard/hiv/hiv-program.routes.ts @@ -49,6 +49,11 @@ import { IptReportPatientListComponent } from 'src/app/hiv-care-lib/ipt-report/i import { ClinicDashboardHeiReportComponent } from './clinic-dashboard-hei-indicators-report/clinic-dashboard-hei-report.component'; import { HeiIndicatorsPatientListComponent } from './../../hiv-care-lib/hei-indicators-report/hei-indicators-patient-list.component'; +// pmtct-rri reports +import { PmtctCalhivRriReportComponent } from 'src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component'; +import { PmtctCalhivRriPatientListComponent } from 'src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component'; +import { ClinicDashboardPmtctRriReportComponent } from './clinic-dashboard-pmtct-rri-report/clinic-dashboard-pmtct-rri-report.component'; + import { HIVListsMicroFrontendComponent } from './hiv-lists-microfrontend-report/hiv-lists-microfrontend.component'; import { FamilyTestingBaseComponent } from 'src/app/hiv-care-lib/family-testing/family-testing-base.component'; import { FamilyTestingContactComponent } from 'src/app/hiv-care-lib/family-testing/family-testing-contact-list.component'; @@ -296,6 +301,19 @@ const routes: Routes = [ { path: 'location', component: ClinicFlowLocationStatsComponent }, { path: '', redirectTo: 'summary', pathMatch: 'prefix' } ] + }, + { + path: 'pmtct-rri-report', + children: [ + { path: 'visits', component: ClinicFlowVisitsComponent }, + { path: 'summary', component: ClinicFlowSummaryComponent }, + { + path: 'provider-stats', + component: ClinicFlowProviderStatsComponent + }, + { path: 'location', component: ClinicFlowLocationStatsComponent }, + { path: '', redirectTo: 'summary', pathMatch: 'prefix' } + ] } ] }, @@ -470,6 +488,20 @@ const routes: Routes = [ } ] }, + + { + path: 'pmtct-rri-report', + children: [ + { + path: '', + component: ClinicDashboardPmtctRriReportComponent + }, + { + path: 'patient-list', + component: PmtctCalhivRriPatientListComponent + } + ] + }, { path: 'pre-appoinment-outreach', component: PreAppointmentOutreachComponent diff --git a/src/app/etl-api/etl-api.module.ts b/src/app/etl-api/etl-api.module.ts index 96359d5d6..66ca15eab 100644 --- a/src/app/etl-api/etl-api.module.ts +++ b/src/app/etl-api/etl-api.module.ts @@ -38,6 +38,7 @@ import { HivDifferentiatedCareResourceService } from './hiv-differentiated-care- import { SurgeResourceService } from './surge-resource.service'; import { PatientEducationService } from './patient-education.service'; import { HeiReportService } from './hei-report.service'; +import { PmtctCalhivRriReportService } from './pmtct-calhiv-rri-report.service'; import { CervicalCancerScreeningSummaResourceService } from './cervical-cancer-screening-summary-resource.service'; import { MOH412ResourceService } from './moh-412-resource.service'; import { ClinicFlowResourceService } from './clinic-flow-resource.service'; @@ -86,6 +87,7 @@ import { LocationUnitsService } from './location-units.service'; HivDifferentiatedCareResourceService, SurgeResourceService, HeiReportService, + PmtctCalhivRriReportService, PatientEducationService, CervicalCancerScreeningSummaResourceService, MOH412ResourceService, diff --git a/src/app/etl-api/pmtct-calhiv-rri-report.service.spec.ts b/src/app/etl-api/pmtct-calhiv-rri-report.service.spec.ts new file mode 100644 index 000000000..913f60267 --- /dev/null +++ b/src/app/etl-api/pmtct-calhiv-rri-report.service.spec.ts @@ -0,0 +1,18 @@ +import { TestBed, inject } from '@angular/core/testing'; + +import { PmtctCalhivRriReportService } from './pmtct-calhiv-rri-report.service'; + +describe('PmtctCalhivRriReportService', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [PmtctCalhivRriReportService] + }); + }); + + it('should be created', inject( + [PmtctCalhivRriReportService], + (service: PmtctCalhivRriReportService) => { + expect(service).toBeTruthy(); + } + )); +}); diff --git a/src/app/etl-api/pmtct-calhiv-rri-report.service.ts b/src/app/etl-api/pmtct-calhiv-rri-report.service.ts new file mode 100644 index 000000000..3d9604d77 --- /dev/null +++ b/src/app/etl-api/pmtct-calhiv-rri-report.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import * as _ from 'lodash'; +import { AppSettingsService } from '../app-settings/app-settings.service'; +import { DataCacheService } from '../shared/services/data-cache.service'; + +@Injectable({ + providedIn: 'root' +}) +export class PmtctCalhivRriReportService { + constructor( + protected http: HttpClient, + protected appSettingsService: AppSettingsService, + private cacheService: DataCacheService + ) {} + + public getBaseUrl(): string { + return this.appSettingsService.getEtlRestbaseurl().trim(); + } + + public getPatientListUrl(): string { + return ( + this.appSettingsService.getEtlRestbaseurl().trim() + + 'pmtct_rri_summary/patient-list' + ); + } + + public getRriIndicatorsReport(payload: any): Observable { + if (!payload) { + return null; + } + let urlParams: HttpParams = new HttpParams() + .set('endDate', payload.endDate) + .set('startDate', payload.startDate); + + if (payload.locationUuids) { + if (payload.locationUuids.length > 0) { + urlParams = urlParams.set('locationUuids', payload.locationUuids); + } + } + const url = this.getBaseUrl() + 'pmtct_rri_summary'; + return this.http.get(url, { + params: urlParams + }); + } + + public getRriMonthlySummaryPatientList(params: any) { + if (!params) { + return null; + } + + const urlParams: HttpParams = new HttpParams() + .set('startDate', params.startDate) + .set('endDate', params.endDate) + .set('locationUuids', params.locationUuids) + .set('indicators', params.indicators) + .set('reportType', params.reportType); + + const url = this.getPatientListUrl(); + + return this.http.get(url, { + params: urlParams + }); + } +} diff --git a/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-filter.component.ts b/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-filter.component.ts index 8f6beb8b2..4dfdd7014 100644 --- a/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-filter.component.ts +++ b/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-filter.component.ts @@ -84,7 +84,6 @@ export class HeiIndicatorsFilterComponent implements OnInit { .endOf('month') .format('YYYY-MM-DD') }; - this.passParamsToUrl(this.params); } diff --git a/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-report.component.ts b/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-report.component.ts index 4af4d77a6..f153fa3a1 100644 --- a/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-report.component.ts +++ b/src/app/hiv-care-lib/hei-indicators-report/hei-indicators-report.component.ts @@ -1,8 +1,8 @@ +import { HeiReportService } from './../../etl-api/hei-report.service'; import { take } from 'rxjs/operators'; import { Component, OnInit, Input } from '@angular/core'; import { Subject } from 'rxjs'; import { Router, ActivatedRoute } from '@angular/router'; -import { HeiReportService } from './../../etl-api/hei-report.service'; import * as Moment from 'moment'; @Component({ diff --git a/src/app/hiv-care-lib/hiv-care-lib.module.ts b/src/app/hiv-care-lib/hiv-care-lib.module.ts index 4459838ef..c00b2364b 100644 --- a/src/app/hiv-care-lib/hiv-care-lib.module.ts +++ b/src/app/hiv-care-lib/hiv-care-lib.module.ts @@ -63,6 +63,11 @@ import { HeiIndicatorsFilterComponent } from './hei-indicators-report/hei-indica import { HeiIndicatorsTabularComponent } from './hei-indicators-report/hei-indicators-tabular-component'; import { HeiIndicatorsPatientListComponent } from './hei-indicators-report/hei-indicators-patient-list.component'; import { HeiIndicatorsPdfViewComponent } from './hei-indicators-report/hei-indicators-pdf-view.component'; +import { PmtctCalhivRriReportComponent } from './pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component'; +import { PmtctCalhivPdfViewComponent } from './pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component'; +import { PmtctCalhivRriFiltersComponent } from './pmtct-calhiv-rri-report/pmtct-calhiv-filter.component'; +import { PmtctCalhivRriTabularComponent } from './pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component'; +import { PmtctCalhivRriPatientListComponent } from './pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component'; import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService'; import { SurgeReportTabularComponent } from './surge-report/surge-report-tabular.component'; import { SurgeReportBaseComponent } from './surge-report/surge-report-base.component'; @@ -216,6 +221,11 @@ import { TxRttReportPatientListComponent } from './tx-rtt-report/tx-rtt-report-p HeiIndicatorsTabularComponent, HeiIndicatorsPatientListComponent, HeiIndicatorsPdfViewComponent, + PmtctCalhivRriReportComponent, + PmtctCalhivRriTabularComponent, + PmtctCalhivPdfViewComponent, + PmtctCalhivRriFiltersComponent, + PmtctCalhivRriPatientListComponent, FamilyTestingBaseComponent, FamilyTestingPatientlistComponent, FamilyTestingTreeComponent, @@ -285,6 +295,11 @@ import { TxRttReportPatientListComponent } from './tx-rtt-report/tx-rtt-report-p HeiIndicatorsTabularComponent, HeiIndicatorsPatientListComponent, HeiIndicatorsPdfViewComponent, + PmtctCalhivRriReportComponent, + PmtctCalhivRriTabularComponent, + PmtctCalhivPdfViewComponent, + PmtctCalhivRriFiltersComponent, + PmtctCalhivRriPatientListComponent, PatientGainsAndLosesPatientListComponent, PatientGainsAndLosesComponent, FamilyTestingBaseComponent, diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.html b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.html new file mode 100644 index 000000000..e0ad0f919 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.html @@ -0,0 +1,103 @@ +
+
+ + + Report filters + + + + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+ + Loading report.. +
+
diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.ts new file mode 100644 index 000000000..a723fdad9 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-filter.component.ts @@ -0,0 +1,107 @@ +import { take } from 'rxjs/operators'; +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; +import { Subject } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as Moment from 'moment'; + +@Component({ + selector: 'pmtct-calhiv-filters', + templateUrl: './pmtct-calhiv-filter.component.html', + styleUrls: [] +}) +export class PmtctCalhivRriFiltersComponent implements OnInit { + public showLocationsControl = false; + public isMonthMode = true; + public showIsAggregateControl = false; + public endDateString = ''; + public startDateString = ''; + public monthString = ''; + public locationUuid: any; + public locationUuids = []; + public params = { + locationUuids: [], + startDate: '', + endDate: '' + }; + public filterCollapsed = false; + public parentIsBusy = false; + @Output() public selectedFilter: EventEmitter = new EventEmitter(); + @Input() public locations: any; + + constructor(private _router: Router, private _route: ActivatedRoute) {} + + public ngOnInit() { + this._route.queryParams.subscribe( + (params: any) => { + if (params) { + this.params = params; + // cater for endpoints taking long to return data + setTimeout(() => { + this.loadFilterFromUrlParams(params); + }, 1000); + } + }, + (error) => { + console.error('Error', error); + } + ); + } + + public loadFilterFromUrlParams(params) { + const newParams: any = { + startDate: '', + endDate: '', + locationUuids: [] + }; + + if (params.startDate) { + if (params.endDate) { + newParams.endDate = params.endDate; + } + if (params.startDate) { + newParams.startDate = params.startDate; + this.monthString = Moment(params.startDate).format('YYYY-MM'); + } + if (params.locationUuids && params.locationUuids.length > 0) { + this.locations = params.locationUuids; + newParams.locationUuids = params.locationUuids; + } + this.params = newParams; + this.selectedFilter.emit(this.params); + } + } + + public onClickedGenerate() { + this.setQueryParams(); + } + + public setQueryParams() { + this.params = { + locationUuids: this.locations, + + startDate: Moment(this.monthString, 'YYYY-MM') + .startOf('month') + .format('YYYY-MM-DD'), + endDate: Moment(this.monthString, 'YYYY-MM') + .endOf('month') + .format('YYYY-MM-DD') + }; + + this.passParamsToUrl(this.params); + } + + public passParamsToUrl(params) { + const navigationData = { + queryParams: params, + replaceUrl: true + }; + + const currentUrl = this._router.url; + const routeUrl = currentUrl.split('?')[0]; + this._router.navigate([routeUrl], navigationData); + } + + public getQueryParams() { + return this.params; + } +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.html b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.html new file mode 100644 index 000000000..87c57d88a --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.html @@ -0,0 +1,39 @@ +
+
+
+

+ {{ title }} Patient List for {{ params.startDate }} to + {{ params.endDate }} +

+
+
+
+ +
+
+ + + +
+
+
diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.ts new file mode 100644 index 000000000..70fb6cf2e --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-patient-list.component.ts @@ -0,0 +1,192 @@ +import { PmtctCalhivRriReportService } from './../../etl-api/pmtct-calhiv-rri-report.service'; +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Location } from '@angular/common'; + +import * as _ from 'lodash'; +import { Subscription } from 'rxjs'; +import { GridOptions } from 'ag-grid'; + +@Component({ + selector: 'pmtct-calhiv-patient-list', + templateUrl: './pmtct-calhiv-patient-list.component.html', + styleUrls: [] +}) +export class PmtctCalhivRriPatientListComponent implements OnInit { + constructor( + private router: Router, + private route: ActivatedRoute, + private location: Location, + private pmtctCalhivRriReportService: PmtctCalhivRriReportService + ) {} + + public title = ''; + public patients: any = []; + public rowData: any = []; + public patientList: any = []; + public params: any; + public busy: Subscription; + public locationUuids: any; + public gridColumnApi; + public gridOptions: GridOptions = { + enableColResize: true, + enableSorting: true, + enableFilter: true, + showToolPanel: false, + pagination: true, + paginationPageSize: 300, + onGridSizeChanged: () => { + if (this.gridOptions.api) { + this.gridOptions.api.sizeColumnsToFit(); + } + }, + onGridReady: () => { + if (this.gridOptions.api) { + this.gridOptions.api.sizeColumnsToFit(); + } + } + }; + + public rriSummaryColdef: any = []; + + public ngOnInit() { + this.route.queryParams.subscribe( + (params: any) => { + if (params) { + this.getPatientList(params); + this.title = this.translateIndicator(params.indicators); + this.params = params; + } + }, + (error) => { + console.error('Error', error); + } + ); + } + + public getPatientList(params) { + this.busy = this.pmtctCalhivRriReportService + .getRriMonthlySummaryPatientList(params) + .subscribe((result: any) => { + if (result) { + const patients = result.results.results; + this.patients = patients; + this.generateDynamicPatientListCols(); + this.processPatientList(patients); + } + }); + } + + public backToSummary() { + this.navigateBack(); + } + + public generateDynamicPatientListCols() { + const columns = [ + { + headerName: '#', + field: 'no' + }, + { + headerName: 'Patient Uuid', + field: 'patient_uuid', + hide: true + }, + { + headerName: 'Name', + field: 'person_name' + }, + { + headerName: 'Gender', + field: 'gender' + }, + { + headerName: 'Age', + field: 'age' + }, + + { + headerName: 'Date of Birth', + field: 'birth_date' + }, + { + headerName: 'Date of Enrollment', + field: 'enrollment_date' + }, + + { + headerName: 'Location', + field: 'location' + } + ]; + + this.rriSummaryColdef = columns; + } + + public redirectTopatientInfo(patientUuid) { + if (patientUuid === undefined || patientUuid === null) { + return; + } + this.router.navigate([ + '/patient-dashboard/patient/' + + patientUuid + + '/general/general/landing-page' + ]); + } + + public translateIndicator(indicator: string) { + const indicatorArray = indicator.toLowerCase().split('_'); + if (indicator === 'hiv_status') { + return ( + indicatorArray[0].toUpperCase() + + ' ' + + indicatorArray[1].charAt(0).toUpperCase() + + indicatorArray[1].slice(1) + ); + } else { + return indicatorArray + .map((word) => { + return word.charAt(0).toUpperCase() + word.slice(1); + }) + .join(' '); + } + } + + public processPatientList(patients) { + const patientsRow = []; + + _.each(patients, (patient: any, index) => { + patient['no'] = index + 1; + + patientsRow.push(patient); + }); + + this.rowData = patientsRow; + } + + public showColumn(column: string) { + if (this.patients.length > 0) { + const firstRow: any = this.patients[0]; + if (firstRow[column]) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + public navigateBack() { + this.location.back(); + } + + public onCellClicked($event: any) { + const patientUuid = $event.data.patient_uuid; + this.redirectTopatientInfo(patientUuid); + } + + public exportPatientListToCsv() { + this.gridOptions.api.exportDataAsCsv(); + } +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.css b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.css new file mode 100644 index 000000000..b2913079a --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.css @@ -0,0 +1,32 @@ +.section-title { + color: #fff; + background-color: #337ab7; + font-weight: bold; + display: block; + width: 100%; + font-size: 18px; +} +td, +th { + padding: 10px; + text-align: left; + font-size: 16px; + border: 1px solid #090909; +} +th { + background-color: #337ab7; + color: white; + font-weight: bold; +} +.section-data { + width: 50%; +} +.value { + color: #337ab7; +} +.value:hover { + cursor: pointer; +} +tr { + padding: 10px; +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.html b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.html new file mode 100644 index 000000000..b98709620 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.html @@ -0,0 +1,61 @@ +
+
+
+ + + RRI Report + for {{ params.startDate }} to {{ params.endDate }} + +
+ +
+
+
+
+ + + + + + + + +
Locations + {{ location }} +
+
+ + + + + + + + +
+ {{ section.sectionTitle }} +
+ {{ indicator.label }} + + {{ locationData[indicator.indicator] }} +
+
+
+ +
+
diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.ts new file mode 100644 index 000000000..d5b294dc2 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-pdf-view.component.ts @@ -0,0 +1,122 @@ +import { take } from 'rxjs/operators'; +import { + Component, + OnInit, + Input, + OnChanges, + SimpleChanges +} from '@angular/core'; +import { Subject } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as moment from 'moment'; +import * as jspdf from 'jspdf'; +import html2canvas from 'html2canvas'; + +@Component({ + selector: 'pmtct-calhiv-pdf-view', + templateUrl: './pmtct-calhiv-pdf-view.component.html', + styleUrls: ['./pmtct-calhiv-pdf-view.component.css'] +}) +export class PmtctCalhivPdfViewComponent implements OnInit, OnChanges { + @Input() rriMonthlySummary = []; + @Input() params: any; + @Input() sectionDefs: any; + public rriSummaryColdef = []; + public data = []; + public reportData: any; + public rrisummaryGridOptions = { + enableColResize: true, + enableSorting: true, + enableFilter: true, + showToolPanel: false, + groupDefaultExpanded: -1, + onGridSizeChanged: () => {}, + onGridReady: () => {} + }; + + public locations = []; + public displayTabluarFilters = true; + public headers = []; + public selectedResult = ''; + + constructor(private _router: Router, private _route: ActivatedRoute) {} + + public ngOnInit() {} + + public ngOnChanges(changes: SimpleChanges) { + if (changes.rriMonthlySummary) { + this.processSummaryData(this.rriMonthlySummary); + } + } + + public processSummaryData(results) { + this.data = results; + this.setRowData(results); + } + + public setRowData(results) { + const sectionDefs = this.sectionDefs; + _.each(results, (result: any) => { + this.locations.push(result.location); + Object.keys(result).forEach((key, index) => { + _.each(sectionDefs, (sectionDef: any) => { + const indicators = sectionDef.indicators; + _.each(indicators, (indicator: any) => { + const locationData = { + location: result.location, + location_uuid: result.location_uuid + }; + locationData[indicator.indicator] = result[indicator.indicator]; + if (indicator.indicator === key) { + if (indicator.hasOwnProperty('data') === false) { + indicator['data'] = []; + } + indicator['data'].push(locationData); + } + }); + }); + }); + }); + + this.reportData = sectionDefs; + } + + public viewPatientList(data, indicator) { + const params: any = { + locationUuids: data.location_uuid, + indicators: indicator, + startDate: this.params.startDate, + endDate: this.params.endDate + }; + this._router.navigate(['./patient-list'], { + relativeTo: this._route, + queryParams: params + }); + } + + public downloadPdf() { + const data = document.getElementById('contentToConvert'); + html2canvas(data).then((canvas) => { + // Few necessary setting options + const imgWidth = 200; + const pageHeight = 287; + const imgHeight = (canvas.height * imgWidth) / canvas.width; + let heightLeft = imgHeight; + const contentDataURL = canvas.toDataURL('image/png'); + const pdf = new jspdf('P', 'mm', 'a4'); // A4 size page of PDF + let position = 15; + pdf.setFontSize(20); + pdf.text(10, 10, 'RRI Indicators Report'); + pdf.addImage(contentDataURL, 'PNG', 10, position, imgWidth, imgHeight); + heightLeft -= pageHeight; + while (heightLeft >= 0) { + position = heightLeft - imgHeight; + pdf.addPage(); + pdf.addImage(contentDataURL, 'PNG', 10, position, imgWidth, imgHeight); + heightLeft -= pageHeight; + } + pdf.save('RRI Report.pdf'); + }); + } +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.css b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.css new file mode 100644 index 000000000..1ea7cf5ca --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.css @@ -0,0 +1,46 @@ +#report-container { + background: #fff; + margin-top: 10px; +} +.oncology-title-header { + padding-top: 5px; + padding-bottom: 5px; +} +#oncology-summary-indicators-table { + margin-top: 10px; +} +.loader { + position: absolute; + left: 0; + width: 100%; + height: 100%; + text-align: center; + z-index: 9; + box-sizing: border-box; + background-color: #fff; + color: #fff; + opacity: 0.8; +} + +.loader .fa:before { + margin-right: 12px; + display: inline-block; +} + +.loader span { + padding: 12px; + background-color: #0d6aad; + border-radius: 6px; + position: relative; + top: 50%; + transform: translateY(-50%); + display: inline-block; +} + +.fa-spin { + width: 16px; + margin-right: 8px; +} +.navigation-btn { + margin-top: 10px; +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.html b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.html new file mode 100644 index 000000000..b36e4d171 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.html @@ -0,0 +1,53 @@ +
+
+
+

+ RRI Report Summary +

+
+ {{ errorObj.message }} +
+
+ {{ busyIndicator.message }} +
+
+
+ +
+
+ + + + + + + + +
+
+
diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.spec.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.spec.ts new file mode 100644 index 000000000..b171ff4ae --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PmtctCalhivRriReportComponent } from './pmtct-calhiv-rri-report.component'; + +describe('PmtctCalhivRriReportComponent', () => { + let component: PmtctCalhivRriReportComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PmtctCalhivRriReportComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PmtctCalhivRriReportComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.ts new file mode 100644 index 000000000..a9461448e --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-rri-report.component.ts @@ -0,0 +1,123 @@ +import { PmtctCalhivRriReportService } from './../../etl-api/pmtct-calhiv-rri-report.service'; +import { take } from 'rxjs/operators'; +import { Component, OnInit, Input } from '@angular/core'; +import { Subject } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as Moment from 'moment'; + +@Component({ + selector: 'pmtct-calhiv-rri-report', + templateUrl: './pmtct-calhiv-rri-report.component.html', + styleUrls: ['./pmtct-calhiv-rri-report.component.css'] +}) +export class PmtctCalhivRriReportComponent implements OnInit { + @Input() locations = ''; + public summaryTitle = 'RRI Monthly Summary Report'; + public params = { + startDate: '', + endDate: '', + locationUuids: '', + displayTabluarFilters: true, + reportName: this.summaryTitle, + _date: Moment().format('MMM YYYY') + }; + + public busyIndicator: any = { + busy: false, + message: 'Please wait...' // default message + }; + public errorObj = { + message: '', + isError: false + }; + public rriSummary: any = []; + public rriOutcomeSummary: any; + public sectionDefs: any; + public outcomeSectionDefs: any; + public currentView = 'pdf'; + + constructor( + private _router: Router, + private _route: ActivatedRoute, + private _pmtctCalhivRriReportService: PmtctCalhivRriReportService + ) {} + + public ngOnInit() {} + + public selectedFilter($event) { + this.setParams($event); + this.getRriSummary(this.params); + } + + public setParams(filterParams: any) { + this.params = { + startDate: filterParams.startDate, + endDate: filterParams.endDate, + locationUuids: filterParams.locationUuids, + displayTabluarFilters: true, + reportName: this.summaryTitle, + _date: Moment(filterParams.startDate).format('MMMM YYYY') + }; + } + + public loading() { + this.busyIndicator = { + busy: true, + message: 'Fetching report...please wait' + }; + } + + public endLoading() { + this.busyIndicator = { + busy: false, + message: '' + }; + } + + public getRriSummary(params: any) { + this.loading(); + this._pmtctCalhivRriReportService.getRriIndicatorsReport(params).subscribe( + (result: any) => { + if (result) { + this.rriSummary = result.result; + this.sectionDefs = result.sectionDefinitions; + this.endLoading(); + } + }, + (err) => { + this.endLoading(); + this.errorObj = { + isError: true, + message: err.error.message ? err.error.message : '' + }; + } + ); + } + + public onTabChanged($event) {} + + public setCellSelectionRri($event, $event2) { + this.viewPatientList($event); + } + + public viewPatientList(data) { + this._route.parent.params.subscribe((result: any) => { + if (result) { + data.location = result.location_uuid; + } + }); + + const params: any = { + locationUuids: data.location, + indicators: data.field, + startDate: this.params.startDate, + endDate: this.params.endDate, + reportName: this.summaryTitle + }; + + this._router.navigate(['./patient-list'], { + relativeTo: this._route, + queryParams: params + }); + } +} diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.css b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.html b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.html new file mode 100644 index 000000000..283b658e9 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.html @@ -0,0 +1,19 @@ +
+
+

+ {{ reportTitle }} for {{ params.startDate }} to {{ params.endDate }} +

+
+ + +
+
diff --git a/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.ts b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.ts new file mode 100644 index 000000000..1e424db07 --- /dev/null +++ b/src/app/hiv-care-lib/pmtct-calhiv-rri-report/pmtct-calhiv-tabular.component.ts @@ -0,0 +1,122 @@ +import { take } from 'rxjs/operators'; +import { + Component, + OnInit, + Input, + OnChanges, + SimpleChanges +} from '@angular/core'; +import { Subject } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import * as _ from 'lodash'; +import * as moment from 'moment'; + +@Component({ + selector: 'pmtct-calhiv-tabular', + templateUrl: './pmtct-calhiv-tabular.component.html', + styleUrls: [] +}) +export class PmtctCalhivRriTabularComponent implements OnInit, OnChanges { + @Input() rriMonthlySummary = []; + @Input() params: any; + @Input() sectionDefs: any; + @Input() reportTitle = ''; + @Input() reportType = ''; + public rriSummaryColdef = []; + public data = []; + public rrisummaryGridOptions = { + enableColResize: true, + enableSorting: true, + enableFilter: true, + showToolPanel: false, + groupDefaultExpanded: -1, + onGridSizeChanged: () => {}, + onGridReady: () => {} + }; + + constructor(private _router: Router, private _route: ActivatedRoute) {} + + public ngOnInit() {} + + public ngOnChanges(changes: SimpleChanges) { + if (changes.rriMonthlySummary) { + this.processSummaryData(this.rriMonthlySummary); + } + if (changes.sectionDefs) { + this.generateColumns(this.sectionDefs); + } + } + + public processSummaryData(results) { + this.data = results; + this.setRowData(results); + } + public onCellClicked(event) { + this.goToPatientList(event); + } + + public generateColumns(sectionsData) { + const defs = []; + defs.push({ + headerName: 'Location', + field: 'location', + pinned: 'left' + }); + // tslint:disable-next-line:prefer-for-of + for (let i = 0; i < sectionsData.length; i++) { + const section = sectionsData[i]; + const created: any = {}; + created.headerName = section.sectionTitle; + created.children = []; + // tslint:disable-next-line:prefer-for-of + for (let j = 0; j < section.indicators.length; j++) { + const child: any = { + headerName: section.indicators[j].label, + field: section.indicators[j].indicator + }; + created.children.push(child); + } + defs.push(created); + } + + this.rriSummaryColdef = defs; + } + + public translateIndicator(indicator: string) { + return indicator + .toLowerCase() + .split('_') + .map((word) => { + return word.charAt(0).toUpperCase() + word.slice(1); + }) + .join(' '); + } + + public setRowData(allRowsData) { + const finalRows = []; + _.each(allRowsData, (rowData) => { + const rowObj = {}; + _.each(rowData, (data, index) => { + rowObj[index] = data; + }); + finalRows.push(rowObj); + }); + + this.data = finalRows; + } + + public goToPatientList(data) { + // let queryParams = this.route.snapshot.params; + const params: any = { + locationUuids: data.data.location_uuid, + indicators: data.colDef.field, + startDate: this.params.startDate, + endDate: this.params.endDate + }; + + this._router.navigate(['./patient-list'], { + relativeTo: this._route, + queryParams: params + }); + } +} diff --git a/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json b/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json index 8c647994b..1757d4686 100644 --- a/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json +++ b/src/app/shared/dynamic-route/schema/clinic.dashboard.conf.json @@ -182,6 +182,12 @@ "icon": "fa fa-line-chart", "isSideBarOpen": false }, + { + "url": "pmtct-rri-report", + "label": "Pmtct-Calhiv RRI Report", + "icon": "fa fa-file", + "isSideBarOpen": false + }, { "url": "department-select", "label": "Change Department", From 5c7469214564b816a3300b77ab3d12a770fdf7d2 Mon Sep 17 00:00:00 2001 From: Drizzentic Date: Fri, 6 Oct 2023 12:19:06 +0300 Subject: [PATCH 2/3] Poc 454 (#1675) * 2.17.1 * 2.17.2 * remove covid restriction --- package-lock.json | 4 ++-- package.json | 2 +- .../visit-details/visit-details.component.html | 13 ++----------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5d2e1c78..00881c608 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ngx-amrs", - "version": "2.17.1", + "version": "2.17.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ngx-amrs", - "version": "2.17.1", + "version": "2.17.2", "dependencies": { "@ampath-kenya/ngx-openmrs-formentry": "2.12.23", "@angular/animations": "^6.1.0", diff --git a/package.json b/package.json index dd1b7ba4a..5b81cbaad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-amrs", - "version": "2.17.1", + "version": "2.17.2", "scripts": { "ng": "ng", "start": "ng serve --host 0.0.0.0 --port 3000", diff --git a/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html b/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html index 2fd834a8e..43a699018 100644 --- a/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html +++ b/src/app/patient-dashboard/common/visit/visit-details/visit-details.component.html @@ -155,16 +155,7 @@

(onEncounterEdit)="onEncounterSelected($event)" >
Patient yet to see provider
-
- To access clinical forms kindly fill Covid 19 Assessment Form -
-
>To access clinical forms kindly fill Enhanced Adherence Encounter Form -
+ --> From e11ddd6824944246f2d651e1026a8cac5b8ccc12 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:36:35 +0300 Subject: [PATCH 3/3] Poc 145 (#1676) * addedreported test date and result to family history * added reported test date and result to family history * Added locator map details component * locator map 1 * POC-145: UI * test * add button * added data to UI * locator-map add button * added view button * added view and edit buttons * added view * add view button * pop-up * all * modal component * dismiss modal * spacing * Add locator-pretty viewer * Add locator data * Add download functionality * Remove unused code * generate correct mappings * Worked on requested changes * Update package-lock.json * Fix lint errors * Work on requested changes * Fix prettier issues * Add peds details * Delete .vscode/launch.json --------- Co-authored-by: Saningo Lekalantula Co-authored-by: Angie-540 Co-authored-by: Angie-540 <96350406+Angie-540@users.noreply.github.com> Co-authored-by: kantush Co-authored-by: Drizzentic --- .vscode/launch.json | 38 - .../locator-pretty-viewer.component.css | 43 + .../locator-pretty-viewer.component.html | 1071 +++++++++++++++++ .../locator-pretty-viewer.component.ts | 97 ++ .../pretty-encounter-viewer.component.html | 14 +- .../pretty-encounter-viewer.component.ts | 4 + .../locator-map-details.component.css | 27 + .../locator-map-details.component.html | 105 ++ .../locator-map-details.component.spec.ts | 24 + .../locator-map-details.component.ts | 170 +++ .../locator-map/locator-map.component.html | 20 +- .../locator-map/locator-map.component.ts | 16 +- .../common/locator-map/locator-map.css | 3 + .../common/patient-dashboard.common.module.ts | 3 + ...ient-encounter-observations.component.html | 5 +- .../patient-info/patient-info.component.css | 6 + .../patient-info/patient-info.component.html | 8 +- .../patient-info/patient-info.component.ts | 1 + .../patient-dashboard.routes.ts | 5 + src/app/shared/ngamrs-shared.module.ts | 6 +- 20 files changed, 1609 insertions(+), 57 deletions(-) delete mode 100644 .vscode/launch.json create mode 100644 src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.css create mode 100644 src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.html create mode 100644 src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.ts create mode 100644 src/app/patient-dashboard/common/locator-map/locator-map-details.component.css create mode 100644 src/app/patient-dashboard/common/locator-map/locator-map-details.component.html create mode 100644 src/app/patient-dashboard/common/locator-map/locator-map-details.component.spec.ts create mode 100644 src/app/patient-dashboard/common/locator-map/locator-map-details.component.ts diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index f0a142628..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "attach", - "name": "Unit tests", - "address": "localhost", - "port": 9333, - "sourceMaps": true, - "webRoot": "${workspaceRoot}" - }, - { - "name": "ng serve", - "type": "chrome", - "request": "launch", - "url": "http://localhost:3000/#", - "webRoot": "${workspaceFolder}" - }, - { - "name": "npm run test", - "type": "chrome", - "request": "launch", - "url": "http://localhost:9876/debug.html", - "webRoot": "${workspaceFolder}" - }, - { - "name": "ng e2e", - "type": "node", - "request": "launch", - "program": "${workspaceFolder}/node_modules/protractor/bin/protractor", - "protocol": "inspector", - "args": [ - "${workspaceFolder}/e2e/protractor.conf.js" - ] - } - ] -} diff --git a/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.css b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.css new file mode 100644 index 000000000..e436441e3 --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.css @@ -0,0 +1,43 @@ +p { + padding: 8px; + background-color: rgba(29, 112, 219, 0.842); + color: #fff; + border-radius: 3px; +} + +h4 { + padding: 8px; + color: #fff; + background-color: yellowgreen; + border-radius: 2px; +} + +.header { + font-size: 16px; + font-weight: 600; + margin-left: 20px; + color: rgb(5, 102, 212); + display: block; + width: 100%; +} + +.wrapper-container { + margin-top: 18px; + width: 100%; +} + +.self-container { + margin-top: 18px; + width: 100%; +} + +.wrapper { + padding-bottom: 32px; +} + +.btn-print { + font-size: 24px; + float: right; + margin-right: 20px; + cursor: pointer; +} diff --git a/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.html b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.html new file mode 100644 index 000000000..75359c0c7 --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.html @@ -0,0 +1,1071 @@ +
+
+
+ +
+
+
+

Encounter Details

+
    +
  • + Follow Up Date: + {{ + mappedAttributes.obs['PLANNED FOLLOW-UP DATE'] + }} +
  • +
  • + Date Of Last Follow-Up : + {{ + mappedAttributes.obs['DATE OF LAST FOLLOW-UP'] + }} +
  • +
  • + Case Manager: + {{ mappedAttributes.attributes['Case Manager'] }} +
  • +
+
+
+

Clients/Patient's Information

+
    +
  • + Marital status: + {{ mappedAttributes.obs['CIVIL STATUS'] }} +
  • +
  • + Place of Work: + {{ mappedAttributes.attributes['Workplace'] }} +
  • +
  • + Religious affiliation & location: + {{ mappedAttributes.obs.RELIGION }} +
  • +
  • + Patient/Client category: + {{ mappedAttributes.obs['PATIENT TYPE'] }} +
  • +
+

For Peds Only

+
    +
  • + Are any parents dead? + {{ mappedAttributes.obs['PARENT WHO IS DEAD'] }} +
  • +
  • + Who does the patient live with? + {{ + mappedAttributes.obs['PERSON THE CHILD CURRENTLY LIVING WITH'] + }} +
  • +
  • + Where is the child living, temporarily (Specify) ? + {{ + mappedAttributes.obs['CHILD TEMPORARY RESIDENCE'] + }} +
  • +
  • + Where is the child living, permanent residence (Specify) ? + {{ + mappedAttributes.obs['CHILD PERMANENT RESIDENCE'] + }} +
  • +
  • + Whom does the information belongs to ? + {{ + mappedAttributes.obs['PERSON TO WHOM INFORMATION BELONGS'] + }} +
  • +
+
+
+

Other Personal Information

+
    +
  • + No of children: + {{ + mappedAttributes.obs['NUMBER OF CHILDREN LIVING IN HOME'] + }} +
  • +
  • + No of siblings: + {{ mappedAttributes.obs['NUMBER OF SIBLINGS'] }} +
  • +
  • + Names of family members who know about the status of the client: + {{ + mappedAttributes.obs['HIV STATUS DICLOSURE TO HOUSEHOLD MEMBERS'] + }} +
  • +
  • + Name of well known child: + {{ + mappedAttributes.attributes['Well Known Child Name'] + }} +
  • +
  • + Name of well known sibling: + {{ + mappedAttributes.attributes['Well Known Sibling Name'] + }} +
  • +
+
+
+

Locator Information

+
    +
  • + Client/Parent/Guardians preferred place of contact: + {{ + mappedAttributes.obs['PREFERRED PLACE OF CONTACT'] + }} +
  • +
  • + Time: - + {{ + mappedAttributes.obs['PREFERRED DAY AND TIME OF CONTACT, CODED'] + }} +
  • +
  • + Physical Description of the patient/client/Guardian: + {{ + mappedAttributes.obs['PHYSICAL EXAM NOTE, FREETEXT'] + }} +
  • +
  • + Additional comments: + {{ + mappedAttributes.obs['CLINICAL COMMENTS, GENERAL'] + }} +
  • +
  • + Indicate if patient is from AMPATH catchment area: + {{ mappedAttributes.obs['AMPATH CATCHMENT AREA'] }} +
  • +
+
+
+

Residence and Personal Information

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Official name of client : + {{ mappedAttributes.attributes['Caregiver Name'] }} + + Name commonly called : + {{ mappedAttributes.attributes['Caregiver common name'] }} +
+ Tribe : + {{ mappedAttributes.attributes.Tribe }} + + Phone number : + {{ mappedAttributes.attributes['Caregiver Phonenumber'] }} +
+ Alternative Phone No. : + {{ + mappedAttributes.attributes[ + 'Caregiver Alternative phone number' + ] + }} + + Occupation : {{ mappedAttributes.attributes['POLICE OFFICER'] }} +
+ Relationship: {{ mappedAttributes.attributes['GRANDPARENT'] }} + + Location :{{ + mappedAttributes.attributes[ + 'Caregiver location of religious worship' + ] + }} +
+
+
+
Place of Work
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ mappedAttributes.attributes['Workplace'] }} + + Institution/Business: {{ mappedAttributes.attributes['Workplace Institution'] }} +
+ Location : + {{ mappedAttributes.attributes['Workplace Location'] }} + + Department/section : {{ mappedAttributes.attributes['Workplace department'] }} +
+ well known name : {{ mappedAttributes.attributes['Workplace Known Name'] }} +
+
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ mappedAttributes.attributes['Driving Route'] }} + + Nearest centre: {{ + mappedAttributes.attributes['Rural nearest shopping centre'] + }} +
+ Stage : {{ mappedAttributes.attributes['Rural bus stage'] }} + + Village : + {{ mappedAttributes.attributes['Rural village'] }} +
+ Nearest landmark : {{ mappedAttributes.attributes['Rural landmark'] }} + + Homestead name : {{ mappedAttributes.attributes['Rural homestead'] }} +
+ Whom to ask :{{ + mappedAttributes.attributes[ + 'Rural person reporting information' + ] + }} +
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ mappedAttributes.attributes['Client residence'] }} + + Estate: {{ mappedAttributes.attributes['Client urban estate'] }} +
+ Stage : {{ mappedAttributes.attributes['Bus Stage'] }} + + Section : + {{ mappedAttributes.attributes['Client urban section'] }} +
+ Nearest landmark : {{ mappedAttributes.attributes['Landmark'] }} + + Plot name: {{ mappedAttributes.attributes['Plot number'] }} +
+ Landlord : {{ mappedAttributes.attributes['Landlord name'] }} + + Nearest well Known neighbour : + {{ mappedAttributes.attributes['Well known neighbour name'] }} +
+ Whom to ask :{{ + mappedAttributes.attributes[ + 'Urban person reporting information' + ] + }} +
+
+
+
+ +
+

Spouse Details

+
+
+ + + + + + + + + + + + + + + + + + +
+ Name of Spouse : + {{ mappedAttributes.attributes['Partner Name'] }} + + Name commonly called : {{ mappedAttributes.attributes['Partner common name'] }} +
+ Tribe : {{ mappedAttributes.attributes['Partner tribe'] }} + + Phone number : + {{ + mappedAttributes.attributes['Partner Contact Phone Number'] + }} +
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ + mappedAttributes.attributes['Partner rural general route'] + }} + + Nearest centre: {{ + mappedAttributes.attributes[ + 'Partner rural nearest shopping centre' + ] + }} +
+ Stage : {{ + mappedAttributes.attributes['Partner rural bus stage'] + }} + + Village : + {{ mappedAttributes.attributes['Partner rural village'] }} +
+ Nearest landmark : {{ mappedAttributes.attributes['Partner rural landmark'] }} + + Homestead name : + {{ mappedAttributes.attributes['Partner rural homestead'] }} +
+ Whom to ask : + {{ + mappedAttributes.attributes[ + 'Partner rural person reporting information' + ] + }} +
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ mappedAttributes.attributes['Partner urban residence'] }} + + Estate: {{ mappedAttributes.attributes['Partner urban estate'] }} +
+ Stage : {{ + mappedAttributes.attributes['Partner urban bus stage'] + }} + + Section : + {{ mappedAttributes.attributes['Partner urban section'] }} +
+ Nearest landmark : {{ mappedAttributes.attributes['Partner urban landmark'] }} + + Plot name: {{ + mappedAttributes.attributes['Partner rural plot number'] + }} +
+ Landlord : {{ + mappedAttributes.attributes['Partner urban landlord name'] + }} + + Nearest well known neighbor: {{ + mappedAttributes.attributes[ + 'Partner urban well known neighbor name' + ] + }} +
+ Whom to ask :{{ + mappedAttributes.attributes[ + 'Partner urban person reporting information' + ] + }} +
+
+
+
+

Next of Kin Details

+
+
+ + + + + + + + + + + + + + + + + + +
+ Name of next of kin : + {{ mappedAttributes.attributes['Next of Kin name'] }} + + Name commonly called : {{ mappedAttributes.attributes['Next of Kin Common Name'] }} +
+ Tribe : + {{ mappedAttributes.attributes['Next of Kin Tribe'] }} + + Phone number : + {{ + mappedAttributes.attributes[ + 'Next of Kin Contact Phone Number' + ] + }} +
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ + mappedAttributes.attributes[ + 'Next of kin rural general route' + ] + }} + + Nearest centre: {{ + mappedAttributes.attributes[ + 'Next of Kin rural nearest shopping Centre' + ] + }} +
+ Stage : {{ + mappedAttributes.attributes['Next of kin rural bus stage'] + }} + + Village : + {{ + mappedAttributes.attributes['Next of kin Rural Village'] + }} +
+ Nearest landmark : {{ + mappedAttributes.attributes['Next of kin rural landmark'] + }} + + Homestead name : + {{ + mappedAttributes.attributes['Next of kin rural Homestead'] + }} +
+ Whom to ask :{{ + mappedAttributes.attributes[ + 'Next of kin rural person reporting information' + ] + }} +
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ + mappedAttributes.attributes['Next of kin urban residence'] + }} + + Estate: {{ + mappedAttributes.attributes['Next of Kin Urban Estate'] + }} +
+ Stage : {{ + mappedAttributes.attributes['Next of kin urban bus stage'] + }} + + Section : + {{ + mappedAttributes.attributes['Next of Kin Urban Section'] + }} +
+ Nearest landmark : {{ + mappedAttributes.attributes['Next of Kin Urban Landmark'] + }} + + Plot name / Number: {{ + mappedAttributes.attributes[ + 'Next of kin urban plot number' + ] + }} +
+ Landlord : {{ + mappedAttributes.attributes[ + 'Next of kin urban landlord name' + ] + }} + + Nearest well known neighbor: {{ + mappedAttributes.attributes[ + 'Next of Kin urban well known neighbor name' + ] + }} +
+ Whom to ask : + {{ + mappedAttributes.attributes[ + 'Next of kin urban person reporting information' + ] + }} +
+
+
+
+

Treatment supporter

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Treatment supporter name : + {{ mappedAttributes.attributes['Treatment Supporter Name'] }} + + Common name: {{ + mappedAttributes.attributes[ + 'Treatment Supporter common name' + ] + }} +
+ Tribe : + {{ mappedAttributes.attributes['Treatment supporter tribe'] }} + + Phone number : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter Contact Phone Number' + ] + }} +
+ Religious affliation: + {{ mappedAttributes.obs['RELIGION'] }} + + Relationship : {{ mappedAttributes.attributes['GRANDPARENT'] }} +
+
+
+
Rural Direction
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter Rural General Route' + ] + }} + + Nearest centre: {{ + mappedAttributes.attributes[ + 'Treatment supporter rural nearest shopping Centre' + ] + }} +
+ Stage : {{ + mappedAttributes.attributes[ + 'Treatment Supporter Rural Bus Stage' + ] + }} + + Village : + {{ + mappedAttributes.attributes['Treatment Supporter Village'] + }} +
+ Nearest landmark : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter Rural Landmark' + ] + }} + + Homestead name : {{ + mappedAttributes.attributes[ + 'Treatment Supporter Rural Homestead' + ] + }} +
+ Whom to ask :{{ + mappedAttributes.attributes[ + 'Treatment Support Rural Person Reporting Info' + ] + }} +
+
+
+
+
Place of Work
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter workplace' + ] + }} + + Institution/Business: {{ + mappedAttributes.attributes[ + 'Treatment Supporter Workplace Institution' + ] + }} +
+ Location : {{ + mappedAttributes.attributes[ + 'Treatment Supporter Workplace Location' + ] + }} + + Department/section : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter workplace Department' + ] + }} +
+ well known name : {{ + mappedAttributes.attributes[ + 'Treatment Supporter Workplace Known Name' + ] + }} +
+
+
+
+
Urban Direction
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter Urban Residence' + ] + }} + + Estate: {{ + mappedAttributes.attributes[ + 'Treatment Supporter Urban Estate' + ] + }} +
+ Stage : {{ + mappedAttributes.attributes[ + 'Treatment supporter urban bus stage' + ] + }} + + Section : + {{ + mappedAttributes.attributes[ + 'Treatment Supporter Urban Section' + ] + }} +
+ Nearest landmark : {{ + mappedAttributes.attributes[ + 'Treatment Supporter Urban Landmark' + ] + }} + + Plot name: {{ + mappedAttributes.attributes[ + 'Treatment Supporter Urban Plot number' + ] + }} +
+ Landlord : {{ + mappedAttributes.attributes[ + 'Treatment Supporter urban landlord' + ] + }} + + Nearest well known neighbor: {{ + mappedAttributes.attributes[ + 'Treatment supporter urban well known neighbour' + ] + }} +
+ Whom to ask: {{ + mappedAttributes.attributes[ + 'Treatment Support Urban Person Reporting Info' + ] + }} +
+
+
+
+
+
+
diff --git a/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.ts b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.ts new file mode 100644 index 000000000..ff1eaaf41 --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.ts @@ -0,0 +1,97 @@ +import { Component, Input, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-locator-pretty-viewer', + templateUrl: './locator-pretty-viewer.component.html', + styleUrls: ['./locator-pretty-viewer.component.css'] +}) +export class LocatorPrettyViewerComponent implements OnInit { + @Input() locatorData: any; + + data: any; + mappedAttributes: any; + constructor() {} + + ngOnInit() { + this.getData(); + } + + getData() { + if (this.locatorData) { + const { obs, patient } = this.locatorData.existingOrders; + + if (patient) { + const { + person: { attributes } + } = patient; + this.data = { + obs, + attributes + }; + } + } + this.mappedAttributes = this.generateMappings(this.data); + console.log('mappedAttributes', this.mappedAttributes); + } + + generateMappings(data: any) { + const mappings = { + obs: {}, + attributes: {} + }; + + if (data) { + for (const type of ['obs', 'attributes']) { + if (data[type]) { + for (const item of data[type]) { + if (type === 'obs' && item.concept.name.display) { + mappings[type][item.concept.name.display] = + item.value.display || item.value; + } else if (type === 'attributes' && item.display) { + const parts = item.display.split('='); + if (parts.length === 2) { + mappings[type][parts[0].trim()] = parts[1].trim(); + } else { + mappings[type][item.display] = item.display; + } + } + } + } + } + } + return mappings; + } + + generatePDF() { + const printContents = document.getElementById('wrapper-container'); + + if (!printContents) { + return; + } + + const contentToPrint = printContents.innerHTML; + const popupWin = window.open( + '', + '_blank', + 'top=0,left=0,height=100%,width=auto' + ); + + popupWin.document.open(); + popupWin.document.write(` + + + Locator Map Details + + + ${contentToPrint} + + `); + popupWin.document.close(); + + // Use an event listener to trigger the print and close actions + popupWin.addEventListener('load', () => { + popupWin.print(); + popupWin.close(); + }); + } +} diff --git a/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.html b/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.html index 6b0e1021e..178f9dd6d 100644 --- a/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.html +++ b/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.html @@ -1,10 +1,14 @@
- +
+ +
+
+ + +
-
{{ errorMessage }}
diff --git a/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.ts b/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.ts index afe4dbae2..b5ea8df09 100644 --- a/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.ts +++ b/src/app/patient-dashboard/common/formentry/pretty-encounter-viewer.component.ts @@ -26,6 +26,9 @@ export class PrettyEncounterViewerComponent implements OnInit { this.displayEncounterObs(encounter); } } + @Input() fromLocatorMap: boolean; + + public locatorData: Form; public form: Form; public showLoader: boolean; public error: boolean; @@ -138,6 +141,7 @@ export class PrettyEncounterViewerComponent implements OnInit { this.selectedEncounter ); this.form = unpopulatedform; + this.locatorData = unpopulatedform; this.showLoader = false; this.error = false; }); diff --git a/src/app/patient-dashboard/common/locator-map/locator-map-details.component.css b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.css new file mode 100644 index 000000000..6c4a2453f --- /dev/null +++ b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.css @@ -0,0 +1,27 @@ +.patient-info-row { + margin-right: 0px; + margin-left: 0px; +} + +.info_section_title { + font-size: 20px; + color: #203864; +} +.edit_link span { + font-size: 1.1em; +} +.edit_link .fa { + display: inline; +} +.edit_link:hover { + cursor: pointer; +} +.spacing { + margin-right: 15px; +} +.smaller-icon { + font-size: 12px; +} +#encounter .modal-nav-header { + padding-bottom: 20px; +} diff --git a/src/app/patient-dashboard/common/locator-map/locator-map-details.component.html b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.html new file mode 100644 index 000000000..06aaa1c0b --- /dev/null +++ b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.html @@ -0,0 +1,105 @@ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
Landmark : {{ landmark }}Workplace : {{ workplace }}
+ Well Known Neighbour : {{ nearestNeighbour }} + + Treatment Supporter Name : {{ treatmentSupporter }} +
Well Known child Name : {{ knownChild }}Tribe {{ tribe }}
+
+ + +
diff --git a/src/app/patient-dashboard/common/locator-map/locator-map-details.component.spec.ts b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.spec.ts new file mode 100644 index 000000000..c43e52abb --- /dev/null +++ b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LocatorMapDetailsComponent } from './locator-map-details.component'; + +describe('LocatorMapDetailsComponent', () => { + let component: LocatorMapDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LocatorMapDetailsComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LocatorMapDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/patient-dashboard/common/locator-map/locator-map-details.component.ts b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.ts new file mode 100644 index 000000000..292af49ed --- /dev/null +++ b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.ts @@ -0,0 +1,170 @@ +import { + Component, + OnInit, + EventEmitter, + Input, + Output, + ViewChild, + ViewEncapsulation +} from '@angular/core'; +import { PatientService } from '../../services/patient.service'; +import { PersonAttributeResourceService } from './../../../openmrs-api/person-attribute-resource.service'; +import { PrettyEncounterViewerComponent } from '../patient-dashboard/common/formentry/pretty-encounter-viewer.component'; +import { EncounterResourceService } from '../../../openmrs-api/encounter-resource.service'; +import { Patient } from '../../../models/patient.model'; +import { Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { take } from 'rxjs/operators'; +import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal'; +import { ModalDirective } from 'ngx-bootstrap/modal'; + +import * as _ from 'lodash'; +@Component({ + selector: 'locator-map-details', + templateUrl: './locator-map-details.component.html', + styleUrls: ['./locator-map-details.component.css'] +}) +export class LocatorMapDetailsComponent implements OnInit { + public patient: Patient = new Patient({}); + + public display = false; + public subscription: Subscription; + public patientLocatorEncounterUuid: string; + public patientLocatorEncounter: any; + public editDetails = false; + public patientEncounters: Array = []; + @ViewChild('staticModal') + public staticModal: ModalDirective; + @ViewChild('modal') + public modal: ModalComponent; + @Output() public isBusy = new EventEmitter(); + @Output() public ShowPrettyEncounterViewer = new EventEmitter(); + @Output() public EncounterObservations = new EventEmitter(); + private patient_uuid: string; + private tribe: string; + private nearestNeighbour: string; + private landmark: string; + private workplace: string; + private knownChild: string; + private treatmentSupporter: string; + private locatorMapFormUuid = '18992298-4fe3-4c77-af9c-df8cf31b6e2b'; + constructor( + private patientService: PatientService, + private personAttributeResourceService: PersonAttributeResourceService, + private router: Router, + private encounterResourceService: EncounterResourceService + ) {} + + public showDialog() { + this.display = true; + } + public close() { + this.modal.close(); + } + public dismissed() { + this.modal.dismiss(); + } + + public showEncounterObservations(encounter) { + this.display = true; + this.isBusy.emit(true); + this.EncounterObservations.emit(encounter); + // console.log('Show observations', encounter); + } + ngOnInit() { + this.subscription = this.patientService.currentlyLoadedPatient.subscribe( + (patient) => { + this.patient = new Patient({}); + if (patient) { + this.patient = patient; + this.getPatientLocation(); + this.getPatientEncounters(); + } + } + ); + } + + public getPatientLocation() { + const patientUuid = this.patient.uuid; + this.personAttributeResourceService + .getPersonAttributesByUuid(patientUuid) + .subscribe((res) => { + res.results.forEach((a: any) => { + if (a.attributeType.uuid === '4dcc4901-d4a1-422a-b6a0-2b24594a0dc6') { + this.knownChild = a.value; + } else if ( + a.attributeType.uuid === '254e3b6a-eeec-4714-9c5f-776cc4d30191' + ) { + this.landmark = a.value; + } else if ( + a.attributeType.uuid === '4dae5b87-884d-4f88-b2fb-85cda2be37d6' + ) { + this.workplace = a.value; + } else if ( + a.attributeType.uuid === '38f592c5-9e44-4629-8561-c2429bc6062d' + ) { + this.nearestNeighbour = a.value; + } else if ( + a.attributeType.uuid === '20360c21-2241-47b6-8442-04aa3594544b' + ) { + this.treatmentSupporter = a.value; + } else if ( + a.attributeType.uuid === 'fb74a24a-13a9-11df-a1f1-0026b9348838' + ) { + this.tribe = a.value; + } + }); + }); + } + public fillLocatorDetails() { + const patientUuid = this.patient.uuid; + + if (patientUuid === undefined || patientUuid === null) { + return; + } + + if (this.patientEncounters.length > 0) { + const url = `/patient-dashboard/patient/${patientUuid}/general/general/formentry/${this.locatorMapFormUuid}`; + this.router.navigate([url], { + queryParams: { + encounter: this.patientLocatorEncounterUuid, + visitTypeUuid: '' + } + }); + } else { + this.router.navigate([ + '/patient-dashboard/patient/' + + patientUuid + + '/general/general/formentry/' + + this.locatorMapFormUuid + ]); + } + } + + public getPatientEncounters() { + this.encounterResourceService + .getEncountersByPatientUuid(this.patient.uuid, false, null) + .pipe(take(1)) + .subscribe((resp) => { + this.patientEncounters = resp.reverse().filter((encounter) => { + if (encounter.form) { + return encounter.form.uuid === this.locatorMapFormUuid; + } + }); + if (this.patientEncounters.length > 0) { + this.editDetails = true; + this.patientLocatorEncounter = _.first(this.patientEncounters); + this.patientLocatorEncounterUuid = _.first( + this.patientEncounters + ).uuid; + } + }); + } + + // tslint:disable-next-line: use-life-cycle-interface + public ngOnDestroy(): void { + if (this.subscription) { + this.subscription.unsubscribe(); + } + } +} diff --git a/src/app/patient-dashboard/common/locator-map/locator-map.component.html b/src/app/patient-dashboard/common/locator-map/locator-map.component.html index 1ac00ef6b..1eb3af07c 100644 --- a/src/app/patient-dashboard/common/locator-map/locator-map.component.html +++ b/src/app/patient-dashboard/common/locator-map/locator-map.component.html @@ -1,4 +1,13 @@ -
+ +
+
+ + +
--> + diff --git a/src/app/patient-dashboard/common/locator-map/locator-map.component.ts b/src/app/patient-dashboard/common/locator-map/locator-map.component.ts index 46b9f26b4..541bd2ab4 100644 --- a/src/app/patient-dashboard/common/locator-map/locator-map.component.ts +++ b/src/app/patient-dashboard/common/locator-map/locator-map.component.ts @@ -16,6 +16,10 @@ import { PatientService } from '../../services/patient.service'; styleUrls: ['./locator-map.css'] }) export class LocatorMapComponent implements OnInit, OnDestroy { + public display = false; + public addDialog = false; + public showSuccessAlert = false; + public showErrorAlert = false; public dataModel: string; public mapInfo: any; public lastUpdatedDate: string; @@ -39,7 +43,15 @@ export class LocatorMapComponent implements OnInit, OnDestroy { private personResourceService: PersonResourceService ) {} - public ngOnInit() { + public ngOnInit(): void {} + + public ngOnDestroy(): void {} + + public showDialog() { + this.display = true; + } + + /*public ngOnInit() { this.subscriptions.push( this.patientService.currentlyLoadedPatient.subscribe((patient) => { if (patient) { @@ -185,5 +197,5 @@ export class LocatorMapComponent implements OnInit, OnDestroy { public resetValues(): void { this.dataModel = null; this.pdfAvailable = false; - } + } */ } diff --git a/src/app/patient-dashboard/common/locator-map/locator-map.css b/src/app/patient-dashboard/common/locator-map/locator-map.css index 7e3aef70e..8de4801e2 100644 --- a/src/app/patient-dashboard/common/locator-map/locator-map.css +++ b/src/app/patient-dashboard/common/locator-map/locator-map.css @@ -4,3 +4,6 @@ img { a img { width: 200px; } +.edit-locator-dialog { + top: 170px !important; +} 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 a0a05e65d..4c8ee52de 100644 --- a/src/app/patient-dashboard/common/patient-dashboard.common.module.ts +++ b/src/app/patient-dashboard/common/patient-dashboard.common.module.ts @@ -93,6 +93,7 @@ import { EditDemographicsComponent } from './patient-info/edit-demographics.comp import { VisitPeriodComponent } from './visit/visit-period/visit-period.component'; import { LocatorMapComponent } from './locator-map/locator-map.component'; import { SecurePipe } from './locator-map/secure.pipe'; +import { LocatorMapDetailsComponent } from './locator-map/locator-map-details.component'; import { CohortMemberModule } from '../../patient-list-cohort/cohort-member/cohort-member.module'; import { EditHealtCenterComponent } from './patient-info/edit-healthcenter.component'; import { VisitEncountersListComponent } from './visit-encounters/visit-encounters-list.component'; @@ -213,6 +214,7 @@ import { UserDefaultPropertiesService } from 'src/app/user-default-properties/us VisitSummaryComponent, LocatorMapComponent, SecurePipe, + LocatorMapDetailsComponent, VisitEncountersListComponent, VisitEncountersComponent, VisitDetailsComponent, @@ -270,6 +272,7 @@ import { UserDefaultPropertiesService } from 'src/app/user-default-properties/us TodayVisitsComponent, LocatorMapComponent, SecurePipe, + LocatorMapDetailsComponent, AgePipe, VisitEncountersListComponent, VisitEncountersComponent, diff --git a/src/app/patient-dashboard/common/patient-encounters/patient-encounter-observations.component.html b/src/app/patient-dashboard/common/patient-encounters/patient-encounter-observations.component.html index 6f1dc7513..263f178b2 100644 --- a/src/app/patient-dashboard/common/patient-encounters/patient-encounter-observations.component.html +++ b/src/app/patient-dashboard/common/patient-encounters/patient-encounter-observations.component.html @@ -64,9 +64,8 @@
- + +
diff --git a/src/app/patient-dashboard/common/patient-info/patient-info.component.css b/src/app/patient-dashboard/common/patient-info/patient-info.component.css index 8ae442d25..289922b12 100644 --- a/src/app/patient-dashboard/common/patient-info/patient-info.component.css +++ b/src/app/patient-dashboard/common/patient-info/patient-info.component.css @@ -19,3 +19,9 @@ .edit_link:hover { cursor: pointer; } +.spacing { + margin-right: 10px; +} +.smaller-icon { + font-size: 12px; +} 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 82fb0026f..642d890a3 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 @@ -69,7 +69,9 @@
Identifiers
+
+
Relationships
@@ -78,9 +80,13 @@
Relationships

+
-
Outreach Locator Map
+
Patient Location Details
+
+ +
diff --git a/src/app/patient-dashboard/common/patient-info/patient-info.component.ts b/src/app/patient-dashboard/common/patient-info/patient-info.component.ts index 337d51def..7f08ad0a0 100644 --- a/src/app/patient-dashboard/common/patient-info/patient-info.component.ts +++ b/src/app/patient-dashboard/common/patient-info/patient-info.component.ts @@ -13,6 +13,7 @@ import { Subscription } from 'rxjs'; export class PatientInfoComponent implements OnInit, OnDestroy { public patient: Patient; public subs: Subscription[] = []; + public display = false; constructor( private appFeatureAnalytics: AppFeatureAnalytics, diff --git a/src/app/patient-dashboard/patient-dashboard.routes.ts b/src/app/patient-dashboard/patient-dashboard.routes.ts index 59d9d52fb..fddbe47ca 100644 --- a/src/app/patient-dashboard/patient-dashboard.routes.ts +++ b/src/app/patient-dashboard/patient-dashboard.routes.ts @@ -13,6 +13,7 @@ import { PatientMonthlyStatusComponent } from './hiv/patient-status-change/patie import { FromentryGuard } from './common/formentry/formentry.guard'; import { FormCreationDataResolverService } from './common/formentry/form-creation-data-resolver.service'; import { LocatorMapComponent } from './common/locator-map/locator-map.component'; +import { LocatorMapDetailsComponent } from './common/locator-map/locator-map-details.component'; import { VisitEncountersComponent } from './common/visit-encounters/visit-encounters.component'; import { GeneralLandingPageComponent } from './general-landing-page/landing-page.component'; import { PatientSearchContainerComponent } from '../patient-search/patient-search-container.component'; @@ -146,6 +147,10 @@ export const routes = [ path: ':programClass/:program/locator-map', component: LocatorMapComponent }, + { + path: ':programClass/:program/locator-map-details', + component: LocatorMapDetailsComponent + }, { path: ':programClass/:program/program-manager', component: ProgramManagerContainerComponent, diff --git a/src/app/shared/ngamrs-shared.module.ts b/src/app/shared/ngamrs-shared.module.ts index c98696108..6241b3075 100644 --- a/src/app/shared/ngamrs-shared.module.ts +++ b/src/app/shared/ngamrs-shared.module.ts @@ -76,6 +76,7 @@ import { KibanaVizComponent } from './kibana-viz/kibana-viz.component'; import { SnakeCaseToTitlePipe } from './pipes/snake-case-to-title.pipe'; import { ProgramSnapshotNegativesComponent } from '../patient-dashboard/hiv/program-snapshot-negatives/program-snapshot-negatives.component'; import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2-multiselect-dropdown'; +import { LocatorPrettyViewerComponent } from '../patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component'; @NgModule({ imports: [ @@ -177,7 +178,8 @@ import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2 MatIconModule, MatExpansionModule, MatTooltipModule, - SnakeCaseToTitlePipe + SnakeCaseToTitlePipe, + LocatorPrettyViewerComponent ], declarations: [ DisplayErrorComponent, @@ -197,7 +199,7 @@ import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown/angular2 PatientEncounterObservationsComponent, PrettyEncounterViewerComponent, CdmProgramSnapshotComponent, - + LocatorPrettyViewerComponent, SnakeCaseToTitlePipe ], providers: [