...
Get employee.id from declaration request, get party for employee_id
Find all employees in status= 'APPROVED' for the party. Count all declarations in status='active' & declaration_requests in status='APPROVED' for these Find all specialities for those employees.
...
Set doctor's limit = min limit for employee's speciality.
Speciality limits are in ehealth.charts.il
Change declaration request status
...