Медицина/Документы Jinja
Версия от 23:50, 2 июня 2023; Admin (обсуждение | вклад)
Некешируемое изображение
<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') }}