diff --git a/src/app/modules/rup/components/elementos/recetaMedica.component.ts b/src/app/modules/rup/components/elementos/recetaMedica.component.ts index 3280821edc..ca34bf01f9 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, tipo: 'magistral' }).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..344c20782f 100644 --- a/src/app/modules/rup/components/elementos/recetaMedica.html +++ b/src/app/modules/rup/components/elementos/recetaMedica.html @@ -37,10 +37,20 @@ +
+ + +
- + + +
@@ -50,8 +60,13 @@ [disabled]="!unidades?.length || ingresoCantidadManual" (change)="onChange($event)"> - + + + - + {{ truncateDiagnostico(item.diagnostico.term) }} + + Fórmula Magistral + Tratamiento prolongado {{item.tipoReceta}} @@ -161,11 +178,13 @@
{{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`); }