示例#1
0
        public async Task <RegisterPatientResponse> RegisterPatientAsync(RegisterPatientRequest data,
                                                                         CancellationToken cancellationToken)
        {
            var existedUsers = await _patientService.FindPatientsByPersonalIdAsync(data.PersonalId, cancellationToken);

            if (existedUsers.Any())
            {
                return(RegisterPatientResponse.PersonalIdAlreadyExists);
            }

            var patient = new Patient
            {
                FirstName  = data.FirstName,
                Patronymic = data.MiddleName,
                LastName   = data.LastName,
                PersonalId = data.PersonalId,
                BirthDate  = data.BirthDate,
            };

            await _patientService.AddPatientAsync(patient, cancellationToken);

            return(new RegisterPatientResponse
            {
                Guid = patient.Guid,
                Status = RegisterPatientStatus.Ok,
            });
        }
示例#2
0
        public ActionResult <RegisterPatientResponse> Post(RegisterPatientRequest request)
        {
            var service  = new RegisterPatientService(_unitOfWork);
            var response = service.Ejecute(request);

            return(Ok(response));
        }
示例#3
0
        public void CreatePatientStratum5Test()
        {
            var request = new RegisterPatientRequest
            {
                Identification = "1005", Name = "Paciente5", Surname = "Prueba", Age = 25, Gender = "Masculino",
                Stratum        = 5, EPS = "EpsExample"
            };
            var service  = new RegisterPatientService(new UnitOfWork(_context));
            var response = service.Ejecute(request);

            Assert.AreEqual("Paciente registrado satisfactoriamente", response.Mensaje);
        }
示例#4
0
        internal async Task Run()
        {
            Console.WriteLine("Hello World!");
            var input = new RegisterPatientRequest()
            {
                FirstName  = "Didier",
                Name       = "Cauvin",
                Birthdate  = new DateTime(1980, 12, 30),
                Adresse1   = "chemin du plan de clavel",
                PostalCode = "13330",
                City       = "Pelissanne"
            };

            await _mediator.Send(input);
        }
 public Task <RegisterPatientResponse> RegisterPatientAsync(RegisterPatientRequest request,
                                                            CancellationToken cancellationToken)
 {
     return(_accountsControllerService
            .RegisterPatientAsync(request, cancellationToken));
 }