protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string actionType = DTRequest.GetQueryString("action"); int inHosId = Convert.ToInt32(DTRequest.GetQueryString("InhosId")); Hashtable hashTable = BLL_InHos.GetHospitalSettleInfomrationByPatientIdAndHosId(inHosId); Patient = hashTable["Patient"] as Patient; InHospital = hashTable["InHospital"] as InHospital; //helpedFee = Convert.ToDecimal((hashTable["HelpedItems"] as Hashtable)["HelpedFee"]); helpedNums = Convert.ToInt32((hashTable["HelpedItems"] as Hashtable)["HelpedNums"]); listDept = BLL_Department.GetDepartmentList(" TypeId=1 or TypeId=6 or TypeId=5 or TypeId=2 "); //获取,医院 患者类别 乡镇 的部门数据 } }
/// <summary> /// 发布住院事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { CheckTheData(); Med_Model.Manager manager = GetAdminInfo(); //赋值 InHospital inHos = new InHospital { PatientId = patientId, HosId = manager.DeptId, HosDepart = this.txtOffice.Text.Trim(), HosIllName = this.txtReason.Value.Trim(), InOperator = manager.RealName, AddTime = DateTime.Now, State = 0 }; if (BLL_InHos.AddInHos(inHos) && AddSysLog(CommonEnum.ActionType.Add.ToString(), "发布住院信息")) { MessageBox.ShowAndRedirect(this, "该救助对象的住院信息发布成功,请及时和民政局联系审批", "HospitalManage.aspx"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { CheckTheData(); Med_Model.Manager manager = GetAdminInfo(); //赋值 InHospital inHos = new InHospital { PatientId = patientId, HosId = manager.DeptId, HosDepart = this.txtOffice.Text.Trim(), HosIllName = this.txtReason.Value.Trim(), InOperator = manager.RealName, AddTime = DateTime.Now, State = 0 }; if (BLL_InHos.AddInHos(inHos) && AddSysLog(CommonEnum.ActionType.Add.ToString(), "发布住院信息")) { Page.ClientScript.RegisterStartupScript(GetType(), "alert", "alert('住院信息添加成功!');this.window.close();", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CheckAdminLevel("Hospital");//判断操作权限 int patientId = Convert.ToInt32(DTRequest.GetQueryString("patientId")); hashTable = BLL_InHos.GetHospitalSettleInfomrationByPatientId(patientId); Patient = hashTable["Patient"] as Patient; InHospital = hashTable["InHospital"] as InHospital; helpedFee = Convert.ToDecimal(((hashTable["HelpedItems"] as Hashtable)[patientId] as Hashtable)["HelpedFee"]); helpedNums = Convert.ToInt32(((hashTable["HelpedItems"] as Hashtable)[patientId] as Hashtable)["HelpedNums"]); listDept = BLL_Department.GetDepartmentList(" TypeId=1 or TypeId=6 or TypeId=5 or TypeId=2 "); //获取,医院 患者类别 乡镇 的部门数据 this.hiddenHelpDetails.Value = BLL_HelpStandard.SelectHelpStandardById(Patient.HelpClass).HelpDetails; DataTable table = BLL_InHos.GetHelpedTotalMoney(" and B.State=8 and A.Id=" + patientId); } }
/// <summary> /// 根据住院编号数组批量更新救助对象住院相关信息(事务处理) /// </summary> /// <param name="arrayInHosId"></param> /// <param name="inHospital"></param> /// <returns></returns> public bool UpdatePatientAndInHosByArrayInHosId(int[] arrayInHosId, InHospital inHospital) { bool result = false; try { Hashtable hashTable = new Hashtable(); StringBuilder strSql = new StringBuilder(); //更改住院信息的状态 strSql.Append(" update T_Med_InHos set"); strSql.Append(" State= @state, "); strSql.Append(" CivilOperator= @CivilOperator, "); strSql.Append(" CivilOperateDate= @CivilOperateDate "); strSql.Append(" where Id=@inHosId"); //更改救助对象的当前状态为初始状态 StringBuilder strSql1 = new StringBuilder(); strSql1.Append(" update T_Med_Patient set "); strSql1.Append(" IsHos=0, ");//设置为初始状态 strSql1.Append(" HosId=null, "); strSql1.Append(" InHosId=null "); strSql1.Append(" where InHosId=@InHosId "); int count = 0; //构建事务处理语句 foreach (var inHosId in arrayInHosId) { SqlParameter[] para = { new SqlParameter("@state", SqlDbType.Int), new SqlParameter("@CivilOperator", SqlDbType.NVarChar,50), new SqlParameter("@CivilOperateDate", SqlDbType.DateTime), new SqlParameter("@inHosId", SqlDbType.Int) }; para[0].Value = inHospital.State; para[1].Value = inHospital.CivilOperator; para[2].Value = inHospital.CivilOperateDate; para[3].Value = inHosId; SqlParameter[] para1 = { new SqlParameter("@InHosId", SqlDbType.Int) }; para1[0].Value = inHosId; hashTable.Add(count, new TranPara(strSql.ToString(), para)); count++; hashTable.Add(count, new TranPara(strSql1.ToString(), para1)); count++; } result = SqlHelper.ExecuteSqlTran(SqlHelper.connString, CommandType.Text, hashTable);//执行事务操作,返回操作结果 } catch (Exception e) { Log4Net.LogWrite("err", "Med_DAL:DAL_InHos//UpdatePatientAndInHosByArrayInHosId" + e.Message); //发生异常,记录 } return result; }
/// <summary> /// 更新住院消息(事务处理) /// </summary> /// <param name="InHospital"></param> /// <returns></returns> public bool UpdateInHosAndBackUpPatient(InHospital InHospital) { bool result = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_Med_InHos set "); strSql.Append(" InHosTime=@InHosTime, "); strSql.Append(" HosFee=@HosFee, "); strSql.Append(" MeetMedMoney=@MeetMedMoney, "); strSql.Append(" MedHelpedMoney=@MedHelpedMoney, "); strSql.Append(" CivilHelpedMoney=@CivilHelpedMoney, "); strSql.Append(" SelfMoney=@SelfMoney, "); strSql.Append(" OutHosTime=@OutHosTime, "); strSql.Append(" OutOperator=@OutOperator, "); strSql.Append(" State=@State "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@InHosTime", SqlDbType.DateTime), new SqlParameter("@HosFee", SqlDbType.Decimal), new SqlParameter("@MeetMedMoney", SqlDbType.Decimal), new SqlParameter("@MedHelpedMoney", SqlDbType.Decimal), new SqlParameter("@CivilHelpedMoney", SqlDbType.Decimal), new SqlParameter("@SelfMoney", SqlDbType.Decimal), new SqlParameter("@OutHosTime", SqlDbType.DateTime), new SqlParameter("@OutOperator", SqlDbType.NVarChar,100), new SqlParameter("@State", SqlDbType.Int,2), new SqlParameter("@Id", SqlDbType.Int) }; parameters[0].Value = InHospital.InHosTime; parameters[1].Value = InHospital.HosFee; parameters[2].Value = InHospital.MeetMedMoney; parameters[3].Value = InHospital.MedHelpedMoney; parameters[4].Value = InHospital.CivilHelpedMoney; parameters[5].Value = InHospital.SelfMoney; parameters[6].Value = InHospital.OutHosTime; parameters[7].Value = InHospital.OutOperator; parameters[8].Value = InHospital.State; parameters[9].Value = InHospital.Id; Hashtable hashTable = new Hashtable { { "sql", new TranPara(strSql.ToString(), parameters) } }; //构建处理事务语句 参数 hashtable strSql = new StringBuilder(null); strSql.Append(" update T_Med_Patient set "); strSql.Append(" IsHos=0, "); strSql.Append(" InHosId=null, "); strSql.Append(" HosId=null, "); strSql.Append(" HelpedHosFee=HelpedHosFee+@HelpedHosFee, "); strSql.Append(" HelpedNums=HelpedNums+1 "); strSql.Append(" where Id=@Id "); SqlParameter[] para = { new SqlParameter("@HelpedHosFee", SqlDbType.Decimal), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = InHospital.CivilHelpedMoney; para[1].Value = InHospital.PatientId; hashTable.Add("text", new TranPara(strSql.ToString(), para)); result = SqlHelper.ExecuteSqlTran(SqlHelper.connString, CommandType.Text, hashTable);//执行事务操作,返回操作结果 { result = true; //更新成功设置为true } } catch (Exception e) { Log4Net.LogWrite("err", "Med_DAL:DAL_InHos//UpdateInHos" + e.Message); //发生异常,记录 } return result; }
/// <summary> /// 添加救助对象住院记录,同时更新对象住院标记为社事情住院状态 (事务处理) /// </summary> /// <param name="InHos">救助对象住院 model</param> /// <returns> /// true:添加成功 /// false:添加失败 /// </returns> public bool AddInHos(InHospital InHos) { var result = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" update T_Med_Patient set "); strSql.Append(" IsHos=1, "); //设置为,申请住院状态 strSql.Append(" HosId=@HosId, "); strSql.Append(" InHosId=@InHosId "); strSql.Append(" where Id=@Id "); SqlParameter[] para = { new SqlParameter("@HosId", SqlDbType.Int), new SqlParameter("@InHosId", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int) }; para[0].Value = InHos.HosId; //取得消费编号 para[1].Value = InHos.Id; para[2].Value = InHos.PatientId; Hashtable hashTable = new Hashtable { { "sql", new TranPara(strSql.ToString(), para) } }; //构建处理事务语句 参数 hashtable strSql = new StringBuilder(null); strSql.Append(" insert into T_Med_InHos ("); strSql.Append( " PatientId,HosId,HosDepart,HosIllName,InHosTime,InOperator,HosFee,MeetMedMoney,MedHelpedMoney,CivilHelpedMoney,SelfMoney,HosDetails,OutHosTime,OutOperator,AddTime,State)"); strSql.Append(" values("); strSql.Append( " @PatientId,@HosId,@HosDepart,@HosIllName,@InHosTime,@InOperator,@HosFee,@MeetMedMoney,@MedHelpedMoney,@CivilHelpedMoney,@SelfMoney,@HosDetails,@OutHosTime,@OutOperator,@AddTime,@State)"); strSql.Append(" ;select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@PatientId", SqlDbType.Int), new SqlParameter("@HosId", SqlDbType.Int), new SqlParameter("@HosDepart", SqlDbType.NVarChar, 50), new SqlParameter("@HosIllName", SqlDbType.NVarChar, 50), new SqlParameter("@InHosTime", SqlDbType.DateTime), new SqlParameter("@InOperator", SqlDbType.NVarChar, 50), new SqlParameter("@HosFee", SqlDbType.Decimal), new SqlParameter("@MeetMedMoney", SqlDbType.Decimal), new SqlParameter("@MedHelpedMoney", SqlDbType.Decimal), new SqlParameter("@CivilHelpedMoney", SqlDbType.Decimal), new SqlParameter("@SelfMoney", SqlDbType.Decimal), new SqlParameter("@HosDetails", SqlDbType.NVarChar, 100), new SqlParameter("@OutHosTime", SqlDbType.DateTime), new SqlParameter("@OutOperator", SqlDbType.NVarChar, 100), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@State", SqlDbType.Int, 2) }; parameters[0].Value = InHos.PatientId; parameters[1].Value = InHos.HosId; parameters[2].Value = InHos.HosDepart; parameters[3].Value = InHos.HosIllName; parameters[4].Value = InHos.InHosTime; parameters[5].Value = InHos.InOperator; parameters[6].Value = InHos.HosFee; parameters[7].Value = InHos.MeetMedMoney; parameters[8].Value = InHos.MedHelpedMoney; parameters[9].Value = InHos.CivilHelpedMoney; parameters[10].Value = InHos.SelfMoney; parameters[11].Value = InHos.HosDetails; parameters[12].Value = InHos.OutHosTime; parameters[13].Value = InHos.OutOperator; parameters[14].Value = InHos.AddTime; parameters[15].Value = InHos.State; hashTable.Add("text", new TranPara(strSql.ToString(), parameters)); //更新救助对象的当前状态为住院状态 result = SqlHelper.ExecuteSqlTran2(SqlHelper.connString, CommandType.Text, hashTable); //执行事务操作,返回操作结果 } catch (Exception e) { Log4Net.LogWrite("err", "Med_DAL:DAL_InHos//AddInHos" + e.Message); //发生异常,记录 } return result; }
/// <summary> /// 根据住院信息编号,得到相关信息 /// </summary> /// <param name="inHosId"></param> /// <returns></returns> public InHospital GetInhospitalById(int inHosId) { InHospital inHos = new InHospital(); try { StringBuilder strSql = new StringBuilder(); strSql.Append( " select Id,PatientId,HosId,HosDepart,HosIllName,InHosTime,InOperator,HosFee,MeetMedMoney,MedHelpedMoney,CivilHelpedMoney,SelfMoney,HosDetails,OutHosTime,OutOperator,AddTime,State "); strSql.Append(" from T_Med_InHos where Id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int) }; parameters[0].Value = inHosId; inHos = SqlHelper.ExecuteDataset(SqlHelper.connString, CommandType.Text, strSql.ToString(), parameters) .Tables[0].ToList<InHospital>()[0]; } catch (Exception e) { Log4Net.LogWrite("err", "Med_DAL:DAL_InHos//GetInhospitalById" + e.Message); //发生异常,记录 } return inHos; }
/// <summary> /// 添加救助对象住院记录 同时更新对象住院标记为社事情住院状态 (事务处理) /// </summary> /// <param name="InHos">救助对象住院 model</param> /// <returns> /// true:添加成功 /// false:添加失败 /// </returns> public static bool AddInHos(InHospital InHos) { return DalInHos.AddInHos(InHos); }
/// <summary> /// 根据住院编号数组批量更新救助对象住院相关信息(事务处理) /// </summary> /// <param name="arrayInHosId"></param> /// <param name="inHospital"></param> /// <returns></returns> public static bool UpdatePatientAndInHosByArrayInHosId(int[] arrayInHosId, InHospital inHospital) { return DalInHos.UpdatePatientAndInHosByArrayInHosId(arrayInHosId, inHospital); }
/// <summary> /// 更新住院消息(事务处理) /// </summary> /// <param name="InHospital"></param> /// <returns></returns> public static bool UpdateInHosAndBackUpPatient(InHospital InHospital) { return DalInHos.UpdateInHosAndBackUpPatient(InHospital); }
/// <summary> /// 更新住院消息 /// </summary> /// <param name="InHospital"></param> /// <param name="state">救助对象当前状态</param> /// <returns></returns> public static bool UpdateInHos(InHospital InHospital, int state) { return DalInHos.UpdateInHos(InHospital, state); }