Skip to content

Commit

Permalink
Получить значение поля из другого отделения по cda отношению
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Jan 14, 2025
1 parent f762710 commit 8afe266
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from cda.integration import cdator_gen_xml, render_cda
from contracts.models import PriceCategory, PriceCoast, PriceName, Company
from ecp_integration.integration import get_ecp_time_table_list_patient, get_ecp_evn_direction, fill_slot_ecp_free_nearest
from external_system.models import ProfessionsWorkersPositionsRefbook
from external_system.models import ProfessionsWorkersPositionsRefbook, CdaFields
from integration_framework.common_func import directions_pdf_result
from l2vi.integration import gen_cda_xml, send_cda_xml, send_lab_direction_to_ecp
import collections
Expand Down Expand Up @@ -3090,7 +3090,13 @@ def last_field_result(request):
if len(data) < 2:
result = {"value": ""}
else:
field_pks = [data[1]]
if data[1] == "cda":
cda_code = data[2]
cda_id = list(CdaFields.get_cda_id_by_codes([int(cda_code)]))
paraclinic_field = ParaclinicInputField.objects.filter(cda_option_id=cda_id[0]).first()
field_pks = [paraclinic_field.pk]
else:
field_pks = [data[1]]
logical_or = True
hosp_dirs = hosp_get_hosp_direction(num_dir)
parent_iss = [i['issledovaniye'] for i in hosp_dirs]
Expand Down
7 changes: 6 additions & 1 deletion external_system/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __str__(self):


class CdaFields(models.Model):
code = models.IntegerField(default=-1, blank=True, help_text='code документа', db_index=True)
code = models.IntegerField(default=-1, blank=True, help_text='code', db_index=True)
title = models.CharField(max_length=255, default="", help_text='Наименование', db_index=True)
is_doc_refferal = models.BooleanField(default=False, blank=True, help_text="Это исследование-направление к врачу", db_index=True)
is_treatment = models.BooleanField(default=False, blank=True, help_text="Это лечение", db_index=True)
Expand Down Expand Up @@ -119,6 +119,11 @@ def get_cda_id_by_titles(cda_titles):
result = CdaFields.objects.filter(title__in=cda_titles)
return result

@staticmethod
def get_cda_id_by_codes(cda_codes):
result = list(CdaFields.objects.filter(code__in=cda_codes).values_list("pk", flat=True))
return result


class ProfessionsWorkersPositionsRefbook(models.Model):
"""
Expand Down

0 comments on commit 8afe266

Please sign in to comment.