Migrate to MariaDB backend and fix bed management
- Switch from SQLite to MariaDB for database backend - Fix bed state updates on admission (iniciarInternacion) - Fix bed updates on admission edit (actualizarInternacion) - Fix bed updates on discharge (finalizarInternacion): delete if fuera de area, mark available otherwise - Fix NuevoIngreso to wait for cama creation before creating internacion - Fix patient undefined check in Cultivos - Update CORS to allow all origins - Remove unused files
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ function AppContent() {
|
||||
pacientes={store.pacientes}
|
||||
internaciones={store.internaciones}
|
||||
onActualizarCama={store.actualizarCama}
|
||||
onAgregarCama={store.agregarCama}
|
||||
onAgregarCama={store.agregarCama as any}
|
||||
onEliminarCama={store.eliminarCama}
|
||||
onIniciarInternacion={store.iniciarInternacion}
|
||||
getPacienteById={store.getPacienteById}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+554
-352
File diff suppressed because it is too large
Load Diff
@@ -107,7 +107,7 @@ export function Cultivos({
|
||||
};
|
||||
|
||||
const guardarNuevo = () => {
|
||||
if (!protocolo.trim()) return;
|
||||
if (!protocolo.trim() || !patient) return;
|
||||
onAgregarCultivo({
|
||||
pacienteId: patient.id,
|
||||
internacionId,
|
||||
|
||||
@@ -16,7 +16,7 @@ interface EditIngresoProps {
|
||||
camas: Cama[];
|
||||
areas: Area[];
|
||||
onActualizarInternacion: (id: string, datos: Partial<Internacion>) => void;
|
||||
onAgregarCama?: (cama: Omit<Cama, 'id'>) => string;
|
||||
onAgregarCama?: (cama: Omit<Cama, 'id'>) => any;
|
||||
onVolver: () => void;
|
||||
getAreaName: (areaId: string | undefined) => string;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ interface MapaCamasProps {
|
||||
pacientes: Paciente[];
|
||||
internaciones: Internacion[];
|
||||
onActualizarCama: (id: string, datos: Partial<Cama>) => void;
|
||||
onAgregarCama: (cama: Omit<Cama, 'id'>) => string;
|
||||
onAgregarCama: (cama: Omit<Cama, 'id'>) => any;
|
||||
onEliminarCama: (id: string) => void;
|
||||
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => void;
|
||||
onAgregarArea: (area: Omit<Area, 'id'>) => string;
|
||||
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => Promise<string>;
|
||||
onAgregarArea: (area: Omit<Area, 'id'>) => any;
|
||||
onActualizarArea: (id: string, datos: Partial<Area>) => void;
|
||||
onEliminarArea: (id: string) => void;
|
||||
getPacienteById: (id: string) => Paciente | undefined;
|
||||
|
||||
@@ -12,8 +12,8 @@ interface NuevoIngresoProps {
|
||||
pacientes: Paciente[];
|
||||
camas: Cama[];
|
||||
areas: Area[];
|
||||
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => void;
|
||||
onAgregarCama?: (cama: Omit<Cama, 'id'>) => string;
|
||||
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => Promise<string>;
|
||||
onAgregarCama?: (cama: Omit<Cama, 'id'>) => Promise<string>;
|
||||
onAgregarPaciente?: (paciente: Omit<Paciente, 'id'>) => void;
|
||||
onActualizarPaciente?: (id: string, datos: Partial<Paciente>) => void;
|
||||
onVolver: () => void;
|
||||
@@ -125,14 +125,19 @@ export function NuevoIngreso({ pacientes, camas, areas, onIniciarInternacion, on
|
||||
camaId = camaExistente.id;
|
||||
newAreaId = camaExistente.areaId || '';
|
||||
} else if (onAgregarCama) {
|
||||
const nuevaCamaId = onAgregarCama({
|
||||
numero: numeroCama,
|
||||
areaId: areaFueraDeAreaId,
|
||||
tipo: 'General',
|
||||
estado: 'Ocupada'
|
||||
});
|
||||
camaId = nuevaCamaId;
|
||||
newAreaId = areaFueraDeAreaId;
|
||||
try {
|
||||
camaId = await onAgregarCama({
|
||||
numero: numeroCama,
|
||||
areaId: areaFueraDeAreaId,
|
||||
tipo: 'General',
|
||||
estado: 'Ocupada'
|
||||
});
|
||||
newAreaId = areaFueraDeAreaId;
|
||||
} catch (err) {
|
||||
console.error('Error al crear cama:', err);
|
||||
alert('Error al crear la cama');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
alert('No se puede agregar una nueva cama');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user