Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { FileObject, FILE_EXT, IMAGENES_EXT, VIDEO_EXT } from '@andes/shared';
import { DriveService } from 'src/app/services/drive.service';
import { ConstantesService } from './../../../services/constantes.service';
import { SnomedService } from '../../../apps/mitos';
import { ECLQueriesService } from 'src/app/services/eclqueries.service';
import { switchMap } from 'rxjs';

@Component({
selector: 'form-nueva-solicitud',
Expand Down Expand Up @@ -76,6 +78,9 @@ export class FormNuevaSolicitudComponent implements OnInit {
dataReglasDestino = [];
dataReglasOrigen: { id: any; nombre: any }[];

public asociados: any[] = [];
public conceptosEcl: any[] = [];

constructor(
private plex: Plex,
private auth: Auth,
Expand All @@ -84,8 +89,8 @@ export class FormNuevaSolicitudComponent implements OnInit {
private servicioReglas: ReglaService,
private adjuntosService: AdjuntosService,
private driveService: DriveService,
private constantesService: ConstantesService,
private snomedService: SnomedService
private snomedService: SnomedService,
public eclqueriesServicies: ECLQueriesService
) { }

ngOnInit() {
Expand All @@ -98,14 +103,21 @@ export class FormNuevaSolicitudComponent implements OnInit {
this.adjuntosService.token$.subscribe((data: any) => {
this.fileToken = data.token;
});
this.constantesService.search({ source: 'solicitud:conceptosAsociados' }).subscribe(async (constantes) => {
if (constantes?.length) {
this.snomedService.get({
search: constantes[0].query
}).subscribe((resultados) => {
this.conceptosAsociados = [...resultados];
});
}

this.eclqueriesServicies.search({ key: 'conceptos-asociadosm' }).pipe(
switchMap(ecl => {
this.conceptosEcl = ecl;
if (this.conceptosEcl?.length > 0) {
const query: any = {
expression: this.conceptosEcl[0].valor,
search: ''
};
return this.snomedService.get(query); // Retorna el observable del segundo servicio
}
return []; // Retorna un observable vacío si no hay conceptos
})
).subscribe((resultado) => {
this.conceptosAsociados = [...resultado];
});
}

Expand Down
28 changes: 17 additions & 11 deletions src/app/components/top/solicitudes/solicitudes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { PrestacionesService } from '../../../modules/rup/services/prestaciones.
import { TurnoService } from '../../../services/turnos/turno.service';
import { ConstantesService } from 'src/app/services/constantes.service';
import { SnomedService } from 'src/app/apps/mitos';
import { ECLQueriesService } from 'src/app/services/eclqueries.service';


@Component({
Expand Down Expand Up @@ -177,6 +178,7 @@ export class SolicitudesComponent implements OnInit {
public motivosHudsService: MotivosHudsService,
public constantesService: ConstantesService,
public snomedService: SnomedService,
public eclqueriesServicies: ECLQueriesService
) {
}

Expand Down Expand Up @@ -214,7 +216,7 @@ export class SolicitudesComponent implements OnInit {
this.fechaDesde = moment(this.fechaHasta).subtract(this.diasIntervalo, 'days').toDate();
this.estadoEntrada = { id: 'asignada', nombre: 'ASIGNADA' };
}

this.cargarConceptosAsociados();
this.buscarSolicitudes();
}

Expand Down Expand Up @@ -580,7 +582,6 @@ export class SolicitudesComponent implements OnInit {
this.scrollEnd = true;
}
this.loader = false;
this.cargarConceptosAsociados();
});
}

Expand Down Expand Up @@ -951,19 +952,24 @@ export class SolicitudesComponent implements OnInit {
}

setConceptoAsociado(event) {
this.conceptoAsociado = event.value?.id || null;
this.conceptoAsociado = event.value?.conceptId || null;
this.cargarSolicitudes();
}

cargarConceptosAsociados() {
this.constantesService.search({ source: 'solicitud:conceptosAsociados' }).subscribe(async (constantes) => {
const query = constantes[0].query;

this.snomedService?.get({
search: query
}).subscribe((resultados) => {
this.listaConceptosAsociados = resultados.map(concepto => ({ id: concepto.conceptId, nombre: concepto.term }));
});
this.eclqueriesServicies.search({ key: 'conceptos-asociadosm' }).pipe(
switchMap(ecl => {
if (ecl?.length > 0) {
const query: any = {
expression: ecl[0].valor,
search: ''
};
return this.snomedService.get(query); // Retorna el observable del segundo servicio
}
return []; // Retorna un observable vacío si no hay conceptos
})
).subscribe((resultado) => {
this.listaConceptosAsociados = [...resultado];
});
}
}
14 changes: 8 additions & 6 deletions src/app/components/top/solicitudes/solicitudes.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@
label="Prioridad" ngModelOptions="{standalone: true}"
(change)="cargarSolicitudes()">
</plex-select>
<plex-select [(ngModel)]="conceptoAsociado" name="conceptoAsociado"
label="Diagnóstico asociado" name="conceptoAsociado"
[data]="listaConceptosAsociados" (change)="setConceptoAsociado($event)">
<plex-select *ngIf="listaConceptosAsociados.length" [(ngModel)]="conceptoAsociado"
name="conceptoAsociado" label="Diagnóstico asociado" name="conceptoAsociado"
[data]="listaConceptosAsociados" labelField="term" idField="conceptId"
(change)="setConceptoAsociado($event)">
</plex-select>
<plex-bool class="bool-actualizacion" [(ngModel)]="check" label="Actualización"
(change)="onChange()" [ngModelOptions]="{standalone: true}" type="slide">
Expand Down Expand Up @@ -238,9 +239,10 @@
label="Prioridad" ngModelOptions="{standalone: true}"
(change)="cargarSolicitudes()">
</plex-select>
<plex-select [(ngModel)]="conceptoAsociado" name="conceptoAsociado"
label="Diagnóstico asociado" name="conceptoAsociado"
[data]="listaConceptosAsociados" (change)="setConceptoAsociado($event)">
<plex-select [(ngModel)]="conceptoAsociado" *ngIf="listaConceptosAsociados.length"
name="conceptoAsociado" label="Diagnóstico asociado" name="conceptoAsociado"
[data]="listaConceptosAsociados" labelField="term" idField="conceptId"
(change)="setConceptoAsociado($event)">
</plex-select>
<plex-bool class="bool-actualizacion" [(ngModel)]="check" label="Actualización"
(change)="onChange()" [ngModelOptions]="{standalone: true}" type="slide">
Expand Down