Skip to content

Commit

Permalink
Merge pull request #4042 from mikhailprivalov/templateHospResearchFor…
Browse files Browse the repository at this point in the history
…User

hosp_research_template for user
  • Loading branch information
Wellheor1 authored Jul 2, 2024
2 parents b55db00 + ed6b742 commit 7482a82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions api/stationar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,17 @@ def hosp_services_by_type(request):
r_type = data["r_type"]
result = []
type_by_key = HospitalService.TYPES_BY_KEYS.get(r_type, -1)
hosp_research = None
if request.user.doctorprofile.hosp_research_template:
hosp_research = request.user.doctorprofile.hosp_research_template
elif request.user.doctorprofile.podrazdeleniye.hosp_research_default:
hosp_research = request.user.doctorprofile.podrazdeleniye.hosp_research_default
for i in Issledovaniya.objects.filter(napravleniye__pk=base_direction_pk, research__is_hospital=True):
hosp_research = i.research
if not hosp_research:
hosp_research = i.research
if int(data['hospResearch']) > -1:
hosp_research = int(data['hospResearch'])

if request.user.doctorprofile.podrazdeleniye.hosp_research_default_id:
hosp_research = request.user.doctorprofile.podrazdeleniye.hosp_research_default_id
for hs in HospitalService.objects.filter(site_type=type_by_key, main_research=hosp_research, hide=False):
result.append(
{
Expand Down
10 changes: 10 additions & 0 deletions users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Meta:


class Position(models.Model):
title = models.CharField(max_length=255, help_text='Название')
title = models.CharField(max_length=255, help_text='Название')
hide = models.BooleanField(help_text='Скрытие', default=False)
rmis_id = models.PositiveSmallIntegerField(default=None, db_index=True, blank=True, null=True)
Expand Down Expand Up @@ -110,6 +111,15 @@ class DoctorProfile(models.Model):
date_stop_certificate = models.DateField(help_text='Дата окончания сертификата', db_index=True, default=None, blank=True, null=True)
replace_doctor_cda = models.ForeignKey('self', related_name='used_doctor_cda', help_text="Замена доктора для cda", blank=True, null=True, default=None, on_delete=models.SET_NULL)
additional_info = models.TextField(default='', blank=True, help_text='Дополнительная информация описывать словарем {}')
hosp_research_template = models.ForeignKey(
'directory.Researches',
related_name='hosp_research_template',
blank=True,
default=None,
null=True,
verbose_name="Услуга стационара по котрой по умолчанию подгружаются шаблоны",
on_delete=models.CASCADE,
)

@staticmethod
def get_system_profile():
Expand Down

0 comments on commit 7482a82

Please sign in to comment.