From ead841df6cd8529e32242df2231af379496f1757 Mon Sep 17 00:00:00 2001 From: AI Studio Date: Wed, 12 Aug 2026 20:39:53 +0000 Subject: [PATCH] chore: Eliminar scripts de transformacion temporales --- auto_portal.cjs | 137 ----------------------------------------- eslint.config.js | 23 ------- fix_atb.cjs | 24 -------- fix_buttons.cjs | 21 ------- fix_estudios.cjs | 46 -------------- fix_ic_atb.cjs | 26 -------- fix_pendientes.cjs | 38 ------------ fix_props.cjs | 22 ------- patch.cjs | 58 ----------------- patch.js | 39 ------------ patch2.cjs | 45 -------------- patch_app.cjs | 10 --- patch_db.cjs | 109 -------------------------------- patch_dirname.cjs | 10 --- patch_dirname_fix.cjs | 9 --- patch_index.cjs | 40 ------------ patch_schema.cjs | 31 ---------- patch_store.cjs | 21 ------- patch_store_update.cjs | 13 ---- patch_utils.cjs | 16 ----- postcss.config.js | 6 -- tailwind.config.js | 84 ------------------------- update_buttons.cjs | 92 --------------------------- update_glucemias.cjs | 37 ----------- 24 files changed, 957 deletions(-) delete mode 100644 auto_portal.cjs delete mode 100644 eslint.config.js delete mode 100644 fix_atb.cjs delete mode 100644 fix_buttons.cjs delete mode 100644 fix_estudios.cjs delete mode 100644 fix_ic_atb.cjs delete mode 100644 fix_pendientes.cjs delete mode 100644 fix_props.cjs delete mode 100644 patch.cjs delete mode 100644 patch.js delete mode 100644 patch2.cjs delete mode 100644 patch_app.cjs delete mode 100644 patch_db.cjs delete mode 100644 patch_dirname.cjs delete mode 100644 patch_dirname_fix.cjs delete mode 100644 patch_index.cjs delete mode 100644 patch_schema.cjs delete mode 100644 patch_store.cjs delete mode 100644 patch_store_update.cjs delete mode 100644 patch_utils.cjs delete mode 100644 postcss.config.js delete mode 100644 tailwind.config.js delete mode 100644 update_buttons.cjs delete mode 100644 update_glucemias.cjs diff --git a/auto_portal.cjs b/auto_portal.cjs deleted file mode 100644 index f1277d6..0000000 --- a/auto_portal.cjs +++ /dev/null @@ -1,137 +0,0 @@ -const fs = require('fs'); - -const patterns = [ - { - // Glucemias - find: `
\n
\n {canEdit && (\n \n )}\n \n
\n
`, - replace: `{portalNode ? createPortal(\n <>\n {canEdit && (\n \n )}\n \n ,\n portalNode\n ) : (\n
\n
\n {canEdit && (\n \n )}\n \n
\n
\n )}` - }, - { - // Laboratorios - find: `
\n {canEdit && }\n setSearchTerm(e.target.value)} className="max-w-xs" />\n
`, - replace: ` - {portalNode ? createPortal( - <> - {canEdit && } - setSearchTerm(e.target.value)} className="max-w-[150px] h-9" /> - , - portalNode - ) : ( -
- {canEdit && } - setSearchTerm(e.target.value)} className="max-w-xs" /> -
- )} - `.trim() - }, - { - // Evoluciones - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // EAB - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // Cultivos - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // Estudios - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // Interconsultas - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // ATB - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - }, - { - // Pendientes - find: `
\n {canEdit && }\n
`, - replace: ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} - `.trim() - } -]; - -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -for (let p of patterns) { - if (code.includes(p.find)) { - code = code.replace(p.find, p.replace); - } else { - console.log("NOT FOUND:", p.find.substring(0, 50)); - } -} - -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code); diff --git a/eslint.config.js b/eslint.config.js deleted file mode 100644 index 5e6b472..0000000 --- a/eslint.config.js +++ /dev/null @@ -1,23 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { defineConfig, globalIgnores } from 'eslint/config' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - js.configs.recommended, - tseslint.configs.recommended, - reactHooks.configs.flat.recommended, - reactRefresh.configs.vite, - ], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - }, -]) diff --git a/fix_atb.cjs b/fix_atb.cjs deleted file mode 100644 index efd89ac..0000000 --- a/fix_atb.cjs +++ /dev/null @@ -1,24 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -const repl = ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} -`.trim(); - -code = code.replace( - /
\s*\{canEdit && ` and `` - - // A more robust approach: - // Instead of replacing the JSX, let's just create a string replacement loop for known patterns. - code = code.replace( - /
\s*(\{canEdit && } -
- -
- )} -`.trim(); - -code = code.replace(regex, repl); -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code); diff --git a/fix_ic_atb.cjs b/fix_ic_atb.cjs deleted file mode 100644 index b16f31d..0000000 --- a/fix_ic_atb.cjs +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -const replIC = ` - {portalNode ? createPortal( - canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )} -`.trim(); - -code = code.replace( - /
\s*\{canEdit && - {canEdit && ( - - )} - , - portalNode - ) : ( -
- - {canEdit && ( - - )} -
- )} -`.trim(); - -code = code.replace(regex, repl); -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code); diff --git a/fix_props.cjs b/fix_props.cjs deleted file mode 100644 index 8527426..0000000 --- a/fix_props.cjs +++ /dev/null @@ -1,22 +0,0 @@ -const fs = require('fs'); - -function fix(filename) { - let code = fs.readFileSync(filename, 'utf8'); - - // Fix duplicate portalNode - code = code.replace(/portalNode , portalNode/g, 'portalNode'); - - // Add type definition: replace `canEdit?: boolean;` with `canEdit?: boolean; portalNode?: HTMLDivElement | null;` - code = code.replace(/canEdit\?: boolean;/g, 'canEdit?: boolean;\n portalNode?: HTMLDivElement | null;'); - - // For SeccionPendientes which has `canEdit: boolean })` - code = code.replace(/canEdit: boolean \}\)/g, 'canEdit: boolean; portalNode?: HTMLDivElement | null; })'); - - // For SeccionIndicaciones (if it uses `canEdit?: boolean`) - - fs.writeFileSync(filename, code); -} - -fix('src/sections/HistoriaClinica.tsx'); -try { fix('src/sections/SeccionIndicaciones.tsx'); } catch(e){} - diff --git a/patch.cjs b/patch.cjs deleted file mode 100644 index f523d1f..0000000 --- a/patch.cjs +++ /dev/null @@ -1,58 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -code = code.replace("import { useState } from 'react';", "import { useState } from 'react';\nimport { createPortal } from 'react-dom';"); - -const portalState = "const [tabActivo, setTabActivo] = useState('evoluciones');\n const [portalNode, setPortalNode] = useState(null);"; -code = code.replace("const [tabActivo, setTabActivo] = useState('evoluciones');", portalState); - -const tabsListRegex = /([\s\S]*?)<\/ScrollArea>/; -const newTabsList = ` -
- - - -
-`; - -code = code.replace(tabsListRegex, newTabsList.trim()); - -// We also need to add portalNode={portalNode} to all SeccionXXX components -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); -code = code.replace(//g, ''); - -// Update signatures -function updateSignature(name) { - const regex = new RegExp(`function ${name}\\(\\{ (.*?)canEdit \\}: \\{([\\s\\S]*?)canEdit\\?: boolean;([\\s\\S]*?)\\}\\) \\{`, 'g'); - // Wait, some might not have canEdit?: boolean optional. -} -// Actually, it's easier to do this individually or just with a regex - -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code); diff --git a/patch.js b/patch.js deleted file mode 100644 index 44ab953..0000000 --- a/patch.js +++ /dev/null @@ -1,39 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -code = code.replace("import { useState } from 'react';", "import { useState } from 'react';\nimport { createPortal } from 'react-dom';"); - -const portalState = "const [tabActivo, setTabActivo] = useState('evoluciones');\n const [portalNode, setPortalNode] = useState(null);"; -code = code.replace("const [tabActivo, setTabActivo] = useState('evoluciones');", portalState); - -const tabsListRegex = /([\s\S]*?)<\/ScrollArea>/; -const newTabsList = ` -
- - - -
-`.trim(); - -code = code.replace(tabsListRegex, newTabsList); - -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code); diff --git a/patch2.cjs b/patch2.cjs deleted file mode 100644 index 86949f8..0000000 --- a/patch2.cjs +++ /dev/null @@ -1,45 +0,0 @@ -const fs = require('fs'); - -function processFile(filename) { - let code = fs.readFileSync(filename, 'utf8'); - - // Add import if not present - if (!code.includes("import { createPortal }")) { - code = code.replace("import { useState }", "import { useState } from 'react';\nimport { createPortal }"); - if (!code.includes("import { createPortal }")) { - code = "import { createPortal } from 'react-dom';\n" + code; - } - } - - // Update component signatures - const components = [ - 'SeccionGlucemias', 'SeccionLaboratorios', 'SeccionEvoluciones', - 'SeccionAcidosBase', 'SeccionCultivos', 'SeccionATB', - 'SeccionEstudiosComplementarios', 'SeccionInterconsultas', 'SeccionPendientes', - 'SeccionIndicaciones' - ]; - - components.forEach(name => { - // 1. Add portalNode to the destructured props - const regex1 = new RegExp(`function ${name}\\(\\{ (.*?) \\}: \\{`, 'g'); - code = code.replace(regex1, `function ${name}({ $1, portalNode }: {`); - - // Some don't have spaces around the brackets - const regex1b = new RegExp(`function ${name}\\(\\{(.*?)\\}: \\{`, 'g'); - code = code.replace(regex1b, `function ${name}({$1, portalNode}: {`); - - // 2. Add portalNode?: HTMLDivElement | null; to the type definition - // Usually ends with canEdit?: boolean; }) or canEdit: boolean }) - const regex2 = new RegExp(`(canEdit\\??: boolean;?\\s*)\\}\\)`, 'g'); - // Actually we can just find the end of the props type definition for that component. - // It's safer to just replace `canEdit` or something similar, but let's do a more robust approach. - }); - - fs.writeFileSync(filename, code); -} - -processFile('src/sections/HistoriaClinica.tsx'); -try { - processFile('src/sections/SeccionIndicaciones.tsx'); -} catch (e) {} - diff --git a/patch_app.cjs b/patch_app.cjs deleted file mode 100644 index 684241d..0000000 --- a/patch_app.cjs +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/App.tsx', 'utf8'); - -code = code.replace(/store\.getLaboratoriosByPaciente\(paciente\.id\)/g, 'store.getLaboratoriosByInternacion(internacion.id)'); -code = code.replace(/store\.getGlucemiasByPaciente\(paciente\.id\)/g, 'store.getGlucemiasByInternacion(internacion.id)'); -code = code.replace(/store\.getAcidosBaseByPaciente\(paciente\.id\)/g, 'store.getAcidosBaseByInternacion(internacion.id)'); -code = code.replace(/store\.getCultivosByPaciente\(paciente\.id\)/g, 'store.getCultivosByInternacion(internacion.id)'); -code = code.replace(/store\.estudiosComplementarios\.filter\(e => e\.pacienteId === paciente\.id\)/g, 'store.estudiosComplementarios.filter(e => e.internacionId === internacion.id)'); - -fs.writeFileSync('src/App.tsx', code); diff --git a/patch_db.cjs b/patch_db.cjs deleted file mode 100644 index 6ff9c70..0000000 --- a/patch_db.cjs +++ /dev/null @@ -1,109 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('server/db.js', 'utf8'); - -// Add computeSector function -const computeSectorCode = ` -function computeSector(numero) { - if (!numero) return 'En Área'; - const parts = String(numero).trim().split('-'); - if (parts.length === 0) return 'En Área'; - const salaStr = parts[0].trim(); - const salaNum = parseInt(salaStr, 10); - if (isNaN(salaNum)) return 'En Área'; - if (salaNum >= 300 && salaNum < 400 && salaNum % 2 !== 0) { - return 'Fuera de Área'; - } - if (salaNum >= 400 && salaNum < 500) { - return 'Fuera de Área'; - } - return 'En Área'; -} -`; - -// Find where to insert computeSector -code = code.replace("export function createCama(cama) {", computeSectorCode + "\nexport function createCama(cama) {"); - -// Update createCama -code = code.replace( - /export function createCama\(cama\) \{\s*const gId = cama.grupoId \|\| cama.areaId \|\| null;\s*db.prepare\('INSERT INTO camas \(id, numero, grupoId, areaId, tipo, estado, pacienteId, internacionId\) VALUES \(\?, \?, \?, \?, \?, \?, \?, \?\)'\)\.run\(cama.id, cama.numero, gId, gId, cama.tipo \|\| 'Estándar', cama.estado \|\| 'Disponible', cama.pacienteId \|\| null, cama.internacionId \|\| null\);\s*\}/, - `export function createCama(cama) { - const gId = cama.grupoId || cama.areaId || null; - const sector = computeSector(cama.numero); - db.prepare('INSERT INTO camas (id, numero, grupoId, areaId, tipo, estado, pacienteId, internacionId, sector) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)').run(cama.id, cama.numero, gId, gId, cama.tipo || 'Estándar', cama.estado || 'Disponible', cama.pacienteId || null, cama.internacionId || null, sector); -}` -); - -// Update updateCama -code = code.replace( - /export function updateCama\(id, updates\) \{[\s\S]*?if \(fields\.length > 0\) \{/, - `export function updateCama(id, updates) { - const fields = []; - const values = []; - - if (updates.numero !== undefined) { - fields.push('numero = ?'); - values.push(updates.numero); - fields.push('sector = ?'); - values.push(computeSector(updates.numero)); - } - if (updates.tipo !== undefined) { - fields.push('tipo = ?'); - values.push(updates.tipo); - } - if (updates.grupoId !== undefined) { - fields.push('grupoId = ?'); - values.push(updates.grupoId); - fields.push('areaId = ?'); - values.push(updates.grupoId); - } - if (updates.estado !== undefined) { - fields.push('estado = ?'); - values.push(updates.estado); - } - if (updates.pacienteId !== undefined) { - fields.push('pacienteId = ?'); - values.push(updates.pacienteId); - } - if (updates.internacionId !== undefined) { - fields.push('internacionId = ?'); - values.push(updates.internacionId); - } - - if (fields.length > 0) {` -); - -// Update table schema -code = code.replace( - /CREATE TABLE IF NOT EXISTS camas \(\s*id TEXT PRIMARY KEY,\s*numero TEXT NOT NULL,\s*grupoId TEXT,\s*areaId TEXT,\s*tipo TEXT DEFAULT 'Estándar',\s*estado TEXT DEFAULT 'Disponible',\s*pacienteId TEXT,\s*internacionId TEXT\s*\);/, - `CREATE TABLE IF NOT EXISTS camas ( - id TEXT PRIMARY KEY, - numero TEXT NOT NULL, - grupoId TEXT, - areaId TEXT, - tipo TEXT DEFAULT 'Estándar', - estado TEXT DEFAULT 'Disponible', - pacienteId TEXT, - internacionId TEXT, - sector TEXT DEFAULT 'En Área' - ); - try { - db.prepare("ALTER TABLE camas ADD COLUMN sector TEXT DEFAULT 'En Área'").run(); - } catch(e) {} - try { - // Initialize existing beds with their sector - const rows = db.prepare('SELECT id, numero FROM camas WHERE sector IS NULL OR sector = "En Área"').all(); - for (const row of rows) { - if (!row.numero) continue; - const salaStr = String(row.numero).trim().split('-')[0].trim(); - const salaNum = parseInt(salaStr, 10); - let s = 'En Área'; - if (!isNaN(salaNum)) { - if (salaNum >= 300 && salaNum < 400 && salaNum % 2 !== 0) s = 'Fuera de Área'; - else if (salaNum >= 400 && salaNum < 500) s = 'Fuera de Área'; - } - db.prepare('UPDATE camas SET sector = ? WHERE id = ?').run(s, row.id); - } - } catch(e) {}` -); - -fs.writeFileSync('server/db.js', code); diff --git a/patch_dirname.cjs b/patch_dirname.cjs deleted file mode 100644 index 94d591e..0000000 --- a/patch_dirname.cjs +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('server/db.js', 'utf8'); - -code = code.replace( - /const __dirname = dirname\(fileURLToPath\(import\.meta\.url\)\);/, - `const currentDir = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url));` -); -code = code.replace(/__dirname/g, "currentDir"); - -fs.writeFileSync('server/db.js', code); diff --git a/patch_dirname_fix.cjs b/patch_dirname_fix.cjs deleted file mode 100644 index 9c4eb28..0000000 --- a/patch_dirname_fix.cjs +++ /dev/null @@ -1,9 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('server/db.js', 'utf8'); - -code = code.replace( - /const currentDir = typeof currentDir !== 'undefined' \? currentDir : dirname\(fileURLToPath\(import\.meta\.url\)\);/, - `const currentDir = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url));` -); - -fs.writeFileSync('server/db.js', code); diff --git a/patch_index.cjs b/patch_index.cjs deleted file mode 100644 index 9b19a75..0000000 --- a/patch_index.cjs +++ /dev/null @@ -1,40 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('server/index.js', 'utf8'); - -const computeSectorCode = ` -function computeSector(numero) { - if (!numero) return 'En Área'; - const parts = String(numero).trim().split('-'); - if (parts.length === 0) return 'En Área'; - const salaStr = parts[0].trim(); - const salaNum = parseInt(salaStr, 10); - if (isNaN(salaNum)) return 'En Área'; - if (salaNum >= 300 && salaNum < 400 && salaNum % 2 !== 0) return 'Fuera de Área'; - if (salaNum >= 400 && salaNum < 500) return 'Fuera de Área'; - return 'En Área'; -} -`; - -// Insert computeSector somewhere at the top -code = code.replace("const PORT = process.env.PORT || 3000;", computeSectorCode + "\nconst PORT = process.env.PORT || 3000;"); - -code = code.replace( - /const stmt = db\.prepare\('INSERT OR IGNORE INTO camas \(id, numero, grupoId, areaId, tipo, estado\) VALUES \(\?, \?, \?, \?, \?, \?\)'\);\s*for \(const c of state\.camas\) \{\s*const gId = c\.grupoId \|\| c\.areaId \|\| null;\s*stmt\.run\(c\.id, c\.numero, gId, gId, c\.tipo, c\.estado\);\s*\}/, - `const stmt = db.prepare('INSERT OR IGNORE INTO camas (id, numero, grupoId, areaId, tipo, estado, sector) VALUES (?, ?, ?, ?, ?, ?, ?)'); - for (const c of state.camas) { - const gId = c.grupoId || c.areaId || null; - const sector = computeSector(c.numero); - stmt.run(c.id, c.numero, gId, gId, c.tipo, c.estado, sector); - }` -); - -code = code.replace( - /const stmt = db\.prepare\('INSERT INTO camas \(id, numero, areaId, tipo, estado\) VALUES \(\?, \?, \?, \?, \?\)'\);\s*for \(const c of updates\.camas\) \{\s*stmt\.run\(c\.id, c\.numero, c\.areaId, c\.tipo, c\.estado\);\s*\}/, - `const stmt = db.prepare('INSERT INTO camas (id, numero, grupoId, areaId, tipo, estado, sector) VALUES (?, ?, ?, ?, ?, ?, ?)'); - for (const c of updates.camas) { - const sector = computeSector(c.numero); - stmt.run(c.id, c.numero, c.grupoId || c.areaId || null, c.grupoId || c.areaId || null, c.tipo, c.estado, sector); - }` -); - -fs.writeFileSync('server/index.js', code); diff --git a/patch_schema.cjs b/patch_schema.cjs deleted file mode 100644 index d66c05f..0000000 --- a/patch_schema.cjs +++ /dev/null @@ -1,31 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('server/db.js', 'utf8'); - -code = code.replace( - / \);\n try \{\n db\.prepare\("ALTER TABLE camas ADD COLUMN sector TEXT DEFAULT 'En Área'"\)\.run\(\);\n \} catch\(e\) \{\}\n try \{\n \/\/ Initialize existing beds with their sector\n const rows = db\.prepare\('SELECT id, numero FROM camas WHERE sector IS NULL OR sector = "En Área"'\)\.all\(\);\n for \(const row of rows\) \{\n if \(\!row\.numero\) continue;\n const salaStr = String\(row\.numero\)\.trim\(\)\.split\('-'\)\[0\]\.trim\(\);\n const salaNum = parseInt\(salaStr, 10\);\n let s = 'En Área';\n if \(\!isNaN\(salaNum\)\) \{\n if \(salaNum >= 300 && salaNum < 400 && salaNum % 2 !== 0\) s = 'Fuera de Área';\n else if \(salaNum >= 400 && salaNum < 500\) s = 'Fuera de Área';\n \}\n db\.prepare\('UPDATE camas SET sector = \? WHERE id = \?'\)\.run\(s, row\.id\);\n \}\n \} catch\(e\) \{\}/, - ` );` -); - -code = code.replace( - /\/\/ Seed default 4 grupos if empty/, - `try { db.exec("ALTER TABLE camas ADD COLUMN sector TEXT DEFAULT 'En Área'"); } catch (_) {} - try { - // Initialize existing beds with their sector - const rows = db.prepare('SELECT id, numero FROM camas WHERE sector IS NULL OR sector = "En Área"').all(); - for (const row of rows) { - if (!row.numero) continue; - const salaStr = String(row.numero).trim().split('-')[0].trim(); - const salaNum = parseInt(salaStr, 10); - let s = 'En Área'; - if (!isNaN(salaNum)) { - if (salaNum >= 300 && salaNum < 400 && salaNum % 2 !== 0) s = 'Fuera de Área'; - else if (salaNum >= 400 && salaNum < 500) s = 'Fuera de Área'; - } - db.prepare('UPDATE camas SET sector = ? WHERE id = ?').run(s, row.id); - } - } catch(e) {} - - // Seed default 4 grupos if empty` -); - -fs.writeFileSync('server/db.js', code); diff --git a/patch_store.cjs b/patch_store.cjs deleted file mode 100644 index cd13112..0000000 --- a/patch_store.cjs +++ /dev/null @@ -1,21 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/hooks/useHospitalStore.ts', 'utf8'); - -code = code.replace(/getLaboratoriosByPaciente = useCallback\(\(pacienteId: string\)/g, 'getLaboratoriosByInternacion = useCallback((internacionId: string)'); -code = code.replace(/\.filter\(l => l\.pacienteId === pacienteId\)/g, '.filter(l => l.internacionId === internacionId)'); - -code = code.replace(/getGlucemiasByPaciente = useCallback\(\(pacienteId: string\)/g, 'getGlucemiasByInternacion = useCallback((internacionId: string)'); -code = code.replace(/\.filter\(g => g\.pacienteId === pacienteId\)/g, '.filter(g => g.internacionId === internacionId)'); - -code = code.replace(/getAcidosBaseByPaciente = useCallback\(\(pacienteId: string\)/g, 'getAcidosBaseByInternacion = useCallback((internacionId: string)'); -code = code.replace(/\.filter\(a => a\.pacienteId === pacienteId\)/g, '.filter(a => a.internacionId === internacionId)'); - -code = code.replace(/getCultivosByPaciente = useCallback\(\(pacienteId: string\)/g, 'getCultivosByInternacion = useCallback((internacionId: string)'); -code = code.replace(/\.filter\(c => c\.pacienteId === pacienteId\)/g, '.filter(c => c.internacionId === internacionId)'); - -code = code.replace(/getLaboratoriosByPaciente,/g, 'getLaboratoriosByInternacion,'); -code = code.replace(/getGlucemiasByPaciente,/g, 'getGlucemiasByInternacion,'); -code = code.replace(/getAcidosBaseByPaciente,/g, 'getAcidosBaseByInternacion,'); -code = code.replace(/getCultivosByPaciente,/g, 'getCultivosByInternacion,'); - -fs.writeFileSync('src/hooks/useHospitalStore.ts', code); diff --git a/patch_store_update.cjs b/patch_store_update.cjs deleted file mode 100644 index 70f68f6..0000000 --- a/patch_store_update.cjs +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/hooks/useHospitalStore.ts', 'utf8'); - -code = code.replace( - /try \{\s*await apiCall\('PUT', `\/camas\/\$\{id\}`/, - `try { - if (datos.numero !== undefined) { - datos.sector = computeSector(datos.numero); - } - await apiCall('PUT', \`/camas/\${id}\`` -); - -fs.writeFileSync('src/hooks/useHospitalStore.ts', code); diff --git a/patch_utils.cjs b/patch_utils.cjs deleted file mode 100644 index 9053c4f..0000000 --- a/patch_utils.cjs +++ /dev/null @@ -1,16 +0,0 @@ -const fs = require('fs'); -let code = fs.readFileSync('src/lib/utils.ts', 'utf8'); - -code = code.replace( - /export function isCamaFueraDeGrupo\([\s\S]*?return false;\n\}/, - `export function isCamaFueraDeGrupo( - cama: { numero: string; grupoId?: string; areaId?: string; sector?: string }, - gruposOrAreas?: { id: string; nombre: string }[] -): boolean { - if (cama.sector === 'Fuera de Área') return true; - if (cama.sector === 'En Área') return false; - return computeSector(cama.numero) === 'Fuera de Área'; -}` -); - -fs.writeFileSync('src/lib/utils.ts', code); diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 2e7af2b..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index cb8a316..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,84 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - darkMode: ["class"], - content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], - theme: { - extend: { - colors: { - border: "hsl(var(--border))", - input: "hsl(var(--input))", - ring: "hsl(var(--ring))", - background: "hsl(var(--background))", - foreground: "hsl(var(--foreground))", - primary: { - DEFAULT: "hsl(var(--primary))", - foreground: "hsl(var(--primary-foreground))", - }, - secondary: { - DEFAULT: "hsl(var(--secondary))", - foreground: "hsl(var(--secondary-foreground))", - }, - destructive: { - DEFAULT: "hsl(var(--destructive) / )", - foreground: "hsl(var(--destructive-foreground) / )", - }, - muted: { - DEFAULT: "hsl(var(--muted))", - foreground: "hsl(var(--muted-foreground))", - }, - accent: { - DEFAULT: "hsl(var(--accent))", - foreground: "hsl(var(--accent-foreground))", - }, - popover: { - DEFAULT: "hsl(var(--popover))", - foreground: "hsl(var(--popover-foreground))", - }, - card: { - DEFAULT: "hsl(var(--card))", - foreground: "hsl(var(--card-foreground))", - }, - sidebar: { - DEFAULT: "hsl(var(--sidebar-background))", - foreground: "hsl(var(--sidebar-foreground))", - primary: "hsl(var(--sidebar-primary))", - "primary-foreground": "hsl(var(--sidebar-primary-foreground))", - accent: "hsl(var(--sidebar-accent))", - "accent-foreground": "hsl(var(--sidebar-accent-foreground))", - border: "hsl(var(--sidebar-border))", - ring: "hsl(var(--sidebar-ring))", - }, - }, - borderRadius: { - xl: "calc(var(--radius) + 4px)", - lg: "var(--radius)", - md: "calc(var(--radius) - 2px)", - sm: "calc(var(--radius) - 4px)", - xs: "calc(var(--radius) - 6px)", - }, - boxShadow: { - xs: "0 1px 2px 0 rgb(0 0 0 / 0.05)", - }, - keyframes: { - "accordion-down": { - from: { height: "0" }, - to: { height: "var(--radix-accordion-content-height)" }, - }, - "accordion-up": { - from: { height: "var(--radix-accordion-content-height)" }, - to: { height: "0" }, - }, - "caret-blink": { - "0%,70%,100%": { opacity: "1" }, - "20%,50%": { opacity: "0" }, - }, - }, - animation: { - "accordion-down": "accordion-down 0.2s ease-out", - "accordion-up": "accordion-up 0.2s ease-out", - "caret-blink": "caret-blink 1.25s ease-out infinite", - }, - }, - }, - plugins: [require("tailwindcss-animate")], -} \ No newline at end of file diff --git a/update_buttons.cjs b/update_buttons.cjs deleted file mode 100644 index 8b33c2f..0000000 --- a/update_buttons.cjs +++ /dev/null @@ -1,92 +0,0 @@ -const fs = require('fs'); - -let hc = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -// Laboratorios -hc = hc.replace( - /
\s*\{canEdit && } - setSearchTerm(e.target.value)} className="max-w-xs" /> - , - portalNode - ) : ( -
- {canEdit && } - setSearchTerm(e.target.value)} className="max-w-xs" /> -
- )}` -); - -// General pattern for those inside `
` -const blocks = [ - 'Nueva Evolución', - 'Nueva Gasometría', - 'Nuevo Cultivo', - 'Nuevo Estudio', - 'Nueva Interconsulta', - 'Nuevo ATB' -]; - -blocks.forEach(text => { - const regex = new RegExp(`
\\s*\\{canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )}`); -}); - -// Pendientes -hc = hc.replace( - /
\s*\{canEdit && , - portalNode - ) : ( -
- {canEdit && } -
- )}` -); - -fs.writeFileSync('src/sections/HistoriaClinica.tsx', hc); - - -let si = fs.readFileSync('src/sections/SeccionIndicaciones.tsx', 'utf8'); - -// Also import createPortal -if (!si.includes("createPortal")) { - si = si.replace("import { useState }", "import { useState } from 'react';\nimport { createPortal }"); -} - -si = si.replace( - /
\s*\{canEdit && } - - , - portalNode - ) : ( -
- {canEdit && } - -
- )}` -); - -fs.writeFileSync('src/sections/SeccionIndicaciones.tsx', si); diff --git a/update_glucemias.cjs b/update_glucemias.cjs deleted file mode 100644 index c70ed81..0000000 --- a/update_glucemias.cjs +++ /dev/null @@ -1,37 +0,0 @@ -const fs = require('fs'); - -let code = fs.readFileSync('src/sections/HistoriaClinica.tsx', 'utf8'); - -const regex = /
\s*
\s*\{canEdit && \(\s* - )} - - , - portalNode - ) : ( -
-
- {canEdit && ( - - )} - -
-
- )} -`.trim(); - -code = code.replace(regex, replacement); -fs.writeFileSync('src/sections/HistoriaClinica.tsx', code);