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

Материал из Medlogic
 
(не показано 8 промежуточных версий этого же участника)
Строка 16: Строка 16:
<syntaxhighlight lang="html">
<syntaxhighlight lang="html">
<style>
<style>
.file {
.files-list {
display: flex;
flex-direction: row;
flex-flow: row wrap;
gap: 10px;
justify-content: flex-start;
}
.files-list .file-item {
width: 300px;
border: 1px solid #ccc;
border: 1px solid #ccc;
border-radius: 10px;
border-radius: 10px;
overflow: hidden;
overflow: hidden;
margin: 0px;
margin-bottom: 20px;
}
}
.file img{
.files-list .file-item .file-preview {
max-width: 100%;
height: 200px;
max-height: 100%;
display: flex;
align-items: center;
    justify-content: center;
background: #fff;
}
.files-list .file-item .file-description {
padding: 10px;
}
}
</style>
</style>
<div class="row form-group file">
<div class="files-list" pswp-gallery id="qwe">
<div class="">
{% for obj in files %}
{% if obj.is_image() %}
<div class="file-item">
<a href="{{ obj.file.url }}" target="_blank"><img src="{{ obj.file.url }}" alt="{{ obj.file_name }}" /></a>
<div class="file-preview">
{% if obj.is_image() %}
<a  
  href="{{ obj.file.url }}"
  data-pswp-width="{{ obj.image_size.width }}"
  data-pswp-height="{{ obj.image_size.height }}"
  data-download-url="{{ obj.file.url }}"
  target="_blank"
  class="pswp-item"
  >
<img src="{{ obj.file_thumbnail.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
</a>
{% elif obj.is_pdf() %}
<a
  href="{{ obj.file.url }}?{{ timestamp() }}"
  data-download-url="{{ obj.file.url }}"
  target="_blank"
  class="pswp-item"
  data-pswp-type="pdf"
  >
{% if obj.convert_to_image %}
<img src="{{ obj.convert_to_image.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
{% else %}
Просмотр
{% endif %}
</a>
{% elif obj.convert_to_pdf %}
<a
  href="{{ obj.convert_to_pdf.url }}"
  data-download-url="{{ obj.convert_to_pdf.url }}"
  target="_blank"
  class="pswp-item"
  data-pswp-type="pdf"
  >
{% if obj.convert_to_image %}
<img src="{{ obj.convert_to_image.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
{% else %}
Просмотр
{% endif %}
</a>
{% endif %}
</div>
<div class="file-description">
<div>
<a  
  href="{{ obj.file.url }}"
  target="_blank"
  >
{{ obj.file_name }}
</a>
</div>
{% if obj.description %}
<div class="mt-5">
{{ obj.description }}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</syntaxhighlight>
 
=== Печать всех документов ===
<syntaxhighlight lang="html">
{% set case=record.case %}
 
{% for case_record in case.records.all() %}
{% if record == case_record %}
<!-- Пропускаем текущую запись -->
{% continue %}
{% endif %}
 
{% set document_template = case_record.document_template %}
{% if document_template %}
{% for print_template in document_template.print_templates.all() %}
{{ print_template.generate_html(record=case_record, obj=case_record, mode='print') }}
 
{% if not loop.last %}
<div class="page-break"></div>
{% endif %}
{% endfor %}
 
{% for record_file in case_record.get_files() %}
{% set file = record_file.file %}
{% if record_file.is_image() %}
<img src="{{ file.path }}" style="width: 100%" />
{% if not loop.last %}
<div class="page-break"></div>
{% endif %}
{% elif record_file.convert_to_image %}
<img src="{{ record_file.convert_to_image.path }}" style="width: 100%" />
{% if not loop.last %}
<div class="page-break"></div>
{% endif %}
{% endif %}
{% endfor %}
 
{% if not loop.last %}
<div class="page-break"></div>
{% endif %}
{% endif %}
<table class="table table-bordered">
{% endif %}
<tr>
{% endfor %}
<th class="col-3">Файл</th>
<td><a href="{{ obj.file.url }}" target="_blank">{{ obj.file_name }}</a></td>
</tr>
<tr>
<th class="col-3">Описание</th>
<td>{{ obj.description }}</td>
</tr>
</table>
</div>
</div>
</syntaxhighlight>
</syntaxhighlight>

Текущая версия от 11:25, 9 июля 2023

COVID 19

{% set data = record.data %}
<div>
	<p>Статус: {{ data.status.label }}</p>
	<p>Дата устанволения статуса: {{ data.status_date }}</p>
	<p>Эпидемиологический номер: {{ data.epidemiological_number }}</p>
	<p>Дата следующего мероприятия: {{ data.next_date }}</p>
	<p>Больничный лист с: {{ data.sick_list_start }}</p>
	<p>Больничный лист по: {{ data.sick_list_end }}</p>
	<p>Комментарий: {{ data.comment }}</p>
</div>

Прикрепленный файл

<style>
	.files-list {
		display: flex;
		flex-direction: row;
		flex-flow: row wrap;
		gap: 10px;
		justify-content: flex-start;
		
	}
	.files-list .file-item {
		width: 300px;
		border: 1px solid #ccc;
		border-radius: 10px;
		overflow: hidden;
	}
	.files-list .file-item .file-preview {
		height: 200px;
		display: flex;
		align-items: center;
    	justify-content: center;
		background: #fff;
	}
	.files-list .file-item .file-description {
		padding: 10px;
	}
</style>
<div class="files-list" pswp-gallery id="qwe">
	{% for obj in files %}
		<div class="file-item">
			<div class="file-preview">
				{% if obj.is_image() %}
					<a 
					   href="{{ obj.file.url }}"
					   data-pswp-width="{{ obj.image_size.width }}" 
					   data-pswp-height="{{ obj.image_size.height }}"
					   data-download-url="{{ obj.file.url }}"
					   target="_blank"
					   class="pswp-item"
					   >
						<img src="{{ obj.file_thumbnail.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
					</a>
				{% elif obj.is_pdf() %}
					<a 
					   href="{{ obj.file.url }}?{{ timestamp() }}"
					   data-download-url="{{ obj.file.url }}"
					   target="_blank"
					   class="pswp-item"
					   data-pswp-type="pdf"
					   >
						{% if obj.convert_to_image %}
							<img src="{{ obj.convert_to_image.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
						{% else %}
							Просмотр
						{% endif %}
					</a>
				{% elif obj.convert_to_pdf %}
					<a 
					   href="{{ obj.convert_to_pdf.url }}"
					   data-download-url="{{ obj.convert_to_pdf.url }}"
					   target="_blank"
					   class="pswp-item"
					   data-pswp-type="pdf"
					   >
						{% if obj.convert_to_image %}
							<img src="{{ obj.convert_to_image.url }}?{{ timestamp() }}" alt="{{ obj.file_name }}" />
						{% else %}
							Просмотр
						{% endif %}
					</a>
				{% endif %}
			</div>
			<div class="file-description">
				<div>
					<a 
					   href="{{ obj.file.url }}"
					   target="_blank"
					   >
						{{ obj.file_name }}
					</a>
				</div>
				{% if obj.description %}
				<div class="mt-5">
					{{ obj.description }}
				</div>
				{% endif %}
			</div>
		</div>
	{% endfor %}
</div>

Печать всех документов

{% set case=record.case %}

{% for case_record in case.records.all() %}
	{% if record == case_record %}
		<!-- Пропускаем текущую запись -->
		{% continue %}
	{% endif %}

	{% set document_template = case_record.document_template %}
	
	{% if document_template %}
		{% for print_template in document_template.print_templates.all() %}
			{{ print_template.generate_html(record=case_record, obj=case_record, mode='print') }}

			{% if not loop.last %}
				<div class="page-break"></div>
			{% endif %}
		{% endfor %}

		{% for record_file in case_record.get_files() %}
			{% set file = record_file.file %}
			{% if record_file.is_image() %}
				<img src="{{ file.path }}" style="width: 100%" />
				{% if not loop.last %}
					<div class="page-break"></div>
				{% endif %}
			{% elif record_file.convert_to_image %}
				<img src="{{ record_file.convert_to_image.path }}" style="width: 100%" />
				{% if not loop.last %}
					<div class="page-break"></div>
				{% endif %}
			{% endif %}
		{% endfor %}

		{% if not loop.last %}
			<div class="page-break"></div>
		{% endif %}
	{% endif %}
{% endfor %}