Advertisement
jeniferfleurant

Specimen avec date et code mere(code pour Solutions)

Nov 14th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. USE caris_db;
  2. SET @start_date='2016-10-01';
  3. SET @end_date= now();
  4. select distinct mother_code, concat(tracking_motherbasicinfo.first_name,' ',tracking_motherbasicinfo.last_name) as mother_name,
  5. patient_code, lookup_hospital.name as hospital, lookup_lab.name as lab,date_of_birth, date_blood_taken,
  6. lookup_testing_which_pcr.name as which_pcr, lookup_testing_specimen_result.name as pcr_result, pcr_result_date from testing_mereenfant
  7. left join testing_specimen on testing_specimen.id_patient = testing_mereenfant.id_patient
  8. left join patient on patient.id = testing_specimen.id_patient
  9. left join lookup_hospital on concat(lookup_hospital.city_code,'/',lookup_hospital.hospital_code) = concat(patient.city_code,'/',patient.hospital_code)
  10. left join lookup_lab on lookup_lab.id = lookup_hospital.id_lab
  11. left join lookup_testing_which_pcr on lookup_testing_which_pcr.id = which_pcr
  12. left join lookup_testing_specimen_result on lookup_testing_specimen_result.id = pcr_result
  13. left join tracking_children on testing_specimen.id_patient=id_patient_child
  14. left join tracking_motherbasicinfo on tracking_motherbasicinfo.id_patient=id_patient_mother
  15. where date_blood_taken >= @start_date and date_blood_taken <= @end_date
  16. and pcr_result_date <> '0000-00-00'
  17. and linked_to_id_patient = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement