Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
TutorialsWorkflow Component1. Getting Started2. Data Retrieval3. Tabbed Menu4. Building Reusable Parts5. Information Tab6. Relationship Tab7. Provider Relationship Tab8. Final StepsFull Page MPage1. Getting Started2. User Prompts3. Custom Script - Part 14. Add a Table5. Click to View Details6. Custom Script - Part 27. Add Remaining Details8. Bonus - Deploy to DA2Third Party IntegrationExcelJS

Provider Relationship Tab

The provider relationship tab has been designed as part of this tutorial to demonstrate the value of the typelist filtering available in MPage Developer services.

Unlike the other two tabs, we are going to keep this one simple by displaying only the names and provider types for our patient personnel relationships and encounter personnel relationships. This tab, like the others, should be seen as a learning exercise and starting point for creating your own MPage workflow components.

Steps

  1. Open providers.ts and replace the code with the code shown below. We will not be highlighting anything here as it has been covered in the previous tabs.
    import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
    import { EncounterService, PersonService, IPrsnlReltn, IEncntrPrsnlReltn } from '@clinicaloffice/mpage-developer';
    import { Field } from '../field/field';
    
    @Component({
      selector: 'app-providers',
      imports: [Field],
      templateUrl: './providers.html',
      styleUrl: './providers.scss',
      changeDetection: ChangeDetectionStrategy.OnPush,
      standalone: true
    })
    export class Providers {
      protected encounterService = inject(EncounterService);
      protected personService = inject(PersonService);
    
      // Return a relationship object in sorted order by prsnl relation type
      protected sortedRelationships(relationship: IPrsnlReltn[] | IEncntrPrsnlReltn[] | undefined): IPrsnlReltn[] | IEncntrPrsnlReltn[] | undefined {
        return relationship ? relationship.sort((a, b) => a.reltnType.localeCompare(b.reltnType)) : undefined;
      }
    
    }
    
  2. Open providers.html and replace the code with the code shown below.
    @let patient = personService.get();
    @let visit = encounterService.get();
    
    <div class="grid-2-column">
        <div class="section">
            <div class="section-title">Patient Provider Relationships</div>
    
            @for (rel of sortedRelationships(patient?.prsnlReltn); track rel) {
                <app-field [label]="rel.reltnType" [text]="rel.nameFullFormatted" />
            }
        </div>
    
        <div class="section">
            <div class="section-title">Provider Relationships this Visit</div>
                <div class="grid-2-column">
                @for (rel of sortedRelationships(visit?.prsnlReltn); track rel) {
                    <app-field [label]="rel.reltnType" [text]="rel.nameFullFormatted" />
                }
            </div>
        </div>
    </div>

    When you view your Provider Relationships tab, you will see your provider names, however, there is a problem. You will see more relationships than you want, including those which are irrelevant to the Patient Information component.

  3. Open the common.ts service file and find your payload section of the code.

    Add a typeList array to your payload with any entries from code set 333 that you wish to filter the encounter personnel relationships by. If you have any values you wish to filter for the person personnel relationships, you can add them as well.

    The typeList array accepts a codeSet value, a type and typeCd value. The type can either represent the "CDFMEANING" or "DISPLAYKEY" value from the code set. If you wish, you can optionally hard code a code value in the typeCd field and pass an empty string to the type.

    payload: {
        patientSource: [this.MPage.emptyPatientSource],
        person: {
            aliases: true,
            names: true,
            .... etc ...
        },
        encounter: {
            prsnlReltn: true,
            .... etc ...
        },
        prsnl: {
            aliases: true,
            loadExtendedPersons: true
        },
        address: true,
        phone: true,
    typeList: [
            {codeSet: 333, type: 'ADMITDOC', typeCd: 0},
            {codeSet: 333, type: 'ATTENDDOC', typeCd: 0},
            {codeSet: 333, type: 'CONSULTDOC', typeCd: 0},
            {codeSet: 333, type: 'ORDERDOC', typeCd: 0},
            {codeSet: 333, type: 'REFERDOC', typeCd: 0},
            {codeSet: 333, type: 'PRIMARYNURSE', typeCd: 0},
            {codeSet: 333, type: 'EDPROVIDER', typeCd: 0},
            {codeSet: 333, type: 'TRIAGEPROVIDER', typeCd: 0},
            {codeSet: 333, type: 'NURSE', typeCd: 0},
            {codeSet: 333, type: 'NURSEPRACTITIONER', typeCd: 0},
        ]
    }
  4. View your MPage again. You should see the list of providers shortened. Opening the debugger log also lists fewer values as the typeList array has limited the number of allowed types to be loaded.
<< Prev: 6. Relationship Tab
Next: 8. Final Steps >>
Copyright © 2026 Precision Healthcare Solutions