新增 医生账户详情
This commit is contained in:
@@ -29,6 +29,7 @@ type sysSetting struct {
|
||||
// 医生管理
|
||||
type userDoctorManage struct {
|
||||
UserDoctor // 医生列表
|
||||
DoctorAccount
|
||||
}
|
||||
|
||||
// Basic 基础数据
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"hospital-admin-api/api/dao"
|
||||
"hospital-admin-api/api/dto"
|
||||
"hospital-admin-api/api/requests"
|
||||
"hospital-admin-api/api/responses"
|
||||
"hospital-admin-api/api/service"
|
||||
"hospital-admin-api/global"
|
||||
"hospital-admin-api/utils"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type DoctorAccount struct{}
|
||||
|
||||
// GetDoctorAccountPage 获取医生账户列表-分页
|
||||
func (r *DoctorAccount) GetDoctorAccountPage(c *gin.Context) {
|
||||
doctorAccountRequest := requests.DoctorAccountRequest{}
|
||||
req := doctorAccountRequest.GetDoctorAccountPage
|
||||
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
|
||||
}
|
||||
|
||||
if req.Page == 0 {
|
||||
req.Page = 1
|
||||
}
|
||||
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 20
|
||||
}
|
||||
|
||||
doctorAccountDao := dao.DoctorAccountDao{}
|
||||
doctorAccount, total, err := doctorAccountDao.GetDoctorAccountPage(req, req.Page, req.PageSize)
|
||||
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 处理返回值
|
||||
res := dto.GetDoctorAccountListDto(doctorAccount)
|
||||
|
||||
result := make(map[string]interface{})
|
||||
result["page"] = req.Page
|
||||
result["page_size"] = req.PageSize
|
||||
result["total"] = total
|
||||
result["data"] = res
|
||||
responses.OkWithData(result, c)
|
||||
}
|
||||
|
||||
// GetDoctorAccount 医生账户详情
|
||||
func (r *DoctorAccount) GetDoctorAccount(c *gin.Context) {
|
||||
id := c.Param("doctor_id")
|
||||
if id == "" {
|
||||
responses.FailWithMessage("缺少参数", c)
|
||||
return
|
||||
}
|
||||
|
||||
// 将 id 转换为 int64 类型
|
||||
doctorId, err := strconv.ParseInt(id, 10, 64)
|
||||
if err != nil {
|
||||
responses.Fail(c)
|
||||
return
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
doctorAccountService := service.DoctorAccountService{}
|
||||
res, err := doctorAccountService.GetDoctorAccount(doctorId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
responses.OkWithData(res, c)
|
||||
}
|
||||
@@ -72,7 +72,7 @@ func (r *DoctorWithdrawal) GetDoctorWithdrawal(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
doctorWithdrawaService := service.DoctorWithdrawaService{}
|
||||
doctorWithdrawaService := service.DoctorWithdrawalService{}
|
||||
res, err := doctorWithdrawaService.GetDoctorWithdrawal(withdrawalId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
@@ -152,7 +152,7 @@ func (r *DoctorWithdrawal) PutDoctorWithdrawalIncome(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 业务处理
|
||||
doctorWithdrawaService := service.DoctorWithdrawaService{}
|
||||
doctorWithdrawaService := service.DoctorWithdrawalService{}
|
||||
_, err = doctorWithdrawaService.PutDoctorWithdrawalIncome(req, withdrawalId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
@@ -194,7 +194,7 @@ func (r *DoctorWithdrawal) PutDoctorWithdrawalExamine(c *gin.Context) {
|
||||
adminUserId := c.GetInt64("UserId")
|
||||
|
||||
// 业务处理
|
||||
doctorWithdrawaService := service.DoctorWithdrawaService{}
|
||||
doctorWithdrawaService := service.DoctorWithdrawalService{}
|
||||
_, err = doctorWithdrawaService.PutDoctorWithdrawalExamine(req, withdrawalId, adminUserId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
@@ -223,7 +223,7 @@ func (r *DoctorWithdrawal) PutDoctorWithdrawalPayment(c *gin.Context) {
|
||||
adminUserId := c.GetInt64("UserId")
|
||||
|
||||
// 业务处理
|
||||
doctorWithdrawaService := service.DoctorWithdrawaService{}
|
||||
doctorWithdrawaService := service.DoctorWithdrawalService{}
|
||||
_, err = doctorWithdrawaService.PutDoctorWithdrawalPayment(withdrawalId, adminUserId)
|
||||
if err != nil {
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
|
||||
Reference in New Issue
Block a user