Advertisement
temaon_lieto

SQL chronic_diseases/patients

Feb 2nd, 2024
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- http://localhost:4000/api/v1/chronic_diseases/patients
  2.  
  3. SELECT DISTINCT "mv_stat_declarations".* FROM "mv_stat_declarations" WHERE ("mv_stat_declarations"."legal_entity_id" = 3228) AND "mv_stat_declarations"."declaration_status_code" = $1  [["declaration_status_code", "ACTIVE"]]
  4.  
  5.  SELECT "mv_stat_patient_personalities".* FROM "mv_stat_patient_personalities" WHERE "mv_stat_patient_personalities"."id" IN ($1, $2, $3, $4, $5)  [["id", 11395822], ["id", 11395824], ["id", 11464974], ["id", 11464976], ["id", 11464994]]
  6.  
  7. SELECT "mv_stat_employees_parties".* FROM "mv_stat_employees_parties" WHERE "mv_stat_employees_parties"."Id" IN ($1, $2)  [["Id", 180499], ["Id", 181286]]
  8.  
  9. SELECT MAX(receptions.patient_id) as patient_id, COUNT(DISTINCT receptions.patient_id) as counter FROM "receptions" WHERE ("receptions"."ehealth_status" = 1) AND "receptions"."asserted_date" BETWEEN $1 AND $2 AND "receptions"."patient_id" IN ($3, $4, $5, $6, $7) GROUP BY date(asserted_date), patient_id  [["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-02 23:59:59.999999"], ["patient_id", 11395822], ["patient_id", 11395824], ["patient_id", 11464974], ["patient_id", 11464976], ["patient_id", 11464994]
  10.  
  11. SELECT "mv_stat_imt_diseases".* FROM "mv_stat_imt_diseases" WHERE "mv_stat_imt_diseases"."asserted_date" BETWEEN $1 AND $2 AND "mv_stat_imt_diseases"."patient_id" IN ($3, $4, $5, $6, $7)  [["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-02 23:59:59.999999"], ["patient_id", 11395822], ["patient_id", 11395824], ["patient_id", 11464974], ["patient_id", 11464976], ["patient_id", 11464994]]
  12.  
  13. SELECT "mv_stat_conditions".* FROM "mv_stat_conditions" WHERE "mv_stat_conditions"."asserted_date" BETWEEN $1 AND $2 AND "mv_stat_conditions"."patient_id" IN ($3, $4, $5, $6, $7)  [["asserted_date", "2024-01-01 00:00:00"], ["asserted_date", "2024-02-02 23:59:59.999999"], ["patient_id", 11395822], ["patient_id", 11395824], ["patient_id", 11464974], ["patient_id", 11464976], ["patient_id", 11464994]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement