Skip to content

Commit

Permalink
updates (#3230)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailprivalov authored Nov 19, 2023
1 parent 971e158 commit 63829e5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,7 @@ def directions_paraclinic_result(request):
return JsonResponse(response)
parent_child_data = rb.get('parent_child_data', None)
slave_reserch = HospitalService.objects.filter(slave_research=iss.research).first()
if parent_child_data:
if parent_child_data and slave_reserch:
parent = int(parent_child_data.get('parent_iss', -1))
child = int(parent_child_data.get('child_iss', -1))
current = int(parent_child_data.get('current_iss', -1))
Expand Down
9 changes: 6 additions & 3 deletions api/stationar/stationar_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def hosp_get_data_direction(main_direction, site_type=-1, type_service='None', l

hosp_site_type = site_type
hosp_level = level
hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_is_all, hosp_morfology = False, False, False, False, False, False
hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_is_all, hosp_morfology, hosp_form = False, False, False, False, False, False, False
if type_service == 'is_paraclinic':
hosp_is_paraclinic = True
elif type_service == 'is_doc_refferal':
Expand All @@ -40,11 +40,13 @@ def hosp_get_data_direction(main_direction, site_type=-1, type_service='None', l
hosp_is_lab = True
elif type_service == 'is_morfology':
hosp_morfology = True
elif type_service == 'is_form':
hosp_form = True
if site_type == -1 and type_service == 'None':
hosp_is_all = True

hosp_dirs = tree_directions.hospital_get_direction(
num_iss, main_research, hosp_site_type, hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_level, hosp_is_all, hosp_morfology
num_iss, main_research, hosp_site_type, hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_level, hosp_is_all, hosp_morfology, hosp_form
)

data = []
Expand All @@ -71,10 +73,11 @@ def hosp_get_data_direction(main_direction, site_type=-1, type_service='None', l
'podrazdeleniye_title': i[19],
'site_type': i[21],
'research_short_title': i[23],
'is_slave_hospital': i[24],
'is_slave_hospital': i[24] or hosp_form,
'is_cancel': i[25],
"is_citology": i[26],
"is_gistology": i[27],
"is_form": i[28],
}
)

Expand Down
3 changes: 2 additions & 1 deletion api/stationar/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def counts(request):
.distinct()
.count()
)
result["pharmacotherapy"] = ProcedureList.objects.filter(history=i.napravleniye, cancel=False, diary__issledovaniya__time_confirmation__isnull=False).count()
result["pharmacotherapy"] += ProcedureList.objects.filter(history=i.napravleniye, cancel=False, diary__issledovaniya__time_confirmation__isnull=False).count()
result["forms"] += Napravleniya.objects.filter(parent=i, issledovaniya__research__is_form=True).distinct().count()
result["all"] += Napravleniya.objects.filter(parent=i).count()
return JsonResponse(dict(result))

Expand Down
3 changes: 3 additions & 0 deletions directory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ class HospitalService(models.Model):
(7, 'Выписка'),
(8, 'Больничный лист'),
(9, 't, ad, p – лист'),
(11, 'Формы'),
)

TYPES_BY_KEYS = {
Expand All @@ -515,6 +516,7 @@ class HospitalService(models.Model):
7: 'extracts',
8: 'bl',
9: 't, ad, p sheet',
11: 'forms',
}

TYPES_REVERSED = {
Expand All @@ -523,6 +525,7 @@ class HospitalService(models.Model):
"consultation": "is_doc_refferal",
"diaries": "diaries",
"morfology": "is_morfology",
"forms": "is_form",
"all": "None",
}

Expand Down
3 changes: 3 additions & 0 deletions l2-frontend/src/pages/Stationar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,9 @@ export default {
if (this.openPlusId === 'consultation') {
return [4];
}
if (this.openPlusId === 'forms') {
return [11];
}
if (this.openPlusId === null) {
return [2, 3, 4];
}
Expand Down
3 changes: 3 additions & 0 deletions l2-frontend/src/pages/Stationar/mixins/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const menuItems = Object.freeze({
physiotherapy: 'Физиотерапия',
assignments: 'Назначения',
't, ad, p sheet': 't, ad, p – листы',
forms: 'Формы',
epicrisis: 'Эпикризы',
extracts: 'Выписки',
all: 'Показать всё',
Expand All @@ -35,12 +36,14 @@ export default {
't, ad, p sheet': true,
epicrisis: true,
extracts: true,
forms: true,
},
plusDirectionsMode: {
laboratory: true,
paraclinical: true,
morfology: true,
consultation: true,
forms: true,
},
allowedOnlyOneEntry: {
'primary receptions': true,
Expand Down
11 changes: 7 additions & 4 deletions utils/tree_directions.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def hosp_tree_direction(iss):
return row


def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_level, hosp_is_all, hosp_morfology):
def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclinic, hosp_is_doc_refferal, hosp_is_lab, hosp_is_hosp, hosp_level, hosp_is_all, hosp_morfology, hosp_form=False):
"""
парам: услуга
Вернуть стуркутру в след порядке:
Expand Down Expand Up @@ -242,7 +242,7 @@ def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclini
t_research AS (SELECT directory_researches.id as research_iddir, podrazdeleniye_id, is_paraclinic, is_doc_refferal,
is_stom, is_hospital, is_microbiology, is_slave_hospital, is_citology, is_gistology, t_podrazdeleniye.title as podr_title,
t_podrazdeleniye.p_type FROM directory_researches
t_podrazdeleniye.p_type, is_form FROM directory_researches
LEFT JOIN t_podrazdeleniye ON t_podrazdeleniye.id = directory_researches.podrazdeleniye_id),
t_hospital_service AS (SELECT site_type, slave_research_id FROM directory_hospitalservice
Expand All @@ -266,11 +266,13 @@ def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclini
is_hospital = true and site_type is NULL
when %(hosp_is_doc_refferal)s = TRUE THEN
is_doc_refferal = true and site_type is NULL
when %(hosp_form)s = TRUE THEN
is_form = true and site_type is NULL
when %(hosp_morfology)s = TRUE THEN
(is_microbiology = true or is_citology = true or is_gistology = true) and site_type is NULL
when %(hosp_is_lab)s = TRUE THEN
is_paraclinic = FALSE and is_doc_refferal = FALSE and is_stom = FALSE and is_hospital = FALSE and is_microbiology = FALSE
and is_citology = FALSE and is_gistology = FALSE and site_type is NULL AND is_slave_hospital = FALSE
and is_citology = FALSE and is_gistology = FALSE and site_type is NULL AND is_slave_hospital = FALSE AND is_form = FALSE
when %(hosp_site_type)s = -1 and %(hosp_is_all)s = TRUE THEN
EXISTS (SELECT id FROM r)
END
Expand All @@ -279,7 +281,7 @@ def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclini
SELECT DISTINCT "id", date_create, time_create, parent_id, napravleniye_id, iss, date_confirm, time_confirm, research_id, title,
diagnos, "level", research_iddir, podrazdeleniye_id, is_paraclinic, is_doc_refferal, is_stom, is_hospital,
is_microbiology, podr_title, p_type, site_type, slave_research_id, short_title, is_slave_hospital, cancel, is_citology, is_gistology FROM t_all WHERE
is_microbiology, podr_title, p_type, site_type, slave_research_id, short_title, is_slave_hospital, cancel, is_citology, is_gistology, is_form FROM t_all WHERE
CASE
WHEN %(hosp_level)s > -1 THEN
level = %(hosp_level)s
Expand All @@ -299,6 +301,7 @@ def hospital_get_direction(iss, main_research, hosp_site_type, hosp_is_paraclini
'hosp_level': hosp_level,
'hosp_is_all': hosp_is_all,
'hosp_morfology': hosp_morfology,
'hosp_form': hosp_form,
'tz': TIME_ZONE,
},
)
Expand Down

0 comments on commit 63829e5

Please sign in to comment.