/// <summary> /// 根据Id更新医疗救助列表中的信息 /// </summary> /// <param name="id"></param> /// <param name="med_Ass"></param> /// <returns></returns> public static bool UpdateAssById(long id, Med_Assistance medApp) { bool result = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" update Med_Assistance set "); strSql.Append("Name=@Name,IdCard=@IdCard,Sex=@Sex,Tel=@Tel,StreetId=@StreetId,CommunityId=@CommunityId,Address=@Address,Home=@Home,typeId=@typeId,ClassId=@ClassId,Bz_Cz=@Bz_Cz,Reason=@Reason,IllName=@IllName,State=@State "); strSql.Append("where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar,50), new SqlParameter("@IdCard",SqlDbType.NVarChar,50), new SqlParameter("@Sex",SqlDbType.NVarChar,50), new SqlParameter("@Tel", SqlDbType.NVarChar,50), new SqlParameter("@StreetId", SqlDbType.Int), new SqlParameter("@CommunityId", SqlDbType.Int), new SqlParameter("@Address", SqlDbType.NVarChar,50), new SqlParameter("@Home", SqlDbType.NVarChar,50), new SqlParameter("@typeId", SqlDbType.Int), new SqlParameter("@ClassId", SqlDbType.Int), new SqlParameter("@Bz_Cz", SqlDbType.Int), new SqlParameter("@Reason", SqlDbType.NVarChar,2000), new SqlParameter("@IllName", SqlDbType.NVarChar,50), new SqlParameter("@State", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.BigInt), }; parameters[0].Value = medApp.Name; parameters[1].Value = medApp.IdCard; parameters[2].Value = medApp.Sex; parameters[3].Value = medApp.Tel; parameters[4].Value = medApp.StreetId; parameters[5].Value = medApp.CommunityId; parameters[6].Value = medApp.Address; parameters[7].Value = medApp.Home; parameters[8].Value = medApp.typeId; parameters[9].Value = medApp.ClassId; parameters[10].Value = medApp.Bz_Cz; parameters[11].Value = medApp.Reason; parameters[12].Value = medApp.IllName; parameters[13].Value = medApp.State; parameters[14].Value = id; int count = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (count == 1) { result = true; } } catch (Exception e) { Log4Net.LogWrite("err", "error:" + e.Message); } return result; }
/// <summary> /// 添加一条申请医疗救助人员的基本信息 /// </summary> /// <param name="medApp"></param> /// <returns></returns> public static int InsertMedAss(Med_Assistance medApp) { int result = 0; try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Med_Assistance values("); strSql.Append("@Name,@IdCard,@Sex,@Tel,@StreeId,@CommunityId,@Address,@Home,@TypeId,@ClassId,@Bz_Cz,@Reason,@IllName,@State,@HospitalState,@HosFee,@MenZhenState,@MenZhenFee,@GouYaoState,@GouYaoFee,@TotalFee,@AppTime"); strSql.Append(")"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar,50), new SqlParameter("@IdCard",SqlDbType.NVarChar,50), new SqlParameter("@Sex", SqlDbType.NVarChar,50), new SqlParameter("@Tel", SqlDbType.NVarChar,50), new SqlParameter("@StreeId", SqlDbType.Int), new SqlParameter("@CommunityId", SqlDbType.Int), new SqlParameter("@Address", SqlDbType.NVarChar,50), new SqlParameter("@Home", SqlDbType.NVarChar,50), new SqlParameter("@TypeId", SqlDbType.Int), new SqlParameter("@ClassId", SqlDbType.Int), new SqlParameter("@Bz_Cz", SqlDbType.Int), new SqlParameter("@Reason", SqlDbType.NVarChar,2000), new SqlParameter("@IllName", SqlDbType.NVarChar,50), new SqlParameter("@State", SqlDbType.Int), new SqlParameter("@HospitalState", SqlDbType.Int), new SqlParameter("@HosFee", SqlDbType.Decimal), new SqlParameter("@MenZhenState", SqlDbType.Int), new SqlParameter("@MenZhenFee", SqlDbType.Decimal), new SqlParameter("@GouYaoState", SqlDbType.Int), new SqlParameter("@GouYaoFee", SqlDbType.Decimal), new SqlParameter("@TotalFee", SqlDbType.Decimal), new SqlParameter("@AppTime", SqlDbType.Date), }; parameters[0].Value = medApp.Name; parameters[1].Value = medApp.IdCard; parameters[2].Value = medApp.Sex; parameters[3].Value = medApp.Tel; parameters[4].Value = medApp.StreetId; parameters[5].Value = medApp.CommunityId; parameters[6].Value = medApp.Address; parameters[7].Value = medApp.Home; parameters[8].Value = medApp.typeId; parameters[9].Value = medApp.ClassId; parameters[10].Value = medApp.Bz_Cz; parameters[11].Value = medApp.Reason; parameters[12].Value = medApp.IllName; parameters[13].Value = medApp.State; parameters[14].Value = medApp.IsHospital; parameters[15].Value = medApp.HospitalFee; parameters[16].Value = medApp.IsMenZhen; parameters[17].Value = medApp.MenZhenFee; parameters[18].Value = medApp.IsGouYao; parameters[19].Value = medApp.GouYaoFee; parameters[20].Value = medApp.TotalMoney; parameters[21].Value = medApp.AppTime; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj != null) { result = Convert.ToInt32(obj); } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Med_Ass.AddDiBao:" + e.Message); } return result; }
/// <summary> /// 通过医疗申请主表主键Id找出医疗救助列表中相对应的人员信息 /// </summary> /// <param name="idCard"></param> /// <returns></returns> public static Med_Assistance SelectMedAppById(long id) { Med_Assistance med_App = new Med_Assistance(); try { DataSet ds = new DataSet(); StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Med_Assistance as A left join Ass_class as B on A.ClassId=B.Id left join Ass_Type as C on A.typeId=C.Id where A.Id=" + "'" + id + "'"); ds = DbHelperSQL.Query(strSql.ToString()); med_App.Name = (string)ds.Tables[0].Rows[0]["Name"]; med_App.IdCard = (string)ds.Tables[0].Rows[0]["IdCard"]; med_App.Sex = (string)ds.Tables[0].Rows[0]["Sex"]; med_App.Tel = (string)ds.Tables[0].Rows[0]["Tel"]; med_App.Address = (string)ds.Tables[0].Rows[0]["Address"]; med_App.Home = (string)ds.Tables[0].Rows[0]["Home"]; med_App.Reason = (string)ds.Tables[0].Rows[0]["Reason"]; med_App.IllName = (string)ds.Tables[0].Rows[0]["IllName"]; med_App.ClassId = (int)ds.Tables[0].Rows[0]["ClassId"]; med_App.typeId = (int)ds.Tables[0].Rows[0]["typeId"]; med_App.StreetId = (int)ds.Tables[0].Rows[0]["StreetId"]; med_App.CommunityId = (int)ds.Tables[0].Rows[0]["CommunityId"]; med_App.State = (int)ds.Tables[0].Rows[0]["State"]; med_App.IsHospital = (int)ds.Tables[0].Rows[0]["HospitalState"]; med_App.HospitalFee = (decimal)ds.Tables[0].Rows[0]["HosFee"]; med_App.IsMenZhen = (int)ds.Tables[0].Rows[0]["MenZhenState"]; med_App.MenZhenFee = (decimal)ds.Tables[0].Rows[0]["MenZhenFee"]; med_App.IsGouYao = (int)ds.Tables[0].Rows[0]["GouYaoState"]; med_App.GouYaoFee = (decimal)ds.Tables[0].Rows[0]["GouYaoFee"]; med_App.TotalMoney = (decimal)ds.Tables[0].Rows[0]["TotalFee"]; return med_App; } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Ctrl_Approve.AddDiBao:" + e.Message); } return med_App; }
/// <summary> /// 数据初始化绑定 /// </summary> private void Bind(string action) { #region 初始化申请人基本信息 lbApproverName.Text = AppUser.Name; txtTel1.Text = AppUser.Tel; #endregion #region 初始化区域信息 drpStreet.DataSource = Ctrl_Area.GetStreetList(); drpStreet.DataTextField = "Name"; drpStreet.DataValueField = "Id"; drpStreet.DataBind(); drpCommunity.DataSource = Ctrl_Area.GetCommunityListByStreetId(int.Parse(drpStreet.SelectedValue)); ; drpCommunity.DataTextField = "Name"; drpCommunity.DataValueField = "Id"; drpCommunity.DataBind(); #endregion #region 绑定医疗救助类别 Ass_Type.DataSource = Ctrl_Area.GetAssType(); Ass_Type.DataTextField = "TypeName"; Ass_Type.DataValueField = "TypeName"; Ass_Type.DataBind(); #endregion #region 绑定医疗救助 参保类型 Ass_Class.DataSource = Ctrl_Area.GetAssClass(); Ass_Class.DataTextField = "ClassName"; Ass_Class.DataValueField = "ClassName"; Ass_Class.DataBind(); #endregion #region 绑定修改数据 if (action == "modify") { medApp = Med_Ass.SelectMedAppById(fid); lbApproverName.Text = medApp.Name; txtTel1.Text = medApp.Tel; txtHome.Text = medApp.Home; txtAddress.Text = medApp.Address; txtIllName.Text = medApp.IllName; //txtMoney.Value = medApp.Apply_fee.ToString(); //if (medApp.Purpose == "住院") //{ // rbHospital.Checked = true; //} //else if (medApp.Purpose == "购药") //{ // rbMed.Checked = true; //} //else //{ // rbClinic.Checked = true; //} drpStreet.SelectedIndex = medApp.StreetId - 1; drpCommunity.SelectedIndex = medApp.CommunityId - 1; Ass_Type.SelectedIndex = medApp.typeId; Ass_Class.SelectedIndex = medApp.ClassId; txtReason.Value = medApp.Reason; dpSex.SelectedIndex = (medApp.Sex == "男") ? 0 : 1; } #endregion }