Skip to content

Commit

Permalink
Merge pull request #4181 from mikhailprivalov/resultSend_receiveExter…
Browse files Browse the repository at this point in the history
…nal_id

IF: upload pairDirections
  • Loading branch information
Wellheor1 authored Aug 11, 2024
2 parents 13538bb + 61b8f56 commit e5ff2a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions integration_framework/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
20 changes: 19 additions & 1 deletion integration_framework/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"):
Expand Down

0 comments on commit e5ff2a1

Please sign in to comment.