File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 = / ( V I H | H I V ) / i. test ( diag ) ;
624+ diag = { descripcion : contieneConfidencial ? 'Confidencial por Ley 27.675' : diag } ;
625+ } else if ( diag && typeof diag . descripcion === 'string' ) {
626+ if ( / ( V I H | H I V ) / 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 ,
You can’t perform that action at this time.
0 commit comments