From f6c7dc9c1834e2261c2e72507c2cbf2d07df935c Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Wed, 27 Mar 2024 15:55:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E4=BB=8B=E5=A4=84=E7=90=86=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E4=B8=93=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/userDoctor.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) 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