Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. id | Name | Test Name | Test Performed | Test Value
  2. 1 John HIV EIA Reactive
  3. 1 John HIV EIA2 Reactive
  4. 1 John HIV WB Positive
  5. 1 John HIV Final Kit Positive
  6. 2 Mark HIV Rapid Reactive
  7. 2 Mark HIV EIA Reactive
  8. 2 Mark HIV EIA2 Reactive
  9. 2 Mark HIV Final Result Positive
  10. 2 Mark Immuno CD4% 12.0%
  11. 2 Mark Immuno CD4 Lympo 1299
  12. 2 Mark Immuni CD4 Absolute 838
  13. 3 Carl SY RPR Reactive
  14. 3. Carl SY TPHA Reactive
  15.  
  16. id | Name | Test Name | EIA | EIA2 | Rapid | WB |Final Kit
  17. 1 John HIV Reactive Reactive Positive
  18. 2 Mark HIV Reactive Reactive Reactive Reactive
  19.  
  20. id | Name | Test Name | CD4% | CD4 Lympo | CD4 Absolute
  21. 1 Mark Immuno 12.0% 1299 838
  22.  
  23.  
  24. id | Name | Test Name | RPR | TPHA
  25. 3 Carl SY Reactive Reactive
  26.  
  27. select (p.id) as Patient_ID, p.entry_datetime, po.specimen_id, CONCAT(p.last_name, ', ' ,p.first_name, ' ' ,p.middle_name) as Patient_Name,
  28. p.alias, (poef.value) as Source, (sl.region) as Region, (sl.type) as Lab_Type, (tg.name) as TestName, (tc.name) as Test_Performed, (tor.value) as Test_Value , tr.release_date from patients p
  29. right join patient_orders po on po.patient_id = p.id
  30. left join saccl_referrals sr on sr.specimen_id = po.specimen_id
  31. left join saccl_laboratories sl on sl.id = sr.laboratory_id
  32. left join test_order_details tod on tod.specimen_id = po.specimen_id
  33. left join test_orders ts on po.specimen_id = ts.specimen_id
  34. left join test_results tr on ts.id = tr.test_order_id
  35. left join test_groups tg on tg.id = tr.test_group_id
  36. left join test_order_results tor on tor.test_order_detail_id = tod.id
  37. left join test_codes tc on tod.test_id = tc.id
  38. left join patient_order_extra_fields poef on po.specimen_id = poef.specimen_id where poef.extra_field_id = 'source'
  39. order by entry_datetime desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement