Purpose This web service is designed to change contract request by nhs employee. NHS ADMIN SIGNER should enrich contract request with information about itself, sum and place of the contract request. NHS signer could change only contract request in status = IN_RPOCESS, all other statuses can't be changed
Specification
Link
GENERAL MIS API · Apiary
Посилання на Apiary або Swagger
Resource
/api/contract_requests/{{id}}
Посилання на ресурс, наприклад: /api/persons/create
Scope
contract_request:update
Scope для доступу
Components
Contracts
Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription
Microservices
API paragraph not found
Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC
Protocol type
REST
Тип протоколу, який використовується запитом, наприклад: SOAP | REST
Request type
PATCH
Тип запиту API, наприклад: GET, POST, PATCH…
Sync/Async
API paragraph not found
Метод є синхронним чи асинхронним?
Public/Private/Internal
Private
Потрібно зазначити тип методу за ступенем доступності
Preconditions Before this the contract request should be created from MSP/PHARAMCY side and NHS employee should be appointed
Logic NHS employee with scopes 'contract_request:update' can change contract request
Contract request only in status 'IN_PROCESS' could be changed
NHS employee can change only several field of the contract request but not all of them
In case of reimbursement contract, nhs_contract_price shouldn`t be filled.
Input parameters
id
String
Contract request identifier. Required
d290f1ee-6c54-4b01-90e6-d701748f0851
Request structure Example:
Request example
{
"contract_type": "CAPITATION",
"nhs_signer_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"nhs_signer_base": "на підставі наказу",
"nhs_contract_price": 50000,
"nhs_payment_method": "prepayment",
"issue_city": "Київ",
"miscellaneous": "Жодна зі сторін не має права передавати права і зобов’язання за цим контрактом третій стороні без письмової на те згоди іншої сторони"
}
Authorize Request to process the request using a token in the headers
Headers Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation Validate token Validate user extract client_id from token
Validate scopes Validate contract request status Validate data Validate contract request id exists in DB
in case error return 404 ("Contract request with id=$id doesn't exist")
Validate request according to json schema
in case error return 422 ("validation failed")
Validate OPS.contract_request.contract_type == $.contract_type
in case of error return 409 ("Contract_type does not correspond to previously created content")
validate nhs_contract_price
in case contract_type =` REIMBURSEMENT` nhs_contract_price shouldn`t be submitted
in case of error return 409 - "nhs_contract_price is unavailable for reimbursement contract requests`
nhs_contract_price should be >= 0
in case error return 422 ("Contract price could not be negative")
Validate $nhs_signer_id: fetch prm.employees.id=$nhs_signer_id
check client_id=prm.employees.legal_entity_id
in case of error return 422 Error (Employee doesn't belong to legal_entity)
check status='APPROVED' and is_active=true
in case of error return 422 Error (Employee must be active)
Processing Fill the fields of contract_request in DB with information from request and from employee token:
contract_requests.nhs_signer_id
$nhs_signer_id
contract_requests.nhs_legal_entity_id
$client_id
contract_requests.nhs_signer_base
$.nhs_signer_base
contract_requests.issue_city
$.issue_city
contract_requests.nhs_contract_price
$.nhs_contract_price
contract_requests.nhs_payment_method
$.nhs_payment_method
contract_requests.updated_by
$.user_id
contract_requests.updated_at
now()
Response structure Click here to expand...
{
"meta": {
"code": 201,
"url": "https://example.com/resource",
"type": "object",
"request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
},
"data": {
"id": "09106b70-18b0-4726-b0ed-6bda1369fd52",
"contract_type": "REIMBURSEMENT",
"contractor_legal_entity": {
"id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"name": "Клініка Ноунейм",
"edrpou": "32323454",
"addresses": [
{
"type": "RESIDENCE",
"country": "UA",
"area": "Житомирська",
"region": "Бердичівський",
"settlement": "Київ",
"settlement_type": "CITY",
"settlement_id": "b075f148",
"street_type": "STREET",
"street": "вул. Ніжинська",
"building": "15",
"apartment": "23",
"zip": "02090"
}
]
},
"contractor_owner": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"party": {
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
}
},
"contractor_base": "на підставі закону про Медичне обслуговування населення",
"contractor_payment_details": {
"bank_name": "Банк номер 1",
"MFO": "351005",
"payer_account": "32009102701026"
},
"id_form": "RMB-1",
"nhs_signer": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"party": {
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
}
},
"nhs_legal_entity": {
"id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"name": "Клініка Ноунейм",
"edrpou": "32323454",
"addresses": [
{
"type": "RESIDENCE",
"country": "UA",
"area": "Житомирська",
"region": "Бердичівський",
"settlement": "Київ",
"settlement_type": "CITY",
"settlement_id": "b075f148",
"street_type": "STREET",
"street": "вул. Ніжинська",
"building": "15",
"apartment": "23",
"zip": "02090"
}
]
},
"nhs_signer_base": "на підставі наказу",
"nhs_contract_price": 50000,
"nhs_payment_method": "BACKWARD",
"status": "NEW",
"status_reason": "Не відповідає попереднім домовленостям",
"issue_city": "Київ",
"contract_number": "0000-9EAX-XT7X-3115",
"contract_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"parent_contract_id": "22e416c4-5747-41cd-9f73-c3a85cdee885",
"start_date": "2017-04-20",
"end_date": "2017-04-20",
"printout_content": "Contract request content",
"previous_request_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"assignee_id": "22e416c4-5747-41cd-9f73-c3a85cdee885",
"medical_programs": [
"3914a240-63db-404e-b730-09222bfeb2d0"
],
"updated_at": "2017-04-20T19:14:13Z",
"inserted_at": "2017-04-20T19:14:13Z"
}
}
contract_requests.nhs_signer_id
$nhs_signer_id
contract_requests.nhs_legal_entity_id
$client_id
contract_requests.nhs_signer_base
$.nhs_signer_base
contract_requests.issue_city
$.issue_city
contract_requests.nhs_contract_price
$.nhs_contract_price
contract_requests.nhs_payment_method
$.nhs_payment_method
contract_requests.updated_by
$.user_id
contract_requests.updated_at
now()
contract_request_update_response.json_schema
Example:
Response example
{
"meta": {
"code": 200,
"url": "https://example.com/resource",
"type": "object",
"request_id": "6617aeec-15e2-4d6f-b9bd-53559c358f97#17810"
},
"data": {
"id": "09106b70-18b0-4726-b0ed-6bda1369fd52",
"contract_type": "CAPITATION",
"contractor_legal_entity": {
"id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"name": "Клініка Ноунейм",
"edrpou": "32323454",
"addresses": [
{
"type": "RESIDENCE",
"country": "UA",
"area": "Житомирська",
"region": "Бердичівський",
"settlement": "Київ",
"settlement_type": "CITY",
"settlement_id": "b075f148",
"street_type": "STREET",
"street": "вул. Ніжинська",
"building": "15",
"apartment": "23",
"zip": "02090"
}
]
},
"contractor_owner": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"party": {
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
}
},
"contractor_base": "на підставі закону про Медичне обслуговування населення",
"contractor_payment_details": {
"bank_name": "Банк номер 1",
"MFO": "351005",
"payer_account": "32009102701026"
},
"contractor_rmsp_amount": 50000,
"contractor_divisions": [
{
"id": "2922a240-63db-404e-b730-09222bfeb2dd",
"name": "Бориспільське відділення Клініки Ноунейм",
"addresses": [
{
"type": "RESIDENCE",
"country": "UA",
"area": "Житомирська",
"region": "Бердичівський",
"settlement": "Київ",
"settlement_type": "CITY",
"settlement_id": "b075f148",
"street_type": "STREET",
"street": "вул. Ніжинська",
"building": "15",
"apartment": "23",
"zip": "02090"
}
],
"phones": [
{
"type": "MOBILE",
"number": "+380503410870"
}
],
"email": "email@example.com",
"working_hours": {
"mon": [
[
"08.00",
"12.00"
],
[
"14.00",
"18.00"
]
],
"tue": [
[
"08.00",
"12.00"
]
],
"wed": [
[
"08.00",
"12.00"
]
],
"thu": [
[
"08.00",
"12.00"
]
],
"fri": [
[
"08.00",
"12.00"
]
]
},
"mountain_group": false
}
],
"contractor_employee_divisions": [
{
"employee": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"party": {
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
},
"speciality": {
"speciality": "THERAPIST",
"speciality_officio": true,
"level": "FIRST",
"qualification_type": "AWARDING",
"attestation_name": "Академія Богомольця",
"attestation_date": "2017-02-28",
"valid_to_date": "2020-02-28",
"certificate_number": "AB/21331"
}
},
"staff_units": 0.5,
"declaration_limit": 2000,
"division_id": "2922a240-63db-404e-b730-09222bfeb2dd"
}
],
"external_contractor_flag": true,
"external_contractors": [
{
"legal_entity": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"name": "Клініка Ноунейм"
},
"contract": {
"number": "1234567",
"issued_at": "2018-01-01",
"expires_at": "2019-01-01"
},
"divisions": [
{
"id": "2922a240-63db-404e-b730-09222bfeb2dd",
"name": "Бориспільське відділення Клініки Ноунейм",
"medical_service": "Послуга ПМД"
}
]
}
],
"id_form": "PMD_1",
"nhs_signer": {
"id": "b075f148-7f93-4fc2-b2ec-2d81b19a9b7b",
"party": {
"first_name": "Петро",
"last_name": "Іванов",
"second_name": "Миколайович"
}
},
"nhs_legal_entity": {
"id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"name": "Клініка Ноунейм",
"edrpou": "32323454",
"addresses": [
{
"type": "RESIDENCE",
"country": "UA",
"area": "Житомирська",
"region": "Бердичівський",
"settlement": "Київ",
"settlement_type": "CITY",
"settlement_id": "b075f148",
"street_type": "STREET",
"street": "вул. Ніжинська",
"building": "15",
"apartment": "23",
"zip": "02090"
}
]
},
"nhs_signer_base": "на підставі наказу",
"nhs_contract_price": 50000,
"nhs_payment_method": "BACKWARD",
"status": "NEW",
"status_reason": "Не відповідає попереднім домовленостям",
"issue_city": "Київ",
"contract_number": "0000-9EAX-XT7X-3115",
"contract_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"parent_contract_id": "22e416c4-5747-41cd-9f73-c3a85cdee885",
"start_date": "2017-04-20",
"end_date": "2017-04-20",
"printout_content": "Contract request content",
"previous_request_id": "df9f70ee-4b12-4740-b0f5-bb5aea116863",
"assignee_id": "22e416c4-5747-41cd-9f73-c3a85cdee885",
"updated_at": "2017-04-20T19:14:13Z",
"inserted_at": "2017-04-20T19:14:13Z"
}
}
HTTP status codes
200
Response
401
Error
Token is expired
Access token validation failed
403
404
Contract request with id=$id doesn't exist
409
Validation failed
422
Validation failed