Skip to content

Commit

Permalink
Merge pull request #4588 from mikhailprivalov/prepare_prin_result_tab…
Browse files Browse the repository at this point in the history
…le_part_result

fix print table
  • Loading branch information
Wellheor1 authored Dec 22, 2024
2 parents 2543697 + 7d407d7 commit dfed60f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions results/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,26 +1016,21 @@ def table_part_result(value, width_max_table=None):
for value_raw in t:
result = ""
result_mkb_code = ""
result_mkb_title = ""
clinic_diag_text = ""
is_diag_table = False
try:
row_data = json.loads(value_raw)

if isinstance(row_data, list):
result = '<br/>'.join(row_data)
elif isinstance(row_data, dict):
temp_data = []
if row_data.get("code", None):
if row_data.get("code", None) and row_data.get("title", None):
is_diag_table = True
result_mkb_code = f"{row_data.get('code')}"
if row_data.get("title", None):
result_mkb_title = f"{row_data.get('title')}"
result = f"{result_mkb_title}; {clinic_diag_text}"
is_diag_table = True
else:
result = f"{result_mkb_title}; {clinic_diag_text}"
if row_data.get('fio', None):
result = f"{row_data.get('family')} {row_data.get('name')} {row_data.get('patronymic')}"
if row_data.get('id', None):
if row_data.get('id', None) and not is_diag_table:
doctor = DoctorProfile.objects.get(pk=row_data.get('id'))
position = doctor.position.title if doctor.position else ""
result = f"{result} ({position})"
Expand Down

0 comments on commit dfed60f

Please sign in to comment.