Skip to content

Commit

Permalink
Merge pull request #4582 from mikhailprivalov/printForm_TableDiagnos
Browse files Browse the repository at this point in the history
Print form table diagnos
  • Loading branch information
Wellheor1 authored Dec 18, 2024
2 parents 8e0159f + f5b6a44 commit a4c6ec6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion results/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,15 +1010,28 @@ def table_part_result(value, width_max_table=None):
opinion = [[Paragraph(f"{t}", style) for t in table_titles]]

table_rows = value['rows']
space_symbol = " "
for t in table_rows:
temp_data = []
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):
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:
if row_data.get('fio', None):
result = f"{row_data.get('family')} {row_data.get('name')} {row_data.get('patronymic')}"
Expand All @@ -1028,7 +1041,10 @@ def table_part_result(value, width_max_table=None):
result = f"{result} ({position})"
except:
result = value_raw
temp_data.append(Paragraph(f"{result}", style))
if is_diag_table and result:
temp_data.append([Paragraph(f"<u>{result}</u>", style), Paragraph(f"код по МКБ {space_symbol * 3}<u>{result_mkb_code}</u>", style)])
else:
temp_data.append(Paragraph(f"{result}", style))
opinion.append(temp_data)

table_width = []
Expand Down

0 comments on commit a4c6ec6

Please sign in to comment.