Пример #1
0
        protected void rgEncounterResults_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                string strPatientID;
                strPatientID = e.Item.Cells[2].Text;

                // Get the patient information from data.
                TrinityClassLibrary_BL.Patient patient = TrinityClassLibrary_DAL.PatientProvider.Fetch(Convert.ToInt32(strPatientID));
                Session["Patient"] = patient;

                // Open the encounter in view or edit mode depending on the encounter status.
                switch (patient.EncounterStatus)
                {
                case "C":                           // Complete.
                case "D":                           // Discussion case.
                case "P":                           // Pending review.
                case "R":                           // Reviewed By Company.
                    Session["mode"] = "view";
                    break;

                case "I":                           // Incomplete.
                    Session["mode"] = "edit";
                    break;

                default:
                    break;
                }

                //string strJS;

                // Lets the patient page know we are returning from a search.
                Session["SearchComplete"] = true;

                //TODO: Remove all references of the patientid session variable and replace with uses of the patient session variable.
                //This is being kept until other code is modified.
                Session["PatientID"] = strPatientID;

                // Get the patient's rig information and store it to session.
                TrinityClassLibrary_BL.Rig rig = TrinityClassLibrary_DAL.RigProvider.Fetch(Convert.ToInt32(patient.RigID));
                Session["PatientRig"] = rig;

                // Redirect the parent window to the patient.apsx page.
                //strJS = "<script language='JavaScript'>window.opener.document.forms[0].action='patient.aspx';</script>";
                //Page.ClientScript.RegisterStartupScript(Page.GetType(), "changeURL", strJS);
                //Page.ClientScript.RegisterStartupScript(Page.GetType(), "close", "<script language='JavaScript'>window.opener.document.forms[0].submit(); window.close();</script>");

                Response.Redirect("patient.aspx");
            }
        }
Пример #2
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            Session["SearchComplete"] = true;

            if (Session["mode"] == null)
            {
                if (Session["PatientID"] == null)
                {
                    Response.Redirect("SessionTimedOut.aspx");
                }
            }

            if (!IsPostBack)
            {
                LoadTips();

                // Get the patient information from session.
                TrinityClassLibrary_BL.Patient patient = (TrinityClassLibrary_BL.Patient)Session["Patient"];

                // Get the patient's rig information from session.
                TrinityClassLibrary_BL.Rig rig = null;
                if (patient.RigID.HasValue)
                {
                    rig = (TrinityClassLibrary_BL.Rig)Session["PatientRig"];
                }

                // Display the patient information to the screen.
                if (rig != null)
                {
                    litPatientData.Text = rig.Name + ": ";
                }
                litPatientData.Text += patient.LastName + ", " + patient.FirstName + " (" + Convert.ToDateTime(patient.EncounterDate).ToShortDateString() + ")";

                // Get all medic records from data.
                List <TrinityClassLibrary_BL.Medic> allMedics = TrinityClassLibrary_DAL.MedicProvider.FetchList();

                // Get all notes for this encounter that are not marked as deleted.
                List <TrinityClassLibrary_BL.AdditionalPatientNote> notes = TrinityClassLibrary_DAL.AdditionalPatientNoteProvider.FetchList(patient.PatientID, false);

                // Get the user's medic information.
                TrinityClassLibrary_BL.Medic currentUser = allMedics.Find(delegate(TrinityClassLibrary_BL.Medic currentMedic)
                {
                    if (currentMedic.MedicID == Convert.ToInt32(Session["MedicPK"]))
                    {
                        return(true);
                    }
                    return(false);
                });
                //ViewState["CurrentMedicSecurity"] = currentUser.SecurityLevel.Value.ToString();

                // Filters out notes the user does not have rights to view.
                notes = FilterNotes(notes, currentUser);

                // Displays the additional notes at the bottom of the screen.
                DisplayNotes(allMedics, notes, currentUser);
            }
            //DataUtility clsData = new DataUtility();

            //StringBuilder strSQL = new StringBuilder();

            if (Session["mode"] != null)
            {
                if (Session["mode"].ToString() == "view")
                {
                    btnContinue.Visible = false;
                    btnReset.Visible    = false;

                    DataTool  dbTool         = new DataTool();
                    DataTable dtPatientNotes = dbTool.getPatientNotes(Session["PatientID"].ToString());
                    // add the javascript onload event that will initialize the span tables
                    bodyMain.Attributes.Add("onLoad", "initSpan()");

                    // disable the input boxes and show the data from the database
                    enterData();

                    //clsData.doIncompletes(strSQL.ToString(), Page);
                    //Filling Spans with datatable
                    if (dtPatientNotes.Rows.Count > 0)
                    {
                        if (dtPatientNotes.Rows[0][1] != null)
                        {
                            txtImpressionNotes.Text = dtPatientNotes.Rows[0][1].ToString();
                        }
                        if (dtPatientNotes.Rows[0][3] != null)
                        {
                            txtInstructionNotes.Text = dtPatientNotes.Rows[0][3].ToString();
                        }
                        if (dtPatientNotes.Rows[0][0] != null)
                        {
                            txtPhysicalNotes.Text = dtPatientNotes.Rows[0][0].ToString();
                        }
                        if (dtPatientNotes.Rows[0][2] != null)
                        {
                            txtRecommendationNotes.Text = dtPatientNotes.Rows[0][2].ToString();
                        }
                        if (dtPatientNotes.Rows[0][1] != null)
                        {
                            spantxtImpressionNotes.InnerHtml = dtPatientNotes.Rows[0][1].ToString();
                        }
                        if (dtPatientNotes.Rows[0][3] != null)
                        {
                            spantxtInstructionNotes.InnerHtml = dtPatientNotes.Rows[0][3].ToString();
                        }
                        if (dtPatientNotes.Rows[0][0] != null)
                        {
                            spantxtPhysicalNotes.InnerHtml = dtPatientNotes.Rows[0][0].ToString();
                        }
                        if (dtPatientNotes.Rows[0][2] != null)
                        {
                            spantxtRecommendationNotes.InnerHtml = dtPatientNotes.Rows[0][2].ToString();
                        }
                    }

                    // Set the visibility of the header panels.
                    pnlAddEditHeader.Visible = false;
                    pnlViewHeader.Visible    = true;
                }
                else if (Session["mode"].ToString() == "edit")
                {
                    DataTool  dbTool         = new DataTool();
                    DataTable dtPatientNotes = dbTool.getPatientNotes(Session["PatientID"].ToString());

                    if (!Page.IsPostBack)
                    {
                        if (dtPatientNotes.Rows.Count > 0)
                        {
                            //Filling Textboxes with datatable
                            txtImpressionNotes.Text              = dtPatientNotes.Rows[0][1].ToString();
                            txtInstructionNotes.Text             = dtPatientNotes.Rows[0][3].ToString();
                            txtPhysicalNotes.Text                = dtPatientNotes.Rows[0][0].ToString();
                            txtRecommendationNotes.Text          = dtPatientNotes.Rows[0][2].ToString();
                            spantxtImpressionNotes.InnerHtml     = dtPatientNotes.Rows[0][1].ToString();
                            spantxtInstructionNotes.InnerHtml    = dtPatientNotes.Rows[0][3].ToString();
                            spantxtPhysicalNotes.InnerHtml       = dtPatientNotes.Rows[0][0].ToString();
                            spantxtRecommendationNotes.InnerHtml = dtPatientNotes.Rows[0][2].ToString();
                        }
                    }
                    // enter the data into the fields

                    // Set the visibility of the header panels.
                    pnlAddEditHeader.Visible = true;
                    pnlViewHeader.Visible    = false;
                }
                else
                {
                }
                ShowHideEditButtons();
            }
        }         // Done... Tested
Пример #3
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            Session["SearchComplete"] = true;

            // make sure the session is valid
            if (Session["MedicPK"] == null)
            {
                Response.Redirect("SessionTimedOut.aspx");
            }
            if (!IsPostBack)
            {
                DataUtility clsData = new DataUtility();
                DataTool    dbTool  = new DataTool();
                LoadTips();
                btnMedAdd.Attributes.Add("onClick", "btnMedAdd_click");
                cboMedic.Items.Add(new ListItem("[Select]", "-1"));

                foreach (TMMModel.UserInfo ui in GetAllMedics())
                {
                    cboMedic.Items.Add(new ListItem(ui.LastName + ", " + ui.FirstName, ui.ID.ToString()));
                }
                //Fills in Medication and VitalSigns Table
                setupGrid();

                // Get the patient information from data.
                // We are getting the session and rig information from data again because the save may have been for a new patient record
                // and if so the patient in session will be incorrect because it does not contain the correct primary key. This can be
                // corrected later if this application is every moved to using a single method of data access.
                TrinityClassLibrary_BL.Patient patient = TrinityClassLibrary_DAL.PatientProvider.Fetch(Convert.ToInt32(Session["PatientID"]));
                Session.Remove("efPatient");

                // Get the patient's rig information from data.
                TrinityClassLibrary_BL.Rig rig = null;
                if (patient.RigID.HasValue)
                {
                    rig = TrinityClassLibrary_DAL.RigProvider.Fetch(patient.RigID.Value);
                }
                Session["PatientRig"] = rig;

                // Display the patient information to the screen.
                if (rig != null)
                {
                    litPatientData.Text = rig.Name + ": ";
                }
                litPatientData.Text += patient.LastName + ", " + patient.FirstName + " (" + Convert.ToDateTime(patient.EncounterDate).ToShortDateString() + ")";

                if (Session["mode"] != null)
                {
                    if (Session["mode"].ToString() == "view")
                    {
                        btnReset.Visible    = false;
                        btnContinue.Visible = false;

                        bodyMain.Attributes.Add("onLoad", "initSpan()");

                        enterData();
                        SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo();
                        MedicalInfo    mInfo          = new MedicalInfo();
                        sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo);
                        clsData.doIncompletes_BL(mInfo, Page);

                        pnlAddEditHeader.Visible = false;
                        pnlViewHeader.Visible    = true;
                        pnlMeds.Visible          = false;
                        pnlVitals.Visible        = false;
                    }
                    else if (Session["mode"].ToString() == "edit")
                    {
                        SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo();
                        MedicalInfo    mInfo          = new MedicalInfo();
                        sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo);

                        clsData.doIncompletes_BL(mInfo, Page);

                        pnlAddEditHeader.Visible = true;
                        pnlViewHeader.Visible    = false;
                        pnlMeds.Visible          = true;
                        pnlVitals.Visible        = true;
                    }
                }
                else
                {
                    btnMedAdd.Attributes.Add("onClick", "btnMedAdd_click");

                    //initDropDown_BL(cboMedic, dbTool.getAllMedics(), 1);
                    setupGrid();
                    SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo();
                    MedicalInfo    mInfo          = new MedicalInfo();
                    sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo);
                    clsData.doIncompletes_BL(mInfo, Page);
                    pnlMeds.Visible   = true;
                    pnlVitals.Visible = true;
                }
            }
            //Build Allergy Table
            initTable_BL();
            //Fills in Medication and VitalSigns Table
            // Shortcut because Lance is a lazy bastard and hates typing all this
            // crap out every time.
            if (Environment.MachineName == "HTX5Y21")
            {
                FillOutControls();
            }
        }
Пример #4
0
        private string GetPatientEncounterStatus(List <TrinityClassLibrary_BL.EncounterStatus> allEncounterStatus, TrinityClassLibrary_BL.Patient patient)
        {
            string currentEncounterStatus = string.Empty;

            TrinityClassLibrary_BL.EncounterStatus status = allEncounterStatus.Find(delegate(TrinityClassLibrary_BL.EncounterStatus currentStatus)
            {
                if (patient.EncounterStatus == currentStatus.EncounterStatusID)
                {
                    return(true);
                }
                return(false);
            });

            if (status != null)
            {
                currentEncounterStatus = status.Description;
            }
            return(currentEncounterStatus);
        }
Пример #5
0
        /// <summary>
        /// Builds an address string from the many parts of the patient address.
        /// </summary>
        /// <param name="patient">
        /// Patient to build address information from.
        /// </param>
        /// <returns>
        /// The address as a string or "Not Available" if there is no address information.
        /// </returns>
        private string BuildPatientAddress(TrinityClassLibrary_BL.Patient patient)
        {
            string address = string.Empty;

            // Add the home address if it is available.
            if (!String.IsNullOrEmpty(patient.HomeAddress))
            {
                address += patient.HomeAddress;
            }

            // Add the city if it is available.
            if (!String.IsNullOrEmpty(patient.HomeCity))
            {
                if (String.IsNullOrEmpty(address))
                {
                    address += patient.HomeCity;
                }
                else
                {
                    address += ", " + patient.HomeCity;
                }
            }

            // Add the state if it is available.
            if (!String.IsNullOrEmpty(patient.HomeState))
            {
                if (String.IsNullOrEmpty(address))
                {
                    address += patient.HomeState;
                }
                else
                {
                    address += ", " + patient.HomeState;
                }
            }

            // Add the zip code if it is available.
            if (!String.IsNullOrEmpty(patient.HomeZipCode))
            {
                if (String.IsNullOrEmpty(address))
                {
                    address += patient.HomeZipCode;
                }
                else
                {
                    if (String.IsNullOrEmpty(patient.HomeState))
                    {
                        address += " " + patient.HomeZipCode;
                    }
                    else
                    {
                        address += ", " + patient.HomeZipCode;
                    }
                }
            }

            // Set the address to "Not Available" if none of the address information was available.
            if (String.IsNullOrEmpty(address))
            {
                address += "Not Available";
            }

            return(address);
        }