<template>
    <div class="card patient-card">
        <div class="card-title">患者信息</div>
        <div class="patient-hero">
            <div class="patient-name">{{ apt?.patient_name || '—' }}</div>
            <div class="patient-meta">
                <div>
                    {{ maskPhone(apt?.patient_phone) }} · {{ formatGender(diag?.gender) }} ·
                    {{ diag?.age != null ? diag.age + '岁' : '—' }}
                </div>
                <div>
                    {{ diag?.height ? diag.height + 'cm' : '—' }} /
                    {{ diag?.weight ? diag.weight + 'kg' : '—' }} · {{ diag?.region || '—' }}
                </div>
                <div>
                    预约：{{ apt?.appointment_date }} {{ apt?.appointment_time }} ·
                    {{ formatPeriod(apt?.period) }}
                </div>
                <div>医生：{{ apt?.doctor_name || '—' }}　客服：{{ apt?.assistant_name || '—' }}</div>
                <div>
                    状态：{{ apt?.status_desc || '—' }} ·
                    {{ apt?.has_prescription ? '已开方' : '未开方' }}
                </div>
                <div v-if="apt?.remark">备注：{{ apt.remark }}</div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { maskPhone, formatGender, formatPeriod } from '@/utils/diag-display'

interface Props {
    apt?: Record<string, any> | null
    diag?: Record<string, any> | null
}

withDefaults(defineProps<Props>(), {
    apt: () => ({}),
    diag: () => ({})
})
</script>

<style lang="scss" scoped>
.card {
    background: var(--rx-surface);
    border: 1px solid var(--rx-line);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--rx-shadow-sm);
    transition: box-shadow 0.2s ease;

    &:hover {
        box-shadow: var(--rx-shadow);
    }
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--rx-ink);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
    position: relative;

    &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 16px;
        border-radius: 2px;
        background: linear-gradient(180deg, #4f8cff 0%, #2563eb 100%);
    }
}

.patient-hero {
    background: linear-gradient(135deg, #f5f8ff 0%, #eef3ff 100%);
    border: 1px solid #dde7ff;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;

    &::after {
        content: '';
        position: absolute;
        right: -20px;
        top: -20px;
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(79, 140, 255, 0.08) 0%, transparent 70%);
    }
}

.patient-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--rx-ink);
    letter-spacing: -0.01em;
}

.patient-meta {
    color: var(--rx-muted);
    font-size: 13px;
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
}
</style>
