Skip to content

Commit b3fd1c2

Browse files
committed
(fix): Modificar diagnóstico VIH
1 parent c8c4e0c commit b3fd1c2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

modules/recetas/recetasController.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,7 @@ export async function create(req) {
537537
paciente: null,
538538
profesional: null,
539539
organizacion: req.body.organizacion,
540-
diagnostoco: null,
541540
origenExterno: null
542-
543541
};
544542
try {
545543
dataReceta.fechaRegistro = dataReceta.fechaRegistro ? moment(dataReceta.fechaRegistro).toDate() : moment().toDate();
@@ -620,8 +618,16 @@ export async function crearReceta(dataReceta, req) {
620618
receta = new Receta();
621619
receta.idPrestacion = dataReceta.idPrestacion;
622620
receta.idRegistro = dataReceta.idRegistro;
623-
const diag = medicamento.diagnostico;
624-
receta.diagnostico = (typeof diag === 'string') ? { descripcion: diag } : diag;
621+
let diag = medicamento.diagnostico;
622+
if (typeof diag === 'string') {
623+
const contieneConfidencial = /(VIH|HIV)/i.test(diag);
624+
diag = { descripcion: contieneConfidencial ? 'Confidencial por Ley 27.675' : diag };
625+
} else if (diag && typeof diag.descripcion === 'string') {
626+
if (/(VIH|HIV)/i.test(diag.descripcion)) {
627+
diag.descripcion = 'Confidencial por Ley 27.675';
628+
}
629+
}
630+
receta.diagnostico = diag;
625631
receta.medicamento = {
626632
concepto: medicamento.concepto || medicamento.generico,
627633
presentacion: medicamento.presentacion?.term || medicamento.presentacion,

0 commit comments

Comments
 (0)