/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="ProgramOffering"/> class. /// </summary> /// <param name="program">The program.</param> /// <param name="location">The location.</param> /// <param name="startDate">The start date.</param> protected internal ProgramOffering( Program program, Location location, DateTime startDate ) : this() { Check.IsNotNull ( program, "Program is required." ); Check.IsNotNull ( location, "Location is required." ); Check.IsNotNull ( startDate, "Start Date is required." ); _program = program; _location = location; _startDate = startDate; }
/// <summary> /// Creates the visit. /// </summary> /// <param name="staff">The staff.</param> /// <param name="appointmentDateTimeRange">The appointment date time range.</param> /// <param name="clinicalCase">The clinical case.</param> /// <param name="visitTemplate">The visit template.</param> /// <param name="serviceLocation">The service location.</param> /// <returns> /// A Visit. /// </returns> public Visit CreateVisit(Staff staff, DateTimeRange appointmentDateTimeRange, ClinicalCase clinicalCase, VisitTemplate visitTemplate, Location serviceLocation ) { var visitStatus = _visitStatusRepository.GetByWellKnownName ( WellKnownNames.VisitModule.VisitStatus.Scheduled ); var visit = new Visit (staff, appointmentDateTimeRange, clinicalCase, visitStatus, serviceLocation, visitTemplate.Name, visitTemplate.CptCode ); _visitRepository.MakePersistent ( visit ); return visit; }
/// <summary> /// Creates the location. /// </summary> /// <param name="agency">The agency.</param> /// <param name="locationProfile">The location profile.</param> /// <returns> /// A Location. /// </returns> public Location CreateLocation(Agency agency, LocationProfile locationProfile) { Check.IsNotNull(agency, "agency is required."); Check.IsNotNull(locationProfile, "locationProfile is required."); var newLocation = new Location ( agency, locationProfile ); Location createdLocation = null; DomainRuleEngine.CreateRuleEngine ( newLocation, "CreateLocationRuleSet" ) .Execute(() => { _locationRepository.MakePersistent(newLocation); createdLocation = newLocation; }); return createdLocation; }
/// <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; }
/// <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; }
public void SetPrimaryLocation_GivenLocationButWithoutAgencyLocations_PrimaryLocationIsNotChanged() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture ( serviceLocatorFixture ); var staff = new Staff(new Mock<Agency>().Object, new StaffProfileBuilder().WithStaffName(new PersonNameBuilder().WithFirst("first name").WithLast("last name"))); var location = new Location( new Mock<Agency>().Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("location name"))); staff.SetPrimaryLocation(null); // Exercise staff.SetPrimaryLocation(location); // Verify Assert.IsTrue ( staff.PrimaryLocation == null ); } }
public void SetPrimaryLocation_GivenLocationButWithoutAgencyLocations_ValidationFailureEventIsRaised() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var staff = new Staff(new Mock<Agency>().Object, new StaffProfileBuilder().WithStaffName(new PersonNameBuilder().WithFirst("first name").WithLast("last name"))); var location = new Location( new Mock<Agency>().Object, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName("location name"))); bool eventRaised = false; DomainEvent.Register<RuleViolationEvent>(p => eventRaised = true); // Exercise staff.SetPrimaryLocation(location); // Verify Assert.IsTrue(eventRaised); } }
/// <summary> /// Revises the place of service. /// </summary> /// <param name="placeOfService"> The place of service. </param> public virtual void RevisePlaceOfService(Location placeOfService) { Check.IsNotNull ( placeOfService, () => ServiceLocation ); ServiceLocation = placeOfService; }
/// <summary> /// Sets the primary location. /// </summary> /// <param name="location"> /// The location. /// </param> public virtual void SetPrimaryLocation( Location location ) { DomainRuleEngine.CreateRuleEngine<Staff, Location> ( this, () => SetPrimaryLocation ) .WithContext ( location ) .Execute ( () => PrimaryLocation = location ); }
/// <summary> /// Remove location assignment. /// </summary> /// <param name="location"> /// The location. /// </param> public virtual void RemoveLocationAssignment( Location location ) { Check.IsNotNull ( location, "Location is required." ); for ( var index = 0; index < _staffLocationAssignments.Count; index++ ) { if ( _staffLocationAssignments[index].Staff.Key != Key || _staffLocationAssignments[index].Location.Key != location.Key ) { continue; } var staffLocationAssignmentToBeRemoved = _staffLocationAssignments[index]; _staffLocationAssignments.Remove ( staffLocationAssignmentToBeRemoved ); NotifyItemRemoved ( () => StaffLocationAssignments, staffLocationAssignmentToBeRemoved ); index--; } }
/// <summary> /// Assign location. /// </summary> /// <param name="location"> /// The location. /// </param> public virtual void AssignLocation( Location location ) { Check.IsNotNull ( location, "Location is required." ); DomainRuleEngine.CreateRuleEngine<Staff, Location> ( this, () => AssignLocation ) .WithContext ( location ) .Execute(() => { var staffLocationAssignment = new StaffLocationAssignment(location) { Staff = this }; _staffLocationAssignments.Add(staffLocationAssignment); NotifyItemAdded(() => StaffLocationAssignments, staffLocationAssignment); }); }
private string BuildLocationPhone( Location location, string identifierType ) { Logger.Debug ( "BuildLocationPhone - Building Phone For Location {0}, Phone Type {1}", location.LocationProfile.LocationName.DisplayName, identifierType ); var candidate = location.LocationAddressesAndPhones.FirstOrDefault ( a => a.LocationAddress.LocationAddressType.WellKnownName == LocationAddressType.Physical ); if ( candidate != null ) { var phoneNumber = candidate.PhoneNumbers .FirstOrDefault ( phone => phone.LocationPhoneType.WellKnownName == identifierType ); if ( phoneNumber == null ) { throw new ApplicationException ( string.Format ( "Location {0} must have a valid Phone Number of type {1}", identifierType, location.LocationProfile.LocationName.DisplayName ) ); } return phoneNumber.Phone.PhoneNumber; } throw new ApplicationException ( string.Format ( "Location {0} Does not contain an Address of type {1}", location.LocationProfile.LocationName.Name, LocationAddressType.Physical ) ); }
/// <summary> /// Creates the program offering. /// </summary> /// <param name="program">The program.</param> /// <param name="location">The location.</param> /// <param name="startDate">The start date.</param> /// <returns> /// A ProgramOffering. /// </returns> public ProgramOffering CreateProgramOffering( Program program, Location location, DateTime startDate ) { var programOffering = new ProgramOffering ( program, location, startDate ); _programOfferingRepository.MakePersistent ( programOffering ); return programOffering; }
/// <summary> /// Revises the place of service. /// </summary> /// <param name="placeOfService">The place of service.</param> public virtual void RevisePlaceOfService( Location placeOfService ) { Check.IsNotNull ( placeOfService, "Place of service is required." ); ServiceLocation = placeOfService; }
/// <summary> /// Changes the Service location. /// </summary> /// <param name="location">The service location.</param> public virtual void ChangeServiceLocation( Location location ) { Check.IsNotNull ( location, "Location is required." ); ServiceLocation = location; }
/// <summary> /// Revises the location. /// </summary> /// <param name="location">The location.</param> public virtual void ReviseLocation( Location location ) { Location = location; }
private Location BuildLocation(Agency agency, string name) { var location = new Location(agency, new LocationProfileBuilder().WithLocationName(new LocationNameBuilder().WithName(name))); Session.SaveOrUpdate(location); return location; }
private ClinicalCase BuildClinicalCase( Patient patient, Location location, long clinicalCaseNumber ) { var clinicalCase = new ClinicalCase ( patient, new ClinicalCaseProfileBuilder().WithInitialLocation(location), clinicalCaseNumber ); Session.SaveOrUpdate ( clinicalCase ); return clinicalCase; }
private void LoadEntitiesFromDomain( long patientKey, long staffKey, long agencyKey, long locationKey ) { Logger.Debug ( "LoadEntitiesFromDomain - Loading Entities" ); var patientCriteria = DetachedCriteria.For<Patient> ( "p" ).Add ( Restrictions.Eq ( Projections.Property ( "p.Key" ), patientKey ) ); var staffCriteria = DetachedCriteria .For<Staff> ( "s" ) .Add ( Restrictions.Eq ( Projections.Property ( "s.Key" ), staffKey ) ); var agencyCriteria = DetachedCriteria.For<Agency> ( "a" ).Add ( Restrictions.Eq ( Projections.Property ( "a.Key" ), agencyKey ) ); var locationCriteria = DetachedCriteria.For<Location> ( "l" ).Add ( Restrictions.Eq ( Projections.Property ( "l.Key" ), locationKey ) ); var multiCriteria = _session.CreateMultiCriteria () .Add ( patientCriteria ) .Add ( staffCriteria ) .Add ( agencyCriteria ) .Add ( locationCriteria ); var criteriaList = multiCriteria.List (); try { _patient = ( ( IList )criteriaList[0] )[0] as Patient; } catch ( ArgumentOutOfRangeException ) { //// No patient with an Id of [_patientKey] was found. _patient = null; } _staff = ( ( IList )criteriaList[1] )[0] as Staff; _agency = ( ( IList )criteriaList[2] )[0] as Agency; _location = ( ( IList )criteriaList[3] )[0] as Location; }
/// <summary> /// Assigns the initial location. /// </summary> /// <param name="initialLocation">The initial location.</param> /// <returns>A ClinicalCaseProfileBuilder.</returns> public ClinicalCaseProfileBuilder WithInitialLocation(Location initialLocation) { _initialLocation = initialLocation; return this; }
/// <summary> /// Initializes a new instance of the <see cref="StaffLocationAssignment"/> class. /// </summary> /// <param name="location">The location.</param> public StaffLocationAssignment(Location location) { Check.IsNotNull(location, "Location is required."); _location = location; }
private AddressType BuildLocationAddress( Location location ) { Logger.Debug ( "BuildLocationAddress - Building Location Address for Location {0}", location.LocationProfile.LocationName.DisplayName ); var candidate = location.LocationAddressesAndPhones.FirstOrDefault ( a => a.LocationAddress.LocationAddressType.WellKnownName == LocationAddressType.Physical ); if ( candidate != null ) { return new AddressType { Address1 = candidate.LocationAddress.Address.FirstStreetAddress, Address2 = candidate.LocationAddress.Address.SecondStreetAddress, City = candidate.LocationAddress.Address.CityName, Country = candidate.LocationAddress.Address.Country.WellKnownName ?? "US", State = candidate.LocationAddress.Address.StateProvince.WellKnownName, Zip = candidate.LocationAddress.Address.PostalCode.Code.Substring ( 0, 5 ) }; } throw new ApplicationException ( string.Format ( "Location {0} Does not contain an Address of type {1}", location.LocationProfile.LocationName.Name, LocationAddressType.Physical ) ); }
/// <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; }
private LocationType BuildLocationType( Location location ) { Logger.Debug ( "BuildLocationType - Building Location with Location {0}", location.LocationProfile.LocationName.DisplayName ); return new LocationType { ID = location.Key.ToString (), LocationName = location.LocationProfile.LocationName.DisplayName, LocationShortName = location.LocationProfile.LocationName.Name, LocationAddress = BuildLocationAddress ( location ), PharmacyContactNumber = BuildLocationPhone ( location, LocationPhoneType.Main ), PrimaryFaxNumber = BuildLocationPhone ( location, LocationPhoneType.Fax ), PrimaryPhoneNumber = BuildLocationPhone ( location, LocationPhoneType.Main ) }; }
/// <summary> /// Initializes a new instance of the <see cref="Visit"/> class. /// </summary> /// <param name="staff">The staff.</param> /// <param name="appointmentDateTimeRange">The appointment date time range.</param> /// <param name="clinicalCase">The clinical case.</param> /// <param name="visitStatus">The visit status.</param> /// <param name="placeOfService">The place of service.</param> /// <param name="name">The name.</param> /// <param name="cptCode">The CPT code.</param> protected internal Visit(Staff staff, DateTimeRange appointmentDateTimeRange, ClinicalCase clinicalCase, VisitStatus visitStatus, Location placeOfService, string name, string cptCode ) : base(staff, appointmentDateTimeRange) { Check.IsNotNull ( clinicalCase, "Clinical case is required." ); Check.IsNotNull ( visitStatus, "Visit status is required." ); Check.IsNotNull ( placeOfService, "Location is required." ); Check.IsNotNull ( name, "Name is required." ); Check.IsNotNull ( cptCode, "CptCode is required." ); if ( visitStatus.WellKnownName != WellKnownNames.VisitModule.VisitStatus.Scheduled ) { throw new ArgumentException ( "Visits must always be created as scheduled visits." ); } _clinicalCase = clinicalCase; _visitStatus = visitStatus; _serviceLocation = placeOfService; _name = name; _cptCode = cptCode; _activities = new List<Activity> (); _problems = new List<VisitProblem> (); }
/// <summary> /// Determines if the values are equal. /// </summary> /// <param name="other"> /// The other object. /// </param> /// <returns> /// A boolean denoting equality of the values. /// </returns> public virtual bool ValuesEqual(Location other) { return ValuesEqual(other.LocationProfile, other.Agency); }
/// <summary> /// Destroys the location. /// </summary> /// <param name="location">The location.</param> public void DestroyLocation(Location location) { Check.IsNotNull(location, "Location is required"); _locationRepository.MakeTransient(location); }