Person Service
Overview
The PersonService is responsible for retrieving person related data from Cerner for one or more patients.
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 {PersonService} from '@clinicaloffice/mpage-developer';
Object Assignment
Using the Angular inject command, assign the PersonService to a new object. It is recommended that you scope your object as "protected" to allow access to your component HTML.
@Component({...
...})
export class YourComponent implements OnInit {
protected personService = inject(PersonService);
....remaining code...
Data Collection
The examples below demonstrate data collection methods you can use.
// Load the person record for the current patient default payload of "PERSON_MIN"
this.personService.load();
// Use the MPage Service to load multiple payload items
this.MPageService.executeCCL({
payload: {
patientSource: [{personId: 0, encntrId: 0}],
person: {
aliases: true
}
});
Payload Options
The person service offers several payload options described in the following table.
| Property Name | Description |
|---|---|
| aliases | Collect information from the PERSON_ALIAS table. |
| loadExtendedPersons | If set to true, any personId found during the person collection will be added to the patient source and the person records for those associated persons will be collected. |
| names | Collect information from the PERSON_NAME table. |
| orgReltn | Collect information from the PERSON_ORG_RELTN table along with the organization name from the ORGANIZATION table. |
| patient | Collect information from the PERSON_PATIENT table. |
| personCodeReltn | Collect information from the PERSON_CODE_RELTN table. |
| personInfo | Collect information from the PERSON_INFO table. |
| personPlanReltn | Collect information from the PERSON_PLAN_RELTN and HEALTH_PLAN tables. |
| personReltn | Collect information from the PERSON_RELTN and PERSON tables. |
| prsnlReltn | Collect information from the PRSNL_RELTN and PRSNL tables. |
| skipJSON | 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. |
{
person: {
aliases: true,
names: true,
loadExtendedPersons: true
}
}
Default Payload Tags that Reference the Person Service
| PERSON_MIN | {
person: {
aliases: true
},
typeList: [
{codeSet: 4, type: 'MRN', typeCd: 0}
]
}
|
| PERSON_PATIENT | {
person: {
aliases: true,
patient: true,
names: true,
personInfo: true,
prsnlReltn: true,
personReltn: true,
personPlanReltn: true,
orgReltn: true,
personCodeReltn: true
}
}
|
| PERSON_PATIENT_PLUS | {
person: {
aliases: true,
patient: true,
names: true,
personInfo: true,
prsnlReltn: true,
personReltn: true,
personPlanReltn: true,
orgReltn: true,
personCodeReltn: true,
loadExtendedPersons: true
},
prsnl: {
aliases: 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 persons(), get(), getAlias(), getName(), getPersonInfo(), getPersonCodeReltn(), getPlanReltn(), getPrsnlReltn(), getPersonReltn(), and getPersonOrgReltn() methods in the person service can be accessed directly from HTML. The persons() method will return all loaded person information for all patients where the various get() methods return data for a specific person id.
@let patient = personService.get();
<h2>{{ patient?.nameFullFormatted }}</h2>
<p>Age: {{ patient?.age }}, Gender: {{ patient?.sex }}</p>
Methods / Usable Objects
clear(personId: number): voidClears person records from memory for a specific personId. If 0 is passed as the personId, all persons are removed from memory.
get(personId: number = this.MPage.personId): IPerson | undefinedReturns the record for a specific personId if loaded or undefined if not loaded.
getAlias(aliasType: string, personId: number = this.MPage.personId): IPersonAlias | undefinedIf it exists, the getAlias method returns a specific person alias value where the aliasType or aliasTypeMeaning value matches the incoming aliasType string.
getName(nameType: string, personId: number = this.MPage.personId): IPersonName | undefinedIf it exists, the getName method returns a specific person name value where the nameType or nameTypeMeaning value matches the incoming nameType string.
getPersonCodeReltn(codeSet: number, personId: number = this.MPage.personId): IPersonCodeReltn[]Returns an array containing all loaded PERSON_CODE_RELTN records for a specific code set and personId.
getPersonInfo(infoType: string, personId: number = this.MPage.personId, internalSeq: number = 1, prioritySeq: number = 1): IPersonInfo | undefinedIf it exists, the getPersonInfo method returns a specific person info value where the infoType, infoTypeMeaning, infoSubType, or infoSubTypeMeaning value matches the incoming nameType string. Additional filtering is used for determining the internal sequence and priority sequence. If 1 is passed to either value, a 0 or 1 will qualify where PERSON_INFO records with sequences greater than one must be identified in the search.
getPersonOrgReltn(reltnType: string, personId: number = this.MPage.personId, prioritySeq: number = 1): IPersonOrgReltn | undefinedIf it exists, the getPersonOrgReltn method returns a specific organization relation value where the personOrgReltn or personOrgReltnMeaning value matches the incoming reltnType string. Additional filtering is used for determining the priority sequence. If 1 is passed to the method, a 0 or 1 will qualify where PERSON_ORG_RELTN records with a priority sequence greater than one must be identified in the search.
getPersonReltn(reltnType: string, personId: number = this.MPage.personId, internalSeq: number, prioritySeq: number): IPersonReltn | undefinedIf it exists, the getPersonReltn method returns a specific person relation value where the personReltnType or personReltnTypeMeaning value matches the incoming reltnType string. If provided in the call, additional filtering is used for determining the internal sequence and priority sequence.
getPlanReltn(personId: number = this.MPage.personId): IPersonPlanReltn[]Returns all health plans associated with a personId.
getPlanReltnById(personPlanReltnId: number, personId: number = this.MPage.personId): IPersonPlanReltn | undefinedReturns a specific health plan associated with a personId and personPlanReltnId value.
getPrsnlReltn(reltnType: string, personId: number = this.MPage.personId): IPrsnlReltn | undefinedIf it exists, the getPrsnlReltn method returns a specific prsnl relation value where the reltnType or reltnTypeMeaning value matches the incoming reltnType string.
has(personId: number): booleanIndicates if a specific personId has been loaded.
length(): numberReturns a count containing the number of person values loaded in memory.
load( payload: any = 'PERSON_MIN', patientSource: IPatientSource[] = [{personId: 0, encntrId: 0}], callback: any = undefined ): voidLoads person information for patients identified in the patientSource array. The payload can be any valid payload string or default payload (see payload tab).
persons(): Map<number, IPersons>Reference to the person service Map containing all loaded person data.
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<IPerson>Returns an iterable iterator representation of all loaded person 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 "SSN" aliases for patients and you never plan on using the other types, simply add a typeList entry for code set 4 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}],
person: {
aliases: true
}
typeList: [{codeSet: 4, type: 'SSN', typeCd: 0}]
}
}
Interfaces
IPerson {
personId: number;
logicalDomainId: number;
nameFullFormatted: string;
nameLast: string;
nameFirst: string;
nameMiddle: string;
birthDtTm: Date;
age: string;
deceasedDtTm: Date;
lastEncntrDtTm: Date;
autopsy: string;
deceased: string;
ethnicGrp: string;
language: string;
maritalType: string;
race: string;
religion: string;
sex: string;
species: string;
confidLevel: string;
vip: string;
interpRequired: string;
livingWill: string;
gestAgeAtBirth: number;
gestAgeMethod: string;
healthInfoAccessOffered: string;
autopsyCd: number;
deceasedCd: number;
ethnicGrpCd: number;
languageCd: number;
maritalTypeCd: number;
raceCd: number;
religionCd: number;
sexCd: number;
speciesCd: number;
confidLevelCd: number;
vipCd: number;
interpRequiredCd: number;
livingWillCd: number;
gestAgeMethodCd: number;
healthInfoAccessOfferedCd: number;
aliases: IPersonAlias[];
names: IPersonName[];
prsnlReltn: IPrsnlReltn[];
personReltn: IPersonReltn[];
personPlanReltn: IPersonPlanReltn[];
personOrgReltn: IPersonOrgReltn[];
personInfo: IPersonInfo[];
personCodeReltn: IPersonCodeReltn[]
}
IPersonAlias {
aliasPool: string;
aliasType: string;
aliasTypeMeaning: string;
alias: string;
aliasFormatted: string;
aliasSubType: string;
visitSeqNbr: number;
healthCardProvince: string;
healthCardVerCode: string;
healthCardIssueDtTm: Date;
healthCardExpiryDtTm: Date;
healthCardType: string;
aliasPoolCd: number;
personAliasTypeCd: number;
personAliasSubTypeCd: number;
}
IPersonName {
nameType: string;
nameTypeMeaning: string;
begEffectiveDtTm: Date;
endEffectiveDtTm: Date;
nameFullFormatted: string;
nameFirst: string;
nameMiddle: string;
nameLast: string;
nameDegree: string;
nameTitle: string;
namePrefix: string;
nameSuffix: string;
nameInitials: string;
nameTypeSeq: number;
nameTypeCd: number;
}
IPrsnlReltn {
reltnType: string;
reltnTypeMeaning: string;
personId: number;
prioritySeq: number;
prsnlType: string;
nameFullFormatted: string;
physicianInd: number;
position: string;
nameLast: string;
nameFirst: string;
userName: string;
personPrsnlRCd: number;
prsnlTypeCd: number;
positionCd: number;
}
IPersonReltn {
personReltnType: string;
personReltnTypeMeaning: string;
personReltn: string;
relatedPersonReltn: string;
personId: number;
prioritySeq: number;
internalSeq: number;
nameFullFormatted: string;
nameLast: string;
nameFirst: string;
nameMiddle: string;
personReltnTypeCd: number;
personReltnCd: number;
relatedPersonReltnCd: number;
}
IPersonOrgReltn {
personOrgReltnId: number;
personOrgReltn: string;
personOrgReltnMeaning: string;
organizationId: number;
emplType: string;
emplStatus: string;
orgName: string;
prioritySeq: number;
personOrgReltnCd: number;
emplTypeCd: number;
emplStatusCd: number;
}
IPersonInfo {
infoType: string;
infoTypeMeaning: string;
infoSubType: string;
infoSubTypeMeaning: string;
valueNumericInd: number;
valueNumeric: number;
valueDtTm: Date;
chartableInd: number;
prioritySeq: number;
internalSeq: number;
value: string;
longText: string;
infoTypeCd: number;
infoSubTypeCd: number;
valueCd: number;
}
IPersonCodeReltn {
personCodeValueRId: number;
codeSet: number;
codeValue: number;
display: string;
}
IPersonPlanReltn {
personPlanReltnId: number;
healthPlanId: number;
personPlanR: string;
personPlanRCd: number;
organizationId: number;
prioritySeq: number;
memberNbr: string;
signatureOnFile: string;
signatureOnFileCd: number;
balanceType: string;
balanceTypeCd: number;
deductAmt: number;
deductMetAmt: number;
deductMetDtTm: Date;
coverageType: string;
coverageTypeCd: number;
maxOutPcktAmt: number;
maxOutPcktDtTm: Date;
famDeductMetAmt: number;
famDeductMetDtTm: Date;
verifyStatus: string;
verifyStatusCd: number;
verifyDtTm: Date;
verifyPrsnlId: number;
insuredCardName: string;
groupName: string;
groupNbr: string;
policyNbr: string;
subscriberPersonName: string;
subscriberPersonId: number;
memberPersonCode: string;
lifeRsvDays: number;
lifeRsvRemainDays: number;
lifeRsvDailyDedAmt: number;
lifeRsvDailyDedQual: string;
lifeRsvDailyDedQualCd: number;
cardIssueNbr: number;
cardCategory: string;
cardCategoryCd: number;
programStatus: string;
programStatusCd: number;
denialReason: string;
denialReasonCd: number;
coverageComments: string;
contractCode: string;
verifySource: string;
verifySourceCd: number;
extPayerName: string;
extPayerIdent: string;
altMemberNbr: string;
genericHealthPlanName: string;
planType: string;
planTypeCd: number;
planClass: string;
planClassCd: number;
planName: string;
planDesc: string;
financialClass: string;
financialClassCd: number;
babyCoverage: string;
babyCoverageCd: number;
combBabyBill: string;
combBabyBillCd: number;
serviceType: string;
serviceTypeCd: number;
planCategory: string;
planCategoryCd: number;
priorityRankingNbr: number;
}