From 3059bea599246a6ec8ed53ee1237f61f9cf49099 Mon Sep 17 00:00:00 2001 From: sergei kasianenko Date: Sun, 17 Mar 2024 18:36:01 +0800 Subject: [PATCH 1/6] api: get gistology directions by list --- integration_framework/views.py | 80 +++++++++++++++++++++------------- slog/models.py | 1 + 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/integration_framework/views.py b/integration_framework/views.py index cdeba8ab59..8b66db3003 100644 --- a/integration_framework/views.py +++ b/integration_framework/views.py @@ -1578,13 +1578,35 @@ def external_direction_create(request): return Response({"ok": False, "message": "Некорректный auth токен"}) body = json.loads(request.body) + result = create_direction_by_param(body, request) + return Response(result) + + +@api_view(["POST"]) +def external_list_direction_create(request): + if not hasattr(request.user, "hospitals"): + return Response({"ok": False, "message": "Некорректный auth токен"}) + body_directions = json.loads(request.body) + for body in body_directions: + result = create_direction_by_param(body, request) + if not result.get("ok"): + try: + Log.log( + str(body.get("internalId")), + 122002, + body={"data": body}, + ) + except Exception as e: + logger.exception(e) + +def create_direction_by_param(body, request): org = body.get("org", {}) code_tfoms = org.get("codeTFOMS") oid_org = org.get("oid") if not code_tfoms and not oid_org: - return Response({"ok": False, "message": "Должно быть указано хотя бы одно значение из org.codeTFOMS или org.oid"}) + return {"ok": False, "message": "Должно быть указано хотя бы одно значение из org.codeTFOMS или org.oid"} if code_tfoms: hospital = Hospitals.objects.filter(code_tfoms=code_tfoms).first() @@ -1592,10 +1614,10 @@ def external_direction_create(request): hospital = Hospitals.objects.filter(oid=oid_org).first() if not hospital: - return Response({"ok": False, "message": "Организация не найдена"}) + return {"ok": False, "message": "Организация не найдена"} if not request.user.hospitals.filter(pk=hospital.pk).exists(): - return Response({"ok": False, "message": "Нет доступа в переданную организацию"}) + return {"ok": False, "message": "Нет доступа в переданную организацию"} is_exclude_contorl_documnets = False if hospital.pk in HOSPITAL_PKS_NOT_CONTROL_DOCUMENT_EXTERNAL_CREATE_DIRECTION: @@ -1606,15 +1628,15 @@ def external_direction_create(request): enp = (patient.get("enp") or "").replace(" ", "") if enp and (len(enp) != 16 or not enp.isdigit()): - return Response({"ok": False, "message": "Неверные данные полиса, должно быть 16 чисел"}) + return {"ok": False, "message": "Неверные данные полиса, должно быть 16 чисел"} snils = (patient.get("snils") or "").replace(" ", "").replace("-", "") if not enp and not snils and not is_exclude_contorl_documnets: - return Response({"ok": False, "message": "При пустом patient.enp должно быть передано patient.snils или patient.passportSerial+patient.passportNumber"}) + return {"ok": False, "message": "При пустом patient.enp должно быть передано patient.snils или patient.passportSerial+patient.passportNumber"} if snils and not petrovna.validate_snils(snils): - return Response({"ok": False, "message": "patient.snils: не прошёл валидацию"}) + return {"ok": False, "message": "patient.snils: не прошёл валидацию"} lastname = str(patient.get("lastName") or "") firstname = str(patient.get("firstName") or "") @@ -1627,22 +1649,22 @@ def external_direction_create(request): sex = "ж" if not enp and not (lastname and firstname and birthdate and birthdate): - return Response({"ok": False, "message": "При пустом patient.enp должно быть передано поле patient.individual"}) + return {"ok": False, "message": "При пустом patient.enp должно быть передано поле patient.individual"} if lastname and not firstname: - return Response({"ok": False, "message": "При передаче lastname должен быть передан и firstname"}) + return {"ok": False, "message": "При передаче lastname должен быть передан и firstname"} if firstname and not lastname: - return Response({"ok": False, "message": "При передаче firstname должен быть передан и lastname"}) + return {"ok": False, "message": "При передаче firstname должен быть передан и lastname"} if firstname and lastname and not birthdate: - return Response({"ok": False, "message": "При передаче firstname и lastname должно быть передано поле birthdate"}) + return {"ok": False, "message": "При передаче firstname и lastname должно быть передано поле birthdate"} if birthdate and (not re.fullmatch(r"\d{4}-\d\d-\d\d", birthdate) or birthdate[0] not in ["1", "2"]): - return Response({"ok": False, "message": "birthdate должно соответствовать формату YYYY-MM-DD"}) + return {"ok": False, "message": "birthdate должно соответствовать формату YYYY-MM-DD"} if birthdate and sex not in ["м", "ж"]: - return Response({"ok": False, "message": 'individual.sex должно быть "м" или "ж"'}) + return {"ok": False, "message": 'individual.sex должно быть "м" или "ж"'} individual = None if enp: @@ -1681,25 +1703,25 @@ def external_direction_create(request): ) if not individual: - return Response({"ok": False, "message": "Физлицо не найдено"}) + return {"ok": False, "message": "Физлицо не найдено"} card = Card.objects.filter(individual=individual, base__internal_type=True).first() if not card: card = Card.add_l2_card(individual) if not card: - return Response({"ok": False, "message": "Карта не найдена"}) + return {"ok": False, "message": "Карта не найдена"} financing_source_title = body.get("financingSource", "") if financing_source_title.lower() not in ["омс", "бюджет", "платно"]: - return Response({"ok": False, "message": "Некорректный источник финансирования"}) + return {"ok": False, "message": "Некорректный источник финансирования"} financing_source = directions.IstochnikiFinansirovaniya.objects.filter(title__iexact=financing_source_title, base__internal_type=True).first() financing_category_code = body.get("financingCategory", "") price_category = PriceCategory.objects.filter(title__startswith=financing_category_code).first() if not financing_source: - return Response({"ok": False, "message": "Некорректный источник финансирования"}) + return {"ok": False, "message": "Некорректный источник финансирования"} message = None @@ -1713,11 +1735,11 @@ def external_direction_create(request): diag_text = body.get("diagText", "") # обязательно if not diag_text: - return Response({"ok": False, "message": "Диагноз описание не заполнено"}) + return {"ok": False, "message": "Диагноз описание не заполнено"} diag_mkb10 = body.get("diagMKB10", "") # обязательно if not diag_mkb10: - return Response({"ok": False, "message": "Диагноз по МКБ10 не заполнен (не верно)"}) + return {"ok": False, "message": "Диагноз по МКБ10 не заполнен (не верно)"} open_skob = "{" close_skob = "}" @@ -1734,11 +1756,11 @@ def external_direction_create(request): } method_obtain_material = body.get("methodObtainMaterial", "") # обязательно code из НСИ 1.2.643.5.1.13.13.99.2.33" if not method_obtain_material or method_obtain_material not in [1, 2, 3, 4, 5, 6, 7]: - return Response({"ok": False, "message": "Способо забора не верно заполнено"}) + return {"ok": False, "message": "Способо забора не верно заполнено"} resident_code = patient.get("residentCode", "") # обязательно code из НСИ 1.2.643.5.1.13.13.11.1042" if not resident_code or resident_code not in [1, 2]: - return Response({"ok": False, "message": "Не указан вид жительства"}) + return {"ok": False, "message": "Не указан вид жительства"} if resident_code == 1: resident_data = f'{open_skob}"code": "1", "title": "Город"{close_skob}' else: @@ -1746,20 +1768,18 @@ def external_direction_create(request): solution10 = body.get("solution10", "") # обязательно if not solution10 or solution10 not in ["true", "false"]: - return Response({"ok": False, "message": "Не указано помещен в 10% раствор"}) + return {"ok": False, "message": "Не указано помещен в 10% раствор"} doctor_fio = body.get("doctorFio", "") # обязательно if not doctor_fio: - return Response({"ok": False, "message": "Не указан врач производивший забор материала"}) + return {"ok": False, "message": "Не указан врач производивший забор материала"} material_mark = body.get("materialMark", "") numbers_vial = [] for k in material_mark: result_check = check_valid_material_mark(k, numbers_vial) if not result_check: - return Response({"ok": False, "message": "Не верная маркировка материала"}) + return {"ok": False, "message": "Не верная маркировка материала"} numbers_vial = result_check - if len(numbers_vial) != sorted(numbers_vial)[-1]: - return Response({"ok": False, "message": "Не верная маркировка флаконов (порядок 1,2,3,4...)"}) try: with transaction.atomic(): @@ -1795,7 +1815,7 @@ def external_direction_create(request): pathological_process = {1: "1-Внешне неизмененная ткань", 2: "2-Узел", 3: "3-Пятно", 4: "4-Полип", 5: "5-Эрозия", 6: "6-Язва", 7: "7-Прочие"} for m_m in material_mark: result_table_field.append( - [str(m_m["numberVial"]), m_m.get("localization", ""), pathological_process[m_m["pathologicalProcess"]], str(m_m["objectValue"]), m_m.get("description", "")] + [str(m_m["numberVial"]), m_m.get("localization", ""), pathological_process[m_m.get("pathologicalProcess", 7)], str(m_m["objectValue"]), m_m.get("description", "")] ) data_marked["rows"] = result_table_field match_keys = { @@ -1826,7 +1846,7 @@ def external_direction_create(request): ) except Exception as e: logger.exception(e) - return Response({"ok": True, "id": str(direction.pk)}) + return {"ok": True, "id": str(direction.pk)} except InvalidData as e: logger.exception(e) @@ -1835,7 +1855,7 @@ def external_direction_create(request): logger.exception(e) message = "Серверная ошибка" - return Response({"ok": False, "message": message}) + return {"ok": False, "message": message} @api_view(["POST"]) @@ -1923,11 +1943,11 @@ def external_get_pdf_result(request): return JsonResponse({"result": pdf_data}) -def check_valid_material_mark(current_material_data, current_numbers_vial): +def check_valid_material_mark(current_material_data, current_numbers_vial, isCheckpathologicalProcess=False): for k, v in current_material_data.items(): if k == "numberVial" and not isinstance(v, int): # обязательно число return False - if k == "pathologicalProcess" and v not in [1, 2, 3, 4, 5, 6, 7]: # "code из НСИ 1.2.643.5.1.13.13.99.2.34" обязательно + if isCheckpathologicalProcess and k == "pathologicalProcess" and v not in [1, 2, 3, 4, 5, 6, 7]: # "code из НСИ 1.2.643.5.1.13.13.99.2.34" обязательно return False if k == "objectValue" and not isinstance(v, int): # обязательно число return False diff --git a/slog/models.py b/slog/models.py index 84468c46eb..a80cb2fa21 100644 --- a/slog/models.py +++ b/slog/models.py @@ -134,6 +134,7 @@ class Log(models.Model): (121107, 'Сотрудники: обновление должности сотрудника'), (122000, 'Гистология: регистрация материала гистологии'), (122001, 'Гистология: api-приём направлений'), + (122002, 'Ошибка Гистология: api-приём направлений списком'), (130000, 'Настройка прайсов: изменение цены'), (130001, 'Настройка прайсов: удаление цены'), (130002, 'Настройка компаний: изменение компании'), From afd2d256c22f71dc55129c70a96bafb8a21358df Mon Sep 17 00:00:00 2001 From: sergei kasianenko Date: Sun, 17 Mar 2024 19:26:46 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=D0=9D=D0=B0=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20"e"=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B5=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=B2=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/directions/sql_func.py | 6 ++++-- api/directions/views.py | 8 +++++++- integration_framework/views.py | 2 ++ l2-frontend/src/ui-cards/DirectionsHistory/index.vue | 1 + 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/api/directions/sql_func.py b/api/directions/sql_func.py index 39c7f98896..522d33b2b8 100644 --- a/api/directions/sql_func.py +++ b/api/directions/sql_func.py @@ -37,7 +37,8 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk directory_researches.is_expertise, person_contract.id as person_contract_id, person_contract.dir_list as contract_dirs, - directions_napravleniya.hospital_id as dir_hosp + directions_napravleniya.hospital_id as dir_hosp, + directions_napravleniya.rmis_number as rmis_number FROM directions_issledovaniya LEFT JOIN directory_researches ON directions_issledovaniya.research_id = directory_researches.Id @@ -108,7 +109,8 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk directions_napravleniya.visit_date, directions_napravleniya.time_microbiology_receive, directions_napravleniya.time_gistology_receive, - is_case + is_case, + directions_napravleniya.rmis_number FROM t_iss_tubes LEFT JOIN t_recive ON t_iss_tubes.tubesregistration_id = t_recive.id_t_recive diff --git a/api/directions/views.py b/api/directions/views.py index 3252f743c4..4524491830 100644 --- a/api/directions/views.py +++ b/api/directions/views.py @@ -469,7 +469,7 @@ def directions_history(request): status_set = {-2} lab = set() lab_title = None - person_contract_dirs, planed_doctor, register_number = "", "", "" + person_contract_dirs, planed_doctor, register_number, rmis_number = "", "", "", "" created_document_only_user_hosp = SettingManager.get("created_document_only_user_hosp", default='false', default_type='b') user_groups = [str(x) for x in request.user.groups.all()] type_service = request_data.get("type_service", None) @@ -525,6 +525,7 @@ def directions_history(request): 'person_contract_dirs': person_contract_dirs, 'planed_doctor': planed_doctor, 'register_number': register_number, + 'rmis_number': rmis_number, } ) child_researches_titles = "" @@ -532,6 +533,8 @@ def directions_history(request): person_contract_dirs = "" planed_doctor = "" register_number = "" + rmis_number = "" + dir = i[0] expertise_data = get_expertise(dir) is_expertise = False @@ -616,6 +619,8 @@ def directions_history(request): register_number = i[29] if i[30]: planed_doctor = f"{i[30]} {i[31]} {i[32]}" + if i[37]: + rmis_number = i[37] status = min(status_set) if len(lab) > 0: @@ -653,6 +658,7 @@ def directions_history(request): 'person_contract_dirs': person_contract_dirs, 'planed_doctor': planed_doctor, 'register_number': register_number, + 'rmis_number': rmis_number, } ) res['directions'] = final_result diff --git a/integration_framework/views.py b/integration_framework/views.py index 8b66db3003..0030a9977d 100644 --- a/integration_framework/views.py +++ b/integration_framework/views.py @@ -1781,6 +1781,7 @@ def create_direction_by_param(body, request): return {"ok": False, "message": "Не верная маркировка материала"} numbers_vial = result_check + try: with transaction.atomic(): direction = Napravleniya.objects.create( @@ -1792,6 +1793,7 @@ def create_direction_by_param(body, request): hospital=hospital, id_in_hospital=id_in_hospital, price_category=price_category, + rmis_number=id_in_hospital if body.get("isRMIS") else None ) time_get = str(body.get("dateTimeGet", "") or "") or None diff --git a/l2-frontend/src/ui-cards/DirectionsHistory/index.vue b/l2-frontend/src/ui-cards/DirectionsHistory/index.vue index 59f4e0d713..dc47e08dc6 100644 --- a/l2-frontend/src/ui-cards/DirectionsHistory/index.vue +++ b/l2-frontend/src/ui-cards/DirectionsHistory/index.vue @@ -215,6 +215,7 @@ :class="['status-' + row.status]" > + e {{ row.status }} **З From d79381fa1abf754aeb407cfe9babc5e8c129d548 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko <41939763+urchinpro@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:34:50 +0800 Subject: [PATCH 3/6] Update integration_framework/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- integration_framework/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/integration_framework/views.py b/integration_framework/views.py index 0030a9977d..db928f89e4 100644 --- a/integration_framework/views.py +++ b/integration_framework/views.py @@ -1781,7 +1781,6 @@ def create_direction_by_param(body, request): return {"ok": False, "message": "Не верная маркировка материала"} numbers_vial = result_check - try: with transaction.atomic(): direction = Napravleniya.objects.create( From b3a150cf393ab50dacd41032e73facde216bbd61 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko <41939763+urchinpro@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:35:08 +0800 Subject: [PATCH 4/6] Update integration_framework/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- integration_framework/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_framework/views.py b/integration_framework/views.py index db928f89e4..3a01dd765a 100644 --- a/integration_framework/views.py +++ b/integration_framework/views.py @@ -1792,7 +1792,7 @@ def create_direction_by_param(body, request): hospital=hospital, id_in_hospital=id_in_hospital, price_category=price_category, - rmis_number=id_in_hospital if body.get("isRMIS") else None + rmis_number=id_in_hospital if body.get("isRMIS") else None, ) time_get = str(body.get("dateTimeGet", "") or "") or None From a824b440b51ee170950b7388788546ca2948eea5 Mon Sep 17 00:00:00 2001 From: Wellheor1 Date: Sun, 17 Mar 2024 11:42:49 +0000 Subject: [PATCH 5/6] Bump version to 2024.3.171142+529ef9 --- l2-frontend/yarn.lock | 6 +++--- laboratory/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/l2-frontend/yarn.lock b/l2-frontend/yarn.lock index f0e4df996f..20a4de9652 100644 --- a/l2-frontend/yarn.lock +++ b/l2-frontend/yarn.lock @@ -2933,9 +2933,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464: - version "1.0.30001597" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001597.tgz" - integrity sha512-7LjJvmQU6Sj7bL0j5b5WY/3n7utXUJvAe1lxhsHDbLmwX9mdL86Yjtr+5SRCyf8qME4M7pU2hswj0FpyBVCv9w== + version "1.0.30001598" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001598.tgz" + integrity sha512-j8mQRDziG94uoBfeFuqsJUNECW37DXpnvhcMJMdlH2u3MRkq1sAI0LJcXP1i/Py0KbSIC4UDj8YHPrTn5YsL+Q== case-sensitive-paths-webpack-plugin@^2.3.0: version "2.4.0" diff --git a/laboratory/__init__.py b/laboratory/__init__.py index 0dae191ca2..4878271a53 100644 --- a/laboratory/__init__.py +++ b/laboratory/__init__.py @@ -1,2 +1,2 @@ -__version__ = "2024.3.120305+95738d" +__version__ = "2024.3.171142+529ef9" VERSION = __version__ diff --git a/pyproject.toml b/pyproject.toml index ffd5ee32bb..c5160db7b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ skip-string-normalization = true [tool.poetry] name = "l2" -version = "2024.3.120305+95738d" +version = "2024.3.171142+529ef9" description = "" authors = ["Mikhail Privalov "] license = "MIT" From ca964a9757d9a5772c2a8eb9e2f9187fc94f36fc Mon Sep 17 00:00:00 2001 From: urchinpro Date: Sun, 17 Mar 2024 11:59:08 +0000 Subject: [PATCH 6/6] Bump version to 2024.3.171159+d5b7dc --- laboratory/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/laboratory/__init__.py b/laboratory/__init__.py index 4878271a53..485bb7f875 100644 --- a/laboratory/__init__.py +++ b/laboratory/__init__.py @@ -1,2 +1,2 @@ -__version__ = "2024.3.171142+529ef9" +__version__ = "2024.3.171159+d5b7dc" VERSION = __version__ diff --git a/pyproject.toml b/pyproject.toml index c5160db7b2..601dbc6de7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ skip-string-normalization = true [tool.poetry] name = "l2" -version = "2024.3.171142+529ef9" +version = "2024.3.171159+d5b7dc" description = "" authors = ["Mikhail Privalov "] license = "MIT"