Пример #1
0
        private static void analyzeErrorsDataSet(IBackgroundContext context, ErrorsAnalyzerDataContext dataContext, SmoErrorDataSet errorDataSet)
        {
            context.ProgressSeparator();
            context.ReportProgress("РЕВЬЮ {0}", errorDataSet.FileName);

            var bill =
                dataContext.Bills.FirstOrDefault(
                    x => x.LFileName == errorDataSet.SourceFileName || x.HFileName == errorDataSet.SourceFileName);

            if (bill == null)
            {
                context.ReportProgress(@"Не найден файл счета {0}", errorDataSet.SourceFileName);
                return;
            }

            if (errorDataSet.PR.Rows.Count == 0)
            {
                context.ReportProgress(@"Ошибки не обнаружены", errorDataSet.FileName);
                return;
            }

            if (errorDataSet.SourceFileName.StartsWith("L"))
            {
                /* ошибки по списку персон */
                foreach (var prRow in errorDataSet.PR)
                {
                    context.ReportError(@"{0}", prRow);
                    if(prRow.N_ZAP != "")
                    {
                        var pers = bill.Persons.PERS.FirstOrDefault(x => x.ID_PAC == prRow.N_ZAP);
                        if(pers != null)
                            context.ReportProgress(@"    -> {0}", pers);
                    }
                }
            }
            else
            {
                /* ошибки по услугам */
                foreach (var prRow in errorDataSet.PR)
                {
                    context.ReportError(@"{0}", prRow);

                    if(prRow.OSHIB == "904")
                    {
                        var doc =
                            dataContext.DoctorList.FirstOrDefault(
                                x => x.SNILS == prRow.COMMENT.Substring(prRow.COMMENT.Length - 11));
                        if(doc != null)
                            context.ReportProgress(@"    Доктор {0}", doc.ToString());
                    }

                    if (prRow.N_ZAP != "")
                    {
                        var zap = bill.Reestr.ZAP.FirstOrDefault(x => x.N_ZAP == prRow.N_ZAP);
                        if (zap != null)
                        {
                            foreach (var sluchRow in zap.GetSLUCHRows())
                            {
                                context.ReportProgress(@"    -> {0}", sluchRow.ToString());
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public void LoadErrors(IBackgroundContext context, string errorsDir)
        {
            if (context.CancellationPending) return;

            context.ProgressSeparator();
            context.ReportProgress(@"Загрузка файлов с ошибками СМО ...");

            if (string.IsNullOrEmpty(errorsDir))
                errorsDir = @".\";
            errorsDir = Path.GetFullPath(errorsDir);
            if (Directory.Exists(errorsDir))
            {
                foreach (var xmlFileName in Directory.GetFiles(errorsDir, "FLK_*.xml").TakeWhile(x => !context.CancellationPending))
                {
                    if (File.Exists(xmlFileName) && File.Exists(xmlFileName))
                    {
                        var errorDataSet = new SmoErrorDataSet();
                        errorDataSet.ReadXml(xmlFileName);
                        Errors.Add(errorDataSet);
                    }
                }
            }
            context.ReportProgress(@"Загрузка файлов с ошибками СМО закончена");
        }