Mis pacientes

Gestiona expedientes clínicos, tareas terapéuticas y notas profesionales.

@include('partials.notification-modal')
@include('partials.frontend-alerts') @php $statusLabels = [ 'pending_payment' => 'Pago pendiente', 'pending' => 'Pendiente', 'accepted' => 'Aceptada', 'rescheduled' => 'Reagenda pendiente', 'rejected' => 'Rechazada', 'cancelled' => 'Cancelada', 'completed' => 'Completada', 'missed' => 'Perdida / sin entrar', ]; $paymentLabels = [ 'pending' => 'Pendiente', 'paid' => 'Pagado', 'waived' => 'Sin cobro', 'refunded' => 'Reembolsado', 'failed' => 'Fallido', ]; $exportPatients = $patients->map(function ($patient) use ($appointments, $tasks, $notes, $statusLabels) { $patientAppointments = $appointments->where('patient_id', $patient->id); $nextAppointment = $patientAppointments->filter(fn($a) => $a->starts_at && $a->starts_at->gte(now()))->sortBy('starts_at')->first(); $lastAppointment = $patientAppointments->filter(fn($a) => $a->starts_at && $a->starts_at->lt(now()))->sortByDesc('starts_at')->first(); return [ 'expediente' => 'EXP-'.str_pad($patient->id, 3, '0', STR_PAD_LEFT), 'nombre' => $patient->nombre_completo, 'correo' => $patient->email, 'telefono' => $patient->telefono ?: 'Sin teléfono', 'motivo' => $patient->patientProfile?->motivo_consulta ?: 'Sin motivo registrado', 'proxima' => $nextAppointment?->starts_at?->format('d/m/Y H:i') ?: 'Sin programar', 'ultima' => $lastAppointment?->starts_at?->format('d/m/Y H:i') ?: 'Sin registro', 'tareas' => $tasks->where('patient_id', $patient->id)->whereIn('status', ['pendiente','requiere_cambios','entregada'])->count(), 'estado' => $nextAppointment ? ($statusLabels[$nextAppointment->status] ?? ucfirst($nextAppointment->status)) : 'Seguimiento', ]; })->values(); @endphp

Total pacientes

{{ $stats['total'] ?? $patients->count() }}

Activos

{{ $stats['active'] ?? 0 }}

Tareas pendientes

{{ $stats['pending_tasks'] ?? 0 }}

Riesgo alto

{{ $stats['high_risk'] ?? 0 }}
@if($patients->isEmpty())

Aún no tienes pacientes vinculados

También puedes agregar un paciente previo con el botón “Agregar nuevo paciente”.

@endif @foreach($patients as $patient) @php $profile = $patient->patientProfile; $emergency = $patient->emergencyContact; $patientAppointments = $appointments->where('patient_id', $patient->id)->sortByDesc('starts_at'); $nextAppointment = $patientAppointments->filter(fn($a) => $a->starts_at && $a->starts_at->gte(now()))->sortBy('starts_at')->first(); $lastAppointment = $patientAppointments->filter(fn($a) => $a->starts_at && $a->starts_at->lt(now()))->first(); $patientTasks = $tasks->where('patient_id', $patient->id); $patientNotes = $notes->where('patient_id', $patient->id); $risk = $patientNotes->contains(fn($note) => str_contains(mb_strtolower((string) $note->description), 'riesgo alto')) ? 'alto' : 'medio'; @endphp
first) hidden @endif>
{{ $patient->initials() }}
EXP-{{ str_pad($patient->id, 3, '0', STR_PAD_LEFT) }}

{{ $patient->nombre_completo }}

{{ optional($patient->fecha_nacimiento)->age ? optional($patient->fecha_nacimiento)->age.' años · ' : '' }}{{ $profile?->terapia_previa === 'si' ? 'Terapia previa' : 'Terapia individual' }}

ActivoRiesgo {{ $risk }}
Próxima sesión{{ $nextAppointment?->starts_at?->format('d/m/Y') ?? 'Sin programar' }}
Última sesión{{ $lastAppointment?->starts_at?->format('d/m/Y') ?? 'Sin registro' }}

Resumen clínico

Vista rápida del estado actual.

Motivo de consulta

{{ $profile?->motivo_consulta ?: 'No registrado' }}

Objetivo actual

{{ $profile?->objetivos ?: 'No registrado' }}

Teléfono

{{ $patient->telefono ?: 'No registrado' }}

Correo

{{ $patient->email }}

Contacto emergencia

{{ $emergency ? $emergency->nombre.' · '.$emergency->telefono : 'No registrado' }}

Medicación actual

{{ $profile?->medicacion_actual ?: 'No registrada' }}

Estado

Activo

@php $history = (array)($profile?->clinical_history ?? []); $attachments = (array)($profile?->clinical_attachments ?? []); $h = fn($key, $fallback = '') => old($key, data_get($history, $key, $fallback)); @endphp
@csrf

Historial clínico

Expediente clínico psicológico con datos de identificación, interrogatorio, evaluación, diagnóstico, riesgo y plan terapéutico.

Identificación del paciente
Motivo de consulta y padecimiento actual
Antecedentes
Interrogatorio y estado general
Evaluación psicológica y examen mental
Diagnóstico, problemas clínicos y pronóstico
Riesgo clínico y plan de seguridad
Plan terapéutico
Archivos adjuntos del paciente

Archivos adjuntos registrados

@forelse($attachments as $index => $attachment)
{{ $attachment['nombre_original'] ?? 'Adjunto clínico' }}

{{ $attachment['descripcion'] ?? 'Sin descripción' }}

{{ $attachment['uploaded_at'] ?? '' }} · {{ $attachment['mime'] ?? 'archivo' }}
@empty
No hay archivos adjuntos registrados para este expediente.
@endforelse

Historial de sesiones

Sesiones reales registradas con este paciente.

@forelse($patientAppointments as $appointment)
ID {{ $appointment->id }}

{{ $appointment->reason }}

{{ optional($appointment->starts_at)->format('d/m/Y H:i') }} · {{ $appointment->modality }} · {{ $paymentLabels[$appointment->payment_status] ?? ucfirst($appointment->payment_status) }}

{{ $statusLabels[$appointment->status] ?? ucfirst(str_replace('_',' ', $appointment->status)) }}
@empty
No hay sesiones registradas.
@endforelse

Tareas terapéuticas

Actividades entre sesiones y entregas revisables.

@csrf
@forelse($patientTasks as $task)

{{ $task->title }}

Vence: {{ optional($task->due_date)->format('d/m/Y') ?: 'Sin fecha' }}
{{ ['pendiente'=>'Pendiente','entregada'=>'Entregada','completada'=>'Completada','requiere_cambios'=>'Requiere cambios'][$task->status] ?? ucfirst(str_replace('_', ' ', $task->status)) }}

{{ $task->description }}

@if($task->follow_up)
Respuesta del paciente

{{ $task->follow_up }}

@if($task->evidence_file_path)Ver PDF adjunto@endif
@endif @if($task->status === 'entregada')
@csrf
@endif
@empty
No hay tareas asignadas.
@endforelse

Notas profesionales

Notas clínicas privadas de tu seguimiento.

@csrf
@forelse($patientNotes as $note)

{{ $note->title }}

{{ optional($note->note_date)->format('d/m/Y') }} · {{ $note->type }}

{{ $note->description }}

@empty
No hay notas clínicas registradas.
@endforelse
@endforeach