Agregar hora a laboratorios: modal importar, save con hora seleccionada
This commit is contained in:
@@ -19,10 +19,10 @@ interface InternacionesProps {
|
||||
cultivos?: Cultivo[];
|
||||
areas: Area[];
|
||||
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => void;
|
||||
onFinalizarInternacion: (internacionId: string, datos: {
|
||||
fechaEgreso: string;
|
||||
diagnosticoEgreso: string;
|
||||
motivoEgreso: Internacion['motivoEgreso']
|
||||
onFinalizarInternacion: (internacionId: string, datos: {
|
||||
fechaEgreso: string;
|
||||
diagnosticoEgreso: string;
|
||||
motivoEgreso: Internacion['motivoEgreso']
|
||||
}) => void;
|
||||
getPacienteById: (id: string) => Paciente | undefined;
|
||||
getCamaById: (id: string) => Cama | undefined;
|
||||
@@ -30,11 +30,11 @@ interface InternacionesProps {
|
||||
onNuevoIngreso?: () => void;
|
||||
}
|
||||
|
||||
export function Internaciones({
|
||||
internaciones,
|
||||
pacientes,
|
||||
export function Internaciones({
|
||||
internaciones,
|
||||
pacientes,
|
||||
camas,
|
||||
onIniciarInternacion,
|
||||
onIniciarInternacion,
|
||||
onFinalizarInternacion,
|
||||
getPacienteById,
|
||||
getCamaById,
|
||||
@@ -54,7 +54,7 @@ export function Internaciones({
|
||||
const [motivoConsulta, setMotivoConsulta] = useState('');
|
||||
const [antecedentesEnfermedadActual, setAntecedentesEnfermedadActual] = useState('');
|
||||
const [medicoIngresante, setMedicoIngresante] = useState('');
|
||||
|
||||
|
||||
// Formulario nueva internación
|
||||
const [fechaEgreso, setFechaEgreso] = useState('');
|
||||
const [diagnosticoEgreso, setDiagnosticoEgreso] = useState('');
|
||||
@@ -106,17 +106,17 @@ export function Internaciones({
|
||||
|
||||
const internacionesFiltradas = internaciones.filter(i => {
|
||||
const paciente = getPacienteById(i.pacienteId);
|
||||
const cumpleBusqueda = !busqueda ||
|
||||
const cumpleBusqueda = !busqueda ||
|
||||
(paciente && (
|
||||
paciente.nombre.toLowerCase().includes(busqueda.toLowerCase()) ||
|
||||
paciente.apellido.toLowerCase().includes(busqueda.toLowerCase()) ||
|
||||
paciente.dni.includes(busqueda)
|
||||
));
|
||||
|
||||
const cumpleEstado = filtroEstado === 'todas' ||
|
||||
|
||||
const cumpleEstado = filtroEstado === 'todas' ||
|
||||
(filtroEstado === 'activas' && i.activa) ||
|
||||
(filtroEstado === 'finalizadas' && !i.activa);
|
||||
|
||||
|
||||
return cumpleBusqueda && cumpleEstado;
|
||||
}).sort((a, b) => new Date(b.fechaIngresoClinica || '').getTime() - new Date(a.fechaIngresoClinica || '').getTime());
|
||||
|
||||
@@ -251,18 +251,18 @@ export function Internaciones({
|
||||
</div>
|
||||
<div>
|
||||
<Label>Médico Ingresante *</Label>
|
||||
<Input
|
||||
<Input
|
||||
value={medicoIngresante}
|
||||
onChange={(e) => setMedicoIngresante(e.target.value)}
|
||||
placeholder="Nombre del médico ingresante"
|
||||
/>
|
||||
</div>
|
||||
<Button variant="outline"
|
||||
className="w-full"
|
||||
onClick={handleIniciarInternacion}
|
||||
disabled={!pacienteSeleccionado || !camaSeleccionada || !motivoConsulta || !enfermedadActual || !medicoIngresante}
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
<Button variant="outline"
|
||||
className="w-full"
|
||||
onClick={handleIniciarInternacion}
|
||||
disabled={!pacienteSeleccionado || !camaSeleccionada || !motivoConsulta || !enfermedadActual || !medicoIngresante}
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
Iniciar Internación
|
||||
</Button>
|
||||
</div>
|
||||
@@ -304,15 +304,14 @@ export function Internaciones({
|
||||
{internacionesFiltradas.map((internacion) => {
|
||||
const paciente = getPacienteById(internacion.pacienteId);
|
||||
const cama = getCamaById(internacion.camaId);
|
||||
|
||||
|
||||
return (
|
||||
<Card key={internacion.id} className="hover:shadow-md transition-shadow">
|
||||
<CardContent className="p-4 dark:bg-gray-800">
|
||||
<CardContent className="p-4 dark:bg-gray-800">
|
||||
<div className="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4">
|
||||
<div className="flex items-start gap-4">
|
||||
<div className={`h-12 w-12 rounded-full flex items-center justify-center flex-shrink-0 ${
|
||||
internacion.activa ? 'bg-purple-100' : 'bg-gray-100'
|
||||
}`}>
|
||||
<div className={`h-12 w-12 rounded-full flex items-center justify-center flex-shrink-0 ${internacion.activa ? 'bg-purple-100' : 'bg-gray-100'
|
||||
}`}>
|
||||
{internacion.activa ? (
|
||||
<ClipboardList className="h-6 w-6 text-purple-600" />
|
||||
) : (
|
||||
@@ -371,8 +370,8 @@ export function Internaciones({
|
||||
{internacion.activa && (
|
||||
<Dialog open={dialogoEgresoAbierto && internacionSeleccionada?.id === internacion.id} onOpenChange={setDialogoEgresoAbierto}>
|
||||
<DialogTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
<Button
|
||||
variant="outline"
|
||||
className="whitespace-nowrap"
|
||||
onClick={() => abrirDialogoEgreso(internacion)}
|
||||
>
|
||||
@@ -387,14 +386,14 @@ export function Internaciones({
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label>Paciente</Label>
|
||||
<Input
|
||||
<Input
|
||||
value={paciente ? `${paciente.apellido}, ${paciente.nombre}` : ''}
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label>Fecha de Egreso *</Label>
|
||||
<Input
|
||||
<Input
|
||||
type="date"
|
||||
value={fechaEgreso}
|
||||
onChange={(e) => setFechaEgreso(e.target.value)}
|
||||
@@ -425,13 +424,13 @@ export function Internaciones({
|
||||
/>
|
||||
</div>
|
||||
<Button variant="outline"
|
||||
className="w-full"
|
||||
onClick={handleFinalizarInternacion}
|
||||
disabled={!fechaEgreso || !diagnosticoEgreso || !motivoEgreso}
|
||||
>
|
||||
<CheckCircle2 className="h-4 w-4 mr-2" />
|
||||
Confirmar Egreso
|
||||
</Button>
|
||||
className="w-full"
|
||||
onClick={handleFinalizarInternacion}
|
||||
disabled={!fechaEgreso || !diagnosticoEgreso || !motivoEgreso}
|
||||
>
|
||||
<CheckCircle2 className="h-4 w-4 mr-2" />
|
||||
Confirmar Egreso
|
||||
</Button>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
@@ -450,8 +449,8 @@ export function Internaciones({
|
||||
<div className="text-center py-12 text-gray-400">
|
||||
<ClipboardList className="h-16 w-16 mx-auto mb-4 opacity-50" />
|
||||
<p className="text-lg">
|
||||
{busqueda || filtroEstado !== 'todas'
|
||||
? 'No se encontraron internaciones con esos filtros'
|
||||
{busqueda || filtroEstado !== 'todas'
|
||||
? 'No se encontraron internaciones con esos filtros'
|
||||
: 'No hay internaciones registradas'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user