From 81b733648af6173793f84bb46eb665d06ea0f414 Mon Sep 17 00:00:00 2001 From: sergei kasianenko Date: Tue, 26 Nov 2024 10:35:37 +0800 Subject: [PATCH] fix upload_result --- api/parse_file/views.py | 3 +-- .../management/commands/upload_desription_result.py | 9 +++++++++ integration_framework/utils.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/parse_file/views.py b/api/parse_file/views.py index 7ea27cbc3a..1d7ed32873 100644 --- a/api/parse_file/views.py +++ b/api/parse_file/views.py @@ -18,11 +18,10 @@ import simplejson as json from api.patients.sql_func import search_cards_by_numbers -from api.patients.views import patients_search_card from api.views import endpoint from openpyxl import load_workbook from appconf.manager import SettingManager -from contracts.models import PriceCoast, Company, MedicalExamination, CompanyDepartment, PriceName +from contracts.models import PriceCoast import directions.models as directions from directory.models import SetOrderResearch, Researches, ParaclinicInputGroups, ParaclinicInputField from directory.sql_func import is_paraclinic_filter_research, is_lab_filter_research diff --git a/directions/management/commands/upload_desription_result.py b/directions/management/commands/upload_desription_result.py index d578327b53..959f3d7efb 100644 --- a/directions/management/commands/upload_desription_result.py +++ b/directions/management/commands/upload_desription_result.py @@ -3,6 +3,7 @@ from django.db.models import Q from openpyxl import load_workbook import clients.models as clients +from api.directions.views import eds_documents from directory.models import ParaclinicInputGroups, ParaclinicInputField from django.db import transaction from django.utils import timezone @@ -12,6 +13,8 @@ import directions.models as directions from utils.dates import normalize_dots_date from sys import stdout +from django.http import HttpRequest +import simplejson as json logger = logging.getLogger("IF") @@ -121,6 +124,12 @@ def handle(self, *args, **kwargs): else: value = cells[current_cells] directions.ParaclinicResult(issledovaniye=iss, field=f, field_type=f.field_type, value=value).save() + eds_documents_data = json.dumps({"pk": direction.pk}) + eds_documents_obj = HttpRequest() + eds_documents_obj._body = eds_documents_data + eds_documents_obj.user = doc_profile.user + eds_documents(eds_documents_obj) + stdout.write(f'Добавлено направление: {direction.pk}') except Exception as e: logger.exception(e) diff --git a/integration_framework/utils.py b/integration_framework/utils.py index 3a8300ca59..b735700b63 100644 --- a/integration_framework/utils.py +++ b/integration_framework/utils.py @@ -163,7 +163,7 @@ def get_json_protocol_data(pk, is_paraclinic=False): if not data.get("Состояние код"): data["Состояние код"] = "1" data["Состояние наименование"] = "Удовлетворительное" - if not data.get("Дата осмотра"): + if not data.get("Дата осмотра") and iss.medical_examination: data["Дата осмотра"] = iss.medical_examination.strftime("%Y-%m-%d") if data.get("Дата заключения"): val = data.get("Дата заключения")