From 0d6b9d0ae87731e49287fd9e7fb58591644262f7 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko Date: Wed, 10 Jan 2024 15:38:32 +0800 Subject: [PATCH 1/3] additional attr for Research --- api/views.py | 1 + directory/admin.py | 15 +++++++++++++++ directory/models.py | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/api/views.py b/api/views.py index 2d4a378dba..a38a97abbb 100644 --- a/api/views.py +++ b/api/views.py @@ -1219,6 +1219,7 @@ def get_template(request): def update_template(request): response = {"ok": False} request_data = json.loads(request.body) + print(request_data) pk = request_data.get("pk", -2) if pk > -2: title = request_data.get("title").strip() diff --git a/directory/admin.py b/directory/admin.py index 60e34489e4..b7a5456133 100644 --- a/directory/admin.py +++ b/directory/admin.py @@ -270,6 +270,18 @@ class SetAuxService(admin.ModelAdmin): ) +class SetComplexService(admin.ModelAdmin): + list_display = ( + 'main_research', + 'slave_research', + 'hide', + ) + list_display_links = ( + 'main_research', + 'slave_research', + ) + + admin.site.register(models.ResearchSite, RefSiteType) admin.site.register(models.ResearchGroup) admin.site.register(models.Researches, ResAdmin) @@ -302,3 +314,6 @@ class SetAuxService(admin.ModelAdmin): admin.site.register(models.SetResearch, SetResearchAdmin) admin.site.register(models.SetOrderResearch, SetOrderResearchAdmin) admin.site.register(models.AuxService, SetAuxService) +admin.site.register(models.ComplexService, SetComplexService) +admin.site.register(models.LaboratoryMaterial) +admin.site.register(models.SubGroup) diff --git a/directory/models.py b/directory/models.py index d542e306db..4fd1301fd8 100644 --- a/directory/models.py +++ b/directory/models.py @@ -134,6 +134,28 @@ class Meta: verbose_name_plural = 'Методика анализа' +class LaboratoryMaterial(models.Model): + title = models.CharField(max_length=64, help_text="Биоматериал") + + def __str__(self): + return "%s" % self.title + + class Meta: + verbose_name = 'Биоматериал' + verbose_name_plural = 'Биоматериалы' + + +class SubGroup(models.Model): + title = models.CharField(max_length=64, help_text="Подгруппа услуги") + + def __str__(self): + return "%s" % self.title + + class Meta: + verbose_name = 'Погруппа услуги' + verbose_name_plural = 'Подгруппы услуг' + + class Researches(models.Model): """ Вид исследования @@ -250,6 +272,7 @@ class Researches(models.Model): is_expertise = models.BooleanField(default=False, blank=True, help_text="Это экспертиза", db_index=True) is_aux = models.BooleanField(default=False, blank=True, help_text="Это вспомогательный", db_index=True) is_case = models.BooleanField(default=False, blank=True, help_text="Это случай", db_index=True) + is_complex = models.BooleanField(default=False, blank=True, help_text="Это комплексная услуга", db_index=True) site_type = models.ForeignKey(ResearchSite, default=None, null=True, blank=True, help_text='Место услуги', on_delete=models.SET_NULL, db_index=True) need_vich_code = models.BooleanField(default=False, blank=True, help_text="Необходимость указания кода вич в направлении") paraclinic_info = models.TextField(blank=True, default="", help_text="Если это параклиническое исследование - здесь указывается подготовка и кабинет") @@ -306,6 +329,9 @@ class Researches(models.Model): cda_template_file = models.CharField(max_length=50, db_index=True, blank=True, default="", null=True, help_text="название шаблона cda-шаблона") n3_id_med_document_type = models.SmallIntegerField(default=0, blank=True, help_text="N3 id_med_document_type") ecp_id = models.CharField(max_length=16, default='', blank=True, verbose_name='Код услуги в ЕЦП') + laboratory_material = models.ForeignKey(LaboratoryMaterial, blank=True, default=None, null=True, help_text='Биоматериал', on_delete=models.SET_NULL) + sub_grou = models.ForeignKey(SubGroup, blank=True, default=None, null=True, help_text='Подгруппа', on_delete=models.SET_NULL) + laboratory_duration = models.CharField(max_length=3, default='', blank=True, verbose_name='Срок выполнения') @staticmethod def save_plan_performer(tb_data): @@ -685,6 +711,19 @@ def __str__(self): return f"{self.main_research.title} - {self.aux_research.title} - {self.hide}" +class ComplexService(models.Model): + main_research = models.ForeignKey(Researches, help_text="Комплексная услуга", on_delete=models.CASCADE, db_index=True) + slave_research = models.ForeignKey(Researches, related_name='slave_service', help_text="Простая услуга", on_delete=models.CASCADE) + hide = models.BooleanField(default=False, blank=True, help_text='Скрытие услуги', db_index=True) + + class Meta: + verbose_name = 'Комплексная услуга' + verbose_name_plural = 'Комплексные услуги' + + def __str__(self): + return f"{self.main_research.title} - {self.slave_research.title} - {self.hide}" + + class ParaclinicInputGroups(models.Model): title = models.CharField(max_length=255, help_text='Название группы') show_title = models.BooleanField() From 9f116be376504be775e5c51cf4adc243641e7120 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko Date: Wed, 10 Jan 2024 15:40:34 +0800 Subject: [PATCH 2/3] fix --- api/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/api/views.py b/api/views.py index a38a97abbb..2d4a378dba 100644 --- a/api/views.py +++ b/api/views.py @@ -1219,7 +1219,6 @@ def get_template(request): def update_template(request): response = {"ok": False} request_data = json.loads(request.body) - print(request_data) pk = request_data.get("pk", -2) if pk > -2: title = request_data.get("title").strip() From 6455ea5043c7b9dca8bc254a6718327c67d45893 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko Date: Wed, 10 Jan 2024 15:46:32 +0800 Subject: [PATCH 3/3] fix --- directory/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory/models.py b/directory/models.py index 4fd1301fd8..1c7a12936e 100644 --- a/directory/models.py +++ b/directory/models.py @@ -330,7 +330,7 @@ class Researches(models.Model): n3_id_med_document_type = models.SmallIntegerField(default=0, blank=True, help_text="N3 id_med_document_type") ecp_id = models.CharField(max_length=16, default='', blank=True, verbose_name='Код услуги в ЕЦП') laboratory_material = models.ForeignKey(LaboratoryMaterial, blank=True, default=None, null=True, help_text='Биоматериал', on_delete=models.SET_NULL) - sub_grou = models.ForeignKey(SubGroup, blank=True, default=None, null=True, help_text='Подгруппа', on_delete=models.SET_NULL) + sub_group = models.ForeignKey(SubGroup, blank=True, default=None, null=True, help_text='Подгруппа', on_delete=models.SET_NULL) laboratory_duration = models.CharField(max_length=3, default='', blank=True, verbose_name='Срок выполнения') @staticmethod