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

Case amb #3087

Merged
merged 42 commits into from
Oct 10, 2023
Merged
Changes from 24 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b348c32
.
urchinpro Sep 22, 2023
7379597
случай
urchinpro Sep 22, 2023
4c03c71
конструктор случай
urchinpro Sep 22, 2023
eaefd3f
fix
urchinpro Sep 22, 2023
b167f46
fix
urchinpro Sep 22, 2023
99e6b06
fix
urchinpro Sep 22, 2023
2046432
fix
urchinpro Sep 22, 2023
1667c99
fix
urchinpro Sep 22, 2023
e18ba81
fix
urchinpro Sep 23, 2023
7768dc5
Update directory/models.py
urchinpro Sep 23, 2023
b3b10d9
Update api/views.py
urchinpro Sep 23, 2023
7f393f4
fix
urchinpro Sep 23, 2023
0326357
Merge remote-tracking branch 'origin/caseAmb' into caseAmb
urchinpro Sep 23, 2023
1b0b7b2
Случаи в истории
urchinpro Sep 26, 2023
390a27d
.
urchinpro Sep 26, 2023
5a2412f
.
urchinpro Sep 26, 2023
f7f9ddc
Исключено требование создавать случай внутри истории болезни
urchinpro Sep 27, 2023
5486c79
fix
urchinpro Sep 27, 2023
e65f035
Update api/directions/views.py
urchinpro Sep 27, 2023
4d67e31
Update api/directions/views.py
urchinpro Sep 27, 2023
94c9bbb
fix
urchinpro Sep 27, 2023
5188f4e
Merge remote-tracking branch 'origin/caseAmb' into caseAmb
urchinpro Sep 27, 2023
07e1bd5
fix date in xlsx
urchinpro Sep 27, 2023
b132d1d
add fielt to Napravleniya "paren_case"
urchinpro Sep 28, 2023
5efedc2
fix
urchinpro Sep 28, 2023
62387f1
fix cda gen lab
urchinpro Sep 29, 2023
581414c
автосоздание случая
urchinpro Sep 30, 2023
d087a08
fix
urchinpro Sep 30, 2023
cd2b61b
fix
urchinpro Sep 30, 2023
2e86003
fix
urchinpro Sep 30, 2023
ae39ed9
вывод услуг случая в "Истории" случая
urchinpro Oct 1, 2023
ddafb37
fix
urchinpro Oct 1, 2023
6c60cd7
fix
urchinpro Oct 1, 2023
4745778
fix
urchinpro Oct 1, 2023
5014c6a
Роль для редактирвоания случая
urchinpro Oct 1, 2023
aa3cd89
получить случай не скрытый
urchinpro Oct 1, 2023
84c7594
initial case ui
Oct 6, 2023
7b5b773
Merge branch 'caseAmb' into case-ui
Oct 6, 2023
288c71a
History case link
mikhailprivalov Oct 7, 2023
80d83e4
case directions ui
mikhailprivalov Oct 8, 2023
44c2d2b
aggregate base
mikhailprivalov Oct 8, 2023
de5e490
Merge pull request #3110 from moodpulse/case-ui
mikhailprivalov Oct 8, 2023
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
27 changes: 26 additions & 1 deletion api/directions/sql_func.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk
directory_researches.is_paraclinic,
directory_researches.is_form,
directory_researches.is_microbiology,
directory_researches.is_case,
directory_researches.podrazdeleniye_id,
directions_napravleniya.parent_id as dir_parent_id,
directions_napravleniya.data_sozdaniya as dir_data_sozdaniya,
@@ -106,7 +107,8 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk
ud.patronymic,
directions_napravleniya.visit_date,
directions_napravleniya.time_microbiology_receive,
directions_napravleniya.time_gistology_receive
directions_napravleniya.time_gistology_receive,
is_case
FROM t_iss_tubes
LEFT JOIN t_recive
ON t_iss_tubes.tubesregistration_id = t_recive.id_t_recive
@@ -505,3 +507,26 @@ def get_directions_meta_info(directions):
)
rows = namedtuplefetchall(cursor)
return rows


def get_patient_open_case_data(card_pk):
with connection.cursor() as cursor:
cursor.execute(
"""
SELECT
directions_issledovaniya.id as iss_id,
directions_issledovaniya.napravleniye_id,
directions_issledovaniya.research_id,
dr.title,
dr.is_case,
to_char(dn.data_sozdaniya AT TIME ZONE %(tz)s, 'DD.MM.YYYY') as date_create
FROM directions_issledovaniya
LEFT JOIN directory_researches dr on directions_issledovaniya.research_id = dr.id
LEFT JOIN directions_napravleniya dn on directions_issledovaniya.napravleniye_id = dn.id
WHERE dn.client_id = %(card_pk)s and dr.is_case = true and directions_issledovaniya.time_confirmation is Null
ORDER BY directions_issledovaniya.napravleniye_id
""",
params={'card_pk': card_pk, 'tz': TIME_ZONE},
)
rows = namedtuplefetchall(cursor)
return rows
1 change: 1 addition & 0 deletions api/directions/urls.py
Original file line number Diff line number Diff line change
@@ -64,4 +64,5 @@
path('meta-info', views.meta_info),
path('resend-results', views.resend_results),
path('need-order-redirection', views.need_order_redirection),
path('patient-open-case', views.patient_open_case),
]
31 changes: 28 additions & 3 deletions api/directions/views.py
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@
from utils.common import non_selected_visible_type, none_if_minus_1, values_from_structure_data
from utils.dates import normalize_date, date_iter_range, try_strptime
from utils.dates import try_parse_range
from utils.tree_directions import tree_direction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flake8] <401> reported by reviewdog 🐶
'utils.tree_directions.tree_direction' imported but unused

from utils.xh import check_float_is_valid, short_fio_dots
from .sql_func import (
get_history_dir,
@@ -93,6 +94,7 @@
get_directions_by_user,
get_confirm_direction_by_hospital,
get_directions_meta_info,
get_patient_open_case_data,
)
from api.stationar.stationar_func import hosp_get_hosp_direction, hosp_get_text_iss
from forms.forms_func import hosp_get_operation_data
@@ -108,6 +110,7 @@ def directions_generate(request):
result = {"ok": False, "directions": [], "directionsStationar": [], "message": ""}
if request.method == "POST":
p = json.loads(request.body)
print(p)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flake8] <201> reported by reviewdog 🐶
print found.

card_pk = p.get("card_pk")
card = None
if card_pk == -1:
@@ -310,7 +313,7 @@ def directions_history(request):
# status: 4 - выписано пользователем, 0 - только выписанные, 1 - Материал получен лабораторией. 2 - результат подтвержден, 3 - направления пациента, -1 - отменено,
if req_status == 4:
user_creater = request.user.doctorprofile.pk
if req_status in [0, 1, 2, 3, 5]:
if req_status in [0, 1, 2, 3, 5, 7]:
patient_card = pk

if req_status == 5:
@@ -459,6 +462,10 @@ def directions_history(request):
continue
elif type_service == 'is_lab' and (i[11] or i[14] or i[15] or i[16] or i[17] or i[18] or i[19]):
continue
elif req_status == 7 and not i[36]:
continue
elif i[36] and req_status != 7:
continue
if i[0] != last_dir:
status = min(status_set)
if len(lab) > 0:
@@ -470,7 +477,7 @@ def directions_history(request):
if aux_researches_obj.exists():
aux_researches = [{"pk": i.aux_research.pk, "title": i.aux_research.title} for i in aux_researches_obj]
has_aux = True
if (req_status == 2 and status == 2) or (req_status in [3, 4] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
if (req_status == 2 and status == 2) or (req_status in [3, 4, 7] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
final_result.append(
{
'pk': dir,
@@ -581,7 +588,7 @@ def directions_history(request):
if aux_researches_obj.exists():
aux_researches = [{"pk": i.aux_research.pk, "title": i.aux_research.title} for i in aux_researches_obj]
has_aux = True
if (req_status == 2 and status == 2) or (req_status in [3, 4] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
if (req_status == 2 and status == 2) or (req_status in [3, 4, 7] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
final_result.append(
{
'pk': dir,
@@ -1442,6 +1449,7 @@ def directions_paraclinic_form(request):
| Q(research__is_monitoring=True)
| Q(research__is_expertise=True)
| Q(research__is_aux=True)
| Q(research__is_case=True)
)
)
.select_related('research', 'research__microbiology_tube', 'research__podrazdeleniye')
@@ -4424,3 +4432,20 @@ def meta_info(request):
index_num = res_direction.index(i['direction'])
sort_result[index_num] = i
return JsonResponse({"rows": sort_result})


@login_required
def patient_open_case(request):
request_data = json.loads(request.body)
card_pk = request_data.get("card_pk", None)
data_case = {}
if card_pk:
open_case = get_patient_open_case_data(card_pk)
for o_case in open_case:
data_case[o_case.iss_id] = ""
child_direction = tree_direction(o_case.iss_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flake8] <841> reported by reviewdog 🐶
local variable 'child_direction' is assigned to but never used

for child in child_direction:
print(child)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flake8] <201> reported by reviewdog 🐶
print found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[flake8] <201> reported by reviewdog 🐶
print found.


data = {"data": ""}
return JsonResponse(data)
2 changes: 1 addition & 1 deletion api/parse_file/views.py
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ def gen_commercial_offer(request):
born_data = cells[born].split(" ")[0]
age = -1
if born_data != "None":
age = age_for_year(born_data)
age = age_for_year(normalize_dots_date(born_data))
if "м" in cells[sex]:
adds_harmfull = CONTROL_AGE_MEDEXAM.get("м")
else:
8 changes: 6 additions & 2 deletions api/researches/views.py
Original file line number Diff line number Diff line change
@@ -177,6 +177,7 @@ def get_researches(request, last_used=False):
"treatment": r.is_treatment,
"is_hospital": r.is_hospital,
"is_form": r.is_form,
"is_case": r.is_case,
"is_application": r.is_application,
"stom": r.is_stom,
"need_vich_code": r.need_vich_code,
@@ -257,7 +258,6 @@ def get_researches(request, last_used=False):
result = {"researches": deps, "cnts": cnts}
else:
result = json.loads(result)

if hasattr(request, 'plain_response') and request.plain_response:
return result
return JsonResponse(result)
@@ -361,6 +361,8 @@ def researches_by_department(request):
q = DResearches.objects.filter(is_monitoring=True).order_by("title")
elif department_pk == -13:
q = DResearches.objects.filter(is_expertise=True).order_by("title")
elif department_pk == -14:
q = DResearches.objects.filter(is_case=True).order_by("title")
else:
q = DResearches.objects.filter(podrazdeleniye__pk=department_pk).order_by("title")

@@ -455,7 +457,7 @@ def researches_update(request):
if tube == -1:
tube = None
stationar_slave = is_simple and -500 >= department_pk > -600 and main_service_pk != 1
desc = stationar_slave or department_pk in [-2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13]
desc = stationar_slave or department_pk in [-2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -16]
if len(title) > 0 and (desc or Podrazdeleniya.objects.filter(pk=department_pk).exists()):
department = None if desc else Podrazdeleniya.objects.filter(pk=department_pk)[0]
res = None
@@ -484,6 +486,7 @@ def researches_update(request):
is_application=department_pk == -11,
is_monitoring=department_pk == -12,
is_expertise=department_pk == -13,
is_case=department_pk == -14,
is_slave_hospital=stationar_slave,
microbiology_tube_id=tube if department_pk == -6 else None,
site_type_id=site_type,
@@ -527,6 +530,7 @@ def researches_update(request):
res.is_application = department_pk == -11
res.is_monitoring = department_pk == -12
res.is_expertise = department_pk == -13
res.is_case = department_pk == -14
res.microbiology_tube_id = tube if department_pk == -6 else None
res.paraclinic_info = info
res.hide = hide
7 changes: 4 additions & 3 deletions api/views.py
Original file line number Diff line number Diff line change
@@ -513,7 +513,7 @@ def departments(request):
data = {
"departments": deps,
"can_edit": can_edit,
"types": [*[{"pk": str(x[0]), "title": x[1]} for x in Podrazdeleniya.TYPES if x[0] not in [8, 12] and en.get(x[0], True)], *more_types],
"types": [*[{"pk": str(x[0]), "title": x[1]} for x in Podrazdeleniya.TYPES if x[0] not in [8, 12, 16] and en.get(x[0], True)], *more_types],
}
if hasattr(request, 'plain_response') and request.plain_response:
return data
@@ -748,6 +748,7 @@ def fill_settings():
ret["extended_departments"][Podrazdeleniya.MORFOLOGY].append(
{"pk": Podrazdeleniya.MORFOLOGY + 3, "title": "Гистология", "type": Podrazdeleniya.MORFOLOGY, "extended": True, "e": Podrazdeleniya.MORFOLOGY}
)

try:
connections.close_all()
except Exception as e:
@@ -784,7 +785,7 @@ def directive_from(request):
data = []
hospital = request.user.doctorprofile.hospital
for dep in (
Podrazdeleniya.objects.filter(p_type__in=(Podrazdeleniya.DEPARTMENT, Podrazdeleniya.HOSP, Podrazdeleniya.PARACLINIC), hospital__in=(hospital, None))
Podrazdeleniya.objects.filter(p_type__in=(Podrazdeleniya.DEPARTMENT, Podrazdeleniya.HOSP, Podrazdeleniya.PARACLINIC, Podrazdeleniya.CASE), hospital__in=(hospital, None))
.prefetch_related(
Prefetch(
'doctorprofile_set',
@@ -2657,7 +2658,7 @@ def update_price(request):
current_price.title = request_data["title"]
current_price.date_start = request_data["start"]
current_price.date_end = request_data["end"]
if request_data.get("typePrice") == "Профосмотр":
if request_data.get("typePrice") == "Заказчик" or request_data.get("typePrice") == "Работодатель":
current_price.company_id = request_data["company"]
else:
hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first()
3 changes: 3 additions & 0 deletions appconf/manager.py
Original file line number Diff line number Diff line change
@@ -168,6 +168,8 @@ def l2_modules() -> dict:
"price_customer",
"price_externel_performer",
"ftp",
"case",
"hide_show_count_param",
]
},
"consults_module": SettingManager.get("consults_module", default='false', default_type='b'),
@@ -214,6 +216,7 @@ def en():
12: SettingManager.get("directions_params", default='false', default_type='b'),
13: SettingManager.l2("applications"),
14: SettingManager.l2("monitorings"),
16: SettingManager.l2("case"),
}

cache.set(k, simplejson.dumps(result), 60 * 60 * 8)
3 changes: 3 additions & 0 deletions directions/models.py
Original file line number Diff line number Diff line change
@@ -500,6 +500,9 @@ class Napravleniya(models.Model):
parent_slave_hosp = models.ForeignKey(
'Issledovaniya', related_name='parent_slave_hosp', help_text="Из стационарного протокола", db_index=True, blank=True, null=True, default=None, on_delete=models.SET_NULL
)
parent_case = models.ForeignKey(
'Issledovaniya', related_name='parent_case', help_text="Случай основание", db_index=True, blank=True, null=True, default=None, on_delete=models.SET_NULL
)
Comment on lines +503 to +505
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[black-format] reported by reviewdog 🐶

Suggested change
parent_case = models.ForeignKey(
'Issledovaniya', related_name='parent_case', help_text="Случай основание", db_index=True, blank=True, null=True, default=None, on_delete=models.SET_NULL
)
parent_case = models.ForeignKey('Issledovaniya', related_name='parent_case', help_text="Случай основание", db_index=True, blank=True, null=True, default=None, on_delete=models.SET_NULL)

rmis_slot_id = models.CharField(max_length=20, blank=True, null=True, default=None, help_text="РМИС слот")
microbiology_n = models.CharField(max_length=10, blank=True, default='', help_text="Номер в микробиологической лаборатории")
time_microbiology_receive = models.DateTimeField(null=True, blank=True, db_index=True, help_text='Дата/время приёма материала микробиологии')
1 change: 1 addition & 0 deletions directions/views.py
Original file line number Diff line number Diff line change
@@ -566,6 +566,7 @@ def print_direction(c: Canvas, n, dir: Napravleniya, format_a6: bool = False):
-9: 'Формы',
-11: 'Заявления',
-12: 'Мониторинги',
-14: 'Случай',
}[rtp]
# if rtp == -6:
# has_micro = True
6 changes: 6 additions & 0 deletions directory/models.py
Original file line number Diff line number Diff line change
@@ -82,6 +82,7 @@ class ResearchSite(models.Model):
(4, 'Микробиология'),
(7, 'Формы'),
(10, 'Мониторинги'),
(12, 'Случаи'),
)

site_type = models.SmallIntegerField(choices=TYPES, help_text="Тип раздела", db_index=True)
@@ -243,6 +244,7 @@ class Researches(models.Model):
is_monitoring = models.BooleanField(default=False, blank=True, help_text="Это мониторинг", db_index=True)
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)
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="Если это параклиническое исследование - здесь указывается подготовка и кабинет")
@@ -330,6 +332,7 @@ def filter_type(t):
14: dict(is_application=True),
15: dict(is_monitoring=True),
16: dict(is_expertise=True),
17: dict(is_case=True),
}
return ts.get(t + 1, {})

@@ -357,6 +360,8 @@ def reversed_type(self):
return -13
if self.is_microbiology or self.is_citology or self.is_gistology:
return 2 - Podrazdeleniya.MORFOLOGY
if self.is_case:
return -14
return self.podrazdeleniye_id or -2

@property
@@ -368,6 +373,7 @@ def desc(self):
or self.is_paraclinic
or self.is_microbiology
or self.is_hospital
or self.is_case
or self.is_citology
or self.is_gistology
or self.is_form
4 changes: 4 additions & 0 deletions l2-frontend/src/construct/ConstructParaclinic.vue
Original file line number Diff line number Diff line change
@@ -277,6 +277,10 @@ export default {
d.push({ value: -8, label: '– Гистология' });
}
}

if (this.modules.l2_case) {
d.push({ value: -14, label: 'Случаи' });
}
}

this.departments_of_type = d;
1 change: 1 addition & 0 deletions l2-frontend/src/construct/ParaclinicResearchEditor.vue
Original file line number Diff line number Diff line change
@@ -1286,6 +1286,7 @@ export default {
'-11': 13,
'-12': 14,
'-13': 15,
'-14': 16,
}[this.department] || this.department
);
},
2 changes: 2 additions & 0 deletions l2-frontend/src/registerHooks.ts
Original file line number Diff line number Diff line change
@@ -149,6 +149,7 @@ export default (instance: Vue): void => {
hospital_override: hospitalOverride = -1,
monitoring = false,
priceCategory = null,
caseId,
}) => {
if (cardPk === -1 && !monitoring) {
instance.$root.$emit('msg', 'error', 'Не выбрана карта');
@@ -194,6 +195,7 @@ export default (instance: Vue): void => {
hospital_department_override: hospitalDepartmentOverride,
hospital_override: hospitalOverride,
priceCategory,
caseId,
})
.then(data => {
instance.$store.dispatch(actions.DEC_LOADING);
1 change: 1 addition & 0 deletions l2-frontend/src/ui-cards/DirectionsHistory/index.vue
Original file line number Diff line number Diff line change
@@ -449,6 +449,7 @@ export default {
{ pk: 4, title: 'Созданы пользователем' },
{ pk: 5, title: 'Договоры пациента' },
{ pk: 6, title: 'Регистратура пациента', module: 'rmisQueue' },
{ pk: 7, title: 'Случаи пациента' },
],
active_type: this.onlyType || 3,
checked_obj: {},
Loading

Unchanged files with check annotations Beta

return result;
};
export const convertSubjectNameToTitle = (object: any, subjectName: string | null, name: string) => {

Check warning on line 364 in l2-frontend/src/utils.ts

GitHub Actions / webpack_build_prod

'name' is defined but never used
const obj = object || convertSubjectNameToCertObject(subjectName);
// eslint-disable-next-line no-console