updateExisting method: createComposition
Implemented changes:
…
Request structure
Example
Expand | ||
---|---|---|
| ||
|
Validation data request
Focus Processing - Receiving and processing Focus record
For Newborn Composition:
If focus.type.coding.code isn’t person - return BAD_FOCUS_CODING(1009)
Getting a record about the Composition's patient by id with RPC method get_preperson_by_id if focus.type.coding.code = preperson or get_person_by_id if focus.type.coding.code = person and Composition.type is Temporary Disability
In case of error - return 1009 (BAD_FOCUS_CODING), 1010 (FOCUS_NOT_FOUND), 1111 (FOCUS_IS_NOT_ACTIVE)
Getting a record about the Composition.focus’s authorization methods by id with RPC method get_auth_methods.If authorization method is expired such method isn't not usedIf specified authorization method wasn't found - return 1171 (FOCUS_AUTH_NOT_SPECIFIED)
Checks for “section.focus” attribute:
If focus.type.code does not match with value in EMAL_VALIDATION_FOCUS_CATEGORIES_BY_TYPE - return 1201 (INVALID_DISABILITY_FOCUS_CATEGORY)
If focus.status does not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_STATUSES_BY_CATEGORY - return 1202 (INVALID_DISABILITY_FOCUS_STATUS) or 1203 (INVALID_NEWBORN_FOCUS_STATUS )
If focus.type=preperson and IS_FOREIGN_TREATMENT extension is TRUE - return 1214 (FOREIGN_TREATMENT_FOR_FOCUS_PREPERSON_NOT_ALLOWED)
Additional checks for focus.type=person:
Check for patient’s verification_status:
If verification_status does not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_VERIFICATION_STATUSES_BY_CATEGORY or it doesn't specified - return 1204 (INVALID_NEWBORN_FOCUS_VERIFICATION_STATUS) or 1205 (INVALID_DISABILITY_FOCUS_VERIFICATION_STATUS)
Check for tax_id
In case of error - return 1138 (PERSON_HAS_NO_TAX_ID)
Check for focus document.type
If it is not match with value in EMAL_ERLN_CREATE_RECORD_JOB_DOCUMENT_TYPE_CODES - return 10916 (IDENTIFICATION_FAILED_DOCUMENT_ABSENT)
If focus.documen_type is not match with value in EMAL_VALIDATION_FOCUS_DOCUMENTS_BY_CATEGORY - return 1212 (INVALID_NEWBORN_FOCUS_DOCUMENTS) or 1213 (INVALID_DISABILITY_FOCUS_DOCUMENTS)
Check for focus.gender
If focus gender is not match with value in EMAL_VALIDATION_FOCUS_GENDERS_BY_CATEGORY or it's not specified - return 1208 (INVALID_NEWBORN_FOCUS_GENDER) or 1209 (INVALID_DISABILITY_FOCUS_GENDER)
Check for focus age
If age of the person is not match with value in EMAL_VALIDATION_FOCUS_ALLOWED_AGES_BY_CATEGORY - return 1206 (INVALID_NEWBORN_FOCUS_AGE) or 1207 (INVALID_DISABILITY_FOCUS_AGE)
Check
thatif authentication methodwith type = ‘THIRD_PERSON’is submitted inAUTHORIZE_WITHINFORM_WITH extension. If true - getting a record about the authorization methods by id with RPC method get_auth_methods:persons age < no_self_registration_age global parameter;persons age between no_self_registration_age and person_full_legal_capacity_age global parameters and person does not have document with type from PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter;persons age > person_full_legal_capacity_age global parameter and exists at least one active and approved confidant person relationship for person (using following process https://e-health-ua.atlassian.net/wiki/spaces/CSI/pages/17667883028 with person_id = person_id from request - expected :ok, :approved response)If AUTHORIZE_WITH with type = 'THIRD_PERSON' does not exist - return 1230 FOCUS_NOT_LEGALLY_CAPABLE_WITHOUT_AUTHORIZATION
Check that authentication method exists in MPI database,
person_authentication_methods
table (with is_active = true), belongs to the same patient as set in the composition, is active (ended_at > now() or ended_at is null) and type != NAin case error - return 1171 'FOCUS_AUTH_NOT_SPECIFIED'
For Rectification cases:
If the records of identified and unidentified patients are not combined - return 1155 (CANT_AMEND_NO_MERGE_PAIR)
getSmsPhoneNumber - Receiving phone number for sending SMS about creation of composition
This procedure is performed if extension “
AUTHORIZE_WITHINFORM_WITH” was specified in the request. In other cases, the procedure is not performedsearch for a person's authorization method by RPC call to the MPI service get_auth_method
If phone number was found - this number is saving for future SMS sending
If phone number wasn't found - return 1017 (PHONE_NOT_FOUND)