protected void Page_Load(object sender, EventArgs e) { Owen.Model.Model_UserInfo model = HttpContext.Current.Session[Owen.Common.Constant.SESSION_ADMIN_INFO] as Owen.Model.Model_UserInfo; if (model == null) { Response.Write("<script>parent.location.href='../login.aspx'</script>"); Response.End(); } mMedical = new Owen.BLL.BLL_Medical().GetEntity(string.Format(" PatientMobile = '{0}'", model.UserName)); if (mMedical == null) { Owen.Common.JSHelper.Alert(this, "没有检查到您的病历!", "../Center.aspx"); return; } }
protected void btnSave_Click(object sender, EventArgs e) { Owen.BLL.BLL_Doctor bllDoctor = new Owen.BLL.BLL_Doctor(); Owen.Model.Model_Medical entity = null; if (entity == null) entity = new Owen.Model.Model_Medical(); if (string.IsNullOrEmpty(ddlHospital.SelectedValue)) { JSHelper.Alert(this, "请选择医院!"); return; } if (string.IsNullOrEmpty(ddlDoctor.SelectedValue)) { JSHelper.Alert(this, "请选择主治医生!"); return; } entity.HospitalID = int.Parse(ddlHospital.SelectedValue); entity.DoctorID = int.Parse(ddlDoctor.SelectedValue); if (string.IsNullOrEmpty(txtHospitalNumber.Text)) { JSHelper.Alert(this, "请输入住院号!"); return; } entity.HospitalNumber = txtHospitalNumber.Text.Trim(); if (string.IsNullOrEmpty(txtSurgery.Text)) { JSHelper.Alert(this, "请输入手术名称!"); return; } entity.Surgery = txtSurgery.Text.Trim(); if (string.IsNullOrEmpty(txtPatientName.Text)) { JSHelper.Alert(this, "请输入患者姓名!"); return; } entity.PatientName = txtPatientName.Text.Trim(); if (string.IsNullOrEmpty(txtPatientBirth.Text)) { JSHelper.Alert(this, "请输入患者出生日期!"); return; } entity.PatientBirth = txtPatientBirth.Text.Trim(); if (string.IsNullOrEmpty(txtPatientAge.Text)) { JSHelper.Alert(this, "请输入患者年龄!"); return; } else { int age = 0; if (!int.TryParse(txtPatientAge.Text, out age)) { JSHelper.Alert(this, "请输入正确的患者年龄!"); return; } entity.PatientAge = age; } if (string.IsNullOrEmpty(txtPatientMobile.Text)) { JSHelper.Alert(this, "请输入患者手机号码!"); return; } else { //用户名(手机号码)格式错误,请输入正确的手机号码 if (!Owen.Common.Validator.IsValidPhone(txtPatientMobile.Text)) { JSHelper.Alert(this, "请输入患者手机号码!"); return; } } entity.PatientMobile = txtPatientMobile.Text.Trim(); entity.PatientSex = int.Parse(ddlPatientSex.SelectedValue); //完成度 entity.Finish = 0.1M; entity.DistributorID = distributorID; entity.EmployeesID = employessID; switch (action) { case "add": entity.CreateDt = DateTime.Now; new Owen.BLL.BLL_Medical().AddEntity(entity); JSHelper.Alert(this, "创建成功!", "MedicalList.aspx"); break; case "edit": entity.MedicalID = medicalId; new Owen.BLL.BLL_Medical().UpdateEntity(entity); JSHelper.Alert(this, "修改成功!", "MedicalManager.aspx?action=edit&medicalId="+ medicalId +""); break; } }