diff --git a/integration_framework/urls.py b/integration_framework/urls.py index 259fc30f21..c5832001bc 100644 --- a/integration_framework/urls.py +++ b/integration_framework/urls.py @@ -33,6 +33,7 @@ path('send-result', views.external_research_create), path('send-direction', views.external_direction_create), path('send-list-direction', views.external_list_direction_create), + path('receive-pair-direction', views.receive_pair_direction), path('get-directions', views.get_directions), path('get-direction-data-by-period', views.get_direction_data_by_period), path('get-directions-data', views.get_direction_data_by_num), diff --git a/integration_framework/views.py b/integration_framework/views.py index ec77ed1a8a..93745bfd2a 100644 --- a/integration_framework/views.py +++ b/integration_framework/views.py @@ -1625,7 +1625,7 @@ def external_list_direction_create(request): Log.log( str(body.get("internalId")), 122002, - body={"data": body}, + body={"data": f"{body}-result:{result}"}, ) except Exception as e: logger.exception(e) @@ -1918,6 +1918,24 @@ def get_directions(request): return Response({"ok": True, "data": directions_data}) +@api_view(["POST"]) +def receive_pair_direction(request): + if not hasattr(request.user, "hospitals"): + return Response({"ok": False, "message": "Некорректный auth токен"}) + + body = json.loads(request.body) + pair_id_directions = body.get(("pairDirections") or {}) + + if not pair_id_directions: + return Response({"ok": False, "message": ""}) + else: + for id_direction, rmis_id in pair_id_directions.items(): + direction = Napravleniya.objects.filter(pk=id_direction).first() + direction.rmis_number = rmis_id + direction.save() + return Response({"ok": True}) + + @api_view(["POST"]) def get_direction_data_by_num(request): if not hasattr(request.user, "hospitals"):