diff --git a/api/service/userDoctor.go b/api/service/userDoctor.go index f1c13b5..544bde9 100644 --- a/api/service/userDoctor.go +++ b/api/service/userDoctor.go @@ -1718,6 +1718,7 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P userDoctorData := make(map[string]interface{}) // 医生数据 doctorIdenFailDao := dao.DoctorIdenFailDao{} + doctorExpertiseDao := dao.DoctorExpertiseDao{} // 审核不通过 if req.IntroductionStatus == 3 { @@ -1793,6 +1794,40 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P 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资料 if doctorIntroductionRecord.Avatar != "" { userDoctorData["avatar"] = doctorIntroductionRecord.Avatar