修改健康包 多点执业的判断
This commit is contained in:
@@ -81,6 +81,48 @@ func (r *DoctorConfigHealthPackageService) PutDoctorHealth(healthPackageId int64
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
// 获取医生数据
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorConfigHealthPackage.DoctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
|
||||
if userDoctor.IdcardStatus != 1 {
|
||||
return false, errors.New("该医生未进行实名认证")
|
||||
}
|
||||
|
||||
if userDoctor.IdenAuthStatus != 1 {
|
||||
return false, errors.New("该医生未进行身份认证")
|
||||
}
|
||||
|
||||
if userDoctor.IsBindBank != 1 {
|
||||
return false, errors.New("该医生未绑定结算银行卡")
|
||||
}
|
||||
|
||||
// 开启
|
||||
if req.IsEnable == 1 {
|
||||
// 获取医生多点执业状态
|
||||
userDoctorService := UserDoctorService{}
|
||||
|
||||
multiPointStatus, _ := userDoctorService.GetDoctorMultiPointEnable(userDoctor.DoctorId)
|
||||
if multiPointStatus == 0 {
|
||||
return false, errors.New("该医生未开启多点执业")
|
||||
}
|
||||
|
||||
// 获取专家图文问诊价格
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = userDoctor.DoctorId
|
||||
maps["inquiry_type"] = 1
|
||||
maps["inquiry_mode"] = 1
|
||||
|
||||
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||
_, err := doctorInquiryConfigDao.GetDoctorInquiryConfig(maps)
|
||||
if err != nil && req.IsEnable == 1 {
|
||||
return false, errors.New("本服务需设置图文问诊的价格,才可开启")
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
@@ -188,6 +230,18 @@ func (r *DoctorConfigHealthPackageService) AddDoctorHealth(req requests.AddDocto
|
||||
return false, errors.New("医生错误")
|
||||
}
|
||||
|
||||
if userDoctor.IdcardStatus != 1 {
|
||||
return false, errors.New("该医生未进行实名认证")
|
||||
}
|
||||
|
||||
if userDoctor.IdenAuthStatus != 1 {
|
||||
return false, errors.New("该医生未进行身份认证")
|
||||
}
|
||||
|
||||
if userDoctor.IsBindBank != 1 {
|
||||
return false, errors.New("该医生未绑定结算银行卡")
|
||||
}
|
||||
|
||||
doctorConfigHealthPackageDao := dao.DoctorConfigHealthPackageDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
@@ -216,6 +270,14 @@ func (r *DoctorConfigHealthPackageService) AddDoctorHealth(req requests.AddDocto
|
||||
return false, errors.New("本服务需设置图文问诊的价格,才可开启")
|
||||
}
|
||||
|
||||
// 获取医生多点执业状态
|
||||
userDoctorService := UserDoctorService{}
|
||||
|
||||
multiPointStatus, _ := userDoctorService.GetDoctorMultiPointEnable(userDoctor.DoctorId)
|
||||
if multiPointStatus == 0 {
|
||||
return false, errors.New("该医生未开启多点执业")
|
||||
}
|
||||
|
||||
// 价格计算
|
||||
// 重新价格计算(专家图文问诊价格*费率+30盒35元的干爽颗粒)
|
||||
serviceRate, err := strconv.ParseFloat(healthPackage.ServiceRate, 64)
|
||||
|
||||
@@ -1925,3 +1925,29 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// GetDoctorMultiPointEnable 获取医生多点执业状态
|
||||
func (r *UserDoctorService) GetDoctorMultiPointEnable(doctorId int64) (int, error) {
|
||||
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||
userDoctorDao := dao.UserDoctorDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
maps["doctor_id"] = doctorId
|
||||
maps["inquiry_type"] = 4
|
||||
maps["inquiry_mode"] = 1
|
||||
doctorInquiryConfig, err := doctorInquiryConfigDao.GetDoctorInquiryConfig(maps)
|
||||
if err != nil || doctorInquiryConfig == nil {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
userDoctor, err := userDoctorDao.GetUserDoctorById(doctorId)
|
||||
if err != nil || userDoctor == nil {
|
||||
return 0, errors.New("医生数据错误")
|
||||
}
|
||||
|
||||
if doctorInquiryConfig.IsEnable == 1 && userDoctor.MultiPointStatus == 1 {
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user