修改健康包 多点执业的判断
This commit is contained in:
parent
c3bafbb11c
commit
0de58be7ef
@ -81,6 +81,48 @@ func (r *DoctorConfigHealthPackageService) PutDoctorHealth(healthPackageId int64
|
|||||||
return false, errors.New("修改失败")
|
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()
|
tx := global.Db.Begin()
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -188,6 +230,18 @@ func (r *DoctorConfigHealthPackageService) AddDoctorHealth(req requests.AddDocto
|
|||||||
return false, errors.New("医生错误")
|
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{}
|
doctorConfigHealthPackageDao := dao.DoctorConfigHealthPackageDao{}
|
||||||
|
|
||||||
maps := make(map[string]interface{})
|
maps := make(map[string]interface{})
|
||||||
@ -216,6 +270,14 @@ func (r *DoctorConfigHealthPackageService) AddDoctorHealth(req requests.AddDocto
|
|||||||
return false, errors.New("本服务需设置图文问诊的价格,才可开启")
|
return false, errors.New("本服务需设置图文问诊的价格,才可开启")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取医生多点执业状态
|
||||||
|
userDoctorService := UserDoctorService{}
|
||||||
|
|
||||||
|
multiPointStatus, _ := userDoctorService.GetDoctorMultiPointEnable(userDoctor.DoctorId)
|
||||||
|
if multiPointStatus == 0 {
|
||||||
|
return false, errors.New("该医生未开启多点执业")
|
||||||
|
}
|
||||||
|
|
||||||
// 价格计算
|
// 价格计算
|
||||||
// 重新价格计算(专家图文问诊价格*费率+30盒35元的干爽颗粒)
|
// 重新价格计算(专家图文问诊价格*费率+30盒35元的干爽颗粒)
|
||||||
serviceRate, err := strconv.ParseFloat(healthPackage.ServiceRate, 64)
|
serviceRate, err := strconv.ParseFloat(healthPackage.ServiceRate, 64)
|
||||||
|
|||||||
@ -1925,3 +1925,29 @@ func (r *UserDoctorService) PutDoctorIntroduction(doctorId int64, req requests.P
|
|||||||
|
|
||||||
return true, nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -58,52 +58,6 @@ func getRequestUrlParams(userId string) (bool, string) {
|
|||||||
return true, queryString
|
return true, queryString
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// // 统一请求
|
|
||||||
// func postRequest(url string, requestBody []byte) (map[string]interface{}, error) {
|
|
||||||
// responseMap := make(map[string]interface{})
|
|
||||||
//
|
|
||||||
// // 发起 POST 请求
|
|
||||||
// resp, err := http.Post(url, "application/json", bytes.NewBuffer(requestBody))
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// defer func(Body io.ReadCloser) {
|
|
||||||
// _ = Body.Close()
|
|
||||||
// }(resp.Body)
|
|
||||||
//
|
|
||||||
// body, err := io.ReadAll(resp.Body)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// err = json.Unmarshal([]byte(string(body)), &responseMap)
|
|
||||||
// if err != nil {
|
|
||||||
// // json解析失败
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if responseMap == nil {
|
|
||||||
// return nil, errors.New("请求im失败")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if _, ok := responseMap["ErrorCode"]; ok {
|
|
||||||
// errorCode := responseMap["ErrorCode"].(int)
|
|
||||||
// if errorCode != 0 {
|
|
||||||
// if errorInfo, ok := responseMap["ErrorInfo"].(string); ok {
|
|
||||||
// return nil, errors.New(errorInfo)
|
|
||||||
// } else {
|
|
||||||
// return nil, errors.New("请求im失败")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// return nil, errors.New("请求im失败")
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return responseMap, nil
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 统一请求
|
// 统一请求
|
||||||
func postRequest(url string, requestBody []byte) (*responseData, error) {
|
func postRequest(url string, requestBody []byte) (*responseData, error) {
|
||||||
var responseData responseData
|
var responseData responseData
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user