Update Indicaciones: new types PHP, Paralelo, Alterno with dual plans
This commit is contained in:
@@ -26,15 +26,17 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
const [frecuenciaHoras, setFrecuenciaHoras] = useState<number | ''>('');
|
||||
const [via, setVia] = useState<ViaAdministracion>('EV');
|
||||
const [descripcion, setDescripcion] = useState('');
|
||||
const [tipoPlan, setTipoPlan] = useState<TipoPlanHidratacion>('SolucionFisiologica09');
|
||||
const [tipoPlan, setTipoPlan] = useState<TipoPlanHidratacion>('SF 0.9%');
|
||||
const [tipoPlan2, setTipoPlan2] = useState<TipoPlanHidratacion>('Ringer Lactato');
|
||||
const [cantidadMl, setCantidadMl] = useState<number | ''>('');
|
||||
const [cantidadMl2, setCantidadMl2] = useState<number | ''>('');
|
||||
const [tiempoHoras, setTiempoHoras] = useState<number | ''>(24);
|
||||
const [medico, setMedico] = useState('');
|
||||
const [showHistorial, setShowHistorial] = useState(false);
|
||||
|
||||
const vias: ViaAdministracion[] = ['Oral', 'EV', 'IM', 'SC', 'PorGGT', 'PorSNG'];
|
||||
const planes: TipoPlanHidratacion[] = ['SolucionFisiologica09', 'Dextrosa5', 'Dextrosa10', 'Dextrosa25', 'RingerLactato'];
|
||||
const tipos: IndicacionTipo[] = ['Farmacologica', 'NoFarmacologica', 'Hidratacion'];
|
||||
const vias: ViaAdministracion[] = ['Oral', 'EV', 'IM', 'SC', 'Por GGT', 'Por SNG'];
|
||||
const planes: TipoPlanHidratacion[] = ['SF 0.9%', 'Dextrosa 5%', 'Dextrosa 10%', 'Dextrosa 25%', 'Ringer Lactato'];
|
||||
const tipos: IndicacionTipo[] = ['Farmacologica', 'No Farmacologica', 'PHP', 'Paralelo', 'Alterno'];
|
||||
|
||||
const reset = () => {
|
||||
setEdit(null);
|
||||
@@ -44,8 +46,10 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
setFrecuenciaHoras('');
|
||||
setVia('EV');
|
||||
setDescripcion('');
|
||||
setTipoPlan('SolucionFisiologica09');
|
||||
setTipoPlan('SF 0.9%');
|
||||
setTipoPlan2('Ringer Lactato');
|
||||
setCantidadMl('');
|
||||
setCantidadMl2('');
|
||||
setTiempoHoras(24);
|
||||
setMedico('');
|
||||
};
|
||||
@@ -58,8 +62,10 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
setFrecuenciaHoras(i.frecuenciaHoras || '');
|
||||
setVia(i.via || 'EV');
|
||||
setDescripcion(i.descripcion || '');
|
||||
setTipoPlan(i.tipoPlan || 'SolucionFisiologica09');
|
||||
setTipoPlan(i.tipoPlan || 'SF 0.9%');
|
||||
setTipoPlan2(i.tipoPlan2 || 'Ringer Lactato');
|
||||
setCantidadMl(i.cantidadMl || '');
|
||||
setCantidadMl2(i.cantidadMl2 || '');
|
||||
setTiempoHoras(i.tiempoHoras || 24);
|
||||
setMedico(i.medicoCrea);
|
||||
setDialog(true);
|
||||
@@ -68,8 +74,9 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
const handleGuardar = () => {
|
||||
if (!medico.trim()) return;
|
||||
if (tipo === 'Farmacologica' && (!droga.trim() || !dosis.trim())) return;
|
||||
if (tipo === 'NoFarmacologica' && !descripcion.trim()) return;
|
||||
if (tipo === 'Hidratacion' && !cantidadMl) return;
|
||||
if (tipo === 'No Farmacologica' && !descripcion.trim()) return;
|
||||
if ((tipo === 'PHP' || tipo === 'Paralelo') && !cantidadMl) return;
|
||||
if (tipo === 'Alterno' && (!cantidadMl || !cantidadMl2)) return;
|
||||
|
||||
const data: any = {
|
||||
internacionId,
|
||||
@@ -84,12 +91,18 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
data.dosis = dosis;
|
||||
data.frecuenciaHoras = frecuenciaHoras || undefined;
|
||||
data.via = via;
|
||||
} else if (tipo === 'NoFarmacologica') {
|
||||
} else if (tipo === 'No Farmacologica') {
|
||||
data.descripcion = descripcion;
|
||||
} else {
|
||||
} else if (tipo === 'PHP' || tipo === 'Paralelo') {
|
||||
data.tipoPlan = tipoPlan;
|
||||
data.cantidadMl = cantidadMl;
|
||||
data.tiempoHoras = tiempoHoras;
|
||||
} else if (tipo === 'Alterno') {
|
||||
data.tipoPlan = tipoPlan;
|
||||
data.cantidadMl = cantidadMl;
|
||||
data.tipoPlan2 = tipoPlan2;
|
||||
data.cantidadMl2 = cantidadMl2;
|
||||
data.tiempoHoras = tiempoHoras;
|
||||
}
|
||||
|
||||
if (edit) {
|
||||
@@ -156,11 +169,11 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
</>
|
||||
)}
|
||||
|
||||
{tipo === 'NoFarmacologica' && (
|
||||
<div><Label>Descripción *</Label><textarea className="w-full p-2 border rounded-md text-sm min-h-[80px] bg-transparent dark:bg-input/30" value={descripcion} onChange={e => setDescripcion(e.target.value)} placeholder="Ej: Control de signos vitales cada 4hs, Dieta blanda, etc." /></div>
|
||||
{tipo === 'No Farmacologica' && (
|
||||
<div><Label>Descripción *</Label><textarea className="w-full p-2 border rounded-md text-sm min-h-[80px] bg-transparent dark:bg-input/30" value={descripcion} onChange={e => setDescripcion(e.target.value)} placeholder="Ej: Control de signos vitales, Dieta, etc." /></div>
|
||||
)}
|
||||
|
||||
{tipo === 'Hidratacion' && (
|
||||
{(tipo === 'PHP' || tipo === 'Paralelo') && (
|
||||
<>
|
||||
<div><Label>Tipo de Plan</Label><Select value={tipoPlan} onValueChange={(v: TipoPlanHidratacion) => setTipoPlan(v)}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent>{planes.map(p => <SelectItem key={p} value={p}>{p}</SelectItem>)}</SelectContent></Select></div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
@@ -169,6 +182,20 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{tipo === 'Alterno' && (
|
||||
<>
|
||||
<div><Label>Plan 1</Label><Select value={tipoPlan} onValueChange={(v: TipoPlanHidratacion) => setTipoPlan(v)}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent>{planes.map(p => <SelectItem key={p} value={p}>{p}</SelectItem>)}</SelectContent></Select></div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><Label>Cantidad Plan 1 (ml) *</Label><Input type="number" value={cantidadMl} onChange={e => setCantidadMl(e.target.value ? parseInt(e.target.value) : '')} placeholder="ml" /></div>
|
||||
</div>
|
||||
<div><Label>Plan 2</Label><Select value={tipoPlan2} onValueChange={(v: TipoPlanHidratacion) => setTipoPlan2(v)}><SelectTrigger><SelectValue /></SelectTrigger><SelectContent>{planes.map(p => <SelectItem key={p} value={p}>{p}</SelectItem>)}</SelectContent></Select></div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div><Label>Cantidad Plan 2 (ml) *</Label><Input type="number" value={cantidadMl2} onChange={e => setCantidadMl2(e.target.value ? parseInt(e.target.value) : '')} placeholder="ml" /></div>
|
||||
<div><Label>Tiempo Total (hs)</Label><Input type="number" value={tiempoHoras} onChange={e => setTiempoHoras(e.target.value ? parseInt(e.target.value) : 24)} placeholder="24" /></div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex justify-end gap-2 mt-4">
|
||||
<Button variant="outline" onClick={() => setDialog(false)}><X className="h-4 w-4 mr-2" />Cancelar</Button>
|
||||
@@ -192,12 +219,15 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
{ind.tipo === 'Farmacologica' && (
|
||||
<div className="font-medium">{ind.droga} {ind.dosis} {ind.via && `(${ind.via})`} {ind.frecuenciaHoras && `c/${ind.frecuenciaHoras}hs`}</div>
|
||||
)}
|
||||
{ind.tipo === 'NoFarmacologica' && (
|
||||
{ind.tipo === 'No Farmacologica' && (
|
||||
<div className="font-medium">{ind.descripcion}</div>
|
||||
)}
|
||||
{ind.tipo === 'Hidratacion' && (
|
||||
{(ind.tipo === 'PHP' || ind.tipo === 'Paralelo') && (
|
||||
<div className="font-medium">{ind.tipoPlan} {ind.cantidadMl}ml en {ind.tiempoHoras}hs</div>
|
||||
)}
|
||||
{ind.tipo === 'Alterno' && (
|
||||
<div className="font-medium">{ind.tipoPlan} {ind.cantidadMl}ml + {ind.tipoPlan2} {ind.cantidadMl2}ml en {ind.tiempoHoras}hs</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-1">
|
||||
<Button size="sm" variant="outline" className="text-orange-600" onClick={() => {
|
||||
@@ -225,10 +255,10 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>Fecha Indicación</TableHead>
|
||||
<TableHead>Fecha</TableHead>
|
||||
<TableHead>Indicado por</TableHead>
|
||||
<TableHead>Fecha Suspensión</TableHead>
|
||||
<TableHead>Médico</TableHead>
|
||||
<TableHead>Suspenso Por</TableHead>
|
||||
<TableHead>Suspendido por</TableHead>
|
||||
<TableHead>Indicación</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -236,13 +266,14 @@ export function SeccionIndicaciones({ recomendaciones, internacionId, add, updat
|
||||
{historial.map(ind => (
|
||||
<TableRow key={ind.id}>
|
||||
<TableCell>{ind.fechaCrea}</TableCell>
|
||||
<TableCell>{ind.fechaSuspension}</TableCell>
|
||||
<TableCell>{ind.medicoCrea}</TableCell>
|
||||
<TableCell>{ind.fechaSuspension}</TableCell>
|
||||
<TableCell>{ind.medicoSuspende}</TableCell>
|
||||
<TableCell>
|
||||
{ind.tipo === 'Farmacologica' && `${ind.droga} ${ind.dosis}`}
|
||||
{ind.tipo === 'NoFarmacologica' && ind.descripcion}
|
||||
{ind.tipo === 'Hidratacion' && `${ind.tipoPlan} ${ind.cantidadMl}ml`}
|
||||
{ind.tipo === 'No Farmacologica' && ind.descripcion}
|
||||
{(ind.tipo === 'PHP' || ind.tipo === 'Paralelo') && `${ind.tipoPlan} ${ind.cantidadMl}ml`}
|
||||
{ind.tipo === 'Alterno' && `${ind.tipoPlan} ${ind.cantidadMl}ml + ${ind.tipoPlan2} ${ind.cantidadMl2}ml`}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user