Changes between Initial Version and Version 1 of UseCase15


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

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase15

    v1 v1  
     1= UseCase15 - Create Prescription =
     2
     3== Initiating Actor - `Doctor` ==
     4
     5== Description ==
     6A doctor prescribes medication for a patient, specifying dosage, frequency, and duration. The system creates a prescription record and links it to the patient's medical record.
     7
     8== Scenario ==
     9
     101. Doctor opens a patient's medical record.
     11
     12{{{
     13#!sql
     14SELECT
     15  mr.record_id,
     16  mr.patient_id
     17FROM medical_records mr
     18WHERE mr.patient_id = (
     19  SELECT patient_id FROM users WHERE username = 'maja.veljanova'
     20);
     21}}}
     22
     232. System displays the patient's known allergies as a safety reference.
     24
     25{{{
     26#!sql
     27SELECT
     28  a.allergy_id,
     29  a.name,
     30  a.allergy_severity,
     31  mra.reaction,
     32  mra.severity
     33FROM medical_record_allergies mra
     34JOIN allergies a ON mra.allergy_id = a.allergy_id
     35WHERE mra.record_id = (
     36  SELECT record_id FROM medical_records
     37  WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')
     38);
     39}}}
     40
     413. Doctor enters the medication name and submits.
     42
     43{{{
     44#!sql
     45INSERT INTO prescriptions (medication_name)
     46VALUES ('Lisinopril')
     47RETURNING prescription_id;
     48}}}
     49
     504. System links the prescription to the patient's medical record with full dosage details.
     51
     52{{{
     53#!sql
     54INSERT INTO prescription_medical_records (record_id, prescription_id, dosage, frequency, duration, notes)
     55VALUES (
     56  (SELECT record_id FROM medical_records WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')),
     57  (SELECT MAX(prescription_id) FROM prescriptions),
     58  '10mg',
     59  'Once daily in the morning',
     60  '30 days',
     61  'Take with meals'
     62);
     63}}}
     64
     655. System displays the updated prescription list for the patient's medical record.
     66
     67{{{
     68#!sql
     69SELECT
     70  p.prescription_id,
     71  p.medication_name,
     72  pmr.dosage,
     73  pmr.frequency,
     74  pmr.duration,
     75  pmr.notes
     76FROM prescription_medical_records pmr
     77JOIN prescriptions p ON pmr.prescription_id = p.prescription_id
     78WHERE pmr.record_id = (
     79  SELECT record_id FROM medical_records
     80  WHERE patient_id = (SELECT patient_id FROM users WHERE username = 'maja.veljanova')
     81);
     82}}}