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] 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: [