Versions Compared

Key

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

...

  1. 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
  2. Count all declaration_requests in status approved where IL.declaration_requests.data($.employee.id) ==$.declaration_request.employee_id
  3. Get all specialities of current doctor
    1. Select speciality from PRM.employees where PRM.employees.party_id == (select PRM.employees.party_id where PRM.employees.id=$.declaration_request.employee_id)
  4. Select config parameter for declarations_limit where speciality == select 3 
  5. 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"

Validate person documents

  1. issued_at, issued_by is mandatory for documents
  2. Validate dates
    1. issued_at <= now() and issued_at => birth_date
      1.  in case `issued_at > now()` show error 422, "Document issued date should be in the past"
      2.  in case `issued_at < person.birth_date` show error 422, "Document issued date should greater than person.birth_date "
    2. expiration_date > now()
      1.  in case error show 422, "Document expiration_date should be in future"
      2. expiration_date is mandatory for document_type
        • NATIONAL_ID
        • COMPLEMENTARY_PROTECTION_CERTIFICATE
        • PERMANENT_RESIDENCE_PERMIT
        • REFUGEE_CERTIFICATE
        • TEMPORARY_CERTIFICATE
        • TEMPORARY_PASSPORT
      3. in case error return 422, "expiration_date is mandatory for document_type $.documents.type"
  3. Validate documents_type.number according to json schema 
    1. PASSPORT - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
    2. NATIONAL_ID - `^[0-9]{9}$`
    3. BIRTH_CERTIFICATE - `` ^(?![ыъэ@%&$^#`~:,.*|}{?!])[А-ЯҐЇІЄа-яґїіє0-9 №\\\"()-]+$ ``
    4. COMPLEMENTARY_PROTECTION_CERTIFICATE - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
    5. PERMANENT_RESIDENCE_PERMIT - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
    6. REFUGEE_CERTIFICATE - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
    7. TEMPORARY_CERTIFICATE - `^((?![ЫЪЭЁ])([А-ЯҐЇІЄ])){2}[0-9]{6}$`
    8. TEMPORARY_PASSPORT - `` ^(?![ыъэ@%&$^#`~:,.*|}{?!])[А-ЯҐЇІЄа-яґїіє0-9 №\\\"()-]+$ `
  4. Validate `unzr` is not null and matches "^[0-9]{8}-[0-9]{5}$" check if first 8 symbols = birth_date
    1. in case error return 422, msg "unzr or birthdate are not correct"
  5. if documents.type=NATIONAL_ID

    1. check if unzr exists in request, in case error return 422, msg "unzr is mandatory for document type NATIONAL_ID"

  6. Document numbersmaxLength < 25 

Determine default auth method for new MPI

...