Table of Contents |
---|
Purpose
...
- Validate headers – ?
- Validate that $type exists in dictionary (name='REGISTER_TYPE').
- In case error show the 422 error "value is not allowed in enum"
- in case declaration_id repeated more then once show error 422, msg "Declaration_id in file should be unique. Please, check your file"
- Validate declaration_id
- in case declaration_id was not find in ops.declarations.id
- show the row with not found ID with status "not_found"
- in case $declaration_id.status <> active
- show the row with not found ID with status "processed"
- in case declaration_id was not find in ops.declarations.id
- In case technical error happened, but declaration found
- show the row with not found ID with status "processing"
...
Name | Source | Description |
---|---|---|
id | $batch_id | id=batch_id from il.registers |
file_name | $file_name | file_name=file_name from il.registers |
status | [new, processing, processed ] | new - file was downloaded and not processed processing - when processing entries>0 processed - when processing entries=0 |
type | $type | type=type from il.dictionaries.name='REGISTER_TYPE' |
qty | {not_found: number, processing: number, errors: number, total: number} | |
errors | ["Row has length 4 - expected length 5 on line 5", "Row has length 1 - expected length 5 on line 7"] | |
inserted_at | user_id | |
inserted_by | :timestamp | |
updated_at | user_id | |
updated_by | :timestamp |
The data from file must be stored to il.register_entries. In case some rows had errors those entries will be shown in filed "errors" and won't be processed.
Name | Source | Description |
---|---|---|
id | ||
register_id | the unique id for the batch upload | |
person_type | enum(employee,patient) | |
type | $type | document_type |
number | $number | document_number |
status |
| |
inserted_at | user_id | from token |
inserted_by | :timestamp | |
updated_at | user_id | |
updated_by | :timestamp |
After the file was processed the field "qty" from table il.registers must be updated.
...
If the person was matched then
- update declarations.status to `terminated`
- update persons.status='INACTIVE'
- change declarations.reason to $"auto_"||type
- update il.registers.status='matched'
...
If declaration_id was matched
- update ops.declarations.status to `terminated`
- update ops.declaration.updated_at = now()
- update ops.declaration.updated_by = $user_id
- change declarations.reason to $"auto_"||type
- update il.registers.status='matched'
- involve Event Manager for changed status
Backward compatibility
is not possible for this kind of termination. In case the wrong declaration was terminated, the patient must sign the new one.
...