Доступ к стационару



Модель Hospital — Стационар

разрешены запросы:

получение списка записей, получение одной записи, обновление данных записи

@property integer $id // ID записи
*@property integer $client_id // ID клиента
*@property integer $pet_id // ID питомца
*@property integer $user_id // ID доктора
*@property string $start_date // дата поступления (формат Y-m-d H:i:s 2019-12-31 14:57)
@property string $end_date // дата выписки (формат Y-m-d H:i:s 2019-12-31 14:57)
*@property string $place // № клетки/места
@property string $description // Описание/заметка к записи стационара
*@property integer $hospital_block_id // ID блока в стационаре
*@property integer $clinic_id // ID клиники
*@property string $status // статус записи стационара
поле status может иметь следующие значения:
    in_hospital - в стационаре
    planned - запланировано
    discharged - выписан
    delayed - просроченный
    deleted - удаленный

@property integer $invoice_id // ID счета
@property integer $admission_id // ID приема
связанные данные:
    @property Client $client_data - данные клиента
    @property Pet $pet_data - данные питомца
    @property User $doctor_data - данные доктора

пример запроса на получение списка записей

curl --location -g --request GET 'http://{DOMAIN NAME}/rest/api/Hospital?offset=0&limit=1&sort=[{"property":"start_date","direction":"asc"}]&filter=[{"property":"clinic_id","value":"1","operator":"="},{"property":"user_id","value":"1","operator":"="},{"property":"status","value":["in_hospital","planned"],"operator":"in"}]' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'

▶ Ответ сервера
{
    "success": true,
    "message": "Records Retrieved Successfully",
    "data": {
        "totalCount": "1",
        "hospital": [
            {
                "id": "1",
                "client_id": "6",
                "pet_id": "5",
                "user_id": "0",
                "invoice_id": "0",
                "start_date": "2021-09-20 17:13:00",
                "end_date": "0000-00-00 00:00:00",
                "place": "",
                "description": "",
                "hospital_block_id": "1",
                "clinic_id": "1",
                "admission_id": "0",
                "status": "planned",
                "pet_data": {
                    "id": "5",
                    "owner_id": "6",
                    "type_id": "13",
                    "alias": "Матроскин",
                    "sex": "unknown",
                    "date_register": "2021-09-17 16:07:44",
                    "birthday": null,
                    "note": "",
                    "breed_id": "444",
                    "old_id": null,
                    "color_id": null,
                    "deathnote": null,
                    "deathdate": null,
                    "chip_number": "",
                    "lab_number": "",
                    "status": "alive",
                    "picture": null,
                    "weight": "0.0000000000",
                    "pet_type_data": {
                        "id": "13",
                        "title": "Кошачий",
                        "picture": "cat",
                        "type": "cat"
                    },
                    "breed_data": {
                        "id": "444",
                        "title": "Ангорская",
                        "pet_type_id": "13"
                    }
                },
                "client_data": {
                    "id": "6",
                    "address": "",
                    "home_phone": "",
                    "work_phone": "",
                    "note": "",
                    "type_id": null,
                    "how_find": null,
                    "balance": "0.0000000000",
                    "email": "",
                    "city": "",
                    "city_id": "145",
                    "date_register": "2021-09-09 14:37:37",
                    "cell_phone": "0957778899",
                    "zip": "",
                    "registration_index": null,
                    "vip": "0",
                    "last_name": "Client001",
                    "first_name": "Client001",
                    "middle_name": "Client001",
                    "status": "ACTIVE",
                    "discount": "0",
                    "passport_series": "",
                    "lab_number": "",
                    "street_id": "0",
                    "apartment": "",
                    "unsubscribe": "0",
                    "in_blacklist": "0",
                    "last_visit_date": "2021-09-20 14:02:19",
                    "number_of_journal": "",
                    "phone_prefix": "38"
                },
                "in_hospital_time": ""
            }
        ]
    }
}

пример запроса на обновление записи

curl --location --request PUT 'http://{DOMAIN NAME}/rest/api/Hospital/1' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'
--data-raw '{
    "start_date":"2019-12-10 12:12:00",
    "end_date":"2019-12-12 12:12:00",
    "client_id":6,
    "pet_id":5,
    "user_id":1,
    "place":"Б1-12",
    "hospital_block_id":1,
    "description":"какое-то описание",
    "status":"in_hospital"
}'

▶ Ответ сервера
{
    "success": true,
    "message": "Record Updated",
    "data": {
        "totalCount": 1,
        "hospital": {
            "id": "1",
            "client_id": "6",
            "pet_id": "5",
            "user_id": "1",
            "invoice_id": "0",
            "start_date": "2019-12-10 12:12:00",
            "end_date": "2019-12-12 12:12:00",
            "place": "Б1-12",
            "description": "какое-то описание",
            "hospital_block_id": "1",
            "clinic_id": "1",
            "admission_id": "0",
            "status": "in_hospital",
            "pet_data": {
                "id": "5",
                "owner_id": "6",
                "type_id": "13",
                "alias": "Матроскин",
                "sex": "unknown",
                "date_register": "2021-09-17 16:07:44",
                "birthday": null,
                "note": "",
                "breed_id": "444",
                "old_id": null,
                "color_id": null,
                "deathnote": null,
                "deathdate": null,
                "chip_number": "",
                "lab_number": "",
                "status": "alive",
                "picture": null,
                "weight": "0.0000000000"
            },
            "client_data": {
                "id": "6",
                "address": "",
                "home_phone": "",
                "work_phone": "",
                "note": "",
                "type_id": null,
                "how_find": null,
                "balance": "0.0000000000",
                "email": "",
                "city": "",
                "city_id": "145",
                "date_register": "2021-09-09 14:37:37",
                "cell_phone": "0957778899",
                "zip": "",
                "registration_index": null,
                "vip": "0",
                "last_name": "Client001",
                "first_name": "Client001",
                "middle_name": "Client001",
                "status": "ACTIVE",
                "discount": "0",
                "passport_series": "",
                "lab_number": "",
                "street_id": "0",
                "apartment": "",
                "unsubscribe": "0",
                "in_blacklist": "0",
                "last_visit_date": "2021-09-20 14:02:19",
                "number_of_journal": "",
                "phone_prefix": "38"
            },
            "doctor_data": {
                "id": "1",
                "last_name": "admin",
                "first_name": "",
                "middle_name": "",
                "login": "admin",
                "passwd": "9205814c8bc98857f5e07f3bae30ad68",
                "position_id": "8",
                "email": "[email protected]",
                "phone": "00000000000",
                "cell_phone": "0000000000",
                "address": "Address 1",
                "role_id": "7",
                "is_active": "1",
                "calc_percents": "1",
                "nickname": "admin",
                "youtrack_login": "",
                "youtrack_password": "",
                "last_change_pwd_date": "0000-00-00",
                "is_limited": "0",
                "carrotquest_id": "two:1",
                "sip_number": "",
                "user_inn": ""
            }
        }
    }
}

Модель HospitalBlock — Блоки для стационара

разрешены запросы:

получение списка записей, получение одной записи

@property integer $id // ID записи
*@property string $title // название блока
*@property integer $places_count // кол-во мет в блоке
*@property integer $reserved_places_count // резерв мест в блоке
*@property integer $is_daily_payment // посуточная оплата значения: 0/1
*@property integer $is_hourly_payment // почасовая оплата значения: 0/1
*@property integer $clinic_id // ID клиники
*@property string $status // статус блока 
значения:
    active - активный
    disabled - неактивный
    deleted - удаленный

пример запроса получение списка блоков стационара

curl --location -g --request GET 'http://{DOMAIN NAME}/rest/api/HospitalBlock?offset=0&limit=20&filter=[{"property":"clinic_id","value":"1","operator":"="},{"property":"status","value":"active","operator":"="}]' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'

▶ Ответ сервера
{
    "success": true,
    "message": "Records Retrieved Successfully",
    "data": {
        "totalCount": "1",
        "hospitalBlock": [
            {
                "id": "1",
                "title": "Блок1",
                "places_count": "10",
                "reserved_places_count": "1",
                "is_daily_payment": "1",
                "is_hourly_payment": "0",
                "status": "active",
                "clinic_id": "1"
            }
        ]
    }
}