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

Print form table diagnos #4582

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
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
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
Loading