From 63829e556f1ad2efa8a768d36a21ecd63e13a387 Mon Sep 17 00:00:00 2001 From: Mikhail Privalov Date: Sun, 19 Nov 2023 07:12:41 +0300 Subject: [PATCH] updates (#3230) --- api/directions/views.py | 2 +- api/stationar/stationar_func.py | 9 ++++++--- api/stationar/views.py | 3 ++- directory/models.py | 3 +++ l2-frontend/src/pages/Stationar/index.vue | 3 +++ l2-frontend/src/pages/Stationar/mixins/menu.js | 3 +++ utils/tree_directions.py | 11 +++++++---- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/api/directions/views.py b/api/directions/views.py index 97ba05523b..6e1515bf19 100644 --- a/api/directions/views.py +++ b/api/directions/views.py @@ -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)) diff --git a/api/stationar/stationar_func.py b/api/stationar/stationar_func.py index 6354bdd6d9..99826a4f94 100644 --- a/api/stationar/stationar_func.py +++ b/api/stationar/stationar_func.py @@ -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': @@ -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 = [] @@ -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], } ) diff --git a/api/stationar/views.py b/api/stationar/views.py index d1660798a1..f0d4675a66 100644 --- a/api/stationar/views.py +++ b/api/stationar/views.py @@ -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)) diff --git a/directory/models.py b/directory/models.py index f810d447d1..67e5c5b3a2 100644 --- a/directory/models.py +++ b/directory/models.py @@ -489,6 +489,7 @@ class HospitalService(models.Model): (7, 'Выписка'), (8, 'Больничный лист'), (9, 't, ad, p – лист'), + (11, 'Формы'), ) TYPES_BY_KEYS = { @@ -515,6 +516,7 @@ class HospitalService(models.Model): 7: 'extracts', 8: 'bl', 9: 't, ad, p sheet', + 11: 'forms', } TYPES_REVERSED = { @@ -523,6 +525,7 @@ class HospitalService(models.Model): "consultation": "is_doc_refferal", "diaries": "diaries", "morfology": "is_morfology", + "forms": "is_form", "all": "None", } diff --git a/l2-frontend/src/pages/Stationar/index.vue b/l2-frontend/src/pages/Stationar/index.vue index 819db59ee4..805e9777e3 100644 --- a/l2-frontend/src/pages/Stationar/index.vue +++ b/l2-frontend/src/pages/Stationar/index.vue @@ -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]; } diff --git a/l2-frontend/src/pages/Stationar/mixins/menu.js b/l2-frontend/src/pages/Stationar/mixins/menu.js index 7178c174ab..88c3b5bc02 100644 --- a/l2-frontend/src/pages/Stationar/mixins/menu.js +++ b/l2-frontend/src/pages/Stationar/mixins/menu.js @@ -11,6 +11,7 @@ export const menuItems = Object.freeze({ physiotherapy: 'Физиотерапия', assignments: 'Назначения', 't, ad, p sheet': 't, ad, p – листы', + forms: 'Формы', epicrisis: 'Эпикризы', extracts: 'Выписки', 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, diff --git a/utils/tree_directions.py b/utils/tree_directions.py index 1ef984d985..a6ee4c4419 100644 --- a/utils/tree_directions.py +++ b/utils/tree_directions.py @@ -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): """ парам: услуга Вернуть стуркутру в след порядке: @@ -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 @@ -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 @@ -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 @@ -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, }, )