25.2.6.9.3 Signaling the Workflow to Continue
Save the patient’s registration data and signal the waiting workflow to continue.
The last page of the Complete Registration wizard uses an Invoke API
page process to call the COMPLETE_REGISTRATION procedure below. Each
data item the wizard collected gets passed in by declaratively configuring the parameter
value expressions. The value of an Image Upload page item provides the unique
file name in the APEX_APPLICATION_TEMP_FILES table where the APEX engine stores the uploaded file for application-specific processing.
Notice that after retrieving the uploaded proof of insurance scan image blob from the temporary file table, it updates Cristina Cordero's FRC_PATIENTS row with date of birth and proof of insurance information. For fraud detection purposes, the wizard also uses a Get Current Position dynamic action step in a Page Load event handler to record the latitude and longitude of the user's position when uploading the proof of insurance.
After updating the patient row, the procedure calls CONTINUE_ACTIVITY in the APEX_WORKFLOW package to signal that Cristina Cordero's Patient Onboarding workflow should now proceed.
procedure complete_registration(
p_patient_id in number,
p_year_of_birth in number,
p_month_of_birth in number,
p_day_of_birth in number,
p_insurance_policy_number in varchar2,
p_scan_uploadname in varchar2,
p_scan_latitude in number,
p_scan_longitude in number)
is
l_scan_blob blob;
l_params apex_application_global.vc_map;
begin
-- get uploaded insurance proof scan blob from temp storage
for scan in (select blob_content
from apex_application_temp_files
where name = p_scan_upload_name)
loop
l_scan_blob := scan.blob_content;
end loop;
-- update patient to include insurance proof scan blob
update frc_patients
set insurance_proof_scan = l_scan_blob,
date_of_birth = to_date(
to_char(p_year_of_birth)||
to_char(p_month_of_birth,'00')||
to_char(p_day_of_birth,'00'),
'YYYYMMDD'),
insurance_policy_number = p_insurance_policy_number,
insurance_proof_latitude = p_scan_latitude,
insurance_proof_longitude = p_scan_longitude
where id = p_patient_id;
-- Continue onboarding workflow that's waiting for new patient
-- registration to be complete. Use workflow id from the most
-- recent onboarding workflow associated with this patient id
for wf in (select workflow_id
from apex_workflows
where workflow_def_static_id = 'patient_onboarding'
and detail_pk = to_char(p_patient_id)
order by start_time desc
fetch first row only)
loop
-- Continue the complete_registration "Wait" activity
apex_workflow.continue_activity(
p_instance_id => wf.workflow_id,
p_static_id => 'complete_registration',
p_activity_params => l_params);
end loop;
end;Parent topic: Waiting Until Patient Completes Profile