wiki:UseCase18PrototypeImplementation

Version 2 (modified by 236021, 7 hours ago) ( diff )

--

UseCase18PrototypeImplementation - System Administrator Manages Users

Initiating Actor - System Administrator

Description

A system administrator creates new user accounts. The admin can register doctors, patients, and other users by entering their data directly into a form.

Scenario

1.System Admin navigates to the user management section and clicks "Add New Doctor".

)]]

  1. System Admin fills in the doctor's information and submits the form.

)]]

INSERT INTO doctors (first_name, last_name, email_address, level_id, specialization_id, department_id)
VALUES (
    'Maja',
    'Ivanova',
    'maja.ivanova@hospital.com',
    2,
    2,
    2
)
RETURNING doctor_id;
  1. System creates the linked user account using the newly created doctor's ID.
INSERT INTO users (username, password, role, first_name, last_name, is_active, doctor_id)
VALUES (
    'maja.ivanova@medora.com',
    'password123',
    'DOCTOR',
    'Maja',
    'Ivanova',
    TRUE,
    (SELECT doctor_id FROM doctors WHERE email_address = 'maja.ivanova@hospital.com')
)
RETURNING user_id;
  1. System displays the updated doctor list confirming the new account.

)]]

SELECT
    u.user_id,
    u.username,
    u.role,
    d.first_name,
    d.last_name,
    u.is_active,
    ds.specialization_name,
    dep.department_name,
    dl.level
FROM doctors d
JOIN users u ON d.doctor_id = u.doctor_id
LEFT JOIN doctor_specialization ds ON d.specialization_id = ds.specialization_id
LEFT JOIN departments dep ON d.department_id = dep.department_id
LEFT JOIN doctor_level dl ON d.level_id = dl.level_id
ORDER BY u.username;

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.