public DataSet SaveMedicalInfo(MedicalInfo medicalInfo) { DataSet dataSet = new DataSet(); try { string storedProcedure = "pSRGs_MedicalInfo"; string parameterName = "@aXMLString"; string parameterValue = ObjectHelper.GetXMLFromObject(medicalInfo); sqlCommand = new SqlCommand(storedProcedure, sqlConnection); sqlCommand.Parameters.AddWithValue(parameterName, parameterValue); sqlCommand.CommandType = CommandType.StoredProcedure; sqlConnection.Open(); sqlDataAdapter.SelectCommand = sqlCommand; sqlDataAdapter.Fill(dataSet); dataSet.Tables[0].TableName = "MedicalInfo"; } catch (Exception) { throw; } finally { sqlConnection.Close(); } return(dataSet); }
private void setOrdDetail(RouteMark routeMark) { var orService = XapServiceMgr.find <ICiorderCrudService>(); routeMark.MedicalInfoList = new List <MedicalInfo>(); //获取已医嘱信息 CiorderAggDO ciagg = orService.findById(routeMark.IdOr); IOrderedEnumerable <OrdSrvDO> srva = ciagg.getOrdSrvDO().OrderBy(x => x.Sortno); foreach (OrdSrvDO srvDo in srva) { if (srvDo.Fg_or == FBoolean.True && srvDo.Sd_srvtp.StartsWith("01")) { var med = new MedicalInfo(); med.Units = srvDo.Quan_medu + " " + srvDo.Medu_name; med.MedicationModels = srvDo.Route_name; med.Name = srvDo.Name; med.Order = (int)srvDo.Sortno; routeMark.MedicalInfoList.Add(med); } } }
public void LoadObject(DataTable MedicalTable, MedicalInfo mInfo) { if (MedicalTable.Rows.Count > 0) { Type type = mInfo.GetType(); foreach (DataColumn dC in MedicalTable.Columns) { PropertyInfo pi = type.GetProperty(dC.ColumnName); switch (pi.PropertyType.ToString()) { case "System.Int32": if (MedicalTable.Rows[0][dC.ColumnName].GetType().ToString() == "System.DBNull") { pi.SetValue(mInfo, 0, null); } else { pi.SetValue(mInfo, Int32.Parse(MedicalTable.Rows[0][dC.ColumnName].ToString()), null); } break; case "System.String": pi.SetValue(mInfo, MedicalTable.Rows[0][dC.ColumnName].ToString(), null); break; } } } }
} // Done... Tested #endregion #region btnContinue_Click(object sender, System.EventArgs e) protected void btnContinue_Click(object sender, System.EventArgs e) { Page.Validate("PageSubmit"); if (Page.IsValid) { MedicalInfo newMedical = new MedicalInfo(); Type type = newMedical.GetType(); foreach (Control ctl in Page.Form.Controls) { string pName; if (ctl.ID != null) { pName = ctl.ID.Substring(3, ctl.ID.Length - 3); } else { continue; } switch (ctl.GetType().ToString()) { case "System.Web.UI.WebControls.TextBox": if (((TextBox)ctl).Text.Length > 0 && type.GetProperty(pName) != null) { PropertyInfo pi = type.GetProperty(pName); string input = HttpUtility.HtmlEncode(((TextBox)ctl).Text.Replace("'", "''")); pi.SetValue(newMedical, input, null); } continue; case "System.Web.UI.WebControls.DropDownList": if (((DropDownList)ctl).SelectedIndex > -1 && type.GetProperty(pName) != null) { PropertyInfo pi = type.GetProperty(pName); string input = HttpUtility.HtmlEncode(((DropDownList)ctl).SelectedValue); pi.SetValue(newMedical, Int32.Parse(input), null); } continue; case "System.Web.UI.WebControls.RadioButtonList": if (((RadioButtonList)ctl).SelectedIndex > -1 && type.GetProperty(pName) != null) { PropertyInfo pi = type.GetProperty(pName); string input = HttpUtility.HtmlEncode(((RadioButtonList)ctl).SelectedValue); pi.SetValue(newMedical, input, null); } continue; } } Session["newMedical"] = newMedical; Server.Transfer("save.Medical.aspx"); } else { ValidationSummary1.ValidationGroup = "PageSubmit"; setupGrid(); } }
private void LoadMedicalControls(MedicalInfo pInfo, Control c) { if (pInfo != null) { Type type = pInfo.GetType(); foreach (Control ctl in c.Controls) { if (ctl.ID == null) { continue; } if (ctl.ID.Contains("span")) { string pName = ctl.ID.Substring(7, ctl.ID.Length - 7); PropertyInfo pi = type.GetProperty(pName); ((System.Web.UI.HtmlControls.HtmlGenericControl)ctl).InnerText = (string)pi.GetValue(pInfo, null).ToString(); if (ctl.ID.Contains("spancbo")) { string cName = ctl.ID.Substring(4, ctl.ID.Length - 4); DropDownList ddlCtl = (DropDownList)c.FindControl(cName); ddlCtl.SelectedValue = pi.GetValue(pInfo, null).ToString(); ((System.Web.UI.HtmlControls.HtmlGenericControl)ctl).InnerText = ddlCtl.SelectedItem.Text; } if (ctl.ID.Contains("spanchk")) { string cName = ctl.ID.Substring(4, ctl.ID.Length - 4); CheckBox chkCtl = (CheckBox)c.FindControl(cName); chkCtl.Checked = Convert.ToBoolean(pi.GetValue(pInfo, null)); ((System.Web.UI.HtmlControls.HtmlGenericControl)ctl).InnerText = chkCtl.Checked.ToString(); } } if (ctl.HasControls()) { LoadMedicalControls(pInfo, ctl); //LoadControlsIncomplete_BL(pInfo, ctl); } } } else { Response.Redirect("CustError.aspx"); } }
private void setOrdDetail(EventLabelCheck labelCheck) { var orService = XapServiceMgr.find <ICiorderCrudService>(); labelCheck.MedicalInfoList = new List <MedicalInfo>(); //获取已医嘱信息 CiorderAggDO ciagg = orService.findById(labelCheck.IdOr); var orcontent = new OrContent(); var medlist = new List <MedicalInfo>(); var med = new MedicalInfo(); med.Name = ciagg.getParentDO().Name_or; med.Order = 1; medlist.Add(med); orcontent.Des = ciagg.getParentDO().Des_or; orcontent.Medlist = medlist; labelCheck.OrCon = orcontent; if (ciagg.getParentDO().Sd_orrsttp == null || ciagg.getParentDO().Sd_orrsttp == "0") { labelCheck.IsShowReportButton = false; } else { labelCheck.IsShowReportButton = true; } //labelCheck.IsShowReportButton=ciagg.getParentDO() // labelCheck.ACName = ciagg.getParentDO().Content_or; //IOrderedEnumerable<OrdSrvDO> srva = ciagg.getOrdSrvDO().OrderBy(x => x.Sortno); //foreach (OrdSrvDO srvDo in srva) //{ // if (srvDo.Fg_or == FBoolean.True && srvDo.Sd_srvtp.StartsWith("03")) // { // var med = new MedicalInfo(); // med.Units = srvDo.Quan_medu + " " + srvDo.Medu_name; // med.MedicationModels = srvDo.Route_name; // med.Name = srvDo.Name; // med.Order = (int)srvDo.Sortno; // labelCheck.MedicalInfoList.Add(med); // } //} }
public int updateMedicalRecord(MedicalInfo mInfo) { clsUtility.Connection = getConnectionString(); Type type = mInfo.GetType(); InfiniEdge.SqlParameterCollection parameters = new InfiniEdge.SqlParameterCollection(); foreach (PropertyInfo pi in type.GetProperties()) { // Database was not saving these 2 date fields correctly if they were null. // Added this statement to insert DBNulls instead. if (pi.Name == "DepartDate" || pi.Name == "ArrivalDate") { if (pi.GetValue(mInfo, null) == null) { parameters.Add(new SqlParameter("@" + pi.Name, DBNull.Value)); } else { parameters.Add(new SqlParameter("@" + pi.Name, pi.GetValue(mInfo, null).ToString())); } } else { if (pi.GetValue(mInfo, null) == null) { parameters.Add(new SqlParameter("@" + pi.Name, "")); } else { parameters.Add(new SqlParameter("@" + pi.Name, pi.GetValue(mInfo, null).ToString())); } } } parameters.Add(new SqlParameter("@PatientID", Int32.Parse(HttpContext.Current.Session["PatientID"].ToString()))); // 'Gets the password for the user //Dim passwdOutput As New SqlParameter("@password", SqlDbType.VarChar, 35) //passwdOutput.Direction = ParameterDirection.Output //pParams.Add(passwdOutput) //oSQL.ExecuteSP("GetPasswordByUserName", pParams) //password = passwdOutput.Value.ToString() int pKey = clsUtility.ExecuteSP_RETURN_VALUE("InsertPatientMedical", parameters); return(pKey); }
private bool ValidateMedicalInfoForm(MedicalInfo medicalInfo, out string responseMessage) { bool boolResponse = true; responseMessage = "<ul>"; List <FormData> lsMedicalInfoData = new List <FormData>(); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.Ablation, "ABLATION", "Ablation", true)); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.WeightLoss, "WEIGHTLOSS", "WeightLoss", true)); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.Medical, "MEDICAL", "Medical", true)); lsMedicalInfoData.Add(new FormData(FormInputType.NameWithSpace, medicalInfo.MedicalDetail, "MEDICALDETAIL", "Medical Detail", false)); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.Medication, "MEDICATION", "Medication", true)); lsMedicalInfoData.Add(new FormData(FormInputType.NameWithSpace, medicalInfo.MedicationDetail, "MEDICATIONDETAIL", "Medication Detail", false)); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.BreastFeeding, "BREASTFEEDING", "Breast Feeding", true)); lsMedicalInfoData.Add(new FormData(FormInputType.DropDownListValue, medicalInfo.Periods, "PERIODS", "Periods", true)); boolResponse = FormValidator.validateForm(lsMedicalInfoData, out responseMessage); return(boolResponse); }
public ActionResult MedicalInfo() { SurrogateService medicalInfoService = new SurrogateService(); MedicalInfo medicalInfo = new MedicalInfo(); try { medicalInfo.UserID = ApplicationManager.LoggedInUser.UserID; medicalInfo.EntityState = EntityState.View; medicalInfo = medicalInfoService.SaveMedicalInfo(medicalInfo); } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("MedicalInfo", medicalInfo)); }
public ActionResult MedicalInfo(MedicalInfo medicalInfo) { SurrogateService medicalInfoService = new SurrogateService(); string validationMessage = string.Empty; try { if (ValidateMedicalInfoForm(medicalInfo, out validationMessage)) { medicalInfo.EntityState = medicalInfo.UserID != null ? EntityState.Edit : EntityState.Save; medicalInfo.ChangeBy = ApplicationManager.LoggedInUser.UserID; medicalInfo.UserID = ApplicationManager.LoggedInUser.UserID; medicalInfo = medicalInfoService.SaveMedicalInfo(medicalInfo); if (medicalInfo.responseDetail.responseType == ResponseType.Error) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), medicalInfo.responseDetail.ResponseMessage, "5000"); return(View("MedicalInfo", medicalInfo)); } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Success); } } else { WebHelper.SetMessageBoxProperties(this, ResponseType.Error, validationMessage); return(View("MedicalInfo", medicalInfo)); } } catch (Exception ex) { WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000"); LoggerHelper.WriteToLog(ex); } return(View("MedicalInfo", medicalInfo)); }
public MedicalInfo SaveMedicalInfo(MedicalInfo medicalInfo) { MedicalInfo localMedicalInfo = new MedicalInfo(); SurrogateData surrogateData = new SurrogateData(); DataSet dataSet = new DataSet(); try { dataSet = surrogateData.SaveMedicalInfo(medicalInfo); if (dataSet.Tables["MedicalInfo"].Rows.Count > 0) { localMedicalInfo = new MedicalInfo(); localMedicalInfo.UserID = dataSet.Tables["MedicalInfo"].Rows[0]["MEDICALINFOID"].ToString(); localMedicalInfo.UserID = dataSet.Tables["MedicalInfo"].Rows[0]["USERID"].ToString(); localMedicalInfo.Ablation = dataSet.Tables["MedicalInfo"].Rows[0]["ABLATION"].ToString(); localMedicalInfo.WeightLoss = dataSet.Tables["MedicalInfo"].Rows[0]["WEIGHLOSS"].ToString(); localMedicalInfo.Medical = dataSet.Tables["MedicalInfo"].Rows[0]["MEDICAL"].ToString(); localMedicalInfo.MedicalDetail = dataSet.Tables["MedicalInfo"].Rows[0]["MEDICALDETAIL"].ToString(); localMedicalInfo.Medication = dataSet.Tables["MedicalInfo"].Rows[0]["MEDICATION"].ToString(); localMedicalInfo.MedicationDetail = dataSet.Tables["MedicalInfo"].Rows[0]["MEDICATIONDETAIL"].ToString(); localMedicalInfo.BreastFeeding = dataSet.Tables["MedicalInfo"].Rows[0]["BREASTFEEDING"].ToString(); localMedicalInfo.Periods = dataSet.Tables["MedicalInfo"].Rows[0]["PERIODS"].ToString(); localMedicalInfo.IsSubmit = Convert.ToInt32(dataSet.Tables["MedicalInfo"].Rows[0]["ISSUBMIT"].ToString()); } } catch (SqlException sqlEx) { localMedicalInfo.responseDetail.responseType = ResponseType.Error; localMedicalInfo.responseDetail.ResponseMessage = sqlEx.Message; } catch (Exception ex) { localMedicalInfo.responseDetail.responseType = ResponseType.Error; localMedicalInfo.responseDetail.ResponseMessage = ApplicationManager.GenericErrorMessage; LoggerHelper.WriteToLog(ex); } return(localMedicalInfo == null ? new MedicalInfo() : localMedicalInfo); }
public void doIncompletes_BL(MedicalInfo mInfo, Control c) { foreach (Control ctrl in c.Controls) { if (ctrl.GetType().ToString() == "System.Web.UI.WebControls.RadioButtonList" || ctrl.GetType().ToString() == "System.Web.UI.WebControls.TextBox" || ctrl.GetType().ToString() == "System.Web.UI.WebControls.DropDownList" || ctrl.GetType().ToString() == "System.Web.UI.HtmlControls.HtmlGenericControl") { // get the id, don't retrieve the first three letters string strID = ctrl.ID.Substring(3); Type type = mInfo.GetType(); PropertyInfo pi = type.GetProperty(strID); if (pi != null) { if (pi.GetValue(mInfo, null) != null) { string strValue = pi.GetValue(mInfo, null).ToString(); switch (ctrl.GetType().ToString()) { case "System.Web.UI.WebControls.RadioButtonList": RadioButtonList rdoList = (RadioButtonList)ctrl; if (rdoList.Visible) { if (strValue.Equals("0")) { rdoList.SelectedIndex = Convert.ToInt32(strValue.Trim()); } else if (strValue.Equals("1")) { rdoList.SelectedIndex = Convert.ToInt32(strValue.Trim()); } } else { HtmlGenericControl spanTxt = (HtmlGenericControl)c.FindControl("span" + ctrl.ID); spanTxt.InnerHtml = strValue.Trim(); } break; case "System.Web.UI.WebControls.TextBox": TextBox txtField = (TextBox)ctrl; if (txtField.Visible) { txtField.Text = strValue.Trim(); } else { HtmlGenericControl spanTxt = (HtmlGenericControl)c.FindControl("span" + ctrl.ID); spanTxt.InnerHtml = strValue.Trim(); } break; case "System.Web.UI.WebControls.DropDownList": DropDownList cboField = (DropDownList)ctrl; if (cboField.Visible) { cboField.SelectedValue = strValue.Trim(); } else { HtmlGenericControl spanTxt = (HtmlGenericControl)c.FindControl("span" + ctrl.ID); cboField.SelectedValue = strValue.Trim(); spanTxt.InnerHtml = cboField.SelectedItem.Text; } break; case "System.Web.UI.HtmlControls.HtmlGenericControl": if (ctrl.Visible) { HtmlGenericControl spanTxt = (HtmlGenericControl)c.FindControl(ctrl.ID); spanTxt.InnerHtml = strValue.Trim(); } break; } strValue = null; } } } if (ctrl.HasControls()) { doIncompletes_BL(mInfo, ctrl); } } }
public int updateMedicalInfo(MedicalInfo mInfo) { return(dbTool.updateMedicalRecord(mInfo)); }
public void getMedicalInfo(int PatientID, MedicalInfo mInfo) { LoadObject(dbTool.getMedicalRecords(PatientID), mInfo); }
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(); } }