修正银行卡问题
This commit is contained in:
+183
-100
@@ -110,7 +110,7 @@ func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse
|
||||
}
|
||||
|
||||
// PutUserDoctor 修改医生
|
||||
func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest requests.PutUserDoctor) (bool, error) {
|
||||
func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDoctor) (bool, error) {
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorId)
|
||||
@@ -141,19 +141,19 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
userData := make(map[string]interface{}) // 用户数据
|
||||
|
||||
// 处理头像
|
||||
avatar := utils.RemoveOssDomain(putUserDoctorRequest.Avatar)
|
||||
avatar := utils.RemoveOssDomain(req.Avatar)
|
||||
if userDoctor.Avatar != avatar {
|
||||
userDoctorData["avatar"] = avatar
|
||||
userData["avatar"] = avatar
|
||||
}
|
||||
|
||||
// 处理职称
|
||||
if userDoctor.DoctorTitle != putUserDoctorRequest.DoctorTitle {
|
||||
userDoctorData["doctor_title"] = putUserDoctorRequest.DoctorTitle
|
||||
if userDoctor.DoctorTitle != req.DoctorTitle {
|
||||
userDoctorData["doctor_title"] = req.DoctorTitle
|
||||
}
|
||||
|
||||
// 处理科室
|
||||
departmentCustomId, err := strconv.ParseInt(putUserDoctorRequest.DepartmentCustomId, 10, 64)
|
||||
departmentCustomId, err := strconv.ParseInt(req.DepartmentCustomId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("科室错误")
|
||||
}
|
||||
@@ -161,7 +161,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
if departmentCustomId == 0 && userDoctor.DepartmentCustomId != 0 {
|
||||
return false, errors.New("未选择新的科室")
|
||||
}
|
||||
if userDoctor.DepartmentCustomId != departmentCustomId || userDoctor.DepartmentCustomName != putUserDoctorRequest.DepartmentCustomName {
|
||||
if userDoctor.DepartmentCustomId != departmentCustomId || userDoctor.DepartmentCustomName != req.DepartmentCustomName {
|
||||
// 获取科室数据
|
||||
hospitalDepartmentCustomDao := dao.HospitalDepartmentCustom{}
|
||||
hospitalDepartmentCustom, err := hospitalDepartmentCustomDao.GetHospitalDepartmentCustomById(departmentCustomId)
|
||||
@@ -169,11 +169,11 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
return false, errors.New("科室错误")
|
||||
}
|
||||
|
||||
userDoctorData["department_custom_id"] = putUserDoctorRequest.DepartmentCustomId
|
||||
userDoctorData["department_custom_id"] = req.DepartmentCustomId
|
||||
userDoctorData["department_custom_name"] = hospitalDepartmentCustom.DepartmentCustomName
|
||||
|
||||
if putUserDoctorRequest.DepartmentCustomName != "" {
|
||||
userDoctorData["department_custom_name"] = putUserDoctorRequest.DepartmentCustomName
|
||||
if req.DepartmentCustomName != "" {
|
||||
userDoctorData["department_custom_name"] = req.DepartmentCustomName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,12 +199,12 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 处理科室电话
|
||||
if userDoctor.DepartmentCustomMobile != putUserDoctorRequest.DepartmentCustomMobile {
|
||||
userDoctorData["department_custom_id"] = putUserDoctorRequest.DepartmentCustomMobile
|
||||
if userDoctor.DepartmentCustomMobile != req.DepartmentCustomMobile {
|
||||
userDoctorData["department_custom_id"] = req.DepartmentCustomMobile
|
||||
}
|
||||
|
||||
// 处理医院
|
||||
hospitalId, err := strconv.ParseInt(putUserDoctorRequest.HospitalId, 10, 64)
|
||||
hospitalId, err := strconv.ParseInt(req.HospitalId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("科室错误")
|
||||
}
|
||||
@@ -216,39 +216,39 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
if err != nil || hospital == nil {
|
||||
return false, errors.New("医院错误")
|
||||
}
|
||||
userDoctorData["department_custom_id"] = putUserDoctorRequest.HospitalId
|
||||
userDoctorData["department_custom_id"] = req.HospitalId
|
||||
}
|
||||
|
||||
// 处理深度合作医生
|
||||
if userDoctor.IsPlatformDeepCooperation != putUserDoctorRequest.IsPlatformDeepCooperation {
|
||||
userDoctorData["is_platform_deep_cooperation"] = putUserDoctorRequest.IsPlatformDeepCooperation
|
||||
if userDoctor.IsPlatformDeepCooperation != req.IsPlatformDeepCooperation {
|
||||
userDoctorData["is_platform_deep_cooperation"] = req.IsPlatformDeepCooperation
|
||||
}
|
||||
|
||||
// 处理是否先思达合作医生
|
||||
if userDoctor.IsSysDiagnoCooperation != putUserDoctorRequest.IsSysDiagnoCooperation {
|
||||
userDoctorData["is_sys_diagno_cooperation"] = putUserDoctorRequest.IsSysDiagnoCooperation
|
||||
if userDoctor.IsSysDiagnoCooperation != req.IsSysDiagnoCooperation {
|
||||
userDoctorData["is_sys_diagno_cooperation"] = req.IsSysDiagnoCooperation
|
||||
}
|
||||
|
||||
// 是否推荐
|
||||
if userDoctor.IsRecommend != putUserDoctorRequest.IsRecommend {
|
||||
userDoctorData["is_recommend"] = putUserDoctorRequest.IsRecommend
|
||||
if userDoctor.IsRecommend != req.IsRecommend {
|
||||
userDoctorData["is_recommend"] = req.IsRecommend
|
||||
}
|
||||
|
||||
// 处理擅长
|
||||
if userDoctor.BeGoodAt != putUserDoctorRequest.BeGoodAt {
|
||||
userDoctorData["be_good_at"] = putUserDoctorRequest.BeGoodAt
|
||||
if userDoctor.BeGoodAt != req.BeGoodAt {
|
||||
userDoctorData["be_good_at"] = req.BeGoodAt
|
||||
}
|
||||
|
||||
// 医生简介
|
||||
if userDoctor.BriefIntroduction != putUserDoctorRequest.BriefIntroduction {
|
||||
userDoctorData["brief_introduction"] = putUserDoctorRequest.BriefIntroduction
|
||||
if userDoctor.BriefIntroduction != req.BriefIntroduction {
|
||||
userDoctorData["brief_introduction"] = req.BriefIntroduction
|
||||
}
|
||||
|
||||
// 处理医师执业证
|
||||
var licenseCert string
|
||||
if len(putUserDoctorRequest.LicenseCert) > 0 {
|
||||
result := make([]string, len(putUserDoctorRequest.LicenseCert))
|
||||
for i, url := range putUserDoctorRequest.LicenseCert {
|
||||
if len(req.LicenseCert) > 0 {
|
||||
result := make([]string, len(req.LicenseCert))
|
||||
for i, url := range req.LicenseCert {
|
||||
result[i] = strings.TrimPrefix(url, config.C.Oss.OssCustomDomainName)
|
||||
}
|
||||
|
||||
@@ -265,9 +265,9 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
|
||||
// 处理医师资格证
|
||||
var qualificationCert string
|
||||
if len(putUserDoctorRequest.QualificationCert) > 0 {
|
||||
result := make([]string, len(putUserDoctorRequest.QualificationCert))
|
||||
for i, url := range putUserDoctorRequest.QualificationCert {
|
||||
if len(req.QualificationCert) > 0 {
|
||||
result := make([]string, len(req.QualificationCert))
|
||||
for i, url := range req.QualificationCert {
|
||||
result[i] = strings.TrimPrefix(url, config.C.Oss.OssCustomDomainName)
|
||||
}
|
||||
|
||||
@@ -284,9 +284,9 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
|
||||
// 处理医师工作证
|
||||
var workCert string
|
||||
if len(putUserDoctorRequest.WorkCert) > 0 {
|
||||
result := make([]string, len(putUserDoctorRequest.WorkCert))
|
||||
for i, url := range putUserDoctorRequest.WorkCert {
|
||||
if len(req.WorkCert) > 0 {
|
||||
result := make([]string, len(req.WorkCert))
|
||||
for i, url := range req.WorkCert {
|
||||
result[i] = strings.TrimPrefix(url, config.C.Oss.OssCustomDomainName)
|
||||
}
|
||||
|
||||
@@ -302,12 +302,12 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 处理身份证正面图片
|
||||
if userDoctorInfo.IdCardFront != "" && putUserDoctorRequest.IdCardFront == "" {
|
||||
if userDoctorInfo.IdCardFront != "" && req.IdCardFront == "" {
|
||||
return false, errors.New("未上传新的身份证图片")
|
||||
}
|
||||
|
||||
if putUserDoctorRequest.IdCardFront != "" {
|
||||
idCardFront := strings.Replace(putUserDoctorRequest.IdCardFront, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if req.IdCardFront != "" {
|
||||
idCardFront := strings.Replace(req.IdCardFront, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardFront != userDoctorInfo.IdCardFront {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
@@ -317,11 +317,11 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 身份证背面图片
|
||||
if userDoctorInfo.IdCardBack != "" && putUserDoctorRequest.IdCardBack == "" {
|
||||
if userDoctorInfo.IdCardBack != "" && req.IdCardBack == "" {
|
||||
return false, errors.New("未上传新的身份证图片")
|
||||
}
|
||||
if putUserDoctorRequest.IdCardBack != "" {
|
||||
idCardBack := strings.Replace(putUserDoctorRequest.IdCardBack, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if req.IdCardBack != "" {
|
||||
idCardBack := strings.Replace(req.IdCardBack, "https://img.applets.igandanyiyuan.com", "", 1)
|
||||
if idCardBack != userDoctorInfo.IdCardBack {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
@@ -332,11 +332,11 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 签名图片
|
||||
if userDoctorInfo.SignImage != "" && putUserDoctorRequest.SignImage == "" {
|
||||
if userDoctorInfo.SignImage != "" && req.SignImage == "" {
|
||||
return false, errors.New("未上传新的签名图片")
|
||||
}
|
||||
if putUserDoctorRequest.SignImage != "" {
|
||||
signImage := utils.RemoveOssDomain(putUserDoctorRequest.SignImage)
|
||||
if req.SignImage != "" {
|
||||
signImage := utils.RemoveOssDomain(req.SignImage)
|
||||
if signImage != userDoctorInfo.SignImage {
|
||||
if userDoctor.MultiPointStatus == 2 {
|
||||
return false, errors.New("多点执业审核中,请操作后进行修改")
|
||||
@@ -362,10 +362,10 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 处理专长
|
||||
if len(putUserDoctorRequest.DoctorExpertise) > 0 {
|
||||
if len(req.DoctorExpertise) > 0 {
|
||||
// 检测专长是否存在
|
||||
diseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||
for _, v := range putUserDoctorRequest.DoctorExpertise {
|
||||
for _, v := range req.DoctorExpertise {
|
||||
expertiseId, err := strconv.ParseInt(v, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("专长错误")
|
||||
@@ -395,7 +395,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
}
|
||||
|
||||
// 修改医生详情数据
|
||||
// 处理医生详情数据
|
||||
if userDoctorInfo == nil {
|
||||
// 新增医生详情表
|
||||
if len(userDoctorInfoData) != 0 {
|
||||
@@ -425,7 +425,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 修改专长数据
|
||||
if len(putUserDoctorRequest.DoctorExpertise) > 0 {
|
||||
if len(req.DoctorExpertise) > 0 {
|
||||
doctorExpertiseDao := dao.DoctorExpertiseDao{}
|
||||
|
||||
// 删除原专长
|
||||
@@ -437,7 +437,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
for _, v := range putUserDoctorRequest.DoctorExpertise {
|
||||
for _, v := range req.DoctorExpertise {
|
||||
expertiseId, err := strconv.ParseInt(v, 10, 64)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
@@ -463,7 +463,7 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
profileItem := []tencentIm.ProfileItem{
|
||||
{
|
||||
Tag: "Tag_Profile_IM_Image",
|
||||
Value: putUserDoctorRequest.Avatar,
|
||||
Value: req.Avatar,
|
||||
},
|
||||
}
|
||||
res, err := tencentIm.SetProfile(strconv.FormatInt(userDoctor.UserId, 10), profileItem)
|
||||
@@ -474,8 +474,8 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// 处理签名图片-如果更改,查看是否已添加签章配置,会进行删除
|
||||
if putUserDoctorRequest.SignImage != "" {
|
||||
signImage := utils.RemoveOssDomain(putUserDoctorRequest.SignImage)
|
||||
if req.SignImage != "" {
|
||||
signImage := utils.RemoveOssDomain(req.SignImage)
|
||||
if signImage != userDoctorInfo.SignImage {
|
||||
// 检测是否存在云证书
|
||||
userCaCertDao := dao.UserCaCert{}
|
||||
@@ -519,14 +519,14 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, putUserDoctorRequest r
|
||||
}
|
||||
|
||||
// AddUserDoctor 新增医生
|
||||
func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDoctor) (bool, error) {
|
||||
func (r *UserDoctorService) AddUserDoctor(userId string, req requests.AddUserDoctor) (bool, error) {
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDao := dao.UserDao{}
|
||||
userDoctorInfoDao := dao.UserDoctorInfoDao{}
|
||||
|
||||
// 检测手机号是否重复
|
||||
maps := make(map[string]interface{})
|
||||
maps["mobile"] = a.Mobile
|
||||
maps["mobile"] = req.Mobile
|
||||
users, err := userDao.GetUserList(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("新增失败")
|
||||
@@ -537,14 +537,14 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
}
|
||||
|
||||
// 检测身份证号码
|
||||
res, err := utils.CheckCardNum(a.CardNum)
|
||||
res, err := utils.CheckCardNum(req.CardNum)
|
||||
if !res || err != nil {
|
||||
return false, errors.New("身份证号错误")
|
||||
}
|
||||
|
||||
// 检测身份证号是否重复
|
||||
maps = make(map[string]interface{})
|
||||
maps["card_num"] = a.CardNum
|
||||
maps["card_num"] = req.CardNum
|
||||
userDoctorInfos, err := userDoctorInfoDao.GetUserDoctorInfoList(maps)
|
||||
if err != nil {
|
||||
return false, errors.New("新增失败")
|
||||
@@ -555,25 +555,25 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
}
|
||||
|
||||
// 处理年龄
|
||||
age, err := utils.GetCardAge(a.CardNum)
|
||||
age, err := utils.GetCardAge(req.CardNum)
|
||||
if err != nil {
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 处理性别
|
||||
sex, err := utils.GetCardSex(a.CardNum)
|
||||
sex, err := utils.GetCardSex(req.CardNum)
|
||||
if err != nil {
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 身份证号码脱敏
|
||||
cardNumMask := utils.GetMaskCardNum(a.CardNum)
|
||||
cardNumMask := utils.GetMaskCardNum(req.CardNum)
|
||||
|
||||
// 身份证名称脱敏
|
||||
cardNameMask := utils.GetMaskCardName(a.CardName)
|
||||
cardNameMask := utils.GetMaskCardName(req.CardName)
|
||||
|
||||
// 检测科室
|
||||
departmentCustomId, err := strconv.ParseInt(a.DepartmentCustomId, 10, 64)
|
||||
departmentCustomId, err := strconv.ParseInt(req.DepartmentCustomId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("科室错误")
|
||||
}
|
||||
@@ -586,7 +586,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
}
|
||||
|
||||
// 检测医院
|
||||
hospitalId, err := strconv.ParseInt(a.HospitalId, 10, 64)
|
||||
hospitalId, err := strconv.ParseInt(req.HospitalId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("医院错误")
|
||||
}
|
||||
@@ -599,13 +599,13 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
}
|
||||
|
||||
// 处理头像
|
||||
avatar := utils.RemoveOssDomain(a.Avatar)
|
||||
avatar := utils.RemoveOssDomain(req.Avatar)
|
||||
|
||||
// 处理医师执业证
|
||||
var licenseCert string
|
||||
if len(a.LicenseCert) > 0 {
|
||||
result := make([]string, len(a.LicenseCert))
|
||||
for i, url := range a.LicenseCert {
|
||||
if len(req.LicenseCert) > 0 {
|
||||
result := make([]string, len(req.LicenseCert))
|
||||
for i, url := range req.LicenseCert {
|
||||
result[i] = utils.RemoveOssDomain(url)
|
||||
}
|
||||
|
||||
@@ -614,9 +614,9 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
|
||||
// 处理医师资格证
|
||||
var qualificationCert string
|
||||
if len(a.QualificationCert) > 0 {
|
||||
result := make([]string, len(a.QualificationCert))
|
||||
for i, url := range a.QualificationCert {
|
||||
if len(req.QualificationCert) > 0 {
|
||||
result := make([]string, len(req.QualificationCert))
|
||||
for i, url := range req.QualificationCert {
|
||||
result[i] = utils.RemoveOssDomain(url)
|
||||
}
|
||||
|
||||
@@ -625,9 +625,9 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
|
||||
// 处理医师资格证
|
||||
var workCert string
|
||||
if len(a.WorkCert) > 0 {
|
||||
result := make([]string, len(a.WorkCert))
|
||||
for i, url := range a.WorkCert {
|
||||
if len(req.WorkCert) > 0 {
|
||||
result := make([]string, len(req.WorkCert))
|
||||
for i, url := range req.WorkCert {
|
||||
result[i] = utils.RemoveOssDomain(url)
|
||||
}
|
||||
|
||||
@@ -638,30 +638,30 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
var idCardFront string
|
||||
var idCardBack string
|
||||
|
||||
if a.IdCardFront != "" {
|
||||
idCardFront = utils.RemoveOssDomain(a.IdCardFront)
|
||||
if req.IdCardFront != "" {
|
||||
idCardFront = utils.RemoveOssDomain(req.IdCardFront)
|
||||
}
|
||||
if a.IdCardBack != "" {
|
||||
idCardBack = utils.RemoveOssDomain(a.IdCardBack)
|
||||
if req.IdCardBack != "" {
|
||||
idCardBack = utils.RemoveOssDomain(req.IdCardBack)
|
||||
}
|
||||
|
||||
// 处理签名图片
|
||||
var signImage string
|
||||
if a.SignImage != "" {
|
||||
signImage = utils.RemoveOssDomain(a.SignImage)
|
||||
if req.SignImage != "" {
|
||||
signImage = utils.RemoveOssDomain(req.SignImage)
|
||||
}
|
||||
|
||||
// 多点执业状态
|
||||
var multiPointStatus int
|
||||
if a.IdCardFront != "" && a.IdCardBack != "" && a.SignImage != "" && departmentCustomId != 0 {
|
||||
if req.IdCardFront != "" && req.IdCardBack != "" && req.SignImage != "" && departmentCustomId != 0 {
|
||||
multiPointStatus = 2
|
||||
}
|
||||
|
||||
// 处理专长
|
||||
if len(a.DoctorExpertise) > 0 {
|
||||
if len(req.DoctorExpertise) > 0 {
|
||||
// 检测专长是否存在
|
||||
diseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||
for _, v := range a.DoctorExpertise {
|
||||
for _, v := range req.DoctorExpertise {
|
||||
expertiseId, err := strconv.ParseInt(v, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("专长错误")
|
||||
@@ -675,6 +675,63 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
|
||||
}
|
||||
|
||||
// 处理银行卡省市区
|
||||
areaDao := dao.AreaDao{}
|
||||
var province string
|
||||
if req.BankCardProvinceId != 0 {
|
||||
area, err := areaDao.GetAreaById(req.BankCardProvinceId)
|
||||
if err != nil || area == nil {
|
||||
return false, errors.New("银行卡省份数据错误")
|
||||
}
|
||||
province = area.AreaName
|
||||
}
|
||||
|
||||
var city string
|
||||
if req.BankCardCityId != 0 {
|
||||
area, err := areaDao.GetAreaById(req.BankCardCityId)
|
||||
if err != nil || area == nil {
|
||||
return false, errors.New("银行卡城市数据错误")
|
||||
}
|
||||
city = area.AreaName
|
||||
}
|
||||
|
||||
var county string
|
||||
if req.BankCardCountyId != 0 {
|
||||
area, err := areaDao.GetAreaById(req.BankCardCountyId)
|
||||
if err != nil || area == nil {
|
||||
return false, errors.New("银行卡城市数据错误")
|
||||
}
|
||||
county = area.AreaName
|
||||
}
|
||||
|
||||
// 处理银行卡数据
|
||||
if req.BankId != "" {
|
||||
bankId, err := strconv.ParseInt(req.BankId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("银行错误")
|
||||
}
|
||||
|
||||
basicBankDao := dao.BasicBankDao{}
|
||||
basicBank, err := basicBankDao.GetBasicBankById(bankId)
|
||||
if err != nil || basicBank == nil {
|
||||
return false, errors.New("银行数据错误")
|
||||
}
|
||||
}
|
||||
|
||||
// 处理银行卡号掩码
|
||||
var bankCardCodeMask string
|
||||
if req.BankCardCode != "" {
|
||||
if len(req.BankCardCode) < 8 {
|
||||
return false, errors.New("银行卡号错误")
|
||||
}
|
||||
|
||||
// 获取银行卡号的前4位和后4位
|
||||
start := req.BankCardCode[:4]
|
||||
end := req.BankCardCode[len(req.BankCardCode)-4:]
|
||||
// 拼接前4位、中间的 * 字符串和后4位
|
||||
bankCardCodeMask = start + "****" + end
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@@ -685,9 +742,9 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
|
||||
// 新增用户表数据
|
||||
user := &model.User{
|
||||
UserName: a.CardName,
|
||||
Mobile: a.Mobile,
|
||||
WxMobile: a.Mobile,
|
||||
UserName: req.CardName,
|
||||
Mobile: req.Mobile,
|
||||
WxMobile: req.Mobile,
|
||||
UserType: 2,
|
||||
UserStatus: 1,
|
||||
RegisterMethod: 2,
|
||||
@@ -699,35 +756,34 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
user, err = userDao.AddUser(tx, user)
|
||||
if err != nil || user == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 新增医生表
|
||||
userDoctor := &model.UserDoctor{
|
||||
UserId: user.UserId,
|
||||
UserName: a.CardName,
|
||||
UserName: req.CardName,
|
||||
Status: 1,
|
||||
IdcardStatus: 1, // 身份证默认审核通过
|
||||
IdenAuthStatus: 2,
|
||||
MultiPointStatus: multiPointStatus,
|
||||
IsBindBank: 0,
|
||||
IsRecommend: a.IsRecommend,
|
||||
IsRecommend: req.IsRecommend,
|
||||
Avatar: avatar,
|
||||
DoctorTitle: a.DoctorTitle,
|
||||
DoctorTitle: req.DoctorTitle,
|
||||
DepartmentCustomId: departmentCustomId,
|
||||
DepartmentCustomName: a.DepartmentCustomName,
|
||||
DepartmentCustomMobile: a.DepartmentCustomMobile,
|
||||
DepartmentCustomName: req.DepartmentCustomName,
|
||||
DepartmentCustomMobile: req.DepartmentCustomMobile,
|
||||
HospitalID: hospitalId,
|
||||
IsPlatformDeepCooperation: a.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: a.IsSysDiagnoCooperation,
|
||||
BeGoodAt: a.BeGoodAt,
|
||||
BriefIntroduction: a.BriefIntroduction,
|
||||
IsPlatformDeepCooperation: req.IsPlatformDeepCooperation,
|
||||
IsSysDiagnoCooperation: req.IsSysDiagnoCooperation,
|
||||
BeGoodAt: req.BeGoodAt,
|
||||
BriefIntroduction: req.BriefIntroduction,
|
||||
}
|
||||
|
||||
userDoctor, err = userDoctorDao.AddUserDoctor(tx, userDoctor)
|
||||
if err != nil || userDoctor == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 新增医生详情表
|
||||
@@ -735,9 +791,9 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
UserId: user.UserId,
|
||||
DoctorId: userDoctor.DoctorId,
|
||||
CardType: 1,
|
||||
CardName: a.CardName,
|
||||
CardName: req.CardName,
|
||||
CardNameMask: cardNameMask,
|
||||
CardNum: a.CardNum,
|
||||
CardNum: req.CardNum,
|
||||
CardNumMask: cardNumMask,
|
||||
LicenseCert: licenseCert,
|
||||
QualificationCert: qualificationCert,
|
||||
@@ -746,18 +802,45 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
IdCardBack: idCardBack,
|
||||
SignImage: signImage,
|
||||
}
|
||||
|
||||
userDoctorInfo, err = userDoctorInfoDao.AddUserDoctorInfo(tx, userDoctorInfo)
|
||||
if err != nil || userDoctor == nil {
|
||||
tx.Rollback()
|
||||
return false, err
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 新增医生银行卡表
|
||||
if req.BankCardProvinceId != 0 && req.BankCardCityId != 0 && req.BankCardCountyId != 0 && req.BankId != "" && req.BankCardCode != "" {
|
||||
bankId, err := strconv.ParseInt(req.BankId, 10, 64)
|
||||
if err != nil {
|
||||
return false, errors.New("银行错误")
|
||||
}
|
||||
|
||||
doctorBankCard := &model.DoctorBankCard{
|
||||
DoctorId: userDoctor.DoctorId,
|
||||
BankId: bankId,
|
||||
BankCardCode: req.BankCardCode,
|
||||
BankCardCodeMask: bankCardCodeMask,
|
||||
ProvinceId: req.BankCardProvinceId,
|
||||
Province: province,
|
||||
CityId: req.BankCardCityId,
|
||||
City: city,
|
||||
CountyId: req.BankCardCountyId,
|
||||
County: county,
|
||||
}
|
||||
doctorBankCardDao := dao.DoctorBankCardDao{}
|
||||
|
||||
doctorBankCard, err = doctorBankCardDao.AddDoctorBankCard(tx, doctorBankCard)
|
||||
if err != nil || doctorBankCard == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// 修改专长数据
|
||||
if len(a.DoctorExpertise) > 0 {
|
||||
if len(req.DoctorExpertise) > 0 {
|
||||
doctorExpertiseDao := dao.DoctorExpertiseDao{}
|
||||
|
||||
for _, v := range a.DoctorExpertise {
|
||||
for _, v := range req.DoctorExpertise {
|
||||
expertiseId, err := strconv.ParseInt(v, 10, 64)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
@@ -779,7 +862,7 @@ func (r *UserDoctorService) AddUserDoctor(userId string, a requests.AddUserDocto
|
||||
}
|
||||
|
||||
// 创建im账户
|
||||
res, err = tencentIm.CreateAccount(strconv.FormatInt(userDoctor.UserId, 10), a.CardName, a.Avatar)
|
||||
res, err = tencentIm.CreateAccount(strconv.FormatInt(userDoctor.UserId, 10), req.CardName, req.Avatar)
|
||||
if err != nil || res != true {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user