Ejemplo n.º 1
0
        /// <summary>
        /// Creates the patient account.
        /// </summary>
        /// <param name="billingOffice">The billing office.</param>
        /// <param name="medicalRecordNumber">The medical record number.</param>
        /// <param name="name">The name.</param>
        /// <param name="birthDate">The birth date.</param>
        /// <param name="homeAddress">The home address.</param>
        /// <param name="administrativeGender">The administrative gender.</param>
        /// <returns>A patient account.</returns>
        public virtual PatientAccount CreatePatientAccount(BillingOffice billingOffice, long medicalRecordNumber, PersonName name, DateTime?birthDate, Address homeAddress, AdministrativeGender administrativeGender)
        {
            var patientAccount = new PatientAccount(billingOffice, medicalRecordNumber, name, birthDate, homeAddress, administrativeGender);

            _patientAccountRepository.MakePersistent(patientAccount);
            return(patientAccount);
        }
Ejemplo n.º 2
0
        public void RevisePhones_GivenAPhoneListAndPatientAccountHasNoPhone_PatientAccountHasTheSamePhoneList()
        {
            // 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 inputPhoneList = new List<PatientAccountPhone> {new Mock<PatientAccountPhone>().Object};

            // Exercise
            patientAccount.RevisePhones ( inputPhoneList );

            // Verify
            Assert.AreEqual(inputPhoneList.Count, patientAccount.Phones.Count());
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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;
        }
        /// <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;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates the patient account.
 /// </summary>
 /// <param name="billingOffice">The billing office.</param>
 /// <param name="medicalRecordNumber">The medical record number.</param>
 /// <param name="name">The name.</param>
 /// <param name="birthDate">The birth date.</param>
 /// <param name="homeAddress">The home address.</param>
 /// <param name="administrativeGender">The administrative gender.</param>
 /// <returns>A patient account.</returns>
 public virtual PatientAccount CreatePatientAccount( BillingOffice billingOffice, long medicalRecordNumber, PersonName name, DateTime? birthDate, Address homeAddress, AdministrativeGender administrativeGender)
 {
     var patientAccount = new PatientAccount ( billingOffice, medicalRecordNumber, name, birthDate, homeAddress, administrativeGender );
     _patientAccountRepository.MakePersistent ( patientAccount );
     return patientAccount;
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
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;
 }