diff --git a/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.css b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.css new file mode 100644 index 000000000..cfeb4b37f --- /dev/null +++ b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.css @@ -0,0 +1,23 @@ +/* .header { + display: flex; + justify-content: space-between; +} */ +/* +table tbody tr, +table thead tr{ + display: flex; + flex-direction: row; + +} */ +table tbody tr td, +table thead tr th { + width: 50%; +} + +/* table tbody tr td{ + background-color: blue; +} */ + +/* .ahd { + max-width: 100%; +} */ diff --git a/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.html b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.html new file mode 100644 index 000000000..c4902fd4a --- /dev/null +++ b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.html @@ -0,0 +1,134 @@ +
+
+ + + + + + + + + + + + + +
TB Treatment Start DateTB Treatment End Date
+ {{ startDate | date: 'dd-MM-yyyy' }} + + {{ endDate | date: 'dd-MM-yyyy' }} +
+ + + + + + + + + + + + + + +
Cryptococcal Treatment Start Date :Cryptococcal Treatment End Date :
+ {{ startDate | date: 'dd-MM-yyyy' }} + + {{ endDate | date: 'dd-MM-yyyy' }} +
+ + + + + + + + + + + + + + +
PCP Treatment Start DatePCP Treatment End Date
+ {{ startDate | date: 'dd-MM-yyyy' }} + + {{ endDate | date: 'dd-MM-yyyy' }} +
+ + + + + + + + + + + + + + +
Toxoplasmosis Treatment Start DateToxoplasmosis Treatment End Date
+ {{ startDate | date: 'dd-MM-yyyy' }} + + {{ endDate | date: 'dd-MM-yyyy' }} +
+ + + + + + + + + + + + + + +
Kaposis Sarcoma Treatment Start DateKaposis Sarcoma Treatment End Date
+ {{ startDate | date: 'dd-MM-yyyy' }} + + {{ endDate | date: 'dd-MM-yyyy' }} +
+
+ +
+

NO AHD SUMMARY DATA!

+
+
diff --git a/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.spec.ts b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.spec.ts new file mode 100644 index 000000000..e5b210e1b --- /dev/null +++ b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AhdEventsSummaryComponent } from './ahd-events-summary.component'; + +describe('AhdEventsSummaryComponent', () => { + let component: AhdEventsSummaryComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [AhdEventsSummaryComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AhdEventsSummaryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.ts b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.ts new file mode 100644 index 000000000..1166b5d5f --- /dev/null +++ b/src/app/patient-dashboard/hiv/hiv-summary/ahd-events-summary/ahd-events-summary.component.ts @@ -0,0 +1,174 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { DatePipe } from '@angular/common'; +import { HivSummaryService } from '../hiv-summary.service'; +import { PatientService } from 'src/app/patient-dashboard/services/patient.service'; +import { Patient } from 'src/app/models/patient.model'; +import { Subscription } from 'rxjs'; +import * as _ from 'lodash'; + +@Component({ + selector: 'app-ahd-events-summary', + templateUrl: './ahd-events-summary.component.html', + styleUrls: ['./ahd-events-summary.component.css'] +}) +export class AhdEventsSummaryComponent implements OnInit, OnDestroy { + public patientUuid: any; + public patient: Patient; + isHEIActive = false; + public hasError = false; + public dataLoaded = false; + public toxoplasmosisStartDates: any = []; + public toxoplasmosisEndDates: any = []; + public kaposisStartDates: any = []; + public kaposisEndDates: any = []; + public pcpStartDates: any = []; + public pcpEndDates: any = []; + public tbStartdates: any = []; + public tbEnddates: any = []; + public cryptococallStartDates: any = []; + public cryptococallEndDates: any = []; + public ahdSummary: any = []; + public ahd: any; + public subscription: Subscription[] = []; + public errors: any = []; + public loadingAhdSummary = false; + public isLoading: boolean; + + constructor( + private patientService: PatientService, + private hivSummaryService: HivSummaryService, + private datePipe: DatePipe + ) {} + + public ngOnInit() { + this.loadPatient(); + } + + public ngOnDestroy() { + this.subscription.forEach((sub) => { + sub.unsubscribe(); + }); + } + + public loadPatient() { + this.loadingAhdSummary = true; + const patientSub = this.patientService.currentlyLoadedPatient.subscribe( + (patient) => { + if (patient) { + this.patient = patient; + this.patientUuid = this.patient.person.uuid; + this.getPatientHivSummary(this.patientUuid); + } + this.loadingAhdSummary = false; + }, + (err) => { + this.loadingAhdSummary = true; + this.errors.push({ + id: 'patient', + message: 'error fetching patient' + }); + } + ); + this.subscription.push(patientSub); + } + + public getPatientHivSummary(patientUuid) { + const summary = this.hivSummaryService + .getHivSummary(patientUuid, 0, 1, false, this.isHEIActive) + .subscribe((data) => { + // this.tbStartdates = []; + if (data) { + console.log('tb-history: ', data); + if (data.length > 0) { + for (const result in data) { + if (data.hasOwnProperty(result)) { + const hivsum = data[result]; + console.log('hivsum.tb_tx_start_date: ', hivsum); + if ( + hivsum.tb_tx_start_date !== null && + !this.tbStartdates.includes(hivsum.tb_tx_start_date) + ) { + this.tbStartdates = [ + ...this.tbStartdates, + hivsum.tb_tx_start_date + ]; + } + + if (!this.tbEnddates.includes(hivsum.tb_tx_end_date)) { + this.tbEnddates.push(hivsum.tb_tx_end_date); + } + + if ( + !this.cryptococallStartDates.includes( + hivsum.cm_treatment_start_date + ) + ) { + this.cryptococallStartDates.push( + hivsum.cm_treatment_start_date + ); + } + + if ( + !this.cryptococallEndDates.includes( + hivsum.cm_treatment_end_date + ) + ) { + this.cryptococallEndDates.push(hivsum.cm_treatment_end_date); + } + + if ( + !this.pcpStartDates.includes( + hivsum.pcp_prophylaxis_start_date + ) + ) { + this.pcpStartDates.push(hivsum.pcp_prophylaxis_start_date); + } + + if ( + !this.pcpEndDates.includes(hivsum.pcp_prophylaxis_end_date) + ) { + this.pcpEndDates.push(hivsum.pcp_prophylaxis_end_date); + } + + if ( + !this.toxoplasmosisStartDates.includes( + hivsum.toxoplasmosis_start_date + ) + ) { + this.toxoplasmosisStartDates.push( + hivsum.toxoplasmosis_start_date + ); + } + + if ( + !this.toxoplasmosisEndDates.includes( + hivsum.toxoplasmosis_end_date + ) + ) { + this.toxoplasmosisEndDates.push( + hivsum.toxoplasmosis_end_date + ); + } + + if ( + !this.kaposisStartDates.includes(hivsum.kaposis_start_date) + ) { + this.kaposisStartDates.push(hivsum.kaposis_start_date); + } + + if (!this.kaposisEndDates.includes(hivsum.kaposis_end_date)) { + this.kaposisEndDates.push(hivsum.kaposis_end_date); + } + } + } + } + console.log('stx: ', this.tbStartdates); + console.log('tbend: ', this.tbEnddates); + this.isLoading = false; + } else { + this.dataLoaded = true; + } + }); + this.subscription.push(summary); + } +} diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.html b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.html index 5bea21389..681c40063 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.html +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.html @@ -2,16 +2,16 @@ - + + - - + @@ -24,14 +24,24 @@ hivSummary.prev_rtc_date < hivSummary.encounter_datetime }" > - + + - - + + +
Encounter Date Encounter TypeEncounter Date RTC DateDays Missed Medication Pick up DateTB Treatment Start DateTB Treatment End Date ARV Meds CD4 Count Viral Load WHO StageStatus EAC
{{ hivSummary.encounter_datetime | date: 'dd-MM-yyyy' }} {{ hivSummary.encounter_type_name }}{{ hivSummary.encounter_datetime | date: 'dd-MM-yyyy' }} {{ hivSummary.rtc_date | date: 'dd-MM-yyyy' }} + {{ + (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) > + 0 + ? (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) + : 0 + }} + {{ hivSummary.med_pickup_rtc_date | date: 'dd-MM-yyyy' }} {{ hivSummary?.tb_tx_start_date | date: 'dd-MM-yyyy' }}{{ hivSummary?.tb_tx_end_date | date: 'dd-MM-yyyy' }} {{ hivSummary.cur_arv_meds }} {{ hivSummary.cd4_1 }} @@ -51,6 +61,30 @@ {{ hivSummary.cur_who_stage }} {{ hivSummary.mdt_session_number }} + {{ + (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) > + 0 && + (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) <= + 5 + ? 'missed' + : (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) > + 4 && + (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) <= + 28 + ? 'defaulter' + : (hivSummary.encounter_datetime - hivSummary.prev_rtc_date) / + (1000 * 60 * 60 * 24) > + 28 + ? 'LTFU' + : '' + }} +
diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.ts b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.ts index 962a0141b..438b5765f 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.ts +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary-historical.component.ts @@ -1,11 +1,12 @@ /* tslint:disable:no-inferrable-types */ import { take } from 'rxjs/operators/take'; import { Component, OnInit, OnDestroy } from '@angular/core'; - +import * as Moment from 'moment'; import { PatientService } from '../../services/patient.service'; import { HivSummaryService } from './hiv-summary.service'; import { Patient } from '../../../models/patient.model'; import { Subscription } from 'rxjs'; +import { result } from 'lodash'; @Component({ selector: 'hiv-summary-historical', @@ -13,6 +14,7 @@ import { Subscription } from 'rxjs'; styleUrls: ['./hiv-summary.component.css'] }) export class HivSummaryHistoricalComponent implements OnInit, OnDestroy { + public isHEIActive = false; public loadingHivSummary: boolean = false; public hivSummaries: Array = []; public patient: Patient; @@ -25,7 +27,9 @@ export class HivSummaryHistoricalComponent implements OnInit, OnDestroy { public nextStartIndex: number = 0; public hasMedicationRtc = false; public hasMdtSessionNo = false; - isHEIActive: boolean; + public showMissedDays: boolean; + public patientStatus: any; + public daysMissed = 0; constructor( private hivSummaryService: HivSummaryService, @@ -99,6 +103,22 @@ export class HivSummaryHistoricalComponent implements OnInit, OnDestroy { 'med_pickup_rtc_date' ); } + const prev_rtc = new Date(hivsum.prev_rtc_date); + const encounter_date = new Date(hivsum.encounter_datetime); + const startDate = Moment(encounter_date, 'YYYY-MM-DD'); + const endDate = Moment(prev_rtc, 'YYYY-MM-DD'); + const specificDate = Moment('2005-01-01'); + + if (endDate < specificDate) { + this.showMissedDays = false; + } else { + this.showMissedDays = true; + } + const dateDiffInDays = endDate.diff(startDate, 'days'); + if (dateDiffInDays > 0) { + this.daysMissed = dateDiffInDays; + } + if (this.hasMdtSessionNo === false) { this.hasMdtSessionNo = this.hasColumnData( data[r], @@ -109,6 +129,7 @@ export class HivSummaryHistoricalComponent implements OnInit, OnDestroy { } const size: number = data.length; this.nextStartIndex = this.nextStartIndex + size; + this.isLoading = false; } else { this.dataLoaded = true; @@ -126,6 +147,7 @@ export class HivSummaryHistoricalComponent implements OnInit, OnDestroy { ); this.subscription.push(summarySub); } + public loadMoreHivSummary() { this.isLoading = true; this.loadHivSummary(this.patientUuid, this.nextStartIndex); diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.html b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.html index bb5809209..7b2803a62 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.html +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.html @@ -1,13 +1,16 @@

HIV Summary - {{ gbvScreeningLabel }}: {{ gbvScreeningResult }}

- + - + @@ -33,5 +36,8 @@

+ + +

diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.spec.ts b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.spec.ts index fedbc62bf..2288354f8 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.spec.ts +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.spec.ts @@ -13,6 +13,7 @@ import { HivSummaryLatestComponent } from './hiv-summary-latest.component'; import { TabViewModule } from 'primeng/primeng'; import { HivSummaryHistoricalComponent } from './hiv-summary-historical.component'; import { MedicationHistoryComponent } from './medication-history.component'; +import { AhdEventsSummaryComponent } from './ahd-events-summary/ahd-events-summary.component'; import { HivPatientClinicalSummaryComponent } from '../patient-clinical-summaries/hiv-patient-clinical-summary.component'; import { PreviousVisitComponent } from './previous-visit.component'; import { ZeroVlPipe } from './../../../shared/pipes/zero-vl-pipe'; @@ -54,7 +55,8 @@ describe('Component: Hiv Summary', () => { HivPatientClinicalSummaryComponent, PreviousVisitComponent, ZeroVlPipe, - PdfViewerComponent + PdfViewerComponent, + AhdEventsSummaryComponent ] }); }); diff --git a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.ts b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.ts index b746c91f4..5436d9e8a 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.ts +++ b/src/app/patient-dashboard/hiv/hiv-summary/hiv-summary.component.ts @@ -12,6 +12,7 @@ const mdtProgramUuid = 'c4246ff0-b081-460c-bcc5-b0678012659e'; styleUrls: ['./hiv-summary.component.css'] }) export class HivSummaryComponent implements OnInit, OnDestroy { + // isVisible: false; lowViremia: boolean; highViremia: boolean; patientUuid: string; diff --git a/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.css b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.css new file mode 100644 index 000000000..12a02406d --- /dev/null +++ b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.css @@ -0,0 +1,13 @@ +.table { + width: 100%; +} + +th, +td { + padding: 8px; + width: 10%; +} + +th:nth-child(6) { + width: 18%; +} diff --git a/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.html b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.html index 4d8e552f2..9f6475617 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.html +++ b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.html @@ -2,17 +2,23 @@ - + + + + + + +
Encounter Date changeChange Date Previous VL Previous Vl DateDST/DRT Date Current RegimenARV LineReason
{{ encounter.encounter_datetime }} {{ (encounter.previousViralLoad | zeroVl) || ' ' }} {{ encounter.previous_vl_date }} {{ encounter.current_regimen || ' ' }}{{ encounter.cur_arv_line || ' ' }}{{ encounter.reason_for_regimen_change || ' ' }}
diff --git a/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.ts b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.ts index 29b442308..b914984fa 100644 --- a/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.ts +++ b/src/app/patient-dashboard/hiv/hiv-summary/medication-history.component.ts @@ -1,6 +1,5 @@ import { take } from 'rxjs/operators/take'; import { Component, OnInit, OnDestroy } from '@angular/core'; - import { MedicationHistoryResourceService } from '../../../etl-api/medication-history-resource.service'; import { PatientService } from '../../services/patient.service'; import { Subscription } from 'rxjs'; @@ -8,7 +7,7 @@ import { Subscription } from 'rxjs'; @Component({ selector: 'medication-change-history', templateUrl: './medication-history.component.html', - styleUrls: [] + styleUrls: ['./medication-history.component.css'] }) export class MedicationHistoryComponent implements OnInit, OnDestroy { public encounters = []; diff --git a/src/app/patient-dashboard/hiv/patient-dashboard-hiv.module.ts b/src/app/patient-dashboard/hiv/patient-dashboard-hiv.module.ts index 193335680..34699cb14 100644 --- a/src/app/patient-dashboard/hiv/patient-dashboard-hiv.module.ts +++ b/src/app/patient-dashboard/hiv/patient-dashboard-hiv.module.ts @@ -38,6 +38,7 @@ import { GeneXpertResourceService } from './genexpert-images/genexpert-images-re import { HivSummaryService } from './hiv-summary/hiv-summary.service'; import { HivSummaryResourceService } from '../../etl-api/hiv-summary-resource.service'; import { PredictionResourceService } from 'src/app/etl-api/prediction-resource.service'; +import { AhdEventsSummaryComponent } from './hiv-summary/ahd-events-summary/ahd-events-summary.component'; @NgModule({ imports: [ @@ -64,7 +65,8 @@ import { PredictionResourceService } from 'src/app/etl-api/prediction-resource.s HivSummaryHistoricalComponent, MedicationHistoryComponent, PatientMonthlyStatusComponent, - PreviousVisitComponent + PreviousVisitComponent, + AhdEventsSummaryComponent ], declarations: [ HivPatientClinicalSummaryComponent, @@ -73,7 +75,8 @@ import { PredictionResourceService } from 'src/app/etl-api/prediction-resource.s MedicationHistoryComponent, PatientMonthlyStatusComponent, PreviousVisitComponent, - GeneXpertImagesComponent + GeneXpertImagesComponent, + AhdEventsSummaryComponent ], providers: [ GeneXpertResourceService,