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
12 changes: 5 additions & 7 deletions src/app/core/mpi/components/datos-basicos.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DatosBasicosComponent implements OnInit, OnChanges, AfterViewInit,
noPoseeDNI = false;
botonRegistroDNI = false;
pacienteExtranjero: IPaciente;
pacienteEditado = { nombre: '', apellido: '' };
pacienteEditado = { nombre: '', apellido: '', fechaNacimiento: null as Date | null };
public requiereGenero: boolean;
public nuevoPaciente = false;
public disableRegistro = false;
Expand Down Expand Up @@ -267,6 +267,7 @@ export class DatosBasicosComponent implements OnInit, OnChanges, AfterViewInit,
registrarError() {
this.pacienteEditado.nombre = this.paciente.nombre;
this.pacienteEditado.apellido = this.paciente.apellido;
this.pacienteEditado.fechaNacimiento = this.paciente.fechaNacimiento;
this.paciente.reportarError = true;
this.changes.emit({ pacienteError: this.pacienteEditado });
}
Expand Down Expand Up @@ -536,12 +537,9 @@ export class DatosBasicosComponent implements OnInit, OnChanges, AfterViewInit,
}

verificarNombreApellido(data) {
if (data.nombre) {
this.pacienteEditado.nombre = data.nombre;
}
if (data.apellido) {
this.pacienteEditado.apellido = data.apellido;
}
this.pacienteEditado.nombre = data.hasOwnProperty('nombre') ? data.nombre : this.pacienteEditado.nombre;
this.pacienteEditado.apellido = data.hasOwnProperty('apellido') ? data.apellido : this.pacienteEditado.apellido;
this.pacienteEditado.fechaNacimiento = data.hasOwnProperty('fechaNacimiento') ? data.fechaNacimiento : this.pacienteEditado.fechaNacimiento;
this.changes.emit({ pacienteError: this.pacienteEditado });
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/core/mpi/components/datos-basicos.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@
[required]="true" [debounce]="500"
(change)="verificarNombreApellido({nombre: pacienteEditado.nombre})">
</plex-text>
<plex-datetime label="Ingrese fecha de nacimiento correcta" type="date" [required]="true"
[debounce]="500" [(ngModel)]="pacienteEditado.fechaNacimiento" name="fechaError"
(change)="verificarNombreApellido({fechaNacimiento: pacienteEditado.fechaNacimiento})">
</plex-datetime>
<br>
<plex-label size="md" titulo="Si hay un error en RENAPER, la persona deberá informar el
problema en la delegación de RENAPER más cercana a su domicilio para corregir la situación de su
Expand Down
40 changes: 25 additions & 15 deletions src/app/core/mpi/components/paciente.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class PacienteComponent implements OnInit {
reportarError: false,
nombreCorrectoReportado: '',
apellidoCorrectoReportado: '',
fechaNacimientoCorrectoReportado: null,
notaError: '',
vinculos: null,
documentos: [],
Expand Down Expand Up @@ -355,6 +356,10 @@ export class PacienteComponent implements OnInit {
documentos: nuevoPaciente.documentos,
relaciones: nuevoPaciente.relaciones,
estado: nuevoPaciente.estado,
nombreCorrectoReportado: nuevoPaciente.nombreCorrectoReportado,
apellidoCorrectoReportado: nuevoPaciente.apellidoCorrectoReportado,
fechaNacimientoCorrectoReportado: nuevoPaciente.fechaNacimientoCorrectoReportado,
reportarError: nuevoPaciente.reportarError
};

return this.prepararPaciente(paciente, ignoreSuggestions);
Expand Down Expand Up @@ -430,12 +435,10 @@ export class PacienteComponent implements OnInit {
});
}
} else {
if (this.paciente?.nombreCorrectoReportado) {
this.pacienteModel.nombreCorrectoReportado = this.paciente.nombreCorrectoReportado;
}
if (this.paciente?.apellidoCorrectoReportado) {
this.pacienteModel.apellidoCorrectoReportado = this.paciente.apellidoCorrectoReportado;
}
this.pacienteModel.nombreCorrectoReportado = this.paciente.nombreCorrectoReportado;
this.pacienteModel.apellidoCorrectoReportado = this.paciente.apellidoCorrectoReportado;
this.pacienteModel.fechaNacimientoCorrectoReportado = this.paciente.fechaNacimientoCorrectoReportado;
this.pacienteModel.reportarError = this.paciente.reportarError;
const paciente = this.prepararPaciente(this.mergePaciente(this.pacienteModel, this.pacienteExtranjero), ignoreSuggestions);
if (paciente) {
this.guardarPaciente(paciente).subscribe((paciente) => {
Expand Down Expand Up @@ -617,17 +620,22 @@ export class PacienteComponent implements OnInit {
this.disableGuardar = false;
}
if (data.pacienteError) {
this.nombreApellidoIgual = (data.pacienteError.nombre === this.paciente.nombre && data.pacienteError.apellido === this.paciente.apellido) ? true : false;
if (!this.nombreApellidoIgual) {
if (data.pacienteError.nombre !== this.paciente.nombre) {
this.paciente.nombreCorrectoReportado = data.pacienteError.nombre;
}
if (data.pacienteError.apellido !== this.paciente.apellido) {
this.paciente.apellidoCorrectoReportado = data.pacienteError.apellido;
}
}
const error = data.pacienteError;
const paciente = this.paciente;

paciente.nombreCorrectoReportado = (error?.nombre?.trim().toUpperCase() !== paciente.nombre?.trim().toUpperCase()) ? error.nombre : '';
paciente.apellidoCorrectoReportado = (error?.apellido?.trim().toUpperCase() !== paciente.apellido?.trim().toUpperCase()) ? error.apellido : '';

const fechaError = this.formatFecha(error.fechaNacimiento);
const fechaPaciente = this.formatFecha(paciente.fechaNacimiento);

paciente.fechaNacimientoCorrectoReportado = (fechaError !== fechaPaciente) ? error.fechaNacimiento : null;
paciente.reportarError = true;
}
}
formatFecha(fecha: any): string {
return fecha ? moment(fecha).format('YYYY-MM-DD') : '';
}
documentos(documentosNew) {
this.pacienteModel.documentos = documentosNew;
}
Expand Down Expand Up @@ -724,6 +732,7 @@ export class PacienteComponent implements OnInit {
if (resultado.errorData) {
this.pacienteModel.nombreCorrectoReportado = resultado.nombre;
this.pacienteModel.apellidoCorrectoReportado = resultado.apellido;
this.pacienteModel.fechaNacimientoCorrectoReportado = resultado.fechaNacimiento;
this.pacienteModel.reportarError = true;
}
// agregamos en identificadores la validación
Expand Down Expand Up @@ -800,6 +809,7 @@ export class PacienteComponent implements OnInit {
this.pacienteModel.reportarError = false;
delete this.pacienteModel.nombreCorrectoReportado;
delete this.pacienteModel.apellidoCorrectoReportado;
delete this.pacienteModel.fechaNacimientoCorrectoReportado;
}
this.conservarDatos();
this.disableValidar = false;
Expand Down
1 change: 1 addition & 0 deletions src/app/core/mpi/interfaces/IPaciente.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export interface IPaciente {
reportarError: Boolean;
nombreCorrectoReportado: String;
apellidoCorrectoReportado: String;
fechaNacimientoCorrectoReportado: Date;
notaError: string;
carpetaEfectores?: [{
organizacion: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class ListadoAuditoriaComponent {
@Output() hover: EventEmitter<IPaciente> = new EventEmitter<IPaciente>();
// Evento que se emite cuando se scrollea en la lista
@Output() scrolled: EventEmitter<null> = new EventEmitter<null>();
@Output() resetReport: EventEmitter<IPaciente> = new EventEmitter<IPaciente>();

_pacientes: IPacienteMatch[] | IPaciente[];
seleccionado: IPaciente;
Expand Down Expand Up @@ -58,8 +59,9 @@ export class ListadoAuditoriaComponent {
}
}

constructor(private plex: Plex,
private historialBusquedaService: HistorialBusquedaService) { }
constructor(
private plex: Plex,
private historialBusquedaService: HistorialBusquedaService) { }


getCantidadVinculados(paciente: IPaciente) {
Expand All @@ -80,16 +82,22 @@ export class ListadoAuditoriaComponent {
this.itemsDropdown = [];

if (paciente.activo) {
this.itemsDropdown[0] = { label: 'VINCULAR', handler: () => {
this.vincular(this.seleccionado);
} };
this.itemsDropdown[1] = { label: 'INACTIVAR', handler: () => {
this.setActivo(this.seleccionado, false);
} };
this.itemsDropdown[0] = {
label: 'VINCULAR', handler: () => {
this.vincular(this.seleccionado);
}
};
this.itemsDropdown[1] = {
label: 'INACTIVAR', handler: () => {
this.setActivo(this.seleccionado, false);
}
};
} else {
this.itemsDropdown[0] = { label: 'ACTIVAR', handler: () => {
this.setActivo(this.seleccionado, true);
} };
this.itemsDropdown[0] = {
label: 'ACTIVAR', handler: () => {
this.setActivo(this.seleccionado, true);
}
};
}
}
}
Expand Down Expand Up @@ -128,4 +136,21 @@ export class ListadoAuditoriaComponent {
public onScroll() {
this.scrolled.emit();
}

pacienteCorregido(paciente: IPaciente) {
this.plex.confirm('¿Desea marcar como corregido?', 'Confirmación').then(confirmar => {
if (confirmar) {
paciente.reportarError = false;
this.resetReport.emit(paciente);
}
});
}

tieneDatosReportados(paciente: IPaciente) {
return !!(
paciente.nombreCorrectoReportado ||
paciente.apellidoCorrectoReportado ||
paciente.fechaNacimientoCorrectoReportado
);
}
}
10 changes: 8 additions & 2 deletions src/app/modules/auditoria/component/auditoria-listado.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<plex-list [height]="errorTab ? '100%' : '80%'" [striped]="true" (scrolled)="onScroll()">
<plex-list [offset]="185" [striped]="true" (scrolled)="onScroll()">
<plex-heading *ngIf="errorTab" [sticky]="true">
<b label>Paciente</b>
<b label>Edad</b>
Expand All @@ -20,7 +20,6 @@
titulo="Creado por {{ paciente.createdBy?.nombreCompleto?paciente.createdBy.nombreCompleto: 'S/D' }}"
subtitulo="DNI:{{ paciente.createdBy?.documento? paciente.createdBy.documento :'S/D'}} {{ paciente.createdBy?.organizacion?.nombre? ' | '+paciente.createdBy.organizacion.nombre : ' ' }}">
</plex-label>
<plex-label titulo=" "></plex-label>
<plex-badge *ngIf="!errorTab && paciente.fechaFallecimiento" type="danger">Fallecido:
{{ paciente.fechaFallecimiento | fecha:'utc'}}
</plex-badge>
Expand Down Expand Up @@ -54,6 +53,13 @@
{{ registroReportes[paciente.id][0]?.createdAt | fecha:'utc'}}
</plex-badge>

<plex-badge *ngIf="errorTab && !tieneDatosReportados(paciente)" size="sm" type="warning">
<plex-button size="sm" type="warning" label="Marcar como corregido"
(click)="pacienteCorregido(paciente)">
</plex-button>
</plex-badge>


</plex-item>
</ng-container>
</plex-list>
14 changes: 12 additions & 2 deletions src/app/modules/auditoria/component/auditoria.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,25 @@ export class AuditoriaComponent implements OnInit {
this.resultadoBusqueda = [];
}

tieneDatosCorrectos() {
const p = this.pacienteSelected;

return !!(
p.nombreCorrectoReportado ||
p.apellidoCorrectoReportado ||
p.fechaNacimientoCorrectoReportado
);
}

tieneNombreApellidoCorrecto() {
return (this.pacienteSelected.nombreCorrectoReportado && !this.pacienteSelected.apellidoCorrectoReportado) || !this.pacienteSelected.nombreCorrectoReportado && this.pacienteSelected.apellidoCorrectoReportado;
}

tieneNotaError() {
return !this.pacienteSelected.nombreCorrectoReportado && !this.pacienteSelected.apellidoCorrectoReportado && this.pacienteSelected.notaError;
return !this.pacienteSelected.nombreCorrectoReportado && !this.pacienteSelected.apellidoCorrectoReportado && !this.pacienteSelected.fechaNacimientoCorrectoReportado && this.pacienteSelected.notaError;
}

noTieneNotaError() {
return !this.pacienteSelected.nombreCorrectoReportado && !this.pacienteSelected.apellidoCorrectoReportado && !this.pacienteSelected.notaError;
return !this.pacienteSelected.nombreCorrectoReportado && !this.pacienteSelected.apellidoCorrectoReportado && !this.pacienteSelected.fechaNacimientoCorrectoReportado && !this.pacienteSelected.notaError;
}
}
32 changes: 21 additions & 11 deletions src/app/modules/auditoria/component/auditoria.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</plex-tab>

<plex-tab *ngIf="permisoEdicion" label="Errores reportados" icon="account-details">
<reporte-errores #erroresComponent (selected)="onSelectReportado($event)"></reporte-errores>
<reporte-errores #erroresComponent (selected)="onSelectReportado($event)" (reset)="closeSidebar()"></reporte-errores>
</plex-tab>
</plex-tabs>

Expand Down Expand Up @@ -87,18 +87,25 @@
{{ listaReportes[0].createdAt | fecha:'utc' }}</plex-badge>
</plex-title>

<plex-grid *ngIf="pacienteSelected.nombreCorrectoReportado || pacienteSelected.apellidoCorrectoReportado"
[cols]="pacienteSelected.nombreCorrectoReportado && pacienteSelected.apellidoCorrectoReportado ? 3 : 2">
<plex-label *ngIf="pacienteSelected.nombreCorrectoReportado" titulo="Nombre correcto"
subtitulo="{{ pacienteSelected.nombreCorrectoReportado }}">
</plex-label>
<plex-label *ngIf="pacienteSelected.apellidoCorrectoReportado" titulo="Apellido correcto"
subtitulo="{{ pacienteSelected.apellidoCorrectoReportado }}">
</plex-label>
<plex-button *ngIf="permisoEdicion" class="pt-2 pb-4" label="corregir" justify="end" type="warning"
<div *ngIf="tieneDatosCorrectos()" class="d-flex justify-content-between align-items-center">
<plex-grid [cols]="(pacienteSelected.nombreCorrectoReportado ? 1 : 0) +
(pacienteSelected.apellidoCorrectoReportado ? 1 : 0) +
(pacienteSelected.fechaNacimientoCorrectoReportado ? 1 : 0)">
<plex-label *ngIf="pacienteSelected.nombreCorrectoReportado" titulo="Nombre correcto"
subtitulo="{{ pacienteSelected.nombreCorrectoReportado }}">
</plex-label>
<plex-label *ngIf="pacienteSelected.apellidoCorrectoReportado" titulo="Apellido correcto"
subtitulo="{{ pacienteSelected.apellidoCorrectoReportado }}">
</plex-label>
<plex-label *ngIf="pacienteSelected.fechaNacimientoCorrectoReportado"
titulo="Fecha de nacimiento correcta"
subtitulo="{{ pacienteSelected.fechaNacimientoCorrectoReportado | fecha:'utc' }}">
</plex-label>
</plex-grid>
<plex-button *ngIf="permisoEdicion" class="pt-2 pb-4" label="corregir" type="warning"
(click)="onSelectCorregir()">
</plex-button>
</plex-grid>
</div>

<plex-label *ngIf="tieneNotaError()">{{pacienteSelected.notaError}}</plex-label>
<plex-label *ngIf="noTieneNotaError()">No se ha encontrado alguna descripción del error</plex-label>
Expand All @@ -119,6 +126,9 @@
subtitulo="{{ pacienteSelected.nombreCorrectoReportado}}"></plex-label>
<plex-label *ngIf="pacienteSelected.apellidoCorrectoReportado" titulo="Apellido correcto"
subtitulo="{{ pacienteSelected.apellidoCorrectoReportado}}"></plex-label>
<plex-label *ngIf="pacienteSelected.fechaNacimientoCorrectoReportado"
titulo="Fecha de nacimiento correcta"
subtitulo="{{ pacienteSelected.fechaNacimientoCorrectoReportado | fecha:'utc'}}"></plex-label>
</ng-container>
</plex-item>
</ng-container>
Expand Down
6 changes: 1 addition & 5 deletions src/app/modules/auditoria/component/auditoria.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ img {
height: 60px;
}

.img-fallecido {
filter: grayscale(100%);
}

span.error-paciente {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100px !important;
display: inline-block;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,55 @@ export class ModalCorreccionPacienteComponent {
@Output() patientCorrected = new EventEmitter<IPaciente>();
@ViewChild('modal', { static: true }) modal: PlexModalComponent;

public pacienteEdited = { nombre: '', apellido: '' };
public pacienteEdited = { nombre: '', apellido: '', fechaNacimiento: null as Date | null };
public pacienteFoto = { fotoId: '', id: '' };

/**
* verifica que al paciente se le haya editado al menos un campo (nombre y apellido)
* y que los campos editados no sean vacíos
*/
get pacienteEdit() {
const res = (this.pacienteEdited && this.pacienteEdited.nombre && this.pacienteEdited.apellido &&
(this.pacienteEdited.nombre.toUpperCase() !== this.paciente.nombre ||
this.pacienteEdited.apellido.toUpperCase() !== this.paciente.apellido));
return res;
if (
!this.pacienteEdited?.nombre ||
!this.pacienteEdited?.apellido ||
!this.pacienteEdited?.fechaNacimiento
) {
return false;
}

const nombreDiff =
this.pacienteEdited.nombre.trim().toUpperCase() !== this.paciente.nombre;

const apellidoDiff =
this.pacienteEdited.apellido.trim().toUpperCase() !== this.paciente.apellido;

const fechaOriginal = moment(this.paciente.fechaNacimiento).format('YYYY-MM-DD');
const fechaEditada = moment(this.pacienteEdited.fechaNacimiento).format('YYYY-MM-DD');

const fechaDiff = fechaEditada !== fechaOriginal;

return nombreDiff || apellidoDiff || fechaDiff;
}

formatFecha(fecha: Date): string {
return fecha
? new Date(fecha).toISOString().split('T')[0]
: '';
}

show() {
this.pacienteFoto = this.paciente;
this.modal.show();
this.pacienteEdited.nombre = this.paciente.nombre;
this.pacienteEdited.apellido = this.paciente.apellido;
this.pacienteEdited.fechaNacimiento = this.paciente.fechaNacimiento;
}

notificarAccion(flag: boolean) {
if (flag && this.pacienteEdit) {
this.paciente.nombre = this.pacienteEdited.nombre;
this.paciente.apellido = this.pacienteEdited.apellido;
this.paciente.fechaNacimiento = this.pacienteEdited.fechaNacimiento;
this.patientCorrected.emit(this.paciente);
}
this.modal.close();
Expand Down
Loading
Loading