Esempio n. 1
0
        /// <summary>
        /// Конструктор.
        /// </summary>
        public Groups(IHubConfigurator hubConfigurator) : base(hubConfigurator, HubNames.GroupsHub)
        {
            Proxy.On <DbChangeStatus, Group>(nameof(IGroupsHubEvents.OnChanged),
                                             (status, group) => OnChanged?.Invoke(status, group));

            Proxy.On(nameof(IGroupsHubEvents.GroupsImport), () => Imported?.Invoke());
        }
        private void ReadCell(Patient patient, IRow row, int cellCursor)
        {
            string header          = _headers.ElementAt(cellCursor);
            string newObjectFields = (string)_dictonary[header];
            string propertyValue   = row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();

            if (string.IsNullOrEmpty(propertyValue))
            {
                return;
            }
            switch (header)
            {
            case "OtherDiagnosisAndNotes":
                SetPatientGenericNote(patient, propertyValue);
                break;

            case "HasLungSurgery":
                var            surgeryResolver = new ManARTSPatientSurgeryResolver(_context, propertyValue, row, _headers);
                PatientSurgery surgery         = surgeryResolver.Resolve();
                if (surgery != null)
                {
                    surgery.PatientId = patient.ID;
                    _context.PatientSurgeries.Add(surgery);
                    Imported.Add(surgery);
                    _context.SaveChanges();
                }
                break;
            }
        }
        public static (string[], string) GetDefaultTexturesAndActive(Imported model, string defFromVisibleMesh)
        {
            string[] textures = new string[model.materialMappings.Length];
            SKAnimatorToolsProxy.IncrementEnd(textures.Length);

            for (int index = 0; index < model.materialMappings.Length; index++)
            {
                MaterialMapping mapping = model.materialMappings[index];
                ConfigReference texRef  = (ConfigReference)mapping.material.getArguments().getOrDefault("Texture", null);
                if (texRef != null)
                {
                    string file = (string)texRef.getArguments().getOrDefault("File", null);
                    if (file != null)
                    {
                        textures[index] = file;
                        if (mapping.texture == defFromVisibleMesh)
                        {
                            defFromVisibleMesh = new FileInfo(file).Name;
                        }
                    }
                }
                SKAnimatorToolsProxy.IncrementProgress();
            }

            return(textures, defFromVisibleMesh);
        }
        private Patient ReadCellsForPatient(Patient patient, IRow row, int cellCount)
        {
            var allDates = _context.PatientNACDates
                           .Where(p => p.PatientId == patient.ID)
                           .FirstOrDefault();
            var dates = patient.PatientNACDates.FirstOrDefault();

            if (dates == null)
            {
                dates = new PatientNACDates();
            }
            dates.PatientId = patient.ID;
            for (int cellCursor = 0; cellCursor < cellCount; cellCursor++)
            {
                if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null)
                {
                    ReadCell(patient, row, dates, cellCursor);
                }
            }

            patient.PatientNACDates.Add(dates);
            if (dates.PatientId != 0 && dates.PatientId > 0)
            {
                Imported.Add(dates);
            }
            return(patient);
        }
Esempio n. 5
0
 private void ReadCellsForPatient(Patient patient, IRow row, int cellCount)
 {
     for (int cellCursor = 0; cellCursor < cellCount; cellCursor++)
     {
         if (patient.ID <= 0)
         {
             continue;
         }
         if (!patient.PatientNACDates.Any())
         {
             patient.PatientNACDates = new List <PatientNACDates>()
             {
                 new PatientNACDates()
             }
         }
         ;
         if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null)
         {
             ReadCell(patient, row, cellCursor);
         }
     }
     if (patient.ID > 0)
     {
         Imported.Add(patient);
     }
 }
        private void ReadCell(Patient patient, IRow row, int cellCursor)
        {
            string header          = _headers.ElementAt(cellCursor);
            string newObjectFields = (string)_dictonary[header];
            string propertyValue   = row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString();

            if (string.IsNullOrEmpty(propertyValue))
            {
                return;
            }
            var capturedKeys = new List <string>();

            foreach (var key in HeadersDictionary().Keys)
            {
                capturedKeys.Add(key as String);
            }
            if (header == "Smoker")
            {
                var smokingStatusResolver = new SmokingStatusResolver(_context, propertyValue, row, _headers);
                var smokingStatus         = smokingStatusResolver.Resolve();
                if (smokingStatus != null)
                {
                    smokingStatus.PatientId = patient.ID;
                    patient.PatientSmokingDrinkingStatus = smokingStatus;
                    _context.PatientSmokingDrinkingStatus.Add(smokingStatus);
                    Imported.Add(smokingStatus);
                }
            }
        }
Esempio n. 7
0
        private void ImportPictureFormatOption(Option anyOption, Imported imported)
        {
            PictureFormatOption option = anyOption as PictureFormatOption;

            if (option.Digits != null)
            {
                imported.TypeLength = Int32.Parse(option.Digits.Value);
            }

            if (option.DecimalDigits != null)
            {
                imported.TypeDecimalLength = Int32.Parse(option.DecimalDigits.Value);
            }

            imported.IsNumeric =
                !(option.Type.StartsWith("A") || option.Type.StartsWith("X"));

            imported.TypeIsSigned = option.Type.StartsWith("S");

            // analyse PIC formatting for length
            if (imported.TypeLength == 0)
            {
                imported.TypeLength = option.Type.Length;
            }

            if (imported.TypeDecimalLength == 0 && option.DecimalType != null)
            {
                imported.TypeDecimalLength = option.DecimalType.Length;
            }

            imported.IsTyped = true;
        }
        private void CheckIfAlreadyImportedInDatabase(Patient patientFromExcel, Patient existingImportedPatient)
        {
            var dbPatient = FindPatientInDatabase(patientFromExcel);

            if (dbPatient != null && !string.IsNullOrEmpty(patientFromExcel.NhsNumber))
            {
                dbPatient.NhsNumber = patientFromExcel.NhsNumber;
            }

            if (dbPatient != null)
            {
                var excelPatientDrugLevelList = patientFromExcel.DrugLevels.Select(dl => dl.ResultValue).ToList();
                var dbPatientDrugLevelList    = dbPatient.DrugLevels.Select(dl => dl.ResultValue).ToList();
                var newDrugLevels             = excelPatientDrugLevelList.Except(dbPatientDrugLevelList);

                var toInsertDrugLevels = patientFromExcel.DrugLevels.Where(dl => newDrugLevels.Contains(dl.ResultValue));

                foreach (var drugLevel in toInsertDrugLevels)
                {
                    dbPatient.DrugLevels.Add(drugLevel);
                }
                Imported.Add(dbPatient);
            }
            else
            {
                if (patientFromExcel.IsValid() && existingImportedPatient == null)
                {
                    Imported.Add(patientFromExcel);
                }
            }
        }
        /// <summary>
        /// The function tries to merge possible updates from the deltaDB into
        /// the actual database. If there was made changes to the actualDB, then
        /// the function fires a event, which cause the KeePass UI to update and
        /// show the "save"-button.
        /// </summary>
        public void Import(object sender, SyncSource source)
        {
            Debug.Assert(source.DestinationDB != null && source.DestinationDB.RootGroup != null);
            //merge all updates in
            PwDatabase deltaDB = new PwDatabase();

            try {
                deltaDB.Open(IOConnectionInfo.FromPath(source.Location), source.Key, null);
            }
            catch (InvalidCompositeKeyException e) {
                Debug.WriteLine("Wrong key! exception was: " + e.Message);
                //brand this entry as a false one => red bg-color and "X" as group icon
                ShowErrorHighlight(source.DestinationDB, source.Uuid);
                if (Imported != null)
                {
                    Imported.Invoke(this, source.DestinationDB.RootGroup);
                }
                return;
            }
            catch (Exception e) {
                Debug.WriteLine("Standard exception was thrown during deltaDB.Open(): " + e.Message);
                //maybe the process has not finished writing to our file, but the filewtcher fires our event
                //sourceEntryUuid we have to ignore it and wait for the next one.
                return;
            }
            HideErrorHighlight(source.DestinationDB, source.Uuid);
            MergeIn(source.DestinationDB, deltaDB);
            deltaDB.Close();
        }
Esempio n. 10
0
        private PatientMRCScore BuildMRCScore(Patient patient, IDictionary record)
        {
            var score = new PatientMRCScore();

            score.PatientId = patient.ID;
            var stringScore = (string)record[SCORE];

            if (stringScore == "NULL" || string.IsNullOrEmpty(stringScore))
            {
                return(null);
            }
            score.Score = stringScore;
            string stringDateTaken = (string)record[DATE_TAKEN];
            var    dateTaken       = ParseDate(stringDateTaken);

            if (dateTaken == null)
            {
                return(null);
            }
            score.DateTaken = dateTaken.Value;
            _context.Entry(patient).Collection(p => p.PatientMRCScores).Load();
            var dates           = patient.PatientMRCScores.Select(s => s.DateTaken.Date).ToList();
            var existingDbDates = dates.FindAll(d => d.Date == score.DateTaken.Date);

            if (existingDbDates.Count > 0)
            {
                return(null);
            }
            Imported.Add(score);
            return(score);
        }
        protected override void ProcessSheet(ISheet currentSheet)
        {
            Action <Patient, IRow, int> sheetProcessingAction = (patient, row, cellCount) =>
            {
                List <PatientSTGQuestionnaire> sgrqs = _context.PatientSTGQuestionnaires.Where(d => d.PatientId.Equals(patient.ID)).ToList();
                var newSgrq = new PatientSTGQuestionnaire()
                {
                    PatientId = patient.ID
                };
                patient = ReadRowCellsIntoPatientObject(patient, row, cellCount, newSgrq);
                var  existingDates    = sgrqs.Select(pi => pi.DateTaken.Date).ToList();
                bool dateDoesNotExist = existingDates.FindAll(d => d.Date == newSgrq.DateTaken.Date).ToList().Count == 0;
                if (newSgrq.DateTaken.Year > 1 && dateDoesNotExist)
                {
                    if (patient.STGQuestionnaires == null)
                    {
                        patient.STGQuestionnaires = new List <PatientSTGQuestionnaire>();
                    }
                    patient.STGQuestionnaires.Add(newSgrq);
                }
                Imported.Add(patient);
            };

            InitializeSheetProcessingForRows(HeadersDictionary(), currentSheet, sheetProcessingAction);
        }
 public void ReadDOCXFile()
 {
     ResetStream();
     ConvertToDocxIfDoc();
     InitializeRequiredProperties();
     using (_wordDocument = WordprocessingDocument.Open(_wordPackage))
     {
         var           diagnosisElement        = GetDiagnosisElement();
         var           rm2Number               = FindRM2InDocumentName();
         var           potentialDiagnoses      = FindDiagnosesFromWord();
         List <string> discoveredDiagnosesList = CopyToNewList(potentialDiagnoses);
         Patient       patient = _patientManager.FindPatientByRM2Number(rm2Number, true);
         if (patient == null)
         {
             return;
         }
         foreach (var potentialDiagnosis in potentialDiagnoses)
         {
             var diagnosis = GetPatientDiagnosesFromWord(patient, potentialDiagnosis);
             if (diagnosis != null)
             {
                 Imported.Add(diagnosis);
                 discoveredDiagnosesList.Remove(potentialDiagnosis);
             }
             GetPatientSurgeriesFromWord(patient, potentialDiagnosis);
         }
         BuildPatientGenericNotes(patient, discoveredDiagnosesList);
     }
     _stream.Close();
     _context.SaveChanges();
 }
Esempio n. 13
0
        private Imported ImportBasicRecord(Record anyRecord)
        {
            BasicRecord record = anyRecord as BasicRecord;

            Imported imported = new Imported()
            {
                Level = Int32.Parse(record.Level.Value),
                Name  = (!record.LevelName.HasFiller ?
                         record.LevelName.Identifier.Name : null)
            };

            // process options to extract Type and Super
            foreach (Option option in record.Options)
            {
                try {
                    new Dictionary <string, Action <Option, Imported> >()
                    {
                        // ValueOption <|-- Symbolic <|--
                        { "Variable", this.ImportVariableValue },
                        //                           <|-- Figurative
                        { "Zero", this.ImportZeroValue },
                        { "Space", this.ImportSpaceValue },
                        { "HighValue", this.ImportHighValue },
                        { "LowValue", this.ImportLowValue },
                        { "AllString", this.ImportAllStringValue },
                        { "Null", this.ImportNullValue },
                        //                           <|-- Literal
                        { "Float", this.ImportFloatValue },
                        { "String", this.ImportStringValue },
                        { "Int", this.ImportIntValue },
                        //
                        { "RedefinesOption", this.ImportRedefinesOption },
                        { "ExternalOption", this.ImportExternalOption },
                        { "InternalOption", this.ImportInternalOption },
                        // UsageOption <|-- Usage <|--
                        { "IndexUsage", this.ImportIndexUsage },
                        { "PackedDecimalUsage", this.ImportPackedDecimalUsage },
                        { "BinaryUsage", this.ImportBinaryUsage },
                        { "CompUsage", this.ImportCompUsage },
                        { "DisplayUsage", this.ImportDisplayUsage },
                        //
                        { "SignOption", this.ImportSignOption },
                        { "OccursOption", this.ImportOccursOption },
                        { "SyncOption", this.ImportSyncOption },
                        { "JustOption", this.ImportJustOption },
                        { "BlankOption", this.ImportBlankOption },
                        // PictureOption <|--
                        { "PictureStringOption", this.ImportPictureStringOption },
                        { "PictureFormatOption", this.ImportPictureFormatOption }
                    }[option.GetType().ToString()](option, imported);
                } catch (KeyNotFoundException) {
                    throw new ArgumentException(
                              "Unknown record option: " + option.GetType().ToString() + " from " +
                              record.ToString()
                              );
                }
            }
            return(imported);
        }
Esempio n. 14
0
        /// <summary>
        /// Конструктор.
        /// </summary>
        public Students(IHubConfigurator hubConfigurator) : base(hubConfigurator, HubNames.StudentsHub)
        {
            Proxy.On <DbChangeStatus, Student>(nameof(IStudentsHubEvents.OnChanged),
                                               (status, student) => OnChanged?.Invoke(status, student));

            Proxy.On(nameof(IStudentsHubEvents.StudentsImported),
                     () => Imported?.Invoke());
        }
Esempio n. 15
0
        private void ImportSignOption(Option anyOption, Imported imported)
        {
            SignOption option = anyOption as SignOption;

            imported.Sign = (option.HasLeading ? "leading" : "trailing") +
                            (option.HasSeparate ? " separate" +
                             (option.HasCharacter ? " character" : "") : "");
        }
        protected override void ProcessSheet(ISheet currentSheet)
        {
            Action <Patient, IRow, int> sheetProcessingAction = (patient, row, cellCount) =>
            {
                patient = ReadRowCellsIntoPatientObject(patient, row, cellCount);
                var existingPatient = ExistingPatient(patient.RM2Number);
                Imported.Add(patient);
            };

            InitializeSheetProcessingForRows(HeadersDictionary(), currentSheet, sheetProcessingAction);
        }
Esempio n. 17
0
        private void ParseAndSaveLines(List <string> matched)
        {
            _uom = _context.UnitOfMeasurements.Where(uom => uom.Name == "g/l").FirstOrDefault();

            var patient = _context.Patients.Where(p => p.RM2Number.Contains(_id))
                          .Include(p => p.PatientTestResults)
                          .ThenInclude(pt => pt.TestType)
                          .FirstOrDefault();

            var testType = _context.TestTypes
                           .Where(tt => tt.Name == "Albumin")
                           .FirstOrDefault();

            var existingDates = patient.PatientTestResults
                                .Where(ig => ig.TestTypeId == testType.ID)
                                .Select(pi => pi.DateTaken.Date)
                                .ToList();

            foreach (string line in matched)
            {
                var    dataArray  = line.Split(" ");
                string range      = "";
                string dateString = dataArray.Take(3).ToList().Join(" ");
                string testValue  = dataArray[5].Replace("*", String.Empty)
                                    .Replace("<", String.Empty)
                                    .Replace(">", String.Empty);
                string sampleId = dataArray[4];
                if (dataArray.Length > 6)
                {
                    range = dataArray[6] + dataArray[7] + dataArray[8];
                }
                else
                {
                    range = "(" + Regex.Match(_lines[12], @"\(([^)]*)\)").Groups[1].Value + ")";
                    Console.WriteLine(dataArray);
                }
                DateTime parsedDate;
                DateTime.TryParseExact(dateString, "dd MMM yyyy", null, System.Globalization.DateTimeStyles.None, out parsedDate);
                if (existingDates.FindAll(d => d.Date == parsedDate.Date).ToList().Count == 0)
                {
                    var crp = new PatientTestResult();
                    crp.TestTypeId        = testType.ID;
                    crp.SampleId          = sampleId;
                    crp.Range             = range;
                    crp.PatientId         = patient.ID;
                    crp.Value             = decimal.Parse(testValue);
                    crp.DateTaken         = parsedDate;
                    crp.UnitOfMeasurement = _uom;
                    _context.PatientTestResult.Add(crp);
                    Imported.Add(crp);
                }
            }
        }
Esempio n. 18
0
        protected override void ProcessSheet(ISheet currentSheet)
        {
            Action <Patient, IRow, int> sheetProcessingAction = (patient, row, cellCount) =>
            {
                var modifiedPatient = ReadCellsForPatient(patient, row, cellCount);
                if (modifiedPatient.IsValid())
                {
                    Imported.Add(modifiedPatient);
                }
            };

            InitializeSheetProcessingForRows(HeadersDictionary(), currentSheet, sheetProcessingAction);
        }
Esempio n. 19
0
        private void ParseAndSaveLines(List <string> matched)
        {
            var patient = _context.Patients.Where(p => p.RM2Number.Contains(_id))
                          .Include(p => p.PatientImmunoglobulines)
                          .ThenInclude(p => p.ImmunoglobulinType)
                          .FirstOrDefault();

            var igType = _context.ImmunoglobulinTypes
                         .Where(it => it.Name == "Total IgE")
                         .FirstOrDefault();

            var existingDates = patient.PatientImmunoglobulines
                                .Where(ig => ig.ImmunoglobulinTypeId == igType.ID)
                                .Select(pi => pi.DateTaken.Date)
                                .ToList();

            foreach (string line in matched)
            {
                var    dataArray  = line.Split(" ");
                string range      = "";
                string dateString = dataArray.Take(3).ToList().Join(" ");
                string igeValue   = dataArray[5].Replace("*", String.Empty)
                                    .Replace("<", String.Empty)
                                    .Replace(">", String.Empty);
                string sampleId = dataArray[4];
                if (dataArray.Length > 6)
                {
                    range = dataArray[6] + dataArray[7] + dataArray[8];
                }
                else
                {
                    range = "(" + Regex.Match(_lines[11], @"\(([^)]*)\)").Groups[1].Value + ")";
                    Console.WriteLine(dataArray);
                }
                DateTime parsedDate;
                DateTime.TryParseExact(dateString, "dd MMM yyyy", null, System.Globalization.DateTimeStyles.None, out parsedDate);
                if (existingDates.FindAll(d => d.Date == parsedDate.Date).ToList().Count == 0)
                {
                    var totalIgE = new PatientImmunoglobulin();
                    totalIgE.ImmunoglobulinType = igType;
                    totalIgE.SampleId           = sampleId;
                    totalIgE.Range     = range;
                    totalIgE.PatientId = patient.ID;
                    totalIgE.Value     = decimal.Parse(igeValue);
                    totalIgE.DateTaken = parsedDate;
                    _context.PatientImmunoglobulins.Add(totalIgE);
                    Imported.Add(totalIgE);
                }
            }
        }
        private object ReadCellsForPatient(Patient patient, IRow row, int cellCount)
        {
            var pft = new PatientPulmonaryFunctionTest();
            var hmt = new PatientHaematology();

            for (int cellCursor = 0; cellCursor < cellCount; cellCursor++)
            {
                if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null)
                {
                    ReadCell(patient, pft, hmt, row, cellCursor);
                }
            }
            Imported.Add(patient);
            return(patient);
        }
Esempio n. 21
0
        private void HandleIpRegister()
        {
            int lparam = 1;

            if (m_buf[12] == 0x01 && m_buf[13] == 0x00)
            {
                m_txt = "切换配置(" + m_in_specoffice + ")成功……OK\r\n>";

                m_in_lr.b2b.lr.SwitchConfig(m_ipid_dest);
            }
            else
            {
                lparam = 0;
                m_txt  = "切换配置(" + m_in_specoffice + ")失败……\r\n>";
            }
            Imported.SendMessage(0xFFFF, (int)Imported.egMsg.SWITCH_CONFIG_RESULT, 0, lparam);//用于配置共享
        }
        private Patient FindPatientInImported(Patient importedPatient)
        {
            if (importedPatient.FirstName == null || importedPatient.LastName == null || importedPatient.DOB == null)
            {
                return(null);
            }
            var exisingImportedPatient = Imported.Where(p => p.RM2Number == importedPatient.RM2Number)
                                         .FirstOrDefault();

            if (exisingImportedPatient != null)
            {
                return(exisingImportedPatient);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 23
0
        protected override void ProcessSheet(ISheet currentSheet)
        {
            Action <Patient, IRow, int> sheetProcessingAction = (patient, row, cellCount) =>
            {
                _patientAliveStatus    = _context.PatientStatuses.Where(s => s.Name == "Active").FirstOrDefault().ID;
                _patientDeceasedStatus = _context.PatientStatuses.Where(s => s.Name == "Deceased").FirstOrDefault().ID;
                _cpaDiagnosis          = _context.DiagnosisTypes.Where(dt => dt.Name.Contains("Chronic pulmonary aspergillosis")).SingleOrDefault();
                _primaryDiagnosisCat   = _context.DiagnosisCategories.Where(dc => dc.CategoryName == "Primary").SingleOrDefault();

                var importedPatient = ReadCellsToPatient(patient, row, cellCount);
                AddPatientDiagnosis(patient);
                if (importedPatient.IsValid())
                {
                    Imported.Add(importedPatient);
                }
            };

            InitializeSheetProcessingForRows(HeadersDictionary(), currentSheet, sheetProcessingAction);
        }
Esempio n. 24
0
        protected void MergeIn(PwDatabase target, PwDatabase source)
        {
            //remember stats of destDB to guess if we merged in something
            //maybe we only look for the lastChanged entry
            var clone = source.CloneDeep(target.RootGroup);

            clone.SetCustomAttribute(KeeShare.AttributeFlags.IsTemporaryDatabase, true);
            var cyclicEntries = new List <PwEntry>();

            foreach (var cloneEntry in clone.RootGroup.GetEntries(true).ToList())
            {
                if (cloneEntry.HasExportSource(target.RootGroup.Uuid.ToHexString()))
                {
                    cloneEntry.DeleteFrom(cloneEntry.ParentGroup);
                    cyclicEntries.Add(cloneEntry);
                }
            }

            Console.WriteLine("Prevent import of nodes which are exported from here: " + String.Join(",", cyclicEntries.Select(e => e.GetTitle()).ToArray()));

            DateTime lastChange = DateTime.MinValue;

            foreach (var entry in target.RootGroup.GetEntries(true))
            {
                if (entry.LastModificationTime.Ticks > lastChange.Ticks)
                {
                    lastChange = entry.LastModificationTime;
                }
            }
            target.MergeIn(clone, PwMergeMethod.Synchronize);
            foreach (var entry in source.RootGroup.GetEntries(true))
            {
                if (entry.LastModificationTime.Ticks > lastChange.Ticks)
                {
                    //set the modified flag of the database true, so the uiUpdate knows which tab should be marked as changed
                    target.Modified = true;
                }
            }
            if (Imported != null)
            {
                Imported.Invoke(this, target.RootGroup);
            }
        }
        private Patient ReadCellsForPatient(Patient patient, IRow row, int cellCount)
        {
            var admission = new PatientHospitalAdmission();

            admission.PatientId = patient.ID;
            for (int cellCursor = 0; cellCursor < cellCount; cellCursor++)
            {
                if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null)
                {
                    ReadCell(patient, row, admission, cellCursor);
                }
            }

            patient.PatientHospitalAdmissions.Add(admission);
            if (admission.PatientId != 0 && admission.PatientId > 0)
            {
                Imported.Add(admission);
            }
            return(patient);
        }
Esempio n. 26
0
        private void ImportOccursOption(Option anyOption, Imported imported)
        {
            OccursOption option = anyOption as OccursOption;

            if (option.Amount != null)
            {
                if (option.Amount is Int)
                {
                    imported.Amount = Int32.Parse(((Int)option.Amount).Value);
                }
                else
                {
                    throw new NotImplementedException("Identifier Amounts are not yet supported.");
                }
            }
            if (option.UpperBound != null)
            {
                if (option.UpperBound is Int)
                {
                    imported.MaxAmount = Int32.Parse(((Int)option.UpperBound).Value);
                }
                else
                {
                    throw new NotImplementedException("Identifier UpperBounds are not yet supported.");
                }
            }
            if (option.DependsOn != null)
            {
                imported.AmountDependsOn = option.DependsOn.Name;
            }
            if (option.Keys.Count > 0)
            {
                throw new NotImplementedException("Occurs Keys are not yet supported.");
            }
            if (option.Indexes.Count > 0)
            {
                throw new NotImplementedException("Occurs Indexes are not yet supported.");
            }
        }
Esempio n. 27
0
        private PatientSTGQuestionnaire BuildPatientSTGQuestionnaire(Patient patient, IDictionary record)
        {
            var sgrquestionare = new PatientSTGQuestionnaire();

            sgrquestionare.PatientId     = patient.ID;
            sgrquestionare.SymptomScore  = decimal.Parse((string)record[SYMPTOM_SCORE]);
            sgrquestionare.ImpactScore   = decimal.Parse((string)record[IMPACT_SCORE]);
            sgrquestionare.ActivityScore = decimal.Parse((string)record[ACTIVITY_SCORE]);
            sgrquestionare.TotalScore    = decimal.Parse((string)record[TOTAL_SCORE]);
            string dateTaken = (string)record[DATE_TAKEN];

            try
            {
                sgrquestionare.DateTaken = DateTime.ParseExact(dateTaken, "yyyy-MM-dd", CultureInfo.InvariantCulture);
            } catch (FormatException)
            {
                try
                {
                    sgrquestionare.DateTaken = Convert.ToDateTime(dateTaken);
                } catch (FormatException)
                {
                    Console.WriteLine(dateTaken);
                }
            }
            _context.Entry(patient).Collection(p => p.STGQuestionnaires).Load();
            var dates           = patient.STGQuestionnaires.Select(sgrq => sgrq.DateTaken.Date).ToList();
            var existingDbDates = dates.FindAll(d => d.Date == sgrquestionare.DateTaken.Date);

            if (existingDbDates.Count > 0)
            {
                return(sgrquestionare);
            }
            if (sgrquestionare.IsValid())
            {
                Imported.Add(sgrquestionare);
            }
            return(sgrquestionare);
        }
Esempio n. 28
0
        protected override void ProcessSheet(ISheet currentSheet)
        {
            Action <Patient, IRow, int> sheetProcessingAction = (patient, row, cellCount) =>
            {
                string identifierValue = row.Cells[1].StringCellValue;
                var    dbPatient       = FindByDOBAndNames(row, identifierValue);
                if (dbPatient == null)
                {
                    return;
                }
                else
                {
                    patient = dbPatient;
                }
                var modifiedPatient = ReadCellsForPatient(patient, row, cellCount);
                if (modifiedPatient.IsValid() && dbPatient != null)
                {
                    Imported.Add(modifiedPatient);
                }
            };

            InitializeSheetProcessingForRows(HeadersDictionary(), currentSheet, sheetProcessingAction);
        }
Esempio n. 29
0
        private void ParseAndSaveLines(List <string> matched)
        {
            var patient = _context.Patients.Where(p => p.RM2Number.Contains(_id))
                          .Include(p => p.PatientImmunoglobulines)
                          .ThenInclude(p => p.ImmunoglobulinType)
                          .FirstOrDefault();

            var igType = _context.ImmunoglobulinTypes
                         .Where(it => it.Name == "Aspergillus F IgG")
                         .FirstOrDefault();

            var existingDates = patient.PatientImmunoglobulines
                                .Where(pi => pi.ImmunoglobulinTypeId == igType.ID)
                                .Select(pi => pi.DateTaken.Date)
                                .ToList();

            foreach (string line in matched)
            {
                var    dataArray  = line.Split(" ");
                string dateString = dataArray.Take(3).ToList().Join(" ");
                string igGValue   = dataArray[5].Replace("*", String.Empty)
                                    .Replace("<", String.Empty)
                                    .Replace(">", String.Empty);
                DateTime parsedDate;
                DateTime.TryParseExact(dateString, "dd MMM yyyy", null, System.Globalization.DateTimeStyles.None, out parsedDate);
                if (existingDates.FindAll(d => d.Date == parsedDate.Date).ToList().Count == 0)
                {
                    var patientIGg = new PatientImmunoglobulin();
                    patientIGg.ImmunoglobulinType = igType;
                    patientIGg.PatientId          = patient.ID;
                    patientIGg.Value     = decimal.Parse(igGValue);
                    patientIGg.DateTaken = parsedDate;
                    _context.PatientImmunoglobulins.Add(patientIGg);
                    Imported.Add(patientIGg);
                }
            }
        }
Esempio n. 30
0
 private void ImportPictureStringOption(Option anyOption, Imported imported)
 {
     throw new NotImplementedException("Picture string options are not yet supported.");
 }
 public void OnImportsSatisfied()
 {
     SetOnImportsSatisfied = Imported;
 }