Changes between Initial Version and Version 1 of UseCase05


Ignore:
Timestamp:
06/12/26 17:56:39 (9 days ago)
Author:
236021
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase05

    v1 v1  
     1= UseCase05 - Doctor Records Symptoms and Creates Diagnosis =
     2
     3== Initiating Actor - `Doctor` ==
     4
     5
     6== Description ==
     7During a patient consultation, a doctor records symptoms for the patient's medical record and creates a diagnosis. The system stores the symptoms and diagnosis linked to both the patient and the doctor.
     8
     9== Scenario ==
     10
     111. Doctor opens a patient's medical record.
     12
     13{{{
     14#!sql
     15SELECT
     16  mr.record_id,
     17  mr.patient_id
     18FROM medical_records mr
     19WHERE mr.patient_id = (
     20SELECT patient_id
     21FROM patients
     22WHERE user_id = (
     23SELECT user_id
     24FROM users
     25WHERE username = 'maja.veljanova'));
     26}}}
     27
     282. System displays all available symptoms for the doctor to choose from.
     29
     30{{{
     31#!sql
     32SELECT
     33  s.symptom_id,
     34  s.name,
     35  s.description
     36FROM symptoms s
     37ORDER BY s.name;
     38}}}
     39
     403. Doctor selects symptoms and the system records them in the patient's medical record.
     41
     42{{{
     43#!sql
     44INSERT INTO medical_record_symptoms (record_id, symptom_id, severity)
     45VALUES (
     46  (SELECT record_id FROM medical_records WHERE patient_id = (SELECT patient_id FROM patients WHERE user_id = (SELECT user_id FROM users WHERE username = 'maja.veljanova'))),
     47  (SELECT symptom_id FROM symptoms WHERE name = 'Headache'),
     48  'MODERATE'
     49);
     50}}}
     51
     524. Doctor enters a diagnosis name and description and submits it.
     53
     54{{{
     55#!sql
     56INSERT INTO diagnosis (name, description, patient_id, doctor_id)
     57VALUES (
     58  'Essential hypertension',
     59  'High blood pressure condition',
     60  (SELECT patient_id FROM patients WHERE user_id = (SELECT user_id FROM users WHERE username = 'maja.veljanova')),
     61  (SELECT doctor_id FROM doctors WHERE user_id = (SELECT user_id FROM users WHERE username = 'elena.kirova'))
     62)
     63RETURNING diagnosis_id;
     64}}}
     65
     665. System confirms the diagnosis was created and displays the record.
     67
     68{{{
     69#!sql
     70SELECT
     71  d.diagnosis_id,
     72  d.name,
     73  d.description,
     74  u.first_name AS doctor_first_name,
     75  u.last_name AS doctor_last_name
     76FROM diagnosis d
     77JOIN doctors doc ON d.doctor_id = doc.doctor_id
     78JOIN users u ON doc.user_id = u.user_id
     79WHERE d.diagnosis_id = (
     80SELECT MAX(diagnosis_id)
     81FROM diagnosis);
     82}}}