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, Input } from '@angular/core';
import { AllergyExt, QueryParams } from '../../models/patientModels';
import * as _ from 'lodash';
/**
* Allergies Component - For displaying a table of patient allergies
*/
@Component({
selector: 'app-allergies',
templateUrl: './allergies.component.html',
styleUrls: ['./allergies.component.css']
})
export class AllergiesComponent {
_allergies = {
data: [],
err: '',
dataTable: [],
dataViewExpanded: []
};
@Input()
queryParams: QueryParams;
/**
* input property of allergy data for display. In format {data: Allergy[], err: string }
*/
@Input()
set allergies(allergies: {data: AllergyExt[], err: string}) {
this._allergies.data = allergies.data;
this._allergies.err = allergies.err;
this._allergies.dataTable = [];
this._allergies.dataViewExpanded = [];
if (allergies.data) { _.fill(this._allergies.dataViewExpanded, false, 0, allergies.data.length); }
}
constructor() { }
hasValidAllergies(): boolean {
if (_.find(this._allergies.data, function(itm) { return !itm.gmrAllergy || itm.status === 'active'; })) {
return true;
} else {
return false;
}
}
getMechanism(itm): string {
const rtn = (itm.reactions[0] && itm.reactions[0].mechanism) ? itm.reactions[0].mechanism : 'UNKNOWN';
return RegExp('pharmacologic', 'i').test(rtn) ? 'ADVERSE REACTION' : rtn;
}
}