diff --git a/server/server.js b/server/server.js index 6447bcb..9bb16d8 100644 --- a/server/server.js +++ b/server/server.js @@ -211,7 +211,6 @@ app.put('/api/state', (req, res) => { run('DELETE FROM evoluciones'); run('DELETE FROM acidosbase'); run('DELETE FROM cultivos'); - run('DELETE FROM laboratoriumes'); run('DELETE FROM laboratorios'); run('DELETE FROM internaciones'); run('DELETE FROM camas'); @@ -254,22 +253,22 @@ app.put('/api/state', (req, res) => { } } - if (state.laboratorios?.length) { +if (state.laboratorios?.length) { const stmt = db.prepare('INSERT INTO laboratorios (id, pacienteId, fecha, tipo, resultados, observaciones) VALUES (?, ?, ?, ?, ?, ?)'); for (const l of state.laboratorios) { stmt.run(l.id, l.pacienteId, l.fecha, l.tipo, JSON.stringify(l.resultados), l.observaciones); } } -if (state.acidosBase?.length) { - const stmt = db.prepare('INSERT INTO acidosbase (id, pacienteId, fecha, hora, ph, pco2, po2, hco3, be, sato2, lactato, interpretacion, fio2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + if (state.acidosBase?.length) { + const stmt = db.prepare('INSERT INTO acidosbase (id, pacienteId, fecha, hora, ph, pco2, po2, hco3, be, sato2, lactato, interpretacion, fio2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); for (const a of state.acidosBase) { stmt.run(a.id, a.pacienteId, a.fecha, a.hora, a.ph, a.pco2, a.po2, a.hco3, a.be, a.sato2, a.lactato || null, a.interpretacion || null, a.fio2 || null); } } -if (state.cultivos?.length) { - const stmt = db.prepare('INSERT INTO cultivos (id, pacienteId, internacionId, fechaToma, protocolo, tipoMuestra, observaciones, estado, fechaResultado, germen, sensible, resistente) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + if (state.cultivos?.length) { + const stmt = db.prepare('INSERT INTO cultivos (id, pacienteId, internacionId, fechaToma, protocolo, tipoMuestra, observaciones, estado, fechaResultado, germen, sensible, resistente) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); for (const c of state.cultivos) { stmt.run(c.id, c.pacienteId, c.internacionId, c.fechaToma, c.protocolo, c.tipoMuestra, c.observaciones, c.estado, c.fechaResultado, c.germen, c.sensible, c.resistente); }