Example #1
0
 public static Exam GetExamByAccessionNo(WSShieldsApps.Exam exam)
 {
     using (ShieldsAppsClient client = new ShieldsAppsClient())
     {
         try
         {
             exam = client.GetExamByAccessionNo(exam.AccessionNo);
         }
         catch (Exception ex)
         {
             client.Close();
         }
     }
     return(exam);
 }
Example #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));
                }
            }
        }