示例#1
0
        /// <summary>
        /// 添加预约登记
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public JsonResult AddPatientInfo(string data)
        {
            bool   isSuccess      = false;
            string errormsg       = "";
            string identityNumber = string.Empty;
            string pwd            = string.Empty;

            try
            {
                if (data != null)
                {
                    UsersModel    patient = JsonConvert.DeserializeObject <UsersModel>(data);
                    UsersProvider db      = new UsersProvider();
                    if (!db.CheckUserIsExist(patient.IdentityNumber))
                    {
                        patient.IdentityType   = string.IsNullOrEmpty(patient.IdentityType) ? "1" : patient.IdentityType;
                        patient.Gender         = string.IsNullOrEmpty(patient.Gender) ? "男" : patient.Gender;
                        patient.SmokingHisType = string.IsNullOrEmpty(patient.SmokingHisType) ? "1" : patient.SmokingHisType;

                        db.AddPatientInfo(patient, out identityNumber, out pwd);

                        if (!string.IsNullOrEmpty(identityNumber))
                        {
                            isSuccess = true;
                            Session["IdentityNumber"] = identityNumber;
                            Session["IdentityPWD"]    = pwd;
                        }
                    }
                    else
                    {
                        errormsg = "您的证件号码已经被使用!";
                    }
                }
            }
            catch { }

            return(Json(new { IsSuccess = isSuccess, errormsg = errormsg }, "text/html", JsonRequestBehavior.AllowGet));
        }