Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Component, OnInit } from '@angular/core';
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { QueryParams, AllergyExt, ProgressNote } from '../../models/patientModels';
import { GridElement } from '../../models/uiModels';
import { ProgressNoteComponent } from '../progress-note/progress-note.component';
import { AllergyComponent } from '../allergy/allergy.component';
@Component({
selector: 'app-cwad',
templateUrl: './cwad.component.html',
styleUrls: ['./cwad.component.css']
})
export class CwadComponent implements OnInit {
allergies = {
data: [],
dataTable: []
};
allergyParams: QueryParams = {};
cwad = {
data: [],
dataTable: []
};
cwadParams: QueryParams = {};
set data(incoming: any) {
if (incoming) {
this.allergies.data = incoming.allergies;
this.allergies.dataTable = this.setAllergiesTable(incoming.allergies);
this.cwad.data = incoming.cwad;
this.cwad.dataTable = this.setCWADTable(incoming.cwad);
} else {
this.allergies.dataTable = [];
this.cwad.dataTable = [];
}
}
allergyTableDef: Array<GridElement> = [
{ header: 'GMR Allergy', key: 'gmrAllergy',
tooltip: `<div>This field reflects the standard entry from which the user selected the Causative Agent/Reaction.</div>
<div style="padding-left:5px;margin-top:3px;">(N) – represents a selection from the National Drug File (#50.6)</div>
<div style="padding-left:5px;margin-top:3px;">(A) – represents a selection from the GMR Allergies file (#120.82)</div>
<div style="padding-left:5px;margin-top:3px;">(I) – represents a selection from the Drug Ingredients file (#50.416)</div>
<div style="padding-left:5px;margin-top:3px;">(C) - represents a selection from the VA Drug Class (#50.605)</div>`
},
{ header: 'Severity', key: 'severity', tooltip: 'The seriousness/acuteness of the reaction' },
{ header: 'Signs/Symptoms', key: 'symptoms', tooltip: 'Reactions observed or communicated' },
{ header: 'Facility',
key: 'facility.stationNumber',
tooltip: 'Station number of facility where allergy/ADR record was entered.',
dataTooltipKey: 'facility.siteName'
}
];
cwadTableDef: Array<GridElement> = [
{ header: 'Local Title', key: 'localTitle', tooltip: 'Local Title name assigned to the progress note' },
{ header: 'Date of Note', key: 'entryDate', tooltip: 'Date/Time of Note', format: 'date'},
{ header: 'Facility',
key: 'facility.stationNumber',
tooltip: 'Station number of facility where progress note record was entered.',
dataTooltipKey: 'facility.siteName'
}
];
/**
*
* @param activeModal The currently active modal to display this component within
*/
constructor(public activeModal: NgbActiveModal, private modalService: NgbModal ) {}
ngOnInit() {}
/**
* closes the current modal window
*/
cancel() {
this.activeModal.close();
}
/**
* Build array of records for display in grid
* @param data raw allergy data
*/
setAllergiesTable(data: AllergyExt[]): any {
const retval = [];
data.forEach((itm, idx) => {
if (itm.status !== 'entered-in-error') {
const rec = {
gmrAllergy: '',
severity: '',
symptoms: '',
'facility.stationNumber': itm.facility.stationNumber,
'facility.siteName': itm.facility.siteName,
dataIndex: idx
};
if (!itm.gmrAllergy) {
rec.gmrAllergy = itm.allergyAssessment;
} else {
rec.gmrAllergy = itm.gmrAllergy + ((itm.gmrAllergySource) ? '(' + itm.gmrAllergySource + ')' : '');
rec.severity = (itm.severity) ? itm.severity.key : 'N/A';
if (itm.reactions) {
itm.reactions.forEach((reaction) => {
rec.symptoms += reaction.manifestation.join('<br />') + '<br />';
});
}
}
retval.push(rec);
}
});
return retval;
}
/**
* Build array of note data to display in grid
* @param data raw note data
*/
setCWADTable(data: ProgressNote[]): any {
const retval = [];
data.forEach((itm, idx) => {
if (itm.docType !== 'A') {
const rec = {
localTitle: itm.localTitle,
entryDate: itm.entryDate,
'facility.stationNumber': (itm.facility) ? itm.facility.stationNumber : 0,
'facility.siteName': (itm.facility) ? itm.facility.siteName : 'UNKNOWN',
dataIndex: idx
};
retval.push(rec);
}
});
return retval;
}
/**
* Method for displaying detailed Postings(progress note) record in a modal popup
* @param dataTableRecord the Consult grid record to display
*/
viewNoteDetail(dataTableRecord: any) {
const noteModal = this.modalService.open(ProgressNoteComponent, {size: 'lg', windowClass: 'record-popup'});
noteModal.componentInstance.data = {...this.cwad.data[dataTableRecord.dataIndex]};
}
/**
* method to trigger display of a detailed allergy record
* @param dataTableRecord allergy grid record to display
*/
viewAllergy(dataTableRecord: any) {
if (!this.allergies.data[dataTableRecord.dataIndex].gmrAllergy) { return; }
const allergyModal = this.modalService.open(AllergyComponent, {size: 'lg', windowClass: 'record-popup'});
allergyModal.componentInstance.data = [{...this.allergies.data[dataTableRecord.dataIndex]}];
}
}