/// <summary>
    /// 初始加载
    /// </summary>
    private void OnStart(object sender, EventArgs e)
    {
        Owen.Model.Model_Hospital model = new Owen.BLL.BLL_Hospital().GetEntity(hospitalId);

        if (model == null) return;

        ddlHosType.SelectedValue = model.HosType.ToString();
        txtName.Text = model.Name;
        txtPhone.Text = model.Phone;
        txtAddress.Text = model.Address;

        //医院Id
        int hosId = model.HospitalID;

        //根据医院Id得到所属的城市Id
        Owen.Model.Model_Hospital mHospital = new Owen.BLL.BLL_Hospital().GetEntity(hosId);
        if (mHospital == null) return;
        int cityId = mHospital.CityID;

        //根据城市Id得到省(直辖市)Id
        Owen.Model.Model_City mCity = new Owen.BLL.BLL_City().GetEntity(cityId);
        if (mCity == null) return;
        int province = mCity.ProvinceID;

        ddlProvince.SelectedValue = province.ToString();
        ddlProvince_SelectedIndexChanged(sender, e);

        txtContent.Value = model.Memo;
        ddlCity.SelectedValue = cityId.ToString();
    }
 /// <summary>
 /// 绑定医院
 /// </summary>
 private void BindHospital(int distributorID)
 {
     IList<Owen.Model.Model_Hospital> list = new Owen.BLL.BLL_Hospital().GetEntities(string.Format(" DistributorID = {0}", distributorID));
     ddlHospital.DataTextField = "Name";
     ddlHospital.DataValueField = "HospitalID";
     ddlHospital.DataSource = list;
     ddlHospital.DataBind();
     ddlHospital.Items.Insert(0, new ListItem("--请选择医院--", ""));
 }
 /// <summary>
 /// 绑定医院
 /// </summary>
 private void BindHospital(int cityId)
 {
     IList<Owen.Model.Model_Hospital> list = new Owen.BLL.BLL_Hospital().GetEntities(string.Format(" CityID = {0}", cityId));
     cblHos.DataTextField = "Name";
     cblHos.DataValueField = "HospitalID";
     cblHos.DataSource = list;
     cblHos.DataBind();
 }
    /// <summary>
    /// 初始加载
    /// </summary>
    private void OnStart(object sender, EventArgs e)
    {
        Owen.Model.Model_Doctor model = new Owen.BLL.BLL_Doctor().GetEntity(doctorId);

        if (model == null) return;

        ddlDepartment.SelectedValue = model.DepartmentID.ToString();
        txtName.Text = model.Name;
        txtMobile.Text = model.Mobile;
        txtNativePlace.Text = model.NativePlace;
        txtJobTitle.Text = model.JobTitle;
        ddlSex.SelectedValue = model.Sex.ToString();
        ddlStatus.SelectedValue = model.Status.ToString();
        //医院Id
        int hosId = model.HospitalID;

        //根据医院Id得到所属的城市Id
        Owen.Model.Model_Hospital mHospital = new Owen.BLL.BLL_Hospital().GetEntity(hosId);
        if(mHospital == null ) return;
        int cityId = mHospital.CityID;

        //根据城市Id得到省(直辖市)Id
        Owen.Model.Model_City mCity = new Owen.BLL.BLL_City().GetEntity(cityId);
        if (mCity == null) return;
        int province = mCity.ProvinceID;

        ddlProvince.SelectedValue = province.ToString();
        ddlProvince_SelectedIndexChanged(sender, e);

        ddlCity.SelectedValue = cityId.ToString();
        ddlCity_SelectedIndexChanged(sender, e);

        ddlHospital.SelectedValue = hosId.ToString();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Owen.BLL.BLL_Hospital bllHospital = new Owen.BLL.BLL_Hospital();

        Owen.Model.Model_Hospital entity = bllHospital.GetEntity(hospitalId);

        if (entity == null)
            entity = new Owen.Model.Model_Hospital();

        if (string.IsNullOrEmpty(ddlProvince.SelectedValue))
        {
            JSHelper.Alert(this, "请选择省(直辖市)!");
            return;
        }
        if (string.IsNullOrEmpty(ddlCity.SelectedValue))
        {
            JSHelper.Alert(this, "请选择城市!");
            return;
        }

        if (string.IsNullOrEmpty(ddlHosType.SelectedValue))
        {
            JSHelper.Alert(this, "请选择医院类型!");
            return;
        }
        entity.CityID = int.Parse(ddlCity.SelectedValue);
        entity.HospitalID = hospitalId;
        entity.HosType = int.Parse(ddlHosType.SelectedValue);
        entity.Name = txtName.Text.Trim();
        entity.Phone = txtPhone.Text.Trim();
        entity.Address = txtAddress.Text.Trim();
        entity.Memo = txtContent.Value;

        switch (action)
        {
            case "add":
                new Owen.BLL.BLL_Hospital().AddEntity(entity);
                JSHelper.Alert(this, "保存成功!", "HospitalList.aspx");
                break;
            case "edit":
                entity.HospitalID = hospitalId;
                new Owen.BLL.BLL_Hospital().UpdateEntity(entity);
                JSHelper.Alert(this, "保存成功!", "HospitalList.aspx");
                break;
        }

    }
    /// <summary>
    /// 初始加载
    /// </summary>
    private void OnStart(object sender, EventArgs e)
    {
        Owen.Model.Model_Medical model = new Owen.BLL.BLL_Medical().GetEntity(medicalId);

        if (model == null) return;

        txtPatientMobile.Text = model.PatientMobile;
        txtPatientBirth.Text = model.PatientBirth;
        txtPatientAge.Text = model.PatientAge.ToString();
        ddlPatientSex.SelectedValue = model.PatientSex.ToString();
        txtPatientName.Text = model.PatientName;
        txtSurgery.Text = model.Surgery;
        txtHospitalNumber.Text = model.HospitalNumber;
        txtPatientMobile.Text = model.PatientMobile;

        //医生Id
        int doctorId = model.DoctorID;
        //根据医生Id得到所属的医院
        if (model.mDoctor == null) return;
        int hosId = model.mDoctor.HospitalID;


        //根据医院Id得到所属的城市Id
        Owen.Model.Model_Hospital mHospital = new Owen.BLL.BLL_Hospital().GetEntity(hosId);
        if (mHospital == null) return;
        int cityId = mHospital.CityID;

        //根据城市Id得到省(直辖市)Id
        Owen.Model.Model_City mCity = new Owen.BLL.BLL_City().GetEntity(cityId);
        if (mCity == null) return;
        int province = mCity.ProvinceID;


        ddlHospital.SelectedValue = hosId.ToString();
        ddlHospital_SelectedIndexChanged(sender, e);

        ddlDoctor.SelectedValue = doctorId.ToString();
    }