Пример #1
0
        public PatientSurgery Resolve()
        {
            var patientSurgery          = new PatientSurgery();
            var surgeriesNames          = _context.Surgeries.Select(s => s.Name).ToList();
            var surgeriesRegex          = RegularExpressions.FindWordInList(surgeriesNames);
            var surgeryMatches          = surgeriesRegex.Matches(_surgeryCellValue);
            var surgeryFieldYearMatches = RegularExpressions.ValidYear().Matches(_surgeryCellValue);

            if (surgeryMatches.Count > 0)
            {
                string  matchedSurgeryName = surgeryMatches[0].ToString();
                Surgery dbSurgery          = FindSurgeryByName(matchedSurgeryName);
                if (dbSurgery == null)
                {
                    return(null);
                }

                patientSurgery.SurgeryId = dbSurgery.ID;

                if (NotesCellValueIsNotBlank())
                {
                    patientSurgery.Note = notesCellValue();
                }
                FindAndSetYearInSurgeryColumns(patientSurgery, surgeryFieldYearMatches);
            }
            return(patientSurgery);
        }
Пример #2
0
        private string FindMatchingDiagnosisInDatabase()
        {
            var matched = new List <string>();

            foreach (var dbDiagnosis in AlphabeticalDiagnosisList())
            {
                Regex regExpression = RegularExpressions.FindWordInList(dbDiagnosis.Split(" ").ToList());
                try
                {
                    if (regExpression.IsMatch(_potentialDiagnosis))
                    {
                        matched.Add(dbDiagnosis);
                    }
                } catch (InvalidOperationException ex)
                {
                    continue;
                }
            }
            return(matched.FirstOrDefault(el => _potentialDiagnosis.ToLower().Contains(el.ToLower())));
        }
Пример #3
0
        private string FindMatchingSurgeriesInDatabase()
        {
            var matched = new List <string>();

            foreach (var dbSurgery in GetListOfSurgeriesFromDatabase())
            {
                Regex regExpression = RegularExpressions.FindWordInList(dbSurgery.Split(" ").ToList());
                try
                {
                    if (regExpression.IsMatch(_potentialSurgery))
                    {
                        matched.Add(dbSurgery);
                    }
                }
                catch (InvalidOperationException ex)
                {
                    continue;
                }
            }
            return(matched.FirstOrDefault(el => _potentialSurgery.ToLower().Contains(el.ToLower())));
        }
Пример #4
0
        private DiagnosisCategory ResolveDiagnosisCategory()
        {
            var primaryDiagnosisRegex    = RegularExpressions.FindWordInList(PrimaryDiagnosisClassifyingWords());
            var pastDiagnosisRegex       = RegularExpressions.FindWordInList(PastDiagnosisClassifyingWords());
            var underlyingDiagnosisRegex = RegularExpressions.FindWordInList(UnderlyingDiagnosisClassifyingWords());

            if (primaryDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Primary"));
            }
            else if (pastDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Past Diagnosis"));
            }
            else if (underlyingDiagnosisRegex.IsMatch(_potentialDiagnosis))
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Underlying Diagnosis"));
            }
            else
            {
                return(_context.DiagnosisCategories.FirstOrDefault(dc => dc.CategoryName == "Other"));
            }
        }