コード例 #1
0
        public async Task <IActionResult> Search(SearchPatient search)
        {
            string id    = _userManager.GetUserId(User);
            var    query = _context.Patients.Include(d => d.User).Include(p => p.InsuranceCompany).ToArray();

            if (User.IsInRole("Doctor"))
            {
                search.EditList = _context.Doctor_Patients.Where(r => r.Doctor.User.Id == id).Select(r => r.Patient.Id).ToArray();
                if (search.MyPatients)
                {
                    query = query.Where(p => search.EditList.Contains(p.Id)).ToArray();
                }
            }
            else
            if (User.IsInRole("Admin") || User.IsInRole("Assistant"))
            {
                search.EditList = _context.Patients.Select(p => p.Id).ToArray();
            }
            else if (User.IsInRole("Insurance"))
            {
                query = _context.Patients.Include(p => p.InsuranceCompany).Where(p => p.InsuranceCompany.User.Id == id).ToArray();
            }


            if (search.SearchId != 0)
            {
                search.Patients = query.Where(d => d.Id == search.SearchId).ToArray();
                return(View(search));
            }
            if (search.FirstName != null)
            {
                query = query.Where(d => d.FirstName == search.FirstName).ToArray();
            }
            if (search.MiddleName != null)
            {
                query = query.Where(d => d.MiddleName == search.MiddleName).ToArray();
            }
            if (search.LastName != null)
            {
                query = query.Where(d => d.LastName == search.LastName).ToArray();
            }
            if (search.BirthdateFrom != DateTime.MinValue)
            {
                query = query.Where(d => d.Birthdate >= search.BirthdateFrom).ToArray();
            }
            if (search.BirthdateTo != DateTime.MinValue)
            {
                query = query.Where(d => d.Birthdate <= search.BirthdateTo).ToArray();
            }
            if (search.Order == "desc")
            {
                query = query.OrderByDescending(d => d.FirstName).ToArray();
            }
            else
            {
                query = query.OrderBy(d => d.FirstName).ToArray();
            }
            search.Patients = query;
            return(View(search));
        }
コード例 #2
0
ファイル: ResearcherController.cs プロジェクト: eugeb/Custom2
        public SearchCondition ProcessCondition(condition c)
        {
            SearchCondition condition  = null;
            Comparison      comparison = this.GetComparison(c.selectedComparison);

            switch (c.selectedClass)
            {
            case "Questionnaire":
                condition = new SearchQuestionnaire()
                {
                    Comparison = comparison, Value = c.selectedField
                };
                break;

            case "Patient":
                condition = new SearchPatient()
                {
                    Comparison = comparison, TagName = c.selectedField, Value = c.value
                };
                break;

            case "Response":
                condition = new SearchResponseGroup()
                {
                    Comparison = comparison, SearchField = (c.selectedField == "Date Completed" ? SearchResponseGroupFields.DateTimeCompleted : SearchResponseGroupFields.DateTimeStarted), Value = c.value
                };
                break;
            }

            return(condition);
        }
コード例 #3
0
        private void PatientInfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            SearchPatient sp = new SearchPatient(info);

            sp.MdiParent = this.MdiParent;
            sp.Show();
        }
コード例 #4
0
        private void btnFinished_Click(object sender, EventArgs e)
        {
            SearchPatient sp = new SearchPatient(info);

            sp.MdiParent = this.MdiParent;
            sp.Show();
            this.Close();
        }
コード例 #5
0
        private SearchPatient GetSearchPatient(DsioSearchPatient commandPatient)
        {
            // *** Gets a SearchPatient based on string only commandPatient ***

            // *** Get the tracking status ***
            CurrentTrackingStatus trackStat = GetTrackingStatus(commandPatient.TrackingStatus);

            // *** Create the new patient ***
            SearchPatient uiPatient = new SearchPatient()
            {
                Dfn               = commandPatient.Dfn,
                LastName          = commandPatient.LastName,
                FirstName         = commandPatient.FirstName,
                Veteran           = commandPatient.Veteran,
                Location          = commandPatient.Location,
                RoomBed           = commandPatient.RoomBed,
                CurrentlyTracking = trackStat
            };

            uiPatient.Sensitive = (commandPatient.Sensitive == "1") ? true : false;

            //// *** Determine if sensitive ***
            //if (commandPatient.Last4.Contains("SENSITIVE"))
            //    uiPatient.Sensitive = true;
            //else
            if (!uiPatient.Sensitive)
            {
                // *** Prepare SSN ***
                uiPatient.Last4   = commandPatient.Last4;
                uiPatient.FullSSN = string.Format("XXX-XX-{0}", uiPatient.Last4);

                // *** Handle DOB ***
                //DateTime dob = DateTime.MinValue ;
                //if (DateTime.TryParse(commandPatient.DateOfBirth, out dob))
                //    uiPatient.DateOfBirth = dob;
                //else
                //{
                //    uiPatient.DateOfBirth = DateTime.MinValue;
                //    ErrorLogger.Log(string.Format("PatientRepository.GetSearchPatient: Could not parse date [{0}]", commandPatient.DateOfBirth ));
                //}

                // *** Process/Parse dob ***
                DateTime dob;
                if (DateTime.TryParse(commandPatient.DateOfBirth, out dob))
                {
                    uiPatient.DateOfBirth = dob;
                }
                else
                {
                    uiPatient.DateOfBirthInexact = Util.GetInexactDate(commandPatient.DateOfBirth);
                }
            }

            return(uiPatient);
        }
コード例 #6
0
        public void testCreateSearchPatientExistDictionary()
        {
            String patId = "1";

            MedicalInformationManagementSystem.SearchPatient pa = new SearchPatient();
            Assert.IsNotNull(pa);
            Dictionary <String, String> dict = pa.createCheckPatientExistsDictionary(patId);

            Assert.IsNotNull(dict);
            Assert.IsTrue(dict.ContainsKey("@patientId"));
            Assert.AreSame(dict["@patientId"], patId);
        }
コード例 #7
0
        private void btnPatientSearch_Click(object sender, EventArgs e)
        {
            SearchPatient search = new SearchPatient();

            search.ShowDialog();
            if (search.xPatientId.ToString() != "0")
            {
                txtPatientId.Text      = search.xPatientId.ToString();
                txtPatientName.Text    = search.xPatientName == null ? "" : search.xPatientName;
                rchPatientAddress.Text = search.xPatientAddress == null ? "" : search.xPatientAddress;
                txtUhid.Text           = search.xUhid == null ? "" : search.xUhid;
            }
        }
コード例 #8
0
        public void testCreateSearchPatientExistDataTable()
        {
            String patId = "1";

            MedicalInformationManagementSystem.SearchPatient pa = new SearchPatient();
            Assert.IsNotNull(pa);
            Dictionary <String, String> dict = pa.createCheckPatientExistsDictionary(patId);

            Assert.IsNotNull(dict);
            Assert.IsTrue(dict.ContainsKey("@patientId"));
            Assert.AreSame(dict["@patientId"], patId);
            DataTable dat = new DataTable();
            //dat = pa.checkPatientExists(dict);

            //Assert.IsNotNull(dat);
            // Assert.AreEqual(dat.Rows[0][1],0);
        }
コード例 #9
0
ファイル: SearchHandler.cs プロジェクト: eugeb/Custom2
        /// <summary>
        /// Builds a conditional expression for a QuestionnaireUserResponseGroup
        /// </summary>
        /// <param name="searchCondition">The SearchCondition to create the expression for</param>
        /// <returns>The requested expression</returns>
        private Expression <Func <QuestionnaireUserResponseGroup, bool> > BuildConditionQuery(SearchCondition searchCondition)
        {
            Expression <Func <QuestionnaireUserResponseGroup, bool> > result = null;

            if (searchCondition.SearchType == typeof(ProInstrument))
            {
                result = BuildCondition <QuestionnaireUserResponseGroup, string>(r => r.Questionnaire.Name, searchCondition.Value, searchCondition.Comparison);
            }
            else if (searchCondition.SearchType == typeof(Patient))
            {
                SearchPatient patient    = (SearchPatient)searchCondition;
                var           expression = BuildCondition <QuestionnaireUserResponseGroupTag, string>(t => t.TextValue, searchCondition.Value, searchCondition.Comparison, t2 => t2.TagName == patient.TagName);
                result = r => this.context.QuestionnaireUserResponseGroupTags.Where(expression).Where(t => t.GroupId == r.Id).Count() > 0;
            }
            else if (searchCondition.SearchType == typeof(QuestionnaireUserResponseGroup))
            {
                SearchResponseGroup group = (SearchResponseGroup)searchCondition;
                DateTime            value;
                if (!DateTime.TryParse(group.Value, out value))
                {
                    throw new ArgumentException("Value [" + group.Value + "] is not a valid date time variable");
                }

                value = new DateTime(value.Year, value.Month, value.Day);
                switch (group.SearchField)
                {
                case SearchResponseGroupFields.DateTimeStarted:
                    result = this.BuildCondition <QuestionnaireUserResponseGroup, DateTime>(r => r.StartTime.Value, value, group.Comparison);
                    break;

                case SearchResponseGroupFields.DateTimeCompleted:
                    result = this.BuildCondition <QuestionnaireUserResponseGroup, DateTime>(r => r.DateTimeCompleted.Value, value, group.Comparison);
                    break;
                }
            }

            return(result);
        }
コード例 #10
0
 public void TestCreatePatientSearchObject()
 {
     MedicalInformationManagementSystem.SearchPatient search = new SearchPatient();
     Assert.IsNotNull(search);
 }
コード例 #11
0
        public PatientSearchResult Search(string searchParam, int page, int itemsPerPage)
        {
            // *** Gets female patients matching search criteria ***

            PatientSearchResult result = new PatientSearchResult();

            //DsioFemalePatientSearchCommand patSearchCommand;

            //if (Regex.IsMatch(searchParam, @"^[a-zA-Z]\d{4}$"))
            //{
            //    // *** Use Find command ***
            //    DsioFemalePatientFindCommand tempCommand = new DsioFemalePatientFindCommand(broker);

            //    tempCommand.AddCommandArguments(searchParam.ToUpper());

            //    patSearchCommand = tempCommand;
            //}
            //else
            //{
            //    // *** Use Search command ***
            //    patSearchCommand = new DsioFemalePatientSearchCommand(broker);

            //    // *** Set arguments/parameters ***
            //    if (string.IsNullOrWhiteSpace(searchParam))
            //        patSearchCommand.AddCommandArguments("", page, itemsPerPage);
            //    else
            //        patSearchCommand.AddCommandArguments(searchParam.ToUpper(), page, itemsPerPage);
            //}

            // *** Execute command ***
            //RpcResponse response = patSearchCommand.Execute();

            DsioPatientListCommand patSearchCommand = new DsioPatientListCommand(broker);

            patSearchCommand.AddCommandArguments(searchParam, page, itemsPerPage);

            RpcResponse response = patSearchCommand.Execute();

            // *** Set return values ***
            result.Success = (response.Status == RpcResponseStatus.Success);
            result.Message = response.InformationalMessage;

            // *** If we have patients, then add them to return ***
            if (response.Status == RpcResponseStatus.Success)
            {
                if (patSearchCommand.MatchingPatients != null)
                {
                    if (patSearchCommand.MatchingPatients.Count > 0)
                    {
                        foreach (DsioSearchPatient commandPatient in patSearchCommand.MatchingPatients)
                        {
                            SearchPatient uiPatient = GetSearchPatient(commandPatient);

                            if (uiPatient != null)
                            {
                                result.Patients.Add(uiPatient);
                            }
                        }
                    }
                }
                result.TotalResults = patSearchCommand.TotalResults;
            }

            return(result);
        }
コード例 #12
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     DataContext = new SearchPatient();
 }