Organization Service
Overview
The organization service will retrieve organization information 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 {OrganizationService} from '@clinicaloffice/mpage-developer';
Object Assignment
Using the Angular inject command, assign the OrganizationService 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 organizationService = inject(OrganizationService);
....remaining code...
Data Collection
The examples below demonstrate data collection methods you can use.
// Load the organization information for organization 456 and 756 with default payload of "APO_ORG"
this.organizationService.load([{organizationId: 456}, {organizationId: 756}]);
// Use the MPage Service to load multiple payload items for the current organizations 456 and 756
this.MPageService.executeCCL({
payload: {
patientSource: [{personId: 0, encntrId: 0}],
clearPatientSource: true,
orgSource: [{organizationId: 456}, {organizationId: 756}],
organization: {
aliases: true
},
address: true
});
Payload Options
The organization service offers an option to include organization aliases with the optional aliases property as well as an option to skip generating JSON output. Skipping the JSON output will prevent the output of the service from being included in the data returned to your MPage. This functionality is useful if you are creating a custom CCL script after everything else has run where you want to summarize specific information.
{
organization: {
aliases: true,
skipJSON: true
}
}
Default Payload Tags that Reference the Organization Service
| APO_ORG | {
clearPatientSource: true,
organization: {
aliases: true
},
address: true,
phone: true
}
|
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 organizations() or get() methods in the Organization Service can be accessed directly from HTML. The organizations() method will return all loaded organization information where the get() method returns a specific organization based on organization id. Care should be taken to ensure you filter the correct organizations when using the organizations() method.
@let org = organizationService.get(456345);
{{ org?.orgName }}
Methods / Usable Objects
get(organizationId: number): IOrganization | undefinedReturns an IOrganization object containing Cerner organization information for a specific organization.
getAlias(organizationId: number, aliasType: string): IOrganizationRetrieves 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.
has(organizationId: number): booleanReturns a true or false if a specific organization is loaded in memory.
length(): numberReturns a count containing the number of organization values loaded in memory.
load(orgSource: IOrgSource[], payload: any = 'APO_ORG', callback: any = undefined ): voidLoads organization information for organizations identified in the orgSource array. The payload can be any valid payload string or default payload (see payload tab).
organizations(): IOrganization[]Returns and array of all loaded IOrganization values.
putLog(text: string, type: string = 'info', processId: number = -1, statusText: string = ''): voidWrites 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.
values(): IterableIterator<IOrganization>Returns an iterable iterator representation of all loaded organization values.
Interfaces
IOrganization {
organizationId: number;
orgName: string;
federalTaxIdNbr: string;
orgStatus: string;
orgClass: string;
externalInd: number;
orgStatusCd: number;
orgClassCd: number;
aliases: IOrgAlias[];
}
IOrgAlias {
aliasPoolCd: number;
aliasPool: string;
orgAliasTypeCd: number;
orgAliasType: string;
orgAliasTypeMeaning: string;
orgAliasSubTypeCd: number;
orgAliasSubType: string;
alias: string;
aliasFormatted: string;
}
IOrgSource {
organizationId: number;
}