Медицина/Документы Jinja: различия между версиями
Admin (обсуждение | вклад) Нет описания правки |
|||
| Строка 98: | Строка 98: | ||
{{ num2words(52, ordinal=True) }} | {{ num2words(52, ordinal=True) }} | ||
{{ 52|num2words }} | {{ 52|num2words }} | ||
{{ num2currency(52.2) }} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Версия от 01:53, 25 мая 2024
Некешируемое изображение
<img src="{{ src }}?{{ timestamp() }}" />
Медицинский осмотр
{{ record.case }}
{% set case_services = get_case_services(record.case, include_complex_service=False) %}
{% set case_record_services = get_case_record_services(record.case) %}
{% set record_services = get_record_services(record) %}
{% for service in case_services %}
<p>{{ service.name }}</p>
{% endfor %}
{% for record_service in case_record_services %}
<p>{{ record_service.service.name }}</p>
<p>{{ record_service.cost }}</p>
<p>{{ record_service.status }}</p>
{% endfor %}
{% for record_service in record_services %}
<p>{{ record_service.service.name }}</p>
<p>{{ record_service.cost }}</p>
<p>{{ record_service.status }}</p>
{% endfor %}
Значения из справочника
{% set values = get_catalog_values('RECORD_SERVICE_STATUS') %}
{% for value in values %}
{{ value.name }}
{% endfor %}
Шаблоны (jinja2)
"Документация":http://jinja.pocoo.org/docs/2.10/templates/
Pymorphy2
https://pymorphy2.readthedocs.io/en/latest/user/grammemes.html
{{ "Хомяк ест"|inflect("datv", "plur") }}
{{ "Хомяк"|agree_with_number(4) }}
Petrovich
{{ "Иванов Иван Иванович"|inflectfio(case, gender) }}
post= [0...4]
gender = [0...1]
# Родительный
GENITIVE = 0
# Дательный
DATIVE = 1
# Винительный
ACCUSATIVE = 2
# Творительный
INSTRUMENTAL = 3
# Предложный
PREPOSITIONAL = 4
Barcode
{{ barcode128('PATIENT', patient.id) }}
{{ barcode128('PATIENT', patient.id, separator='~', width='300px', height='200px') }}
Qrcode
{{ qrcode('PATIENT', patient.id) }}
{{ qrcode('PATIENT', patient.id, separator='~', size='50px') }}
Даты
{{ now() }}
{{ now('%d.%m.%Y %H:%M') }}
{{ today() }}
{{ today('%d.%m.%Y') }}
Функции
Подключение шаблона
{{ render_layout('name') }}
Конвертация числа в тексовое представление
{{ num2words(52, ordinal=True) }}
{{ 52|num2words }}
{{ num2currency(52.2) }}
Удаление тегов
{{ data.text|remove_tags }}
Разное
{{ "{:02}".format(5) }} 05
{{ user_has_group('Врачи', 'КЭР') }} True