AllergyService
The AllergyService is used to retrieve allergies, reactions and allergy comments from Cerner.
Import
The AllergyService should be imported and initialized in the component source that is responsible for displaying data from the service. Alternatively, if you have your required payload information available, you can initialize the loading of your data in the app.component.ts source.
V4+ import { AllergyService } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { AllergyService } from '@clinicaloffice/clinical-office-mpage';
Initialization
Once you have imported the AllergyService, you need to inject it into your component and assign it to a variable. This is done through the constructor of your component (or the app.component.ts file).
export class myComponent implements OnInit { constructor(public allergyService: AllergyService) { } }
Initialization can be performed one of three ways.
-
In the ngOnInit() method of your app.component.ts or component file through a payload tag and direct
call to the MPageService executeCCL method.
ngOnInit() { this.mpage.executeCCL({ payload: { patientSource: [{personId: 0, encntrId: 0}], allergy: {} } } }
-
Call the AllergyService load method from the ngOnInit() method of your app.component.ts or component file.
ngOnInit() { this.allergyService.load(); }
-
Executed dynamically from your HTML with the AllergyService get or toString methods.
<p>Patient Drug Allergies: {{ allergyService.toString('DRUG') }} </p>
Methods
clear(personId: number = this.mpage.personId):
void
Clears allergies from memory for a specific personId. If 0 is passed as the personId, all allergies are
removed from memory.
get(substanceType: string = "",
personId: number = this.mpage.personId,
payload: any = "ALLERGY_ACTIVE"):
IAllergy[]
Returns allergies by personId and optional substanceType. Substance type can be any valid display or
cdf meaning from code set 12020 (e.g. "DRUG"). If the allergies have not been loaded, they will
be queued up and loaded. *if autoLoadServices has not been disabled*.
load(payload: any = "ALLERGY_ACTIVE",
patientSource: IPatientSource[] = [{"personId":0,"encntrId":0}]):
void
Loads allergy information for the provided patientSource. The payload can be
any valid payload string or default payload (see payload tab).
putLog(message: string): void
Outputs the content of the message parameter to the activity log component.
toString(substanceType: string = "",
personId: number = this.mpage.personId,
payload: any = "ALLERGY_ACTIVE"): string
Returns allergies by personId and optional substanceType as a single string with values seperated by commas.
Substance type can be any valid display or cdf meaning from code set 12020 (e.g. "DRUG"). If the allergies have not
been loaded, they will
be queued up and loaded.
typeList Filtering
You can limit the amount of data collected in CCL by optionally adding a typeList object to your payload. For example, if you only wanted to load "DRUG" allergies for patients and you never plan on using the other types, simply add a typeList entry for code set 12020 to your payload. Simply include the codeSet value, type or typeCd where type represents a cdf_meaning or display_key value and typeCd represents the actual code value you want to filter by. Additionally you can also filter on code set 12025 to limit the reaction status results (e.g. "ACTIVE", "CANCELED", etc.).
{ payload: { patientSource: [{personId: 0, encntrId: 0}], allergy: {}, typeList: [{codeSet: 12020, type: 'DRUG', typeCd: 0}] } }
Public Variables
The AllergyService exposes the following variable that can be useful in the development of your MPages. Interface descriptions of IAllergy, IAllergyReaction and IAllergyComment are available at the bottom of this page.
- allergies:IAllergy[] - Array containing patient allergy values.
Payload
The following payload options represent all available payload values for the AllergyService.
{ payload: { patientSource: [{personId: value, encntrId: value}], allergy: { includeCodeValues: true, reactions: true, comments: true } typeList: [ {codeSet: 12020, type: 'value', typeCd: value}, {codeSet: 12025, type: 'value', typeCd: value} ] } }
Default Payload Tags
The following default payload tags have been defined for use in your MPages.
ALLERGY_ALL
allergy: { includeCodeValues: true, reactions: true, comments: true }
ALLERGY_ACTIVE
allergy: { includeCodeValues: true, reactions: true, comments: true } typeList: [ {codeSet: 12025, type: 'ACTIVE', typeCd: 0} ]
Interfaces
IAllergy
export interface IAllergy { personId: number; encntrId: number; allergyId: number; allergyInstanceId: number; substance: string; substanceIdentifier: string; substanceFtDesc: string; substanceType: string; substanceTypeMeaning: string; reactionClass: string; severity: string; sourceOfInfo: string; sourceOfInfoFt: string; onsetDtTm: Date; reactionStatus: string; createdDtTm: Date; createdPrsnlId: number; cancelReason: string; cancelDtTm: Date; cancelPrsnlId: number; verifiedStatusFlag: number; recSrcVocab: string; recSrcIdentifier: string; recSrcString: string; onsetPrecision: string; onsetPrecisionFlag: number; reviewedDtTm: Date; reviewedPrsnlId: number; origPrsnlId: number; reactionStatusDtTm: Date; substanceTypeCd: number; reactionClassCd: number; severityCd: number; sourceOfInfoCd: number; reactionStatusCd: number; cancelReasonCd: number; recSrcVocabCd: number; onsetPrecisionCd: number; reactions: IAllergyReaction[]; comments: IAllergyComment[]; }
IAllergyReaction
export interface IAllergyReaction { reaction: string; reactionIdentifier: string; reactionFtDesc: string; }
IAllergyComment
export interface IAllergyComment { commentDtTm: Date; commentPrsnlId: number; comment: string; }