修改了获取医生是否可处方图标展示状态的业务判断
This commit is contained in:
parent
7a1ed10dd8
commit
20e6ca30eb
@ -11,4 +11,5 @@ type Api struct {
|
|||||||
type version1 struct {
|
type version1 struct {
|
||||||
UserDoctor v1.UserDoctor // 角色数据
|
UserDoctor v1.UserDoctor // 角色数据
|
||||||
WeChat v1.WeChat // 微信数据
|
WeChat v1.WeChat // 微信数据
|
||||||
|
Coupon v1.Coupon // 优惠卷数据
|
||||||
}
|
}
|
||||||
|
|||||||
39
api/controller/v1/coupon.go
Normal file
39
api/controller/v1/coupon.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
requestsV1 "hospital-open-api/api/requests/v1"
|
||||||
|
"hospital-open-api/api/responses"
|
||||||
|
serviceV1 "hospital-open-api/api/service/v1"
|
||||||
|
"hospital-open-api/global"
|
||||||
|
"hospital-open-api/utils"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Coupon struct{}
|
||||||
|
|
||||||
|
// GetMultiDoctor 获取多点执业医生详情
|
||||||
|
func (r *Coupon) GetMultiDoctor(c *gin.Context) {
|
||||||
|
userDoctorRequest := requestsV1.UserDoctorRequest{}
|
||||||
|
req := userDoctorRequest.GetMultiDoctor
|
||||||
|
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
userDoctorService := serviceV1.UserDoctorService{}
|
||||||
|
getMultiDoctorResponses, err := userDoctorService.GetMultiDoctor(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getMultiDoctorResponses, c)
|
||||||
|
}
|
||||||
@ -98,6 +98,13 @@ func (r *UserDoctor) GetUserDoctorPage(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userDoctorService := serviceV1.UserDoctorService{}
|
||||||
|
for _, respons := range userDoctor {
|
||||||
|
if len(respons.DoctorInquiryConfig) > 0 {
|
||||||
|
respons.MultiPointStatus, _ = userDoctorService.GetDoctorMultiPointEnable(respons.DoctorInquiryConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
getUserDoctorPageResponses := dtoV1.GetUserDoctorPageListDto(userDoctor)
|
getUserDoctorPageResponses := dtoV1.GetUserDoctorPageListDto(userDoctor)
|
||||||
|
|
||||||
|
|||||||
@ -107,11 +107,8 @@ func privateRouter(r *gin.Engine, api controller.Api) {
|
|||||||
// 优惠卷
|
// 优惠卷
|
||||||
couponGroup := v1Group.Group("/coupon")
|
couponGroup := v1Group.Group("/coupon")
|
||||||
{
|
{
|
||||||
// 查询用户某一优惠卷领取状态
|
|
||||||
couponGroup.GET("", api.V1.UserDoctor.GetDoctor)
|
|
||||||
|
|
||||||
// 领取某一优惠卷
|
// 领取某一优惠卷
|
||||||
couponGroup.POST("", api.V1.UserDoctor.GetDoctor)
|
couponGroup.POST("/receive/:coupon_id", api.V1.Coupon.GetMultiDoctor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package v1
|
|||||||
import (
|
import (
|
||||||
"hospital-open-api/api/dao"
|
"hospital-open-api/api/dao"
|
||||||
dtoV1 "hospital-open-api/api/dto/v1"
|
dtoV1 "hospital-open-api/api/dto/v1"
|
||||||
|
"hospital-open-api/api/model"
|
||||||
requestsV1 "hospital-open-api/api/requests/v1"
|
requestsV1 "hospital-open-api/api/requests/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,6 +20,11 @@ func (r *UserDoctorService) GetDoctor(req requestsV1.GetDoctor) (g *dtoV1.UserDo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(userDoctor.DoctorInquiryConfig) > 0 {
|
||||||
|
// 获取医生是否可处方图标展示状态
|
||||||
|
userDoctor.MultiPointStatus, _ = r.GetDoctorMultiPointEnable(userDoctor.DoctorInquiryConfig)
|
||||||
|
}
|
||||||
|
|
||||||
// 处理返回值
|
// 处理返回值
|
||||||
g = dtoV1.GetDoctorDto(userDoctor)
|
g = dtoV1.GetDoctorDto(userDoctor)
|
||||||
|
|
||||||
@ -59,3 +65,16 @@ func (r *UserDoctorService) GetMultiDoctor(req requestsV1.GetMultiDoctor) (g *dt
|
|||||||
|
|
||||||
return g, nil
|
return g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDoctorMultiPointEnable 获取医生是否可处方图标展示状态
|
||||||
|
func (r *UserDoctorService) GetDoctorMultiPointEnable(m []*model.DoctorInquiryConfig) (int, error) {
|
||||||
|
if len(m) > 0 {
|
||||||
|
for _, config := range m {
|
||||||
|
if config.InquiryType == 4 && config.InquiryMode == 1 && config.IsEnable == 1 {
|
||||||
|
return 1, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user