+
diff --git a/src/types/index.ts b/src/types/index.ts
index 8b98d76..78b69e4 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -119,6 +119,15 @@ export interface ResultadoLaboratorio {
estado: 'Normal' | 'Alto' | 'Bajo' | 'Crítico';
}
+export interface OtroLaboratorio {
+ id: string;
+ pacienteId: string;
+ internacionId?: string;
+ fecha: string;
+ hora?: string;
+ observaciones: string;
+}
+
export interface Glucemia {
id: string;
pacienteId: string;
diff --git a/update_hc.cjs b/update_hc.cjs
new file mode 100644
index 0000000..712b5bc
--- /dev/null
+++ b/update_hc.cjs
@@ -0,0 +1,79 @@
+const fs = require('fs');
+let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8');
+
+// 1. Update imports
+code = code.replace("EstudioComplementario, Interconsulta, ATB, Indicacion, MovimientoIndicacion, Pendiente } from '@/types';", "EstudioComplementario, Interconsulta, ATB, Indicacion, MovimientoIndicacion, Pendiente, OtroLaboratorio } from '@/types';");
+
+// 2. Destructure in component
+const destructureRegex = /const \{[\s\S]*?\} = useHospitalStore\(\);/;
+const destructuredMatch = code.match(destructureRegex);
+if (destructuredMatch) {
+ let newDestructure = destructuredMatch[0].replace(
+ "laboratorios,",
+ "laboratorios, otrosLaboratorios, agregarOtroLaboratorio, actualizarOtroLaboratorio, eliminarOtroLaboratorio,"
+ );
+ code = code.replace(destructuredMatch[0], newDestructure);
+}
+
+// 3. Update SeccionLaboratorios props in main render
+code = code.replace(
+ /
/,
+ `
`
+);
+
+// 4. In `handleImportarLaboratorio` (we need to change how observations are saved)
+// Find the exact handleImportarLaboratorio function
+const handleImportarMatch = code.match(/const handleImportarLaboratorio = \(\) => \{[\s\S]*?setImportHora\(new Date\(\)\.toTimeString\(\)\.slice\(0, 5\)\);\s*\};/);
+if (handleImportarMatch) {
+ const newImport = `const handleImportarLaboratorio = () => {
+ if (!addAcidoBase) return;
+ if (importResultados.length === 0 && !importObservaciones && !importAcidoBase) return;
+
+ if (importAcidoBase) {
+ addAcidoBase({ ...importAcidoBase, pacienteId: patientId, internacionId, fecha: importFecha, hora: importHora });
+ }
+
+ if (importResultados.length > 0) {
+ add({
+ pacienteId: patientId,
+ internacionId,
+ fecha: importFecha,
+ hora: importHora,
+ resultados: importResultados,
+ });
+ }
+
+ if (importObservaciones && importObservaciones.trim() !== '') {
+ agregarOtroLaboratorio({
+ pacienteId: patientId,
+ internacionId,
+ fecha: importFecha,
+ hora: importHora,
+ observaciones: importObservaciones
+ });
+ }
+
+ setImportDialog(false);
+ setImportTexto('');
+ setImportResultados([]);
+ setImportObservaciones('');
+ setImportAcidoBase(null);
+ setImportFecha(getLocalToday());
+ setImportHora(new Date().toTimeString().slice(0, 5));
+ };`;
+ code = code.replace(handleImportarMatch[0], newImport);
+}
+
+fs.writeFileSync('src/sections/HistoriaClinica.tsx', code);
diff --git a/update_otros.cjs b/update_otros.cjs
new file mode 100644
index 0000000..adc98f9
--- /dev/null
+++ b/update_otros.cjs
@@ -0,0 +1,110 @@
+const fs = require('fs');
+let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8');
+
+// Add states for new OtroLaboratorio
+const newStates = `
+ const [otrosDialog, setOtrosDialog] = useState(false);
+ const [nuevaObsFecha, setNuevaObsFecha] = useState(getLocalToday());
+ const [nuevaObsTexto, setNuevaObsTexto] = useState('');
+`;
+
+code = code.replace("const [otrosDialog, setOtrosDialog] = useState(false);", newStates);
+
+// Inside the portalNode or regular buttons, add "Otros" button.
+// But we already have the DropdownMenu. Let's just add the "Otros" button inside the `flex gap-2` where Importar is.
+const importBtnRegex = /