From 980943f20bdfd623f19a04545bb347495a5eb1a3 Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko Date: Wed, 17 Jan 2024 08:17:03 +0800 Subject: [PATCH] fix --- forms/forms106.py | 8 ++++---- forms/forms_func.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/forms/forms106.py b/forms/forms106.py index 2752844f91..d0fcf018b3 100644 --- a/forms/forms106.py +++ b/forms/forms106.py @@ -881,19 +881,19 @@ def form_02(request_data): title_page.append(Paragraph(f"{bold_open}Диагноз окончательный при выписке из стационара:{bold_close}", style)) title_page.append(Paragraph("Основное заболевание:", style)) - for i in hosp_extract_data["final_diagnos_mkb"]: + for i in hosp_extract_data["final_diagnos_mkb_dict"]: title_page.append(Paragraph(f"{i.get('data')} {bold_open}код по МКБ:{bold_close} {i.get('code')} ", style)) title_page.append(Spacer(1, 2 * mm)) title_page.append(Paragraph("Осложнения основного заболевания:", style)) - for i in hosp_extract_data["other_diagnos_mkb"]: + for i in hosp_extract_data["other_diagnos_mkb_dict"]: title_page.append(Paragraph(f"{i.get('data')} {bold_open}код по МКБ:{bold_close} {i.get('code')} ", style)) title_page.append(Spacer(1, 2 * mm)) title_page.append(Paragraph("Внешняя причина при травмах, отравления:", style)) - for i in hosp_extract_data["external_reason_mkb"]: + for i in hosp_extract_data["external_reason_mkb_dict"]: title_page.append(Paragraph(f"{i.get('data')} {bold_open}код по МКБ:{bold_close} {i.get('code')} ", style)) title_page.append(Spacer(1, 2 * mm)) title_page.append(Paragraph("Сопутствующие заболевания", style)) - for i in hosp_extract_data["near_diagnos_mkb"]: + for i in hosp_extract_data["near_diagnos_mkb_dict"]: title_page.append(Paragraph(f"{i.get('data')} {bold_open}код по МКБ:{bold_close} {i.get('code')} ", style)) title_page.append(Spacer(1, 2 * mm)) diff --git a/forms/forms_func.py b/forms/forms_func.py index 99637049fb..485383d4cd 100644 --- a/forms/forms_func.py +++ b/forms/forms_func.py @@ -727,6 +727,7 @@ def hosp_extract_get_data(hosp_last_num): final_diagnos, other_diagnos, near_diagnos, outcome, final_diagnos_mkb, other_diagnos_mkb, near_diagnos_mkb, additional_data_ill = '', '', '', '', '', '', '', '' days_count, result_hospital, manager_depart, room_num, transfer_to = '', '', '', '', '' ln_data, ln_vk_data, external_reason_mkb = '', '', '' + final_diagnos_mkb_dict, other_diagnos_mkb_dict, near_diagnos_mkb_dict, external_reason_mkb_dict = [], [], [], [] if list_values: for i in list_values: @@ -767,7 +768,7 @@ def hosp_extract_get_data(hosp_last_num): final_diagnos_mkb_row = final_diagnos_mkb_details.get("rows", []) final_diagnos_mkb = [] for rr in final_diagnos_mkb_row: - final_diagnos_mkb.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({rr[1]})"}) + final_diagnos_mkb_dict.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({rr[1]})"}) if i[3] == "Осложнения основного заболевания код по МКБ": other_diagnos_mkb_data = i[2] other_diagnos_mkb_details = {} @@ -779,7 +780,7 @@ def hosp_extract_get_data(hosp_last_num): other_diagnos_mkb_row = other_diagnos_mkb_details.get("rows", []) other_diagnos_mkb = [] for rr in other_diagnos_mkb_row: - other_diagnos_mkb.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({rr[1]})"}) + other_diagnos_mkb_dict.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({rr[1]})"}) if i[3] == 'Сопутствующие заболевания код по МКБ': near_diagnos_mkb_data = i[2] near_diagnos_mkb_details = {} @@ -791,7 +792,7 @@ def hosp_extract_get_data(hosp_last_num): near_diagnos_mkb_row = near_diagnos_mkb_details.get("rows", []) near_diagnos_mkb = [] for rr in near_diagnos_mkb_row: - near_diagnos_mkb.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')}. {rr[1] if len(rr) > 1 else '' }"}) + near_diagnos_mkb_dict.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')}. {rr[1] if len(rr) > 1 else '' }"}) if i[3] == 'Внешняя причина при травмах, отравлениях код по МКБ': external_reason_mkb_data = i[2] external_reason_mkb_details = {} @@ -805,7 +806,7 @@ def hosp_extract_get_data(hosp_last_num): if len(external_reason_mkb_row) > 0: for rr in external_reason_mkb_row: adds_data = rr[1] if len(rr) > 1 else "" - external_reason_mkb.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({adds_data})"}) + external_reason_mkb_dict.append({"code": json.loads(rr[0]).get('code', ''), "data": f"{json.loads(rr[0]).get('title', '')} ({adds_data})"}) if i[3] == 'Дополнительные сведения о заболевании': additional_data_ill = i[2] if i[3] == 'Куда переведен': @@ -827,6 +828,10 @@ def hosp_extract_get_data(hosp_last_num): 'other_diagnos_mkb': other_diagnos_mkb, 'near_diagnos_mkb': near_diagnos_mkb, 'external_reason_mkb': external_reason_mkb, + 'final_diagnos_mkb_dict': final_diagnos_mkb_dict, + 'other_diagnos_mkb_dict': other_diagnos_mkb_dict, + 'near_diagnos_mkb_dict': near_diagnos_mkb_dict, + 'external_reason_mkb_dict': external_reason_mkb_dict, 'extract_iss': hosp_extract_iss, 'days_count': days_count, 'result_hospital': result_hospital,