From 8eea3ef86f8cc8b1c0e789c9923e4a5427175a00 Mon Sep 17 00:00:00 2001 From: ma7payne Date: Thu, 12 Mar 2026 10:36:34 -0300 Subject: [PATCH 1/2] feat(REC): implementa carga de medicamentos magistrales --- .../elementos/recetaMedica.component.ts | 45 ++++++++++++++++--- .../components/elementos/recetaMedica.html | 26 ++++++++--- .../rup/components/huds/vistaReceta.html | 6 +++ src/app/services/receta.service.ts | 4 ++ 4 files changed, 69 insertions(+), 12 deletions(-) diff --git a/src/app/modules/rup/components/elementos/recetaMedica.component.ts b/src/app/modules/rup/components/elementos/recetaMedica.component.ts index 3280821edc..a830a1f412 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.component.ts +++ b/src/app/modules/rup/components/elementos/recetaMedica.component.ts @@ -27,6 +27,7 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha tiempoTratamiento: null, serie: null, numero: null, + esMagistral: false, dosisDiaria: { dosis: null, frecuencia: null, @@ -118,17 +119,39 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha @Unsubscribe() loadMedicamentoGenerico(event) { const input = event.query; - if (input && input.length > 2 && this.eclMedicamentos) { - const query: any = { - expression: this.eclMedicamentos.valor, - search: input - }; - this.snomedService.get(query).subscribe(event.callback); + if (input && input.length > 2) { + if (this.medicamento.esMagistral) { + this.recetasService.getInsumos({ termino: input }).subscribe(insumos => { + const mappedInsumos = insumos.map(i => { + return { + ...i, + term: i.nombre, + conceptId: i.id + }; + }); + event.callback(mappedInsumos); + }); + } else if (this.eclMedicamentos) { + const query = { + expression: this.eclMedicamentos.valor, + search: input + }; + this.snomedService.get(query).subscribe(event.callback); + } else { + event.callback([]); + } } else { event.callback([]); } } + onChangeMagistral() { + this.medicamento.generico = null; + this.medicamento.presentacion = null; + this.unidades = []; + this.deshacerCantidadManual(); + } + loadRegistros() { this.registros = [ ...this.prestacion.ejecucion.registros @@ -142,9 +165,16 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha loadPresentaciones() { this.deshacerCantidadManual(); this.loading = true; - this.medicamento.cantidad = null; this.medicamento.presentacion = null; this.medicamento.cantEnvases = null; + + if (this.medicamento.esMagistral) { + this.unidades = []; + this.ingresoCantidadManual = true; + this.loading = false; + return; + } + if (this.medicamento.generico && this.eclPresentaciones && this.eclMedicamentosComerciales) { const queryPresentacion: any = { expression: this.eclPresentaciones.valor.replace('#MG#', this.medicamento.generico.conceptId), @@ -279,6 +309,7 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha tiempoTratamiento: null, serie: null, numero: null, + esMagistral: false, dosisDiaria: { frecuencia: null, dias: null, diff --git a/src/app/modules/rup/components/elementos/recetaMedica.html b/src/app/modules/rup/components/elementos/recetaMedica.html index 3d76d87231..67cd2bd48d 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.html +++ b/src/app/modules/rup/components/elementos/recetaMedica.html @@ -37,10 +37,20 @@ +
+ + +
- + + +
@@ -143,11 +153,14 @@ - {{ truncateDiagnostico(item.diagnostico.term) }} + + Fórmula Magistral + Tratamiento prolongado {{item.tipoReceta}} @@ -161,11 +174,14 @@
{{alerta}}
- {{ truncateDiagnostico(item.diagnostico.term) }} + + Fórmula Magistral + Tratamiento prolongado {{item.tipoReceta}} diff --git a/src/app/modules/rup/components/huds/vistaReceta.html b/src/app/modules/rup/components/huds/vistaReceta.html index 5d158b1fc1..f1000cf5d1 100644 --- a/src/app/modules/rup/components/huds/vistaReceta.html +++ b/src/app/modules/rup/components/huds/vistaReceta.html @@ -15,6 +15,9 @@ {{ recetaPrincipal.medicamento.tipoReceta }} + + Fórmula Magistral +
{{ recetaPrincipal.medicamento.concepto.term }}

@@ -157,6 +160,9 @@ {{ receta.estadoDispensaActual.tipo.replace('-', ' ') }} + + Fórmula Magistral + diff --git a/src/app/services/receta.service.ts b/src/app/services/receta.service.ts index d1ca59e70b..718f9ea000 100644 --- a/src/app/services/receta.service.ts +++ b/src/app/services/receta.service.ts @@ -21,6 +21,10 @@ export class RecetaService { return this.server.get(this.url, { params }); } + getInsumos(params): Observable { + return this.server.get('/modules/insumos', { params }); + } + getMotivosSuspension() { return this.server.get(`${this.url}/motivos`); } From 19cb1df6826a6a500a1a511d8f9c6d43f3bf5fe5 Mon Sep 17 00:00:00 2001 From: aldoEMatamala Date: Tue, 19 May 2026 15:34:16 -0300 Subject: [PATCH 2/2] feat(REC-238): Andes: Revisar la carga de medicamentos magistrales --- .../elementos/recetaMedica.component.ts | 2 +- .../rup/components/elementos/recetaMedica.html | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/modules/rup/components/elementos/recetaMedica.component.ts b/src/app/modules/rup/components/elementos/recetaMedica.component.ts index a830a1f412..ca34bf01f9 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.component.ts +++ b/src/app/modules/rup/components/elementos/recetaMedica.component.ts @@ -121,7 +121,7 @@ export class RecetaMedicaComponent extends RUPComponent implements OnInit, OnCha const input = event.query; if (input && input.length > 2) { if (this.medicamento.esMagistral) { - this.recetasService.getInsumos({ termino: input }).subscribe(insumos => { + this.recetasService.getInsumos({ termino: input, tipo: 'magistral' }).subscribe(insumos => { const mappedInsumos = insumos.map(i => { return { ...i, diff --git a/src/app/modules/rup/components/elementos/recetaMedica.html b/src/app/modules/rup/components/elementos/recetaMedica.html index 67cd2bd48d..344c20782f 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.html +++ b/src/app/modules/rup/components/elementos/recetaMedica.html @@ -60,8 +60,13 @@ [disabled]="!unidades?.length || ingresoCantidadManual" (change)="onChange($event)"> - + + + - + {{ truncateDiagnostico(item.diagnostico.term) }} @@ -174,8 +178,7 @@

{{alerta}}
- + {{ truncateDiagnostico(item.diagnostico.term) }}