Changes between Initial Version and Version 1 of UseCase14


Ignore:
Timestamp:
06/14/26 20:58:21 (5 days ago)
Author:
236021
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase14

    v1 v1  
     1= UseCase14 - View and Record Patient Allergies =
     2
     3== Initiating Actor - `Doctor / Patient / Lab Technician` ==
     4
     5== Description ==
     6Medical professionals and patients view a patient's recorded allergies. A doctor can additionally record a newly identified allergy during consultation. The system checks for duplicates and adds it to the patient's medical record.
     7
     8== Scenario ==
     9
     101. User navigates to the patient's allergy profile.
     11
     12{{{
     13#!sql
     14SELECT
     15  a.allergy_id,
     16  a.name,
     17  a.allergy_severity,
     18  mra.reaction,
     19  mra.severity
     20FROM medical_record_allergies mra
     21JOIN allergies a ON mra.allergy_id = a.allergy_id
     22WHERE mra.record_id = (
     23  SELECT record_id FROM medical_records
     24  WHERE patient_id = (
     25SELECT patient_id
     26FROM users
     27WHERE username = 'maja.veljanova')
     28);
     29}}}
     30
     312. System displays all recorded allergies with severity levels.
     32
     333. Doctor clicks "Add Allergy" and system displays all available allergies to choose from.
     34
     35{{{
     36#!sql
     37SELECT
     38  a.allergy_id,
     39  a.name,
     40  a.allergy_severity
     41FROM allergies a
     42ORDER BY a.name;
     43}}}
     44
     454. System checks the allergy is not already recorded for this patient.
     46
     47{{{
     48#!sql
     49SELECT 1
     50FROM medical_record_allergies mra
     51WHERE mra.record_id = (
     52  SELECT record_id FROM medical_records
     53  WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')
     54)
     55  AND mra.allergy_id = (SELECT allergy_id FROM allergies WHERE name = 'Penicillin');
     56}}}
     57
     585. Doctor selects the allergy, enters reaction and severity, and submits.
     59
     60{{{
     61#!sql
     62INSERT INTO medical_record_allergies (record_id, allergy_id, reaction, severity)
     63VALUES (
     64  (SELECT record_id FROM medical_records WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')),
     65  (SELECT allergy_id FROM allergies WHERE name = 'Penicillin'),
     66  'Rash and swelling',
     67  'MODERATE'
     68);
     69}}}
     70
     716. System displays the updated allergy profile.
     72
     73{{{
     74#!sql
     75SELECT
     76  a.allergy_id,
     77  a.name,
     78  a.allergy_severity,
     79  mra.reaction,
     80  mra.severity
     81FROM medical_record_allergies mra
     82JOIN allergies a ON mra.allergy_id = a.allergy_id
     83WHERE mra.record_id = (
     84  SELECT record_id FROM medical_records
     85  WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')
     86);
     87}}}