简介处理医生专场

This commit is contained in:
wucongxing8150 2024-03-27 15:55:46 +08:00
parent 1eeaa3eeb2
commit f6c7dc9c18

View File

@ -1718,6 +1718,7 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
userDoctorData := make(map[string]interface{}) // 医生数据 userDoctorData := make(map[string]interface{}) // 医生数据
doctorIdenFailDao := dao.DoctorIdenFailDao{} doctorIdenFailDao := dao.DoctorIdenFailDao{}
doctorExpertiseDao := dao.DoctorExpertiseDao{}
// 审核不通过 // 审核不通过
if req.IntroductionStatus == 3 { if req.IntroductionStatus == 3 {
@ -1793,6 +1794,40 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
userDoctorData["brief_introduction"] = doctorIntroductionRecord.BriefIntroduction userDoctorData["brief_introduction"] = doctorIntroductionRecord.BriefIntroduction
} }
// 医生专长
if doctorIntroductionRecord.ExpertiseIds != "" {
// 删除医生专长
maps = make(map[string]interface{})
maps["doctor_id"] = doctorId
err = doctorExpertiseDao.DeleteDoctorExpertise(tx, maps)
if err != nil {
tx.Rollback()
return false, errors.New("审核失败")
}
// 新增医生专长
expertiseIds := strings.Split(doctorIntroductionRecord.ExpertiseIds, ",")
for _, id := range expertiseIds {
// 将 id 转换为 int64 类型
expertiseId, err := strconv.ParseInt(id, 10, 64)
if err != nil {
tx.Rollback()
return false, errors.New("审核失败")
}
doctorExpertise := &model.DoctorExpertise{
DoctorId: doctorId,
ExpertiseId: expertiseId,
}
doctorExpertise, err = doctorExpertiseDao.AddDoctorExpertise(tx, doctorExpertise)
if err != nil || doctorExpertise == nil {
tx.Rollback()
return false, errors.New("审核失败")
}
}
}
// 更新医生im资料 // 更新医生im资料
if doctorIntroductionRecord.Avatar != "" { if doctorIntroductionRecord.Avatar != "" {
userDoctorData["avatar"] = doctorIntroductionRecord.Avatar userDoctorData["avatar"] = doctorIntroductionRecord.Avatar