Медицина/Документы Jinja: различия между версиями

Материал из Medlogic
Нет описания правки
Нет описания правки
Строка 21: Строка 21:
https://pymorphy2.readthedocs.io/en/latest/user/grammemes.html
https://pymorphy2.readthedocs.io/en/latest/user/grammemes.html


<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ "Хомяк ест"|inflect("datv", "plur") }}
{{ "Хомяк ест"|inflect("datv", "plur") }}
{{ "Хомяк"|agree_with_number(4) }}
{{ "Хомяк"|agree_with_number(4) }}
Строка 27: Строка 27:


=== Petrovich ===
=== Petrovich ===
<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ "Иванов Иван Иванович"|inflectfio(case, gender) }}
{{ "Иванов Иван Иванович"|inflectfio(case, gender) }}
     post= [0...4]
     post= [0...4]
Строка 45: Строка 45:
=== Barcode ===
=== Barcode ===


<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ barcode128('PATIENT', patient.id) }}
{{ barcode128('PATIENT', patient.id) }}
{{ barcode128('PATIENT', patient.id, separator='~', width='300px', height='200px') }}
{{ barcode128('PATIENT', patient.id, separator='~', width='300px', height='200px') }}
Строка 51: Строка 51:


=== Qrcode ===
=== Qrcode ===
<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ qrcode('PATIENT', patient.id) }}
{{ qrcode('PATIENT', patient.id) }}
{{ qrcode('PATIENT', patient.id, separator='~', size='50px') }}
{{ qrcode('PATIENT', patient.id, separator='~', size='50px') }}
Строка 57: Строка 57:


=== Даты ===
=== Даты ===
<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ now() }}
{{ now() }}
{{ now('%d.%m.%Y %H:%M') }}
{{ now('%d.%m.%Y %H:%M') }}
Строка 66: Строка 66:


=== Функции ===
=== Функции ===
<syntaxhighlight lang="html">
<syntaxhighlight lang="Jinja">
{{ render_layout('name') }}
{{ render_layout('name') }}
</syntaxhighlight>
</syntaxhighlight>

Версия от 23:57, 1 мая 2023

Некешируемое изображение

<img src="{{ src }}?{{ timestamp() }}" />

Медицинский осмотр

{{ record.case }}

{% for service in record.case.get_services(include_complex_service=True) %}
  <p>{{ service.name }}</p>
{% 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') }}