protected void Page_Load(object sender, EventArgs e) { if (Session["loginModel"] == null) { Response.Write("<script>alert('请重新登录');opener.top.location.href='../../Default.aspx';window.close();</script>"); return; } id = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["id"])); outpatientEmergencyModel = new OutpatientEmergencyModel(); outpatientEmergencyBLL = new OutpatientEmergencyBLL(); outpatientEmergencyModel = outpatientEmergencyBLL.GetModelById(id); StudentsRealName.Text = outpatientEmergencyModel.StudentsRealName.ToString(); TrainingBaseName.Text = outpatientEmergencyModel.TrainingBaseName.ToString(); ProfessionalBaseName.Text = outpatientEmergencyModel.ProfessionalBaseName.ToString(); RotaryDept.SelectedItem.Text = outpatientEmergencyModel.DeptName.ToString(); RotaryDept.SelectedValue = outpatientEmergencyModel.DeptCode.ToString(); Teacher.SelectedItem.Text = outpatientEmergencyModel.TeacherName.ToString(); Teacher.SelectedItem.Value = outpatientEmergencyModel.TeacherId.ToString(); RecordType.SelectedValue = outpatientEmergencyModel.RecordTypeId.ToString(); DiseaseName.Text = outpatientEmergencyModel.DiseaseName.ToString(); DiseaseNum.Text = outpatientEmergencyModel.DiseaseNum.ToString(); Comment.Text = outpatientEmergencyModel.Comment.ToString(); Writor.Text = outpatientEmergencyModel.Writor.ToString(); RegisterDate.Text = outpatientEmergencyModel.RegisterDate.ToString(); }
public bool UpdateCheckByTeacher(OutpatientEmergencyModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update GP_OutpatientEmergency set "); strSql.Append("TeacherCheck=@TeacherCheck"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@TeacherCheck", SqlDbType.NVarChar, 50), new SqlParameter("@Id", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.TeacherCheck; parameters[1].Value = model.Id; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public bool Update(OutpatientEmergencyModel model, string id) { StringBuilder strSql = new StringBuilder(); strSql.Append("update GP_OutpatientEmergency set "); strSql.Append("DeptCode=@DeptCode,"); strSql.Append("DeptName=@DeptName,"); strSql.Append("RegisterDate=@RegisterDate,"); strSql.Append("Writor=@Writor,"); strSql.Append("RecordTypeId=@RecordTypeId,"); strSql.Append("RecordTypeName=@RecordTypeName,"); strSql.Append("DiseaseName=@DiseaseName,"); strSql.Append("DiseaseNum=@DiseaseNum,"); strSql.Append("Comment=@Comment,"); strSql.Append("TeacherId=@TeacherId,"); strSql.Append("TeacherName=@TeacherName"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@DeptCode", SqlDbType.NVarChar, 50), new SqlParameter("@DeptName", SqlDbType.NVarChar, 500), new SqlParameter("@RegisterDate", SqlDbType.NVarChar, 50), new SqlParameter("@Writor", SqlDbType.NVarChar, 50), new SqlParameter("@RecordTypeId", SqlDbType.NVarChar, 50), new SqlParameter("@RecordTypeName", SqlDbType.NVarChar, 50), new SqlParameter("@DiseaseName", SqlDbType.NVarChar, 50), new SqlParameter("@DiseaseNum", SqlDbType.NVarChar, 50), new SqlParameter("@Comment", SqlDbType.NVarChar, 1000), new SqlParameter("@TeacherId", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 50), new SqlParameter("@Id", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.DeptCode; parameters[1].Value = model.DeptName; parameters[2].Value = model.RegisterDate; parameters[3].Value = model.Writor; parameters[4].Value = model.RecordTypeId; parameters[5].Value = model.RecordTypeName; parameters[6].Value = model.DiseaseName; parameters[7].Value = model.DiseaseNum; parameters[8].Value = model.Comment; parameters[9].Value = model.TeacherId; parameters[10].Value = model.TeacherName; parameters[11].Value = id; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public List <Model.OutpatientEmergencyModel> GetPagedList(string StudentsName, string TrainingBaseCode, string DeptName, string RecordTypeId, string DiseaseName, string DiseaseNum, int start, int end) { string sql = "select * from (select row_number() over(order by RegisterDate desc) as num,* from GP_OutpatientEmergency where StudentsName='" + StudentsName + "' and TrainingBaseCode='" + TrainingBaseCode + "'"; if (!string.IsNullOrEmpty(DeptName)) { sql += "and DeptName like '%" + DeptName + "%'"; } if (RecordTypeId != "-1" && !string.IsNullOrEmpty(RecordTypeId)) { sql += "and RecordTypeId ='" + RecordTypeId + "'"; } if (!string.IsNullOrEmpty(DiseaseName)) { sql += "and DiseaseName like '%" + DiseaseName + "%'"; } if (!string.IsNullOrEmpty(DiseaseNum)) { sql += "and DiseaseNum = '" + DiseaseNum + "'"; } sql += ")as t where t.num>=@start and t.num<=@end"; SqlParameter[] pars = { new SqlParameter("@start", SqlDbType.Int), new SqlParameter("@end", SqlDbType.Int) }; pars[0].Value = start; pars[1].Value = end; DataTable dt = db.RunDataTable(sql, pars); List <OutpatientEmergencyModel> list = null; if (dt.Rows.Count > 0) { list = new List <OutpatientEmergencyModel>(); OutpatientEmergencyModel model = null; foreach (DataRow row in dt.Rows) { model = new OutpatientEmergencyModel(); model = DataRowToModel(row); list.Add(model); } } return(list); }
public OutpatientEmergencyModel GetModelById(string Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,StudentsRealName,StudentsName,TrainingBaseCode,TrainingBaseName,ProfessionalBaseCode,ProfessionalBaseName,DeptCode,DeptName,RegisterDate,Writor,TeacherCheck,KzrCheck,BaseCheck,ManagerCheck,RecordTypeId,RecordTypeName,DiseaseName,DiseaseNum,Comment,TeacherId,TeacherName from GP_OutpatientEmergency "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.NVarChar, 50) }; parameters[0].Value = Id; OutpatientEmergencyModel model = new OutpatientEmergencyModel(); DataSet ds = db.RunDataSet(strSql.ToString(), parameters, "tbName"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public bool UpdateCheckByTeacher(OutpatientEmergencyModel model) { return(outpatientEmergencyDAL.UpdateCheckByTeacher(model)); }
public bool Update(OutpatientEmergencyModel model, string id) { return(outpatientEmergencyDAL.Update(model, id)); }
public bool Add(OutpatientEmergencyModel model) { return(outpatientEmergencyDAL.Add(model)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["loginModel"] == null) { Response.Write("<script>alert('请重新登录');opener.top.location.href='../../Default.aspx';window.close();</script>"); return; } id = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["id"])); pi = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["pi"])); if (!IsPostBack) { loginModel = new LoginModel(); studentsPersonalInformationModel = new StudentsPersonalInformation2Model(); studentsPersonalInformationBLL = new StudentsPersonalInformation2BLL(); dt = new DataTable(); professionalBaseDeptBLL = new ProfessionalBaseDeptBLL(); loginModel = (LoginModel)Session["loginModel"]; Writor.Text = loginModel.real_name; StudentsRealName.Text = loginModel.real_name; StudentsRealName.ReadOnly = true; RegisterDate.Text = DateTime.Now.Date.ToString("yyyy-MM-dd"); RegisterDate.ReadOnly = true; na = loginModel.name; StudentsName.Value = na; tbcode = loginModel.training_base_code; studentsPersonalInformationModel = studentsPersonalInformationBLL.GetModelByNameTBCode(na, tbcode); if (studentsPersonalInformationModel == null) { Response.Write("<script> alert('请完善个人基本信息');window.close();</script>"); return; } else { TrainingBaseCode.Value = studentsPersonalInformationModel.TrainingBaseCode.ToString(); TrainingBaseName.Text = studentsPersonalInformationModel.TrainingBaseName.ToString(); TrainingBaseName.ReadOnly = true; ProfessionalBaseCode.Value = studentsPersonalInformationModel.ProfessionalBaseCode.ToString(); ProfessionalBaseName.Text = studentsPersonalInformationModel.ProfessionalBaseName.ToString(); ProfessionalBaseName.ReadOnly = true; dt = professionalBaseDeptBLL.GetDeptDataTableByCode(studentsPersonalInformationModel.ProfessionalBaseCode.ToString()); RotaryDept.DataSource = dt; RotaryDept.DataTextField = "dept_name"; RotaryDept.DataValueField = "dept_code"; RotaryDept.DataBind(); RotaryDept.Items.Insert(0, new ListItem("==请选择==", "0")); } if (!string.IsNullOrEmpty(id)) {//如果不是表单提交,并且带了id值来做修改操作,则在界面上把值都呈现出来 outpatientEmergencyModel = new OutpatientEmergencyModel(); outpatientEmergencyBLL = new OutpatientEmergencyBLL(); outpatientEmergencyModel = outpatientEmergencyBLL.GetModelById(id); StudentsRealName.Text = outpatientEmergencyModel.StudentsRealName.ToString(); TrainingBaseName.Text = outpatientEmergencyModel.TrainingBaseName.ToString(); ProfessionalBaseName.Text = outpatientEmergencyModel.ProfessionalBaseName.ToString(); //RotaryDept.SelectedItem.Text = outpatientEmergencyModel.DeptName.ToString(); RotaryDept.SelectedValue = outpatientEmergencyModel.DeptCode.ToString(); dt = new LoginBLL().GetTeachersDtByDeptCode(outpatientEmergencyModel.TrainingBaseCode, outpatientEmergencyModel.ProfessionalBaseCode, outpatientEmergencyModel.DeptCode, "teachers"); Teacher.DataSource = dt; Teacher.DataTextField = "real_name"; Teacher.DataValueField = "name"; Teacher.DataBind(); Teacher.Items.Insert(0, new ListItem("==请选择==", "0")); Teacher.SelectedValue = outpatientEmergencyModel.TeacherId; //Teacher.SelectedItem.Text = outpatientEmergencyModel.TeacherName.ToString(); //Teacher.SelectedItem.Value = outpatientEmergencyModel.TeacherId.ToString(); //RotaryDept.Items.Insert(0, new ListItem("==请选择==", "0")); RecordType.SelectedValue = outpatientEmergencyModel.RecordTypeId.ToString(); DiseaseName.Text = outpatientEmergencyModel.DiseaseName.ToString(); DiseaseNum.Text = outpatientEmergencyModel.DiseaseNum.ToString(); Comment.Text = outpatientEmergencyModel.Comment.ToString(); Writor.Text = outpatientEmergencyModel.Writor.ToString(); RegisterDate.Text = outpatientEmergencyModel.RegisterDate.ToString(); } } }
protected void save_Click(object sender, EventArgs e) { outpatientEmergencyModel = new OutpatientEmergencyModel(); outpatientEmergencyBLL = new OutpatientEmergencyBLL(); outpatientEmergencyModel.DeptCode = CommonFunc.FilterSpecialString(RotaryDept.SelectedItem.Value); outpatientEmergencyModel.DeptName = CommonFunc.FilterSpecialString(RotaryDept.SelectedItem.Text); outpatientEmergencyModel.TeacherId = CommonFunc.FilterSpecialString(Teacher.SelectedItem.Value); outpatientEmergencyModel.TeacherName = CommonFunc.FilterSpecialString(Teacher.SelectedItem.Text); outpatientEmergencyModel.RecordTypeId = CommonFunc.FilterSpecialString(RecordType.SelectedItem.Value); outpatientEmergencyModel.RecordTypeName = CommonFunc.FilterSpecialString(RecordType.SelectedItem.Text); outpatientEmergencyModel.DiseaseName = CommonFunc.FilterSpecialString(DiseaseName.Text); outpatientEmergencyModel.DiseaseNum = CommonFunc.FilterSpecialString(DiseaseNum.Text); outpatientEmergencyModel.Comment = CommonFunc.FilterSpecialString(Comment.Text); outpatientEmergencyModel.Writor = CommonFunc.FilterSpecialString(Writor.Text); outpatientEmergencyModel.RegisterDate = CommonFunc.FilterSpecialString(RegisterDate.Text); if (string.IsNullOrEmpty(id)) { id = Guid.NewGuid().ToString(); outpatientEmergencyModel.Id = id; outpatientEmergencyModel.StudentsName = StudentsName.Value.ToString(); outpatientEmergencyModel.StudentsRealName = CommonFunc.FilterSpecialString(StudentsRealName.Text.Trim()); outpatientEmergencyModel.TrainingBaseCode = CommonFunc.FilterSpecialString(TrainingBaseCode.Value); outpatientEmergencyModel.TrainingBaseName = CommonFunc.FilterSpecialString(TrainingBaseName.Text); outpatientEmergencyModel.ProfessionalBaseCode = CommonFunc.FilterSpecialString(ProfessionalBaseCode.Value); outpatientEmergencyModel.ProfessionalBaseName = CommonFunc.FilterSpecialString(ProfessionalBaseName.Text); outpatientEmergencyModel.TeacherCheck = teacher_check; outpatientEmergencyModel.KzrCheck = kzr_check; outpatientEmergencyModel.BaseCheck = base_check; outpatientEmergencyModel.ManagerCheck = manager_check; if (outpatientEmergencyModel.DeptCode == "0" || outpatientEmergencyModel.DeptName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "轮转科室不能为空", null); return; } if (outpatientEmergencyModel.RecordTypeId == "-1" || outpatientEmergencyModel.RecordTypeName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "类型不能为空", null); return; } if (string.IsNullOrEmpty(outpatientEmergencyModel.DiseaseName)) { ShowMessageBox.Showmessagebox(this, "接诊病种名称不能为空", null); return; } if (string.IsNullOrEmpty(outpatientEmergencyModel.DiseaseNum)) { ShowMessageBox.Showmessagebox(this, "接诊例数不能为空", null); return; } if (outpatientEmergencyModel.Comment.Length > 1000) { ShowMessageBox.Showmessagebox(this, "备注字数不能超过1000字", null); return; } if (outpatientEmergencyBLL.Add(outpatientEmergencyModel)) { try { Response.Write("<script language='javascript'> alert('门/急诊诊治记录信息添加成功');window.opener.parent.frames.bodyFrame.frames.frmright.window.loadPageList(1);window.close();</script>"); } catch (Exception ex) { Response.Write(ex.Message); } } } else { if (outpatientEmergencyModel.DeptCode == "0" || outpatientEmergencyModel.DeptName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "轮转科室不能为空", null); return; } if (outpatientEmergencyModel.RecordTypeId == "-1" || outpatientEmergencyModel.RecordTypeName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "类型不能为空", null); return; } if (string.IsNullOrEmpty(outpatientEmergencyModel.DiseaseName)) { ShowMessageBox.Showmessagebox(this, "接诊病种名称不能为空", null); return; } if (string.IsNullOrEmpty(outpatientEmergencyModel.DiseaseNum)) { ShowMessageBox.Showmessagebox(this, "接诊例数不能为空", null); return; } if (outpatientEmergencyModel.Comment.Length > 1000) { ShowMessageBox.Showmessagebox(this, "备注字数不能超过1000字", null); return; } if (outpatientEmergencyBLL.Update(outpatientEmergencyModel, id)) { try { Response.Write("<script language='javascript'> alert('门/急诊诊治记录信息修改成功');window.opener.window.loadPageList('" + pi + "');window.close();</script>"); } catch (Exception ex) { Response.Write(ex.Message); } } } }
public bool Add(OutpatientEmergencyModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into GP_OutpatientEmergency("); strSql.Append("Id,StudentsRealName,StudentsName,TrainingBaseCode,TrainingBaseName,ProfessionalBaseCode,ProfessionalBaseName,DeptCode,DeptName,RegisterDate,Writor,TeacherCheck,KzrCheck,BaseCheck,ManagerCheck,RecordTypeId,RecordTypeName,DiseaseName,DiseaseNum,Comment,TeacherId,TeacherName)"); strSql.Append(" values ("); strSql.Append("@Id,@StudentsRealName,@StudentsName,@TrainingBaseCode,@TrainingBaseName,@ProfessionalBaseCode,@ProfessionalBaseName,@DeptCode,@DeptName,@RegisterDate,@Writor,@TeacherCheck,@KzrCheck,@BaseCheck,@ManagerCheck,@RecordTypeId,@RecordTypeName,@DiseaseName,@DiseaseNum,@Comment,@TeacherId,@TeacherName)"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.NVarChar, 50), new SqlParameter("@StudentsRealName", SqlDbType.NVarChar, 50), new SqlParameter("@StudentsName", SqlDbType.NVarChar, 50), new SqlParameter("@TrainingBaseCode", SqlDbType.NVarChar, 50), new SqlParameter("@TrainingBaseName", SqlDbType.NVarChar, 50), new SqlParameter("@ProfessionalBaseCode", SqlDbType.NVarChar, 50), new SqlParameter("@ProfessionalBaseName", SqlDbType.NVarChar, 50), new SqlParameter("@DeptCode", SqlDbType.NVarChar, 50), new SqlParameter("@DeptName", SqlDbType.NVarChar, 500), new SqlParameter("@RegisterDate", SqlDbType.NVarChar, 50), new SqlParameter("@Writor", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherCheck", SqlDbType.NVarChar, 50), new SqlParameter("@KzrCheck", SqlDbType.NVarChar, 50), new SqlParameter("@BaseCheck", SqlDbType.NVarChar, 50), new SqlParameter("@ManagerCheck", SqlDbType.NVarChar, 50), new SqlParameter("@RecordTypeId", SqlDbType.NVarChar, 50), new SqlParameter("@RecordTypeName", SqlDbType.NVarChar, 50), new SqlParameter("@DiseaseName", SqlDbType.NVarChar, 50), new SqlParameter("@DiseaseNum", SqlDbType.NVarChar, 50), new SqlParameter("@Comment", SqlDbType.NVarChar, 1000), new SqlParameter("@TeacherId", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.Id; parameters[1].Value = model.StudentsRealName; parameters[2].Value = model.StudentsName; parameters[3].Value = model.TrainingBaseCode; parameters[4].Value = model.TrainingBaseName; parameters[5].Value = model.ProfessionalBaseCode; parameters[6].Value = model.ProfessionalBaseName; parameters[7].Value = model.DeptCode; parameters[8].Value = model.DeptName; parameters[9].Value = model.RegisterDate; parameters[10].Value = model.Writor; parameters[11].Value = model.TeacherCheck; parameters[12].Value = model.KzrCheck; parameters[13].Value = model.BaseCheck; parameters[14].Value = model.ManagerCheck; parameters[15].Value = model.RecordTypeId; parameters[16].Value = model.RecordTypeName; parameters[17].Value = model.DiseaseName; parameters[18].Value = model.DiseaseNum; parameters[19].Value = model.Comment; parameters[20].Value = model.TeacherId; parameters[21].Value = model.TeacherName; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public OutpatientEmergencyModel DataRowToModel(DataRow row) { OutpatientEmergencyModel model = new OutpatientEmergencyModel(); if (row != null) { if (row["Id"] != null) { model.Id = row["Id"].ToString(); } if (row["StudentsRealName"] != null) { model.StudentsRealName = row["StudentsRealName"].ToString(); } if (row["StudentsName"] != null) { model.StudentsName = row["StudentsName"].ToString(); } if (row["TrainingBaseCode"] != null) { model.TrainingBaseCode = row["TrainingBaseCode"].ToString(); } if (row["TrainingBaseName"] != null) { model.TrainingBaseName = row["TrainingBaseName"].ToString(); } if (row["ProfessionalBaseCode"] != null) { model.ProfessionalBaseCode = row["ProfessionalBaseCode"].ToString(); } if (row["ProfessionalBaseName"] != null) { model.ProfessionalBaseName = row["ProfessionalBaseName"].ToString(); } if (row["DeptCode"] != null) { model.DeptCode = row["DeptCode"].ToString(); } if (row["DeptName"] != null) { model.DeptName = row["DeptName"].ToString(); } if (row["RegisterDate"] != null) { model.RegisterDate = row["RegisterDate"].ToString(); } if (row["Writor"] != null) { model.Writor = row["Writor"].ToString(); } if (row["TeacherCheck"] != null) { model.TeacherCheck = row["TeacherCheck"].ToString(); } if (row["KzrCheck"] != null) { model.KzrCheck = row["KzrCheck"].ToString(); } if (row["BaseCheck"] != null) { model.BaseCheck = row["BaseCheck"].ToString(); } if (row["ManagerCheck"] != null) { model.ManagerCheck = row["ManagerCheck"].ToString(); } if (row["RecordTypeId"] != null) { model.RecordTypeId = row["RecordTypeId"].ToString(); } if (row["RecordTypeName"] != null) { model.RecordTypeName = row["RecordTypeName"].ToString(); } if (row["DiseaseName"] != null) { model.DiseaseName = row["DiseaseName"].ToString(); } if (row["DiseaseNum"] != null) { model.DiseaseNum = row["DiseaseNum"].ToString(); } if (row["Comment"] != null) { model.Comment = row["Comment"].ToString(); } if (row["TeacherId"] != null) { model.TeacherId = row["TeacherId"].ToString(); } if (row["TeacherName"] != null) { model.TeacherName = row["TeacherName"].ToString(); } } return(model); }