加载医生专长1
This commit is contained in:
parent
593ecb7db2
commit
5a7b7e0812
@ -115,7 +115,7 @@ type UserDoctorIntroductionDto struct {
|
|||||||
User *UserDto `json:"user"` // 用户
|
User *UserDto `json:"user"` // 用户
|
||||||
Hospital *HospitalDto `json:"hospital"` // 医院
|
Hospital *HospitalDto `json:"hospital"` // 医院
|
||||||
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
UserDoctorInfo *UserDoctorInfoDto `json:"user_doctor_info"` // 医生详情
|
||||||
DoctorExpertise []string `json:"doctor_expertise"` // 医生专长
|
DoctorExpertise []*DiseaseClassExpertiseDto `json:"doctor_expertise"` // 医生专长
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
func GetUserDoctorDto(m *model.UserDoctor) *UserDoctorDto {
|
||||||
|
|||||||
@ -1641,6 +1641,28 @@ func (r *UserDoctorService) GetUserDoctorIntroduction(doctorId int64) (g *dto.Us
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var diseaseClassExpertiseDto []*dto.DiseaseClassExpertiseDto
|
||||||
|
diseaseClassExpertiseDao := dao.DiseaseClassExpertiseDao{}
|
||||||
|
|
||||||
|
if len(expertiseIds) > 0 {
|
||||||
|
for _, id := range expertiseIds {
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
expertiseId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("专长数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
diseaseClassExpertise, err := diseaseClassExpertiseDao.GetDiseaseClassExpertiseById(expertiseId)
|
||||||
|
if err != nil || diseaseClassExpertise == nil {
|
||||||
|
return nil, errors.New("专长数据错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
res := dto.GetDiseaseClassExpertiseDto(diseaseClassExpertise)
|
||||||
|
|
||||||
|
diseaseClassExpertiseDto = append(diseaseClassExpertiseDto, res)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
g = dto.GetUserDoctorIntroductionDto(userDoctor)
|
g = dto.GetUserDoctorIntroductionDto(userDoctor)
|
||||||
|
|
||||||
@ -1663,7 +1685,7 @@ func (r *UserDoctorService) GetUserDoctorIntroduction(doctorId int64) (g *dto.Us
|
|||||||
g.LoadHospital(userDoctor.Hospital)
|
g.LoadHospital(userDoctor.Hospital)
|
||||||
|
|
||||||
// 加载医生专长
|
// 加载医生专长
|
||||||
g.DoctorExpertise = expertiseIds
|
g.DoctorExpertise = diseaseClassExpertiseDto
|
||||||
|
|
||||||
// 加载医生详情
|
// 加载医生详情
|
||||||
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
g.LoadUserDoctorInfo(userDoctor.UserDoctorInfo)
|
||||||
@ -1796,6 +1818,13 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
|
|||||||
|
|
||||||
// 医生专长
|
// 医生专长
|
||||||
if doctorIntroductionRecord.ExpertiseIds != "" {
|
if doctorIntroductionRecord.ExpertiseIds != "" {
|
||||||
|
// 获取医生专长
|
||||||
|
doctorExpertises, err := doctorExpertiseDao.GetDoctorExpertiseListByDoctorId(doctorId)
|
||||||
|
if err != nil {
|
||||||
|
return false, errors.New("审核失败")
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(doctorExpertises) > 0 {
|
||||||
// 删除医生专长
|
// 删除医生专长
|
||||||
maps = make(map[string]interface{})
|
maps = make(map[string]interface{})
|
||||||
maps["doctor_id"] = doctorId
|
maps["doctor_id"] = doctorId
|
||||||
@ -1804,6 +1833,7 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
|
|||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, errors.New("审核失败")
|
return false, errors.New("审核失败")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 新增医生专长
|
// 新增医生专长
|
||||||
expertiseIds := strings.Split(doctorIntroductionRecord.ExpertiseIds, ",")
|
expertiseIds := strings.Split(doctorIntroductionRecord.ExpertiseIds, ",")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user