diff --git a/api/parse_file/forms100.py b/api/parse_file/forms100.py index 4f8af6461d..a7d5481eaf 100644 --- a/api/parse_file/forms100.py +++ b/api/parse_file/forms100.py @@ -3,7 +3,6 @@ import requests from openpyxl.reader.excel import load_workbook - from contracts.models import PriceName, PriceCoast from directory.models import Researches from laboratory.settings import RMIS_MIDDLE_SERVER_ADDRESS, RMIS_MIDDLE_SERVER_TOKEN diff --git a/api/parse_file/forms101.py b/api/parse_file/forms101.py new file mode 100644 index 0000000000..bd205be4e8 --- /dev/null +++ b/api/parse_file/forms101.py @@ -0,0 +1,339 @@ +import datetime +import json + +from django.http import HttpRequest +from openpyxl.reader.excel import load_workbook + +from api.models import Application +from api.patients.views import patients_search_card +from clients.models import Card, Individual, HarmfulFactor, PatientHarmfullFactor, CardBase +from contracts.models import Company, CompanyDepartment, MedicalExamination +from integration_framework.views import check_enp + + +def get_background_token(): + application = Application.objects.filter(active=True, is_background_worker=True).first() + if application: + bearer_token = f"Bearer {application.key}" + else: + new_application = Application(name="background_worker", is_background_worker=True) + new_application.save() + bearer_token = f"Bearer {new_application.key}" + return bearer_token + + +def search_by_fio(request_obj, family, name, patronymic, birthday): + patient_card = None + params_tfoms = { + "enp": "", + "family": family, + "name": name, + "bd": birthday, + "check_mode": "l2-enp-full", + } + params_internal = { + "type": CardBase.objects.get(internal_type=True).pk, + "extendedSearch": True, + "form": { + "family": family, + "name": name, + "patronymic": patronymic, + "birthday": birthday, + "archive": False, + }, + "limit": 1, + } + request_obj._body = params_tfoms + current_patient = check_enp(request_obj) + if current_patient.data.get("message"): + request_obj._body = json.dumps(params_internal) + data = patients_search_card(request_obj) + results_json = json.loads(data.content.decode("utf-8")) + if len(results_json["results"]) > 0: + patient_card_pk = results_json["results"][0]["pk"] + patient_card = Card.objects.filter(pk=patient_card_pk).first() + elif len(current_patient.data["list"]) > 1: + return patient_card + else: + patient_card = Individual.import_from_tfoms(current_patient.data["list"], None, None, None, True) + return patient_card + + +def find_and_replace(text, symbol1, symbol2): + result = [] + for i in range(len(text)): + if text[i] == symbol1: + current_text = text[0:i] + symbol2 + text[i + 1 :] + result.append(current_text) + elif text[i] == symbol2: + current_text = text[0:i] + symbol1 + text[i + 1 :] + result.append(current_text) + return result + + +def search_by_possible_fio(request_obj, name, patronymic, birthday, possible_family): + if not possible_family: + return None + patient_card = None + for i in possible_family: + current_family = i + patient_card = search_by_fio(request_obj, current_family, name, patronymic, birthday) + if patient_card is not None: + break + return patient_card + + +def search_patient(snils_data, request_user, family_data, name_data, patronymic_data, birthday_data): + patient_card = None + bearer_token = get_background_token() + params = {"enp": "", "snils": snils_data, "check_mode": "l2-snils"} + request_obj = HttpRequest() + request_obj._body = params + request_obj.user = request_user + request_obj.method = "POST" + request_obj.META["HTTP_AUTHORIZATION"] = bearer_token + current_patient = None + if snils_data and snils_data != "None": + current_patient = check_enp(request_obj) + if not current_patient or current_patient.data.get("message"): + patient_card = search_by_fio(request_obj, family_data, name_data, patronymic_data, birthday_data) + if patient_card is None: + possible_family = find_and_replace(family_data, "е", "ё") + patient_card = search_by_possible_fio(request_obj, name_data, patronymic_data, birthday_data, possible_family) + if patient_card is None: + return patient_card + elif current_patient.data.get("patient_data") and type(current_patient.data.get("patient_data")) != list: + patient_card_pk = current_patient.data["patient_data"]["card"] + patient_card = Card.objects.filter(pk=patient_card_pk).first() + else: + patient_card = Individual.import_from_tfoms(current_patient.data["patient_data"], None, None, None, True) + + return patient_card + + +def create_patient(family_data, name_data, patronymic_data, birthday_data, gender_data): + patient_indv = Individual( + family=family_data, + name=name_data, + patronymic=patronymic_data, + birthday=birthday_data, + sex=gender_data, + ) + patient_indv.save() + patient_card = Card.add_l2_card(individual=patient_indv) + return patient_card + + +def find_factors(harmful_factors: list): + if not harmful_factors: + return None + incorrect_factor = [] + harmful_factors_data = [] + for i in harmful_factors: + current_code = i.replace(" ", "") + harmful_factor = HarmfulFactor.objects.filter(title=current_code).first() + if harmful_factor: + harmful_factors_data.append({"factorId": harmful_factor.pk}) + else: + incorrect_factor.append(f"{current_code}") + + return harmful_factors_data, incorrect_factor + + +def add_factors_data(patient_card: Card, position: str, factors_data: list, exam_data: str, company_inn: str, department: str): + try: + PatientHarmfullFactor.save_card_harmful_factor(patient_card.pk, factors_data) + company_obj = Company.objects.filter(inn=company_inn).first() + department_obj = CompanyDepartment.objects.filter(company_id=company_obj.pk, title=department).first() + if department_obj: + patient_card.work_department_db_id = department_obj.pk + else: + new_department = CompanyDepartment.save_department(company_obj.pk, department) + patient_card.work_department_db_id = new_department.pk + patient_card.work_position = position.strip() + patient_card.work_place_db = company_obj + patient_card.save() + MedicalExamination.save_examination(patient_card, company_obj, exam_data) + return {"ok": True} + except Exception as e: + return {"ok": False, "message": e} + + +def normalize_med_exam_data(snils: str, fio: str, birthday: str, gender: str, inn_company: str, code_harmful: str, position: str, examination_date: str, department: str): + result = { + "snils": None, + "fio": None, + "family": None, + "name": None, + "patronymic": None, + "birthday": None, + "gender": None, + "inn_company": None, + "codes_harmful": None, + "position": None, + "examination_date": None, + "department": None, + } + if snils and snils != "None": + result["snils"] = snils.replace("-", "").replace(" ", "") + if fio and fio != "None": + fio_data = fio.split(" ") + fio_data = [value for value in fio_data if value] + result["fio"] = " ".join(fio_data) + result["family"] = fio_data[0] + result["name"] = fio_data[1] + if len(fio_data) > 2: + result["patronymic"] = fio_data[2] + if birthday and birthday != "None": + result["birthday"] = birthday.split(" ")[0] + if gender and gender != "None": + result["gender"] = gender[0].lower() + if inn_company and inn_company != "None": + result["inn_company"] = inn_company + if code_harmful and code_harmful != "None": + result["codes_harmful"] = code_harmful.split(",") + if position and position != "None": + result["position"] = position + if examination_date and examination_date != "None": + result["examination_date"] = examination_date.split(" ")[0] + if department and department != "None": + result["department"] = department + return result + + +def create_error_data(fio, snils, reason): + fio_local = fio if fio else snils + if not fio_local: + fio_local = "Неизвестно" + result = {"fio": fio_local, "reason": reason} + return result + + +def check_date(date): + if not date: + return False + try: + datetime.datetime.strptime(date, '%Y-%m-%d') + except ValueError: + return False + return True + + +def validate_med_exam_data(normalize_data: dict, inn_company) -> dict: + result = {"ok": True, "data": {}} + fio = normalize_data["fio"] + snils = normalize_data["snils"] + fio_local = fio if fio else snils + errors = [] + if not fio_local: + result = {"ok": False, "data": {}, "empty": True} + return result + if normalize_data["inn_company"] != inn_company: + errors.append("ИНН организации не совпадает") + if not check_date(normalize_data["birthday"]): + errors.append("Дата рождения: неверная/несуществующая дата") + if not check_date(normalize_data["examination_date"]): + errors.append("Дата мед. осмотра: неверная/несуществующая дата") + if not normalize_data["department"]: + errors.append("Подразделение не указано") + if not normalize_data["gender"] in ["м", "ж"]: + errors.append("Пол указан не верно") + if len(normalize_data["position"]) > 128: + errors.append("Должность больше 128 символов") + + if errors: + result = {"ok": False, "data": {"fio": fio_local, "reason": ", ".join(errors)}, "empty": False} + + return result + + +def check_need_col(cols: list, need_cols: set): + other_need_cols = set(set(cols) - need_cols) + if len(other_need_cols) + len(need_cols) != len(cols): + return False + return True + + +def form_01(request_data): + """ + Загрузка списка на мед. осмотр + + На входе: + Файл XLSX с ФИО и датами осмотра. + Структура: + снилс(snils), фио(fio), дата рождения(birthday), пол(gender), инн организации(inn_company), код вредности(code_harmful) + должность(position), дата мед. осмотра(examination_date), подразделение(department) + + """ + file = request_data.get("file") + other_need_data = request_data.get("other_need_data") + user = request_data.get("user") + company_inn = other_need_data.get("companyInn") + columns = [{"field": 'fio', "key": 'fio', "title": 'ФИО', "align": 'left', "width": 250}, {"field": 'reason', "key": 'reason', "title": 'Причина ошибки'}] + wb = load_workbook(filename=file) + ws = wb[wb.sheetnames[0]] + starts = False + incorrect_patients = [] + snils_idx, fio_idx, birthday_idx, gender_idx, inn_company_idx, code_harmful_idx, position_idx, examination_date_idx, department_idx = ( + None, + None, + None, + None, + None, + None, + None, + None, + None, + ) + need_col_name = {"снилс", "фио", "дата рождения", "пол", "инн организации", "код вредности", "должность", "дата мед. осмотра", "подразделение"} + for index, row in enumerate(ws.rows, 1): + cells = [str(x.value) for x in row] + if not starts: + if "код вредности" in cells: + if not check_need_col(cells, need_col_name): + return {"ok": False, "result": {}, "message": "Нет обязательных полей"} + snils_idx = cells.index("снилс") + fio_idx = cells.index("фио") + birthday_idx = cells.index("дата рождения") + gender_idx = cells.index("пол") + inn_company_idx = cells.index("инн организации") + code_harmful_idx = cells.index("код вредности") + position_idx = cells.index("должность") + examination_date_idx = cells.index("дата мед. осмотра") + department_idx = cells.index("подразделение") + starts = True + else: + snils = cells[snils_idx].strip() + fio = cells[fio_idx].strip() + birthday = cells[birthday_idx].strip() + gender = cells[gender_idx].strip() + inn_company = cells[inn_company_idx].strip() + code_harmful = cells[code_harmful_idx].strip() + position = cells[position_idx].strip() + examination_date = cells[examination_date_idx].strip() + department = cells[department_idx].strip() + + normalize_row = normalize_med_exam_data(snils, fio, birthday, gender, inn_company, code_harmful, position, examination_date, department) + check_result = validate_med_exam_data(normalize_row, company_inn) + if not check_result["ok"] and check_result.get("empty"): + continue + if not check_result["ok"]: + incorrect_patients.append(check_result["data"]) + continue + if check_result["ok"] and check_result["data"]: + incorrect_patients.append(check_result["data"]) + + patient_card = search_patient(normalize_row["snils"], user, normalize_row["family"], normalize_row["name"], normalize_row["patronymic"], normalize_row["birthday"]) + if patient_card is None: + patient_card = create_patient(normalize_row["family"], normalize_row["name"], normalize_row["patronymic"], normalize_row["birthday"], normalize_row["gender"]) + harmful_factors_data, incorrect_factor = find_factors(normalize_row["codes_harmful"]) + if incorrect_factor: + incorrect_patients.append({"fio": normalize_row["fio"], "reason": f"Неверные факторы: {incorrect_factor}"}) + patient_updated = add_factors_data(patient_card, normalize_row["position"], harmful_factors_data, normalize_row["examination_date"], company_inn, normalize_row["department"]) + if not patient_updated["ok"]: + incorrect_patients.append({"fio": cells[fio_idx], "reason": f"Сохранение не удалось, ошибка: {patient_updated['message']}"}) + result = { + "colData": columns, + "data": incorrect_patients, + } + return {"ok": True, "result": result, "message": ""} diff --git a/api/parse_file/views.py b/api/parse_file/views.py index 187d450466..ff23fa204e 100644 --- a/api/parse_file/views.py +++ b/api/parse_file/views.py @@ -4,6 +4,7 @@ import logging import re import tempfile +import traceback from copy import deepcopy from sys import stdout @@ -29,6 +30,7 @@ from hospitals.models import Hospitals from laboratory.settings import CONTROL_AGE_MEDEXAM, DAYS_AGO_SEARCH_RESULT, ALLOWED_FORMS_FILE from results.sql_func import check_lab_instrumental_results_by_cards_and_period +from slog.models import Log from statistic.views import commercial_offer_xls_save_file, data_xls_save_file, data_xls_save_headers_file from users.models import AssignmentResearches, DoctorProfile from clients.models import Individual, HarmfulFactor, PatientHarmfullFactor, Card, CardBase, DocumentType, Document @@ -76,164 +78,6 @@ def http_func(data, user): return endpoint(http_obj) -def create_patient(family_data, name_data, patronymic_data, birthday_data, gender_data): - patient_indv = Individual( - family=family_data, - name=name_data, - patronymic=patronymic_data, - birthday=birthday_data, - sex=gender_data, - ) - patient_indv.save() - patient_card = Card.add_l2_card(individual=patient_indv) - return patient_card - - -def get_background_token(): - application = Application.objects.filter(active=True, is_background_worker=True).first() - if application: - bearer_token = f"Bearer {application.key}" - else: - new_application = Application(name="background_worker", is_background_worker=True) - new_application.save() - bearer_token = f"Bearer {new_application.key}" - return bearer_token - - -def search_patient(snils_data, request_user, family_data, name_data, patronymic_data, birthday_data): - patient_card = None - bearer_token = get_background_token() - params = {"enp": "", "snils": snils_data, "check_mode": "l2-snils"} - request_obj = HttpRequest() - request_obj._body = params - request_obj.user = request_user - request_obj.method = "POST" - request_obj.META["HTTP_AUTHORIZATION"] = bearer_token - current_patient = None - if snils_data and snils_data != "None": - current_patient = check_enp(request_obj) - if not current_patient or current_patient.data.get("message"): - patient_card = search_by_fio(request_obj, family_data, name_data, patronymic_data, birthday_data) - if patient_card is None: - possible_family = find_and_replace(family_data, "е", "ё") - patient_card = search_by_possible_fio(request_obj, name_data, patronymic_data, birthday_data, possible_family) - if patient_card is None: - return patient_card - elif current_patient.data.get("patient_data") and type(current_patient.data.get("patient_data")) != list: - patient_card_pk = current_patient.data["patient_data"]["card"] - patient_card = Card.objects.filter(pk=patient_card_pk).first() - else: - patient_card = Individual.import_from_tfoms(current_patient.data["patient_data"], None, None, None, True) - - return patient_card - - -def find_factors(harmful_factors: list): - if not harmful_factors: - return None - incorrect_factor = [] - harmful_factors_data = [] - for i in harmful_factors: - current_code = i.replace(" ", "") - harmful_factor = HarmfulFactor.objects.filter(title=current_code).first() - if harmful_factor: - harmful_factors_data.append({"factorId": harmful_factor.pk}) - else: - incorrect_factor.append(f"{current_code}") - - return harmful_factors_data, incorrect_factor - - -def add_factors_data(patient_card: Card, position: str, factors_data: list, exam_data: str, company_inn: str, department: str): - try: - PatientHarmfullFactor.save_card_harmful_factor(patient_card.pk, factors_data) - company_obj = Company.objects.filter(inn=company_inn).first() - department_obj = CompanyDepartment.objects.filter(company_id=company_obj.pk, title=department).first() - if department_obj: - patient_card.work_department_db_id = department_obj.pk - else: - new_department = CompanyDepartment.save_department(company_obj.pk, department) - patient_card.work_department_db_id = new_department.pk - patient_card.work_position = position.strip() - patient_card.work_place_db = company_obj - patient_card.save() - MedicalExamination.save_examination(patient_card, company_obj, exam_data) - return {"ok": True} - except Exception as e: - return {"ok": False, "message": e} - - -def add_factors_from_file(request): - incorrect_patients = [] - company_inn = request.POST.get("companyInn", None) - company_file = request.FILES["file"] - wb = load_workbook(filename=company_file) - ws = wb.worksheets[0] - starts = False - snils, fio, birthday, gender, inn_company, code_harmful, position, examination_date, department = ( - None, - None, - None, - None, - None, - None, - None, - None, - None, - ) - for index, row in enumerate(ws.rows, 1): - cells = [str(x.value) for x in row] - if not starts: - if "код вредности" in cells: - snils = cells.index("снилс") - fio = cells.index("фио") - birthday = cells.index("дата рождения") - gender = cells.index("пол") - inn_company = cells.index("инн организации") - code_harmful = cells.index("код вредности") - position = cells.index("должность") - examination_date = cells.index("дата мед. осмотра") - department = cells.index("подразделение") - starts = True - else: - if company_inn != cells[inn_company].strip(): - incorrect_patients.append({"fio": cells[fio], "reason": "ИНН организации не совпадает"}) - continue - snils_data = cells[snils].replace("-", "").replace(" ", "") - fio_data, family_data, name_data, patronymic_data = None, None, None, None - if cells[fio] and cells[fio] != "None": - fio_data = cells[fio].split(" ") - family_data = fio_data[0] - name_data = fio_data[1] - if len(fio_data) > 2: - patronymic_data = fio_data[2] - birthday_data = cells[birthday].split(" ")[0] - code_harmful_data = cells[code_harmful].split(",") - exam_data = cells[examination_date].split(" ")[0] - try: - datetime.datetime.strptime(birthday_data, '%Y-%m-%d') - datetime.datetime.strptime(exam_data, '%Y-%m-%d') - except ValueError as e: - incorrect_patients.append({"fio": cells[fio], "reason": f"Неверный формат даты/несуществующая дата в файле: {e}"}) - continue - gender_data = cells[gender][0] - department_data = cells[department] - if fio_data is None and snils_data is None: - incorrect_patients.append({"fio": f"Строка: {index}", "reason": "Отсутствует данные"}) - continue - patient_card = search_patient(snils_data, request.user, family_data, name_data, patronymic_data, birthday_data) - if patient_card is None: - patient_card = create_patient(family_data, name_data, patronymic_data, birthday_data, gender_data) - harmful_factors_data, incorrect_factor = find_factors(code_harmful_data) - if incorrect_factor: - incorrect_patients.append({"fio": cells[fio], "reason": f"Неверные факторы: {incorrect_factor}"}) - patient_updated = add_factors_data(patient_card, cells[position], harmful_factors_data, exam_data, company_inn, department_data) - if not patient_updated["ok"]: - incorrect_patients.append({"fio": cells[fio], "reason": f"Сохранение не удалось, ошибка: {patient_updated['message']}"}) - - return incorrect_patients - - @csrf_exempt def load_file(request): link = "" @@ -248,9 +92,6 @@ def load_file(request): research_set = int(req_data.get("researchSet")[0]) results = data_research_exam_patient(request, research_set) link = "open-xls" - elif len(req_data.get("companyInn")[0]) != 0: - results = add_factors_from_file(request) - return JsonResponse({"ok": True, "results": results, "company": True}) elif req_data.get("isLoadResultService")[0] == "true": id_research = int(req_data.get("idService")[0]) research = Researches.objects.filter(pk=id_research).first() @@ -602,67 +443,6 @@ def auto_create_protocol(title_fields, file_data, financing_source_title, resear return incorrect_patients -def search_by_fio(request_obj, family, name, patronymic, birthday): - patient_card = None - params_tfoms = { - "enp": "", - "family": family, - "name": name, - "bd": birthday, - "check_mode": "l2-enp-full", - } - params_internal = { - "type": CardBase.objects.get(internal_type=True).pk, - "extendedSearch": True, - "form": { - "family": family, - "name": name, - "patronymic": patronymic, - "birthday": birthday, - "archive": False, - }, - "limit": 1, - } - request_obj._body = params_tfoms - current_patient = check_enp(request_obj) - if current_patient.data.get("message"): - request_obj._body = json.dumps(params_internal) - data = patients_search_card(request_obj) - results_json = json.loads(data.content.decode("utf-8")) - if len(results_json["results"]) > 0: - patient_card_pk = results_json["results"][0]["pk"] - patient_card = Card.objects.filter(pk=patient_card_pk).first() - elif len(current_patient.data["list"]) > 1: - return patient_card - else: - patient_card = Individual.import_from_tfoms(current_patient.data["list"], None, None, None, True) - return patient_card - - -def find_and_replace(text, symbol1, symbol2): - result = [] - for i in range(len(text)): - if text[i] == symbol1: - current_text = text[0:i] + symbol2 + text[i + 1 :] - result.append(current_text) - elif text[i] == symbol2: - current_text = text[0:i] + symbol1 + text[i + 1 :] - result.append(current_text) - return result - - -def search_by_possible_fio(request_obj, name, patronymic, birthday, possible_family): - if not possible_family: - return None - patient_card = None - for i in possible_family: - current_family = i - patient_card = search_by_fio(request_obj, current_family, name, patronymic, birthday) - if patient_card is not None: - break - return patient_card - - @login_required def load_csv(request): file_data = request.FILES["file"] @@ -904,26 +684,28 @@ def get_parts_fio(fio_data): @login_required() def upload_file(request): - # todo - Логирование загрузки файлов + file = request.FILES["file"] + request_data = request.POST + selected_form = request_data.get("selectedForm") + entity_id = request_data.get("entityId") + other_need_data = json.loads(request_data.get("otherNeedData")) + user = request.user + data = {"file": file, "selected_form": selected_form, "entity_id": entity_id, "other_need_data": other_need_data} try: - file = request.FILES["file"] - request_data = request.POST - selected_form = request_data.get("selectedForm") - entity_id = request_data.get("entityId") - other_need_data = request_data.get("otherNeedData") - data = {"file": file, "selected_form": selected_form, "entity_id": entity_id, "other_need_data": other_need_data} function = import_string(f"api.parse_file.forms{selected_form[0:3]}.form_{selected_form[4:6]}") result = function( request_data={ **data, - "user": request.user, + "user": user, "hospital": request.user.doctorprofile.get_hospital() if hasattr(request.user, "doctorprofile") else Hospitals.get_default_hospital(), } ) except Exception as e: + tb = traceback.format_exc() exception_string = f"{e}" - stdout.write(exception_string) - return JsonResponse({"ok": False, "result": [], "message": exception_string}) + stdout.write(tb) + Log.log(selected_form, 240000, user.doctorprofile, {"exception_string": exception_string, "traceback": tb}) + return JsonResponse({"ok": False, "result": [], "message": "Ошибка обработки файла"}) return JsonResponse({"ok": result["ok"], "result": result["result"], "message": result["message"]}) diff --git a/l2-frontend/src/components/UploadFile.vue b/l2-frontend/src/components/UploadFile.vue index 439261317b..a2291d3b86 100644 --- a/l2-frontend/src/components/UploadFile.vue +++ b/l2-frontend/src/components/UploadFile.vue @@ -19,12 +19,16 @@ v-if="selectedType" class="margin-item" > - + class="flex" + > + +
+
+
+ +
+ Нет записей +
+
+ +
+ {{ currentFormsInfo ? currentFormsInfo : 'Нет дополнительной информации' }} +
diff --git a/l2-frontend/src/components/types-and-forms-file.ts b/l2-frontend/src/components/types-and-forms-file.ts index 5e887df075..58df3a48e6 100644 --- a/l2-frontend/src/components/types-and-forms-file.ts +++ b/l2-frontend/src/components/types-and-forms-file.ts @@ -37,8 +37,13 @@ export default function typesAndForms() { XLSX: { 100.01: { id: '100.01', label: 'Загрузка цен по прайсу' }, 100.02: { id: '100.02', label: 'Загрузка посещений' }, + 101.01: { id: '101.01', label: 'Загрузка списка на мед. осмотр' }, }, }); + const fileFormsInfo = ref({ + 101.01: 'Необходимые поля: "снилс", "фио", "дата рождения", "пол", "инн организации", "код вредности", "должность", ' + + '"дата мед. осмотра", "подразделение"', + }); const addForms = (type: string, forms = null, allowedForms: string[] = null) => { const result: formsFile[] = []; for (const form of forms) { @@ -58,7 +63,13 @@ export default function typesAndForms() { }); return result.length === 0; }; - + const getFormsInfo = (formsKey: string) => { + const info = fileFormsInfo.value[formsKey]; + if (info) { + return info; + } + return ''; + }; const getForms = (type: string, forms: string[] = null, onlyResult = false, allowedForms: string[] = null): formsFile[] => { let result: formsFile[] = []; if (!allowedForms) { @@ -76,6 +87,6 @@ export default function typesAndForms() { return result; }; return { - getTypes, getForms, getFileFilters, unsupportedFileForms, + getTypes, getForms, getFileFilters, unsupportedFileForms, getFormsInfo, }; } diff --git a/l2-frontend/src/construct/ConstructCompany.vue b/l2-frontend/src/construct/ConstructCompany.vue index 9064528c0b..6688adc287 100644 --- a/l2-frontend/src/construct/ConstructCompany.vue +++ b/l2-frontend/src/construct/ConstructCompany.vue @@ -153,7 +153,13 @@
@@ -368,14 +374,18 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'; import ruRu from '@/locales/ve'; import VueTippyTd from '@/construct/VueTippyTd.vue'; import * as actions from '@/store/action-types'; -import LoadFile from '@/ui-cards/LoadFile.vue'; +import UploadFileModal from '@/modals/UploadFileModal.vue'; VeLocale.use(ruRu); export default { name: 'ConstructCompany', components: { - LoadFile, VueTippyTd, VeTable, VePagination, Treeselect, + UploadFileModal, + VueTippyTd, + VeTable, + VePagination, + Treeselect, }, data() { return { diff --git a/l2-frontend/src/modals/UploadFileModal.vue b/l2-frontend/src/modals/UploadFileModal.vue index f86022b23e..399be526ca 100644 --- a/l2-frontend/src/modals/UploadFileModal.vue +++ b/l2-frontend/src/modals/UploadFileModal.vue @@ -14,20 +14,21 @@ show-footer="true" ignore-body white-bg="true" - max-width="710px" + :max-width="props.showResults ? '1000px' : '710px'" width="100%" margin-left-right="auto" @close="open = false" > {{ titleLocal }}
-
+
@@ -84,7 +85,11 @@ const props = defineProps({ required: false, }, otherNeedData: { - type: Object || Array || String || Number, + type: Object || Array, + required: false, + }, + showResults: { + type: Boolean, required: false, }, }); @@ -112,4 +117,7 @@ const uploadSuccess = () => { .body { height: 300px; } +.body-high { + height: 600px; +} diff --git a/l2-frontend/src/ui-cards/LoadFile.vue b/l2-frontend/src/ui-cards/LoadFile.vue index 8b47acceed..823a469556 100644 --- a/l2-frontend/src/ui-cards/LoadFile.vue +++ b/l2-frontend/src/ui-cards/LoadFile.vue @@ -214,11 +214,6 @@ export default { type: String, default: 'li', }, - companyInn: { - type: String, - default: '', - required: false, - }, fileFilter: { type: String, default: null, @@ -335,7 +330,6 @@ export default { this.results = []; const formData = new FormData(); formData.append('file', this.file); - formData.append('companyInn', this.companyInn); formData.append('isGenCommercialOffer', this.isGenCommercialOffer); formData.append('selectedPrice', this.selectedPrice); formData.append('isWritePatientEcp', this.isWritePatientEcp); diff --git a/laboratory/settings.py b/laboratory/settings.py index 23b9592ff8..88dfc23526 100644 --- a/laboratory/settings.py +++ b/laboratory/settings.py @@ -427,6 +427,7 @@ def __getitem__(self, item): ALLOWED_FORMS_FILE = { "100.01": False, "100.02": False, + "101.01": False, } EXCLUDE_TYPE_RESEARCH = { diff --git a/slog/models.py b/slog/models.py index 6461cd796f..74107fea67 100644 --- a/slog/models.py +++ b/slog/models.py @@ -181,6 +181,7 @@ class Log(models.Model): (230003, 'Палаты: Пациенту отменили доктора'), (230004, 'Палаты: Пациент переведен в ожидающие'), (230005, 'Палаты: Пациент покинул ожидающих'), + (240000, 'Загрузка файлов: Ошибка'), ) # Виды событий, которые могут быть очищены