From 433f5f78ee40fd2c3282a522e1a613377bb4a26e Mon Sep 17 00:00:00 2001 From: Sergei Kasianenko Date: Wed, 11 Oct 2023 14:18:36 +0800 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B1=D0=BB=D0=B0=D0=BD=D0=BA=D0=B0=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- directory/models.py | 1 - laboratory/settings.py | 1 + results/laboratory_form.py | 526 ++++++++++++++++++++++++++++++++++++- results/views.py | 9 +- 4 files changed, 533 insertions(+), 4 deletions(-) diff --git a/directory/models.py b/directory/models.py index 20d4ec0f0b..5c393ea104 100644 --- a/directory/models.py +++ b/directory/models.py @@ -174,7 +174,6 @@ class Researches(models.Model): (10901, '109.01 - 131/у'), (11001, '110.01 - Антирабическая карта'), (11002, '110.02 - Заключение ВК по психиатрическому освидетельствованию'), - (11003, '110.03 - Форма с клеше для лаборатории'), ) RESULT_TITLE_FORMS = ( diff --git a/laboratory/settings.py b/laboratory/settings.py index 1909b43b04..8a04f4347e 100644 --- a/laboratory/settings.py +++ b/laboratory/settings.py @@ -392,6 +392,7 @@ def __getitem__(self, item): NEED_RECIEVE_TUBE_TO_PUSH_ORDER = False TITLE_RESULT_FORM_USE_HOSPITAL_STAMP = False QR_CODE_ANKETA = "" +RESULT_LABORATORY_FORM = "" try: from laboratory.local_settings import * # noqa: F403,F401 diff --git a/results/laboratory_form.py b/results/laboratory_form.py index e50685ec6f..bef11850e9 100644 --- a/results/laboratory_form.py +++ b/results/laboratory_form.py @@ -3,7 +3,7 @@ from utils.flowable import InteractiveTextField, QrCodeSite from reportlab.platypus import PageBreak, Spacer, KeepTogether, Flowable, Frame, PageTemplate, NextPageTemplate, BaseDocTemplate from reportlab.lib.units import mm -from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph +from reportlab.platypus import Table, TableStyle, Paragraph from reportlab.lib import colors from reportlab.lib.colors import HexColor import simplejson as json @@ -477,3 +477,527 @@ def default_lab_form(fwb, interactive_text_field, pw, direction, styleSheet, dir t.setStyle(style_t) fwb.append(t) return fwb + + +def lab_form_1(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal): + fwb.append(Spacer(1, 4 * mm)) + if interactive_text_field: + fwb.append(InteractiveTextField()) + tw = pw + no_units_and_ref = any([x.research.no_units_and_ref for x in direction.issledovaniya_set.all()]) + data = [] + tmp = [ + Paragraph('Исследование', styleSheet["BodyText"]), + Paragraph('Результат', styleSheet["BodyText"]), + ] + if not no_units_and_ref: + if direction.client.individual.sex.lower() == "м": + tmp.append(Paragraph('Референсные значения (М)', styleSheet["BodyText"])) + else: + tmp.append(Paragraph('Референсные значения (Ж)', styleSheet["BodyText"])) + tmp.append(Paragraph('Единицы
измерения
', styleSheet["BodyText"])) + + # tmp.append(Paragraph('Исполнитель', styleSheet["BodyText"])) + # tmp.append(Paragraph('Дата', styleSheet["BodyText"])) + data.append(tmp) + if no_units_and_ref: + cw = [int(tw * 0.26), int(tw * 0.482), int(tw * 0.178)] + else: + cw = [int(tw * 0.26), int(tw * 0.178), int(tw * 0.17), int(tw * 0.134), int(tw * 0.178)] + cw = cw + [tw - sum(cw)] + t = Table(data, repeatRows=1, colWidths=cw) + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 2), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -2), + ] + ) + style_t.add('BOTTOMPADDING', (0, 0), (-1, 0), 1) + style_t.add('TOPPADDING', (0, 0), (-1, 0), 0) + + t.setStyle(style_t) + t.spaceBefore = 3 * mm + t.spaceAfter = 0 + + prev_conf = "" + prev_date_conf = "" + + has0 = directory.Fractions.objects.filter(research__pk__in=[x.research_id for x in direction.issledovaniya_set.all()], hide=False, render_type=0).exists() + + if has0: + fwb.append(t) + + iss_list = direction.issledovaniya_set.all() + result_style = styleSheet["BodyText"] if no_units_and_ref else stl + pks = [] + for iss in iss_list.order_by("research__direction_id", "research__pk", "tubes__number", "research__sort_weight"): + if iss.pk in pks: + continue + pks.append(iss.pk) + data = [] + fractions = directory.Fractions.objects.filter(research=iss.research, hide=False, render_type=0).order_by("pk").order_by("sort_weight") + + if fractions.count() > 0: + if fractions.count() == 1: + tmp = [Paragraph('' + iss.research.title + "", styleSheet["BodyText"])] + norm = "none" + sign = RANGE_IN + if Result.objects.filter(issledovaniye=iss, fraction=fractions[0]).exists(): + r = Result.objects.filter(issledovaniye=iss, fraction=fractions[0]).order_by("-pk")[0] + ref = r.get_ref() + if show_norm: + norm, sign, ref_res = r.get_is_norm(recalc=True, with_ref=True) + ref = ref_res or ref + result = result_normal(r.value) + f_units = r.get_units() + else: + continue + if not iss.time_confirmation and iss.deferred: + result = "отложен" + f = fractions[0] + st = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 3), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -1), + ] + ) + + if f.render_type == 0: + if norm in ["none", "normal"]: + tmp.append(Paragraph('' + result + "", result_style)) + elif norm == "maybe": + tmp.append(Paragraph('' + result + "", result_style)) + else: + tmp.append(Paragraph('' + result + RANGE_NOT_IN.get(sign, "") + "", result_style)) + if not no_units_and_ref: + tmp.append(Paragraph('' + get_r(ref) + "", stl)) + tmp.append(Paragraph('' + f_units + "", stl)) + + if iss.doc_confirmation_fio: + if prev_conf != iss.doc_confirmation_fio: + prev_conf = iss.doc_confirmation_fio + prev_date_conf = "" + tmp.append(Paragraph('%s' % prev_conf, styleSheet["BodyText"])) + else: + tmp.append("") + if prev_date_conf != strdate(iss.time_confirmation, short_year=True) + '
' + strtime(iss.time_confirmation)[0:5]: + prev_date_conf = strdate(iss.time_confirmation, short_year=True) + '
' + strtime(iss.time_confirmation)[0:5] + tmp.append(Paragraph('%s' % prev_date_conf, styleSheet["BodyText"])) + else: + tmp.append("") + else: + tmp.append("") + tmp.append("") + + data.append(tmp) + elif f.render_type == 1: + tmp.append("") + tmp.append("") + tmp.append("") + + if iss.doc_confirmation_fio: + tmp.append(Paragraph('%s' % iss.doc_confirmation_fio, styleSheet["BodyText"])) + tmp.append( + Paragraph( + '%s' + % ("" if not iss.tubes.exists() or not iss.tubes.first().time_get else strdate(iss.tubes.first().time_get)), + styleSheet["BodyText"], + ) + ) + tmp.append(Paragraph('%s' % strdate(iss.time_confirmation), styleSheet["BodyText"])) + else: + tmp.append("") + tmp.append(Paragraph('%s' % strdate(iss.tubes.first().time_get), styleSheet["BodyText"])) + tmp.append("") + data.append(tmp) + + j = print_vtype(data, f, iss, 1, st, styleSheet) + data.append([Paragraph('S - чувствителен; R - резистентен; I - промежуточная чувствительность;', styleSheet["BodyText"])]) + st.add('SPAN', (0, j), (-1, j)) + st.add('BOX', (0, j), (-1, j), 1, colors.white) + st.add('BOX', (0, j - 1), (-1, j - 1), 1, colors.black) + + t = Table(data, colWidths=cw) + t.setStyle(st) + t.spaceBefore = 0 + else: + tmp = [ + Paragraph( + '' + + iss.research.title + + '' + + ("" if iss.comment == "" or True else '
Материал - ' + iss.comment + '
'), + styleSheet["BodyText"], + ), + '', + ] + if not no_units_and_ref: + tmp.append("") + tmp.append("") + + if iss.doc_confirmation_fio: + if prev_conf != iss.doc_confirmation_fio: + prev_conf = iss.doc_confirmation_fio + prev_date_conf = "" + tmp.append(Paragraph('%s' % prev_conf, styleSheet["BodyText"])) + else: + tmp.append("") + if prev_date_conf != strdate(iss.time_confirmation, short_year=True) + '
' + strtime(iss.time_confirmation)[0:5]: + prev_date_conf = strdate(iss.time_confirmation, short_year=True) + '
' + strtime(iss.time_confirmation)[0:5] + tmp.append(Paragraph('%s' % prev_date_conf, styleSheet["BodyText"])) + else: + tmp.append("") + else: + tmp.append("") + tmp.append("") + + data.append(tmp) + ts = [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.1, colors.white), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 3), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -1), + ] + + style_t = TableStyle(ts) + j = 0 + + for f in fractions: + j += 1 + + tmp = [] + if f.render_type == 0: + tmp.append(Paragraph('' + f.title + "", styleSheet["BodyText"])) + + norm = "none" + sign = RANGE_IN + if Result.objects.filter(issledovaniye=iss, fraction=f).exists() and not f.print_title: + r = Result.objects.filter(issledovaniye=iss, fraction=f).order_by("-pk")[0] + ref = r.get_ref() + if show_norm: + norm, sign, ref_res = r.get_is_norm(recalc=True, with_ref=True) + ref = ref_res or ref + result = result_normal(r.value) + f_units = r.get_units() + elif f.print_title: + tmp[0] = Paragraph('{}'.format(f.title), styleSheet["BodyText"]) + data.append(tmp) + continue + else: + continue + if not iss.doc_confirmation and iss.deferred: + result = "отложен" + if norm in ["none", "normal"]: + tmp.append(Paragraph('' + result + "", result_style)) + elif norm == "maybe": + tmp.append(Paragraph('' + result + "", result_style)) + else: + tmp.append(Paragraph('' + result + RANGE_NOT_IN.get(sign, "") + "", result_style)) + if not no_units_and_ref: + tmp.append(Paragraph('' + get_r(ref) + "", stl)) + tmp.append(Paragraph('' + f_units + "", stl)) + tmp.append("") + tmp.append("") + data.append(tmp) + elif f.render_type == 1: + jp = j + j = print_vtype(data, f, iss, j, style_t, styleSheet) + + if j - jp > 2: + data.append( + [Paragraph('S - чувствителен; R - резистентен; I - промежуточная чувствительность;', styleSheet["BodyText"])] + ) + style_t.add('SPAN', (0, j), (-1, j)) + style_t.add('BOX', (0, j), (-1, j), 1, colors.white) + j -= 1 + + for k in range(0, 6): + style_t.add('INNERGRID', (k, 0), (k, j), 0.1, colors.black) + style_t.add('BOX', (k, 0), (k, j), 0.8, colors.black) + style_t.add('BOTTOMPADDING', (0, 0), (0, -1), 0) + style_t.add('TOPPADDING', (0, 0), (0, -1), 0) + + t = Table(data, colWidths=cw) + t.setStyle(style_t) + fwb.append(t) + + fractions = directory.Fractions.objects.filter(research=iss.research, hide=False, render_type=1).order_by("pk").order_by("sort_weight") + if fractions.count() > 0: + data = [] + if not has0: + tmp = [ + Paragraph('Исследование', styleSheet["BodyText"]), + Paragraph('Дата сбора материала', styleSheet["BodyText"]), + Paragraph('Дата исполнения', styleSheet["BodyText"]), + Paragraph('Исполнитель', styleSheet["BodyText"]), + ] + data.append(tmp) + + tmp = [ + Paragraph('%s' % iss.research.title, styleSheet["BodyText"]), + Paragraph( + '%s%s' + % ("" if not iss.tubes.exists() or not iss.tubes.first().time_get else strdate(iss.tubes.first().time_get), "" if not iss.comment else "
" + iss.comment), + styleSheet["BodyText"], + ), + Paragraph( + '%s' % ("Не подтверждено" if not iss.time_confirmation else strdate(iss.time_confirmation)), styleSheet["BodyText"] + ), + Paragraph('%s' % (iss.doc_confirmation_fio or "Не подтверждено"), styleSheet["BodyText"]), + ] + data.append(tmp) + + cw = [int(tw * 0.34), int(tw * 0.24), int(tw * 0.2)] + cw = cw + [tw - sum(cw)] + t = Table(data, colWidths=cw) + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 0), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), 0), + ] + ) + + style_t.add('LINEBELOW', (0, -1), (-1, -1), 2, colors.black) + t.setStyle(style_t) + t.spaceBefore = 3 * mm + t.spaceAfter = 0 + fwb.append(t) + + has_anti = False + for f in fractions: + j = 0 + if Result.objects.filter(issledovaniye=iss, fraction=f).exists(): + result = Result.objects.filter(issledovaniye=iss, fraction=f).order_by("-pk")[0].value + + if result == "": + continue + jo = json.loads(result)["rows"] + for key, val in jo.items(): + if val["title"] != "": + data = [] + style_t.add('SPAN', (0, j), (-1, j)) + j += 1 + + norm_vals = [] + for rowk, rowv in val["rows"].items(): + if rowv["value"] not in ["", "null"]: + norm_vals.insert(0, {"title": rowv["title"], "value": rowv["value"], "k": int(rowk)}) + tmp = [ + Paragraph( + '' + (val["title"] if len(norm_vals) == 0 else "Выделенная культура: " + val["title"]) + "", + styleSheet["BodyText"], + ), + "", + "", + "", + "", + "", + ] + data.append(tmp) + + if len(norm_vals) > 0: + has_anti = True + + tmp = [Paragraph('%s' % f.title, styleSheet["BodyText"]), "", "", "", "", ""] + data.append(tmp) + j += 1 + + li = 0 + norm_vals.sort(key=operator.itemgetter('k')) + for idx, rowv in enumerate(norm_vals): + li = idx + if li % 3 == 0: + tmp = [] + + tmp.append(Paragraph('' + rowv["title"] + "", styleSheet["BodyText"])) + tmp.append(Paragraph('' + rowv["value"] + "", styleSheet["BodyText"])) + if li % 3 == 2: + data.append(tmp) + j += 1 + + if li % 3 == 0: + tmp.append("") + tmp.append("") + tmp.append("") + tmp.append("") + if li % 3 == 1: + tmp.append("") + tmp.append("") + if li % 3 < 2: + data.append(tmp) + j += 1 + cw = [int(tw * 0.28), int(tw * 0.06), int(tw * 0.27), int(tw * 0.06), int(tw * 0.27)] + cw = cw + [tw - sum(cw)] + t = Table(data, colWidths=cw) + + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 2), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -2), + ] + ) + + style_t.add('BOTTOMPADDING', (0, 0), (-1, -1), 1) + style_t.add('TOPPADDING', (0, 0), (-1, -1), 2) + + style_t.add('SPAN', (0, 0), (-1, 0)) + style_t.add('SPAN', (0, 1), (-1, 1)) + + t.setStyle(style_t) + fwb.append(t) + if has_anti: + data = [] + tmp = [ + [Paragraph('S - чувствителен; R - резистентен; I - промежуточная чувствительность;', styleSheet["BodyText"])], + "", + "", + "", + "", + "", + ] + data.append(tmp) + cw = [int(tw * 0.23), int(tw * 0.11), int(tw * 0.22), int(tw * 0.11), int(tw * 0.22)] + cw = cw + [tw - sum(cw)] + t = Table(data, colWidths=cw) + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'LEFT'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 2), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -2), + ] + ) + style_t.add('BOTTOMPADDING', (0, 0), (-1, 0), 1) + style_t.add('TOPPADDING', (0, 0), (-1, 0), 0) + style_t.add('SPAN', (0, 0), (-1, 0)) + + t.setStyle(style_t) + fwb.append(t) + if iss.lab_comment and iss.lab_comment != "": + data = [] + tmp = [ + [Paragraph('Комментарий', styleSheet["BodyText"])], + [Paragraph('%s' % (iss.lab_comment.replace("\n", "
")), styleSheet["BodyText"])], + "", + "", + "", + "", + ] + data.append(tmp) + cw = [int(tw * 0.26), int(tw * 0.178), int(tw * 0.17), int(tw * 0.134), int(tw * 0.178)] + cw = cw + [tw - sum(cw)] + t = Table(data, colWidths=cw) + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 2), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -2), + ] + ) + style_t.add('BOTTOMPADDING', (0, 0), (-1, 0), 1) + style_t.add('TOPPADDING', (0, 0), (-1, 0), 0) + style_t.add('SPAN', (1, 0), (-1, 0)) + + t.setStyle(style_t) + fwb.append(t) + return fwb + + +def lab_form_2(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal): + fwb.append(Spacer(1, 4 * mm)) + if interactive_text_field: + fwb.append(InteractiveTextField()) + tw = pw + no_units_and_ref = any([x.research.no_units_and_ref for x in direction.issledovaniya_set.all()]) + data = [] + tmp = [ + Paragraph('Исследование', styleSheet["BodyText"]), + Paragraph('Результат', styleSheet["BodyText"]), + ] + if not no_units_and_ref: + if direction.client.individual.sex.lower() == "м": + tmp.append(Paragraph('Референсные значения (М)', styleSheet["BodyText"])) + else: + tmp.append(Paragraph('Референсные значения (Ж)', styleSheet["BodyText"])) + tmp.append(Paragraph('Единицы
измерения
', styleSheet["BodyText"])) + + data.append(tmp) + if no_units_and_ref: + cw = [int(tw * 0.26), int(tw * 0.482), int(tw * 0.178)] + else: + cw = [int(tw * 0.26), int(tw * 0.178), int(tw * 0.17), int(tw * 0.134), int(tw * 0.178)] + cw = cw + [tw - sum(cw)] + t = Table(data, repeatRows=1, colWidths=cw) + style_t = TableStyle( + [ + ('ALIGN', (0, 0), (-1, -1), 'CENTER'), + ('VALIGN', (0, 0), (-1, -1), 'TOP'), + ('TEXTCOLOR', (0, -1), (-1, -1), colors.black), + ('INNERGRID', (0, 0), (-1, -1), 0.8, colors.black), + ('BOX', (0, 0), (-1, -1), 0.8, colors.black), + ('LEFTPADDING', (0, 0), (-1, -1), 4), + ('TOPPADDING', (0, 0), (-1, -1), 2), + ('RIGHTPADDING', (0, 0), (-1, -1), 2), + ('BOTTOMPADDING', (0, 0), (-1, -1), -2), + ] + ) + style_t.add('BOTTOMPADDING', (0, 0), (-1, 0), 1) + style_t.add('TOPPADDING', (0, 0), (-1, 0), 0) + + t.setStyle(style_t) + t.spaceBefore = 3 * mm + t.spaceAfter = 0 + + has0 = directory.Fractions.objects.filter(research__pk__in=[x.research_id for x in direction.issledovaniya_set.all()], hide=False, render_type=0).exists() + + if has0: + fwb.append(t) + + iss_list = direction.issledovaniya_set.all() + result_style = styleSheet["BodyText"] if no_units_and_ref else stl + pks = [] + return fwb diff --git a/results/views.py b/results/views.py index 77dfd73803..c7ef007c3e 100644 --- a/results/views.py +++ b/results/views.py @@ -47,7 +47,8 @@ from clients.models import CardBase from directions.models import Issledovaniya, Result, Napravleniya, ParaclinicResult, Recipe, DirectionDocument, DocumentSign from laboratory.decorators import logged_in_or_token -from laboratory.settings import DEATH_RESEARCH_PK, LK_USER, SYSTEM_AS_VI, QRCODE_OFFSET_SIZE, LEFT_QRCODE_OFFSET_SIZE, GISTOLOGY_RESEARCH_PK, RESEARCHES_NOT_PRINT_FOOTERS +from laboratory.settings import DEATH_RESEARCH_PK, LK_USER, SYSTEM_AS_VI, QRCODE_OFFSET_SIZE, LEFT_QRCODE_OFFSET_SIZE, GISTOLOGY_RESEARCH_PK, RESEARCHES_NOT_PRINT_FOOTERS, \ + RESULT_LABORATORY_FORM from laboratory.settings import FONTS_FOLDER from laboratory.utils import strdate, strtime from podrazdeleniya.models import Podrazdeleniya @@ -530,7 +531,11 @@ def local_mark_pages(c, _): qr_code_param = QRCODE_OFFSET_SIZE fwb.append(QrCodeSite(lk_address, qr_code_param)) if not has_paraclinic: - fwb = default_lab_form(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal) + if not RESULT_LABORATORY_FORM: + fwb = default_lab_form(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal) + else: + laboratory_form = import_string('results.laboratory_form.' + RESULT_LABORATORY_FORM) + fwb = laboratory_form(fwb, interactive_text_field, pw, direction, styleSheet, directory, show_norm, stl, print_vtype, get_r, result_normal) else: iss: Issledovaniya for iss in direction.issledovaniya_set.all().order_by("research__pk"):