/// <summary>
        /// Creates the alert.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="name">The name.</param>
        /// <param name="note">The note.</param>
        /// <param name="cdsIdentifier">The CDS identifier.</param>
        /// <returns>
        /// A PatientAlert.
        /// </returns>
        public PatientAlert CreateAlert( Patient patient, string name, string note, string cdsIdentifier )
        {
            var patientAlert = new PatientAlert(patient, name, note, cdsIdentifier);
            _patientAlertRepository.MakePersistent(patientAlert);

            return patientAlert;
        }
Exemple #2
0
        /// <summary>
        /// Creates the medication.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="medicationCodeCodedConcept">The medication code coded concept.</param>
        /// <param name="provenance">The provenance.</param>
        /// <returns>A Medication.</returns>
        public Medication CreateMedication(Patient patient, CodedConcept medicationCodeCodedConcept,  Provenance provenance)
        {
            var medication = new Medication(patient, medicationCodeCodedConcept, provenance);

            _medicationRepository.MakePersistent(medication);

            return medication;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Medication"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="medicationCodeCodedConcept">The medication code coded concept.</param>
        /// <param name="rootMedicationCodedConcept">The root medication coded concept.</param>
        protected internal Medication( Patient patient, CodedConcept medicationCodeCodedConcept, CodedConcept rootMedicationCodedConcept )
        {
            Check.IsNotNull ( patient, "Patient is required." );
            Check.IsNotNull ( medicationCodeCodedConcept, () => MedicationCodeCodedConcept );
            Check.IsNotNull ( rootMedicationCodedConcept, () => RootMedicationCodedConcept );

            _patient = patient;
            _medicationCodeCodedConcept = medicationCodeCodedConcept;
            _rootMedicationCodedConcept = rootMedicationCodedConcept;
        }
Exemple #4
0
        internal Allergy( Patient patient, AllergyStatus allergyStatus, CodedConcept allergenCodedConcept )
        {
            Check.IsNotNull ( patient, () => Patient );
            Check.IsNotNull ( allergyStatus, () => AllergyStatus );
            Check.IsNotNull ( allergenCodedConcept, () => AllergenCodedConcept );

            _allergyReactions = new List<AllergyReaction> ();
            _patient = patient;
            _allergyStatus = allergyStatus;
            _allergenCodedConcept = allergenCodedConcept;
        }
        /// <summary>
        /// Generates the unique identifier.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <returns>The generated unique identifier.</returns>
        public string GenerateUniqueIdentifier(Patient patient)
        {
            var identifier = patient.Key.ToString();

            if (patient.Profile.PatientGender != null && patient.Profile.BirthDate.HasValue)
            {
                identifier = GenerateUniqueUniqueIdentifier(patient.Name.Last, patient.Profile.PatientGender.Name, patient.Profile.BirthDate.Value);
            }

            return identifier;
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientAlert"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="name">The name.</param>
        /// <param name="note">The note.</param>
        /// <param name="cdsIdentifier">The CDS identifier.</param>
        protected internal PatientAlert(Patient patient, string name, string note, string cdsIdentifier)
        {
            Check.IsNotNull ( patient, () => Patient );
            Check.IsNotNull ( name, () => Name );
            Check.IsNotNullOrWhitespace ( note, () => Note );
            Check.IsNotNullOrWhitespace ( cdsIdentifier, () => CdsIdentifier );

            _patient = patient;
            _name = name;
            _note = note;
            _cdsIdentifier = cdsIdentifier;
        }
        /// <summary>
        /// Creates the patient document.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="patientDocumentType">Type of the patient document.</param>
        /// <param name="document">The document.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>
        /// A PatientDocument.
        /// </returns>
        public PatientDocument CreatePatientDocument(
            Patient patient,
            PatientDocumentType patientDocumentType,
            byte[] document,
            string fileName )
        {
            var hash = _hashingUtility.ComputeHash ( document );

            var patientDocument = new PatientDocument(patient, patientDocumentType, document, fileName, hash);

            _patientDocumentRepository.MakePersistent ( patientDocument );

            return patientDocument;
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SelfPayment"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="collectedByStaff">The collected by staff.</param>
        /// <param name="money">The money.</param>
        /// <param name="paymentMethod">The payment method.</param>
        /// <param name="collectedDate">The collected date.</param>
        protected internal SelfPayment( Patient patient, Staff collectedByStaff, Money money, PaymentMethod paymentMethod, DateTime? collectedDate )
        {
            Check.IsNotNull ( patient, () => Patient );
            Check.IsNotNull ( collectedByStaff, () => CollectedByStaff );
            Check.IsNotNull ( money, () => Money );
            Check.IsNotNull ( paymentMethod, () => PaymentMethod );
            Check.IsNotNull ( collectedDate, () => CollectedDate );

            _patient = patient;
            _collectedByStaff = collectedByStaff;
            _money = money;
            _paymentMethod = paymentMethod;
            _collectedDate = collectedDate;
        }
        /// <summary>
        /// Creates the clinical case.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="clinicalCaseProfile">The clinical case profile.</param>
        /// <returns>A ClinicalCase.</returns>
        public ClinicalCase CreateClinicalCase(
            Patient patient,
            ClinicalCaseProfile clinicalCaseProfile )
        {
            Check.IsNotNull(patient, "Patient is required.");
            Check.IsNotNull(clinicalCaseProfile, "Clinical case profile is required.");

            long mostRecentCaseNumber = _clinicalCaseRepository.GetMostRecentCaseNumber ( patient.Key );

            var clinicalCase = new ClinicalCase(patient, clinicalCaseProfile, mostRecentCaseNumber);

            _clinicalCaseRepository.MakePersistent ( clinicalCase );

            return clinicalCase;
        }
Exemple #10
0
        /// <summary>
        /// Creates the self payment.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="staff">The staff.</param>
        /// <param name="money">The money.</param>
        /// <param name="paymentMethod">The payment method.</param>
        /// <param name="collectedDate">The collected date.</param>
        /// <returns>A Self Payment.</returns>
        public SelfPayment CreateSelfPayment( Patient patient, Staff staff, Money money, PaymentMethod paymentMethod, DateTime? collectedDate )
        {
            var selfPayment = new SelfPayment ( patient, staff, money, paymentMethod, collectedDate );
            SelfPayment createdSelfPayment = null;

            DomainRuleEngine.CreateRuleEngine ( selfPayment, "CreateSelfPaymentRuleSet" )
                .Execute ( () =>
                    {
                        createdSelfPayment = selfPayment;

                        _selfPaymentRepository.MakePersistent(createdSelfPayment);
                    });

            return createdSelfPayment;
        }
        /// <summary>
        /// Creates the patient contact.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="firstName">The first name.</param>
        /// <param name="lastName">The last name.</param>
        /// <returns>
        /// A PatientContact.
        /// </returns>
        public PatientContact CreatePatientContact( Patient patient, string firstName, string lastName )
        {
            var newPatientContact = new PatientContact ( patient, firstName, lastName );
            PatientContact createdPatientContact = null;

            DomainRuleEngine.CreateRuleEngine ( newPatientContact, "CreatePatientContactRuleSet" ).Execute (
                () =>
                    {
                        createdPatientContact = newPatientContact;

                        _patientContactRepository.MakePersistent ( newPatientContact );
                    } );

            return createdPatientContact;
        }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PayorCoverageCache"/> class.
 /// </summary>
 /// <param name="patient">The patient.</param>
 /// <param name="payorCache">The payor cache.</param>
 /// <param name="effectiveDateRange">The effective date range.</param>
 /// <param name="memberNumber">The member number.</param>
 /// <param name="payorSubscriber">The payor subscriber.</param>
 /// <param name="payorCoverageCacheType">Type of the payor coverage cache.</param>
 protected internal PayorCoverageCache(
     Patient patient, 
     PayorCache payorCache, 
     DateRange effectiveDateRange, 
     string memberNumber, 
     PayorSubscriberCache payorSubscriber, 
     PayorCoverageCacheType payorCoverageCacheType )
 {
     Patient = patient;
     PayorCache = payorCache;
     EffectiveDateRange = effectiveDateRange;
     MemberNumber = memberNumber;
     PayorSubscriberCache = payorSubscriber;
     PayorCoverageCacheType = payorCoverageCacheType;
 }
Exemple #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientAccessEvent"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="patientAccessEventType">Type of the patient access event.</param>
        /// <param name="auditedContextDescription">The audited context description.</param>
        /// <param name="note">The note.</param>
        public PatientAccessEvent(
            Patient patient,
            PatientAccessEventType patientAccessEventType,
            string auditedContextDescription,
            string note )
        {
            Check.IsNotNull ( patient, "Patient is required." );
            Check.IsNotNull ( patientAccessEventType, "Patient access event is required." );
            Check.IsNotNull(auditedContextDescription, "Audited context description is required.");
            Check.IsNotNullOrWhitespace ( note, "Note is required." );

            _patient = patient;
            AuditedContextDescription = auditedContextDescription;
            _patientAccessEventType = patientAccessEventType;
            _note = note;
        }
Exemple #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientDocument"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="patientDocumentType">Type of the patient document.</param>
        /// <param name="document">The document.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="documentHashValue">The document hash value.</param>
        protected internal PatientDocument(
            Patient patient,
            PatientDocumentType patientDocumentType,
            byte[] document,
            string fileName,
            string documentHashValue )
        {
            Check.IsNotNull ( patient, "Patient is required." );
            Check.IsNotNull ( patientDocumentType, "Patient Document Type is required." );
            Check.IsNotNull ( document, "Document contents are required." );
            Check.IsNotNullOrWhitespace ( fileName, "Filename is required." );
            Check.IsNotNullOrWhitespace ( documentHashValue, "Document Hash is required." );

            _patient = patient;
            _patientDocumentType = patientDocumentType;
            _document = document;
            _fileName = fileName;
            _documentHashValue = documentHashValue;
        }
Exemple #15
0
        /// <summary>
        /// Creates the patient.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="patientName">Name of the patient.</param>
        /// <param name="patientProfile">The patient profile.</param>
        /// <returns>
        /// A Patient.
        /// </returns>
        public Patient CreatePatient(Agency agency, PersonName patientName, PatientProfile patientProfile )
        {
            var newPatient = new Patient(agency, patientName, patientProfile);
            Patient createdPatient = null;

            DomainRuleEngine.CreateRuleEngine ( newPatient, "CreatePatientRuleSet" )
                .WithContext ( newPatient.Profile )
                .Execute(() =>
                    {
                        createdPatient = newPatient;

                        newPatient.UpdateUniqueIdentifier(_patientUniqueIdentifierCalculator.GenerateUniqueIdentifier(newPatient));

                        _patientRepository.MakePersistent ( newPatient );

                        DomainEvent.Raise ( new PatientCreatedEvent { Patient = newPatient } );
                });

            return createdPatient;
        }
Exemple #16
0
        public void AddAddress_GivenDuplicate_ValidationFailureEventIsRaised()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture ( serviceLocatorFixture );

                var eventRaised = false;
                DomainEvent.Register<RuleViolationEvent>(p => eventRaised = true);

                var agencyMock = new Mock<Agency>();
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");

                var address = new AddressBuilder ()
                    .WithFirstStreetAddress ( "123 Test Street" )
                    .WithCityName ( "Testville" )
                    .WithStateProvince ( new StateProvince () )
                    .WithPostalCode ( new PostalCode ( "12345" ) )
                    .Build ();

                var patientAddress = new PatientAddressBuilder ()
                    .WithPatientAddressType ( new PatientAddressType () )
                    .WithAddress(address)
                    .Build ();

                var patient = new Patient(agencyMock.Object, name, new PatientProfileBuilder().Build());
                patient.AddAddress ( patientAddress );

                // Exercise
                patient.AddAddress(patientAddress);

                // Verify
                Assert.IsTrue(eventRaised);
            }
        }
        /// <summary>
        /// Creates the payor coverage.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="payorCache">The payor cache.</param>
        /// <param name="effectiveDateRange">The effective date range.</param>
        /// <param name="memberNumber">The member number.</param>
        /// <param name="payorSubscriberCache">The payor subscriber cache.</param>
        /// <param name="payorCoverageCacheType">Type of the payor coverage cache.</param>
        /// <returns>A Payor coverage cache.</returns>
        public PayorCoverageCache CreatePayorCoverage(
            Patient patient, 
            PayorCache payorCache, 
            DateRange effectiveDateRange, 
            string memberNumber, 
            PayorSubscriberCache payorSubscriberCache, 
            PayorCoverageCacheType payorCoverageCacheType )
        {
            var payorCoverage = new PayorCoverageCache ( patient, payorCache, effectiveDateRange, memberNumber, payorSubscriberCache, payorCoverageCacheType );

            PayorCoverageCache createdPayorCoverage = null;

            DomainRuleEngine.CreateRuleEngine(payorCoverage, "CreatePayorCoverageRuleSet")
                .WithContext ( payorCoverage.PayorCoverageCacheType )
                .WithContext ( payorCoverage.EffectiveDateRange )
                .Execute(() =>
                {
                    createdPayorCoverage = payorCoverage;

                    _payorCoverageCacheRepository.MakePersistent(payorCoverage);
                });

            return createdPayorCoverage;
        }
Exemple #18
0
        private PatientCharacteristicsType BuildPatientCharacteristics( Patient patient )
        {
            Check.IsNotNull ( patient.Profile.BirthDate, "Patient's Birthdate cannot be null" );
            Debug.Assert ( patient.Profile.BirthDate != null, "patient.BirthDate != null" );

            return new PatientCharacteristicsType
                {
                    Dob = patient.Profile.BirthDate.Value.Date.ToString ( "yyyyMMdd" ),
                    Gender = TransformGenderType ( patient.Profile.PatientGender ),
                    // This assumes Gender is always provided
                    GenderSpecified = true
                };
        }
Exemple #19
0
 /// <summary>
 /// Creates the allergy.
 /// </summary>
 /// <param name="patient">The patient.</param>
 /// <param name="allergyStatus">The allergy status.</param>
 /// <param name="allergenCodedConcept">The allergen coded concept.</param>
 /// <param name="provenance">The provenance.</param>
 /// <returns>
 /// An Allergy.
 /// </returns>
 public Allergy CreateAllergy(Patient patient, AllergyStatus allergyStatus, CodedConcept allergenCodedConcept, Provenance provenance)
 {
     var allergy = new Allergy(patient, allergyStatus, allergenCodedConcept, provenance);
     _allergyRepository.MakePersistent(allergy);
     return allergy;
 }
Exemple #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PatientContact"/> class.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="firstName">The first name.</param>
        /// <param name="lastName">The last name.</param>
        protected internal PatientContact( Patient patient, string firstName, string lastName )
        {
            Check.IsNotNull ( patient, "Patient is required." );
            Check.IsNotNullOrWhitespace ( firstName, "First name is required." );
            Check.IsNotNullOrWhitespace ( lastName, "Last name is required." );

            _patient = patient;
            _firstName = firstName;
            _lastName = lastName;

            _phoneNumbers = new List<PatientContactPhone> ();
            _contactTypes = new List<PatientContactContactType> ();
        }
        /// <summary>
        /// Gets the HL7 message.
        /// </summary>
        /// <param name="keyValues">The key values.</param>
        /// <returns>A <see cref="System.String"/></returns>
        public string GetHl7Message( Dictionary<string, long> keyValues )
        {
            var problemKey = keyValues[HttpHandlerQueryStrings.ProblemKey];
            var session = _sessionProvider.GetSession ();

            _messageLocalDateTime = DateTime.Now;
            _problem = session.Get<Problem> ( keyValues[HttpHandlerQueryStrings.ProblemKey] );
            Check.IsNotNull ( _problem, string.Format ( "Problem not found for key {0}.", problemKey ) );

            // Derive a visit appointment date for a problem associated with multiple visits.
            // Return the first minimum Appointment.ScheduledStartDateTime and Visit.Key where the Problem.Key is found.
            var queryResult = session.CreateQuery (
                @"select min(v.AppointmentDateTimeRange.StartDateTime) as AppointmentStartDateTime, vp.Visit.Key as VisitKey
                from VisitProblem as vp
                join vp.Visit as v
                where vp.Problem.Key = :problemKey
                group by vp.Visit.Key" )
                .SetParameter ( "problemKey", problemKey )
                .List ();

            _minimumVisitScheduledStartDateTime = ( DateTime )( ( object[] )queryResult[0] )[0];
            _minimumVisitKey = ( long )( ( object[] )queryResult[0] )[1];
            VerifyDerivedVisit ();
            _clinicalCase = _problem.ClinicalCase;
            _patient = _problem.ClinicalCase.Patient;

            var dto = new SyndromicSurveillanceDto
                {
                    MshDto = GetMshDto (),
                    PidDto = GetPidDto (),
                    EVNDto = GetEvnDto (),
                    PV1Dto = GetPv1Dto (),
                    Observations = GetObservations (),
                    PresentedProblems = GetPresentedProblems ()
                };

            var helper = IoC.CurrentContainer.Resolve<IMessageHelper<ADT_A01, SyndromicSurveillanceDto>> ();
            var factory = IoC.CurrentContainer.Resolve<MessageFactoryBase<ADT_A01, SyndromicSurveillanceDto>>();

            AbstractMessage message;
            if ( helper != null && factory != null )
            {
                message = factory.CreateMessage ( dto );
            }
            else
            {
                throw new ArgumentException ( "HL7 message helper or factory instances were not created." );
            }
            return ( new PipeParser () ).Encode ( message );
        }
Exemple #22
0
        public void Rename_GivenValidName_ValidationFailureEventIsNotRaised()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                bool eventRaised = false;
                DomainEvent.Register<RuleViolationEvent> ( p => eventRaised = true );

                var agency = new Mock<Agency>();
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");
                var patient = new Patient(agency.Object, name, new PatientProfileBuilder().Build());

                var newName = new PersonNameBuilder()
                    .WithFirst("Fred")
                    .WithLast("Thomas");

                // Exercise
                patient.Rename(newName);

                // Verify
                Assert.IsFalse(eventRaised);
            }
        }
Exemple #23
0
        public void Rename_GivenTheSameName_PatientRenamedEventIsNotRaised()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                bool eventRaised = false;
                DomainEvent.Register<PatientRenamedEvent>(p => eventRaised = true);

                var agencyMock = new Mock<Agency>();
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");
                var patient = new Patient(agencyMock.Object, name, new PatientProfileBuilder().Build());

                // Exercise
                patient.Rename(name);

                // Verify
                Assert.IsFalse(eventRaised);
            }
        }
Exemple #24
0
        private List<OutsidePrescriptionType> BuildOutsidePrescriptionType( Patient patient )
        {
            if ( patient != null && patient.Medications.Any () )
            {
                var outsidePrescriptions = new List<OutsidePrescriptionType> ();

                var medications = patient.Medications
                    .Where ( med => med.MedicationStatus.WellKnownName == MedicationStatus.Active )
                    .ToList ();

                Logger.Debug ( "Patient's Medication List contained {0} active Medications.", medications.Count ().ToString () );

                medications.ForEach (
                    medication =>
                        {
                            outsidePrescriptions.Add ( TransformRemMedicationIntoOutsidePrescriptionAsFreeText ( medication ) );
                            Logger.Debug (
                                "Sending {0} as Free Text OutsidePrescription to NewCrop.",
                                medication.MedicationCodeCodedConcept.DisplayName );
                            // TODO: Make the Sending Rx as Mapped Drug Configurable
                            //outsidePrescriptions.Add ( TransformRemMedicationIntoOutsidePrescriptionAsMappedDrug ( medication ) );
                            //Logger.Debug ( "Sending {0} as Mapped OutsidePrescription to NewCrop.",
                            //                      medication.MedicationCodeCodedConcept.DisplayName );
                        } );

                return outsidePrescriptions;
            }

            return null;
        }
Exemple #25
0
        public void Rename_GivenValidName_NameIsChanged()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                var agencyMock = new Mock<Agency>();
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");
                var patient = new Patient(agencyMock.Object, name, new PatientProfileBuilder().Build());

                var newName = new PersonNameBuilder()
                    .WithFirst("Fred")
                    .WithLast("Thomas");

                // Exercise
                patient.Rename(newName);

                // Verify
                Assert.IsTrue(patient.Name == newName);
            }
        }
Exemple #26
0
        private List<PatientAllergyFreeformType> BuildPatientFreeFormAllergies( Patient patient )
        {
            var allergies = new List<PatientAllergyFreeformType> ();

            var drugAllergies = patient.Allergies
                .Where (
                    a => a.AllergyType.WellKnownName == AllergyType.DrugAllergy
                         && a.AllergyStatus.WellKnownName == AllergyStatus.Active )
                .ToList ();

            drugAllergies.ForEach (
                drugAllergy =>
                    {
                        var da = BuildPatientAllergyFreeformType ( drugAllergy );

                        allergies.Add ( da );
                    } );

            return allergies;
        }
Exemple #27
0
        public void Rename_GivenValidName_PatientRenamedEventWithCorrectInfoIsRaised()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                Patient patientArgumentInEvent = null;
                DomainEvent.Register<PatientRenamedEvent> ( p => patientArgumentInEvent = p.Patient );

                var agencyMock = new Mock<Agency>();
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");
                var patient = new Patient(agencyMock.Object, name, new PatientProfileBuilder().Build());

                var newName = new PersonNameBuilder()
                    .WithFirst("Fred")
                    .WithLast("Thomas");

                // Exercise
                patient.Rename(newName);

                // Verify
                Assert.IsTrue(ReferenceEquals(patient, patientArgumentInEvent) && patientArgumentInEvent.Name == newName);
            }
        }
Exemple #28
0
 private PatientType BuildPatientType( Patient patient )
 {
     if ( patient != null )
     {
         return new PatientType
             {
                 ID = patient.Key.ToString (),
                 PatientName = new PersonNameType { Last = patient.Name.Last, First = patient.Name.First, Middle = patient.Name.Middle },
                 MedicalRecordNumber = patient.UniqueIdentifier,
                 Memo = string.Empty,
                 PatientAddress = PatientAddress ( patient ),
                 PatientCharacteristics = BuildPatientCharacteristics ( patient ),
                 PatientFreeformAllergy = BuildPatientFreeFormAllergies ( patient )
             };
     }
     return BuildDummyPatient ();
 }
Exemple #29
0
        public void Rename_GivenNullAgency_ThrowsArgumentException()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);

                Agency agency = null;
                var name = new PersonNameBuilder()
                    .WithFirst("Albert")
                    .WithLast("Smith");
                var patient = new Patient(agency, name, new PatientProfileBuilder().Build());

                // Exercise
                patient.Rename(null);

                // Verify
            }
        }
Exemple #30
0
        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;
        }