APOService
The APOService is responsible for retrieving Address, Phone and Organization data from Cerner.
Import
The APOService 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 { APOService } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { APOService } from '@clinicaloffice/clinical-office-mpage';
Initialization
Once you have imported the APOService, 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 apoService: APOService) { } }
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}], address: {}, phone: {}; } }); }
-
Call the APOService load method from the ngOnInit() method of your app.component.ts or component file.
ngOnInit() { this.apoService.load(); }
-
Executed dynamically from your HTML with the APOService org, address or phone methods.
<p>Patient Phone Number: {{ apoService.getPhone('HOME').phoneFormatted }}</p>
Methods
getAddress(addressType: string,
parentEntityId: number = this.mpage.personId,
parentEntityType: string = "PERSON"): IAddress
Returns a object containing Cerner address information for either a person or organization. If an
address has not been loaded for the requested parentEntityId it will be loaded
*if autoLoadServices has not been disabled*.
Valid values for addressType can be found in code set 212 and you can either use the cdf_meaning or display value. parentEntityId represents a personId or organizationId with a default value being the current patient. parentEntityType can either have a value of "PERSON" or "ORGANIZATION". The default is "PERSON".
getOrg(organizationId: number,
payload: any = "APO_ORG"): IOrganization
Returns a specific organization by organizationId. If the organization has not been loaded, it will
be queued up and loaded
*if autoLoadServices has not been disabled*.
getOrgAlias(organizationId: number,
aliasType:string): IOrgAlias
Retrieves a specific organization alias based on the organizationId and the alias type. Valid values for
aliasType can be found in code set 334. You can pass either the display or cdf_meaning from code set 334.
getPhone(phoneType: string,
parentEntityId: number = this.mpage.personId,
parentEntityType: string = "PERSON"): IPhone
Returns a object containing Cerner phone information for either a person or organization. If a
phone has not been loaded for the requested parentEntityId it will be loaded
*if autoLoadServices has not been disabled*.
Valid values for phoneType can be found in code set 43 and you can either use the cdf_meaning or display value. parentEntityId represents a personId or organizationId with a default value being the current patient. parentEntityType can either have a value of "PERSON" or "ORGANIZATION". The default is "PERSON".
hasOrg(organizationId: number): boolean
Returns a boolean value indicating if the specified organization has been loaded.
load(payload: any = "APO_ALL",
dataSource: any[] = [{"personId":0,"encntrId":0}],
sourceType: string = "patientSource"): void
Loads Address/Phone/Organization information for either a patientSource or orgSource. The payload can be
any valid payload string or default payload (see payload tab).
If the sourceType is set to "patientSource", the dataSource array must be in the valid PatientSource format of [{"personId": value, "encntrId": value}] where value represents a personId/encntrId pair. Passing the value of 0 for both personId/encntrId in a chart MPage will result in the current encounter being used.
If sourceType is set to "orgSource", the dataSource array must be in the format of [{"organizationId": value}] where value represents a valid Cerner ORGANIZATION_ID.
An optional parameter called phoneOption exists that can be used to set the phone format option on the CNVTPHONE statement. If not set, the default value of 0 is used. Valid values are 0, 1, 2 as per the official Cerner documentation .
putLog(message: string): void
Outputs the content of the message parameter to the activity log component.
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 "HOME" address for patients and you never plan on using the other types, simply add a typeList entry for code set 212 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.
{ payload: { patientSource [{personId: 0, encntrId: 0}], address: {}, typeList: [{codeSet: 212, type: 'HOME', typeCd: 0}] } }
Public Variables
A number of variables exist in the APOService that can be useful in the development of your MPages. They are as follows:
- address: IAddress[] - Array containing person/organization address values.
- organization: IOrganization[] - Array containing organizations.
- phone: IPhone[] - Array containing person/organization phone values.
- executed: boolean - Determines if APO execution has occurred at least once. Can be reset to false.
Payload
The following payload options represent all available payload values for the APOService.
{ payload: { patientSource:[{personId: value, encntrId: value}], orgSource: [{organizationId: value}], organization: { includeCodeValues: true, aliases: true }, address: { includeCodeValues: true }, phone: { includeCodeValues: true, phoneOption: 0 }, typeList: [ {codeSet: 334, type: 'value', typeCd: value}, {codeSet: 212, type: 'value', typeCd: value}, {codeSet: 43, type: 'value', typeCd: value} ] } }
Default Payload Tags
The following default payload tags have been defined for use in your MPages.
APO_ORG
organization: { includeCodeValues: true, aliases: true }
APO_ADDR
address: { includeCodeValues: true }
APO_PHONE
phone: { includeCodeValues: true }
APO_ALL
address: { includeCodeValues: true }, phone: { includeCodeValues: true }
Interfaces
IAddress
export interface IAddress { parentEntityId: number; parentEntityName: string; addressId: number; addressType: string; addressTypeMeaning: string; addressTypeSeq: number; activeInd: number; begEffectiveDtTm: Date; endEffectiveDtTm: Date; streetAddr: string; streetAddr2: string; streetAddr3: string; streetAddr4: string; city: string; state: string; zipCode: string; county: string; country: string; addressTypeCd: number; stateCd: number; countyCd: number; countryCd: number; }
IOrganization
export interface IOrganization { organizationId: number; orgName: string; federalTaxIdNbr: string; orgStatus: string; orgClass: string; externalInd: number; orgStatusCd: number; orgClassCd: number; aliases: IOrgAlias[]; }
IOrgAlias
export interface IOrgAlias { aliasPool: string; aliasType: string; aliasTypeMeaning: string; alias: string; aliasFormatted: string; aliasSubType: string; aliasPoolCd: number; orgAliasTypeCd: number; orgAliasSubTypeCd: number; }
IPhone
export interface IPhone { parentEntityId: number; parentEntityName: string; phoneId: number; phoneType: string; phoneTypeMeaning: string; phoneTypeSeq: number; activeInd: number; begEffectiveDtTm: Date; endEffectiveDtTm: Date; phoneNumber: string; phoneFormatted: string; extension: string; phoneTypeCd: number; }