SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT "Patient"."id", "Patient"."name", "Patient"."social_name" AS "socialName", "Patient"."cpf", "Patient"."rg", "Patient"."telphone", "Patient"."referral_id" AS "referralId", "Patient"."referral_other" AS "referralOther", "Patient"."email", "Patient"."biological_sex" AS "biologicalSex", "Patient"."marital_status" AS "maritalStatus", "Patient"."nationality", "Patient"."place_of_birth" AS "placeOfBirth", "Patient"."profession", "Patient"."company", "Patient"."religion", "Patient"."blood_type" AS "bloodType", "Patient"."health_insurance_plan" AS "healthInsurancePlan", "Patient"."health_insurance_plan_number" AS "healthInsurancePlanNumber", "Patient"."health_insurance_plan_expiration" AS "healthInsurancePlanExpiration", "Patient"."notes", "Patient"."is_foreign" AS "isForeign", "Patient"."is_special_needs" AS "isSpecialNeeds", "Patient"."is_first_appointment" AS "isFirstAppointment", "Patient"."birth_date" AS "birthDate", "Patient"."responsible_id" AS "responsibleId", "Patient"."responsible_relationship" AS "responsibleRelationship", "Patient"."external_id" AS "externalId", "Patient"."need_update" AS "needUpdate", "Patient"."stored_at" AS "storedAt", "Patient"."created_by" AS "createdBy", "address"."id" AS "address.id", "address"."state" AS "address.state", "address"."city" AS "address.city", "address"."zip_code" AS "address.zipCode", "address"."neighborhood" AS "address.neighborhood", "address"."street" AS "address.street", "address"."number" AS "address.number", "address"."complement" AS "address.complement", "referral"."id" AS "referral.id", "referral"."name" AS "referral.name", "responsible"."id" AS "responsible.id", "responsible"."name" AS "responsible.name", "responsible"."social_name" AS "responsible.socialName", "responsible"."cpf" AS "responsible.cpf", "responsible"."rg" AS "responsible.rg", "responsible"."telphone" AS "responsible.telphone", "responsible"."referral_id" AS "responsible.referralId", "responsible"."referral_other" AS "responsible.referralOther", "responsible"."email" AS "responsible.email", "responsible"."biological_sex" AS "responsible.biologicalSex", "responsible"."marital_status" AS "responsible.maritalStatus", "responsible"."nationality" AS "responsible.nationality", "responsible"."place_of_birth" AS "responsible.placeOfBirth", "responsible"."profession" AS "responsible.profession", "responsible"."company" AS "responsible.company", "responsible"."religion" AS "responsible.religion", "responsible"."blood_type" AS "responsible.bloodType", "responsible"."health_insurance_plan" AS "responsible.healthInsurancePlan", "responsible"."health_insurance_plan_number" AS "responsible.healthInsurancePlanNumber", "responsible"."health_insurance_plan_expiration" AS "responsible.healthInsurancePlanExpiration", "responsible"."notes" AS "responsible.notes", "responsible"."is_foreign" AS "responsible.isForeign", "responsible"."is_special_needs" AS "responsible.isSpecialNeeds", "responsible"."birth_date" AS "responsible.birthDate", "responsible"."responsible_id" AS "responsible.responsibleId", "responsible"."health_maintenance_organization_id" AS "responsible.healthMaintenanceOrganizationId", "responsible"."clinic_id" AS "responsible.clinicId", "responsible"."external_id" AS "responsible.externalId", "responsible"."need_update" AS "responsible.needUpdate", "responsible"."stored_at" AS "responsible.storedAt", "responsible->address"."id" AS "responsible.address.id", "responsible->address"."state" AS "responsible.address.state", "responsible->address"."city" AS "responsible.address.city", "responsible->address"."zip_code" AS "responsible.address.zipCode", "responsible->address"."neighborhood" AS "responsible.address.neighborhood", "responsible->address"."street" AS "responsible.address.street", "responsible->address"."number" AS "responsible.address.number", "responsible->address"."complement" AS "responsible.address.complement", "healthMaintenanceOrganization"."id" AS "healthMaintenanceOrganization.id", "healthMaintenanceOrganization"."name" AS "healthMaintenanceOrganization.name", "healthMaintenanceOrganization"."nick_name" AS "healthMaintenanceOrganization.nickName", "clinic"."id" AS "clinic.id", "clinic"."name" AS "clinic.name", "professionals"."id" AS "professionals.id", "professionals->professional"."id" AS "professionals.professional.id", "professionals->professional"."name" AS "professionals.professional.name", "professionals->professional"."external_id" AS "professionals.professional.externalId", "professionals->professional->profession"."id" AS "professionals.professional.profession.id", "professionals->professional->profession"."name" AS "professionals.professional.profession.name"
  2.     FROM "Patient" AS "Patient"
  3.     INNER JOIN "Address" AS "address" ON "Patient"."address_id" = "address"."id" AND "address"."deleted_at" IS NULL
  4.     LEFT OUTER JOIN "Referral" AS "referral" ON "Patient"."referral_id" = "referral"."id" AND "referral"."deleted_at" IS NULL
  5.     LEFT OUTER JOIN ( "Patient" AS "responsible"
  6.     INNER JOIN "Address" AS "responsible->address" ON "responsible"."address_id" = "responsible->address"."id" AND "responsible->address"."deleted_at" IS NULL ) ON "Patient"."responsible_id" = "responsible"."id" AND "responsible"."deleted_at" IS NULL
  7.     LEFT OUTER JOIN "HealthMaintenanceOrganization" AS "healthMaintenanceOrganization" ON "Patient"."health_maintenance_organization_id" = "healthMaintenanceOrganization"."id" AND "healthMaintenanceOrganization"."deleted_at" IS NULL
  8.     LEFT OUTER JOIN "Clinic" AS "clinic" ON "Patient"."clinic_id" = "clinic"."id" AND "clinic"."deleted_at" IS NULL LEFT OUTER JOIN ( "PatientProfessional" AS "professionals"
  9.     INNER JOIN "Professional" AS "professionals->professional" ON "professionals"."professional_id" = "professionals->professional"."id" AND "professionals->professional"."deleted_at" IS NULL
  10.     INNER JOIN "Profession" AS "professionals->professional->profession" ON "professionals->professional"."profession_id" = "professionals->professional->profession"."id" AND "professionals->professional->profession"."deleted_at" IS NULL ) ON "Patient"."id" = "professionals"."patient_id" AND "professionals"."deleted_at" IS NULL
  11.     WHERE "Patient"."deleted_at" IS NULL
  12.     ORDER BY "Patient"."name" ASC LIMIT 30 OFFSET 90;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top