diff --git a/api/reports/views.py b/api/reports/views.py index 6ccbc67245..54d074f105 100644 --- a/api/reports/views.py +++ b/api/reports/views.py @@ -79,10 +79,8 @@ def xlsx_model(request): data = json.loads(request.body) directions = data.get("directions") id_model = data.get("idModel") - sql_pair_direction_iss = {i.iss_id: i.direction_id for i in get_pair_direction_iss(tuple(directions))} sql_simple_directions = [i.direction_id for i in get_simple_directions_for_hosp_stationar(tuple(sql_pair_direction_iss.keys()))] - statistic_param_data = StatisticPatternParamSet.get_statistic_param(id_model) input_field_statistic_param = ParaclinicInputField.get_field_input_by_pattern_param(list(statistic_param_data.keys())) laboratory_fractions_statistic_param = Fractions.get_fraction_id_by_pattern_param(list(statistic_param_data.keys())) diff --git a/api/researches/views.py b/api/researches/views.py index b3ab19647b..4d63d2e47a 100644 --- a/api/researches/views.py +++ b/api/researches/views.py @@ -666,6 +666,7 @@ def researches_update(request): control_param=field.get("controlParam", ""), cda_option_id=field.get("cdaOption", -1) if field.get("cdaOption", -1) != -1 else None, patient_control_param_id=field.get("patientControlParam", -1) if field.get("patientControlParam", -1) != -1 else None, + statistic_pattern_param_id=field.get("patternParam") if field.get("patternParam") != -1 else None, ) if department_template_pk: department_template_field = ParaclinicFieldTemplateDepartment( @@ -700,6 +701,7 @@ def researches_update(request): f.control_param = field.get("controlParam", '') f.patient_control_param_id = field.get("patientControlParam", -1) if field.get("patientControlParam", -1) != -1 else None f.cda_option_id = field.get("cdaOption", -1) if field.get("cdaOption", -1) != -1 else None + f.statistic_pattern_param_id = field.get("patternParam") if field.get("patternParam") != -1 else None if department_template_pk: department_template_field: ParaclinicFieldTemplateDepartment = ParaclinicFieldTemplateDepartment.objects.filter(pk=f.pk).first() diff --git a/directory/models.py b/directory/models.py index 86d5cb39e0..f609857501 100644 --- a/directory/models.py +++ b/directory/models.py @@ -1057,7 +1057,7 @@ def change_service_hidden(complex_id: int, service_id: int): class StatisticPattern(models.Model): - title = models.CharField(max_length=400, unique=True, help_text="Название стастической модели данных") + title = models.CharField(max_length=400, unique=True, help_text="Название статистической модели данных") hide = models.BooleanField(default=False, blank=True, help_text="Скрытие модели", db_index=True) def __str__(self): @@ -1069,7 +1069,7 @@ class Meta: class PatternParam(models.Model): - title = models.CharField(max_length=400, unique=True, help_text="Название название стастического параметра параметра") + title = models.CharField(max_length=400, unique=True, help_text="Название статистического параметра") code = models.CharField(max_length=400, help_text="Код параметра") is_dynamic_param = models.BooleanField(default=False, blank=True, help_text="Динамический параметр", db_index=True) order = models.IntegerField(default=-1) @@ -1081,6 +1081,12 @@ class Meta: verbose_name = "Статистическая модель - параметр" verbose_name_plural = "Статистическая модель - параметры " + @staticmethod + def get_pattern_params(): + params = PatternParam.objects.all().order_by("title").values("title", "pk") + result = [{"label": p["title"], "id": p["pk"]} for p in params] + return result + class StatisticPatternParamSet(models.Model): statistic_pattern = models.ForeignKey(StatisticPattern, default=None, null=True, blank=True, help_text="Статистическая модель", on_delete=models.CASCADE) diff --git a/directory/utils.py b/directory/utils.py index 601eeb2e1f..99f300319c 100644 --- a/directory/utils.py +++ b/directory/utils.py @@ -4,6 +4,7 @@ ParaclinicInputGroups, ParaclinicInputField, PatientControlParam, + PatternParam, ) import simplejson as json @@ -18,6 +19,7 @@ def get_researches_details(pk, templates_department_pk=None): response["patient_control_param_all"] = PatientControlParam.get_patient_control_params() research = DResearches.objects.filter(pk=pk).first() response["cda_options"] = CdaFields.get_cda_params(research.is_doc_refferal, research.is_treatment, research.is_form, research.is_extract) + response["patternParams"] = PatternParam.get_pattern_params() direction_expertise_all = [{"id": -1, "label": "Пусто"}, *[{"id": x.pk, "label": x.title} for x in DResearches.objects.filter(is_expertise=True).order_by("title")]] response["direction_expertise_all"] = direction_expertise_all if DResearches.objects.filter(pk=pk).exists(): @@ -110,6 +112,7 @@ def get_researches_details(pk, templates_department_pk=None): "controlParam": field.control_param, "patientControlParam": field.patient_control_param_id if field.patient_control_param else -1, "cdaOption": field.cda_option_id if field.cda_option else -1, + "patternParam": field.statistic_pattern_param_id if field.statistic_pattern_param else -1, } ) response["groups"].append(g) diff --git a/l2-frontend/src/construct/ParaclinicResearchEditor.vue b/l2-frontend/src/construct/ParaclinicResearchEditor.vue index 577faba10d..e7f5029094 100644 --- a/l2-frontend/src/construct/ParaclinicResearchEditor.vue +++ b/l2-frontend/src/construct/ParaclinicResearchEditor.vue @@ -646,7 +646,7 @@ >