public async Task <IEnumerable <ClientStage> > Extract(Guid?htsClientId = null)
        {
            //_clientStageRepository.Clear();

            var subscriber = await _subscriberSystemRepository.GetDefaultAsync();

            if (null == subscriber)
            {
                throw new Exception("Default EMR NOT SET");
            }

            var practices = _practiceRepository.GetAllDefault().ToList();

            var clients = new List <ClientStage>();

            var persons = _personRepository.GetAllClients();

            foreach (var person in persons)
            {
                var client   = ClientStage.Create(person, subscriber);
                var practice = practices.FirstOrDefault(x => x.Id == client.PracticeId);

                if (null != practice)
                {
                    client.SiteCode = practice.Code;
                }

                clients.Add(client);
            }
            return(clients.Where(x => !x.ClientId.IsNullOrEmpty()));
        }
Exemplo n.º 2
0
        public void should_Extract_Translated()
        {
            var stage = ClientStage.Create(person, subscriber);

            Assert.AreEqual(52, stage.Sex);
            Assert.AreEqual(25, stage.KeyPop);
            Assert.AreEqual(58, stage.MaritalStatus);
            Console.WriteLine(stage);

            /*
             * Code|Display|SubCode|SubDisplay|SubRef
             * ---------------------------------------------------
             * O   |Others	|25	    |Other     |HTSKeyPopulation
             * S   |Single	|58	    |Single	   |HTSMaritalStatus
             * F   |F	    |52	    |Female    |Gender
             *
             */
        }