<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Medical Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 40px;
            line-height: 1.6;
        }
        .header {
            text-align: center;
            border-bottom: 2px solid #333;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }
        .section {
            margin-bottom: 20px;
        }
        .section-title {
            font-weight: bold;
            margin-bottom: 5px;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        table, th, td {
            border: 1px solid #ddd;
        }
        th, td {
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>MEDICAL REPORT</h1>
    </div>
    
    <div class="section">
        <div class="section-title">PATIENT INFORMATION</div>
        <p>
            <strong>Patient ID:</strong> {{ patient_id }}<br>
            <strong>Name:</strong> {{ patient_name }}<br>
            <strong>Date of Birth:</strong> {{ date_of_birth }}
        </p>
    </div>
    
    <div class="section">
        <div class="section-title">VISIT INFORMATION</div>
        <p>
            <strong>Visit Date:</strong> {{ visit_date }}<br>
            <strong>Chief Complaint:</strong> {{ chief_complaint }}
        </p>
    </div>
    
    <div class="section">
        <div class="section-title">MEDICAL HISTORY</div>
        <p>{{ medical_history }}</p>
    </div>
    
    <div class="section">
        <div class="section-title">VITAL SIGNS</div>
        <p>
            <strong>Blood Pressure:</strong> {{ blood_pressure }}<br>
            <strong>Heart Rate:</strong> {{ heart_rate }} bpm<br>
            <strong>Respiratory Rate:</strong> {{ respiratory_rate }} breaths/min<br>
            <strong>Temperature:</strong> {{ temperature }}°F<br>
            <strong>Oxygen Saturation:</strong> {{ oxygen_saturation }}%
        </p>
    </div>
    
    <div class="section">
        <div class="section-title">ASSESSMENT</div>
        <p>{{ assessment }}</p>
    </div>
    
    <div class="section">
        <div class="section-title">DIAGNOSIS</div>
        <ul>
            {% if diagnosis %}
                {% for item in diagnosis %}
                <li>{{ item }}</li>
                {% endfor %}
            {% else %}
                <li>No diagnosis recorded</li>
            {% endif %}
        </ul>
    </div>
    
    <div class="section">
        <div class="section-title">TREATMENT PLAN</div>
        <p>{{ treatment_plan }}</p>
    </div>
    
    <div class="section">
        <div class="section-title">MEDICATIONS</div>
        <table>
            <tr>
                <th>Medication</th>
            </tr>
            {% if medications %}
                {% for med in medications %}
                <tr>
                    <td>{{ med }}</td>
                </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td>No medications prescribed</td>
                </tr>
            {% endif %}
        </table>
    </div>
    
    <div class="section">
        <div class="section-title">FOLLOW-UP</div>
        <p>{{follow_up}}</p>
    </div>
</body>
</html>
