Beispiel #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="documentID"></param>
 /// <param name="unitnum"></param>
 /// <param name="apptid"></param>
 /// 
 public void CreateHtmlDocument(int documentID, string unitnum, int apptid)
 {
     template = new DocumentTemplate();
     template.SetPatient(SessionManager.Instance.GetActivePatient());
     template.documentTemplateID = documentID;
     template.BackgroundLoadWork();
     template.OpenHTML();
     template.ProcessDocument();
 }
Beispiel #2
0
        public string GenerateHtmlDocument(int documentID, string unitnum, int apptid)
        {
            SessionManager.Instance.SetActivePatientNoCallback(unitnum, apptid);

            DocumentTemplate dt = new DocumentTemplate();
            dt.documentTemplateID = documentID;
            dt.BackgroundLoadWork();
            dt.OpenHTML();
            dt.ProcessDocument();

            SessionManager.Instance.Shutdown();
            return dt.htmlText;
        }
Beispiel #3
0
        public string GenerateHtmlDocument(int documentID, string unitnum, int apptid, string configFile)
        {
            RiskApps3.Utilities.Configurator.configFilePath = configFile;
            SessionManager.Instance.SetCoreConfigPath(configFile);

            SessionManager.Instance.SetActivePatientNoCallback(unitnum, apptid);

            DocumentTemplate dt = new DocumentTemplate();
            dt.documentTemplateID = documentID;
            dt.BackgroundLoadWork();
            dt.OpenHTML();
            dt.ProcessDocument();

            SessionManager.Instance.Shutdown();
            return dt.htmlText;
        }
Beispiel #4
0
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            List<Appointment> appts = (List<Appointment>)e.Argument;
            try
            {
                foreach (object o in appts)
                {
                    Appointment appt = (Appointment)o;
                    if (appt.CloudWebQueueState == CREATE_NEW_APPT || appt.CloudWebQueueState == SYNCH_APPT)
                    {
                        backgroundWorker2.ReportProgress(2, "Retrieving Patient Record: " + appt.patientname + " - " + appt.dob);
                        XmlNode xml = cloud.FetchPatientRecord(appt.apptID);

                        MemoryStream stm = new MemoryStream();
                        StreamWriter stw = new StreamWriter(stm);
                        stw.Write(xml.OuterXml);
                        stw.Flush();
                        stm.Position = 0;

                        backgroundWorker2.ReportProgress(2, "Saving Data: " + appt.patientname + " - " + appt.dob);
                        DataContractSerializer ds = new DataContractSerializer(typeof(Patient));
                        Patient p2 = (Patient)ds.ReadObject(stm);

                        if (appt.CloudWebQueueState == CREATE_NEW_APPT)
                        {
                            Utilities.ParameterCollection pc = new RiskApps3.Utilities.ParameterCollection();
                            pc.Add("unitnum", p2.unitnum);
                            pc.Add("patientname", p2.name);
                            pc.Add("dob", p2.dob);
                            pc.Add("clinicId", appt.clinicID);
                            object newApptId = BCDB2.Instance.ExecuteSpWithRetValAndParams("sp_createMasteryAppointment", SqlDbType.Int, pc);
                            p2.apptid = (int)newApptId;
                        }
                        else if (appt.CloudWebQueueState == SYNCH_APPT)
                        {
                            p2.apptid = appt.CloudWebQueueSynchId;
                        }

                        p2.FHx.proband = p2;
                        p2.PersistFullObject(new RiskApps3.Model.HraModelChangedEventArgs(null));

                        if (checkBox4.Checked)
                        {
                            backgroundWorker2.ReportProgress(2, "Marking Complete and updating meta data: " + appt.patientname + " - " + appt.dob);
                            ParameterCollection pc = new ParameterCollection("apptID", p2.apptid);
                            BCDB2.Instance.RunSPWithParams("sp_markRiskDataCompleted", pc);
                        }

                        if (checkBox1.Checked)
                        {
                            backgroundWorker2.ReportProgress(2, "Running Risk Models: " + appt.patientname + " - " + appt.dob);
                            p2.RecalculateRisk();

                            ParameterCollection pc = new ParameterCollection("unitnum", p2.unitnum);
                            BCDB2.Instance.RunSPWithParams("sp_3_populateBigQueue", pc);
                        }

                        if (checkBox2.Checked)
                        {
                            backgroundWorker2.ReportProgress(2, "Printing Automation Documents: " + appt.patientname + " - " + appt.dob);

                            ParameterCollection printDocArgs = new ParameterCollection();
                            printDocArgs.Add("apptid", p2.apptid);
                            SqlDataReader reader = BCDB2.Instance.ExecuteReaderSPWithParams("sp_AutomationHtmlDocsToPrint", printDocArgs);
                            while (reader.Read())
                            {
                                int templateID = -1;
                                if (reader.IsDBNull(0) == false)
                                {
                                    templateID = reader.GetInt32(0);
                                }
                                SessionManager.Instance.SetActivePatientNoCallback(p2.unitnum, p2.apptid);
                                DocumentTemplate template = new DocumentTemplate();
                                template.documentTemplateID = templateID;
                                template.BackgroundLoadWork();
                                template.OpenHTML();
                                template.ProcessDocument();
                                htmlInProgress = true;
                                backgroundWorker2.ReportProgress(1, template.htmlText);
                                while (htmlInProgress)
                                {
                                    Application.DoEvents();
                                    Thread.Sleep(500);
                                }

                            }
                        }
                        if (checkBox5.Checked)
                        {
                            backgroundWorker2.ReportProgress(2, "Removing Web Survey: " + appt.patientname + " - " + appt.dob);
                            backgroundWorker2.ReportProgress(4, appt);
                            cloud.DeleteSurvey(appt.apptID);
                        }
                        backgroundWorker2.ReportProgress(2, "Precessing Queue Documents: " + appt.patientname + " - " + appt.dob);
                        if (checkBox3.Checked)
                        {
                            ParameterCollection pc = new ParameterCollection("apptID", p2.apptid);
                            BCDB2.Instance.RunSPWithParams("sp_processQueueDocuments", pc);
                        }
                    }
                    else if (appt.CloudWebQueueState == DELETE_APPT)
                    {
                        backgroundWorker2.ReportProgress(2, "Removing Web Survey: " + appt.patientname + " - " + appt.dob);
                        backgroundWorker2.ReportProgress(4, appt);
                        cloud.DeleteSurvey(appt.apptID);
                    }
                    backgroundWorker2.ReportProgress(3,o);
                }
            }
            catch (Exception exc)
            {
                Logger.Instance.WriteToLog(exc.ToString());
            }
        }
Beispiel #5
0
        // ported from SimpleInfoScreen jdg 8/31/15 per Brian
        public DocumentTemplate MakeDocument(Patient proband, int templateID, string templatesRoot)
        {
            DocumentTemplate dt = new DocumentTemplate();
            dt.documentTemplateID = templateID;
            dt.SetPatient(proband);
            dt.BackgroundLoadWork();
            if (!String.IsNullOrEmpty(templatesRoot))
            {
                dt.htmlPath = Path.Combine(templatesRoot, Path.GetFileName(dt.htmlPath));
            }
            dt.OpenHTML();
            dt.ProcessDocument();

            return dt;
        }