EncounterService
The EncounterService is responsible for retrieving encounter related data from Cerner.
Import
The EncounterService 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 { EncounterService } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { EncounterService } from '@clinicaloffice/clinical-office-mpage';
Initialization
Once you have imported the EncounterService, 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 encounterService: EncounterService) { } }
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}], encounter: { } } }); }
-
Call the EncounterService loadEncounter method from the ngOnInit() method of your app.component.ts or component file.
ngOnInit() { this.encounterService.load(); }
-
Executed dynamically from your HTML with the EncounterService encounter method.
<p>Visit Type: {{ encounterService.get().encntrType }} </p>
Methods
get(encntrId: number = this.mpage.encntrId,
payload: any = "ENCOUNTER_MIN"): any
Returns a specific encounter record by encntrId. If the encounter record has not been loaded, it will be loaded
with the associated payload.
getAlias(aliasType: string,
encntrId: number = this.mpage.encntrId): any
Retrieves a specific encounter alias record based on the encntrId and the alias type. Valid values for
aliasType can be found in code set 319. You can pass either the display or cdf_meaning from code set 319.
getEncntrInfo(infoType: string,
encntrId: number = this.mpage.encntrId,
internalSeq: number = 1,
prioritySeq: number = 1): any
Retrieves a specific encounter info record based on the encntrId 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.
getLocationHistory(timeStamp: Date,
encntrId: number = this.mpage.encntrId): any
Retrieves a encounter location history record for the specified encntrId as a specific date and time. This
method is extremely useful when trying to match patient locations at the times orders are placed or
where tests are performed.
getPrsnlReltn(reltnType: string,
encntrId: number = this.mpage.encntrId): any
Retrieves a specific encounter prsnl relation record based on the encntrId and the relation type. Valid values for
reltnType can be found in code set 333 using either the display or cdf_meaning values.
load(payload: any = 'ENCOUNTER_MIN',
patientSource: IPatientSource[] = [{personId:0, encntrId:0}],
sourceType: string = 'patientSource'): void
Loads encounter record(s) based on values stored in PatientSource. The payload can be any valid payload object or default tag.
loadList(script: string,
parameters: any,
clearPatientSource: boolean,
customId: string = '',
typeList: ITypeList[] = [{codeSet: 0, type: '', typeCd: 0}],
payload: any = 'ENCOUNTER_LIST_MIN',
patientSource: IPatientSource[] = [{personId: 0, encntrId: 0}]): void
The loadList method is used to execute a custom CCL script designed to load multiple encounters. This CCL script can be
one of the ones provided with Clinical Office or it can be a script of your own.
The following "script" values are available for use in your MPages.
-
1co_mpage_enc_list:group1
Loads visits by date range on any indexed date field. Script supports a number of typeList filters and will use the patientSource if the clearPatientSource is set to false.
For more information on loadList including required parameters and accepted typeList filters click here.
isLoaded(encntrId: number = this.mpage.encntrId): boolean
Returns true or false if the encntrId passed to the method has been loaded from CCL.
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 "FIN NBR" aliases for visits and you never plan on using the other types, simply add a typeList entry for code set 319 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}], encounter: { aliases: true } typeList: [{codeSet: 319, type: 'FIN NBR', typeCd: 0}] } }
Public Variables
The EncounterService exposes a variable that can be useful in the development of your MPages. It is:
- encounters: Map<number, any> - Map containing encounter record values keyed by encntrId.
Payload
The following payload options represent all available payload values for the EncounterService.
{ payload: { patientSource:[ {personId: value, encntrId: value} ], encounter: { includeCodeValues: true, aliases: true, encounterInfo: true, prsnlReltn: true, locHist: true } typeList: [ {codeSet: 319, type: 'value', typeCd: value}, {codeSet: 333, type: 'value', typeCd: value}, {codeSet: 356, type: 'value', typeCd: value} ] } }
Default Payload Tags
The following default payload tags have been defined for use in your MPages.
ENCOUNTER_MIN
encounter: { aliases: true }
ENCOUNTER_ALL
encounter: { includeCodeValues: true aliases: true, encounterInfo: true, prsnlReltn: true, locHist: true }
Results
The EncounterService populates a map variable called encounters. The results returned are based entirely on the payload parameters chosen.
encounters
- encntrId
- personId
- encntrClass
- encntrType
- encntrTypeClass
- encntrStatus
- preRegDtTm
- preRegPrsnlId
- regDtTm
- regPrsnlId
- estArriveDtTm
- estDepartDtTm
- arriveDtTm
- departDtTm
- admitType
- admitSrc
- admitMode
- dischDisposition
- dischToLoctn
- readmit
- accommodation
- accommodationRequest
- ambulatoryCond
- courtesy
- isolation
- medService
- confidLevel
- vip
- location
- locFacility
- locBuilding
- locNurseUnit
- locRoom
- locBed
- dischDtTm
- organizationId
- reasonForVisit
- encntrFinancialId
- financialClass
- trauma
- triage
- triageDtTm
- visitorStatus
- inpatientAdmitDtTm
- encntrClassCd (includeCodeValues: true)
- encntrTypeCd (includeCodeValues: true)
- encntrTypeClassCd (includeCodeValues: true)
- encntrStatusCd (includeCodeValues: true)
- admitTypeCd (includeCodeValues: true)
- admitSrcCd (includeCodeValues: true)
- admitModeCd (includeCodeValues: true)
- dischDispositionCd (includeCodeValues: true)
- dischToLoctnCd (includeCodeValues: true)
- readmitCd (includeCodeValues: true)
- accommodationCd (includeCodeValues: true)
- accommodationRequestCd (includeCodeValues: true)
- ambulatoryCondCd (includeCodeValues: true)
- courtesyCd (includeCodeValues: true)
- isolationCd (includeCodeValues: true)
- medServiceCd (includeCodeValues: true)
- confidLevelCd (includeCodeValues: true)
- vipCd (includeCodeValues: true)
- locationCd (includeCodeValues: true)
- locFacilityCd (includeCodeValues: true)
- locBuildingCd (includeCodeValues: true)
- locNurseUnitCd (includeCodeValues: true)
- locRoomCd (includeCodeValues: true)
- locBedCd (includeCodeValues: true)
- financialClassCd (includeCodeValues: true)
- traumaCd (includeCodeValues: true)
- triageCd (includeCodeValues: true)
- visitorStatusCd (includeCodeValues: true)
-
aliases (aliases: true)
- aliasPool
- aliasType
- aliasTypeMeaning
- alias
- aliasFormatted
- aliasSubType
- aliasPoolCd (includeCodeValues: true)
- encntrAliasTypeCd (includeCodeValues: true)
- encntrAliasSubTypeCd (includeCodeValues: true)
-
prsnlReltn (prsnlReltn: true)
- reltnType
- reltnTypeMeaning
- personId
- prioritySeq
- internalSeq
- prsnlType
- nameFullFormatted
- physicianInd
- position
- nameLast
- nameFirst
- userName
- encntrPrsnlRCd (includeCodeValues: true)
- prsnlTypeCd (includeCodeValues: true)
- positionCd (includeCodeValues: true)
-
encntrInfo (encounterInfo: true)
- infoType
- infoTypeMeaning
- infoSubType
- infoSubTypeMeaning
- valueNumericInd
- valueNumeric
- valueDtTm
- chartableInd
- prioritySeq
- internalSeq
- value
- longText
- infoTypeCd (includeCodeValues: true)
- infoSubTypeCd (includeCodeValues: true)
- valueCd (includeCodeValues: true)
-
locHist (locHist: true)
- begEffectiveDtTm
- endEffectiveDtTm
- arriveDtTm
- arrivePrsnlId
- departDtTm
- departPrsnlId
- location
- locFacility
- locBuilding
- locNurseUnit
- locRoom
- locBed
- encntrType
- medService
- transactionDtTm
- activityDtTm
- accommodation
- accommodationRequest
- admitType
- isolation
- organizationId
- encntrTypeClass
- locationCd (includeCodeValues: true)
- locFacilityCd (includeCodeValues: true)
- locBuildingCd (includeCodeValues: true)
- locNurseUnitCd (includeCodeValues: true)
- locRoomCd (includeCodeValues: true)
- locBedCd (includeCodeValues: true)
- encntrTypeCd (includeCodeValues: true)
- medServiceCd (includeCodeValues: true)
- accommodationCd (includeCodeValues: true)
- accommodationRequestCd (includeCodeValues: true)
- admitTypeCd (includeCodeValues: true)
- isolationCd (includeCodeValues: true)
- encntrTypeClassCd (includeCodeValues: true)