예제 #1
0
        private CreateExamReportTest()
        {
            _examReportService  = GetService <IExamReportService>();
            _medicService       = GetService <IMedicService>();
            _examRequestService = GetService <IExamRequestService>();

            _newExamReport = new Domain.Entities.ExamReport();

            _resident = new Resident()
            {
                CRM         = "123",
                InitialDate = DateTime.Now,
                User        = new User
                {
                    Id       = 1,
                    Email    = "*****@*****.**",
                    Name     = "resident",
                    Password = "******",
                }
            };

            _examRequest = new Domain.Entities.ExamRequest
            {
                Id            = 1,
                Hypothesis    = "Cancer no coracao",
                ExamName      = ExamType.Ecocardiograma,
                Recomendation = "Descansar"
            };

            _medicService.SaveAsync <MedicValidator>(_resident);
            _examRequestService.SaveAsync <ExamRequestValidator>(_examRequest);
        }
        public async Task <IActionResult> Post([FromBody] ExamRequestCommand examRequestCommand)
        {
            if (!ModelState.IsValid)
            {
                return(CustomResponse(ModelState));
            }

            var examRequest    = _mapper.Map <ExamRequestCommand, ExamRequest>(examRequestCommand);
            var userId         = HttpContext.User.Claims.First()?.Value;
            var newExamRequest = await _examRequestService.SaveAsync <ExamRequestValidator>(int.Parse(userId), examRequest);

            if (newExamRequest == null)
            {
                return(CustomResponse());
            }

            var path = Path.Join(Directory.GetCurrentDirectory(), "templates/examRequestReport.html");

            var examRequestDTO = _mapper.Map <ExamRequest, ExamRequestDTO>(newExamRequest);

            string html = System.IO.File.ReadAllText(path);

            html = ReplaceHtml(examRequestDTO, html);

            return(Ok(new Dictionary <string, string>()
            {
                { "html", html }
            }));
        }
예제 #3
0
        public async System.Threading.Tasks.Task ChooseExamAsync(string exame)
        {
            await OpenExamInsertScreenAsync();

            Enum.TryParse(exame, out ExamType exameType);
            _examRequest.ExamName = exameType;

            await _examRequestService.SaveAsync <ExamRequestValidator>(_medic.UserId, _examRequest);
        }
 public async void ClicarEmitirPedido()
 {
     await _examRequestService.SaveAsync <ExamRequestValidator>(_medic.UserId, _examRequest);
 }