Skip to content

Commit

Permalink
Merge pull request #4183 from mikhailprivalov/send2Ecp_afterConfirm
Browse files Browse the repository at this point in the history
commands - send2ecp
  • Loading branch information
urchinpro authored Aug 11, 2024
2 parents d103bb3 + 6db10fd commit b947b72
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions directions/management/commands/lab_result_send_ecp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.core.management.base import BaseCommand

from api.dicom import check_server_port
from appconf.manager import SettingManager
from directions.models import Napravleniya
from l2vi.integration import send_lab_direction_to_ecp


class Command(BaseCommand):
help = "Отправить лабораторные результаты в ЕЦП"

def handle(self, *args, **kwargs):
base = SettingManager.get_api_ecp_base_url()
if base != 'empty':
available = check_server_port(base.split(":")[1].replace("//", ""), int(base.split(":")[2]))
if not available:
self.stdout.write({"error": True, "message": "Cервер отправки в ЕЦП не доступен"})
d_qs = Napravleniya.objects.filter(total_confirmed=True, ecp_direction_number=None, rmis_resend_services=False)
directions = [i.pk for i in d_qs]
res = send_lab_direction_to_ecp(directions)
self.stdout.write(f"{res}\n")
for n in d_qs:
n.rmis_resend_services = True
n.save()
1 change: 1 addition & 0 deletions integration_framework/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,7 @@ def receive_pair_direction(request):
for id_direction, rmis_id in pair_id_directions.items():
direction = Napravleniya.objects.filter(pk=id_direction).first()
direction.rmis_number = rmis_id
direction.ecp_direction_number = rmis_id
direction.save()
return Response({"ok": True})

Expand Down

0 comments on commit b947b72

Please sign in to comment.