Table of Contents |
---|
Lucidchart link
...
owners positions should be one of the list - env. configuration OWNER_POSITIONS.
At the moment it is - "P1, P2, P3, P32, P4, P6, P5, P18, P19, P22, P23, P24, P25, P26, P229, P230, P231, P232, P233, P234, P235, P236, P240"
At the moment it is - "P1, P2, P3, P32, P4, P6, P5, P18, P19, P22, P23, P24, P25, P26, P229, P230, P231, P232, P233, P234, P235, P236, P240, P257"
Anchor | ||||
---|---|---|---|---|
|
...
- Change the record according to received request
- Some of the fields must not be changed. This fields must be excluded from PATCH request: EDRPOU, TYPE
- set accreditations = Request: $.medical_services_providers.accreditations
- save residence address into legal_entities.residence_address
- If nhs_reviewed = true reset it to false
...
- Search for a record in prm.licenses for current legal entity
- Check if any attribute has changed comparing request and prm data. If yes, then:
- For each record in prm.legal_entities related to the license:
- If nhs_reviewed = true reset it to false
- If nhs_verified = true
- reset it to false
- set `nhs_unverified_at` to current date
- For each record in prm.legal_entities related to the license:
- Update license data according to the request
- Check if any attribute has changed comparing request and prm data. If yes, then:
Update LE official name
Extract official name from Digital signature.
- Update `legal_entities.public_name` in prm with official name from Digital signature
- Update `clients.name` in mithril with official name from Digital signature
Update Contract Request
- Find contract requests related to current legal entity in status = NEW, APPROVED, PENDING_NHS_SIGN, NHS_SIGNED, set status = 'TERMINATED', status_reason "Legal Entity Data has changed"
Reset flags
Update Contract
In case Legal Entity already exists in DB we need to check whether next fields weren't changed:
...
Compare fields in prm.legal_entities and in request. In case any of the fields above were changed
find contracts by contractor_legal_entity_id=$legal_entities.id and status='VERIFIED'. Set ops.contracts.is_suspended=true
...
- select licenses.id from prm.licenses where type = $.type and id in (select license_id from legal_entities where edr_data_id in (select id from edr_data where edr_id = active edr id))
- If record found then
- check if any attribute has changed comparing request and prm data. If yes, then:
- For each record in prm.legal_entities related to the license:
- If nhs_reviewed = true reset it to false
- If nhs_verified = true
- reset it to false
- set `nhs_unverified_at` to current date
- For each record in prm.legal_entities related to the license:
- Update license data according to the request
- check if any attribute has changed comparing request and prm data. If yes, then:
- if record not found then create new record:
- set 'licenses.type' = MSP if Request: $.type = MSP
- set 'licenses.type' = PHARMACY if Request: $.type = PHARMACY
- set 'licenses.is_active' = true and populate inserted_by, inserted_at, updated_by, updated_at fields
- set issued_by, issued_date, expiry_date, active_from_date, what_licensed, order_no according to Request: $.medical_services_providers.licenses data
- Link created record and edr_data record
- If record found then
...
- Create new record according to received request
- Link created record and edr_data record
- Link created record and license
- set accreditations = Request: $.medical_services_providers.accreditations
- save registration_address separately
- set nhs_verified, nhs_reviewed to false
- set `nhs_unverified_at` to current date
- set status =
activesuspended
Save LE official name
Extract official name from Digital signature.
- Save LE official name to prm DB = legal_entities.public_name
- Save LE official name to mithril DB = clients.name
...