📋 UC07: Phone Handling
Use Case Uc07 Phone Number Handling In Requests
This document explains how phone numbers are managed in care requests
depending on the user type and the contact person they select.
1. The Two Phone Numbers
Each care request can contain TWO phone numbers:
A) phoneNumber (Primary contact)
- This is the number that nurses will call FIRST
- This number is ALWAYS present
- It comes from the user's account or is entered manually
B) patientPhoneNumber (Patient's phone - optional)
- This is the patient's direct number
- This number is OPTIONAL
- Allows nurses to contact the patient directly
2. Phone Number Source By Scenario
SCENARIO 1: Patient makes request for themselves
Contact type: "Patient"
- phoneNumber = number from patient's account
- patientPhoneNumber = null (not needed)
The patient IS the contact, so only one number is needed.
SCENARIO 2: Family member makes request
Contact type: "Family"
- phoneNumber = number from family member's account
- patientPhoneNumber = patient's number (optional)
The nurse will call the family first, then possibly the patient.
SCENARIO 3: Friend makes request
Contact type: "Friend"
- phoneNumber = number from friend's account
- patientPhoneNumber = patient's number (optional)
Same as family.
SCENARIO 4: Professional makes request (social worker)
Contact type: "Professional"
- phoneNumber = number from professional's account
- patientPhoneNumber = beneficiary's number (optional)
The nurse will call the professional first.
SCENARIO 5: Nurse makes request
Contact type: "Professional"
- phoneNumber = number from nurse's caregiver account
- patientPhoneNumber = patient's number (optional)
Same as professional, the creating nurse is the primary contact.
3. Phone Number Display
FOR PATIENTS (viewing their own request):
- They see the contact number (phoneNumber)
- If different from their account number, they know someone else
made the request for them
FOR NURSES (viewing available request):
- They see the contact number (phoneNumber)
- They see the contact type (Patient/Family/Friend/Professional)
- They can see the patient's number if provided
- They know who they're going to call
4. Selection Logic In Code
File: lib/modules/carerequest/presentation/controllers/carerequest_form_controller.dart
When the request is submitted, the logic is as follows:
// Determine which number to store as primary contact
if (contactPersonType == ContactPersonType.patient) {
// Patient themselves: use their account number
phoneToStore = state.phoneNumber; // from account
} else {
// Other: use the entered number or account number
phoneToStore = patientPhone ?? state.phoneNumber;
In practice:
- If type is "Patient" -> account number is used
- Otherwise -> entered number is used, or account number if none entered
5. Important Points For Users
For Patients
- Your phone number is automatically used
- Make sure your account number is up to date
For Social Workers
- Your professional number is automatically used
- Always add the beneficiary's number if possible
- Nurses will call you first, then possibly the patient
For Nurses Creating Requests
- Your caregiver account number is used
- Add the patient's number for direct contact
6. Technical References
Phone number handling:
- lib/modules/carerequest/presentation/controllers/carerequest_form_controller.dart
- submitRequest() method
- phoneNumber and patientPhoneNumber fields
Phone number entry screen:
- lib/modules/carerequest/presentation/screens/phone_number_screen.dart
Request entity:
- lib/modules/carerequest/domain/entities/carerequest_entity.dart
- phoneNumber: String
- patientPhoneNumber: String?