Example #1
0
        public static Patient CreatePatient(string mrn)
        {
            Patient        patient = new Patient();
            PatientProfile profile = new PatientProfile(
                new PatientIdentifier(mrn, new InformationAuthorityEnum("UHN", "UHN", "")),
                null,
                new HealthcardNumber("1111222333", new InsuranceAuthorityEnum("OHIP", "OHIP", ""), null, null),
                new PersonName("Roberts", "Bob", null, null, null, null),
                DateTime.Now - TimeSpan.FromDays(4000),
                Sex.M,
                new SpokenLanguageEnum("en", "English", null),
                new ReligionEnum("X", "unknown", null),
                false,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                patient
                );

            patient.AddProfile(profile);

            return(patient);
        }
Example #2
0
		public static Patient CreatePatient(string mrn)
        {
            Patient patient = new Patient();
            PatientProfile profile = new PatientProfile(
                new PatientIdentifier(mrn, new InformationAuthorityEnum("UHN", "UHN", "")),
                null,
                new HealthcardNumber("1111222333", new InsuranceAuthorityEnum("OHIP", "OHIP", ""), null, null),
                new PersonName("Roberts", "Bob", null, null, null, null),
                DateTime.Now - TimeSpan.FromDays(4000),
                Sex.M,
                new SpokenLanguageEnum("en", "English", null),
                new ReligionEnum("X", "unknown", null),
                false,
				null,
                null,
                null,
                null,
                null,
                null,
                null,
                patient
                );

            patient.AddProfile(profile);

            return patient;
        }
        public async Task <PatientProfile> UpdatePatientProfile(PatientProfile patientProfile)
        {
            try
            {
                PatientProfile patientProfileData =
                    _PmtctUnitOfWork.Repository <PatientProfile>().FindById(patientProfile.Id);
                if (null != patientProfileData)
                {
                    patientProfileData.PatientMasterVisitId = patientProfileData.PatientMasterVisitId;
                    patientProfileData.PregnancyId          = patientProfileData.PregnancyId;
                    patientProfileData.TreatedForSyphilis   = patientProfileData.TreatedForSyphilis;
                    patientProfileData.VisitType            = patientProfileData.VisitType;
                    patientProfileData.VisitNumber          = patientProfileData.VisitNumber;
                }
                _PmtctUnitOfWork.Repository <PatientProfile>().Update(patientProfileData);
                await _PmtctUnitOfWork.SaveAsync();

                return(patientProfileData);
            }
            catch (Exception e)
            {
                Log.Error(e.Message + " " + e.InnerException);
                throw;
            }
        }
        public Patient GetPatient(string mrn, string assigningAuthority, bool createIfNotExist)
        {
            Platform.CheckForEmptyString(mrn, "mrn");
            Platform.CheckForEmptyString(assigningAuthority, "assigningAuthority");
            var infoAuth =
                _persistenceContext.GetBroker <IEnumBroker>().TryFind <InformationAuthorityEnum>(assigningAuthority);
            Patient patient  = null;
            var     criteria = new PatientProfileSearchCriteria();

            criteria.Mrn.Id.EqualTo(mrn);
            criteria.Mrn.AssigningAuthority.EqualTo(infoAuth);

            try
            {
                var profile =
                    _persistenceContext.GetBroker <IPatientProfileBroker>().FindOne(criteria);
                patient = profile.Patient;
                _patients.Add(new LockableEntity <Patient>(patient, DirtyState.Dirty));
            }
            catch (EntityNotFoundException)
            {
                if (createIfNotExist)
                {
                    patient = new Patient();
                    _patients.Add(new LockableEntity <Patient>(patient, DirtyState.New));
                    var profile = new PatientProfile {
                        Mrn = { Id = mrn, AssigningAuthority = infoAuth }
                    };
                    patient.AddProfile(profile);
                }
            }

            return(patient);
        }
Example #5
0
        //Update patient profile
        public JsonResult GetProfile()
        {
            // Session["AdminUserName"] = "******";
            Models.PatientProfile profile = new PatientProfile();
            string  LivePatient           = Session["PatientUserName"].ToString();
            DataSet data = profile.getProfileDetails(LivePatient);

            List <PatientProfile> profileList = new List <PatientProfile>();


            foreach (DataRow dr in data.Tables[0].Rows)
            {
                profileList.Add(new PatientProfile
                {
                    Patient_Name     = dr["Patient_Name"].ToString(),
                    Patient_UserName = dr["Patient_Username"].ToString(),
                    Patient_Email    = dr["Patient_Email"].ToString(),
                    Patient_Password = dr["Patient_Password"].ToString(),
                    Patient_Contact  = dr["Patient_Contact"].ToString(),
                    Patient_DOB      = dr["Patient_DOB"].ToString(),
                    Patient_BloodGP  = dr["Patient_BloodGP"].ToString(),
                    Patient_Gender   = dr["Patient_Gender"].ToString(),
                    Patient_City     = dr["Patient_City"].ToString(),
                    Patient_State    = dr["Patient_State"].ToString(),
                    Patient_Country  = dr["Patient_Country"].ToString(),
                    Patient_Pin      = Convert.ToInt32(dr["Patient_Pin"])
                });
            }

            return(Json(profileList, JsonRequestBehavior.AllowGet));
        }
        public async Task <long> CreatePatientAsync(CreatePatientInput input)
        {
            PatientProfile patient   = _mapper.Map <PatientProfile>(input);
            long           patientId = await _patientrepository.InsertAndGetIdAsync(patient);

            return(patientId);
        }
Example #7
0
        public static Registeruser EditUser(int id, Guid _doctorkey)
        {
            Registeruser    _edituser      = new Registeruser();
            GuruETCEntities _etc           = new GuruETCEntities();
            long?           DoctorKey      = _etc.DoctorProfiles.Where(d => d.UserGuid == _doctorkey).Select(d => d.Id).FirstOrDefault();
            PatientProfile  _profile       = _etc.PatientProfiles.Where(d => d.Id == id).FirstOrDefault();
            MembershipUser  _getUserbyName = Membership.GetUser(_profile.UserGuid);

            if (_profile != null)
            {
                if (_profile.DoctorId == DoctorKey)
                {
                    _edituser.Email             = _getUserbyName.Email;
                    _edituser.UserName          = _getUserbyName.UserName;
                    _edituser.PhoneNumber       = _profile.PhoneNumber;
                    _edituser.PersonalMotivator = _profile.PersonalMotivator;
                    _edituser.PatientHistorical = _profile.PersonalHistorical;
                    _edituser.MedicalHistory    = _profile.MedicalHistory;
                    _edituser.DOB      = _profile.DOB.Value.ToShortDateString();
                    _edituser.Address1 = _profile.Address1;
                    _edituser.Address2 = _profile.Address2;
                    _edituser.Name     = _profile.Name;
                }
            }
            return(_edituser);
        }
Example #8
0
        public AddPatientResponse AddPatient(AddPatientRequest request)
        {
            var profile = new PatientProfile();

            // check if we should auto-generate the MRN
            var workflowConfig = new WorkflowConfigurationReader();

            if (workflowConfig.AutoGenerateMrn)
            {
                var authorities = PersistenceContext.GetBroker <IEnumBroker>().Load <InformationAuthorityEnum>(false);

                // just use the first Information Authority (there is typically only one in this case)
                profile.Mrn.AssigningAuthority = CollectionUtils.FirstElement(authorities);
                profile.Mrn.Id = PersistenceContext.GetBroker <IMrnBroker>().GetNext();
            }


            var patient = new Patient();

            patient.AddProfile(profile);

            UpdateHelper(profile, request.PatientDetail, true, true, !workflowConfig.AutoGenerateMrn);

            PersistenceContext.Lock(patient, DirtyState.New);

            LogicalHL7Event.PatientCreated.EnqueueEvents(profile);

            PersistenceContext.SynchState();

            var assembler = new PatientProfileAssembler();

            return(new AddPatientResponse(assembler.CreatePatientProfileSummary(profile, PersistenceContext)));
        }
 public OperationData(string operation, PatientProfile patientProfile, Order order, IEnumerable <Procedure> procedures)
 {
     Operation  = operation;
     Patient    = new PatientData(patientProfile);
     Order      = new OrderData(order);
     Procedures = procedures.Select(rp => new ProcedureData(rp)).ToList();
 }
        public ActionResult New()
        {
            PatientProfile patient = new PatientProfile();

            patient.UserId = User.Identity.GetUserId();
            return(View(patient));
        }
        public void DoneSelectionPatient(PatientProfile pp)
        {
            //TODO: mettere il paziente selezionato, non il primo della lista
            myContext.currentPatient = pp;

            myContext.DoneCallBack();
        }
        public async Task <IActionResult> PutPatientProfile([FromRoute] int id, [FromBody] PatientProfile patientProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != patientProfile.Recid)
            {
                return(BadRequest());
            }

            _context.Entry(patientProfile).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PatientProfileExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public PatientProfile LoadPatientProfile(EntityRef profileRef)
        {
            IPatientProfileBroker profileBroker = this.CurrentContext.GetBroker <IPatientProfileBroker>();
            PatientProfile        patient       = profileBroker.Load(profileRef);

            return(patient);
        }
Example #14
0
        public static string UpdateUser(Registeruser _updateUser, Guid _pkey)
        {
            string msg = "Error";

            try
            {
                GuruETCEntities _etc     = new GuruETCEntities();
                PatientProfile  _profile = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault();
                if (_profile != null)
                {
                    _profile.Name               = _updateUser.Name;
                    _profile.MedicalHistory     = _updateUser.MedicalHistory;
                    _profile.PersonalHistorical = _updateUser.PatientHistorical;
                    _profile.PersonalMotivator  = _updateUser.PersonalMotivator;
                    _profile.PhoneNumber        = _updateUser.PhoneNumber;
                    _profile.Address1           = _updateUser.Address1;
                    _profile.Address2           = _updateUser.Address2;
                    _profile.DOB = Convert.ToDateTime(_updateUser.DOB);
                    _etc.SaveChanges();
                    msg = "Success";
                }
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
        public ActionResult Edit(PatientProfile requestPatientProfile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    PatientProfile a = db.PatientsProfiles.Find(User.Identity.GetUserId());


                    if (TryUpdateModel(a))
                    {
                        a.PatientName        = requestPatientProfile.PatientName;
                        a.Age                = requestPatientProfile.Age;
                        a.HealthIssues       = requestPatientProfile.HealthIssues;
                        a.SurgicalProcedures = requestPatientProfile.SurgicalProcedures;
                        a.FamilyDoctor       = requestPatientProfile.FamilyDoctor;

                        db.SaveChanges();
                        TempData["message"] = "Profilul a fost modificat!";
                    }
                    return(RedirectToAction("Show", "PatientProfile"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Example #16
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            var page = new PatientProfile();
            var id   = (this.DataContext as EditDentalProcedureViewModel).PatientId;

            (page.DataContext as PatientProfileViewModel).LoadData(id);
            this.NavigationService.Navigate(page);
        }
        public ActionResult Edit()
        {
            PatientProfile a = db.PatientsProfiles.Find(User.Identity.GetUserId());

            ViewBag.Article = a;


            return(View(a));
        }
Example #18
0
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            (this.DataContext as PatientPhotoesHomeViewModel).Clear();
            var page = new PatientProfile();
            var id   = (this.DataContext as PatientPhotoesHomeViewModel).Id;

            (page.DataContext as PatientProfileViewModel).LoadData(id);
            NavigationService.Navigate(page);
        }
        public ActionResult Delete()
        {
            PatientProfile a = db.PatientsProfiles.Find(User.Identity.GetUserId());

            db.PatientsProfiles.Remove(a);
            db.SaveChanges();
            TempData["message"] = "Profilul a fost sters!";
            return(RedirectToAction("New", "PatientProfile"));
        }
Example #20
0
        public IActionResult Create()
        {
            var model = new PatientProfile
            {
                TreatmentDate = DateTime.Now
            };

            ViewData["GenderId"] = new SelectList(_context.Genders, "Id", "Name");
            return(View(model));
        }
Example #21
0
        public ActionResult Index(PatientInfo patient)
        {

            string emailId = patient.emailId;
            string password = patient.password;

            var test = PatientProfile.getPatientProfile(emailId, password);

            return View();
        }
        public void SynchronizePatientAccount_PatientAccountDoesNotExist_CreatesPatientAccountCorrectly()
        {
            // Setup
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var billingOffice = new Mock <BillingOffice> ();

            billingOffice.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long>);
            var billingOfficeRepository = new Mock <IBillingOfficeRepository> ();

            billingOfficeRepository.Setup(p => p.GetByAgencyKey(It.IsAny <long> ())).Returns(() => billingOffice.Object);
            fixture.Register(() => billingOfficeRepository.Object);

            var patientAccountRepository = new Mock <IPatientAccountRepository> ();

            patientAccountRepository.Setup(p => p.GetByMedicalRecordNumber(It.IsAny <long> ())).Returns(() => null);
            fixture.Register(() => patientAccountRepository.Object);

            var patientAccount = new Mock <PatientAccount> ();

            patientAccount.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long> ());
            var patientAccountFactory = new Mock <IPatientAccountFactory> ();

            patientAccountFactory.Setup(
                p => p.CreatePatientAccount(It.IsAny <BillingOffice>(), It.IsAny <long>(), It.IsAny <PersonName>(), It.IsAny <DateTime>(), It.IsAny <Address>(), It.IsAny <AdministrativeGender> ())).
            Returns(patientAccount.Object);
            fixture.Register(() => patientAccountFactory.Object);

            var agency = new Mock <Agency> ();

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

            var patient = new Mock <Patient> ();

            patient.SetupGet(p => p.Key).Returns(fixture.CreateAnonymous <long> ());
            patient.SetupGet(p => p.Agency).Returns(agency.Object);

            var patientName = fixture.CreateAnonymous <PersonName> ();

            patient.SetupGet(p => p.Name).Returns(patientName);

            var patientProfile = new PatientProfile(
                new Mock <PatientGender> ().Object, fixture.CreateAnonymous <DateTime?> (), null, null, new EmailAddress("*****@*****.**"));

            patient.SetupGet(p => p.Profile).Returns(patientProfile);

            var patientAccountSynchronizationService = fixture.CreateAnonymous <PatientAccountSynchronizationService> ();

            // Exercise
            patientAccountSynchronizationService.SynchronizePatientAccount(patient.Object);

            // Verify
            patientAccountFactory.Verify(
                p => p.CreatePatientAccount(billingOffice.Object, patient.Object.Key, patientName, It.IsAny <DateTime?>(), It.IsAny <Address> (), It.IsAny <AdministrativeGender> ()));
        }
        public ActionResult Show()
        {
            PatientProfile profile = db.PatientsProfiles.Find(User.Identity.GetUserId());

            if (profile == null)
            {
                return(RedirectToAction("New", "PatientProfile"));
            }

            return(View(profile));
        }
        public PatientProfile LoadPatientProfileDetails(EntityRef profileRef)
        {
            IPatientProfileBroker broker  = this.CurrentContext.GetBroker <IPatientProfileBroker>();
            PatientProfile        patient = broker.Load(profileRef);

            // load all relevant collections
            broker.LoadAddressesForPatientProfile(patient);
            broker.LoadTelephoneNumbersForPatientProfile(patient);

            return(patient);
        }
        public IList <PatientProfileMatch> FindReconciliationMatches(PatientProfile targetProfile, IPersistenceContext context)
        {
            /* User needs to resort to manual linking of patient records from multiple HIS when automatic MPI fails.
             *
             * Allow user to to select 2 or more patient records from different hospitals and merge into an MPI.
             *
             * Display High-Probability match/search results from muliple HIS of patients with various Mrns when
             * field: healthcard # is matched/identical.
             *
             * Display Moderate-Probability match/search results from multiple HIS of patients with various Mrns when fields: surname,
             * given name, DOB, gender are matched/identical.
             *
             */
            IPatientProfileBroker broker = context.GetBroker <IPatientProfileBroker>();

            IList <PatientProfileMatch> matches = new List <PatientProfileMatch>();

            IList <PatientProfileMatch> highMatches = new List <PatientProfileMatch>();

            if (targetProfile.Healthcard != null && !string.IsNullOrEmpty(targetProfile.Healthcard.Id))
            {
                PatientProfileSearchCriteria high = new PatientProfileSearchCriteria();
                high.Healthcard.Id.EqualTo(targetProfile.Healthcard.Id);

                highMatches = PatientProfileMatch.CreateList(targetProfile, broker.Find(high), PatientProfileMatch.ScoreValue.High);
            }

            PatientProfileSearchCriteria moderateViaName = new PatientProfileSearchCriteria();

            if (targetProfile.Name.FamilyName != null && !string.IsNullOrEmpty(targetProfile.Name.FamilyName))
            {
                moderateViaName.Name.FamilyName.EqualTo(targetProfile.Name.FamilyName);
            }

            if (targetProfile.Name.GivenName != null && !string.IsNullOrEmpty(targetProfile.Name.GivenName))
            {
                moderateViaName.Name.GivenName.EqualTo(targetProfile.Name.GivenName);
            }

            if (targetProfile.DateOfBirth != null)
            {
                moderateViaName.DateOfBirth.EqualTo(targetProfile.DateOfBirth);
            }

            moderateViaName.Sex.EqualTo(targetProfile.Sex);

            IList <PatientProfileMatch> moderateMatchesViaName = PatientProfileMatch.CreateList(targetProfile, broker.Find(moderateViaName), PatientProfileMatch.ScoreValue.Moderate);

            matches = PatientProfileMatch.Combine(highMatches, moderateMatchesViaName);

            RemoveConflicts(targetProfile.Patient, matches);

            return(matches);
        }
        public List <int> getDiseaseList(PatientProfile m)
        {
            resetViewBagMessages();
            List <int> l = new List <int>();

            foreach (var disease in m.DiseaseList)
            {
                l.Add(disease.DiseaseID);
            }
            return(l);
        }
Example #27
0
        public ActionResult Index(PatientInfo patient)
        {
            string firstName = patient.firstName;
            string lastName  = patient.lastName;
            string emailId   = patient.emailId;
            string password  = patient.password;

            var test = PatientProfile.createPatientProfile(firstName, lastName, emailId, password);

            return(View());
        }
        public async Task <IActionResult> PostPatientProfile([FromBody] PatientProfile patientProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.PatientProfile.Add(patientProfile);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPatientProfile", new { id = patientProfile.Recid }, patientProfile));
        }
Example #29
0
        private ResultRecipient GetFamilyPhysicianRecipients(PatientProfile profile)
        {
            if (profile == null)
            {
                return(null);
            }
            var familyPhysician = profile.FamilyPhysician;

            return(familyPhysician != null
                       ? new ResultRecipient(familyPhysician.DefaultContactPoint, ResultCommunicationMode.ANY)
                       : null);
        }
        public virtual void SetPID(PID pid, PatientProfile profile)
        {
            pid.PatientID.IDNumber.Value = profile.Mrn.Id;
            pid.PatientID.AssigningAuthority.NamespaceID.Value = profile.Mrn.AssigningAuthority.Value;
            pid.GetAlternatePatientIDPID(0).IDNumber.Value     = profile.Healthcard.Id;
            pid.GetAlternatePatientIDPID(0).AssigningAuthority.NamespaceID.Value =
                profile.Healthcard.AssigningAuthority.Value;
            pid.GetAlternatePatientIDPID(0).CheckDigit.Value = profile.Healthcard.VersionCode;

            pid.GetPatientName(0).GivenName.Value = profile.Name.GivenName;
            pid.GetPatientName(0).SecondAndFurtherGivenNamesOrInitialsThereof.Value =
                profile.Name.MiddleName;
            pid.GetPatientName(0).FamilyName.Surname.Value = profile.Name.FamilyName;
            pid.AdministrativeSex.Value = profile.Sex.ToString();


            SetPhone(pid, profile.CurrentHomePhone);
            SetPhone(pid, profile.CurrentWorkPhone);

            if (profile.CurrentHomeAddress != null)
            {
                pid.GetPatientAddress(0).StreetAddress.StreetOrMailingAddress.Value =
                    profile.CurrentHomeAddress.Street;
                pid.GetPatientAddress(0).City.Value            = profile.CurrentHomeAddress.City;
                pid.GetPatientAddress(0).StateOrProvince.Value = profile.CurrentHomeAddress.Province;
                pid.GetPatientAddress(0).Country.Value         = profile.CurrentHomeAddress.Country;
                pid.GetPatientAddress(0).ZipOrPostalCode.Value = profile.CurrentHomeAddress.PostalCode;
                pid.GetPatientAddress(0).AddressType.Value     = "R";
            }

            if (profile.DateOfBirth.HasValue)
            {
                pid.DateTimeOfBirth.Time.Value = profile.DateOfBirth.Value.ToString("yyyyMMdd");
            }

            if (profile.PrimaryLanguage != null)
            {
                pid.PrimaryLanguage.Identifier.Value = profile.PrimaryLanguage.Value;
            }

            if (profile.Religion != null)
            {
                pid.Religion.Identifier.Value = profile.Religion.Value;
            }

            if (profile.TimeOfDeath.HasValue)
            {
                pid.DateTimeOfBirth.Time.Value = profile.TimeOfDeath.Value.ToString("yyyyMMdd");
            }

            pid.PatientDeathIndicator.Value = BoolToString(profile.DeathIndicator);
        }
        private static void IdentifyConflictsForSiteFromProposedMatches(PatientProfile existingReconciledProfile, IList <PatientProfileMatch> matches, IList <PatientProfileMatch> conflicts)
        {
            String existingMrn = existingReconciledProfile.Mrn.AssigningAuthority.Code;

            foreach (PatientProfileMatch proposedMatch in matches)
            {
                if (proposedMatch.PatientProfile.Mrn.AssigningAuthority.Code == existingMrn)
                {
                    conflicts.Add(proposedMatch);
                    RemoveAllProfilesRelatedToConflict(proposedMatch, matches, conflicts);
                }
            }
        }
Example #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Patient"/> class.
        /// </summary>
        /// <param name="agency">The agency.</param>
        /// <param name="patientName">Name of the patient.</param>
        /// <param name="profile">The profile.</param>
        protected internal Patient(
            Agency agency,
            PersonName patientName,
            PatientProfile profile )
            : this()
        {
            Check.IsNotNull ( agency, "Agency is required." );
            Check.IsNotNull ( patientName, "Patient name is required" );
            Check.IsNotNull ( profile, "Patient profile is required" );

            Agency = agency;
            _name = patientName;

            _profile = profile;
        }
Example #33
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;
        }
 public static IList<PatientProfileMatch> CreateList(PatientProfile self, IList<PatientProfile> profileList, ScoreValue score)
 {
     IList<PatientProfileMatch> matchList = new List<PatientProfileMatch>();
     foreach (PatientProfile profile in profileList)
     {
         bool found = false;
         foreach (PatientProfile existing in self.Patient.Profiles)
         {
             if (profile.Equals(existing))
             {
                 found = true;
                 break;
             }
         }
         if (found == false)
         {
             matchList.Add(new PatientProfileMatch(profile, score));
         }
     }
     return matchList;
 }
Example #35
0
			internal PatientFacade(PatientProfile patientProfile)
			{
				_patientProfile = patientProfile;
			}
 public PatientProfileMatch(PatientProfile patientProfile, ScoreValue score)
 {
     _patientProfile = patientProfile;
     _score = score;
 }
Example #37
0
        /// <summary>
        /// Revises the profile.
        /// </summary>
        /// <param name="patientProfile">The patient profile.</param>
        public virtual void ReviseProfile( PatientProfile patientProfile )
        {
            Check.IsNotNull ( patientProfile, "Patient Profile is required." );

            DomainRuleEngine.CreateRuleEngine<Patient, PatientProfile> ( this, () => ReviseProfile )
                .WithContext ( patientProfile )
                .Execute (
                    () =>
                        {
                            Profile = patientProfile;
                            DomainEvent.Raise ( new PatientProfileRevisedEvent { Patient = this } );
                        } );
        }
        public void SynchronizePatientAccount_PatientAccountDoesNotExist_CreatesPatientAccountCorrectly()
        {
            // Setup
            var fixture = new Fixture ().Customize ( new AutoMoqCustomization () );

            var billingOffice = new Mock<BillingOffice> ();
            billingOffice.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> );
            var billingOfficeRepository = new Mock<IBillingOfficeRepository> ();
            billingOfficeRepository.Setup ( p => p.GetByAgencyKey ( It.IsAny<long> () ) ).Returns ( () => billingOffice.Object );
            fixture.Register ( () => billingOfficeRepository.Object );

            var patientAccountRepository = new Mock<IPatientAccountRepository> ();
            patientAccountRepository.Setup ( p => p.GetByMedicalRecordNumber ( It.IsAny<long> () ) ).Returns ( () => null );
            fixture.Register ( () => patientAccountRepository.Object );

            var patientAccount = new Mock<PatientAccount> ();
            patientAccount.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );
            var patientAccountFactory = new Mock<IPatientAccountFactory> ();
            patientAccountFactory.Setup (
                p => p.CreatePatientAccount(It.IsAny<BillingOffice>(), It.IsAny<long>(), It.IsAny<PersonName>(), It.IsAny<DateTime>(), It.IsAny<Address>(), It.IsAny<AdministrativeGender> ())).
                Returns ( patientAccount.Object );
            fixture.Register ( () => patientAccountFactory.Object );

            var agency = new Mock<Agency> ();
            agency.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );

            var patient = new Mock<Patient> ();
            patient.SetupGet ( p => p.Key ).Returns ( fixture.CreateAnonymous<long> () );
            patient.SetupGet ( p => p.Agency ).Returns ( agency.Object );

            var patientName = fixture.CreateAnonymous<PersonName> ();
            patient.SetupGet ( p => p.Name ).Returns ( patientName );

            var patientProfile = new PatientProfile (
                new Mock<PatientGender> ().Object, fixture.CreateAnonymous<DateTime?> (), null, null, new EmailAddress("*****@*****.**") );
            patient.SetupGet(p => p.Profile).Returns(patientProfile);

            var patientAccountSynchronizationService = fixture.CreateAnonymous<PatientAccountSynchronizationService> ();

            // Exercise
            patientAccountSynchronizationService.SynchronizePatientAccount ( patient.Object );

            // Verify
            patientAccountFactory.Verify (
                p => p.CreatePatientAccount(billingOffice.Object, patient.Object.Key, patientName, It.IsAny<DateTime?>(), It.IsAny<Address> (), It.IsAny<AdministrativeGender> ()));
        }