Ejemplo n.º 1
0
        private static void Begin(string Query, bool forceReport = false)
        {
            int      totalCount      = 0;
            int      currentIndex    = 0;
            int      percentComplete = 0;
            DateTime startDate       = DateTime.Now;

            // get all sel oru exams to date
            List <SelOru> accessions = SelOruDAO.GetAllAccessionsFromSELORU(Query);

            totalCount = accessions.Count();

            Console.WriteLine("Starting! {0}", startDate.ToString());

            // set the MOD from here
            //var options = new ParallelOptions
            //{
            //    MaxDegreeOfParallelism = 2
            //};
            // parallel For each
            //Parallel.ForEach(accessions, options, oldSELExam =>
            // for each exam do the following
            accessions.ForEach(delegate(SelOru oldSELExam)
            {
                currentIndex++;
                percentComplete = (int)Math.Round((double)(100 * currentIndex) / totalCount);
                Console.Write("\rProgress: {0}%", percentComplete);

                // check ris db for exam
                Exam tempExam = ShieldsAppsDAO.GetExamByAccessionNo(new Exam()
                {
                    AccessionNo = oldSELExam.accessionNo
                });

                // is the exam in ris db?
                if (tempExam.ExamId == 0)
                {
                    // build sectra exam object
                    DoSectraBuild(oldSELExam);
                }
                else
                {
                    // REPORT STATUS FOR RIS_DB IS 4
                    if (tempExam.ExamStatusId != 4)
                    {
                        // before inserting into db, i'll do another check for the insert
                        DoSectraBuild(oldSELExam);
                    }
                    else if (tempExam.ExamStatusId == 4 && forceReport)
                    {
                        DoSectraBuild(oldSELExam);
                    }
                    else
                    {
                        return;
                    }
                }
            });
            Console.WriteLine("\nDone! Press any key to continue! {0}", DateTime.Now.ToString());
            Console.Read();
            Console.Clear();
        }
Ejemplo n.º 2
0
        private static void DoInsertUpdate(Sectra sectraPatient, List <WsReport> Reports)
        {
            StringBuilder serviceMessage = new StringBuilder();

            // make SEL exam object
            WSShieldsApps.Exam exam
                = new WSShieldsApps.Exam();
            WSShieldsApps.Location location
                = new WSShieldsApps.Location();
            WSShieldsApps.Patient patient
                = new WSShieldsApps.Patient();
            WSShieldsApps.Organization organization
                = new WSShieldsApps.Organization();
            WSShieldsApps.Doctor referring
                = new WSShieldsApps.Doctor();
            // make SEL report object
            WSShieldsApps.Report report
                = new WSShieldsApps.Report();
            WSShieldsApps.Doctor radiologist
                = new WSShieldsApps.Doctor();

            // even though we use inhertiance, it doesn't appear the WS can serialize the object
            setExam(exam, sectraPatient.wsExam);
            setLocation(location, sectraPatient.wsReferringDoctorLocation);
            setPatient(patient, sectraPatient.wsPatient);
            setDoctor(radiologist, sectraPatient.radiologistDoctor);
            setDoctor(referring, sectraPatient.referringDoctor);
            setReport(report, sectraPatient.wsReport);
            setOrganization(organization, sectraPatient.wsOrganization);

            serviceMessage.AppendLine("ACCESSION: " + exam.AccessionNo);

            if (referring.Npi == "" || referring.Npi == null)
            {
                // apply fake npi
                referring.Npi       = "9999999998";
                referring.FirstName = "Doctor";
                referring.LastName  = "Exception";
            }

            if (radiologist.Npi == "" || radiologist.Npi == null)
            {
                // apply fake npi
                radiologist.EnterpriseId = 1;
                radiologist.Npi          = "9999999999";
                radiologist.FirstName    = "Radiologist";
                radiologist.LastName     = "Exception";
            }

            // assign the correct attributes
            exam.Location     = location;
            exam.Doctor       = referring;
            exam.Organization = organization;
            exam.Patient      = patient;

            // make a new exam object
            WSShieldsApps.Exam exam2Object = new WSShieldsApps.Exam();

            // pass the accession so we don't override
            exam2Object.AccessionNo = exam.AccessionNo;

            // get the updated exam id only
            exam.ExamId = ShieldsAppsDAO.GetExamByAccessionNo(exam2Object).ExamId;

            // put radiologist
            serviceMessage.AppendLine("Radiologist: " + ShieldsAppsDAO.PutDoctor(radiologist));

            // put exam
            serviceMessage.AppendLine("Exam: " + ShieldsAppsDAO.PutExam(exam));

            // post orignal report, but make sure you update the exam id and rad id
            report.ExamId        = exam.ExamId;
            report.RadiologistId = radiologist.DoctorId;

            if (Reports.Count > 0)
            {
                serviceMessage.AppendLine("Original Report:" + ShieldsAppsDAO.PostReport(report));
            }

            // if there is more than 1 report, then there is an addendum we need to get
            if (Reports.Count > 1)
            {
                // for each report text starting at "1" (0 == orignal report) get all addendums after
                for (int reportIteration = 1, n = Reports.Count;
                     reportIteration < n;
                     reportIteration++)
                {
                    // set the addendum flag
                    report.IsAddendum = true;

                    // re-define report text and observation date
                    report.ReportText = Reports[reportIteration].ReportText;

                    // handle inserting of addendum report
                    serviceMessage.AppendLine("Report Addendum " + reportIteration.ToString() + ":" + ShieldsAppsDAO.PostReport(report, reportIteration));
                }
            }
        }