Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hosp_research_template for user #4042

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading