医生绑定药房

This commit is contained in:
haomingming
2026-09-07 14:07:00 +08:00
parent 943ee17b2a
commit dc9dee6c98
11 changed files with 646 additions and 0 deletions
+46
View File
@@ -60,6 +60,11 @@ func (r *UserDoctorService) GetUserDoctor(doctorId int64) (getUserDoctorResponse
// 加载医生专长
getUserDoctorResponse.DoctorExpertise = doctorExpertise
// 加载医生药房
doctorPharmacyDao := dao.DoctorPharmacyDao{}
doctorPharmacies, _ := doctorPharmacyDao.GetDoctorPharmacyListByDoctorId(doctorId)
getUserDoctorResponse.DoctorPharmacy = dto.GetDoctorPharmacyListDto(doctorPharmacies)
// 加载医生银行卡
getUserDoctorResponse.LoadDoctorBankCard(doctorBankCard)
@@ -552,6 +557,47 @@ func (r *UserDoctorService) PutUserDoctor(doctorId int64, req requests.PutUserDo
}
}
// 修改药房数据
if len(req.DoctorPharmacy) > 0 {
doctorPharmacyDao := dao.DoctorPharmacyDao{}
// 删除原绑定
maps := make(map[string]interface{})
maps["doctor_id"] = userDoctor.DoctorId
err = doctorPharmacyDao.DeleteDoctorPharmacy(tx, maps)
if err != nil {
tx.Rollback()
return false, errors.New("清空药房绑定失败")
}
for i, v := range req.DoctorPharmacy {
pharmacyId, err := strconv.ParseInt(v, 10, 64)
if err != nil {
tx.Rollback()
return false, errors.New("药房数据错误")
}
isDefault := 0
if i == 0 {
isDefault = 1
}
// 新增药房绑定数据
doctorPharmacy := &model.DoctorPharmacy{
DoctorId: userDoctor.DoctorId,
PharmacyId: pharmacyId,
IsDefault: isDefault,
Status: 1,
}
_, err = doctorPharmacyDao.AddDoctorPharmacy(tx, doctorPharmacy)
if err != nil {
tx.Rollback()
return false, errors.New(err.Error())
}
}
}
// 修改医生银行卡数据-新增
if doctorBankCard == nil {
if provinceId != 0 && cityId != 0 && countyId != 0 && bankId != 0 && bankCardCode != "" {