Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • employee.id=declarations.employee_id
  • employee.employee_type='DOCTOR'
  • employee.is_active=true
  • employee.status='APPROVED'
  • declarations.is_active=true
  • declarations.status='active'

Fields:

do not take into account party_id with avg(qty_person_id_60)=0, exclude them from report.

SOURCEFIELDNAMEDESCRIPTION
employeeparty_idparty_id
employeelegal_entity_idlegal_entity_id
declarationscount(person_id)patients_qtyqty patients by doctor (total till report date)
declarations

avg(qty_person_id_30)/

avg(qty_person_id_60)

patient_increase_30d

For each doctor calculate lifetime - (report_date-inserted_at)

If doctor lifetime <=90 days  - then null 

if doctor lifetime >= 90 days:

avg(qty_person_id_30) - average number of patients for doctor for the last 30 days

avg(qty_person_id_60) - average number of patients for doctor for 60 days before last 30 days

if avg(qty_person_id_60)=0 then 9999

declarationssum(qty_person_id_30)patient_increase_30d_0

if avg(qty_person_id_60)=0 then sum(qty_person_id_30)

$inserted_atreport_datethe date when calculated

...

  • patients_qty
  • patient_increase_30dpatient_increase_30d_0

Output fields:

  • party_id
  • legal_entity_id
  • one of [patients_qty, patient_increase_30d, patient_increase_30d_0]
  • report_date