Esempio n. 1
0
        protected void CheckIfOnProtocol(int PatientID, string FormName, string FormType)
        {
            PatientProtocolDa pDa = new PatientProtocolDa();
            DataSet           pDs = pDa.FormGetRecords(PatientID, FormName, FormType);

            if (pDs.Tables.Count > 0 && pDs.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in pDs.Tables[0].Rows)
                {
                    if (row["ProtocolNum"].ToString().Equals("09-051"))
                    {
                        Protocol_09_051.Visible = true;
                    }
                }
            }

            if (Protocol_09_051.Visible)
            {
                string SurgeryDate = "";
                if (Session[SessionKey.CurrentClinicDate] != null)
                {
                    SurgeryDate = Session[SessionKey.CurrentClinicDate].ToString();
                }
                if (SurgeryDate.Length > 0)
                {
                    SetHiddenDateFieldPair(SurveyDateText_2, SurveyDate_2, SurgeryDate);
                }
            }
        }
Esempio n. 2
0
        protected void BuildHpiProtocols(int PatientID, string FormName, string FormType)
        {
            PatientProtocolDa protocolsDa = new PatientProtocolDa();
            DataSet           protcolsDs  = protocolsDa.FormGetRecords(PatientID, FormName, FormType);

            if (protcolsDs.Tables.Count > 0 && protcolsDs.Tables[0].Rows.Count > 0)
            {
                hpiProtocols.DataSource = protcolsDs.Tables[0].DefaultView;
                hpiProtocols.DataBind();
            }
        }
        /// <summary>
        /// Initalizes public properties used for getting Patient specific ids
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitalizeParams(object sender, EventArgs e)
        {
            // Patient Protocol and StudyId
            string queryPatientProtocolId = GetURLValue(QUERY_PATIENT_PROTOCOL_ID_KEY);

            if (!string.IsNullOrEmpty(queryPatientProtocolId))
            {
                PatientProtocol biz = new PatientProtocol();
                biz.Get(int.Parse(queryPatientProtocolId));
                patientProtocolId = biz[PatientProtocol.PatientProtocolId].ToString();
                patientStudyId    = biz[PatientProtocol.PtProtocolStudyId].ToString();
            }
            else if (!string.IsNullOrEmpty(BaseProtocolId) && !string.IsNullOrEmpty(BaseDecryptedPatientId))
            {
                PatientProtocolDa da = new PatientProtocolDa();
                DataTable         patientProtocolRecords = da.GetPatientProtocol(int.Parse(BaseDecryptedPatientId), int.Parse(BaseProtocolId));
                if (patientProtocolRecords.Rows.Count > 0)
                {
                    patientProtocolId = patientProtocolRecords.Rows[0][PatientProtocol.PatientProtocolId].ToString();
                    patientStudyId    = patientProtocolRecords.Rows[0][PatientProtocol.PtProtocolStudyId].ToString();
                }
                else
                {
                    patientProtocolId = string.Empty;
                    patientStudyId    = string.Empty;
                }
            }
            else
            {
                patientProtocolId = string.Empty;
                patientStudyId    = string.Empty;
            }

            // Patient Schema
            if (!string.IsNullOrEmpty(BaseSchemaId) && !string.IsNullOrEmpty(BaseDecryptedPatientId))
            {
                DataTable dt = ProtocolMgmtDa.GetPatientProtocolSchema(int.Parse(BaseSchemaId), int.Parse(BaseDecryptedPatientId));
                if (dt.Rows.Count > 0)
                {
                    patientSchemaId = dt.Rows[0][PatientSchema.PatientSchemaId].ToString();
                }
                else
                {
                    patientSchemaId = string.Empty;
                }
            }
            else
            {
                patientSchemaId = string.Empty;
            }
        }
Esempio n. 4
0
        protected void GetPtProtocolStatus()
        {
            PatientProtocolDa da   = new PatientProtocolDa();
            DataView          view = da.GetPatientProtocolStatus(_patientId).DefaultView;

            if (view.Count >= 1)
            {
                PDFormDiv.Style.Add("display", "block");

                SpinePtProtocolsRpt.DataSource = view;
                SpinePtProtocolsRpt.DataBind();
            }
            else
            {
                NoSpinePtProtocolsMsgTr.Style.Add("display", "block");
            }
        }
Esempio n. 5
0
        protected void GetProtocols()
        {
            PatientProtocolDa ptProtocol = new PatientProtocolDa();

            DataSet ds = ptProtocol.GetPatientProtocolsByStatus(_patientId, "06-107", "92-055", "Consented");

            if (ds.Tables[0].Rows.Count > 0)
            {
                ProtocolStatusMsgTr.Visible = true;
                ProtocolRpt.DataSource      = ds.Tables[0].DefaultView;
                ProtocolRpt.DataBind();
            }
            else
            {
                NoProtocolMsgTr.Visible     = true;
                ProtocolStatusMsgTr.Visible = false;
                ProtocolStatusRptTr.Visible = false;
            }
        }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private bool ValidateForm()
        {
            List <string> errors = new List <string>();

            // if neither screening pas/fail checked
            if (!(ScreeningPassed.Checked || ScreeningFailed.Checked))
            {
                errors.Add("Please choose Passed or Failed.");
            }
            // if either check, validate if patient protocol exists
            else if (ScreeningPassed.Checked || ScreeningFailed.Checked)
            {
                if (FindExistingPatient.Checked && CanViewPatientInfo)
                {
                    if (string.IsNullOrEmpty(epid.Value))
                    {
                        errors.Add("No Patient found, please search for Patient again.");
                    }
                    // if using existing patient, validate not already assigned to this Protocol
                    else
                    {
                        int protocolId       = int.Parse(BaseProtocolId);
                        int patientId        = int.Parse(DecrypyValue(epid.Value));
                        PatientProtocolDa da = new PatientProtocolDa();
                        DataTable         patientProtocolRecords = da.GetPatientProtocol(patientId, protocolId);
                        // if a PatientProtocol record already exists, ask user to go to registration page
                        if (patientProtocolRecords.Rows.Count > 0)
                        {
                            errors.Add("The selected patient has already been assigned to this protocol.");
                            // register script to ask user to go to Patient's registration page
                            DataTable patientSchemaRecords = ProtocolMgmtDa.GetPatientProtocolSchemasByProtocol(protocolId, patientId);
                            string    schemaId             = "";
                            // if patient has patient schema record
                            // ?? need to handle cases where on differnt arms
                            if (patientSchemaRecords.Rows.Count > 0)
                            {
                                schemaId = patientSchemaRecords.Rows[0][PatientSchema.ProtocolSchemaId].ToString();
                            }
                            string doCheck = "confirm('This patient has already been assigned to this Protocol, would you like to go to this patient\\'s Registration page?')";
                            string script  = "if(parent.patientAssigned) { if(" + doCheck + ") { parent.patientAssigned('" + BaseProtocolId + "','" + schemaId + "','" + epid.Value + "'); } }";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "LoadExisitingPatientProtocol", script, true);
                        }
                    }
                }
            }
            else
            {
                errors.Add("Please verify that all required fields have been entered.");
            }
            // check study id
            if (ScreeningPassed.Checked)
            {
                if (StudyID.Value == string.Empty)
                {
                    errors.Add("Please choose a valid StudyId.");
                }
                // not empty, check if exits
                else
                {
                    if (ProtocolMgmtDa.StudyIdExists(StudyID.Value, int.Parse(BaseProtocolId)))
                    {
                        errors.Add("This Study Id '" + StudyID.Value + "' already exits, please choose another StudyId.");
                    }
                }
            }
            if (errors.Count > 0)
            {
                string errorMessage = string.Join(" ", errors.ToArray());
                throw new InvalidScreeningException(errorMessage);
            }
            return(true);
        }
Esempio n. 7
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;
            }
        }