Пример #1
0
        public void Activate(string jmbg)
        {
            PatientAccount patientAccount = Get(jmbg);

            patientAccount.Activate();
            _patientRepository.Update(patientAccount);
        }
Пример #2
0
        public void RevisePhones_GivenAPhoneListAndPatientAccountHasPhones_RevisesPhonesCorrectly()
        {
            // Setup
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            var address = new Address(
                fixture.CreateAnonymous <string> (),
                fixture.CreateAnonymous <string> (),
                fixture.CreateAnonymous <string> (),
                new Mock <CountyArea> ().Object,
                new Mock <StateProvince> ().Object,
                new Mock <Country> ().Object,
                new PostalCode("21046"));
            var patientAccount = new PatientAccount(
                new Mock <BillingOffice> ().Object,
                fixture.CreateAnonymous <long> (),
                fixture.CreateAnonymous <PersonName> (),
                fixture.CreateAnonymous <DateTime> (),
                address,
                new Mock <AdministrativeGender> ().Object);

            var patientAccountPhoneType1 = new Mock <PatientAccountPhoneType> ();

            patientAccountPhoneType1.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long> ());

            var patientAccountPhoneType2 = new Mock <PatientAccountPhoneType> ();

            patientAccountPhoneType2.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long> ());

            var patientAccountPhoneType3 = new Mock <PatientAccountPhoneType> ();

            patientAccountPhoneType3.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long> ());

            var phone = fixture.CreateAnonymous <Phone> ();

            var patientAccountPhone1       = new PatientAccountPhone(patientAccountPhoneType1.Object, phone);
            var sameAsPatientAccountPhone1 = new PatientAccountPhone(patientAccountPhoneType1.Object, phone);

            var patientAccountPhone2 = new PatientAccountPhone(patientAccountPhoneType2.Object, phone);

            var patientAccountPhone3 = new PatientAccountPhone(patientAccountPhoneType3.Object, phone);

            var initialPhoneList = new List <PatientAccountPhone> {
                patientAccountPhone1, patientAccountPhone2
            };

            patientAccount.RevisePhones(initialPhoneList);

            var inputPhoneList = new List <PatientAccountPhone> {
                sameAsPatientAccountPhone1, patientAccountPhone3
            };

            // Exercise
            patientAccount.RevisePhones(inputPhoneList);

            // Verify
            Assert.AreEqual(2, patientAccount.Phones.Count());
            Assert.IsTrue(patientAccount.Phones.Contains(patientAccountPhone1));
            Assert.IsFalse(patientAccount.Phones.Contains(patientAccountPhone2));
            Assert.IsTrue(patientAccount.Phones.Contains(patientAccountPhone3));
        }
Пример #3
0
        public void RevisePhones_GivenNullPhoneList_PatientAccountHasNoPhone()
        {
            // Setup
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            var address = new Address(
                fixture.CreateAnonymous <string> (),
                fixture.CreateAnonymous <string> (),
                fixture.CreateAnonymous <string> (),
                new Mock <CountyArea> ().Object,
                new Mock <StateProvince> ().Object,
                new Mock <Country> ().Object,
                new PostalCode("21046"));
            var patientAccount = new PatientAccount(
                new Mock <BillingOffice> ().Object,
                fixture.CreateAnonymous <long> (),
                fixture.CreateAnonymous <PersonName> (),
                fixture.CreateAnonymous <DateTime> (),
                address,
                new Mock <AdministrativeGender> ().Object);

            var initialPhoneList = new List <PatientAccountPhone> {
                new Mock <PatientAccountPhone>().Object
            };

            patientAccount.RevisePhones(initialPhoneList);

            // Exercise
            patientAccount.RevisePhones(null);

            // Verify
            Assert.AreEqual(0, patientAccount.Phones.Count());
        }
Пример #4
0
        /// <summary>
        /// Creates the encounter.
        /// </summary>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="placeOfService">The place of service.</param>
        /// <param name="serviceProvider">The service provider.</param>
        /// <param name="trackingNumber">The tracking number.</param>
        /// <param name="serviceDate">The service date.</param>
        /// <returns>An encounter.</returns>
        public Encounter CreateEncounter(PatientAccount patientAccount, Location placeOfService, Staff serviceProvider, long trackingNumber, DateTime serviceDate)
        {
            var encounter = new Encounter(patientAccount, placeOfService, serviceProvider, trackingNumber, serviceDate);

            _encounterRepository.MakePersistent(encounter);
            return(encounter);
        }
Пример #5
0
 public void Update(PatientAccount entity)
 {
     try
     {
         var memento = entity.GetPatientMemento();
         var patient = _context.Patients.Find(memento.Jmbg);
         if (patient is null)
         {
             throw new NotFoundException("Patient account with jmbg " + memento.Jmbg + " does not exist.");
         }
         if (patient.IsGuest)
         {
             throw new NotFoundException("Patient account with jmbg " + memento.Jmbg + " does not exist.");
         }
         patient.IsActive  = memento.IsActivated;
         patient.IsBlocked = memento.IsBlocked;
         patient.ImageName = memento.ImageName;
         _context.Update(patient);
         _context.SaveChanges();
     }
     catch (UserServiceException)
     {
         throw;
     }
     catch (DbUpdateException e)
     {
         throw new ValidationException(e.Message);
     }
     catch (Exception e)
     {
         throw new DataStorageException(e.Message);
     }
 }
        public PatientAccount ChangePassword(PatientAccount account, string newPassword)
        {
            var acc = patientAccountRepository.Repository.GetByID(account.Id);

            acc.Credentials = acc.Credentials.ChangePassword(newPassword);
            return(patientAccountRepository.Repository.Update(acc));
        }
Пример #7
0
        public void ChangeImage(string jmbg, string imageName)
        {
            PatientAccount patientAccount = Get(jmbg);

            patientAccount.ChangeImage(imageName);
            _patientRepository.Update(patientAccount);
        }
Пример #8
0
        public void Block(string jmbg)
        {
            DateTime       earliestMaliciousAction = DateTime.Now.AddMonths(-1);
            PatientAccount patientAccount          = _patientRepository.Get(jmbg, earliestMaliciousAction);

            patientAccount.Block();
            _patientRepository.Update(patientAccount);
        }
Пример #9
0
 private dynamic GetEmailBodyDataForPatientSignUpConfirmationLink(PatientAccount account, string token)
 {
     return(new
     {
         name = account.FullName,
         url = $"{FrontendConfiguration.Url}user-signup-confirmation?email={account.AppUser.UserName}&token={token}"
     });
 }
        //Profile
        public ActionResult Index()
        {
            var id = Convert.ToInt32(Session["AccountId"]);

            if (!IsLoggedIn || id == 0)
            {
                RedirectToAction("Login");
            }

            // Authorization
            var staff = Db.Accounts.OfType <EmployeeAccount>().FirstOrDefault(acc => acc.AccountId == id);

            try
            {
                //Staff Account
                if (staff != null)
                {
                    var model = new ProfileModel
                    {
                        AccountId   = staff.AccountId,
                        Email       = staff.Email,
                        Password    = staff.Password,
                        Firstname   = staff.Firstname,
                        Lastname    = staff.Lastname,
                        Phone       = staff.Phone,
                        Salary      = staff.Salary,
                        SSN         = staff.SSN,
                        Role        = staff.Role,
                        AccountType = AccountType.Employee
                    };
                    return(View("StaffProfile", model));
                }
                else
                {
                    PatientAccount patient = Db.Accounts.OfType <PatientAccount>().FirstOrDefault(acc => acc.AccountId == id);
                    var            model   = new ProfileModel
                    {
                        AccountId       = patient.AccountId,
                        Email           = patient.Email,
                        Password        = patient.Password,
                        Firstname       = patient.Firstname,
                        Lastname        = patient.Lastname,
                        Phone           = patient.Phone,
                        BillingAddress  = patient.BillingAddress,
                        InsuranceNumber = patient.InsuranceNumber,
                        AccountType     = AccountType.Patient
                    };
                    return(View("PatientProfile", model));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Login"));
            }
        }
Пример #11
0
 public void ActivatePatientAccount(PatientAccount patient, bool canActivate)
 {
     if (canActivate)
     {
         patient.Activate();
     }
     else
     {
         Assert.Throws <ValidationException>(() => patient.Activate());
     }
 }
Пример #12
0
 public void BlockPatientAccount(PatientAccount patient, bool canBlock)
 {
     if (canBlock)
     {
         patient.Block();
     }
     else
     {
         Assert.Throws <ValidationException>(() => patient.Block());
     }
 }
Пример #13
0
        public void Register(PatientRegistrationDTO registrationDTO)
        {
            PatientAccountMemento memento = registrationDTO.ToPatientAccountMemento();

            memento.IsActivated = false;
            memento.IsBlocked   = false;
            memento.City        = _cityRepository.Get(registrationDTO.CityId).GetMemento();
            PatientAccount patientAccount = new PatientAccount(memento);

            _patientRepository.Add(patientAccount);
        }
Пример #14
0
        public async Task SendRegistrationConfirmationMailForPatientAsync(PatientAccount account)
        {
            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            var token = await UserManager.GenerateEmailConfirmationTokenAsync(account.AppUser);

            token = Uri.EscapeDataString(token);

            var templateId   = EmailTemplateIds.UserSignUpConfirmationLink;
            var templateData = GetEmailBodyDataForPatientSignUpConfirmationLink(account, token);
            await EmailService.SendEmailWithSendGridTemplateAsync(account.AppUser.Email, account.FullName, templateId, templateData);
        }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Claim"/> class.
        /// </summary>
        /// <param name="encounter">The encounter.</param>
        /// <param name="payor">The payor.</param>
        /// <param name="chargeAmount">The charge amount.</param>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="placeOfService">The place of service.</param>
        /// <param name="serviceDate">The service date.</param>
        public Claim(Encounter encounter, Payor payor, Money chargeAmount, PatientAccount patientAccount, Location placeOfService, DateTime serviceDate)
            : this()
        {
            Check.IsNotNull(encounter, () => Encounter);
            Check.IsNotNull(payor, () => Payor);
            Check.IsNotNull(chargeAmount, () => ChargeAmount);
            Check.IsNotNull(patientAccount, () => PatientAccount);
            Check.IsNotNull(placeOfService, () => ServiceLocation);
            Check.IsNotNull(serviceDate, () => ServiceDate);

            Encounter       = encounter;
            Payor           = payor;
            ChargeAmount    = chargeAmount;
            PatientAccount  = patientAccount;
            ServiceLocation = placeOfService;
            ServiceDate     = serviceDate;
        }
Пример #16
0
 public void Add(PatientAccount entity)
 {
     try
     {
         var patient = entity.ToBackendPatient();
         patient.IsGuest = false;
         var existing = _context.Patients.Find(patient.Jmbg);
         if (existing != null && !existing.IsGuest)
         {
             throw new ValidationException("Patient with jmbg " + patient.Jmbg + "is already registered.");
         }
         if (existing != null && existing.IsGuest)
         {
             _context.Remove(existing);
         }
         _context.Patients.Add(patient);
         _context.SaveChanges();
         if (existing is null)
         {
             _context.PatientCards.Add(new PatientCard()
             {
                 PatientJmbg    = patient.Jmbg,
                 Alergies       = "",
                 BloodType      = BloodType.UNKNOWN,
                 MedicalHistory = "",
                 RhFactor       = RhFactorType.UNKNOWN,
                 Lbo            = "",
                 HasInsurance   = false
             });
             _context.SaveChanges();
         }
     }
     catch (UserServiceException)
     {
         throw;
     }
     catch (DbUpdateException e)
     {
         throw new ValidationException(e.Message);
     }
     catch (Exception e)
     {
         throw new DataStorageException(e.Message);
     }
 }
        /// <summary>
        /// Synchronizes the encounter with the clinical visit.
        /// </summary>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="visit">The visit.</param>
        /// <returns>
        /// An <see cref="Encounter"/> instance.
        /// </returns>
        public Encounter SynchronizeEncounter(PatientAccount patientAccount, Visit visit)
        {
            Check.IsNotNull(patientAccount, "Patient account is required.");
            Check.IsNotNull(visit, "Visit is required.");

            var serviceProvider = visit.Staff;
            var placeOfService  = visit.ServiceLocation;

            var encounter = _encounterRepository.GetByTrackingNumber(visit.Key);

            if (encounter == null)
            {
                encounter = _encounterFactory.CreateEncounter(
                    patientAccount,
                    placeOfService,
                    serviceProvider,
                    visit.Key,
                    visit.CheckedInDateTime ?? DateTime.Now);
            }
            else
            {
                if (encounter.PatientAccount.Key != patientAccount.Key)
                {
                    encounter.RevisePatientAccount(patientAccount);
                }

                if (encounter.ServiceLocation.Key != placeOfService.Key)
                {
                    encounter.RevisePlaceOfService(placeOfService);
                }

                if (encounter.ServiceProviderStaff.Key != serviceProvider.Key)
                {
                    encounter.ReviseServiceProvider(serviceProvider);
                }
            }

            //TODO: move them to ctor
            var currency = _lookupValueRepository.GetLookupByWellKnownName <Currency>(WellKnownNames.CommonModule.Currency.USDollars);

            encounter.ReviseChargeAmount(new Money(currency, 2));

            return(encounter);
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Encounter"/> class.
        /// </summary>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="serviceLocation">The service location.</param>
        /// <param name="serviceProviderStaff">The service provider staff.</param>
        /// <param name="trackingNumber">The tracking number.</param>
        /// <param name="serviceDate">The service date.</param>
        protected internal Encounter(
            PatientAccount patientAccount,
            Location serviceLocation,
            Staff serviceProviderStaff,
            long trackingNumber,
            DateTime serviceDate)
            : this()
        {
            Check.IsNotNull(patientAccount, "Patient account is required.");
            Check.IsNotNull(serviceLocation, "Place of service is required.");
            Check.IsNotNull(serviceProviderStaff, "Service provider staff is required.");
            Check.IsNotNull(serviceDate, "Service date staff is required.");

            PatientAccount       = patientAccount;
            ServiceLocation      = serviceLocation;
            ServiceProviderStaff = serviceProviderStaff;
            TrackingNumber       = trackingNumber;
            ServiceDate          = serviceDate;
        }
Пример #19
0
        public static MaliciousPatientDTO ToMaliciousPatientDTO(this PatientAccount patient)
        {
            var memento = patient.GetPatientMemento();

            return(new MaliciousPatientDTO()
            {
                Name = memento.Name,
                Surname = memento.Surname,
                Email = memento.Email,
                Jmbg = memento.Jmbg,
                HomeAddress = memento.HomeAddress,
                CityName = memento.City.Name,
                CountryName = memento.City.Country.Name,
                Phone = memento.Phone,
                IsBlocked = memento.IsBlocked,
                NumberOfMaliciousActions = memento.MaliciousActions.Count(),
                ImageName = memento.ImageName
            });
        }
Пример #20
0
        public static PatientDTO ToPatientDTO(this PatientAccount patient)
        {
            var memento = patient.GetPatientMemento();

            return(new PatientDTO()
            {
                Name = memento.Name,
                Surname = memento.Surname,
                Email = memento.Email,
                Jmbg = memento.Jmbg,
                Phone = memento.Phone,
                DateOfBirth = memento.DateOfBirth,
                CityId = memento.City.Id,
                CityName = memento.City.Name,
                CountryId = memento.City.Country.Id,
                CountryName = memento.City.Country.Name,
                HomeAddress = memento.HomeAddress,
                ImageName = memento.ImageName,
                Gender = memento.Gender.ToString()
            });
        }
Пример #21
0
        internal static Patient ToBackendPatient(this PatientAccount patient)
        {
            var memento = patient.GetPatientMemento();

            return(new Patient()
            {
                Jmbg = memento.Jmbg,
                DateOfBirth = memento.DateOfBirth,
                CityZipCode = memento.City.Id,
                DateOfRegistration = DateTime.Now,
                Email = memento.Email,
                Gender = memento.Gender.ToBackendGender(),
                HomeAddress = memento.HomeAddress,
                ImageName = memento.ImageName,
                IsActive = memento.IsActivated,
                IsBlocked = memento.IsBlocked,
                Name = memento.Name,
                IsGuest = false,
                Password = memento.Password,
                Phone = memento.Phone,
                Surname = memento.Surname,
                Username = memento.Email
            });
        }
Пример #22
0
        public ResponseObjectDto Create(AppointmentDto appointmentDto)
        {
            var responseObject = new ResponseObjectDto();

            responseObject.Success = true;
            responseObject.Message = "Đặt lịch thành công";

            try
            {
                var appointmentRepo    = this.RepositoryHelper.GetRepository <IAppointmentRepository>(this.UnitOfWork);
                var sgRepo             = this.RepositoryHelper.GetRepository <ISampleGettingRepository>(this.UnitOfWork);
                var sampleRepo         = this.RepositoryHelper.GetRepository <ISampleRepository>(this.UnitOfWork);
                var tableRepo          = this.RepositoryHelper.GetRepository <ITableRepository>(this.UnitOfWork);
                var patientRepo        = this.RepositoryHelper.GetRepository <IPatientRepository>(this.UnitOfWork);
                var patientAccountRepo = this.RepositoryHelper.GetRepository <IPatientAccountRepository>(this.UnitOfWork);
                var accRepo            = this.RepositoryHelper.GetRepository <IAccountRepository>(this.UnitOfWork);

                Patient patient = null;
                if (appointmentDto.PatientDto != null) // Make Ap. without Login
                {
                    //var idcNumber = appointmentDto.PatientDto.IdentityCardNumber;
                    //patient = patientRepo.GetByIDCNumber(idcNumber);
                    var phone   = appointmentDto.PatientDto.PhoneNumber;
                    var account = accRepo.GetByPhoneNumber(phone);

                    if (account == null)
                    {
                        account             = new Account();
                        account.FullName    = appointmentDto.PatientDto.FullName;
                        account.PhoneNumber = phone;
                        account.Password    = ConstantManager.DEFAULT_PASSWORD;
                        account.RoleId      = (int)RoleEnum.Patient;
                        account.IsDeleted   = false;
                        accRepo.Create(account);
                        try
                        {
                            var result = this.UnitOfWork.SaveChanges();
                            if (result.Any())
                            {
                                responseObject.Success = false;
                                responseObject.Message = "Có lỗi xảy ra";
                                responseObject.Data    = result;
                                return(responseObject);
                            }
                        }
                        catch (Exception ex)
                        {
                            responseObject.Success = false;
                            responseObject.Message = "Có lỗi xảy ra";
                            responseObject.Data    = ex;
                            return(responseObject);
                        }
                        responseObject.Data = new
                        {
                            appointmentDto.PatientDto.PhoneNumber,
                            DefaultPassword = account.Password
                        };
                    }
                    int accountId = account.AccountId;

                    var dateOfBirth = DateTime.Parse(appointmentDto.PatientDto.DateOfBirth);
                    patient = patientRepo.GetBy(accountId, appointmentDto.PatientDto.FullName, dateOfBirth);
                    if (patient == null)
                    {
                        // Create a new Patient
                        patient                    = new Patient();
                        patient.AccountId          = accountId;
                        patient.FullName           = appointmentDto.PatientDto.FullName;
                        patient.IdentityCardNumber = appointmentDto.PatientDto.IdentityCardNumber;
                        patient.PhoneNumber        = appointmentDto.PatientDto.PhoneNumber;
                        patient.DateOfBirth        = dateOfBirth;
                        patient.Gender             = appointmentDto.PatientDto.Gender;
                        patient.HomeAddress        = appointmentDto.PatientDto.HomeAddress;
                        patient.IsDeleted          = false;

                        patientRepo.Create(patient);
                        try
                        {
                            var result = this.UnitOfWork.SaveChanges();
                            if (result.Any())
                            {
                                responseObject.Success = false;
                                responseObject.Message = "Có lỗi xảy ra";
                                responseObject.Data    = result;
                                return(responseObject);
                            }
                        }
                        catch (Exception ex)
                        {
                            responseObject.Success = false;
                            responseObject.Message = "Có lỗi xảy ra";
                            responseObject.Data    = ex;
                            return(responseObject);
                        }
                        patient.PatientCode = "BN" + patient.PatientId;
                    }

                    if (account != null && patient != null)
                    {
                        var patientAccount = new PatientAccount();
                        patientAccount.AccountId = account.AccountId;
                        patientAccount.PatientId = patient.PatientId;
                        patientAccount.IsDeleted = false;
                        patientAccountRepo.Create(patientAccount);
                        var result = this.UnitOfWork.SaveChanges();
                        if (result.Any())
                        {
                            responseObject.Success = false;
                            responseObject.Message = "Có lỗi xảy ra";
                            responseObject.Data    = result;
                            return(responseObject);
                        }
                    }

                    appointmentDto.PatientId = patient.PatientId;
                }
                else if (appointmentDto.PatientId != null) // Make Ap. with Login
                {
                    patient = patientRepo.GetById((int)appointmentDto.PatientId);
                    if (patient == null)
                    {
                        responseObject.Success = false;
                        responseObject.Message = "Có lỗi xảy ra";
                        responseObject.Data    = new
                        {
                            MessageForDev = "Không tồn tại PatientId này"
                        };
                        return(responseObject);
                    }
                }
                else
                {
                    responseObject.Success = false;
                    responseObject.Message = "Có lỗi xảy ra";
                    responseObject.Data    = new
                    {
                        MessageForDev = "PatientId truyền vào là Null"
                    };
                    return(responseObject);
                }

                var appointment = new Appointment();
                // Convert AppointmentDto to Appointment
                var now   = DateTime.Now;
                var sDate = now.ToString("yyyy-MM-dd");

                // Generate code
                var lastcode = appointmentRepo.GetLastCode(sDate);
                var count    = 0;
                if (lastcode != null)
                {
                    count = int.Parse(lastcode.Substring("yyyy-MM-dd-".Length));
                }
                var code = sDate + "-" + (count + 1);


                appointment.PatientId       = patient.PatientId;
                appointment.AppointmentCode = code;
                appointment.Status          = "NEW";
                appointment.PatientId       = appointmentDto.PatientId;
                appointment.EnterTime       = now;
                appointment.IsOnline        = true;
                appointment.IsDeleted       = false;

                appointment.SampleGettings = new List <SampleGetting>();

                var sampleGettingDtos = appointmentDto.SampleGettingDtos;
                foreach (var sgDto in appointmentDto.SampleGettingDtos)
                {
                    var duplicatedSG = sgRepo.GetFirst(sgDto.SampleId, sgDto.GettingDate, (int)appointmentDto.PatientId);
                    if (duplicatedSG != null)
                    {
                        var sampleName = sampleRepo.GetById(sgDto.SampleId).SampleName;
                        var date       = DateTime.Parse(sgDto.GettingDate).ToString("dd-MM-yyyy");
                        responseObject.Success = false;
                        responseObject.Message = string.Format("Bạn đã từng đăng ký lấy mẫu {0} vào ngày {1}.\n Bạn không thể lấy mẫu {0} 2 lần 1 ngày.", sampleName, date);
                        return(responseObject);
                    }

                    var sg        = Mapper.Map <SampleGettingDto, SampleGetting>(sgDto);
                    var avaiTable = tableRepo.GetFirstAvailableTable((int)sg.SlotId, (DateTime)sg.GettingDate);
                    if (avaiTable == null)
                    {
                        responseObject.Success = false;
                        responseObject.Message = "Có ca xét nghiệm đã hết chỗ";
                        return(responseObject);
                    }
                    sg.TableId     = avaiTable.TableId;
                    sg.Status      = "NEW";
                    sg.LabTestings = new List <LabTesting>();
                    sg.IsGot       = false;
                    sg.IsPaid      = false;
                    sg.IsDeleted   = false;
                    foreach (var id in sgDto.LabTestIds)
                    {
                        var labTesting = new LabTesting();
                        labTesting.LabTestId       = id;
                        labTesting.SampleGettingId = sg.SampleGettingId;
                        labTesting.Status          = "NEW";
                        labTesting.IsDeleted       = false;
                        sg.LabTestings.Add(labTesting);
                    }
                    appointment.SampleGettings.Add(sg);
                }
                // Create
                appointmentRepo.Create(appointment);
                try
                {
                    var result = this.UnitOfWork.SaveChanges();
                    if (result.Any())
                    {
                        responseObject.Success = false;
                        responseObject.Message = "Có lỗi xảy ra";
                        responseObject.Data    = result;
                        return(responseObject);
                    }
                }
                catch (Exception ex)
                {
                    responseObject.Success = false;
                    responseObject.Message = "Có lỗi xảy ra";
                    responseObject.Data    = ex;
                    return(responseObject);
                }
            }
            catch (Exception ex)
            {
                responseObject.Success = false;
                responseObject.Message = "Có lỗi xảy ra";
                responseObject.Data    = ex;
                return(responseObject);
            }

            return(responseObject);
        }
Пример #23
0
 /// <summary>
 ///   Revises the patient account.
 /// </summary>
 /// <param name="patinetAccount"> The patient account. </param>
 public virtual void RevisePatientAccount(PatientAccount patinetAccount)
 {
     Check.IsNotNull(patinetAccount, () => PatientAccount);
     PatientAccount = patinetAccount;
 }
 public PatientAccount CreateAccount(PatientAccount patientAccount)
 {
     return(patientAccountRepository.Repository.Create(patientAccount));
 }
 public void DeleteAccount(PatientAccount patientAccount)
 {
     patientAccountRepository.Repository.Delete(patientAccount);
 }
Пример #26
0
 /// <summary>
 /// Revises the patient account.
 /// </summary>
 /// <param name="patientAccount">The patient account.</param>
 public virtual void RevisePatientAccount(PatientAccount patientAccount)
 {
     Check.IsNotNull(patientAccount, "Patient account is required.");
     PatientAccount = patientAccount;
 }
 public void RegisterPatient(PatientAccount patientAccount, string emailTemplatePath)
 {
     registrationNotifier
     .SendActivationEmail(patientAccountService.CreateAccount(patientAccount),
                          emailTemplatePath);
 }
 public void SendActivationEmail(PatientAccount patientAccount, string emailTemplatePath)
 {
     ConfigureEmailTemplate(patientAccount.UserGuid, emailTemplatePath, patientAccount.Credentials.Email);
     SendEmail();
 }
Пример #29
0
        /// <summary>
        /// Creates the claim.
        /// </summary>
        /// <param name="encounter">The encounter.</param>
        /// <param name="payor">The payor.</param>
        /// <param name="chargeAmount">The charge amount.</param>
        /// <param name="patientAccount">The patient account.</param>
        /// <param name="placeOfService">The place of service.</param>
        /// <param name="serviceDate">The service date.</param>
        /// <returns>
        /// A claim object.
        /// </returns>
        public Claim CreateClaim(Encounter encounter, Payor payor, Money chargeAmount, PatientAccount patientAccount, Location placeOfService, DateTime serviceDate)
        {
            var claim = new Claim(encounter, payor, chargeAmount, patientAccount, placeOfService, serviceDate);

            _claimRepository.MakePersistent(claim);

            return(claim);
        }