Changes between Initial Version and Version 1 of UseCase07


Ignore:
Timestamp:
06/12/26 18:02:22 (8 days ago)
Author:
236021
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase07

    v1 v1  
     1= UseCase07 - Lab Technician Submits Lab Results =
     2
     3== Initiating Actor - `Lab Technician` ==
     4
     5== Description ==
     6A lab technician views pending lab tests, performs the test, and submits the results. The system records the results, links them to the patient's medical record, and makes them available to the doctor.
     7
     8== Scenario ==
     9
     101. Lab technician logs in and navigates to "Pending Lab Tests".
     11
     12{{{
     13#!sql
     14SELECT
     15  plt.performed_test_id,
     16  lt.test_name,
     17  u_p.first_name AS patient_first_name,
     18  u_p.last_name AS patient_last_name,
     19  u_d.first_name AS doctor_first_name,
     20  u_d.last_name AS doctor_last_name,
     21  plt.test_date,
     22  plt.notes
     23FROM performed_lab_tests plt
     24JOIN lab_tests lt ON plt.test_id = lt.test_id
     25JOIN patients p ON plt.patient_id = p.patient_id
     26JOIN users u_p ON p.patient_id = u_p.patient_id
     27JOIN doctors d ON plt.doctor_id = d.doctor_id
     28JOIN users u_d ON d.doctor_id = u_d.doctor_id;
     29}}}
     30
     312. Technician selects a pending test and views its details.
     32
     33{{{
     34#!sql
     35SELECT
     36  lt.test_id,
     37  lt.test_name,
     38  lt.description,
     39  lt.cost
     40FROM lab_tests lt
     41WHERE lt.test_id = (
     42SELECT test_id
     43FROM performed_lab_tests
     44WHERE performed_test_id = 1);
     45}}}
     46
     473. Technician performs the test and submits the results.
     48
     49{{{
     50#!sql
     51INSERT INTO lab_results (test_id, results, result_date)
     52VALUES (
     53  (SELECT test_id FROM performed_lab_tests WHERE performed_test_id = 1),
     54  'Blood pressure: 145/90, Glucose: 105 mg/dL',
     55  '2026-06-05'
     56)
     57RETURNING result_id;
     58}}}
     59
     604. System links the lab result to the patient's medical record.
     61
     62{{{
     63#!sql
     64INSERT INTO medical_record_lab_results (record_id, result_id)
     65VALUES (
     66  (SELECT record_id FROM medical_records WHERE patient_id = (
     67    SELECT patient_id FROM performed_lab_tests WHERE performed_test_id = 1
     68  )),
     69  (SELECT MAX(result_id) FROM lab_results)
     70);
     71}}}
     72
     735. System confirms submission and displays the results now on record.
     74
     75{{{
     76#!sql
     77SELECT
     78  lt.test_name,
     79  lr.results,
     80  lr.result_date
     81FROM medical_record_lab_results mrlr
     82JOIN lab_results lr ON mrlr.result_id = lr.result_id
     83JOIN lab_tests lt ON lr.test_id = lt.test_id
     84WHERE mrlr.record_id = (
     85  SELECT record_id FROM medical_records
     86  WHERE patient_id = (
     87SELECT patient_id
     88FROM performed_lab_tests
     89WHERE performed_test_id = 1)
     90);
     91}}}