Skip to content
Open
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
29 changes: 23 additions & 6 deletions src/app/core/mpi/services/paciente-buscar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,16 @@ export class PacienteBuscarService {
public findByScan(pacienteEscaneado: PacienteEscaneado) {
const textoLibre = pacienteEscaneado.scan;
// 1. Busca por documento escaneado (simplequery)
return this.pacienteService.get({
const query: any = {
apellido: pacienteEscaneado.apellido,
nombre: pacienteEscaneado.nombre,
documento: pacienteEscaneado.documento,
sexo: pacienteEscaneado.sexo,
activo: true
}).pipe(
};
if (pacienteEscaneado.sexo) {
query.sexo = pacienteEscaneado.sexo;
}
return this.pacienteService.get(query).pipe(
map(resultado => {
return resultado.length ? { scan: textoLibre, pacientes: resultado, err: null } : null;
}),
Expand All @@ -103,13 +106,16 @@ export class PacienteBuscarService {
}

// 1.3. Si no encontró el paciente escaneado, busca uno similar (suggest)
return this.pacienteService.match({
const querySuggest: any = {
apellido: pacienteEscaneado.apellido,
nombre: pacienteEscaneado.nombre,
documento: pacienteEscaneado.documento,
sexo: pacienteEscaneado.sexo,
fechaNacimiento: pacienteEscaneado.fechaNacimiento
}).pipe(
};
if (pacienteEscaneado.sexo) {
querySuggest.sexo = pacienteEscaneado.sexo;
}
return this.pacienteService.match(querySuggest).pipe(
map((resultadoSuggest: any) => {
// 1.3.1. Si no encontró ninguno, retorna un array vacio
if (!resultadoSuggest.length) {
Expand Down Expand Up @@ -232,6 +238,17 @@ export const DocumentoEscaneados: DocumentoEscaneado[] = [
grupoFechaNacimiento: 5
},

// DNI Argentino versión 2026 (sin sexo)
// Formato: NroTramite@Apellido@NombreCompleto@NroDni@Ejemplar@FechaNacimiento@FechaEmision@TokenValidacion
{
regEx: /([0-9]+)@([a-zA-ZñÑáéíóúÁÉÍÓÚÜü'\-\s]+)@([a-zA-ZñÑáéíóúÁÉÍÓÚÜü'\-\s]+)@([0-9]+)@([A-Z]+)@([0-9]{2}\/[0-9]{2}\/[0-9]{4})@([0-9]{2}\/[0-9]{2}\/[0-9]{4})@(.*)/i,
grupoNumeroDocumento: 4,
grupoApellido: 2,
grupoNombre: 3,
grupoSexo: 0,
grupoFechaNacimiento: 6
},

// QR ACTA DE NACIMIENTO
// Formato: INOSTROZA, Ramiro Daniel DNI: 54852844Tomo: 5Folio: 88Acta: 507Año: 2015Formato de archivo de imágen no reconocido
{
Expand Down
10 changes: 0 additions & 10 deletions src/app/modules/mpi/components/paciente-buscar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ import { PacienteBuscarResultado } from '../interfaces/PacienteBuscarResultado.i
import { PacienteBuscarService } from '../../../core/mpi/services/paciente-buscar.service';
import { Subscription } from 'rxjs';
import { PacienteCacheService } from 'src/app/core/mpi/services/pacienteCache.service';

interface PacienteEscaneado {
documento: string;
apellido: string;
nombre: string;
sexo: string;
fechaNacimiento: Date;
scan: string;
}

@Component({
selector: 'paciente-buscar',
templateUrl: 'paciente-buscar.html',
Expand Down
Loading