public async Task <ActionResult> newHistoriaClinica([FromBody] CrearHistoriaClinicaDTO model)
        {
            using (var transaction = context.Database.BeginTransaction())
            {
                logger.LogInformation("BeginTransaction  Crear Historia Clinica by user => {0}", getUser());
                try
                {
                    await fundabiem.newHistoriaClinica(model);

                    transaction.Commit();
                    logger.LogInformation("Commit transaction Crear Historia Clinica");
                    return(Ok());
                }
                catch (Exception ex)
                {
                    logger.LogInformation("RollBack transaction Crear Historia Clinica");
                    logger.LogError(ex.ToString());
                    return(BadRequest());
                }
            }
        }
        public async Task newHistoriaClinica(CrearHistoriaClinicaDTO modelo)
        {
            logger.Information("Creating a new clinic history");

            var historiaClinica = new HistoriaClinica
            {
                idPaciente       = modelo.idPaciente,
                fechaDeRegistro  = DateTime.Today,
                motivoDeConsulta = modelo.motivoConsulta,
                diagnosticoFinal = modelo.diagnosticoFinal
            };

            await context.HistoriasClinicas.AddAsync(historiaClinica);

            await context.SaveChangesAsync();

            foreach (var anamnesis in modelo.anamnesis)
            {
                await newAnamnesis(historiaClinica.idHistoriaClinica, anamnesis);
            }
        }