Add debug logging for internacion not found errors
This commit is contained in:
+22
-7
@@ -114,12 +114,24 @@ function AppContent() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case 'cultivos': {
|
case 'cultivos': {
|
||||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
const internacionId = store.currentInternacionId || '';
|
||||||
|
console.log('Cultivos - currentInternacionId:', internacionId);
|
||||||
|
const internacion = store.getInternacionById(internacionId);
|
||||||
|
console.log('Cultivos - internacion:', internacion);
|
||||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||||
if (!internacion || !paciente) {
|
console.log('Cultivos - paciente:', paciente);
|
||||||
|
if (!internacion) {
|
||||||
return (
|
return (
|
||||||
<div className="p-4 text-center">
|
<div className="p-4 text-center">
|
||||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||||
|
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!paciente) {
|
||||||
|
return (
|
||||||
|
<div className="p-4 text-center">
|
||||||
|
<p className="text-gray-500 dark:text-gray-400">Paciente no encontrado para internación</p>
|
||||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -137,12 +149,14 @@ function AppContent() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 'historiaclinica': {
|
case 'historiaclinica': {
|
||||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
const internacionId = store.currentInternacionId || '';
|
||||||
|
const internacion = store.getInternacionById(internacionId);
|
||||||
|
const { datosVitales, evoluciones, laboratorios, acidosBase, cultivos, estudios, interconsultas, atb, indicaciones } = store;
|
||||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||||
if (!internacion || !paciente) {
|
if (!internacion || !paciente) {
|
||||||
return (
|
return (
|
||||||
<div className="p-4 text-center">
|
<div className="p-4 text-center">
|
||||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -209,12 +223,13 @@ function AppContent() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
case 'editaringreso': {
|
case 'editaringreso': {
|
||||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
const internacionId = store.currentInternacionId || '';
|
||||||
|
const internacion = store.getInternacionById(internacionId);
|
||||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||||
if (!internacion || !paciente) {
|
if (!internacion || !paciente) {
|
||||||
return (
|
return (
|
||||||
<div className="p-4 text-center">
|
<div className="p-4 text-center">
|
||||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user