Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
Getting StartedCerner SetupDeveloper PC SetupGitHub Project TemplatesFull Page DeploymentWorkflow ComponentsComponents & DirectivesButtonConfirm DialogDate Range PickerDrop-DownEmbedded WorkflowIconInputLogOptional TitlePatient SearchPrevent ScrollRadio ButtonsRemaining Screen SpaceResize ObserverScroll BarSelectTabbed MenuTableTreeModels & ServicesAddressAllergyCerner FunctionsCode ValueConfigCustom Custom Data DMInfoDiagnosisDialogEncounterLicenseMPageOrganizationPersonPersonnelPhoneProblemReferenceUtility

Allergy Service

Overview

The allergy service is used to retrieve allergies, reactions and allergy comments from Cerner.

To use this service, you must import the service, assign it to an object, execute a data collection operation (either with the load method on this or any other MPage Developer service, or with the MPage Service executeCCL method). Finally, you need to do something with the data you have retrieved.

Import

import {Component, inject, OnInit, ...etc...} from '@angular/core';
import {AllergyService} from '@clinicaloffice/mpage-developer';

Object Assignment

Using the Angular inject command, assign the AllergyService to a new object. It is recommended that you scope your object as "protected" to allow access from your component HTML.

@Component({...
...})
export class YourComponent implements OnInit {
    protected allergyService = inject(AllergyService);
    ....remaining code...

Data Collection

The examples below demonstrate data collection methods you can use.

// Load the allergies for the current patient default payload of "ALLERGY_ACTIVE"
this.allergyService.load();

// Use the MPage Service to load multiple payload items
this.MPageService.executeCCL({
    payload: {
        patientSource: [{personId: 0, encntrId: 0}],
        person: true,
        allergy: true
});

Payload Options

The allergy service offers payload options to include reactions as well as allergy comments.

The skipJSON option allows skipping generating JSON output. This functionality is useful if you are creating a custom CCL script after everything else has run where you want to summarize specific information.

{
    allergy: {
        reactions: true,
        comments: true,
        skipJSON: true
    }
}

Default Payload Tags that Reference the Allergy Service

ALLERGY_ALL
{
    allergy: {
        reactions: true,
        comments: true
    }
}
ALLERGY_ACTIVE
{
    allergy: {
        reactions: true,
        comments: true
    },
    typeList: [
        {codeSet: 12025, type: 'ACTIVE', typeCd: 0}
    ]
}

Using Callbacks

Both the service load method and MPageService executeCCL methods offer a callback parameter as the final parameter. You can use this callback or another option of your choosing to work with the data returned from Cerner.

this.MPageService.executeCCL({
    payload: {
        ...
    }
}, () => { ...do something here... }

Accessing from HTML

The allergies(), get() or toString() methods in the allergy service can be accessed directly from HTML. The allergies() method will return all loaded allergy information for all patients where the get() method returns allergies for a specific person id and optional substance. The toString() method is similar to the get() method except it flattens the allergies to a single string for a patient.

<b>Allergies:</b> {{ allergyService.toString() }}

Methods / Usable Objects

allergies(): IAllergy[]

Returns and array of all loaded IAllergy values.

clear(personId: number): void

Clears allergies from memory for a specific personId. If 0 is passed as the personId, all allergies for all patients are removed from memory.

get(substanceType: string = '', personId: number): 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").

has(personId: number): boolean

Returns a true or false if allergies for a specific person id is loaded in memory.

length(): number

Returns a count containing the number of allergy values loaded in memory.

load( payload: any = 'ALLERGY_ACTIVE', patientSource: IPatientSource[] = [{personId: 0, encntrId: 0}], callback: any = undefined ): void

Loads allergy information for patients identified in the patientSource array. The payload can be any valid payload string or default payload (see payload tab).

putLog(text: string, type: string = 'info', processId: number = -1, statusText: string = ''): void

Writes a line of text to the MPage Developer log. Valid values for type include 'info', 'error', 'payload', and 'debug'. You should only use the values 'info' or 'error' as 'payload' and 'debug' are reserved for system use. The processId and statusText values can safely be ignored.

toString(substanceType: string = '', personId: number): string

Returns allergies by personId and optional substanceType as a flattened string. Substance type can be any valid display or cdf meaning from code set 12020 (e.g. "DRUG").

values(): IterableIterator<IAllergy>

Returns an iterable iterator representation of all loaded allergy values.

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: true,
        typeList: [
            {codeSet: 12020, type: 'DRUG', typeCd: 0}
            {codeSet: 12025, type: 'ACTIVE', typeCd: 0}
        ]
    }
}

Interfaces

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 {
  reaction: string;
  reactionIdentifier: string;
  reactionFtDesc: string;
}
IAllergyComment {
  commentDtTm: Date;
  commentPrsnlId: number;
  comment: string;
}
<< Prev: Address
Next: Cerner Functions >>
Copyright © 2026 Precision Healthcare Solutions