Backend: - PdfTemplate model with locale field + UNIQUE(name, locale) constraint - Migration 007: pdf_templates table + template_id FK on generated_pdfs - Template service: CRUD, Jinja2 validation, render preview with sample data - Admin endpoints: CRUD /admin/pdf-templates + POST preview - User endpoint: GET /pdf/templates (active templates list) - pdf_service: resolves template from DB by ID or falls back to default for the appropriate locale - AI generate_pdf tool accepts optional template_id - Seed script + 4 HTML template files: - Basic Report (en/ru) — general-purpose report - Medical Report (en/ru) — health-focused with disclaimers Frontend: - Admin PDF templates page with editor, locale selector, live preview (iframe), template variables reference panel - PDF page: template selector dropdown in generation form - API clients for admin CRUD + user template listing - Sidebar: admin templates link - English + Russian translations Also added Phase 9 (OAuth) and Phase 10 (Rate Limits) placeholders to GeneralPlan. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.7 KiB
HTML
76 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body { font-family: 'Georgia', serif; font-size: 11pt; color: #222; margin: 30px; }
|
|
h1 { color: #c0392b; border-bottom: 3px double #c0392b; padding-bottom: 10px; }
|
|
h2 { color: #8e2323; margin-top: 20px; border-left: 4px solid #c0392b; padding-left: 10px; }
|
|
.header { margin-bottom: 20px; }
|
|
.header p { margin: 2px 0; color: #555; }
|
|
.warning { background: #fff3cd; border: 1px solid #ffc107; padding: 10px; border-radius: 4px; margin-bottom: 16px; font-size: 10pt; }
|
|
.section { margin-bottom: 16px; }
|
|
.entry { border-bottom: 1px solid #eee; padding: 8px 0; }
|
|
.entry .cat { font-size: 9pt; color: #999; text-transform: uppercase; letter-spacing: 1px; }
|
|
.entry .title { font-weight: bold; font-size: 12pt; }
|
|
.entry .badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 8pt; font-weight: bold; }
|
|
.badge-critical { background: #e74c3c; color: white; }
|
|
.badge-high { background: #e67e22; color: white; }
|
|
.badge-medium { background: #3498db; color: white; }
|
|
.badge-low { background: #95a5a6; color: white; }
|
|
.doc { background: #f8f9fa; padding: 10px; margin-bottom: 8px; border-left: 3px solid #3498db; }
|
|
.doc .fname { font-weight: bold; }
|
|
.doc .excerpt { font-size: 10pt; color: #444; white-space: pre-wrap; }
|
|
.footer { margin-top: 30px; padding-top: 10px; border-top: 2px solid #eee; font-size: 8pt; color: #999; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>Medical Report: {{ title }}</h1>
|
|
<p>Patient: {{ user_name }}</p>
|
|
<p>Date: {{ generated_at }}</p>
|
|
</div>
|
|
|
|
<div class="warning">
|
|
This report is generated by AI and is for informational purposes only. Always consult a healthcare professional for medical decisions.
|
|
</div>
|
|
|
|
{% if memories %}
|
|
<div class="section">
|
|
<h2>Health Profile</h2>
|
|
{% for m in memories %}
|
|
<div class="entry">
|
|
<span class="cat">{{ m.category }}</span>
|
|
<span class="badge badge-{{ m.importance }}">{{ m.importance }}</span>
|
|
<div class="title">{{ m.title }}</div>
|
|
<div>{{ m.content }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if documents %}
|
|
<div class="section">
|
|
<h2>Medical Documents</h2>
|
|
{% for d in documents %}
|
|
<div class="doc">
|
|
<div class="fname">{{ d.original_filename }} ({{ d.doc_type }})</div>
|
|
<div class="excerpt">{{ d.excerpt }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if ai_summary %}
|
|
<div class="section">
|
|
<h2>AI Clinical Summary</h2>
|
|
<p>{{ ai_summary }}</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="footer">
|
|
Generated by AI Assistant • For informational purposes only • Not a substitute for professional medical advice
|
|
</div>
|
|
</body>
|
|
</html>
|