Table of Contents |
---|
Anchor | ||||
---|---|---|---|---|
|
...
Validate Response $.data.employee_type == DOCTOR
Check "no_tax_id" flag
If "no_tax_id"= true, tax_id field should be empty, in case error return 422
If "no_tax_id"=false, tax_id should be prsent, in case error return 422
Calculate patient age
Calculate patient age
...
- ADULT_AGE
- DECLARATION_TERM
- MAX_PHONE_NUMBER
Code Block | ||||
---|---|---|---|---|
| ||||
curl -X GET \ {:host}/prm/api/global_parameters |
...
Insert record to IL.declaration_request in status 'NEW'
Search MPI
...
Check "no_tax_id" flag
If "no_tax_id"= true, tax_id field should be empty, in case error return 422
If "no_tax_id"=false, tax_id should be prsent, in case error return 422
Search MPI
Search patient in MPI using personal information
...
- in case error (found 0 or more then one) set il.declaration_request.mpi_id=null
Validate phone number limit
- in case person is found, and person_id will be saved to declaration_request we do not count phone numbers and do not compare the phone number with global_parameters.max_phone_number
- In case person is not found
- Check if (SELECT count(*) from persons where authentication_methods::json->0->>'phone_number'='$.phone_number' and persons.status='active' and is_active=true)<global_parameters.max_phone_number
in case error return 422, msg "This phone number is present more then $.global_parameters.max_phone_number times in the system"
- Check if (SELECT count(*) from persons where authentication_methods::json->0->>'phone_number'='$.phone_number' and persons.status='active' and is_active=true)<global_parameters.max_phone_number
Validate declaration limit
- Count all declarations in status
active
where OPS.declarations.employee_id==$.declaration_request.employee_id
1.1 If there is an active declaration with the current person, exclude it from the selection in order to let doctor resign declaration with current patient - Count all declaration_requests in status
approved
where IL.declaration_requests.data($.employee.id) ==$.declaration_request.employee_id - Get all specialities of current doctor
- Select speciality from PRM.employees where PRM.employees.party_id == (select PRM.employees.party_id where PRM.employees.id=$.declaration_request.employee_id)
- Select config parameter for declarations_limit where speciality == select 3
- Compare the result of selections 1+2 with the lowest config parameter from select 4. In case count (declarations+declaration_requests )> config_parameter, return 409 "The employee has reached the declaration limit"
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "authentication_method": SearchMPIResponse.$.data.authentication_method.type, "authentication_number": SearchMPIResponse.$.data.authentication_method.number } |
Determine Channel
- сhannel channel from url
- if url is for cabinet сhannel set declaration_request.сhannel = CABINET
- if not - set declaration_request.сhannel = MIS
- if url is for cabinet сhannel set declaration_request.сhannel = CABINET
...