paperclip-plugin-autopilot-ops 0.1.58 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/worker.js +8 -5
- package/package.json +1 -1
package/dist/manifest.js
CHANGED
package/dist/ui/index.js
CHANGED
package/dist/worker.js
CHANGED
|
@@ -39932,7 +39932,7 @@ function startWorkerRpcHost(options) {
|
|
|
39932
39932
|
|
|
39933
39933
|
// src/manifest.ts
|
|
39934
39934
|
var PLUGIN_ID = "alephoo.autopilot-ops";
|
|
39935
|
-
var PLUGIN_VERSION = "0.1.
|
|
39935
|
+
var PLUGIN_VERSION = "0.1.60";
|
|
39936
39936
|
var DB_NAMESPACE_SLUG = "autopilot_ops";
|
|
39937
39937
|
var PAGE_ROUTE = "autopilot";
|
|
39938
39938
|
var TOOL_NAMES = {
|
|
@@ -44468,7 +44468,7 @@ var HONORARIO_FIJO_MINIMO_PCT = 10;
|
|
|
44468
44468
|
var INSUMOS_A_VERIFICAR_PCT = 50;
|
|
44469
44469
|
function noEsPractica(l) {
|
|
44470
44470
|
if (l.honorarios.length > 0) return false;
|
|
44471
|
-
return /medicament|descartable|insumo|material|farmac/i.test(l.tipo ?? "") ||
|
|
44471
|
+
return /medicament|descartable|insumo|material|farmac|internaci|hoteler/i.test(l.tipo ?? "") || /(comprimid|ampolla|frasco|sachet|cateter|catéter|guantes?\b|jeringa|gasas?\b|capsula|cápsula|\d\s*(mg|mcg|ml|ui)\b|d[ií]as? (en )?cama|d[ií]a de internaci|pensi[oó]n|habitaci[oó]n)/i.test(l.nombre);
|
|
44472
44472
|
}
|
|
44473
44473
|
function leerLecturaRentabilidad(v) {
|
|
44474
44474
|
if (!v || typeof v !== "object" || Array.isArray(v)) return { error: "lectura: tiene que ser un objeto" };
|
|
@@ -45207,7 +45207,8 @@ ON CONFLICT (company_id) DO UPDATE SET bases = EXCLUDED.bases, practicas = EXCLU
|
|
|
45207
45207
|
);
|
|
45208
45208
|
return bases;
|
|
45209
45209
|
}
|
|
45210
|
-
async function guardarMediciones(ctx, companyId, items) {
|
|
45210
|
+
async function guardarMediciones(ctx, companyId, items, quitar = []) {
|
|
45211
|
+
for (const referencia of quitar) await ctx.db.execute(`DELETE FROM ${t3(ctx, "rentabilidad_medicion")} WHERE company_id = $1 AND referencia = $2`, [companyId, referencia]);
|
|
45211
45212
|
for (const { lectura: l, evaluacion } of items) {
|
|
45212
45213
|
await ctx.db.execute(
|
|
45213
45214
|
`INSERT INTO ${t3(ctx, "rentabilidad_medicion")} (company_id, referencia, codigo, practica, financiador, tipo, minutos, evaluacion, componentes, medido_el) VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9::jsonb, now())
|
|
@@ -45727,6 +45728,7 @@ async function evaluarRentabilidades(ctx, companyId, lecturas) {
|
|
|
45727
45728
|
const pedidos = await ultimosPedidos(ctx, companyId);
|
|
45728
45729
|
const medidas = [];
|
|
45729
45730
|
const resultados = [];
|
|
45731
|
+
const noSonPracticas = [];
|
|
45730
45732
|
for (const [indice, l] of leidas.entries()) {
|
|
45731
45733
|
if ("error" in l) {
|
|
45732
45734
|
resultados.push({ indice, error: l.error });
|
|
@@ -45735,7 +45737,8 @@ async function evaluarRentabilidades(ctx, companyId, lecturas) {
|
|
|
45735
45737
|
const evaluacion = evaluarConOpciones(l.lectura, hoy, opciones, bases);
|
|
45736
45738
|
const referencia = `rentabilidad:${l.lectura.prestacion_id}:${l.lectura.financiador_id}`;
|
|
45737
45739
|
const previa = anteriores.get(referencia);
|
|
45738
|
-
|
|
45740
|
+
if (evaluacion.no_es_practica) noSonPracticas.push(referencia);
|
|
45741
|
+
else await registrarCambiosHis(ctx, {
|
|
45739
45742
|
companyId,
|
|
45740
45743
|
referencia,
|
|
45741
45744
|
codigo: l.lectura.codigo,
|
|
@@ -45747,7 +45750,7 @@ async function evaluarRentabilidades(ctx, companyId, lecturas) {
|
|
|
45747
45750
|
const apertura = decidirApertura(evaluacion, pedidos.get(referencia) ?? null, hoy);
|
|
45748
45751
|
resultados.push({ clave: `${l.lectura.prestacion_id}:${l.lectura.financiador_id}`, referencia, codigo: l.lectura.codigo, practica: l.lectura.nombre, financiador: l.lectura.financiador, evaluacion, oracion: oracionRentabilidad(l.lectura, evaluacion), abrir: apertura.abrir, motivo_abrir: apertura.motivo });
|
|
45749
45752
|
}
|
|
45750
|
-
await guardarMediciones(ctx, companyId, medidas);
|
|
45753
|
+
await guardarMediciones(ctx, companyId, medidas, noSonPracticas);
|
|
45751
45754
|
return { resultados, opciones };
|
|
45752
45755
|
}
|
|
45753
45756
|
function enteroEntre2(v, min, max) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paperclip-plugin-autopilot-ops",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Autopilot Care · operación autónoma gobernada para instituciones de salud: workflows determinísticos, validaciones, registro de negocio, políticas (observa/propone/ejecuta/corte) y tablero del director, como plugin de Paperclip.",
|
|
6
6
|
"files": [
|