diff --git a/.vscode/launch.json b/.vscode/launch.json index f0a142628..d08ca05b9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,38 +1,36 @@ { - "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" - ] - } - ] + "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/package-lock.json b/package-lock.json index 0b683431e..8be6b73b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "ngx-amrs", - "version": "2.16.5-SNAPSHOT", - "lockfileVersion": 2, + "version": "2.17.0", + "lockfileVersion": 1, "requires": true, "packages": { "": { @@ -26616,7 +26616,7 @@ "integrity": "sha512-J9X76xnncMw+wIqb15HeWfPMqPwYxSpPY8yWPJ7rAZN/ZDzFkjCSZObryCyUe8zbrVRNiuCnIeQteCzMn7GnWw==", "requires": { "canvg": "1.5.3", - "file-saver": "github:eligrey/FileSaver.js#1.3.8", + "file-saver": "file-saver@github:eligrey/FileSaver.js#1.3.8", "html2canvas": "1.0.0-alpha.12", "omggif": "1.0.7", "promise-polyfill": "8.1.0", 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..4bc51f852 --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.css @@ -0,0 +1,36 @@ +p { + padding: 8px; + background-color: rgba(29, 112, 219, 0.842); + color: #fff; + border-radius: 3px; +} + +.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..3ddde4ca7 --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.html @@ -0,0 +1,755 @@ +
+
+
+ +
+
+
+

Encounter Details

+
    +
  • + Date completed: {{ data?.obs[0]?.obsDatetime }} +
  • +
  • Provider: 1565-1 - Robai Kadanya Kisia
  • +
  • Facility name: Location Test
  • +
+
+
+

Clients/Patient's Information

+
    +
  • + Marital status: {{ data.obs[1].value.display }} +
  • +
  • Place of work: Iten
  • +
  • + Religious affiliation & location: + {{ data.obs[9].value.display }} +
  • +
  • + Patient/Client category: + {{ data.obs[3].value.display }} +
  • +
+
+
+

Other Personal Information

+
    +
  • + No of children: {{ data.obs[6].value }} +
  • +
  • + No of siblings: {{ data.obs[4].value }} +
  • +
  • + Names of family members who know about the status of the client: + {{ data.obs[10].value }} +
  • +
+
+
+

Locator Information

+
    +
  • + Client/Parent/Guardians preferred place of contact: + {{ data.obs[11].value.display }} +
  • +
  • + Time: - {{ data.obs[12].value.display }} +
  • +
  • + Physical Description of the patient/client/Guardian: + {{ data?.obs[13]?.value }} +
  • +
  • + Additional comments: + {{ data?.obs[0]?.value }} +
  • +
  • + Indicate if patient is from AMPATH catchment area: + {{ data?.obs[7]?.value?.display }} +
  • +
+
+
+

Residence and Personal Information

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Official name of client : + {{extractValueFromDisplay(data.person?.attributes[26]?.display)}} + Name commonly called : + {{extractValueFromDisplay(data.person?.attributes[31]?.display)}} +
+ Tribe : + {{ extractValueFromDisplay(data.person?.attributes[3]?.display) }} + + Phone number : + {{ extractValueFromDisplay(data.person?.attributes[1]?.display) }} +
+ Alternative Phone No. : + {{ extractValueFromDisplay(data.person?.attributes[11]?.display) }} + + Occupation : {{ extractValueFromDisplay(data.person?.attributes[13]?.display) }} +
+ Relationship: {{ extractValueFromDisplay(data.person?.attributes[10]?.display) }} + + Location :{{ extractValueFromDisplay(data.person?.attributes[66]?.display) }} +
+
+
+
Place of Work
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ extractValueFromDisplay(data.person.attributes[111]?.display )}} + + Institution/Business: {{ extractValueFromDisplay(data.person?.attributes[110]?.display) }} +
+ Location : + {{ extractValueFromDisplay(data.person?.attributes[12]?.display )}} + + Department/section : {{ extractValueFromDisplay(data.person?.attributes[18]?.display )}} +
+ well known name : {{ extractValueFromDisplay(data.person?.attributes[112]?.display) }} +
+
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
General route : {{ extractValueFromDisplay(data.person.attributes[20].display)}}Nearest centre: {{ extractValueFromDisplay(data.person.attributes[69].display)}}
Stage : {{ extractValueFromDisplay(data.person.attributes[70].display)}}Village : {{ extractValueFromDisplay(data.person.attributes[71].display)}}
Nearest landmark : {{ extractValueFromDisplay(data.person.attributes[72].display)}}Homestead name : {{ extractValueFromDisplay(data.person.attributes[73].display)}}
Whom to ask :{{ extractValueFromDisplay(data.person.attributes[74].display)}}
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Town : {{ extractValueFromDisplay(data.person.attributes[66].display)}}Estate: {{ extractValueFromDisplay(data.person.attributes[67].display)}}
Stage : {{ extractValueFromDisplay(data.person.attributes[17].display)}}Section : {{ extractValueFromDisplay(data.person.attributes[68].display)}}
Nearest landmark : {{ extractValueFromDisplay(data.person.attributes[7].display)}}Plot name: {{ extractValueFromDisplay(data.person.attributes[15].display)}}
Landlord : {{ extractValueFromDisplay(data.person.attributes[16].display)}} + Nearest well known neighbor: {{ extractValueFromDisplay(data.person.attributes[14].display)}} +
Whom to ask : + {{extractValueFromDisplay(data.person.attributes[85].display)}} +
+
+
+
+ +
+

Spouse Details

+
+
+ + + + + + + + + + + + + + + + + + +
+ Name of Spouse : + {{ extractValueFromDisplay(data.person?.attributes[4]?.display )}} + + Name commonly called : {{ extractValueFromDisplay(data.person?.attributes[76]?.display) }} +
+ Tribe : {{ extractValueFromDisplay(data.person?.attributes[77]?.display) }} + + Phone number : + {{ extractValueFromDisplay(data.person?.attributes[5]?.display )}} +
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ extractValueFromDisplay(data.person?.attributes[86]?.display) }} + + Nearest centre: {{ extractValueFromDisplay(data.person?.attributes[87]?.display) }} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[88]?.display) }} + + Village : + {{ extractValueFromDisplay(data.person?.attributes[89]?.display) }} +
+ Nearest landmark : {{ extractValueFromDisplay(data.person?.attributes[90]?.display) }} + + Homestead name : + {{ extractValueFromDisplay(data.person?.attributes[91]?.display) }} +
+ Whom to ask : + {{ extractValueFromDisplay(data.person?.attributes[92]?.display) }} +
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ extractValueFromDisplay(data.person?.attributes[78]?.display )}} + + Estate: {{ extractValueFromDisplay(data.person?.attributes[75]?.display )}} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[79]?.display )}} + + Section : + {{ extractValueFromDisplay(data.person?.attributes[80]?.display )}} +
+ Nearest landmark : {{ extractValueFromDisplay(data.person?.attributes[81]?.display )}} + + Plot name: {{ extractValueFromDisplay(data.person?.attributes[82]?.display )}} +
+ Landlord : {{ extractValueFromDisplay(data.person?.attributes[83]?.display )}} + + Nearest well known neighbor: {{ extractValueFromDisplay(data.person?.attributes[84]?.display )}} +
+ Whom to ask :{{ extractValueFromDisplay(data.person?.attributes[85]?.display )}} +
+
+
+
+

Next of Kin Details

+
+
+ + + + + + + + + + + + + + + + + + +
+ Name of next of kin : + {{ extractValueFromDisplay(data.person?.attributes[2]?.display )}} + + Name commonly called : {{ extractValueFromDisplay(data.person?.attributes[34]?.display) }} +
+ Tribe : + {{ extractValueFromDisplay(data.person?.attributes[35]?.display) }} + + Phone number : + {{ extractValueFromDisplay(data.person?.attributes[6]?.display )}} +
+
+
+
Rural Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ extractValueFromDisplay(data.person?.attributes[96]?.display) }} + + Nearest centre: {{ extractValueFromDisplay(data.person?.attributes[36]?.display) }} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[97]?.display) }} + + Village : + {{ extractValueFromDisplay(data.person?.attributes[56]?.display) }} +
+ Nearest landmark : {{ extractValueFromDisplay(data.person?.attributes[98]?.display) }} + + Homestead name : + {{ extractValueFromDisplay(data.person?.attributes[58]?.display) }} +
+ Whom to ask :{{ extractValueFromDisplay(data.person?.attributes[99]?.display) }} +
+
+
+
+
Urban Direction
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ extractValueFromDisplay(data.person?.attributes[30]?.display) }} + + Estate: {{ extractValueFromDisplay(data.person?.attributes[57]?.display) }} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[93]?.display) }} + + Section : + {{ extractValueFromDisplay(data.person?.attributes[59]?.display) }} +
+ Nearest landmark : {{ extractValueFromDisplay(data.person?.attributes[64]?.display) }} + + Plot name: {{ extractValueFromDisplay(data.person?.attributes[38]?.display) }} +
+ Landlord : {{ extractValueFromDisplay(data.person?.attributes[94]?.display) }} + + Nearest well known neighbor: {{ extractValueFromDisplay(data.person?.attributes[37]?.display) }} +
+ Whom to ask : + {{ extractValueFromDisplay(data.person?.attributes[95]?.display) }} +
+
+
+
+

Treatment supporter name

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Treatment supporter name : + {{ extractValueFromDisplay(data.person?.attributes[8]?.display )}} + + Common name: {{ extractValueFromDisplay(data.person?.attributes[41]?.display) }} +
+ Tribe : + {{ extractValueFromDisplay(data.person?.attributes[42]?.display) }} + + Phone number : + {{ extractValueFromDisplay(data.person?.attributes[9]?.display )}} +
Relationship : {{extractValueFromDisplay(data.person?.attributes[10]?.display)}}Religious affiliation: {{extractValueFromDisplay(data.person?.attributes[49]?.display)}}
+
+
+
Rural Direction
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ General route : + {{ extractValueFromDisplay(data.person?.attributes[103]?.display) }} + + Nearest centre: {{ extractValueFromDisplay(data.person?.attributes[44]?.display )}} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[104]?.display) }} + + Village : + {{ extractValueFromDisplay(data.person?.attributes[60]?.display )}} +
+ Nearest landmark : + {{ extractValueFromDisplay(data.person?.attributes[105]?.display) }} + + Homestead name : + {{ extractValueFromDisplay(data.person?.attributes[62]?.display )}} +
+ Whom to ask :{{ extractValueFromDisplay(data.person?.attributes[106]?.display) }} +
+
+
+
+
Place of Work
+
+ + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ extractValueFromDisplay(data.person?.attributes[47]?.display )}} + + Institution/Business: {{ extractValueFromDisplay(data.person?.attributes[107]?.display) }} +
+ Location : {{ extractValueFromDisplay(data.person?.attributes[108]?.display) }} + + Department/section : + {{ extractValueFromDisplay(data.person?.attributes[48]?.display )}} +
+ well known name : {{ extractValueFromDisplay(data.person?.attributes[109]?.display) }} +
+
+
+
+
Urban Direction
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Town : + {{ extractValueFromDisplay(data.person?.attributes[43]?.display )}} + + Estate: {{ extractValueFromDisplay(data.person?.attributes[63]?.display )}} +
+ Stage : {{ extractValueFromDisplay(data.person?.attributes[100]?.display) }} + + Section : + {{ extractValueFromDisplay(data.person?.attributes[61]?.display )}} +
+ Nearest landmark : {{ extractValueFromDisplay(data.person?.attributes[65]?.display )}} + Plot name: Kwa Mohhamed
+ Landlord : {{ extractValueFromDisplay(data.person?.attributes[101]?.display) }} + + Nearest well known neighbor: {{ extractValueFromDisplay(data.person?.attributes[45]?.display )}} +
+ Whom to ask: {{ extractValueFromDisplay(data.person?.attributes[102]?.display) }} +
+
+
+
+
+
+
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..9fdabd66a --- /dev/null +++ b/src/app/patient-dashboard/common/formentry/locator-pretty-viewer/locator-pretty-viewer.component.ts @@ -0,0 +1,69 @@ +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; + constructor() {} + + ngOnInit() { + this.getData(); + } + + getData() { + if (this.locatorData) { + const { obs, patient } = this.locatorData.existingOrders; + + if (patient) { + const { person } = patient; + this.data = { + obs, + person + }; + } + } + } + + 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(); + }); + } + + extractValueFromDisplay(display: string): string { + const parts = display.split('='); + return parts.length === 2 ? parts[1].trim() : display; + } +} 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..d1831458a 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,15 @@ -
- +
+ +
+
+ + > + +
-
{{ 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..c804975ce --- /dev/null +++ b/src/app/patient-dashboard/common/locator-map/locator-map-details.component.html @@ -0,0 +1,78 @@ + +
+
+
+ +
+ + + Edit + + + Add + + + + View + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
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..799782558 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..6226c3fc7 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 @@ -6,8 +6,8 @@ tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" - aria-hidden="true" -> + aria-hidden="true"> +
diff --git a/src/app/patient-dashboard/common/patient-identifier/edit-patient-identifier.component.html b/src/app/patient-dashboard/common/patient-identifier/edit-patient-identifier.component.html index 0472dba79..cccc4820a 100644 --- a/src/app/patient-dashboard/common/patient-identifier/edit-patient-identifier.component.html +++ b/src/app/patient-dashboard/common/patient-identifier/edit-patient-identifier.component.html @@ -140,15 +140,13 @@ personForm.identifierType.$invalid && personForm.selectedLocation.selected.$invalid" class="btn btn-primary" type="button" - (click)="updatePatientIdentifier()" - > + (click)="updatePatientIdentifier()"> Save
@@ -328,23 +326,20 @@ header="Add Patient Identifiers" [(visible)]="addDialog" closable="true" - styleClass="edit-identifier-dialog" -> + styleClass="edit-identifier-dialog">
+ style="margin-top: 10px"> Done! {{ successAlert }}
+ style="margin-top: 10px"> {{ errorTitle }} {{ errorAlert }}
diff --git a/src/app/patient-dashboard/common/patient-identifier/patient-identifier.component.html b/src/app/patient-dashboard/common/patient-identifier/patient-identifier.component.html index ce32ebbaa..a63d33144 100644 --- a/src/app/patient-dashboard/common/patient-identifier/patient-identifier.component.html +++ b/src/app/patient-dashboard/common/patient-identifier/patient-identifier.component.html @@ -2,8 +2,8 @@ + id="patient_identifier_table"> + 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..307810553 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 @@ -1,3 +1,5 @@ + +

Patient Information

@@ -69,7 +71,9 @@
Identifiers
+
+
Relationships
@@ -78,9 +82,16 @@
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: [