1
This commit is contained in:
parent
ba0e4b4b1f
commit
cf016fd42a
@ -2,9 +2,9 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/global"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -23,7 +23,7 @@ type SystemInquiryConfigService struct {
|
||||
}
|
||||
|
||||
// HandleDoctorInquiryConfig 处理医生问诊配置
|
||||
func (r *DoctorInquiryConfigService) HandleDoctorInquiryConfig(doctorId int64, inquiryType, inquiryMode, isEnable, workNumDay int, inquiryPrice float64) (bool, error) {
|
||||
func (r *DoctorInquiryConfigService) HandleDoctorInquiryConfig(tx *gorm.DB, doctorId int64, inquiryType, inquiryMode, isEnable, workNumDay int, inquiryPrice float64) (bool, error) {
|
||||
var err error
|
||||
|
||||
if inquiryType == 4 && inquiryMode == 1 {
|
||||
@ -48,14 +48,6 @@ func (r *DoctorInquiryConfigService) HandleDoctorInquiryConfig(doctorId int64, i
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
tx := global.Db.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
// 获取医生当前问诊配置
|
||||
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||
|
||||
@ -78,7 +70,6 @@ func (r *DoctorInquiryConfigService) HandleDoctorInquiryConfig(doctorId int64, i
|
||||
|
||||
adminUser, _ := doctorInquiryConfigDao.AddDoctorInquiryConfig(tx, m)
|
||||
if adminUser == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("新增失败")
|
||||
}
|
||||
} else {
|
||||
@ -104,7 +95,6 @@ func (r *DoctorInquiryConfigService) HandleDoctorInquiryConfig(doctorId int64, i
|
||||
|
||||
err := doctorInquiryConfigDao.EditDoctorInquiryConfigById(tx, d.InquiryConfigId, data)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("修改失败")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1560,7 +1560,7 @@ func (r *UserDoctorService) PutMulti(doctorId int64, req requests.PutMulti) (boo
|
||||
if req.MultiPointStatus == 1 {
|
||||
// 审核通过后,创建问诊购药问诊配置
|
||||
inquiryConfigService := InquiryConfigService{}
|
||||
_, err = inquiryConfigService.HandleDoctorInquiryConfig(doctorId, 4, 1, 1, 0, 0)
|
||||
_, err = inquiryConfigService.HandleDoctorInquiryConfig(tx, doctorId, 4, 1, 1, 0, 0)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New("审核失败")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user