protected void AddInstitution(object sender, CommandEventArgs e)
        {
            string instName = InstitutionName.Text;

            if (!string.IsNullOrEmpty(instName))
            {
                InstitutionDa da          = new InstitutionDa();
                DataTable     dt          = da.GetInstitutions();
                bool          isDuplicate = false;
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row[Institution.Institution_Field].ToString() == instName)
                        {
                            isDuplicate = true;
                        }
                    }
                }
                if (!isDuplicate)
                {
                    Institution biz = new Institution();
                    biz[Institution.Institution_Field] = instName;
                    biz.Save();
                }
            }
            SetEditInstitutionsMode();
            InstitutionGrid.DataBind();
        }
    }//end page_load

    protected void ShowInstitutionSelect(int patientId)
    {
        groupMessage.Text = "";

        PatientInstitutionDa da = new PatientInstitutionDa();

        //get users existing insts
        DataTable dt = da.GetPatientInstitutionsByPatientId(patientId);

        rptInstitutions.DataSource = dt.DefaultView;
        rptInstitutions.DataBind();

        if (dt.Rows.Count == 0)
        {
            groupMessage.Text = "No Institutions Assigned. This patient will only be accessible in the All Dataset";
        }

        //get groups
        InstitutionDa i   = new InstitutionDa();
        DataTable     iDt = i.GetInstitutions();

        Institutions.DataSource     = iDt.DefaultView;
        Institutions.DataValueField = "InstitutionId";
        Institutions.DataTextField  = "Institution";
        Institutions.DataBind();
        Institutions.Items.Insert(0, new ListItem(""));

        SelectInstitutionTable.Visible = true;
    }
示例#3
0
        /// <summary>
        /// Builds the Sql string for a single dimension included in an "And" dimension group by creating a
        /// DimensionGroup object.
        /// </summary>
        /// <param name="dimNod">The dimension XmlNode.</param>
        /// <param name="dg">DimensionGroup object that the Dimension belongs to.  This object is being build with each
        /// recursive call to this method.</param>
        /// <returns></returns>
        private string GetAndDimensionString(XmlNode dimNod, DimensionGroup dg)
        {
            string selectStr = "";
            string dimType   = dimNod.Attributes["type"].Value;

            //BaseDataAccess da = null;
            int key = 0;

            switch (dimType)
            {
            case "Institution":
                dg.institution = true;
                InstitutionDa ida = new InstitutionDa();
                key       = ida.GetPrimKey(dimNod.Attributes["value"].Value);
                selectStr = "Dataset_Patients.patientid in(SELECT PatientId FROM PatientInstitutions WHERE institutionid = " + key.ToString() + ") ";
                break;

            case "Physician":
                dg.physician = true;
                PhysicianDa pda = new PhysicianDa();
                key       = pda.GetPrimKey(dimNod.Attributes["value"].Value, dimNod.Attributes["value2"].Value);
                selectStr = "Dataset_Patients.patientid in(SELECT PatientId FROM PatientPhysicians WHERE PhysicianId = " + key.ToString() + ") ";
                break;

            case "Protocol":
                dg.protocol = true;
                ProtocolDa protda = new ProtocolDa();
                key       = protda.GetPrimKey(dimNod.Attributes["value"].Value);
                selectStr = "Dataset_Patients.patientid in (Select patientId from PatientProtocols where protocolId = " + key.ToString() + ") ";
                break;

            case "Disease":
                dg.disease = true;
                DiseaseDa dda = new DiseaseDa();
                key       = dda.GetPrimKey(dimNod.Attributes["value"].Value);
                selectStr = "Dataset_Patients.patientid in(SELECT PatientId FROM PatientDiseases WHERE DiseaseId = " + key.ToString() + ") ";
                break;

            case "All":
                dg.all    = true;
                selectStr = " ";
                break;
            }
            return(selectStr);
        }
示例#4
0
        /// <summary>
        /// Builds the Sql string for a single dimension included in an "Or" dimension group by creating a
        /// DimensionGroup object.
        /// </summary>
        /// <param name="dimNod">The dimension XmlNode.</param>
        /// <param name="dg">DimensionGroup object that the Dimension belongs to.  This object is being build with each
        /// recursive call to this method.</param>
        private void GetOrDimensionString(XmlNode dimNod, DimensionGroup dg)
        {
            string dimType = dimNod.Attributes["type"].Value;

            //BaseDataAccess da = null;
            int key = 0;

            switch (dimType)
            {
            case "Institution":
                dg.institution = true;
                InstitutionDa ida = new InstitutionDa();
                key = ida.GetPrimKey(dimNod.Attributes["value"].Value);
                dg.orInstitution += key.ToString() + ", ";
                break;

            case "Physician":
                dg.physician = true;
                PhysicianDa pda = new PhysicianDa();
                key             = pda.GetPrimKey(dimNod.Attributes["value"].Value, dimNod.Attributes["value2"].Value);
                dg.orPhysician += key.ToString() + ", ";
                break;

            case "Protocol":
                dg.protocol = true;
                ProtocolDa protda = new ProtocolDa();
                key            = protda.GetPrimKey(dimNod.Attributes["value"].Value);
                dg.orProtocol += key.ToString() + ", ";
                break;

            case "Disease":
                dg.disease = true;
                DiseaseDa diseaseda = new DiseaseDa();
                key           = diseaseda.GetPrimKey(dimNod.Attributes["value"].Value);
                dg.orDisease += key.ToString() + ", ";
                break;

            case "All":
                dg.all = true;
                break;
            }
        }
示例#5
0
        override protected void Page_Load(object sender, System.EventArgs e)
        {
            //defaults
            RP_LP_Panel.Visible = false;
            LN_Panel.Visible    = false;


            if (Page.IsPostBack)
            {
                resultMessage.Text = "";

                _opType             = OpType.SelectedValue;
                _surgeon            = OpSurgeon.SelectedValue;
                _institution        = OpInstitution.SelectedValue;
                _monthsSinceSurgery = int.Parse(DateRange.SelectedValue);
                _monthsSincePSA     = int.Parse(MonthsSincePSA.SelectedValue);
                datasetSql          = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);

                // calculate date from today

                ReportDa da = new ReportDa();
                DataSet  ds = da.GetPostOpFollowUp(_opType, _institution, _surgeon, _monthsSinceSurgery, _monthsSincePSA, datasetSql);

                recordCount = ds.Tables[0].Rows.Count;

                if (recordCount > 0)
                {
                    string sortBy = "PtMrn ASC";

                    if (Request.Form["__EVENTTARGET"] != null && !Request.Form["__EVENTTARGET"].Equals(""))
                    {
                        if (Request.Form["__EVENTTARGET"].Equals("SortByName"))
                        {
                            sortBy = "PtLastName";
                        }
                        else if (Request.Form["__EVENTTARGET"].Equals("SortByMonthsSinceSurgery"))
                        {
                            sortBy = "MonthsSinceSurgery";
                        }
                        else if (Request.Form["__EVENTTARGET"].Equals("SortByMonthsSincePSA"))
                        {
                            sortBy = "MonthsSincePSA";
                        }
                    }


                    if (_opType.Equals("RP") || _opType.Equals("LP"))
                    {
                        RP_LP_Panel.Visible = true;

                        DataView dv1 = ds.Tables[0].DefaultView;

                        dv1.Sort = sortBy;

                        RP_LP_Repeater.DataSource = dv1;

                        RP_LP_Repeater.DataBind();
                    }
                    else if (_opType.Equals("LN"))
                    {
                        LN_Panel.Visible = true;

                        DataView dv2 = ds.Tables[0].DefaultView;

                        dv2.Sort = sortBy;

                        LN_Repeater.DataSource = dv2;

                        LN_Repeater.DataBind();
                    }

                    // log report view
                    base.LogReportView();
                }
                else
                {
                    resultMessage.Text = "<br><br>There are no " + _institution + " " + _opType + " patients for " + _surgeon + " outside of " + _monthsSinceSurgery + " months of surgery and " + _monthsSincePSA + " months of PSA for follow-up.";
                }
            }
            else             // not a post back; set defaults
            {
                InstitutionDa iDa = new InstitutionDa();

                // populate dropdown with distinct institutions from surgeries table
                DataTable instDt = iDa.GetDistinctSurgeryInstitution().Tables[0];
                OpInstitution.DataSource     = instDt.DefaultView;
                OpInstitution.DataTextField  = instDt.Columns[0].ColumnName;
                OpInstitution.DataValueField = instDt.Columns[0].ColumnName;
                OpInstitution.DataBind();

                // populate drop down with distint surgeons from surgeries table
                ReportDa  rptDa  = new ReportDa();
                DataTable surgDt = rptDa.GetDistinctSurgeons().Tables[0];
                OpSurgeon.DataSource     = surgDt.DefaultView;
                OpSurgeon.DataTextField  = surgDt.Columns[0].ColumnName;
                OpSurgeon.DataValueField = surgDt.Columns[0].ColumnName;
                OpSurgeon.DataBind();
                OpSurgeon.Items.Add("All");

                OpType.Items.Add("RP");
                OpType.Items.Add("LP");
                OpType.Items.Add("LN");

                DateRange.Items.Add("0");
                DateRange.Items.Add("3");
                DateRange.Items.Add("6");
                DateRange.Items.Add("12");
                DateRange.Items.Add("24");

                MonthsSincePSA.Items.Add("0");
                MonthsSincePSA.Items.Add("3");
                MonthsSincePSA.Items.Add("6");
                MonthsSincePSA.Items.Add("12");
                MonthsSincePSA.Items.Add("24");

                reportTitle = "Post Operation Follow Up Patients";
            }
        }
示例#6
0
        private void InsertDimension(object atts, int patientId, SqlTransaction trans)
        {
            DataRow dr;

            if (atts is XmlNode)
            {
                dr = this.AttributesToRow(((XmlNode)atts).Attributes);
            }
            else
            {
                dr = (DataRow)atts;
            }

            string dimType = (string)dr["type"];

            switch (dimType)
            {
            case "Institution":
                InstitutionDa ida           = new InstitutionDa();
                int           institutionId = ida.GetPrimKey((string)dr["value"]);
                this._CheckId(institutionId, dimType, dr);
                PatientInstitutionDa pida = new PatientInstitutionDa();

                if (VerifyUnique((pida.GetPatientInstitution(patientId, institutionId, trans)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientInstitution ptInstitution = new PatientInstitution();
                    ptInstitution[PatientInstitution.PatientId]     = patientId;
                    ptInstitution[PatientInstitution.InstitutionId] = institutionId;
                    ptInstitution.Save();

                    // OLD CODE, inserts now handled by middle tier
                    // pida.InsertPatientInstitution(patientId, institutionId, trans);  add trans logic after concurrency fully tested- spy 2/21
                    // pida.InsertPatientInstitution(patientId, institutionId, trans);
                }
                break;

            case "Physician":
                PhysicianDa pda = new PhysicianDa();
                //to get Physician primary key need to pass first and last name in from dataset defined in XML
                int physicianId = pda.GetPrimKey((string)dr["value"], (string)dr["value2"]);
                this._CheckId(physicianId, dimType, dr);

                PatientPhysicianDa ppda = new PatientPhysicianDa();
                if (VerifyUnique((ppda.ValidatePatientPhysician(patientId, physicianId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientPhysician ptPhysician = new PatientPhysician();
                    ptPhysician[PatientPhysician.PatientId]   = patientId;
                    ptPhysician[PatientPhysician.PhysicianId] = physicianId;
                    ptPhysician.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //should be creating Patient Physician biz object and passing object to PatientPhysicianDa
                    //ppda.InsertPatientPhysicianDimension(patientId, physicianId, _sc.GetUserName(), trans);
                }
                break;

            case "Protocol":
                ProtocolDa protDa     = new ProtocolDa();
                int        protocolId = protDa.GetPrimKey((string)dr["value"]);
                this._CheckId(protocolId, dimType, dr);

                PatientProtocolDa ptProtDa = new PatientProtocolDa();
                if (VerifyUnique((ptProtDa.ValidatePatientProtocol(patientId, protocolId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientProtocol ptProtocol = new PatientProtocol();
                    ptProtocol[PatientProtocol.PatientId]  = patientId;
                    ptProtocol[PatientProtocol.ProtocolId] = protocolId;
                    ptProtocol.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //ptProtDa.InsertPatientProtocolDimension(patientId, protocolId, _sc.GetUserName(), trans);
                }
                break;

            case "Disease":
                DiseaseDa disDa     = new DiseaseDa();
                int       diseaseId = disDa.GetPrimKey((string)dr["value"]);
                this._CheckId(diseaseId, dimType, dr);

                PatientDiseaseDa ptDiseaseDa = new PatientDiseaseDa();
                if (VerifyUnique((ptDiseaseDa.GetPatientDisease(patientId, diseaseId)).Tables[0]))
                {
                    // NEW CODE, insert record though middle tier
                    PatientDisease ptDisease = new PatientDisease();
                    ptDisease[PatientDisease.PatientId] = patientId;
                    ptDisease[PatientDisease.DiseaseId] = diseaseId;
                    ptDisease.Save();

                    // OLD CODE, inserts now handled by middle tier
                    //ptDiseaseDa.InsertPatientDisease(patientId, diseaseId, trans);
                }
                break;
            }
        }