MPage Tree Component
The MPage Tree Component gives you the ability to render a tree control giving your users the ability to quickly navigate through a hierarchical structure such as hospital locations.
The tree component defaults to the location hierarchy however using your own CCL script for other sets of data is fairly simple.
Implementation
Implement the tree component by adding the <mpage-tree></mpage-tree> element to your Angular HTML code and bind a numerical array variable to it.
<mpage-tree label="Location" [(ngModel)]="location"></mpage-tree>
Upon running your MPage your users will see the location tree as a drop-down. On a tree that has no items bound in the tree variable (location) the field will simply display the label "Location". If the bound variable contains valid values, those values will be automatically loaded from Cerner and populated in your tree control as shown in the second image below.
Clicking the arrow will reveal the tree which can be expanded to different levels.
Options Grid
Item | Binding | Data Type | Description |
---|---|---|---|
class | Input | string | CSS class to apply to the field. |
hintLabel | Input | string | Optional hint label to display below field. |
label | Input | string | Text to display in field to identify it to users |
ngModel | Input/Output | number[] | The numerical array which contains your tree values. |
scriptName | Input | string | Script name to execute for all calls to this instance of the tree component. If not provided the location hierarchy CCL script "1co_location_tree" is used. Along with the script name, please provide the compilation level of the CCL script (e.g. 1co_location_tree:group1). |
scriptParams | Input | string | The script params option lets you pass a string of configuration data to your CCL script. This can be anything you want. For example, 1co_location_tree might use the value '"showUnits":["NURSEUNIT","AMBULATORY"],"maxViewLevel":"UNIT"' to indicate that the tree should show nurse units and ambulatory units to a level no deeper than the unit level (excludes rooms and beds). |
Script Parameters
One of the options listed in the options grid is called scriptParams. This string variable should contain any optional code you may want to use in your CCL script.
The default "1co_location_tree" script uses a partial JSON formatted string to control what types of units are displayed in the tree, the maximum depth of the tree that can be navigated as well as optional organization security settings.
An example of scriptParams in the location tree is as follows.
scriptParams='"showUnits":["NURSEUNIT","AMBULATORY"],"maxViewLevel":"UNIT","orgSecurity":true,"censusInd":true'
The following table describes each of the available scriptParam values.
Parameter | Description | Allowed Values | Default Value |
---|---|---|---|
showUnits | Determines which 'Nurse Unit" level location types will be shown by CDF_MEANING in code set 220. These locations would be the locations directly below the building level in the location hierarchy. | e.g. "NURSEUNIT","AMBULATORY","HIM",etc. | None |
maxViewLevel | Indicates how deep in the location tree the user can navigate. Setting "UNIT" would mean that the user could navigate to the Nurse Unit/Ambulatory Unit level and not see any rooms or beds. A value of "ALL" would show all rooms and beds in the tree. | "FACILITY","BUILDING","UNIT","ALL" | "ALL" |
orgSecurity | Determines if organization security should be applied to the tree. | true, false | true |
censusInd | Indicates if the census indicator on the location should be used when reading the locations. | true, false | true |
CCL Submission of Tree Parameters
Submitting your prompt values is typically done through executing a CustomService load event to your custom CCL script. In the example below, we are passing our "location" array from our example above into the parameters object of our CCL script submission.
this.customService.load({
customScript: {
script: [{
name: '1co_v35_test',
run: 'pre',
id: 'test-tree',
parameters: {
location: this.location
}
}],
"clearPatientSource":true
}
});
CCL Script Processing
Inside your CCL script, you must execute 1co_location_routines:group1 passing in your scriptParam values and the name of your location parameter as shown below.
execute 1co_location_routines:group1 ^"showUnits":["NURSEUNIT","AMBULATORY"],"maxViewLevel":"UNIT"^, ^location^
This code will populate a record structure called rFilteredLocations that you can now use in your SELECT statements. rFilteredLocations contains three fields however the only one meant for script use is the locationCd field, which will either contain ambulatory/nurse unit level code values or bed level code values.
The content of locationCd is directly controlled by the "maxViewLevel" value included in your scriptParams. If "maxViewLevel" is set to "ALL", locationCd will contain the code values representing all beds values selected in your tree. Any other selection will default in the ambulatory/nurse unit level values.
Implementing rFilteredLocations in your CCL script is a simple matter of using the CCL EXPAND function as follows.
declare nNum = i4 select from encounter e plan e where expand(nNum, 1, size(rFilteredLocations->data, 5), e.loc_nurse_unit_cd, rFilteredLocations->data[nNum].location_cd) with expand=1