PersonService
The PersonService is responsible for retrieving person related data from Cerner.
Import
The PersonService 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 { PersonService } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { PersonService } from '@clinicaloffice/clinical-office-mpage';
Initialization
Once you have imported the PersonService, 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 personService: PersonService) { } }
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}], person: { } } } }
-
Call the PersonService loadPerson method from the ngOnInit() method of your app.component.ts or component file.
ngOnInit() { this.personService.load(); }
-
Executed dynamically from your HTML with the PersonService person method.
<p>Patient Name: {{ personService.get().nameFullFormatted }} </p>
Methods
get(
personId: number = this.mpage.personId,
payload: any = 'PERSON_MIN'): IPerson
Returns a specific person record by personId. If the person record has not been loaded, it will be loaded
with the associated payload. *if autoLoadServices has not been disabled*.
getAlias(
aliasType: string,
personId: number = this.mpage.personId): IPersonAlias
Retrieves a specific person alias record based on the personId and the alias type. Valid values for
aliasType can be found in code set 4. You can pass either the display or cdf_meaning from code set 4.
getName(
nameType: string,
personId: number = this.mpage.personId): IPersonName
Retrieves a specific person name record based on the personId and the name type. Valid values for
nameType can be found in code set 213. You can pass either the display or cdf_meaning from code set 213.
getPersonInfo(
infoType: string,
personId: number = this.mpage.personId,
internalSeq: number = 1,
prioritySeq: number = 1): IPersonInfo
Retrieves a specific person info record based on the personId and the info type as well as optional internalSeq
and prioritySeq values. Valid values for infoType can be found in code set 356 using either the display or
cdf_meaning values.
getPersonOrgReltn(
reltnType: string,
personId: number = this.mpage.personId,
prioritySeq: number = 1): IPersonOrgReltn
Retrieves a person organization relationship (e.g. Employer) record based on the personId and the relation type as
well as optional prioritySeq value. Valid values for reltnType can be found in code set 338 using either the display
or
cdf_meaning values.
getPersonReltn(
reltnType: string,
personId: number = this.mpage.personId,
internalSeq: number [Optional],
prioritySeq: number [Optional]): IPersonReltn
Retrieves a specific person relation (e.g. Spouse) record based on the personId and the relation type as
well as optional prioritySeq value. Valid values for reltnType can be found in code set 351 using either the display
or
cdf_meaning values.
getPrsnlReltn(
reltnType: string,
personId: number = this.mpage.personId): IPrsnlReltn
Retrieves a specific person prsnl relation record based on the personId and the relation type. Valid values for
reltnType can be found in code set 331 using either the display or
cdf_meaning values.
load(
payload: any = "PERSON_MIN",
patientSource: IPatientSource[] = [{"personId":0,"encntrId":0}]): void
Loads person record(s) based on values stored in PatientSource. The payload can be any valid payload object or
default tag.
putLog(message: string): void
Outputs the content of the message parameter to the activity log component.
isLoaded(personId: number = this.mpage.personId):
boolean
Returns true or false if the personId passed to the method has been loaded from CCL.
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}] } }
Public Variables
The PersonService exposes a variable that can be useful in the development of your MPages. It is:
- persons: Map<number, IPerson> - Map containing person record values keyed by personId.
Payload
The following payload options represent all available payload values for the PersonService.
{ payload: { patientSource: [ {personId: value, encntrId: value} ], person: { patient: true, aliases: true, names: true, personInfo: true, prsnlReltn: true, personReltn: true, orgReltn: true } typeList: [ {codeSet: 4, type: 'value', typeCd: value}, {codeSet: 213, type: 'value', typeCd: value}, {codeSet: 331, type: 'value', typeCd: value}, {codeSet: 351, type: 'value', typeCd: value}, {codeSet: 338, type: 'value', typeCd: value}, {codeSet: 356, type: 'value', typeCd: value}, {codeSet: 320, type: 'value', typeCd: value}, {codeSet: 357, type: 'value', typeCd: value} ] } }
Default Payload Tags
The following default payload tags have been defined for use in your MPages.
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, orgReltn: true }
Interfaces
IPerson
export interface IPerson { personId: number; logicalDomainId: number; nameFullFormatted: string; nameLast: string; nameFirst: string; nameMiddle: string; birthDtTm: Date; 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[]; personOrgReltn: IPersonOrgReltn[]; personInfo: IPersonInfo[]; personCodeReltn: IPersonCodeReltn[] }
IPersonAlias
export interface 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
export interface 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
export interface 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
export interface 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
export interface IPersonOrgReltn { personOrgReltn: string; personOrgReltnMeaning: string; organizationId: number; emplType: string; emplStatus: string; orgName: string; prioritySeq: number; personOrgReltnCd: number; emplTypeCd: number; emplStatusCd: number; }
IPersonInfo
export interface 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
export interface IPersonCodeReltn { personCodeValueRId: number; codeSet: number; codeValue: number; display: string; }