Simplify Business Process Management using APEX Workflow - Add Pages to the Application

October 17, 2023 | 13 minute read
Ananya Chatterjee
Consulting Member of Technical Staff
Text Size 100%:

Creating the New Appointments Page

Now that the Workflow is created, let us create the Page which will be used by the Hospital Staff to Submit a New Appointment.

Click on Create Page in your Doctor Appointments Made Easy! application.

Name this page "New Appointment" and add it as a breadcrumb under the Home page

New Appointment Page Create

In the Page Designer, create a new Static Content and name it Patient Appointment Details. Add 6  page items -  P5_NAME, P5_EMAIL, P5_DESC, P5_APPT_DATE, P5_DOC and P5_AGE

Set the type for P5_APPT_DATE as DatePicker. Fill in the properties as shown below

Appointment Date Page Item in Workflow

Set the type for P5_DESC to Select List, set the label as Problem and define a list of static values as following:

List of Departments in Medical Appointments

For the P5_DOC Page Item, specify the type as POP LOV and specify the List Of Values using the following SQL Query:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
select dname from doctor where specialization = :P5_DESC

Specify Cascading List Of Values ->  Parent Items as P5_DESC.

Doctor POPUP LOV

Navigate to the Processing Tab and Create a new Page Process of type Workflow. Name the process "Doctor Appointment Workflow"".

Under the Settings, Click the Type and set it as Start. Set the Workflow Definition as Doctor Apppointment.

Set the Details Primary Key Item as P5_DOC. This is how the additional data defined for your workflow gets tied to the DOCTOR table records.

Set the Success Message as "Appointment Submitted Successfully!"

Doctor Appointment Workflow

Set Parameters for the Workflow Page Process

Under Submit Apppontment Workflow in the Processing section:

Click on Patient Age and set it to Item  P5_AGE

Patient AgeWF Parameter

Click on Patient Email and set it to Item P5_EMAIL

Patient Email WF Parameter

Click on Patient Name and set it to Item P5_NAME

Patient Name WF Parameter

Click On Problem and set it to Item P5_DESC

Patient Problem WF Parameter

Click on Request Date and set it to Item P5_APPT_DATE

Request Date WF Parameter

 

Click Save and navigate back to the Rendering Section. Create a new Button and name it BOOK_APT (Book Appointment) as shown below.

Book Appointment Button

Save the changes.

 

Creating the Patient Tasks Page

Our application has 2 entry points for Patients. First, to confirm an invoice request. Second, to provide feedback. For this we need to create a Unified Task List for Patients to act on.

Go to the Application Home and click on Create Page. In the Create Page Wizard, select Unified Task List.

Patient Tasks Unified List

In the Create Unified Task List Wizard, enter Name as Patient Tasks. Leave the Report Context as My Tasks. Enter the Breadcrumb and Navigation Menu entries as shown below. Click on Create Page . This will create the Patient Tasks Unified task list page where Patients can log in to Confirm their appointment invoices and provide requested feedbacks.

Patient Tasks Wizard

 

Creating the Doctor Tasks Page

Our application has 1 entry point for Doctors. Doctors need to log in to approve or reject appointment requests. For this we will create a Doctor Tasks page. This will also be a Unified Task List page for Doctors to act on the tasks assigned to them.

Go to the Application Home and click on Create Page. In the Create Page Wizard, select Unified Task List.

In the Create Unified Task List Wizard, enter Name as Doctor Tasks. Leave the Report Context as My Tasks. Enter the Breadcrumb and Navigation Menu entries as shown below. Click on Create Page . This will create the Doctor Tasks Unified task list page where Doctors can log in to Approve or Reject the appointment requests.

Doctor Tasks List

Modifying the 3 Task Details Pages

Our Application has 3 Task Definitions -  Appointment Request, Invoice Request and Feedback Request. For each of them we had generated a Task Details page. In this section we will rename the Pages so that they appear more meaningful in the Application.

Go to Shared Components-> Task Definitions-> Click on Appointment Request. In the Task Definition Editor, note the page number in the Task Details URL (f?p=&APP_ID.:2:&SESSION.::&DEBUG.:RP,2:P2_TASK_ID:&TASK_ID.) . This points to Page 2.

Appointment Request Task Details

Open this page from the Application Home.

Change the Page Name and Title to Appointment Request Details .

Appointment Request Details Page

Save your changes.

Open the Invoice Request Task Definition from Shared Components and similarly check the page number for the Task Details. This points to Page 3. Open this page from Application Home.

Change the Page Name and Title to Invoice Details .

Notice there is a Developer Information region in the Details Page. Remove this region by right-clicking on the region and selecting Delete.

Invoice Request Task Details Page

Modify the Title of Details Classic Report region to View Invoice.

Rename Task Details Report Region

Note: Developer Information region is autogenerated for Action Tasks (non-approval). This can be removed/customized depending on the application usecase.

Save your Changes.

Open the Feedback Request Task Definition from Shared Components and similarly check the page number for the Task Details. This points to Page 8. Open this page from Application Home.

Change the Page Name and Title to Feedback Details .

Feedback Details Page

Notice there is a Developer Information region in the Details Page. Remove this region by right-clicking on the region and selecting Delete.

Modify the Title of Details Classic Report region to View Appointment Details.

Feed back Details Classic Report

In the Details Page, we want the patient to be able to fill up a Feedback form and submit it. On submission it will create an entry in the PATIENT_FEEDBACK table for the particular doctor. We will customize the Feedback Details Page as follows.

Below View Appointment Details region, create a new Region of type Form and name it Your Feedback.

Your Feedback Region

In the Source section of the Property Editor, set the Table Name as APPOINTMENT and the Where clause as

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
booking_id = :P8_BOOKING_ID

Mark the Page Items P8_FEE and P8_WORKFLOW_ID as Hidden . Change the Format Mask for P8_SCHEDULE to DD-MON-YYYY HH24:MI:SS

Create 2 new Page Items: P8_RATING and P8_FEEDBACK.

For P8_RATING, set the type as Radio Group.

Select List of Values as Static Values and provide the following entries

Feedback Rating Radio options

For P8_FEEDBACK, set the type as Rich Text Editor.

Feedback Text

Click on Save to save your changes.

In the Pre-Rendering section add a new Process above the Initialize Form Feedback Details Process and name it Populate Booking Details in Feedback Form.

Select the Process Type as Execute Code and enter the following code in the PL/SQL Code section

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
begin

select booking_id into :P8_BOOKING_ID
from appointment where booking_id = (select
       param_value
  from apex_task_parameters
 where task_id = :P8_TASK_ID and param_static_id = 'BOOKING_ID');
 
end;

Populate Booking Details

Go to the Processing Tab and add a new Process after the Claim process. Set the type as Execute Code and in the PL/SQL Code section enter the following

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
begin
    insert into patient_feedback (
        patient_name,
        doctor_no,
        appointment,
        feedback,
        rating,
        created_at,
        updated_at)
    values
        (:P8_PATIENT_USERNAME,
        :P8_DOCTOR_NO,
        to_timestamp_tz(:P8_SCHEDULE,'DD-MON-YYYY HH24:MI:SS'),
        :P8_FEEDBACK,
        :P8_RATING,
        systimestamp,
        systimestamp);
end;

Save Feedback Process

In Server Side Condition , set When Button Pressed as COMPLETE.

Complete Button Pressed

Save the changes.

Creating the Patient Appointments And Feedbacks Page

Let us now created a View Only page where a patient can log in to view their appointments and also the feedbacks they have left so far.

Go to App Builder and Click on Create Page. Choose Blank Page in the Create Page Wizard and click Next.

In the Next section, enter the name of the page as Patient Appointments And Feedbacks.

Enter the Breadcrumb and Naviation Menu entries as shown in the screen below.

Patient Apppointments and Feedbacks

In Page Designer, right click on Body and click Create Region. In the new Region, go to Property Editor and change the name to Appointments. Change the Type to Comments (under Theme Components).

Comments Template

In the Source Section set Table Name as APPOINTMENT. In the Where Clause, enter :

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
patient_username=:APP_USER


 

Appointment

Go to the Attributes Tab and Enter the Username, Date and Comment Text as shown below.

Comments Template Attributes

Create a Region Below Appointments Region, and name it Feedbacks. Change the Type to Comments (under Theme Components).

In the Source Section set Type as SQL Querty and in the SQL Query editor, enter :

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
select ID,
       PATIENT_NAME,
       'DR.' || DNAME as DNAME,
       APPOINTMENT,
       FEEDBACK,
       RATING,
       CREATED_AT,
       UPDATED_AT
  from PATIENT_FEEDBACK, DOCTOR
 where PATIENT_NAME=:APP_USER
  and DOCTOR_NO = DNO

Feedback Source

Go to the Attributes Tab and Enter the Username, Date and Comment Text as shown below.

Feedback Attributes

Save the changes.

Creating the View Appointment Workflows Page

Finally, we need the page that the Hospital Management Staff will use the monitor the appointment workflow.

We use the Workflow Console and Details pages with Initiated By Me report context which allows a logged in user to view all Workflows Initiated by him or her.

Tech Tips
The Workflow Console allows workspace users to view and manage their workflow instances, including My Workflows for workflow owners, Admin Workflows for workflow administrators, and Initiated by Me for workflow initiators. When you configure the Workflow Console, you have different Report Contexts to choose from. You will learn about these in subsequent blogs.

To create the Workflow Console and Details pages:

  1. On the Application home page, select Create Page.
  2. Under Components, select Workflow Console.

Workflow Console Wizard

  1. Select the Report Context as Initiated By Me.
  2. For the Form Page, enter Monitor Appointment Workflows
  3. For the Workflow Details page, set the name as Appointment Workflow Details

 

Initiated Workflows

Our Application is now Complete and Ready to Run!

 

In the Next Section we will Run the Application and demonstrate the Workflow.

 

 

Previous                                                                                                                                                                                                      Next

Ananya Chatterjee

Consulting Member of Technical Staff

Ananya hails from Kolkata and has been associated with Oracle for the past 2 decades. For many years, she was working for Oracle Integration Cloud and Oracle Process Automation Service, leading multiple teams. She now works as part of the Oracle APEX team and has co-designed and developed the APEX  Approvals Component and APEX Workflow features.

She is also a bilingual poet with five published poetry collections in English and Bengali.

Show more

Previous Post

Simplify Business Process Management Using APEX Workflow - Create Doctor Appointment Application

Ananya Chatterjee | 9 min read

Next Post


Try the Oracle APEX 23.2 Preview on apex.oracle.com!

Ashish Mohindroo | 2 min read
Oracle Chatbot
Disconnected