/// <summary> /// Build a list of distinct physicans to run report against, or use logged in user (default) /// </summary> private void BuildPhysiciansDropDown() { UserController uc = new UserController(); string phLastName = uc.GetLoggedInUserLastName(); // If user has permission to edit security/admin, then they should be // able to select physician to run report against if (PermissionManager.HasPermission(PermissionManager.EditSecurity)) { // Retrieve a list of distinct urology physicians string serviceName = "Urology"; string[] procNames = new string[] { "RP", "CP", "LP", "RALP", "PP", "LP_CONV", "SalvCP", "SalvLP", "SalvRP" }; PhysicianDa da = new PhysicianDa(); DataTable distinctPhysicians = da.GetDistinctProcSurgeonsByServiceAndProc(serviceName, procNames); PhysiciansSelect.DataSource = distinctPhysicians; PhysiciansSelect.DataBind(); if (distinctPhysicians.Select("ProcSurgeon = '" + phLastName.Replace("'", "''") + "'").Length > 0) { PhysiciansSelect.SelectedValue = phLastName; } } // Otherwise logged in user will be shown and select disabled else { ListItem singlePhysician = new ListItem(phLastName, phLastName); PhysiciansSelect.Items.Add(singlePhysician); PhysiciansSelect.Enabled = false; } }
/// <summary> /// Returns a DataTable of filterd patient menu items /// </summary> /// <param name="filterType"></param> /// <param name="filterExpr"></param> /// <returns></returns> private DataTable GetFilteredPatientMenuItems(string filterType, string filterExpr) { DataTable results = new DataTable(); switch (filterType) { case "Protocols": if (string.IsNullOrEmpty(filterExpr) || filterExpr.ToLower() == "all") { results = new ProtocolDa().GetDistinctProtocols().Tables[0]; } else { results = new ProtocolDa().GetDistinctProtocols(filterExpr).Tables[0]; } break; case "Physicians": if (string.IsNullOrEmpty(filterExpr) || filterExpr.ToLower() == "all") { results = new PhysicianDa().GetDistinctPhysicians().Tables[0]; } else { results = new PhysicianDa().GetDistinctPhysicians(filterExpr).Tables[0]; } break; } return(results); }
/// <summary> /// Build a list of distinct physicans to run report /// </summary> private void BuildPhysiciansDropDown() { PhysicianDa da = new PhysicianDa(); DataTable distinctPhysicians = da.GetDistinctApptPhysicians(); PhysiciansSelect.DataSource = distinctPhysicians.DefaultView;; PhysiciansSelect.DataBind(); }
private void PopulatePhysiciansDropDown() { PhysicianDa phDa = new PhysicianDa(); DataSet phDs = phDa.GetDistinctPhysicians(); if (phDs.Tables.Count > 0) { FollowingPhysicianId.DataSource = phDs.Tables[0].DefaultView; FollowingPhysicianId.DataTextField = "PhName"; FollowingPhysicianId.DataValueField = Physician.PhysicianId; FollowingPhysicianId.DataBind(); } }
/// <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); }
private void PopulatePhysicianDropDown(bool resetToBlank) { // populate drop down; need to reset after saving since doc name may have changed PhysicianDa da = new PhysicianDa(); DataSet ds = da.GetDistinctPhysicians(); PhysiciansDropDown.DataSource = ds.Tables[0].DefaultView; PhysiciansDropDown.DataValueField = "PhysicianId"; PhysiciansDropDown.DataTextField = "PhName"; PhysiciansDropDown.DataBind(); PhysiciansDropDown.Items.Insert(0, new ListItem("")); PhysiciansDropDown.Items.Insert(1, new ListItem(_dropDownNewValue)); if (IsPostBack && resetToBlank == false) { PhysiciansDropDown.SelectedValue = _selectedPhysician; } }
protected void AssignPhysicianClick(object sender, EventArgs e) { // assign selected physician as following physician if (!String.IsNullOrEmpty(FollowingPhysicianId.SelectedValue) && PatientId != 0) { Physician phObj = new Physician(); phObj.Get(Int32.Parse(FollowingPhysicianId.SelectedValue)); if (!phObj.IsEmpty) { PhysicianDa pda = new PhysicianDa(); int physicianId = Int32.Parse(phObj[Physician.PhysicianId].ToString()); PatientPhysicianDa ptPhDa = new PatientPhysicianDa(); DataTable ptphDt = ptPhDa.ValidatePatientPhysician(PatientId, physicianId).Tables[0]; if (VerifyUnique(ptphDt)) { AssignPhysicianErrorLBL.Text = String.Empty; // NEW CODE, insert record though middle tier PatientPhysician ptPhysician = new PatientPhysician(); ptPhysician[PatientPhysician.PatientId] = PatientId; ptPhysician[PatientPhysician.PhysicianId] = physicianId; ptPhysician[PatientPhysician.PtPhRole] = "Following"; UserController userCt = new UserController(); int currentUserId = userCt.GetUserId(); UserDa currentUserDa = new UserDa(); DataSet currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId()); ptPhysician[PatientPhysician.EnteredTime] = DateTime.Now; ptPhysician[PatientPhysician.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; ptPhysician.Save(); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_refreshPage", "refreshPage(); ", true); } else { AssignPhysicianErrorLBL.Text = "Physician " + phObj[Physician.PhFirstName].ToString() + " " + phObj[Physician.PhLastName].ToString() + " already assigned to patient as a(n) " + ptphDt.Rows[0][PatientPhysician.PtPhRole].ToString() + " physician."; } } } }
/// <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; } }
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; } }