Skip to content

Commit

Permalink
Merge branch 'develop' into doy-rename-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro authored Jul 5, 2024
2 parents f45f5c1 + 91e88be commit ae3a082
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 15 deletions.
15 changes: 5 additions & 10 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
USE_TFOMS_DISTRICT,
TYPE_COMPANY_SET_DIRECTION_PDF,
MEDEXAM_FIN_SOURCE_TITLE,
EXCLUDE_TYPE_RESEARCH,
)
from utils.response import status_response

Expand Down Expand Up @@ -2808,19 +2809,13 @@ def update_coast_research_in_price(request):
@group_required("Конструктор: Настройка организации")
def get_research_list(request):
researches = Researches.objects.all().order_by("title")
res_list = {
"Лаборатория": {},
"Параклиника": {},
"Консультации": {"Общие": []},
"Формы": {"Общие": []},
"Лечение": {"Общие": []},
"Морфология": {"Микробиология": [], "Гистология": [], "Цитология": []},
"Стоматология": {"Общие": []},
"Комплексные услуги": {"Общие": []},
}
res_list = Researches.gen_non_excluded_categories()

lab_podr = get_lab_podr()
lab_podr = [podr[0] for podr in lab_podr]
for research in researches:
if not Researches.check_exclude(research):
continue
is_hide = ""
if research.hide:
is_hide = "- (скрыто)"
Expand Down
67 changes: 66 additions & 1 deletion directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.db import models, transaction
from jsonfield import JSONField

from laboratory.settings import DEATH_RESEARCH_PK
from laboratory.settings import DEATH_RESEARCH_PK, EXCLUDE_TYPE_RESEARCH
from podrazdeleniya.models import Podrazdeleniya
from researches.models import Tubes
from users.models import DoctorProfile, Speciality
Expand Down Expand Up @@ -815,6 +815,71 @@ def get_all_ids(array: bool = False, hide: bool = False):
result = set(Researches.objects.filter(hide=hide).values_list('id', flat=True))
return result

@staticmethod
def check_exclude(research):
"""Проверка на исключенные типы услуг, на входе либо SQL namedtuple, либо объект researches"""
result = True
if research.is_paraclinic and EXCLUDE_TYPE_RESEARCH["is_paraclinic"]:
result = False
elif research.is_doc_refferal and EXCLUDE_TYPE_RESEARCH["is_doc_refferal"]:
result = False
elif research.is_treatment and EXCLUDE_TYPE_RESEARCH["is_treatment"]:
result = False
elif research.is_stom and EXCLUDE_TYPE_RESEARCH["is_stom"]:
result = False
elif research.is_hospital and EXCLUDE_TYPE_RESEARCH["is_hospital"]:
result = False
elif research.is_slave_hospital and EXCLUDE_TYPE_RESEARCH["is_slave_hospital"]:
result = False
elif research.is_microbiology and EXCLUDE_TYPE_RESEARCH["is_microbiology"]:
result = False
elif research.is_citology and EXCLUDE_TYPE_RESEARCH["is_citology"]:
result = False
elif research.is_gistology and EXCLUDE_TYPE_RESEARCH["is_gistology"]:
result = False
elif research.is_form and EXCLUDE_TYPE_RESEARCH["is_form"]:
result = False
elif research.is_application and EXCLUDE_TYPE_RESEARCH["is_application"]:
result = False
elif research.is_direction_params and EXCLUDE_TYPE_RESEARCH["is_direction_params"]:
result = False
elif research.is_global_direction_params and EXCLUDE_TYPE_RESEARCH["is_global_direction_params"]:
result = False
elif research.is_monitoring and EXCLUDE_TYPE_RESEARCH["is_monitoring"]:
result = False
elif research.is_expertise and EXCLUDE_TYPE_RESEARCH["is_expertise"]:
result = False
elif research.is_aux and EXCLUDE_TYPE_RESEARCH["is_aux"]:
result = False
elif research.is_case and EXCLUDE_TYPE_RESEARCH["is_case"]:
result = False
elif research.is_complex and EXCLUDE_TYPE_RESEARCH["is_complex"]:
result = False
elif EXCLUDE_TYPE_RESEARCH["is_laboratory"]:
result = False
return result

@staticmethod
def gen_non_excluded_categories():
res_list = {}
if not EXCLUDE_TYPE_RESEARCH["is_laboratory"]:
res_list["Лаборатория"] = {}
if not EXCLUDE_TYPE_RESEARCH["is_paraclinic"]:
res_list["Параклиника"] = {}
if not EXCLUDE_TYPE_RESEARCH["is_doc_refferal"]:
res_list["Консультации"] = {"Общие": []}
if not EXCLUDE_TYPE_RESEARCH["is_form"]:
res_list["Формы"] = {"Общие": []}
if not EXCLUDE_TYPE_RESEARCH["is_treatment"]:
res_list["Лечение"] = {"Общие": []}
if not EXCLUDE_TYPE_RESEARCH["is_microbiology"] and not EXCLUDE_TYPE_RESEARCH["is_gistology"] and not EXCLUDE_TYPE_RESEARCH["is_citology"]:
res_list["Морфология"] = {"Микробиология": [], "Гистология": [], "Цитология": []}
if not EXCLUDE_TYPE_RESEARCH["is_stom"]:
res_list["Стоматология"] = {"Общие": []}
if not EXCLUDE_TYPE_RESEARCH["is_complex"]:
res_list["Комплексные услуги"] = {"Общие": []}
return res_list


class HospitalService(models.Model):
TYPES = (
Expand Down
4 changes: 2 additions & 2 deletions forms/sql_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def get_researches():
with connection.cursor() as cursor:
cursor.execute(
"""
SELECT id, internal_code, title, code FROM directory_researches
WHERE hide=False and internal_code != ''
SELECT * FROM directory_researches
WHERE hide=False
ORDER BY internal_code
""",
)
Expand Down
7 changes: 6 additions & 1 deletion forms/xlsx/forms100.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from openpyxl import Workbook

from contracts.models import PriceName
from directory.models import Researches
from forms.sql_func import get_researches, get_coasts, get_prices


Expand All @@ -20,7 +21,11 @@ def form_01(request_data) -> Workbook:
price_ids = tuple(price_template.keys())
price_titles = [f"{price.title}-{price.symbol_code}" for price in prices]

research_dict = {research.id: {"internal_code": research.internal_code, "research_title": research.title, "research_code": research.code, **price_template} for research in researches}
research_dict = {}

for research in researches:
if Researches.check_exclude(research):
research_dict[research.id] = {"internal_code": research.internal_code, "research_title": research.title, "research_code": research.code, **price_template}

coasts = get_coasts(price_ids)
for coast in coasts:
Expand Down
3 changes: 2 additions & 1 deletion l2-frontend/src/construct/ConstructPrice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
href="#"
@click.prevent="downloadCoastTOXlsx(selectedPrice)"
>
Текущий прайс - XLSX
Текущий - XLSX
</a>
<a
class="a-under a-align r-padding"
Expand All @@ -205,6 +205,7 @@
<LoadFile
:is-gen-commercial-offer="true"
:selected-price="selectedPrice"
title-button="Смета"
/>
</a>
<UploadFileModal
Expand Down
23 changes: 23 additions & 0 deletions laboratory/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,29 @@ def __getitem__(self, item):
"100.01": False,
}

EXCLUDE_TYPE_RESEARCH = {
"is_laboratory": False,
"is_paraclinic": False,
"is_doc_refferal": False,
"is_treatment": False,
"is_stom": False,
"is_hospital": False,
"is_slave_hospital": False,
"is_microbiology": False,
"is_citology": False,
"is_gistology": False,
"is_form": False,
"is_application": False,
"is_direction_params": False,
"is_global_direction_params": False,
"is_monitoring": False,
"is_expertise": False,
"is_aux": False,
"is_case": False,
"is_complex": False,
}


try:
from laboratory.local_settings import * # noqa: F403,F401
except ImportError:
Expand Down

0 comments on commit ae3a082

Please sign in to comment.