/// <summary> /// 快速注册用户 /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <CHIS_Code_Customer> QuickRegist(QuickRegistCustomerInfo model, int opId, string opMan) { if (model.CustomerMobile.IsNotEmpty()) { if (model.CustomerMobile.IsMobileNumber()) { if (_db.vwCHIS_Code_Customer.Where(m => m.CustomerMobile == model.CustomerMobile).Count() > 0) { throw new Exception("该手机已经使用,不能快速注册"); } if (_db.CHIS_Sys_Login.Where(m => m.Mobile == model.CustomerMobile).Count() > 0) { throw new Exception("该手机已经使用,不能快速注册"); } } } var cus = new vwCHIS_Code_Customer { }; cus.CustomerName = model.CustomerName; cus.Gender = model.Gender; cus.Birthday = model.Birthday; cus.LoginName = string.Format("{0}.{1}.{2}", Ass.Data.Chinese2Spell.GetFstLettersLower(model.CustomerName), model.Gender, model.Birthday.ToString("yyyyMMdd")); if (model.CustomerMobile.IsNotEmpty() && model.CustomerMobile.GetStringType().IsMobile) { cus.CustomerMobile = model.CustomerMobile; } cus.sysSource = sysSources.CHIS约号快增.ToString(); cus.IsVIP = false; return(await CreateCustomerAsync(cus, opId, opMan)); }
/// <summary> /// 快速注册一个用户 /// </summary> /// <param name="cusName">用户名</param> /// <param name="cusMobile">用户手机号</param> /// <param name="cusIdCode">用户身份证号</param> /// <param name="opId">操作人Id</param> /// <param name="opMan">操作人</param> /// <returns></returns> public async Task <CHIS_Code_Customer> CreateCustomerAsync(string cusName, string cusMobile, string cusIdCode, sysSources sysSource, int opId, string opMan) { var cus = new vwCHIS_Code_Customer { CustomerName = cusName }; if (cusMobile.GetStringType().IsMobile) { cus.CustomerMobile = cusMobile; } else { cus.Telephone = cusMobile; } if (cusIdCode.GetStringType().IsIdCardNumber) { cus.IDcard = cusIdCode; } else { throw new Exception("身份证错误"); } //处理性别和生日 var a = Ass.Data.Utils.GetIdCardInfo(cusIdCode); cus.Gender = a.Gender; cus.Birthday = a.Birthday; cus.sysSource = sysSource.ToString(); cus.IsVIP = false; cus.LoginName = string.Format("{0}.{1}.{2}", Ass.Data.Chinese2Spell.GetFstLettersLower(cus.CustomerName), cus.Gender, cus.Birthday?.ToString("yyyyMMdd")); return(await CreateCustomerAsync(cus, opId, opMan)); }
/// <summary> /// 添加一个用户 /// </summary> /// <param name="model"></param> /// <param name="opId"></param> /// <param name="opMan"></param> /// <returns></returns> public async Task <CHIS_Code_Customer> CreateCustomerAsync(vwCHIS_Code_Customer model, int opId, string opMan) { var cus = new CHIS_Code_Customer { }; cus.CustomerName = model.CustomerName; cus.Gender = model.Gender; cus.Birthday = model.Birthday; cus.LoginName = model.LoginName; cus.CustomerMobile = model.CustomerMobile; cus.IDcard = model.IDcard; cus.Email = model.Email; cus.sysSource = model.sysSource; cus.IsVIP = model.IsVIP == true; var health = new CHIS_Code_Customer_HealthInfo { CustomerId = cus.CustomerID, Allergic = model.Allergic, PastMedicalHistory = model.PastMedicalHistory }; return(await CreateCustomerAsync(cus, health, opId, opMan)); }