Patient Search Dialog
The Clinical Office Patient Search Dialog extends the Angular Material Dialog Component by offering a flexible patient and/or encounter search window.
Configuration
All configuration for your confirm dialog is performed in the component you wish display the dialog in. If you plan on using the same dialog in multiple components you can use a custom Angular data service instead of storing multiple copies of the same code.
The confirm dialog component is simply a wrapper around the standard Angular Material Dialog Component which means we also need to reference the MatDialog component in our code.
Component Imports
In your component (or custom service), add the following import statements.
import { MatDialog } from '@angular/material/dialog'; V4+ import { MpagePatientSearchComponent } from '@clinicaloffice/clinical-office-mpage-core'; < V3 import { MpagePatientSearchComponent } from '@clinicaloffice/clinical-office-mpage';
You additionally need to inject the MatDialog component in your constructor.
constructor(public dialog: MatDialog) { }
Triggering the Alert
You can trigger the alert at any point in your code. This could be on retrieval of data, when showing an error or based on the action of a button click. The implementation is completely up to you.
To trigger the alert, you simply need to pass the MPageConfirmComponent and your parameters to the open method on the MatDialog component.
const dialogRef = this.dialog.open(MpagePatientSearchComponent, { width: '500px', data: { returnType: 'person' personAlias: ['MRN','SSN'] } });
Although the MatDialog will appear as a modal window, activity will still be occurring in your MPage while the dialog is on screen. It is up to you to control the flow of your MPage if needed while the dialog is displayed.
Configuration Options
In our last example we have defined the width and data properties. The data property is discussed in detail below however there are numerous other configuration options available in the MatDialog component.
The data property is specific to the MpagePatientSearchComponent and offers a number of display properties. All of these display properties have default values set that you can override.
The following table describes all the property values that can be assigned to the data property.
Property | Description | Value | Default |
---|---|---|---|
returnType | Displays either a patient search or encounter search window. | Must be 'encounter' or 'person' | 'encounter' |
cclScript | You can replace the default output script with your own to control what the user sees. | Any valid CCL script that returns the correct record structures. | '1co_enc_search_data:group1' |
fullName | If set to true, user is prompted with a single field for the patient name. A value of false will display a last name and first name prompt to the user. | boolean | false |
birthDate | Indicates if birthdate is included in the prompts. | boolean | false |
sex | Indicates if patient sex is included in the prompts. | boolean | false |
personAlias | Pass in CDF_MEANING values from code set 4 to control which PERSON_ALIAS values are searchable. | Array containing string values | [] |
encntrAlias | Pass in CDF_MEANING values from code set 319 to control which ENCOUNTER_ALIAS values are searchable. | Array containing string values | [] |
Detecting Button Clicks
Often you will want to take some type of action once the confirm or cancel button has been clicked on your dialog. This can be easily accomplished by subscribing to the afterClosed() event of your dialog component.
The afterClosed() subscription should be placed immediately after the dialog.open assignment statement.
The "results" variable shown below will contain the content of the row selected in the dialog. This content will either be the person row for selected patient or a combination of the person and encounter row for a selected encounter. The fields available will match the content returned from the output CCL script.
dialogRef.afterClosed().subscribe(results => { if (results) { // Perform any code to process selected person/encounter } });
The following fields are available in the result object returned from the dialog:
Person
personId, name, mrn, sex, birthDate, age, ethnicGroup
Encounter
personId, name, mrn, sex, birthDate, age, ethnicGroup, encntrId, finNumber, facility, nurseUnit, roomBed, regDtTm, dischDtTm, medicalService, encounterType, attendingPhysician
Replacing 1co_enc_search_data.prg with your own script
The standard 1co_enc_search_data.prg script is equipped to present your users with some common fields typical to an encounter search. Your site however may want other fields displayed to users such as additional providers, patient address or other data not included in the standard script.
Creating your own person search data script is simple. 1co_enc_search_data.prg has been included in the combined 1co_mpage.prg ccl file as well as made available as an independent file in your CCL source code library. You are encouraged to copy this file and make a new version with your desired fields.
The 1co_enc_search_data script makes use of the patient_source record structure to determine which person/encounter records are to be used. With a list of the desired person and encounter records the CCL script simply collects the appropriate data and populates the rCustom record structure shown below.
record rCustom ( 1 person[*] 2 person_id = f8 2 name = vc 2 mrn = vc 2 sex = vc 2 birth_date = dq8 2 age = vc 2 ethnic_group = vc 1 encounter[*] 2 encntr_id = f8 2 person_id = f8 2 fin_number = vc 2 facility = vc 2 nurse_unit = vc 2 room_bed = vc 2 reg_dt_tm = dq8 2 disch_dt_tm = dq8 2 medical_service = vc 2 encounter_type = vc 2 attending_physician = vc )