Table of Contents |
---|
Purpose
This service is made to count an amount of declaration doctor has already made. The amount will increase (decrease) with each declaration signed (terminated) on prm and recalculated and updated every night with real amount of doctor's declarations on ops.
...
- Limit is set with employee_request create/update
- add validation on declaration approve. Return error if doctor's declaration_amount >s counter >= declaration_limit
- Doctor should change declaration_limit via personal cabinet (TBD)
Specification
Apiary
Global_parameters
Sign declaration request
- get employee_id from request
- add +1 to properties.declaration_amount of employee_id
- properties: {"declaration_amount": n+1, "declaration_limit": 2000}
Terminate declaration
- get employee_id from request
- add -1 to properties.declaration_amount of employee_id
- properties: {"declaration_amount": n-1, "declaration_limit": 2000}
Count declarations for employees
Ones a day start the process.
Calculate amount of declarations and update properties.declaration_amount on prm.employees for each doctorset declaration_limit in global_parameters.
default value = 2000
Approve employee request
On creating a Party set party.declaration_limit = prm.global_parameters.declaration_limit
Employees
Declaration limit and declaration count are added to get employees list and get employee details
Declaration request
Add overlimit to declaration request. Set overlimit on create declaration request
Report DB
Add fields to report DB
Add declaration_count and declaration_limit to reports.parties
Field | Source |
---|---|
reports.parties.declaration_count | |
reports.parties.declaration_limit | prm.parties.declaration_limit |
Count declaration on report DB
- if declaration is added to report.declaration - change report.parties.declaration_count. Set declaration_count=declaration_count+1
- if report.declaration.status is change to terminated or closed - change report.parties.declaration_count. Set declaration_count=declaration_count-1