Merge branch 'dev'
This commit is contained in:
commit
d9d0ab1df6
@ -6,22 +6,25 @@ import (
|
|||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
|
"hospital-admin-api/api/service"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Area struct{}
|
type Area struct{}
|
||||||
|
|
||||||
// GetAreaList 获取地区列表
|
// GetAreaList 获取地区列表
|
||||||
func (b *Area) GetAreaList(c *gin.Context) {
|
func (b *Area) GetAreaList(c *gin.Context) {
|
||||||
req := requests.AreaRequest{}
|
areaRequest := requests.AreaRequest{}
|
||||||
if err := c.ShouldBind(&req.GetAreaList); err != nil {
|
req := areaRequest.GetAreaList
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(req.GetAreaList); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -33,7 +36,7 @@ func (b *Area) GetAreaList(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
areaDao := dao.AreaDao{}
|
areaDao := dao.AreaDao{}
|
||||||
area, err := areaDao.GetAreaListByStruct(req.GetAreaList)
|
area, err := areaDao.GetAreaListByStruct(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.Ok(c)
|
responses.Ok(c)
|
||||||
return
|
return
|
||||||
@ -43,3 +46,67 @@ func (b *Area) GetAreaList(c *gin.Context) {
|
|||||||
r := dto.GetAreaListDto(area)
|
r := dto.GetAreaListDto(area)
|
||||||
responses.OkWithData(r, c)
|
responses.OkWithData(r, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddArea 新增地区
|
||||||
|
func (r *Area) AddArea(c *gin.Context) {
|
||||||
|
areaRequest := requests.AreaRequest{}
|
||||||
|
req := areaRequest.AddArea
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
areaService := service.AreaService{}
|
||||||
|
_, areaId, err := areaService.AddArea(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(areaId, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutArea 修改地区
|
||||||
|
func (r *Area) PutArea(c *gin.Context) {
|
||||||
|
areaRequest := requests.AreaRequest{}
|
||||||
|
req := areaRequest.PutArea
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("area_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
areaId, err := strconv.Atoi(id)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
areaService := service.AreaService{}
|
||||||
|
_, err = areaService.PutArea(areaId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|||||||
@ -16,6 +16,8 @@ type Api struct {
|
|||||||
financeManage // 财务管理
|
financeManage // 财务管理
|
||||||
exportManage // 导出管理
|
exportManage // 导出管理
|
||||||
productManage // 商品管理
|
productManage // 商品管理
|
||||||
|
couponManage // 优惠卷管理
|
||||||
|
basicManage // 基础数据管理
|
||||||
}
|
}
|
||||||
|
|
||||||
// SysSetting 系统设置
|
// SysSetting 系统设置
|
||||||
@ -40,14 +42,14 @@ type basic struct {
|
|||||||
Hospital // 医院管理
|
Hospital // 医院管理
|
||||||
DiseaseClassExpertise // 专长管理
|
DiseaseClassExpertise // 专长管理
|
||||||
Bank // 银行管理
|
Bank // 银行管理
|
||||||
Area // 省市区管理
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单管理
|
// 订单管理
|
||||||
type order struct {
|
type order struct {
|
||||||
Order // 订单
|
Order // 订单
|
||||||
OrderInquiry // 问诊订单
|
OrderInquiry // 问诊订单
|
||||||
OrderProduct // 药品订单
|
OrderProduct // 药品订单
|
||||||
|
OrderServicePackage // 服务包订单
|
||||||
}
|
}
|
||||||
|
|
||||||
// 患者管理
|
// 患者管理
|
||||||
@ -68,7 +70,10 @@ type orderPrescriptionManage struct {
|
|||||||
|
|
||||||
// 问诊管理
|
// 问诊管理
|
||||||
type inquiryManage struct {
|
type inquiryManage struct {
|
||||||
InquiryConfig // 问诊配置
|
InquiryConfig // 问诊配置
|
||||||
|
HealthPackage // 系统健康包配置
|
||||||
|
DoctorConfigHealthPackage // 医生健康包配置
|
||||||
|
DoctorConfigFollowPackage // 医生随访包配置
|
||||||
}
|
}
|
||||||
|
|
||||||
// ca管理
|
// ca管理
|
||||||
@ -90,3 +95,13 @@ type exportManage struct {
|
|||||||
type productManage struct {
|
type productManage struct {
|
||||||
Product
|
Product
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 优惠卷管理
|
||||||
|
type couponManage struct {
|
||||||
|
Coupon
|
||||||
|
}
|
||||||
|
|
||||||
|
// 基础数据管理
|
||||||
|
type basicManage struct {
|
||||||
|
Basic
|
||||||
|
}
|
||||||
|
|||||||
@ -1 +1,5 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
|
type Basic struct {
|
||||||
|
Area // 省市区
|
||||||
|
}
|
||||||
|
|||||||
281
api/controller/coupon.go
Normal file
281
api/controller/coupon.go
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
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 Coupon struct{}
|
||||||
|
|
||||||
|
// GetSystemCouponPage 获取系统优惠卷列表-分页
|
||||||
|
func (r *Coupon) GetSystemCouponPage(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.GetSystemCouponPage
|
||||||
|
if err := c.ShouldBindJSON(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
couponDao := dao.CouponDao{}
|
||||||
|
coupon, total, err := couponDao.GetCouponPageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
GetProductPlatformPageResponses := dto.GetCouponListDto(coupon)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = GetProductPlatformPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSystemCoupon 系统优惠卷详情
|
||||||
|
func (r *Coupon) GetSystemCoupon(c *gin.Context) {
|
||||||
|
id := c.Param("coupon_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
couponId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
couponService := service.CouponService{}
|
||||||
|
getSystemCouponResponses, err := couponService.GetSystemCoupon(couponId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getSystemCouponResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddSystemCoupon 新增系统优惠卷
|
||||||
|
func (r *Coupon) AddSystemCoupon(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.AddSystemCoupon
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
couponService := service.CouponService{}
|
||||||
|
_, err := couponService.AddSystemCoupon(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutSystemCoupon 修改系统优惠卷
|
||||||
|
func (r *Coupon) PutSystemCoupon(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.PutSystemCoupon
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("coupon_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
couponId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
couponService := service.CouponService{}
|
||||||
|
_, err = couponService.PutSystemCoupon(couponId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutSystemCouponStatus 修改系统优惠卷状态
|
||||||
|
func (r *Coupon) PutSystemCouponStatus(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.PutSystemCouponStatus
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("coupon_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
couponId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
couponService := service.CouponService{}
|
||||||
|
_, err = couponService.PutSystemCouponStatus(couponId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserCouponPage 获取用户优惠卷列表-分页
|
||||||
|
func (r *Coupon) GetUserCouponPage(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.GetUserCouponPage
|
||||||
|
if err := c.ShouldBindJSON(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
userCouponDao := dao.UserCouponDao{}
|
||||||
|
userCoupon, total, err := userCouponDao.GetUserCouponPageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
GetProductPlatformPageResponses := dto.GetUserCouponListDto(userCoupon)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = GetProductPlatformPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantSystemCoupon 发放系统优惠卷
|
||||||
|
func (r *Coupon) GrantSystemCoupon(c *gin.Context) {
|
||||||
|
couponRequest := requests.CouponRequest{}
|
||||||
|
req := couponRequest.GrantSystemCoupon
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("coupon_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
couponId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前登陆用户id
|
||||||
|
userId := c.GetInt64("UserId")
|
||||||
|
if userId == 0 {
|
||||||
|
responses.FailWithMessage("角色错误", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
couponService := service.CouponService{}
|
||||||
|
_, err = couponService.GrantSystemCoupon(couponId, userId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
159
api/controller/doctorConfigFollowPackage.go
Normal file
159
api/controller/doctorConfigFollowPackage.go
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
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 DoctorConfigFollowPackage struct{}
|
||||||
|
|
||||||
|
// GetDoctorFollowPage 获取开启随访包服务的医生-分页
|
||||||
|
func (r *DoctorConfigFollowPackage) GetDoctorFollowPage(c *gin.Context) {
|
||||||
|
DoctorConfigFollowPackageRequest := requests.DoctorConfigFollowPackageRequest{}
|
||||||
|
req := DoctorConfigFollowPackageRequest.GetDoctorFollowPage
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
doctorConfigFollowPackageDao := dao.DoctorConfigFollowPackageDao{}
|
||||||
|
DoctorConfigFollowPackage, total, err := doctorConfigFollowPackageDao.GetDoctorFollowPageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
res := dto.GetDoctorConfigFollowPackageListDto(DoctorConfigFollowPackage)
|
||||||
|
|
||||||
|
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||||
|
for _, v := range res {
|
||||||
|
maps := make(map[string]interface{})
|
||||||
|
maps["doctor_id"] = v.DoctorId
|
||||||
|
maps["inquiry_type"] = 1
|
||||||
|
maps["inquiry_mode"] = 9
|
||||||
|
doctorInquiryConfig, _ := doctorInquiryConfigDao.GetDoctorInquiryConfig(maps)
|
||||||
|
if doctorInquiryConfig != nil {
|
||||||
|
v.LoadDoctorInquiryConfig(doctorInquiryConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = res
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorFollow 医生随访包配置详情
|
||||||
|
func (r *DoctorConfigFollowPackage) GetDoctorFollow(c *gin.Context) {
|
||||||
|
id := c.Param("follow_package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
followPackageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
DoctorConfigFollowPackageService := service.DoctorConfigFollowPackageService{}
|
||||||
|
getUserDoctorResponses, err := DoctorConfigFollowPackageService.GetDoctorFollow(followPackageId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getUserDoctorResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutDoctorFollow 修改医生随访包配置
|
||||||
|
func (r *DoctorConfigFollowPackage) PutDoctorFollow(c *gin.Context) {
|
||||||
|
DoctorConfigFollowPackageRequest := requests.DoctorConfigFollowPackageRequest{}
|
||||||
|
req := DoctorConfigFollowPackageRequest.PutDoctorFollow
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("follow_package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
followPackageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
DoctorConfigFollowPackageService := service.DoctorConfigFollowPackageService{}
|
||||||
|
_, err = DoctorConfigFollowPackageService.PutDoctorFollow(followPackageId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorFollow 新增医生随访包配置
|
||||||
|
func (r *DoctorConfigFollowPackage) AddDoctorFollow(c *gin.Context) {
|
||||||
|
DoctorConfigFollowPackageRequest := requests.DoctorConfigFollowPackageRequest{}
|
||||||
|
req := DoctorConfigFollowPackageRequest.AddDoctorFollow
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
DoctorConfigFollowPackageService := service.DoctorConfigFollowPackageService{}
|
||||||
|
_, err := DoctorConfigFollowPackageService.AddDoctorFollow(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
159
api/controller/doctorConfigHealthPackage.go
Normal file
159
api/controller/doctorConfigHealthPackage.go
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
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 DoctorConfigHealthPackage struct{}
|
||||||
|
|
||||||
|
// GetDoctorHealthPage 获取开启健康包服务的医生-分页
|
||||||
|
func (r *DoctorConfigHealthPackage) GetDoctorHealthPage(c *gin.Context) {
|
||||||
|
doctorConfigHealthPackageRequest := requests.DoctorConfigHealthPackageRequest{}
|
||||||
|
req := doctorConfigHealthPackageRequest.GetDoctorHealthPage
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
doctorConfigHealthPackageDao := dao.DoctorConfigHealthPackageDao{}
|
||||||
|
doctorConfigHealthPackage, total, err := doctorConfigHealthPackageDao.GetDoctorHealthPageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
res := dto.GetDoctorConfigHealthPackageListDto(doctorConfigHealthPackage)
|
||||||
|
|
||||||
|
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||||
|
for _, v := range res {
|
||||||
|
maps := make(map[string]interface{})
|
||||||
|
maps["doctor_id"] = v.DoctorId
|
||||||
|
maps["inquiry_type"] = 1
|
||||||
|
maps["inquiry_mode"] = 8
|
||||||
|
doctorInquiryConfig, _ := doctorInquiryConfigDao.GetDoctorInquiryConfig(maps)
|
||||||
|
if doctorInquiryConfig != nil {
|
||||||
|
v.LoadDoctorInquiryConfig(doctorInquiryConfig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = res
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorHealth 医生健康包配置详情
|
||||||
|
func (r *DoctorConfigHealthPackage) GetDoctorHealth(c *gin.Context) {
|
||||||
|
id := c.Param("health_package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
healthPackageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
doctorConfigHealthPackageService := service.DoctorConfigHealthPackageService{}
|
||||||
|
getUserDoctorResponses, err := doctorConfigHealthPackageService.GetDoctorHealth(healthPackageId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getUserDoctorResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutDoctorHealth 修改医生健康包配置
|
||||||
|
func (r *DoctorConfigHealthPackage) PutDoctorHealth(c *gin.Context) {
|
||||||
|
doctorConfigHealthPackageRequest := requests.DoctorConfigHealthPackageRequest{}
|
||||||
|
req := doctorConfigHealthPackageRequest.PutDoctorHealth
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("health_package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
healthPackageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
doctorConfigHealthPackageService := service.DoctorConfigHealthPackageService{}
|
||||||
|
_, err = doctorConfigHealthPackageService.PutDoctorHealth(healthPackageId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorHealth 新增医生健康包配置
|
||||||
|
func (r *DoctorConfigHealthPackage) AddDoctorHealth(c *gin.Context) {
|
||||||
|
doctorConfigHealthPackageRequest := requests.DoctorConfigHealthPackageRequest{}
|
||||||
|
req := doctorConfigHealthPackageRequest.AddDoctorHealth
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
doctorConfigHealthPackageService := service.DoctorConfigHealthPackageService{}
|
||||||
|
_, err := doctorConfigHealthPackageService.AddDoctorHealth(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
@ -546,3 +546,100 @@ func (r *Export) OrderPrescription(c *gin.Context) {
|
|||||||
|
|
||||||
responses.OkWithData(ossAddress, c)
|
responses.OkWithData(ossAddress, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Product 系统药品
|
||||||
|
func (r *Export) Product(c *gin.Context) {
|
||||||
|
productRequest := requests.ProductRequest{}
|
||||||
|
req := productRequest.ProductExportList
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取数据
|
||||||
|
productDao := dao.ProductDao{}
|
||||||
|
products, err := productDao.GetProductExportListSearch(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
exportService := service.ExportService{}
|
||||||
|
ossAddress, err := exportService.Product(products)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前登陆用户id
|
||||||
|
userId := c.GetInt64("UserId")
|
||||||
|
if userId != 0 {
|
||||||
|
// 记录日志
|
||||||
|
logExport := &model.LogExport{
|
||||||
|
AdminUserId: userId,
|
||||||
|
ExportModule: "处方",
|
||||||
|
ExportFile: utils.RemoveOssDomain(ossAddress),
|
||||||
|
}
|
||||||
|
|
||||||
|
logExportDao := dao.LogExportDao{}
|
||||||
|
_, _ = logExportDao.AddLogExportUnTransaction(logExport)
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(ossAddress, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderService 服务包订单
|
||||||
|
func (r *Export) OrderService(c *gin.Context) {
|
||||||
|
orderServicePackageRequest := requests.OrderServicePackageRequest{}
|
||||||
|
req := orderServicePackageRequest.OrderServicePackageExportList
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取数据
|
||||||
|
orderServicePackageDao := dao.OrderServicePackageDao{}
|
||||||
|
orderServicePackage, err := orderServicePackageDao.GetOrderServicePackageExportListSearch(req)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
exportService := service.ExportService{}
|
||||||
|
ossAddress, err := exportService.OrderServicePackage(orderServicePackage)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前登陆用户id
|
||||||
|
userId := c.GetInt64("UserId")
|
||||||
|
if userId != 0 {
|
||||||
|
// 记录日志
|
||||||
|
logExport := &model.LogExport{
|
||||||
|
AdminUserId: userId,
|
||||||
|
ExportModule: "服务包订单",
|
||||||
|
ExportFile: utils.RemoveOssDomain(ossAddress),
|
||||||
|
}
|
||||||
|
|
||||||
|
logExportDao := dao.LogExportDao{}
|
||||||
|
_, _ = logExportDao.AddLogExportUnTransaction(logExport)
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(ossAddress, c)
|
||||||
|
}
|
||||||
|
|||||||
180
api/controller/healthPackage.go
Normal file
180
api/controller/healthPackage.go
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
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 HealthPackage struct{}
|
||||||
|
|
||||||
|
// GetHealthPackagePage 获取健康包列表-分页
|
||||||
|
func (r *HealthPackage) GetHealthPackagePage(c *gin.Context) {
|
||||||
|
healthPackageRequest := requests.HealthPackageRequest{}
|
||||||
|
req := healthPackageRequest.GetHealthPackagePage
|
||||||
|
if err := c.ShouldBindJSON(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
healthPackageDao := dao.HealthPackageDao{}
|
||||||
|
healthPackage, total, err := healthPackageDao.GetHealthPackagePageSearch(req, req.Page, req.PageSize)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
res := dto.GetHealthPackageListDto(healthPackage)
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = res
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageList 获取健康包列表-限制条数
|
||||||
|
func (r *HealthPackage) GetHealthPackageList(c *gin.Context) {
|
||||||
|
healthPackageRequest := requests.HealthPackageRequest{}
|
||||||
|
req := healthPackageRequest.GetHealthPackageList
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
healthPackageDao := dao.HealthPackageDao{}
|
||||||
|
healthPackage, err := healthPackageDao.GetHealthPackageListSearch(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
getHealthPackageListResponses := dto.GetHealthPackageListDto(healthPackage)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getHealthPackageListResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackage 获取健康包详情
|
||||||
|
func (r *HealthPackage) GetHealthPackage(c *gin.Context) {
|
||||||
|
id := c.Param("package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
packageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
healthPackageService := service.HealthPackageService{}
|
||||||
|
getResponses, err := healthPackageService.GetHealthPackage(packageId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutHealthPackage 修改健康包
|
||||||
|
func (r *HealthPackage) PutHealthPackage(c *gin.Context) {
|
||||||
|
healthPackageRequest := requests.HealthPackageRequest{}
|
||||||
|
req := healthPackageRequest.PutHealthPackage
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("package_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
packageId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
healthPackageService := service.HealthPackageService{}
|
||||||
|
_, err = healthPackageService.PutHealthPackage(packageId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHealthPackage 新增健康包
|
||||||
|
func (r *HealthPackage) AddHealthPackage(c *gin.Context) {
|
||||||
|
healthPackageRequest := requests.HealthPackageRequest{}
|
||||||
|
req := healthPackageRequest.AddHealthPackage
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
healthPackageService := service.HealthPackageService{}
|
||||||
|
_, err := healthPackageService.AddHealthPackage(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
@ -7,28 +7,31 @@ import (
|
|||||||
"hospital-admin-api/api/dto"
|
"hospital-admin-api/api/dto"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/api/responses"
|
"hospital-admin-api/api/responses"
|
||||||
|
"hospital-admin-api/api/service"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Hospital struct{}
|
type Hospital struct{}
|
||||||
|
|
||||||
// GetHospitalLimit 获取医院列表-限制条数
|
// GetHospitalList 获取医院列表
|
||||||
func (b *Hospital) GetHospitalLimit(c *gin.Context) {
|
func (b *Hospital) GetHospitalList(c *gin.Context) {
|
||||||
hospitalRequest := requests.HospitalRequest{}
|
hospitalRequest := requests.HospitalRequest{}
|
||||||
if err := c.ShouldBind(&hospitalRequest.GetHospitalLimit); err != nil {
|
req := hospitalRequest.GetHospitalList
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(hospitalRequest.GetHospitalLimit); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
hospitalDao := dao.Hospital{}
|
hospitalDao := dao.HospitalDao{}
|
||||||
hospitals, err := hospitalDao.GetHospitalLimitByMaps(hospitalRequest.GetHospitalLimit)
|
hospitals, err := hospitalDao.GetHospitalLimitByMaps(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.Ok(c)
|
responses.Ok(c)
|
||||||
return
|
return
|
||||||
@ -38,3 +41,134 @@ func (b *Hospital) GetHospitalLimit(c *gin.Context) {
|
|||||||
getHospitalLimitResponse := dto.GetHospitalListDto(hospitals)
|
getHospitalLimitResponse := dto.GetHospitalListDto(hospitals)
|
||||||
responses.OkWithData(getHospitalLimitResponse, c)
|
responses.OkWithData(getHospitalLimitResponse, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetHospitalPage 获取医院列表-分页
|
||||||
|
func (r *Hospital) GetHospitalPage(c *gin.Context) {
|
||||||
|
hospitalRequest := requests.HospitalRequest{}
|
||||||
|
req := hospitalRequest.GetHospitalPage
|
||||||
|
if err := c.ShouldBindJSON(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
hospitalDao := dao.HospitalDao{}
|
||||||
|
hospital, total, err := hospitalDao.GetHospitalPageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
GetHospitalPageResponses := dto.GetHospitalListDto(hospital)
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = GetHospitalPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHospital 新增医院
|
||||||
|
func (r *Hospital) AddHospital(c *gin.Context) {
|
||||||
|
hospitalRequest := requests.HospitalRequest{}
|
||||||
|
req := hospitalRequest.AddHospital
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
hospitalService := service.HospitalService{}
|
||||||
|
_, err := hospitalService.AddHospital(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutHospital 修改医院
|
||||||
|
func (r *Hospital) PutHospital(c *gin.Context) {
|
||||||
|
hospitalRequest := requests.HospitalRequest{}
|
||||||
|
req := hospitalRequest.PutHospital
|
||||||
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数验证
|
||||||
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
id := c.Param("hospital_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
hospitalId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
hospitalService := service.HospitalService{}
|
||||||
|
_, err = hospitalService.PutHospital(hospitalId, req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHospital 医院详情
|
||||||
|
func (r *Hospital) GetHospital(c *gin.Context) {
|
||||||
|
id := c.Param("hospital_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
hospitalId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
hospitalService := service.HospitalService{}
|
||||||
|
getHospitalResponses, err := hospitalService.GetHospital(hospitalId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getHospitalResponses, c)
|
||||||
|
}
|
||||||
|
|||||||
@ -17,28 +17,29 @@ type InquiryConfig struct{}
|
|||||||
|
|
||||||
// GetDoctorInquiryConfigPage 获取开启问诊配置医生列表-分页
|
// GetDoctorInquiryConfigPage 获取开启问诊配置医生列表-分页
|
||||||
func (r *InquiryConfig) GetDoctorInquiryConfigPage(c *gin.Context) {
|
func (r *InquiryConfig) GetDoctorInquiryConfigPage(c *gin.Context) {
|
||||||
req := requests.InquiryConfigRequest{}
|
inquiryConfigRequest := requests.InquiryConfigRequest{}
|
||||||
if err := c.ShouldBind(&req.GetDoctorInquiryConfigPage); err != nil {
|
req := inquiryConfigRequest.GetDoctorInquiryConfigPage
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(req.GetDoctorInquiryConfigPage); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.GetDoctorInquiryConfigPage.Page == 0 {
|
if req.Page == 0 {
|
||||||
req.GetDoctorInquiryConfigPage.Page = 1
|
req.Page = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.GetDoctorInquiryConfigPage.PageSize == 0 {
|
if req.PageSize == 0 {
|
||||||
req.GetDoctorInquiryConfigPage.PageSize = 20
|
req.PageSize = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
doctorInquiryConfigDao := dao.DoctorInquiryConfigDao{}
|
||||||
doctorInquiryConfig, total, err := doctorInquiryConfigDao.GetUserDoctorPageSearch(req.GetDoctorInquiryConfigPage, req.GetDoctorInquiryConfigPage.Page, req.GetDoctorInquiryConfigPage.PageSize)
|
doctorInquiryConfig, total, err := doctorInquiryConfigDao.GetUserDoctorPageSearch(req, req.Page, req.PageSize)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
@ -49,8 +50,8 @@ func (r *InquiryConfig) GetDoctorInquiryConfigPage(c *gin.Context) {
|
|||||||
res := dto.GetDoctorInquiryConfigListDto(doctorInquiryConfig)
|
res := dto.GetDoctorInquiryConfigListDto(doctorInquiryConfig)
|
||||||
|
|
||||||
result := make(map[string]interface{})
|
result := make(map[string]interface{})
|
||||||
result["page"] = req.GetDoctorInquiryConfigPage.Page
|
result["page"] = req.Page
|
||||||
result["page_size"] = req.GetDoctorInquiryConfigPage.PageSize
|
result["page_size"] = req.PageSize
|
||||||
result["total"] = total
|
result["total"] = total
|
||||||
result["data"] = res
|
result["data"] = res
|
||||||
responses.OkWithData(result, c)
|
responses.OkWithData(result, c)
|
||||||
@ -58,22 +59,22 @@ func (r *InquiryConfig) GetDoctorInquiryConfigPage(c *gin.Context) {
|
|||||||
|
|
||||||
// GetDoctorInquiryConfig 医生问诊配置详情
|
// GetDoctorInquiryConfig 医生问诊配置详情
|
||||||
func (r *InquiryConfig) GetDoctorInquiryConfig(c *gin.Context) {
|
func (r *InquiryConfig) GetDoctorInquiryConfig(c *gin.Context) {
|
||||||
id := c.Param("inquiry_config_id")
|
inquiryConfigRequest := requests.InquiryConfigRequest{}
|
||||||
if id == "" {
|
req := inquiryConfigRequest.GetDoctorInquiryConfig
|
||||||
responses.FailWithMessage("缺少参数", c)
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将 id 转换为 int64 类型
|
// 参数验证
|
||||||
inquiryConfigId, err := strconv.ParseInt(id, 10, 64)
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
if err != nil {
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
responses.Fail(c)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 业务处理
|
// 业务处理
|
||||||
inquiryConfigService := service.InquiryConfigService{}
|
inquiryConfigService := service.InquiryConfigService{}
|
||||||
getUserDoctorResponses, err := inquiryConfigService.GetDoctorInquiryConfig(inquiryConfigId)
|
getUserDoctorResponses, err := inquiryConfigService.GetDoctorInquiryConfig(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
@ -110,6 +111,11 @@ func (r *InquiryConfig) PutDoctorInquiryConfig(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.InquiryMode == 6 {
|
||||||
|
responses.FailWithMessage("疑难问诊暂不可使用", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 业务处理
|
// 业务处理
|
||||||
doctorInquiryConfigService := service.DoctorInquiryConfigService{}
|
doctorInquiryConfigService := service.DoctorInquiryConfigService{}
|
||||||
_, err = doctorInquiryConfigService.PutDoctorInquiryConfig(inquiryConfigId, req)
|
_, err = doctorInquiryConfigService.PutDoctorInquiryConfig(inquiryConfigId, req)
|
||||||
|
|||||||
@ -87,6 +87,17 @@ func (r *OrderInquiry) GetOrderInquiry(c *gin.Context) {
|
|||||||
|
|
||||||
// CancelOrderInquiry 取消问诊订单
|
// CancelOrderInquiry 取消问诊订单
|
||||||
func (r *OrderInquiry) CancelOrderInquiry(c *gin.Context) {
|
func (r *OrderInquiry) CancelOrderInquiry(c *gin.Context) {
|
||||||
|
//OrderService := service.OrderService{}
|
||||||
|
//
|
||||||
|
//_, err := OrderService.PdfToImg()
|
||||||
|
//if err != nil {
|
||||||
|
// responses.FailWithMessage(err.Error(), c)
|
||||||
|
// return
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//responses.Ok(c)
|
||||||
|
//return
|
||||||
|
|
||||||
id := c.Param("order_inquiry_id")
|
id := c.Param("order_inquiry_id")
|
||||||
if id == "" {
|
if id == "" {
|
||||||
responses.FailWithMessage("缺少参数", c)
|
responses.FailWithMessage("缺少参数", c)
|
||||||
@ -100,24 +111,30 @@ func (r *OrderInquiry) CancelOrderInquiry(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req := requests.OrderInquiryRequest{}
|
orderInquiryRequest := requests.OrderInquiryRequest{}
|
||||||
if err := c.ShouldBind(&req.CancelOrderInquiry); err != nil {
|
req := orderInquiryRequest.CancelOrderInquiry
|
||||||
|
if err := c.ShouldBind(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if err := global.Validate.Struct(req.CancelOrderInquiry); err != nil {
|
if err := global.Validate.Struct(req); err != nil {
|
||||||
responses.FailWithMessage(utils.Translate(err), c)
|
responses.FailWithMessage(utils.Translate(err), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.RefundAmount == nil {
|
||||||
|
responses.FailWithMessage("退款金额不可为空", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// 后台用户id
|
// 后台用户id
|
||||||
adminUserId := c.GetInt64("UserId")
|
adminUserId := c.GetInt64("UserId")
|
||||||
|
|
||||||
// 业务处理
|
// 业务处理
|
||||||
orderInquiryService := service.OrderInquiryService{}
|
orderInquiryService := service.OrderInquiryService{}
|
||||||
_, err = orderInquiryService.CancelOrderInquiry(req.CancelOrderInquiry, orderInquiryId, adminUserId)
|
_, err = orderInquiryService.CancelOrderInquiry(req, orderInquiryId, adminUserId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
|
|||||||
159
api/controller/orderServicePackage.go
Normal file
159
api/controller/orderServicePackage.go
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
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 OrderServicePackage struct{}
|
||||||
|
|
||||||
|
// GetOrderServicePackagePage 获取服务包订单列表-分页
|
||||||
|
func (r *OrderServicePackage) GetOrderServicePackagePage(c *gin.Context) {
|
||||||
|
orderServicePackageRequest := requests.OrderServicePackageRequest{}
|
||||||
|
req := orderServicePackageRequest.GetOrderServicePackagePage
|
||||||
|
if err := c.ShouldBindJSON(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
orderServicePackageDao := dao.OrderServicePackageDao{}
|
||||||
|
orderServicePackage, total, err := orderServicePackageDao.GetOrderServicePackagePageSearch(req, req.Page, req.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
GetOrderInquiryPageResponses := dto.GetOrderServicePackageListDto(orderServicePackage)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[string]interface{})
|
||||||
|
result["page"] = req.Page
|
||||||
|
result["page_size"] = req.PageSize
|
||||||
|
result["total"] = total
|
||||||
|
result["data"] = GetOrderInquiryPageResponses
|
||||||
|
responses.OkWithData(result, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackage 获取服务包订单详情
|
||||||
|
func (r *OrderServicePackage) GetOrderServicePackage(c *gin.Context) {
|
||||||
|
id := c.Param("order_service_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
orderServiceId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
orderServicePackageService := service.OrderServicePackageService{}
|
||||||
|
getResponses, err := orderServicePackageService.GetOrderServicePackage(orderServiceId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailInfo 获取服务包订单服务权益详情
|
||||||
|
func (r *OrderServicePackage) GetOrderServicePackageDetailInfo(c *gin.Context) {
|
||||||
|
id := c.Param("order_service_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
orderServiceId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
orderServicePackageService := service.OrderServicePackageService{}
|
||||||
|
getResponses, err := orderServicePackageService.GetOrderServicePackageDetailInfo(orderServiceId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getResponses, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelOrderServicePackage 取消服务包订单
|
||||||
|
func (r *OrderServicePackage) CancelOrderServicePackage(c *gin.Context) {
|
||||||
|
id := c.Param("order_service_id")
|
||||||
|
if id == "" {
|
||||||
|
responses.FailWithMessage("缺少参数", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 id 转换为 int64 类型
|
||||||
|
orderServiceId, err := strconv.ParseInt(id, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
responses.Fail(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
orderServicePackageRequest := requests.OrderServicePackageRequest{}
|
||||||
|
req := orderServicePackageRequest.CancelOrderServicePackage
|
||||||
|
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.RefundAmount == nil {
|
||||||
|
responses.FailWithMessage("退款金额不可为空", c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后台用户id
|
||||||
|
adminUserId := c.GetInt64("UserId")
|
||||||
|
|
||||||
|
// 业务处理
|
||||||
|
orderServicePackageService := service.OrderServicePackageService{}
|
||||||
|
_, err = orderServicePackageService.CancelOrderServicePackage(req, orderServiceId, adminUserId)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.Ok(c)
|
||||||
|
}
|
||||||
@ -89,7 +89,7 @@ func (r *Product) GetProductPlatform(c *gin.Context) {
|
|||||||
func (r *Product) GetProductPage(c *gin.Context) {
|
func (r *Product) GetProductPage(c *gin.Context) {
|
||||||
productRequest := requests.ProductRequest{}
|
productRequest := requests.ProductRequest{}
|
||||||
req := productRequest.GetProductPage
|
req := productRequest.GetProductPage
|
||||||
if err := c.ShouldBind(&req); err != nil {
|
if err := c.ShouldBindJSON(&req); err != nil {
|
||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -300,3 +300,35 @@ func (r *Product) GetPlatformProductList(c *gin.Context) {
|
|||||||
|
|
||||||
responses.OkWithData(productPlatforms, c)
|
responses.OkWithData(productPlatforms, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetProductList 获取系统商品列表-限制条数
|
||||||
|
func (r *Product) GetProductList(c *gin.Context) {
|
||||||
|
productRequest := requests.ProductRequest{}
|
||||||
|
req := productRequest.GetProductList
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
productDao := dao.ProductDao{}
|
||||||
|
product, err := productDao.GetProductListSearch(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
getProductListResponses := dto.GetProductListDto(product)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
responses.OkWithData(getProductListResponses, c)
|
||||||
|
}
|
||||||
|
|||||||
@ -118,3 +118,30 @@ func (r *UserPatient) PutUserDoctorStatus(c *gin.Context) {
|
|||||||
|
|
||||||
responses.Ok(c)
|
responses.Ok(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserPatientList 获取患者列表-限制条数
|
||||||
|
func (r *UserPatient) GetUserPatientList(c *gin.Context) {
|
||||||
|
userPatientRequest := requests.UserPatientRequest{}
|
||||||
|
req := userPatientRequest.GetUserPatientList
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
userPatientDao := dao.UserPatientDao{}
|
||||||
|
userPatient, err := userPatientDao.GetUserPatientListSearch(req)
|
||||||
|
if err != nil {
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理返回值
|
||||||
|
getUserPatientListResponses := dto.GetUserPatientListDto(userPatient)
|
||||||
|
responses.OkWithData(getUserPatientListResponses, c)
|
||||||
|
}
|
||||||
|
|||||||
190
api/dao/coupon.go
Normal file
190
api/dao/coupon.go
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CouponDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponById 获取数据-id
|
||||||
|
func (r *CouponDao) GetCouponById(couponId int64) (m *model.Coupon, err error) {
|
||||||
|
err = global.Db.First(&m, couponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *CouponDao) GetCouponPreloadById(couponId int64) (m *model.Coupon, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, couponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditCoupon 修改
|
||||||
|
func (r *CouponDao) EditCoupon(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.Coupon{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditCouponById 修改
|
||||||
|
func (r *CouponDao) EditCouponById(tx *gorm.DB, couponId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.Coupon{}).Where("coupon_id = ?", couponId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponList 获取列表
|
||||||
|
func (r *CouponDao) GetCouponList(maps interface{}) (m []*model.Coupon, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddCoupon 新增
|
||||||
|
func (r *CouponDao) AddCoupon(tx *gorm.DB, model *model.Coupon) (*model.Coupon, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponPageSearch 获取列表-分页
|
||||||
|
func (r *CouponDao) GetCouponPageSearch(req requests.GetSystemCouponPage, page, pageSize int) (m []*model.Coupon, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.Coupon{})
|
||||||
|
|
||||||
|
// 优惠卷名称
|
||||||
|
if req.CouponName != "" {
|
||||||
|
query = query.Where("coupon_name LIKE ?", "%"+req.CouponName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 优惠卷描述
|
||||||
|
if req.CouponDesc != "" {
|
||||||
|
query = query.Where("coupon_desc LIKE ?", "%"+req.CouponDesc+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用平台(1:小程序)
|
||||||
|
if req.CouponClient != nil {
|
||||||
|
query = query.Where("coupon_client = ?", req.CouponClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 优惠卷类型(1:无门槛 2:满减 3:数量
|
||||||
|
if req.CouponType != nil {
|
||||||
|
query = query.Where("coupon_type = ?", req.CouponType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||||
|
if req.CouponStatus != nil {
|
||||||
|
query = query.Where("coupon_status = ?", req.CouponStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)
|
||||||
|
if req.DistributionObject != nil {
|
||||||
|
query = query.Where("distribution_object = ?", req.DistributionObject)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)
|
||||||
|
if req.ApplicationScope != nil {
|
||||||
|
query = query.Where("application_scope = ?", req.ApplicationScope)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||||
|
if req.InquiryType != "" {
|
||||||
|
query = query.Where("inquiry_type = ?", req.InquiryType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关联品牌id(如不限制品牌,此项为空)
|
||||||
|
if req.BrandId != "" {
|
||||||
|
query = query.Where("brand_id = ?", req.BrandId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||||
|
if req.IsMutex != nil {
|
||||||
|
query = query.Where("is_mutex = ?", req.IsMutex)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否展示(0:否 1:是)
|
||||||
|
if req.IsDisplay != nil {
|
||||||
|
query = query.Where("is_display = ?", req.IsDisplay)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||||
|
if req.ValidType != nil {
|
||||||
|
query = query.Where("valid_type = ?", req.ValidType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过期之后是否允许再次发放(0:否 1:是)
|
||||||
|
if req.IsReissuableAfterExpire != nil {
|
||||||
|
query = query.Where("is_reissuable_after_expire = ?", req.IsReissuableAfterExpire)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否首页弹窗(0:否 1:是)
|
||||||
|
if req.IsPopup != nil {
|
||||||
|
query = query.Where("is_popup = ?", req.IsPopup)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
if req.CreatedAt != "" {
|
||||||
|
createdAt := strings.Split(req.CreatedAt, "&")
|
||||||
|
if len(createdAt) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", createdAt[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", createdAt[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("created_at BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inc 自增
|
||||||
|
func (r *CouponDao) Inc(tx *gorm.DB, couponId int64, field string, numeral int) error {
|
||||||
|
err := tx.Model(&model.Coupon{}).Where("coupon_id = ?", couponId).UpdateColumn("coupon_take_count", gorm.Expr(field+" + ?", numeral)).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dec 自减
|
||||||
|
func (r *CouponDao) Dec(tx *gorm.DB, couponId int64, field string, numeral int) error {
|
||||||
|
err := tx.Model(&model.Coupon{}).Where("coupon_id = ?", couponId).UpdateColumn("coupon_take_count", gorm.Expr(field+" - ?", numeral)).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
64
api/dao/couponGrant.go
Normal file
64
api/dao/couponGrant.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CouponGrantDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantById 获取数据-id
|
||||||
|
func (r *CouponGrantDao) GetCouponGrantById(couponId int64) (m *model.CouponGrant, err error) {
|
||||||
|
err = global.Db.First(&m, couponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *CouponGrantDao) GetCouponGrantPreloadById(couponId int64) (m *model.CouponGrant, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, couponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantListPreloadByCouponId 获取数据-加载全部关联-id
|
||||||
|
func (r *CouponGrantDao) GetCouponGrantListPreloadByCouponId(couponId int64) (m []*model.CouponGrant, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).Where("coupon_id = ?", couponId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantByCouponId 获取数据-id
|
||||||
|
func (r *CouponGrantDao) GetCouponGrantByCouponId(couponId int64) (m *model.CouponGrant, err error) {
|
||||||
|
err = global.Db.Where("coupon_id = ?", couponId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantList 获取列表
|
||||||
|
func (r *CouponGrantDao) GetCouponGrantList(maps interface{}) (m []*model.CouponGrant, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddCouponGrant 新增
|
||||||
|
func (r *CouponGrantDao) AddCouponGrant(tx *gorm.DB, model *model.CouponGrant) (*model.CouponGrant, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
131
api/dao/doctorConfigFollowPackage.go
Normal file
131
api/dao/doctorConfigFollowPackage.go
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorConfigFollowPackageDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackageListByDoctorId 获取列表-医生id
|
||||||
|
func (r *DoctorConfigFollowPackageDao) GetDoctorConfigFollowPackageListByDoctorId(doctorId int64) (m []*model.DoctorConfigFollowPackage, err error) {
|
||||||
|
err = global.Db.Where("doctor_id = ?", doctorId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackageById 获取医生随访包配置数据-id
|
||||||
|
func (r *DoctorConfigFollowPackageDao) GetDoctorConfigFollowPackageById(followPackageId int64) (m *model.DoctorConfigFollowPackage, err error) {
|
||||||
|
err = global.Db.First(&m, followPackageId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteDoctorConfigFollowPackage 删除医生随访包配置
|
||||||
|
func (r *DoctorConfigFollowPackageDao) DeleteDoctorConfigFollowPackage(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.DoctorConfigFollowPackage{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditDoctorConfigFollowPackageById 修改医生随访包配置-随访包配置id
|
||||||
|
func (r *DoctorConfigFollowPackageDao) EditDoctorConfigFollowPackageById(tx *gorm.DB, followPackageId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.DoctorConfigFollowPackage{}).Where("follow_package_id = ?", followPackageId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackageList 获取医生随访包配置列表
|
||||||
|
func (r *DoctorConfigFollowPackageDao) GetDoctorConfigFollowPackageList(maps interface{}) (m []*model.DoctorConfigFollowPackage, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorConfigFollowPackage 新增医生随访包配置
|
||||||
|
func (r *DoctorConfigFollowPackageDao) AddDoctorConfigFollowPackage(tx *gorm.DB, model *model.DoctorConfigFollowPackage) (*model.DoctorConfigFollowPackage, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackage 获取医生随访包配置
|
||||||
|
func (r *DoctorConfigFollowPackageDao) GetDoctorConfigFollowPackage(maps interface{}) (m *model.DoctorConfigFollowPackage, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorFollowPageSearch 获取开启随访包服务的医生-分页
|
||||||
|
func (r *DoctorConfigFollowPackageDao) GetDoctorFollowPageSearch(req requests.GetDoctorFollowPage, page, pageSize int) (m []*model.DoctorConfigFollowPackage, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.DoctorConfigFollowPackage{})
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 明细
|
||||||
|
query = query.Preload("DoctorConfigFollowPackageItem")
|
||||||
|
|
||||||
|
// 用户表
|
||||||
|
query = query.Preload("UserDoctor.User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
// 医生
|
||||||
|
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||||
|
|
||||||
|
query = query.Where("doctor_id IN (?)", doctorSubQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 医生姓名
|
||||||
|
if req.DoctorName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||||
|
|
||||||
|
query = query.Where("doctor_id IN (?)", subQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
54
api/dao/doctorConfigFollowPackageItem.go
Normal file
54
api/dao/doctorConfigFollowPackageItem.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorConfigFollowPackageItemDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackageItemListByFollowPackageId 获取列表-id
|
||||||
|
func (r *DoctorConfigFollowPackageItemDao) GetDoctorConfigFollowPackageItemListByFollowPackageId(followPackageId int64) (m []*model.DoctorConfigFollowPackageItem, err error) {
|
||||||
|
err = global.Db.Where("follow_package_id = ?", followPackageId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteDoctorConfigFollowPackageItem 删除医生随访包列表配置
|
||||||
|
func (r *DoctorConfigFollowPackageItemDao) DeleteDoctorConfigFollowPackageItem(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.DoctorConfigFollowPackageItem{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditDoctorConfigFollowPackageItemById 修改医生随访包列表配置-随访包列表配置id
|
||||||
|
func (r *DoctorConfigFollowPackageItemDao) EditDoctorConfigFollowPackageItemById(tx *gorm.DB, followPackageItemId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.DoctorConfigFollowPackageItem{}).Where("follow_package_item_id = ?", followPackageItemId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigFollowPackageItemList 获取医生随访包列表配置列表
|
||||||
|
func (r *DoctorConfigFollowPackageItemDao) GetDoctorConfigFollowPackageItemList(maps interface{}) (m []*model.DoctorConfigFollowPackageItem, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorConfigFollowPackageItem 新增医生随访包列表配置
|
||||||
|
func (r *DoctorConfigFollowPackageItemDao) AddDoctorConfigFollowPackageItem(tx *gorm.DB, model *model.DoctorConfigFollowPackageItem) (*model.DoctorConfigFollowPackageItem, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
134
api/dao/doctorConfigHealthPackage.go
Normal file
134
api/dao/doctorConfigHealthPackage.go
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DoctorConfigHealthPackageDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigHealthPackageListByDoctorId 获取列表-医生id
|
||||||
|
func (r *DoctorConfigHealthPackageDao) GetDoctorConfigHealthPackageListByDoctorId(doctorId int64) (m []*model.DoctorConfigHealthPackage, err error) {
|
||||||
|
err = global.Db.Where("doctor_id = ?", doctorId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigHealthPackageById 获取医生健康包配置数据-问诊配置id
|
||||||
|
func (r *DoctorConfigHealthPackageDao) GetDoctorConfigHealthPackageById(healthPackageId int64) (m *model.DoctorConfigHealthPackage, err error) {
|
||||||
|
err = global.Db.First(&m, healthPackageId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteDoctorConfigHealthPackage 删除医生健康包配置
|
||||||
|
func (r *DoctorConfigHealthPackageDao) DeleteDoctorConfigHealthPackage(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.DoctorConfigHealthPackage{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditDoctorConfigHealthPackageById 修改医生健康包配置-健康包配置id
|
||||||
|
func (r *DoctorConfigHealthPackageDao) EditDoctorConfigHealthPackageById(tx *gorm.DB, healthPackageId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.DoctorConfigHealthPackage{}).Where("health_package_id = ?", healthPackageId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigHealthPackageList 获取医生健康包配置列表
|
||||||
|
func (r *DoctorConfigHealthPackageDao) GetDoctorConfigHealthPackageList(maps interface{}) (m []*model.DoctorConfigHealthPackage, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorConfigHealthPackage 新增医生健康包配置
|
||||||
|
func (r *DoctorConfigHealthPackageDao) AddDoctorConfigHealthPackage(tx *gorm.DB, model *model.DoctorConfigHealthPackage) (*model.DoctorConfigHealthPackage, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorConfigHealthPackage 获取医生健康包配置
|
||||||
|
func (r *DoctorConfigHealthPackageDao) GetDoctorConfigHealthPackage(maps interface{}) (m *model.DoctorConfigHealthPackage, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorHealthPageSearch 获取开启健康包服务的医生-分页
|
||||||
|
func (r *DoctorConfigHealthPackageDao) GetDoctorHealthPageSearch(req requests.GetDoctorHealthPage, page, pageSize int) (m []*model.DoctorConfigHealthPackage, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.DoctorConfigHealthPackage{})
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 健康包表
|
||||||
|
query = query.Preload("HealthPackage")
|
||||||
|
|
||||||
|
// 用户表
|
||||||
|
query = query.Preload("UserDoctor.User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 医院表
|
||||||
|
query = query.Preload("UserDoctor.Hospital")
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
// 医生
|
||||||
|
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||||
|
|
||||||
|
query = query.Where("doctor_id IN (?)", doctorSubQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 医生姓名
|
||||||
|
if req.DoctorName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||||
|
|
||||||
|
query = query.Where("doctor_id IN (?)", subQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
109
api/dao/healthPackage.go
Normal file
109
api/dao/healthPackage.go
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HealthPackageDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageById 获取数据-id
|
||||||
|
func (r *HealthPackageDao) GetHealthPackageById(packageId int64) (m *model.HealthPackage, err error) {
|
||||||
|
err = global.Db.First(&m, packageId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackagePreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *HealthPackageDao) GetHealthPackagePreloadById(packageId int64) (m *model.HealthPackage, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, packageId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteHealthPackage 删除
|
||||||
|
func (r *HealthPackageDao) DeleteHealthPackage(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.HealthPackage{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditHealthPackage 修改
|
||||||
|
func (r *HealthPackageDao) EditHealthPackage(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.HealthPackage{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageList 获取列表
|
||||||
|
func (r *HealthPackageDao) GetHealthPackageList(maps interface{}) (m []*model.HealthPackage, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHealthPackage 新增
|
||||||
|
func (r *HealthPackageDao) AddHealthPackage(tx *gorm.DB, model *model.HealthPackage) (*model.HealthPackage, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackagePageSearch 获取列表-分页
|
||||||
|
func (r *HealthPackageDao) GetHealthPackagePageSearch(req requests.GetHealthPackagePage, page, pageSize int) (m []*model.HealthPackage, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.HealthPackage{})
|
||||||
|
|
||||||
|
// 健康包-关联商品
|
||||||
|
query = query.Preload("HealthPackageProduct")
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageListSearch 获取健康包列表-限制条数
|
||||||
|
func (r *HealthPackageDao) GetHealthPackageListSearch(req requests.GetHealthPackageList) (m []*model.HealthPackage, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.HealthPackage{})
|
||||||
|
|
||||||
|
// 健康包-关联商品
|
||||||
|
query = query.Preload("HealthPackageProduct")
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
err = query.Limit(req.Limit).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
74
api/dao/healthPackageProduct.go
Normal file
74
api/dao/healthPackageProduct.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HealthPackageProductDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageProductById 获取数据-id
|
||||||
|
func (r *HealthPackageProductDao) GetHealthPackageProductById(packageProductId int64) (m *model.HealthPackageProduct, err error) {
|
||||||
|
err = global.Db.First(&m, packageProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageProductPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *HealthPackageProductDao) GetHealthPackageProductPreloadById(packageProductId int64) (m *model.HealthPackageProduct, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, packageProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageProductByPackageId 获取数据-id
|
||||||
|
func (r *HealthPackageProductDao) GetHealthPackageProductByPackageId(packageId int64) (m []*model.HealthPackageProduct,
|
||||||
|
err error) {
|
||||||
|
err = global.Db.Where("package_id = ?", packageId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteHealthPackageProduct 删除
|
||||||
|
func (r *HealthPackageProductDao) DeleteHealthPackageProduct(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.HealthPackageProduct{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditHealthPackageProduct 修改
|
||||||
|
func (r *HealthPackageProductDao) EditHealthPackageProduct(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.HealthPackageProduct{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageProductList 获取列表
|
||||||
|
func (r *HealthPackageProductDao) GetHealthPackageProductList(maps interface{}) (m []*model.HealthPackageProduct, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHealthPackageProduct 新增
|
||||||
|
func (r *HealthPackageProductDao) AddHealthPackageProduct(tx *gorm.DB, model *model.HealthPackageProduct) (*model.HealthPackageProduct, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
@ -7,11 +7,11 @@ import (
|
|||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Hospital struct {
|
type HospitalDao struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHospitalById 获取医院数据-医院id
|
// GetHospitalById 获取医院数据-医院id
|
||||||
func (r *Hospital) GetHospitalById(hospitalId int64) (m *model.Hospital, err error) {
|
func (r *HospitalDao) GetHospitalById(hospitalId int64) (m *model.Hospital, err error) {
|
||||||
err = global.Db.First(&m, hospitalId).Error
|
err = global.Db.First(&m, hospitalId).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -20,7 +20,7 @@ func (r *Hospital) GetHospitalById(hospitalId int64) (m *model.Hospital, err err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddHospital 新增医院
|
// AddHospital 新增医院
|
||||||
func (r *Hospital) AddHospital(tx *gorm.DB, model *model.Hospital) (*model.Hospital, error) {
|
func (r *HospitalDao) AddHospital(tx *gorm.DB, model *model.Hospital) (*model.Hospital, error) {
|
||||||
if err := tx.Create(model).Error; err != nil {
|
if err := tx.Create(model).Error; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ func (r *Hospital) AddHospital(tx *gorm.DB, model *model.Hospital) (*model.Hospi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetHospitalList 获取医院列表
|
// GetHospitalList 获取医院列表
|
||||||
func (r *Hospital) GetHospitalList(maps interface{}) (m []*model.Hospital, err error) {
|
func (r *HospitalDao) GetHospitalList(maps interface{}) (m []*model.Hospital, err error) {
|
||||||
err = global.Db.Where(maps).Find(&m).Error
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -37,7 +37,7 @@ func (r *Hospital) GetHospitalList(maps interface{}) (m []*model.Hospital, err e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteHospitalById 删除医院-医院id
|
// DeleteHospitalById 删除医院-医院id
|
||||||
func (r *Hospital) DeleteHospitalById(tx *gorm.DB, hospitalId int64) error {
|
func (r *HospitalDao) DeleteHospitalById(tx *gorm.DB, hospitalId int64) error {
|
||||||
if err := tx.Delete(&model.Hospital{}, hospitalId).Error; err != nil {
|
if err := tx.Delete(&model.Hospital{}, hospitalId).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ func (r *Hospital) DeleteHospitalById(tx *gorm.DB, hospitalId int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// EditHospitalById 修改医院-医院id
|
// EditHospitalById 修改医院-医院id
|
||||||
func (r *Hospital) EditHospitalById(tx *gorm.DB, hospitalId int64, data interface{}) error {
|
func (r *HospitalDao) EditHospitalById(tx *gorm.DB, hospitalId int64, data interface{}) error {
|
||||||
err := tx.Model(&model.Hospital{}).Where("hospital_id = ?", hospitalId).Updates(data).Error
|
err := tx.Model(&model.Hospital{}).Where("hospital_id = ?", hospitalId).Updates(data).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -54,7 +54,7 @@ func (r *Hospital) EditHospitalById(tx *gorm.DB, hospitalId int64, data interfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetHospitalLimitByMaps 获取医院列表-限制条数
|
// GetHospitalLimitByMaps 获取医院列表-限制条数
|
||||||
func (r *Hospital) GetHospitalLimitByMaps(hospitalRequest requests.GetHospitalLimit) (m []*model.Hospital, err error) {
|
func (r *HospitalDao) GetHospitalLimitByMaps(hospitalRequest requests.GetHospitalList) (m []*model.Hospital, err error) {
|
||||||
result := global.Db
|
result := global.Db
|
||||||
if hospitalRequest.HospitalName != "" {
|
if hospitalRequest.HospitalName != "" {
|
||||||
result = result.Where("hospital_name like ?", "%"+hospitalRequest.HospitalName+"%")
|
result = result.Where("hospital_name like ?", "%"+hospitalRequest.HospitalName+"%")
|
||||||
@ -94,3 +94,46 @@ func (r *Hospital) GetHospitalLimitByMaps(hospitalRequest requests.GetHospitalLi
|
|||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetHospitalPageSearch 获取医院列表-分页
|
||||||
|
func (r *HospitalDao) GetHospitalPageSearch(req requests.GetHospitalPage, page, pageSize int) (m []*model.Hospital, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.Hospital{})
|
||||||
|
|
||||||
|
if req.HospitalName != "" {
|
||||||
|
query = query.Where("hospital_name like ?", "%"+req.HospitalName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.HospitalLevelName != "" {
|
||||||
|
query = query.Where("hospital_level_name like ?", "%"+req.HospitalLevelName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.ProvinceId != 0 {
|
||||||
|
query = query.Where("province_id = ?", req.ProvinceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.CityId != 0 {
|
||||||
|
query = query.Where("city_id = ?", req.CityId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.CountyId != 0 {
|
||||||
|
query = query.Where("county_id = ?", req.CountyId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|||||||
62
api/dao/order.go
Normal file
62
api/dao/order.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderById 获取数据-id
|
||||||
|
func (r *OrderDao) GetOrderById(orderId int64) (m *model.Order, err error) {
|
||||||
|
err = global.Db.First(&m, orderId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrder 新增
|
||||||
|
func (r *OrderDao) AddOrder(tx *gorm.DB, model *model.Order) (*model.Order, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderList 获取列表
|
||||||
|
func (r *OrderDao) GetOrderList(maps interface{}) (m []*model.Order, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrder 获取单个
|
||||||
|
func (r *OrderDao) GetOrder(maps interface{}) (m *model.Order, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderById 删除-id
|
||||||
|
func (r *OrderDao) DeleteOrderById(tx *gorm.DB, orderId int64) error {
|
||||||
|
if err := tx.Delete(&model.Order{}, orderId).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderById 修改-id
|
||||||
|
func (r *OrderDao) EditOrderById(tx *gorm.DB, orderId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.Order{}).Where("order_id = ?", orderId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
53
api/dao/orderCoupon.go
Normal file
53
api/dao/orderCoupon.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderCouponDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderCouponById 获取数据-接口id
|
||||||
|
func (r *OrderCouponDao) GetOrderCouponById(orderCouponId int64) (m *model.OrderCoupon, err error) {
|
||||||
|
err = global.Db.First(&m, orderCouponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderCoupon 新增
|
||||||
|
func (r *OrderCouponDao) AddOrderCoupon(tx *gorm.DB, model *model.OrderCoupon) (*model.OrderCoupon, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderCouponList 获取列表
|
||||||
|
func (r *OrderCouponDao) GetOrderCouponList(maps interface{}) (m []*model.OrderCoupon, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderCouponById 删除-id
|
||||||
|
func (r *OrderCouponDao) DeleteOrderCouponById(tx *gorm.DB, orderCouponId int64) error {
|
||||||
|
if err := tx.Delete(&model.OrderCoupon{}, orderCouponId).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderCouponById 修改-id
|
||||||
|
func (r *OrderCouponDao) EditOrderCouponById(tx *gorm.DB, orderCouponId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderCoupon{}).Where("order_coupon_id = ?", orderCouponId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -461,6 +461,15 @@ func (r *OrderInquiryDao) GetOrderInquiryTimeList(maps interface{}, startTime, e
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetOrderInquiryCreatedTimeList 获取问诊订单列表-创建时间
|
||||||
|
func (r *OrderInquiryDao) GetOrderInquiryCreatedTimeList(maps interface{}, startTime, endTime string) (m []*model.OrderInquiry, err error) {
|
||||||
|
err = global.Db.Where(maps).Where("created_at BETWEEN ? AND ?", startTime, endTime).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetOrderInquiryForAccountPageSearch 获取账户关联问诊订单列表-分页
|
// GetOrderInquiryForAccountPageSearch 获取账户关联问诊订单列表-分页
|
||||||
func (r *OrderInquiryDao) GetOrderInquiryForAccountPageSearch(req requests.GetOrderInquiryForAccountPage, page, pageSize int) (m []*model.OrderInquiry, total int64, err error) {
|
func (r *OrderInquiryDao) GetOrderInquiryForAccountPageSearch(req requests.GetOrderInquiryForAccountPage, page, pageSize int) (m []*model.OrderInquiry, total int64, err error) {
|
||||||
var totalRecords int64
|
var totalRecords int64
|
||||||
|
|||||||
79
api/dao/orderPrescriptionFile.go
Normal file
79
api/dao/orderPrescriptionFile.go
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderPrescriptionFileDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderPrescriptionFileById 获取处方关联CA数据-处方关联CAid
|
||||||
|
func (r *OrderPrescriptionFileDao) GetOrderPrescriptionFileById(PrescriptionFileId int64) (m *model.OrderPrescriptionFile, err error) {
|
||||||
|
err = global.Db.First(&m, PrescriptionFileId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *OrderPrescriptionFileDao) GetOrderPrescriptionFileByOrderPrescriptionId(orderPrescriptionId int64) (m *model.OrderPrescriptionFile, err error) {
|
||||||
|
err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *OrderPrescriptionFileDao) GetOrderPrescriptionFileListByOrderPrescriptionId(orderPrescriptionId int64) (m []*model.OrderPrescriptionFile, err error) {
|
||||||
|
err = global.Db.Where("order_prescription_id = ?", orderPrescriptionId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderPrescriptionFile 删除处方关联CA
|
||||||
|
func (r *OrderPrescriptionFileDao) DeleteOrderPrescriptionFile(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderPrescriptionFile{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderPrescriptionFile 修改处方关联CA
|
||||||
|
func (r *OrderPrescriptionFileDao) EditOrderPrescriptionFile(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderPrescriptionFile{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderPrescriptionFileById 修改处方关联CA
|
||||||
|
func (r *OrderPrescriptionFileDao) EditOrderPrescriptionFileById(tx *gorm.DB, PrescriptionFileId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderPrescriptionFile{}).Where("prescription_file_id = ?", PrescriptionFileId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderPrescriptionFileList 获取处方关联CA列表
|
||||||
|
func (r *OrderPrescriptionFileDao) GetOrderPrescriptionFileList(maps interface{}) (m []*model.OrderPrescriptionFile, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderPrescriptionFile 新增处方关联CA
|
||||||
|
func (r *OrderPrescriptionFileDao) AddOrderPrescriptionFile(tx *gorm.DB, model *model.OrderPrescriptionFile) (*model.OrderPrescriptionFile, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
@ -92,6 +92,9 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
query := global.Db.Model(&model.OrderProduct{})
|
query := global.Db.Model(&model.OrderProduct{})
|
||||||
|
|
||||||
|
// 药品数据
|
||||||
|
query = query.Preload("OrderProductItem")
|
||||||
|
|
||||||
// 医生
|
// 医生
|
||||||
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
return db.Omit("open_id", "union_id", "wx_session_key")
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
@ -130,6 +133,29 @@ func (r *OrderProductDao) GetOrderProductPageSearch(req requests.GetOrderProduct
|
|||||||
query = query.Where(gorm.Expr("order_inquiry_id IN (?)", subQuery))
|
query = query.Where(gorm.Expr("order_inquiry_id IN (?)", subQuery))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 药品名称
|
||||||
|
if req.ProductName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.OrderProductItem{}).
|
||||||
|
Select("order_product_id").
|
||||||
|
Where("product_name LIKE ?", "%"+req.ProductName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("order_product_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 药品通用名
|
||||||
|
if req.CommonName != "" {
|
||||||
|
// 患者
|
||||||
|
productSubQuery := global.Db.Model(&model.Product{}).
|
||||||
|
Select("product_id").
|
||||||
|
Where("common_name LIKE ?", "%"+req.CommonName+"%")
|
||||||
|
|
||||||
|
subQuery := global.Db.Model(&model.OrderProductItem{}).
|
||||||
|
Select("order_product_id").
|
||||||
|
Where(gorm.Expr("product_id IN (?)", productSubQuery))
|
||||||
|
|
||||||
|
query = query.Where("order_product_id IN (?)", subQuery)
|
||||||
|
}
|
||||||
|
|
||||||
// 订单编号
|
// 订单编号
|
||||||
if req.OrderProductNo != "" {
|
if req.OrderProductNo != "" {
|
||||||
query = query.Where("order_product_no = ?", req.OrderProductNo)
|
query = query.Where("order_product_no = ?", req.OrderProductNo)
|
||||||
|
|||||||
82
api/dao/orderProductCoupon.go
Normal file
82
api/dao/orderProductCoupon.go
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderProductCouponDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderProductCouponById 获取药品订单优惠卷数据-药品订单优惠卷id
|
||||||
|
func (r *OrderProductCouponDao) GetOrderProductCouponById(orderCouponId int64) (m *model.OrderProductCoupon, err error) {
|
||||||
|
err = global.Db.First(&m, orderCouponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *OrderProductCouponDao) GetOrderProductCouponByOrderProductId(orderProductId int64) (m *model.
|
||||||
|
OrderProductCoupon, err error) {
|
||||||
|
err = global.Db.Where("order_product_id = ?", orderProductId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderProductCouponPreloadById 获取药品订单优惠卷数据-加载全部关联-药品订单优惠卷id
|
||||||
|
func (r *OrderProductCouponDao) GetOrderProductCouponPreloadById(orderCouponId int64) (m *model.OrderProductCoupon, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, orderCouponId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderProductCoupon 删除药品订单优惠卷
|
||||||
|
func (r *OrderProductCouponDao) DeleteOrderProductCoupon(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderProductCoupon{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderProductCoupon 修改药品订单优惠卷
|
||||||
|
func (r *OrderProductCouponDao) EditOrderProductCoupon(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderProductCoupon{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderProductCouponById 修改药品订单优惠卷-药品订单优惠卷id
|
||||||
|
func (r *OrderProductCouponDao) EditOrderProductCouponById(tx *gorm.DB, orderCouponId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderProductCoupon{}).Where("order_coupon_id = ?", orderCouponId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderProductCouponList 获取药品订单优惠卷列表
|
||||||
|
func (r *OrderProductCouponDao) GetOrderProductCouponList(maps interface{}) (m []*model.OrderProductCoupon, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderProductCoupon 新增药品订单优惠卷
|
||||||
|
func (r *OrderProductCouponDao) AddOrderProductCoupon(tx *gorm.DB, model *model.OrderProductCoupon) (*model.OrderProductCoupon, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
53
api/dao/orderRefund.go
Normal file
53
api/dao/orderRefund.go
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderRefundDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderRefundById 获取接口数据-接口id
|
||||||
|
func (r *OrderRefundDao) GetOrderRefundById(orderRefundId int64) (m *model.OrderRefund, err error) {
|
||||||
|
err = global.Db.First(&m, orderRefundId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderRefund 新增接口
|
||||||
|
func (r *OrderRefundDao) AddOrderRefund(tx *gorm.DB, model *model.OrderRefund) (*model.OrderRefund, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderRefundList 获取接口列表
|
||||||
|
func (r *OrderRefundDao) GetOrderRefundList(maps interface{}) (m []*model.OrderRefund, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderRefundById 删除接口-接口id
|
||||||
|
func (r *OrderRefundDao) DeleteOrderRefundById(tx *gorm.DB, orderRefundId int64) error {
|
||||||
|
if err := tx.Delete(&model.OrderRefund{}, orderRefundId).Error; err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderRefundById 修改接口-接口id
|
||||||
|
func (r *OrderRefundDao) EditOrderRefundById(tx *gorm.DB, orderRefundId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderRefund{}).Where("order_refund_id = ?", orderRefundId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
517
api/dao/orderServicePackage.go
Normal file
517
api/dao/orderServicePackage.go
Normal file
@ -0,0 +1,517 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageById 获取数据-id
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackageById(orderServiceId int64) (m *model.OrderServicePackage, err error) {
|
||||||
|
err = global.Db.First(&m, orderServiceId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackagePreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackagePreloadById(orderServiceId int64) (m *model.OrderServicePackage, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, orderServiceId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageByOrderId 获取数据-订单id
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackageByOrderId(orderId int64) (m *model.OrderServicePackage, err error) {
|
||||||
|
err = global.Db.Where("order_id = ?", orderId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderServicePackage 删除
|
||||||
|
func (r *OrderServicePackageDao) DeleteOrderServicePackage(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderServicePackage{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackage 修改
|
||||||
|
func (r *OrderServicePackageDao) EditOrderServicePackage(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackage{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageById 修改-药品订单id
|
||||||
|
func (r *OrderServicePackageDao) EditOrderServicePackageById(tx *gorm.DB, orderId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackage{}).Where("order_id = ?", orderId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageList 获取列表
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackageList(maps interface{}) (m []*model.OrderServicePackage, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackage 获取
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackage(maps interface{}) (m *model.OrderServicePackage, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderServicePackage 新增
|
||||||
|
func (r *OrderServicePackageDao) AddOrderServicePackage(tx *gorm.DB, model *model.OrderServicePackage) (*model.OrderServicePackage, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackagePageSearch 获取问诊订单列表-分页
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackagePageSearch(req requests.GetOrderServicePackagePage, page, pageSize int) (m []*model.OrderServicePackage, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.OrderServicePackage{})
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 医生姓名
|
||||||
|
if req.DoctorName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "mobile")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 主键id
|
||||||
|
if req.OrderServiceId != "" {
|
||||||
|
query = query.Where("order_service_id = ?", req.OrderServiceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单id
|
||||||
|
if req.OrderId != "" {
|
||||||
|
query = query.Where("order_id = ?", req.OrderId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 服务包类型
|
||||||
|
if req.OrderServiceType != nil {
|
||||||
|
query = query.Where("order_service_type = ?", req.OrderServiceType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单状态
|
||||||
|
if req.OrderServiceStatus != nil {
|
||||||
|
query = query.Where("order_service_status = ?", req.OrderServiceStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除状态
|
||||||
|
if req.OrderServiceStatus != nil {
|
||||||
|
query = query.Where("order_service_status = ?", req.OrderServiceStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单退款状态
|
||||||
|
if req.RefundStatus != nil {
|
||||||
|
query = query.Where("refund_status = ?", req.RefundStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付渠道
|
||||||
|
if req.PayChannel != nil {
|
||||||
|
query = query.Where("pay_channel = ?", req.PayChannel)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付状态
|
||||||
|
if req.PayStatus != nil {
|
||||||
|
query = query.Where("pay_status = ?", req.PayStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统订单编号
|
||||||
|
if req.OrderServiceNo != "" {
|
||||||
|
query = query.Where("order_service_no = ?", req.OrderServiceNo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第三方支付流水号
|
||||||
|
if req.EscrowTradeNo != "" {
|
||||||
|
query = query.Where("escrow_trade_no = ?", req.EscrowTradeNo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付时间
|
||||||
|
if req.PayTime != "" {
|
||||||
|
payTime := strings.Split(req.PayTime, "&")
|
||||||
|
if len(payTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", payTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", payTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("pay_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始服务时间
|
||||||
|
if req.StartTime != "" {
|
||||||
|
orderStartTime := strings.Split(req.StartTime, "&")
|
||||||
|
if len(orderStartTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", orderStartTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", orderStartTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("start_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结束服务时间
|
||||||
|
if req.FinishTime != "" {
|
||||||
|
finishTime := strings.Split(req.FinishTime, "&")
|
||||||
|
if len(finishTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", finishTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", finishTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("finish_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单取消时间
|
||||||
|
if req.CancelTime != "" {
|
||||||
|
cancelTime := strings.Split(req.CancelTime, "&")
|
||||||
|
if len(cancelTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", cancelTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", cancelTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("cancel_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消订单原因
|
||||||
|
if req.CancelReason != nil {
|
||||||
|
query = query.Where("cancel_reason = ?", req.CancelReason)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消订单备注
|
||||||
|
if req.CancelRemarks != "" {
|
||||||
|
query = query.Where("cancel_remarks LIKE ?", "%"+req.CancelRemarks+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加完成订单延迟队列状态
|
||||||
|
if req.AddFinishStatus != nil {
|
||||||
|
query = query.Where("add_finish_status = ?", req.AddFinishStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加完成订单延迟队列时间
|
||||||
|
if req.AddFinishTime != "" {
|
||||||
|
addFinishTime := strings.Split(req.AddFinishTime, "&")
|
||||||
|
if len(addFinishTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", addFinishTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", addFinishTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("add_finish_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
if req.CreatedAt != "" {
|
||||||
|
createdAt := strings.Split(req.CreatedAt, "&")
|
||||||
|
if len(createdAt) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", createdAt[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", createdAt[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("created_at BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 患者姓名-就诊人
|
||||||
|
if req.PatientName != "" {
|
||||||
|
query = query.Where("patient_name LIKE ?", "%"+req.PatientName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号-医生/患者
|
||||||
|
if req.Mobile != "" {
|
||||||
|
// 患者
|
||||||
|
patientSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||||
|
|
||||||
|
query = query.Where("user_id IN (?)", patientSubQuery).Or("doctor_id IN (?)", doctorSubQuery)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageExportListSearch 获取服务包订单列表-导出
|
||||||
|
func (r *OrderServicePackageDao) GetOrderServicePackageExportListSearch(req requests.OrderServicePackageExportList) (m []*model.OrderServicePackage, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.OrderServicePackage{})
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
query = query.Preload("UserDoctor", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "mobile")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 患者
|
||||||
|
query = query.Preload("UserPatient.User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("user_id", "user_name", "mobile")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 当前搜索数据
|
||||||
|
if req.Type == 1 {
|
||||||
|
// 医生姓名
|
||||||
|
if req.DoctorName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where("user_name LIKE ?", "%"+req.DoctorName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("doctor_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单id
|
||||||
|
if req.OrderId != "" {
|
||||||
|
query = query.Where("order_id = ?", req.OrderId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 服务包类型
|
||||||
|
if req.OrderServiceType != nil {
|
||||||
|
query = query.Where("order_service_type = ?", req.OrderServiceType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单状态
|
||||||
|
if req.OrderServiceStatus != nil {
|
||||||
|
query = query.Where("order_service_status = ?", req.OrderServiceStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除状态
|
||||||
|
if req.OrderServiceStatus != nil {
|
||||||
|
query = query.Where("order_service_status = ?", req.OrderServiceStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单退款状态
|
||||||
|
if req.RefundStatus != nil {
|
||||||
|
query = query.Where("refund_status = ?", req.RefundStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付渠道
|
||||||
|
if req.PayChannel != nil {
|
||||||
|
query = query.Where("pay_channel = ?", req.PayChannel)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付状态
|
||||||
|
if req.PayStatus != nil {
|
||||||
|
query = query.Where("pay_status = ?", req.PayStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 系统订单编号
|
||||||
|
if req.OrderServiceNo != "" {
|
||||||
|
query = query.Where("order_service_no = ?", req.OrderServiceNo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第三方支付流水号
|
||||||
|
if req.EscrowTradeNo != "" {
|
||||||
|
query = query.Where("escrow_trade_no = ?", req.EscrowTradeNo)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 支付时间
|
||||||
|
if req.PayTime != "" {
|
||||||
|
payTime := strings.Split(req.PayTime, "&")
|
||||||
|
if len(payTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", payTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", payTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("pay_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始服务时间
|
||||||
|
if req.StartTime != "" {
|
||||||
|
orderStartTime := strings.Split(req.StartTime, "&")
|
||||||
|
if len(orderStartTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", orderStartTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", orderStartTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("start_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结束服务时间
|
||||||
|
if req.FinishTime != "" {
|
||||||
|
finishTime := strings.Split(req.FinishTime, "&")
|
||||||
|
if len(finishTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", finishTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", finishTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("finish_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 订单取消时间
|
||||||
|
if req.CancelTime != "" {
|
||||||
|
cancelTime := strings.Split(req.CancelTime, "&")
|
||||||
|
if len(cancelTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", cancelTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", cancelTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("cancel_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消订单原因
|
||||||
|
if req.CancelReason != nil {
|
||||||
|
query = query.Where("cancel_reason = ?", req.CancelReason)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消订单备注
|
||||||
|
if req.CancelRemarks != "" {
|
||||||
|
query = query.Where("cancel_remarks LIKE ?", "%"+req.CancelRemarks+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加完成订单延迟队列状态
|
||||||
|
if req.AddFinishStatus != nil {
|
||||||
|
query = query.Where("add_finish_status = ?", req.AddFinishStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加完成订单延迟队列时间
|
||||||
|
if req.AddFinishTime != "" {
|
||||||
|
addFinishTime := strings.Split(req.AddFinishTime, "&")
|
||||||
|
if len(addFinishTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", addFinishTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", addFinishTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("add_finish_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
if req.CreatedAt != "" {
|
||||||
|
createdAt := strings.Split(req.CreatedAt, "&")
|
||||||
|
if len(createdAt) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", createdAt[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", createdAt[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("created_at BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 患者姓名-就诊人
|
||||||
|
if req.PatientName != "" {
|
||||||
|
query = query.Where("patient_name LIKE ?", "%"+req.PatientName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号-医生/患者
|
||||||
|
if req.Mobile != "" {
|
||||||
|
// 患者
|
||||||
|
patientSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
// 医生
|
||||||
|
doctorUserSubQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
doctorSubQuery := global.Db.Model(&model.UserDoctor{}).
|
||||||
|
Select("doctor_id").
|
||||||
|
Where(gorm.Expr("user_id IN (?)", doctorUserSubQuery))
|
||||||
|
|
||||||
|
query = query.Where("user_id IN (?)", patientSubQuery).Or("doctor_id IN (?)", doctorSubQuery)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前选中数据
|
||||||
|
if req.Type == 2 {
|
||||||
|
if req.Id == "" {
|
||||||
|
return nil, errors.New("未提供需导出数据编号")
|
||||||
|
}
|
||||||
|
|
||||||
|
id := strings.Split(req.Id, ",")
|
||||||
|
query = query.Where("order_service_id IN (?)", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
err = query.Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
100
api/dao/orderServicePackageCase.go
Normal file
100
api/dao/orderServicePackageCase.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageCaseDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseById 获取数据-id
|
||||||
|
func (r *OrderServicePackageCaseDao) GetOrderServicePackageCaseById(orderServiceCaseId int64) (m *model.OrderServicePackageCase, err error) {
|
||||||
|
err = global.Db.First(&m, orderServiceCaseId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCasePreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageCaseDao) GetOrderServicePackageCasePreloadById(orderServiceCaseId int64) (m *model.OrderServicePackageCase, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, orderServiceCaseId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseByOrderId 获取数据-订单id
|
||||||
|
func (r *OrderServicePackageCaseDao) GetOrderServicePackageCaseByOrderId(orderId int64) (m *model.OrderServicePackageCase, err error) {
|
||||||
|
err = global.Db.Where("order_id = ?", orderId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseByOrderServicePackageId 获取数据-订单id
|
||||||
|
func (r *OrderServicePackageCaseDao) GetOrderServicePackageCaseByOrderServicePackageId(orderServicePackageId int64) (m *model.OrderServicePackageCase, err error) {
|
||||||
|
err = global.Db.Where("order_service_id = ?", orderServicePackageId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderServicePackageCase 删除
|
||||||
|
func (r *OrderServicePackageCaseDao) DeleteOrderServicePackageCase(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderServicePackageCase{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageCase 修改
|
||||||
|
func (r *OrderServicePackageCaseDao) EditOrderServicePackageCase(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageCase{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageCaseByOrderServicePackageId 修改-id
|
||||||
|
func (r *OrderServicePackageCaseDao) EditOrderServicePackageCaseByOrderServicePackageId(tx *gorm.DB, orderServicePackageId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageCase{}).Where("order_service_id = ?", orderServicePackageId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageCaseById 修改-药品订单id
|
||||||
|
func (r *OrderServicePackageCaseDao) EditOrderServicePackageCaseById(tx *gorm.DB, orderId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageCase{}).Where("order_id = ?", orderId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseList 获取列表
|
||||||
|
func (r *OrderServicePackageCaseDao) GetOrderServicePackageCaseList(maps interface{}) (m []*model.OrderServicePackageCase, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderServicePackageCase 新增
|
||||||
|
func (r *OrderServicePackageCaseDao) AddOrderServicePackageCase(tx *gorm.DB, model *model.OrderServicePackageCase) (*model.OrderServicePackageCase, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
100
api/dao/orderServicePackageDetail.go
Normal file
100
api/dao/orderServicePackageDetail.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageDetailDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailById 获取数据-id
|
||||||
|
func (r *OrderServicePackageDetailDao) GetOrderServicePackageDetailById(orderServiceDetailId int64) (m *model.OrderServicePackageDetail, err error) {
|
||||||
|
err = global.Db.First(&m, orderServiceDetailId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageDetailDao) GetOrderServicePackageDetailPreloadById(orderServiceDetailId int64) (m *model.OrderServicePackageDetail, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, orderServiceDetailId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailByOrderId 获取数据-订单id
|
||||||
|
func (r *OrderServicePackageDetailDao) GetOrderServicePackageDetailByOrderId(orderId int64) (m *model.OrderServicePackageDetail, err error) {
|
||||||
|
err = global.Db.Where("order_id = ?", orderId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailByOrderServicePackageId 获取数据-订单id
|
||||||
|
func (r *OrderServicePackageDetailDao) GetOrderServicePackageDetailByOrderServicePackageId(orderServicePackageId int64) (m *model.OrderServicePackageDetail, err error) {
|
||||||
|
err = global.Db.Where("order_service_id = ?", orderServicePackageId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderServicePackageDetail 删除
|
||||||
|
func (r *OrderServicePackageDetailDao) DeleteOrderServicePackageDetail(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderServicePackageDetail{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageDetail 修改
|
||||||
|
func (r *OrderServicePackageDetailDao) EditOrderServicePackageDetail(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageDetail{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageDetailByOrderServicePackageId 修改-id
|
||||||
|
func (r *OrderServicePackageDetailDao) EditOrderServicePackageDetailByOrderServicePackageId(tx *gorm.DB, orderServicePackageId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageDetail{}).Where("order_service_id = ?", orderServicePackageId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageDetailById 修改-药品订单id
|
||||||
|
func (r *OrderServicePackageDetailDao) EditOrderServicePackageDetailById(tx *gorm.DB, orderId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageDetail{}).Where("order_id = ?", orderId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailList 获取列表
|
||||||
|
func (r *OrderServicePackageDetailDao) GetOrderServicePackageDetailList(maps interface{}) (m []*model.OrderServicePackageDetail, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderServicePackageDetail 新增
|
||||||
|
func (r *OrderServicePackageDetailDao) AddOrderServicePackageDetail(tx *gorm.DB, model *model.OrderServicePackageDetail) (*model.OrderServicePackageDetail, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
74
api/dao/orderServicePackageInquiry.go
Normal file
74
api/dao/orderServicePackageInquiry.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageInquiryDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryById 获取数据-id
|
||||||
|
func (r *OrderServicePackageInquiryDao) GetOrderServicePackageInquiryById(serviceProductId int64) (m *model.OrderServicePackageInquiry, err error) {
|
||||||
|
err = global.Db.First(&m, serviceProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageInquiryDao) GetOrderServicePackageInquiryPreloadById(serviceProductId int64) (m *model.OrderServicePackageInquiry, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, serviceProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryByOrderNo 获取数据-系统订单编号
|
||||||
|
func (r *OrderServicePackageInquiryDao) GetOrderServicePackageInquiryByOrderNo(orderNo string) (m []*model.OrderServicePackageInquiry, err error) {
|
||||||
|
err = global.Db.Where("order_service_no = ?", orderNo).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryPreloadByOrderNo 获取数据-系统订单编号
|
||||||
|
func (r *OrderServicePackageInquiryDao) GetOrderServicePackageInquiryPreloadByOrderNo(orderNo string) (m []*model.OrderServicePackageInquiry, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).Where("order_service_no = ?", orderNo).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderServicePackageInquiry 删除
|
||||||
|
func (r *OrderServicePackageInquiryDao) DeleteOrderServicePackageInquiry(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderServicePackageInquiry{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageInquiry 修改
|
||||||
|
func (r *OrderServicePackageInquiryDao) EditOrderServicePackageInquiry(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageInquiry{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryList 获取列表
|
||||||
|
func (r *OrderServicePackageInquiryDao) GetOrderServicePackageInquiryList(maps interface{}) (m []*model.OrderServicePackageInquiry, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
74
api/dao/orderServicePackageProduct.go
Normal file
74
api/dao/orderServicePackageProduct.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageProductDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductById 获取数据-id
|
||||||
|
func (r *OrderServicePackageProductDao) GetOrderServicePackageProductById(serviceProductId int64) (m *model.OrderServicePackageProduct, err error) {
|
||||||
|
err = global.Db.First(&m, serviceProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageProductDao) GetOrderServicePackageProductPreloadById(serviceProductId int64) (m *model.OrderServicePackageProduct, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, serviceProductId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductPreloadByOrderServiceId 获取数据
|
||||||
|
func (r *OrderServicePackageProductDao) GetOrderServicePackageProductPreloadByOrderServiceId(orderServiceId int64) (m []*model.OrderServicePackageProduct, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).Where("order_service_id = ?", orderServiceId).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageProduct 修改
|
||||||
|
func (r *OrderServicePackageProductDao) EditOrderServicePackageProduct(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageProduct{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageProductById 修改
|
||||||
|
func (r *OrderServicePackageProductDao) EditOrderServicePackageProductById(tx *gorm.DB, serviceProductId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageProduct{}).Where("service_product_id = ?", serviceProductId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductList 获取列表
|
||||||
|
func (r *OrderServicePackageProductDao) GetOrderServicePackageProductList(maps interface{}) (m []*model.OrderServicePackageProduct, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProduct 获取
|
||||||
|
func (r *OrderServicePackageProductDao) GetOrderServicePackageProduct(maps interface{}) (m *model.OrderServicePackageProduct, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
100
api/dao/orderServicePackageRefund.go
Normal file
100
api/dao/orderServicePackageRefund.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageRefundDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundById 获取数据-id
|
||||||
|
func (r *OrderServicePackageRefundDao) GetOrderServicePackageRefundById(serviceRefundId int64) (m *model.OrderServicePackageRefund, err error) {
|
||||||
|
err = global.Db.First(&m, serviceRefundId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *OrderServicePackageRefundDao) GetOrderServicePackageRefundPreloadById(serviceRefundId int64) (m *model.OrderServicePackageRefund, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, serviceRefundId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundByOrderServicePackageId 获取数据-服务包订单id
|
||||||
|
func (r *OrderServicePackageRefundDao) GetOrderServicePackageRefundByOrderServicePackageId(orderServicePackageId int64) (m *model.OrderServicePackageRefund, err error) {
|
||||||
|
err = global.Db.Where("order_service_id = ?", orderServicePackageId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundByOrderNo 获取数据-系统订单id
|
||||||
|
func (r *OrderServicePackageRefundDao) GetOrderServicePackageRefundByOrderNo(orderNo int64) (m *model.OrderServicePackageRefund, err error) {
|
||||||
|
err = global.Db.Where("order_service_no = ?", orderNo).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOrderServicePackageRefund 删除
|
||||||
|
func (r *OrderServicePackageRefundDao) DeleteOrderServicePackageRefund(tx *gorm.DB, maps interface{}) error {
|
||||||
|
err := tx.Where(maps).Delete(&model.OrderServicePackageRefund{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageRefund 修改
|
||||||
|
func (r *OrderServicePackageRefundDao) EditOrderServicePackageRefund(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageRefund{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageRefundByOrderServicePackageId 修改-id
|
||||||
|
func (r *OrderServicePackageRefundDao) EditOrderServicePackageRefundByOrderServicePackageId(tx *gorm.DB, orderServicePackageId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageRefund{}).Where("order_service_id = ?", orderServicePackageId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditOrderServicePackageRefundById 修改-药品订单id
|
||||||
|
func (r *OrderServicePackageRefundDao) EditOrderServicePackageRefundById(tx *gorm.DB, orderNo string, data interface{}) error {
|
||||||
|
err := tx.Model(&model.OrderServicePackageRefund{}).Where("order_service_no = ?", orderNo).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundList 获取列表
|
||||||
|
func (r *OrderServicePackageRefundDao) GetOrderServicePackageRefundList(maps interface{}) (m []*model.OrderServicePackageRefund, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddOrderServicePackageRefund 新增
|
||||||
|
func (r *OrderServicePackageRefundDao) AddOrderServicePackageRefund(tx *gorm.DB, model *model.OrderServicePackageRefund) (*model.OrderServicePackageRefund, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
64
api/dao/popup.go
Normal file
64
api/dao/popup.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PopupDao struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPopupById 获取数据-id
|
||||||
|
func (r *PopupDao) GetPopupById(popupId int64) (m *model.Popup, err error) {
|
||||||
|
err = global.Db.First(&m, popupId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPopupPreloadById 获取数据-加载全部关联-id
|
||||||
|
func (r *PopupDao) GetPopupPreloadById(popupId int64) (m *model.Popup, err error) {
|
||||||
|
err = global.Db.Preload(clause.Associations).First(&m, popupId).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditPopup 修改
|
||||||
|
func (r *PopupDao) EditPopup(tx *gorm.DB, maps interface{}, data interface{}) error {
|
||||||
|
err := tx.Model(&model.Popup{}).Where(maps).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// EditPopupByOrderServicePackageId 修改-id
|
||||||
|
func (r *PopupDao) EditPopupByOrderServicePackageId(tx *gorm.DB, popupId int64, data interface{}) error {
|
||||||
|
err := tx.Model(&model.Popup{}).Where("popup_id = ?", popupId).Updates(data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetPopupList 获取列表
|
||||||
|
func (r *PopupDao) GetPopupList(maps interface{}) (m []*model.Popup, err error) {
|
||||||
|
err = global.Db.Where(maps).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddPopup 新增
|
||||||
|
func (r *PopupDao) AddPopup(tx *gorm.DB, model *model.Popup) (*model.Popup, error) {
|
||||||
|
if err := tx.Create(model).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return model, nil
|
||||||
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/api/requests"
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProductDao struct {
|
type ProductDao struct {
|
||||||
@ -105,6 +107,11 @@ func (r *ProductDao) GetProductPageSearch(req requests.GetProductPage, page, pag
|
|||||||
query = query.Where("product_type = ?", req.ProductType)
|
query = query.Where("product_type = ?", req.ProductType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 是否麻精药品
|
||||||
|
if req.IsMajing != nil {
|
||||||
|
query = query.Where("is_majing = ?", req.IsMajing)
|
||||||
|
}
|
||||||
|
|
||||||
// 商品状态
|
// 商品状态
|
||||||
if req.ProductStatus != nil {
|
if req.ProductStatus != nil {
|
||||||
query = query.Where("product_status = ?", req.ProductStatus)
|
query = query.Where("product_status = ?", req.ProductStatus)
|
||||||
@ -141,7 +148,15 @@ func (r *ProductDao) GetProductPageSearch(req requests.GetProductPage, page, pag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 排序
|
// 排序
|
||||||
query = query.Order("created_at desc")
|
if req.Order != nil {
|
||||||
|
if req.Order.Stock != "" {
|
||||||
|
query = query.Joins("JOIN gdxz_product_platform_amount ON gdxz_product_platform_amount.product_platform_id = gdxz_product.product_platform_id").
|
||||||
|
Order("gdxz_product_platform_amount.stock " + req.Order.Stock)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Order("gdxz_product.created_at desc")
|
||||||
|
|
||||||
// 查询总数量
|
// 查询总数量
|
||||||
if err := query.Count(&totalRecords).Error; err != nil {
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
@ -154,3 +169,177 @@ func (r *ProductDao) GetProductPageSearch(req requests.GetProductPage, page, pag
|
|||||||
}
|
}
|
||||||
return m, totalRecords, nil
|
return m, totalRecords, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetProductExportListSearch 获取商品列表-导出
|
||||||
|
func (r *ProductDao) GetProductExportListSearch(req requests.ProductExportList) (m []*model.Product, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.Product{})
|
||||||
|
|
||||||
|
// 库存表
|
||||||
|
query = query.Preload("ProductPlatformAmount", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("amount_id", "product_platform_id", "product_platform_code", "stock")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 当前搜索数据
|
||||||
|
if req.Type == 1 {
|
||||||
|
// 商品名称
|
||||||
|
if req.ProductName != "" {
|
||||||
|
query = query.Where("product_name LIKE ?", "%"+req.ProductName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品通用名
|
||||||
|
if req.CommonName != "" {
|
||||||
|
query = query.Where("common_name LIKE ?", "%"+req.CommonName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品助记码
|
||||||
|
if req.MnemonicCode != "" {
|
||||||
|
query = query.Where("mnemonic_code LIKE ?", "%"+req.MnemonicCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 药品类型
|
||||||
|
if req.ProductType != nil {
|
||||||
|
query = query.Where("product_type = ?", req.ProductType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品状态
|
||||||
|
if req.ProductStatus != nil {
|
||||||
|
query = query.Where("product_status = ?", req.ProductStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 平台商品id
|
||||||
|
if req.ProductPlatformId != "" {
|
||||||
|
query = query.Where("product_platform_id = ?", req.ProductPlatformId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处方平台编码
|
||||||
|
if req.ProductPlatformCode != "" {
|
||||||
|
query = query.Where("product_platform_code LIKE ?", "%"+req.ProductPlatformCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 药店编码
|
||||||
|
if req.ProductPharmacyCode != "" {
|
||||||
|
query = query.Where("product_pharmacy_code LIKE ?", "%"+req.ProductPharmacyCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批准文号
|
||||||
|
if req.LicenseNumber != "" {
|
||||||
|
query = query.Where("license_number LIKE ?", "%"+req.LicenseNumber+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生产厂家
|
||||||
|
if req.Manufacturer != "" {
|
||||||
|
query = query.Where("manufacturer LIKE ?", "%"+req.Manufacturer+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品备注
|
||||||
|
if req.ProductRemarks != "" {
|
||||||
|
query = query.Where("product_remarks LIKE ?", "%"+req.ProductRemarks+"%")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前选中数据
|
||||||
|
if req.Type == 2 {
|
||||||
|
if req.Id == "" {
|
||||||
|
return nil, errors.New("未提供需导出数据编号")
|
||||||
|
}
|
||||||
|
|
||||||
|
id := strings.Split(req.Id, ",")
|
||||||
|
query = query.Where("product_id IN (?)", id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
err = query.Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetProductListSearch 获取系统商品列表-限制条数
|
||||||
|
func (r *ProductDao) GetProductListSearch(req requests.GetProductList) (m []*model.Product, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.Product{})
|
||||||
|
|
||||||
|
// 库存表
|
||||||
|
query = query.Preload("ProductPlatformAmount", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Select("amount_id", "product_platform_id", "product_platform_code", "stock")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 商品id
|
||||||
|
if req.ProductId != "" {
|
||||||
|
query = query.Where("product_id = ?", req.ProductId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品名称
|
||||||
|
if req.ProductName != "" {
|
||||||
|
query = query.Where("product_name LIKE ?", "%"+req.ProductName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品通用名
|
||||||
|
if req.CommonName != "" {
|
||||||
|
query = query.Where("common_name LIKE ?", "%"+req.CommonName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品助记码
|
||||||
|
if req.MnemonicCode != "" {
|
||||||
|
query = query.Where("mnemonic_code LIKE ?", "%"+req.MnemonicCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 药品类型
|
||||||
|
if req.ProductType != nil {
|
||||||
|
query = query.Where("product_type = ?", req.ProductType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否麻精药品
|
||||||
|
if req.IsMajing != nil {
|
||||||
|
query = query.Where("is_majing = ?", req.IsMajing)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品状态
|
||||||
|
if req.ProductStatus != nil {
|
||||||
|
query = query.Where("product_status = ?", req.ProductStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 平台商品id
|
||||||
|
if req.ProductPlatformId != "" {
|
||||||
|
query = query.Where("product_platform_id = ?", req.ProductPlatformId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处方平台编码
|
||||||
|
if req.ProductPlatformCode != "" {
|
||||||
|
query = query.Where("product_platform_code LIKE ?", "%"+req.ProductPlatformCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 药店编码
|
||||||
|
if req.ProductPharmacyCode != "" {
|
||||||
|
query = query.Where("product_pharmacy_code LIKE ?", "%"+req.ProductPharmacyCode+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批准文号
|
||||||
|
if req.LicenseNumber != "" {
|
||||||
|
query = query.Where("license_number LIKE ?", "%"+req.LicenseNumber+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生产厂家
|
||||||
|
if req.Manufacturer != "" {
|
||||||
|
query = query.Where("manufacturer LIKE ?", "%"+req.Manufacturer+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 商品备注
|
||||||
|
if req.ProductRemarks != "" {
|
||||||
|
query = query.Where("product_remarks LIKE ?", "%"+req.ProductRemarks+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Order("gdxz_product.created_at desc")
|
||||||
|
|
||||||
|
err = query.Limit(req.Limit).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -4,7 +4,10 @@ import (
|
|||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/api/requests"
|
||||||
"hospital-admin-api/global"
|
"hospital-admin-api/global"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserCouponDao struct {
|
type UserCouponDao struct {
|
||||||
@ -72,6 +75,15 @@ func (r *UserCouponDao) GetUserCouponList(maps interface{}) (m []*model.UserCoup
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserCoupon 获取
|
||||||
|
func (r *UserCouponDao) GetUserCoupon(maps interface{}) (m *model.UserCoupon, err error) {
|
||||||
|
err = global.Db.Where(maps).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// AddUserCoupon 新增用户优惠卷
|
// AddUserCoupon 新增用户优惠卷
|
||||||
func (r *UserCouponDao) AddUserCoupon(tx *gorm.DB, model *model.UserCoupon) (*model.UserCoupon, error) {
|
func (r *UserCouponDao) AddUserCoupon(tx *gorm.DB, model *model.UserCoupon) (*model.UserCoupon, error) {
|
||||||
if err := tx.Create(model).Error; err != nil {
|
if err := tx.Create(model).Error; err != nil {
|
||||||
@ -79,3 +91,158 @@ func (r *UserCouponDao) AddUserCoupon(tx *gorm.DB, model *model.UserCoupon) (*mo
|
|||||||
}
|
}
|
||||||
return model, nil
|
return model, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserAllObjectTypeCoupon 获取用户某一类型优惠卷
|
||||||
|
func (r *UserCouponDao) GetUserAllObjectTypeCoupon(userId int64, distributionObject int) (m []*model.UserCoupon, err error) {
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.UserCoupon{})
|
||||||
|
|
||||||
|
query = query.Preload("Coupon")
|
||||||
|
|
||||||
|
// 用户优惠卷搜索条件
|
||||||
|
query = query.Where("user_id = ?", userId)
|
||||||
|
|
||||||
|
// 获取当前时间
|
||||||
|
currentTime := time.Now()
|
||||||
|
|
||||||
|
// 格式化时间为 "Y-m-d H:i:s"
|
||||||
|
formattedTime := currentTime.Format("2006-01-02 15:04:05")
|
||||||
|
|
||||||
|
query = query.Where("valid_start_time < ?", formattedTime) // 有效使用时间
|
||||||
|
query = query.Where("valid_end_time > ?", formattedTime) // 过期使用时间
|
||||||
|
|
||||||
|
// 优惠卷搜索条件
|
||||||
|
subQuery := global.Db.Model(&model.Coupon{}).
|
||||||
|
Where("gdxz_user_coupon.coupon_id = gdxz_coupon.coupon_id").
|
||||||
|
Where("gdxz_coupon.distribution_object = ?", distributionObject).
|
||||||
|
Where("gdxz_coupon.coupon_client = ?", 1).
|
||||||
|
Where("gdxz_coupon.coupon_status = ?", 1)
|
||||||
|
|
||||||
|
query = query.Where("EXISTS (?)", subQuery)
|
||||||
|
|
||||||
|
query = query.Group("coupon_id")
|
||||||
|
|
||||||
|
err = query.Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserCouponPageSearch 获取用户优惠卷列表-分页
|
||||||
|
func (r *UserCouponDao) GetUserCouponPageSearch(req requests.GetUserCouponPage, page, pageSize int) (m []*model.UserCoupon, total int64, err error) {
|
||||||
|
var totalRecords int64
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.UserCoupon{})
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
query = query.Preload("Coupon")
|
||||||
|
|
||||||
|
// 优惠卷名称
|
||||||
|
if req.CouponName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.Coupon{}).
|
||||||
|
Select("coupon_id").
|
||||||
|
Where("coupon_name LIKE ?", "%"+req.CouponName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("coupon_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 优惠卷编号
|
||||||
|
if req.CouponId != "" {
|
||||||
|
query = query.Where("coupon_id = ?", req.CouponId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用状态
|
||||||
|
if req.UserCouponStatus != nil {
|
||||||
|
query = query.Where("user_coupon_status = ?", req.UserCouponStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用时间
|
||||||
|
if req.CouponUseDate != "" {
|
||||||
|
couponUseDate := strings.Split(req.CouponUseDate, "&")
|
||||||
|
if len(couponUseDate) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", couponUseDate[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", couponUseDate[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("coupon_use_date BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 有效使用时间
|
||||||
|
if req.ValidStartTime != "" {
|
||||||
|
validStartTime := strings.Split(req.ValidStartTime, "&")
|
||||||
|
if len(validStartTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", validStartTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", validStartTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("valid_start_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过期使用时间
|
||||||
|
if req.ValidEndTime != "" {
|
||||||
|
validEndTime := strings.Split(req.ValidEndTime, "&")
|
||||||
|
if len(validEndTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", validEndTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", validEndTime[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("valid_end_time BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
if req.CreatedAt != "" {
|
||||||
|
createdAt := strings.Split(req.CreatedAt, "&")
|
||||||
|
if len(createdAt) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", createdAt[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", createdAt[1])
|
||||||
|
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
|
||||||
|
query = query.Where("created_at BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
subQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile LIKE ?", "%"+req.Mobile+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户名
|
||||||
|
if req.UserName != "" {
|
||||||
|
subQuery := global.Db.Model(&model.UserPatient{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("user_name LIKE ?", "%"+req.UserName+"%")
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
// 查询总数量
|
||||||
|
if err := query.Count(&totalRecords).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = query.Scopes(model.Paginate(page, pageSize)).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
return m, totalRecords, nil
|
||||||
|
}
|
||||||
|
|||||||
@ -366,6 +366,11 @@ func (r *UserDoctorDao) GetUserDoctorListSearch(req requests.GetUserDoctorList)
|
|||||||
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
return db.Select("hospital_id,hospital_name,hospital_level_name")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 医生id
|
||||||
|
if req.DoctorId != "" {
|
||||||
|
query = query.Where("doctor_id = ?", req.DoctorId)
|
||||||
|
}
|
||||||
|
|
||||||
// 用户名称
|
// 用户名称
|
||||||
if req.UserName != "" {
|
if req.UserName != "" {
|
||||||
query = query.Where("user_name LIKE ?", "%"+req.UserName+"%")
|
query = query.Where("user_name LIKE ?", "%"+req.UserName+"%")
|
||||||
|
|||||||
@ -235,3 +235,67 @@ func (r *UserPatientDao) GetUserPatientExportListSearch(req requests.UserPatient
|
|||||||
|
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserPatientByUserId 获取患者数据-id
|
||||||
|
func (r *UserPatientDao) GetUserPatientByUserId(userId int64) (m *model.UserPatient, err error) {
|
||||||
|
err = global.Db.Where("user_id = ?", userId).First(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserPatientListSearch 获取患者列表-限制条数
|
||||||
|
func (r *UserPatientDao) GetUserPatientListSearch(req requests.GetUserPatientList) (m []*model.UserPatient, err error) {
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
query := global.Db.Model(&model.UserPatient{}).Omit("open_id", "union_id", "wx_session_key")
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
query = query.Preload("User", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.Omit("user_password", "salt")
|
||||||
|
})
|
||||||
|
|
||||||
|
// 用户名称
|
||||||
|
if req.UserName != "" {
|
||||||
|
query = query.Where("user_name LIKE ?", "%"+req.UserName+"%")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 手机号
|
||||||
|
if req.Mobile != "" {
|
||||||
|
subQuery := global.Db.Model(&model.User{}).
|
||||||
|
Select("user_id").
|
||||||
|
Where("mobile = ?", req.Mobile)
|
||||||
|
|
||||||
|
query = query.Where(gorm.Expr("user_id IN (?)", subQuery))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户状态
|
||||||
|
if req.Status != nil {
|
||||||
|
query = query.Where("status = ?", req.Status)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注册时间
|
||||||
|
if req.CreatedAt != "" {
|
||||||
|
cancelTime := strings.Split(req.CreatedAt, "&")
|
||||||
|
if len(cancelTime) == 2 {
|
||||||
|
startTime, _ := time.Parse("2006-01-02", cancelTime[0])
|
||||||
|
endTime, _ := time.Parse("2006-01-02", cancelTime[1])
|
||||||
|
|
||||||
|
if startTime == endTime {
|
||||||
|
endTime = endTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
|
||||||
|
}
|
||||||
|
|
||||||
|
query = query.Where("created_at BETWEEN ? AND ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序
|
||||||
|
query = query.Order("created_at desc")
|
||||||
|
|
||||||
|
err = query.Limit(10).Find(&m).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|||||||
99
api/dto/CouponGrant.go
Normal file
99
api/dto/CouponGrant.go
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/dao"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CouponGrantDto 发放优惠券表
|
||||||
|
type CouponGrantDto struct {
|
||||||
|
GrantId string `json:"grant_id"` // 主键id
|
||||||
|
CouponId string `json:"coupon_id"` // 优惠卷id
|
||||||
|
GrantType int `json:"grant_type"` // 发放类型(1:具体用户 2:未拥有用户)
|
||||||
|
UserId string `json:"user_id"` // 用户id(发放类型为具体用户时存在)
|
||||||
|
TotalQuantity int `json:"total_quantity"` // 目标发放数量
|
||||||
|
GrantQuantity int `json:"grant_quantity"` // 已发放数量
|
||||||
|
GrantResult int `json:"grant_result"` // 发放结果(1:成功 2:发放中 3:部分 4:失败)
|
||||||
|
StopReason string `json:"stop_reason"` // 停止原因
|
||||||
|
AdminUserId string `json:"admin_user_id"` // 后台操作用户id
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
UserName string `json:"user_name"` // 用户名称
|
||||||
|
AdminUserName string `json:"admin_user_name"` // 操作人名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantDto 优惠卷详情
|
||||||
|
func GetCouponGrantDto(m *model.CouponGrant) *CouponGrantDto {
|
||||||
|
return &CouponGrantDto{
|
||||||
|
GrantId: fmt.Sprintf("%d", m.GrantId),
|
||||||
|
CouponId: fmt.Sprintf("%d", m.CouponId),
|
||||||
|
GrantType: m.GrantType,
|
||||||
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
|
TotalQuantity: m.TotalQuantity,
|
||||||
|
GrantQuantity: m.GrantQuantity,
|
||||||
|
GrantResult: m.GrantResult,
|
||||||
|
StopReason: m.StopReason,
|
||||||
|
AdminUserId: fmt.Sprintf("%d", m.AdminUserId),
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponGrantListDto 优惠卷列表
|
||||||
|
func GetCouponGrantListDto(m []*model.CouponGrant) []*CouponGrantDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*CouponGrantDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &CouponGrantDto{
|
||||||
|
GrantId: fmt.Sprintf("%d", v.GrantId),
|
||||||
|
CouponId: fmt.Sprintf("%d", v.CouponId),
|
||||||
|
GrantType: v.GrantType,
|
||||||
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
|
TotalQuantity: v.TotalQuantity,
|
||||||
|
GrantQuantity: v.GrantQuantity,
|
||||||
|
GrantResult: v.GrantResult,
|
||||||
|
StopReason: v.StopReason,
|
||||||
|
AdminUserId: fmt.Sprintf("%d", v.AdminUserId),
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.User != nil {
|
||||||
|
response.LoadUserAttr(v.User)
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.AdminUserId != 0 {
|
||||||
|
response.LoadAdminUserName(v.AdminUserId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserAttr 加载用户属性
|
||||||
|
func (r *CouponGrantDto) LoadUserAttr(m *model.User) *CouponGrantDto {
|
||||||
|
if m != nil {
|
||||||
|
r.UserName = m.UserName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadAdminUserName 加载后台用户属性
|
||||||
|
func (r *CouponGrantDto) LoadAdminUserName(adminUserId int64) *CouponGrantDto {
|
||||||
|
if adminUserId != 0 {
|
||||||
|
// 获取后台操作人记录
|
||||||
|
adminUserDao := dao.AdminUserDao{}
|
||||||
|
adminUser, _ := adminUserDao.GetAdminUserFirstById(adminUserId)
|
||||||
|
if adminUser != nil {
|
||||||
|
r.AdminUserName = adminUser.NickName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
89
api/dto/DoctorConfigFollowPackage.go
Normal file
89
api/dto/DoctorConfigFollowPackage.go
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigFollowPackageDto 医生配置-健康包
|
||||||
|
type DoctorConfigFollowPackageDto struct {
|
||||||
|
FollowPackageId string `json:"follow_package_id"` // 主键id
|
||||||
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
MonthlyFrequency int `json:"monthly_frequency"` // 每月次数(0表示不限次)
|
||||||
|
ServiceRounds int `json:"service_rounds"` // 服务回合数(0表示不限次)
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||||
|
DoctorInquiryConfig *DoctorInquiryConfigDto `json:"doctor_inquiry_config"` // 医生问诊配置数据
|
||||||
|
DoctorConfigFollowPackageItem []*DoctorConfigFollowPackageItemDto `json:"doctor_config_follow_package_item"` // 医生随访包配置明细数据
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigFollowPackageDto(m *model.DoctorConfigFollowPackage) *DoctorConfigFollowPackageDto {
|
||||||
|
return &DoctorConfigFollowPackageDto{
|
||||||
|
FollowPackageId: fmt.Sprintf("%d", m.FollowPackageId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||||
|
MonthlyFrequency: m.MonthlyFrequency,
|
||||||
|
ServiceRounds: m.ServiceRounds,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigFollowPackageListDto(m []*model.DoctorConfigFollowPackage) []*DoctorConfigFollowPackageDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*DoctorConfigFollowPackageDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &DoctorConfigFollowPackageDto{
|
||||||
|
FollowPackageId: fmt.Sprintf("%d", v.FollowPackageId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
MonthlyFrequency: v.MonthlyFrequency,
|
||||||
|
ServiceRounds: v.ServiceRounds,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.UserDoctor != nil {
|
||||||
|
response.LoadUserDoctor(v.UserDoctor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserDoctor 加载医生数据
|
||||||
|
func (r *DoctorConfigFollowPackageDto) LoadUserDoctor(m *model.UserDoctor) *DoctorConfigFollowPackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.UserDoctor = GetUserDoctorDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserDoctorHospital 加载医生医院数据
|
||||||
|
func (r *DoctorConfigFollowPackageDto) LoadUserDoctorHospital(m *model.Hospital) *DoctorConfigFollowPackageDto {
|
||||||
|
if m != nil && r.UserDoctor != nil {
|
||||||
|
r.UserDoctor.Hospital = GetHospitalDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorInquiryConfig 加载医生问诊配置
|
||||||
|
func (r *DoctorConfigFollowPackageDto) LoadDoctorInquiryConfig(m *model.DoctorInquiryConfig) *DoctorConfigFollowPackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorInquiryConfig = GetDoctorInquiryConfigDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorConfigFollowPackageItem 加载医生随访包列表配置
|
||||||
|
func (r *DoctorConfigFollowPackageDto) LoadDoctorConfigFollowPackageItem(m []*model.DoctorConfigFollowPackageItem) *DoctorConfigFollowPackageDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
r.DoctorConfigFollowPackageItem = GetDoctorConfigFollowPackageItemListDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
50
api/dto/DoctorConfigFollowPackageItem.go
Normal file
50
api/dto/DoctorConfigFollowPackageItem.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigFollowPackageItemDto 医生配置-随访包-明细
|
||||||
|
type DoctorConfigFollowPackageItemDto struct {
|
||||||
|
FollowPackageItemId string `json:"follow_package_item_id"` // 主键id
|
||||||
|
FollowPackageId string `json:"follow_package_id"` // 医生随访包id
|
||||||
|
ServicePeriod int `json:"service_period"` // 服务周期(天)
|
||||||
|
ServicePrice float64 `json:"service_price"` // 服务价格
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigFollowPackageItemDto(m *model.DoctorConfigFollowPackageItem) *DoctorConfigFollowPackageItemDto {
|
||||||
|
return &DoctorConfigFollowPackageItemDto{
|
||||||
|
FollowPackageItemId: fmt.Sprintf("%d", m.FollowPackageItemId),
|
||||||
|
FollowPackageId: fmt.Sprintf("%d", m.FollowPackageId),
|
||||||
|
ServicePeriod: m.ServicePeriod,
|
||||||
|
ServicePrice: m.ServicePrice,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigFollowPackageItemListDto(m []*model.DoctorConfigFollowPackageItem) []*DoctorConfigFollowPackageItemDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*DoctorConfigFollowPackageItemDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &DoctorConfigFollowPackageItemDto{
|
||||||
|
FollowPackageItemId: fmt.Sprintf("%d", v.FollowPackageItemId),
|
||||||
|
FollowPackageId: fmt.Sprintf("%d", v.FollowPackageId),
|
||||||
|
ServicePeriod: v.ServicePeriod,
|
||||||
|
ServicePrice: v.ServicePrice,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
97
api/dto/DoctorConfigHealthPackage.go
Normal file
97
api/dto/DoctorConfigHealthPackage.go
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigHealthPackageDto 医生配置-健康包
|
||||||
|
type DoctorConfigHealthPackageDto struct {
|
||||||
|
HealthPackageId string `json:"health_package_id"` // 主键id
|
||||||
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
PackageId string `json:"package_id"` // 健康包配置id
|
||||||
|
ServicePrice float64 `json:"service_price"` // 服务价格(根据图文问诊价格计算)
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
HealthPackage *HealthPackageDto `json:"health_package"` // 健康包
|
||||||
|
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||||
|
DoctorInquiryConfig *DoctorInquiryConfigDto `json:"doctor_inquiry_config"` // 医生问诊配置数据
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigHealthPackageDto(m *model.DoctorConfigHealthPackage) *DoctorConfigHealthPackageDto {
|
||||||
|
return &DoctorConfigHealthPackageDto{
|
||||||
|
HealthPackageId: fmt.Sprintf("%d", m.HealthPackageId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||||
|
PackageId: fmt.Sprintf("%d", m.PackageId),
|
||||||
|
ServicePrice: m.ServicePrice,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDoctorConfigHealthPackageListDto(m []*model.DoctorConfigHealthPackage) []*DoctorConfigHealthPackageDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*DoctorConfigHealthPackageDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &DoctorConfigHealthPackageDto{
|
||||||
|
HealthPackageId: fmt.Sprintf("%d", v.HealthPackageId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
PackageId: fmt.Sprintf("%d", v.PackageId),
|
||||||
|
ServicePrice: v.ServicePrice,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.HealthPackage != nil {
|
||||||
|
response.LoadHealthPackage(v.HealthPackage)
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.UserDoctor != nil {
|
||||||
|
response.LoadUserDoctor(v.UserDoctor)
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.UserDoctor.Hospital != nil {
|
||||||
|
response.LoadUserDoctorHospital(v.UserDoctor.Hospital)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadHealthPackage 加载健康包
|
||||||
|
func (r *DoctorConfigHealthPackageDto) LoadHealthPackage(m *model.HealthPackage) *DoctorConfigHealthPackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.HealthPackage = GetHealthPackageDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserDoctor 加载医生数据
|
||||||
|
func (r *DoctorConfigHealthPackageDto) LoadUserDoctor(m *model.UserDoctor) *DoctorConfigHealthPackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.UserDoctor = GetUserDoctorDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserDoctorHospital 加载医生医院数据
|
||||||
|
func (r *DoctorConfigHealthPackageDto) LoadUserDoctorHospital(m *model.Hospital) *DoctorConfigHealthPackageDto {
|
||||||
|
if m != nil && r.UserDoctor != nil {
|
||||||
|
r.UserDoctor.Hospital = GetHospitalDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorInquiryConfig 加载医生问诊配置
|
||||||
|
func (r *DoctorConfigHealthPackageDto) LoadDoctorInquiryConfig(m *model.DoctorInquiryConfig) *DoctorConfigHealthPackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorInquiryConfig = GetDoctorInquiryConfigDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
@ -14,7 +14,7 @@ type DoctorInquiryConfigDto struct {
|
|||||||
IsEnable int `json:"is_enable"` // 是否启用(0:否 1:是)
|
IsEnable int `json:"is_enable"` // 是否启用(0:否 1:是)
|
||||||
LastEnableMethod int `json:"last_enable_method"` // 最后开启方式(1:自己 2:后台)
|
LastEnableMethod int `json:"last_enable_method"` // 最后开启方式(1:自己 2:后台)
|
||||||
WorkNumDay int `json:"work_num_day"` // 每日接诊数量
|
WorkNumDay int `json:"work_num_day"` // 每日接诊数量
|
||||||
InquiryPrice float64 `json:"inquiry_price"` // 接诊价格(专家问诊-公益问诊)
|
InquiryPrice *float64 `json:"inquiry_price"` // 接诊价格(专家问诊-公益问诊)
|
||||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
DoctorName string `json:"doctor_name"` // 医生姓名
|
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||||
|
|||||||
68
api/dto/HealthPackage.go
Normal file
68
api/dto/HealthPackage.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HealthPackageDto struct {
|
||||||
|
PackageId string `json:"package_id"` // 主键id
|
||||||
|
ServiceCount int `json:"service_count"` // 总服务次数
|
||||||
|
MonthlyFrequency int `json:"monthly_frequency"` // 每月次数
|
||||||
|
EffectiveDays string `json:"effective_days"` // 服务有效天数
|
||||||
|
ServiceRate string `json:"service_rate"` // 服务费率。100为满值,表示1,正常费率。
|
||||||
|
DiscountProductTotalAmount float64 `json:"discount_product_total_amount"` // 折扣商品总价格
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
HealthPackageProduct []*HealthPackageProductDto `json:"health_package_product"` // 健康包-关联商品
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetHealthPackageDto(m *model.HealthPackage) *HealthPackageDto {
|
||||||
|
return &HealthPackageDto{
|
||||||
|
PackageId: fmt.Sprintf("%d", m.PackageId),
|
||||||
|
ServiceCount: m.ServiceCount,
|
||||||
|
MonthlyFrequency: m.MonthlyFrequency,
|
||||||
|
EffectiveDays: m.EffectiveDays,
|
||||||
|
ServiceRate: m.ServiceRate,
|
||||||
|
DiscountProductTotalAmount: m.DiscountProductTotalAmount,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetHealthPackageListDto(m []*model.HealthPackage) []*HealthPackageDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*HealthPackageDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &HealthPackageDto{
|
||||||
|
PackageId: fmt.Sprintf("%d", v.PackageId),
|
||||||
|
ServiceCount: v.ServiceCount,
|
||||||
|
MonthlyFrequency: v.MonthlyFrequency,
|
||||||
|
EffectiveDays: v.EffectiveDays,
|
||||||
|
ServiceRate: v.ServiceRate,
|
||||||
|
DiscountProductTotalAmount: v.DiscountProductTotalAmount,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(v.HealthPackageProduct) > 0 {
|
||||||
|
response.LoadHealthPackageProduct(v.HealthPackageProduct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadHealthPackageProduct 加载健康包-关联商品
|
||||||
|
func (r *HealthPackageDto) LoadHealthPackageProduct(m []*model.HealthPackageProduct) *HealthPackageDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
r.HealthPackageProduct = GetHealthPackageProductListDto(m)
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
56
api/dto/HealthPackageProduct.go
Normal file
56
api/dto/HealthPackageProduct.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HealthPackageProductDto 健康包-关联商品
|
||||||
|
type HealthPackageProductDto struct {
|
||||||
|
PackageProductId string `json:"package_product_id"` // 主键id
|
||||||
|
PackageId string `json:"package_id"` // 健康包id
|
||||||
|
ProductId string `json:"product_id"` // 商品id
|
||||||
|
ProductName string `json:"product_name"` // 商品名称
|
||||||
|
Quantity int `json:"quantity"` // 数量
|
||||||
|
DiscountProductPrice float64 `json:"discount_product_price"` // 折扣商品价格
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetHealthPackageProductDto(m *model.HealthPackageProduct) *HealthPackageProductDto {
|
||||||
|
return &HealthPackageProductDto{
|
||||||
|
PackageProductId: fmt.Sprintf("%d", m.PackageProductId),
|
||||||
|
PackageId: fmt.Sprintf("%d", m.PackageId),
|
||||||
|
ProductId: fmt.Sprintf("%d", m.ProductId),
|
||||||
|
ProductName: m.ProductName,
|
||||||
|
Quantity: m.Quantity,
|
||||||
|
DiscountProductPrice: m.DiscountProductPrice,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetHealthPackageProductListDto(m []*model.HealthPackageProduct) []*HealthPackageProductDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*HealthPackageProductDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &HealthPackageProductDto{
|
||||||
|
PackageProductId: fmt.Sprintf("%d", v.PackageProductId),
|
||||||
|
PackageId: fmt.Sprintf("%d", v.PackageId),
|
||||||
|
ProductId: fmt.Sprintf("%d", v.ProductId),
|
||||||
|
ProductName: v.ProductName,
|
||||||
|
Quantity: v.Quantity,
|
||||||
|
DiscountProductPrice: v.DiscountProductPrice,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
type OrderInquiryDto struct {
|
type OrderInquiryDto struct {
|
||||||
OrderInquiryId string `json:"order_inquiry_id"` // 主键id
|
OrderInquiryId string `json:"order_inquiry_id"` // 主键id
|
||||||
|
OrderId string `json:"order_id"` // 订单id
|
||||||
UserId string `json:"user_id"` // 用户id-患者
|
UserId string `json:"user_id"` // 用户id-患者
|
||||||
PatientId string `json:"patient_id"` // 患者id
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
DoctorId string `json:"doctor_id"` // 医生id(未分配时为null)
|
||||||
@ -62,6 +63,7 @@ func GetOrderInquiryDto(m *model.OrderInquiry) *OrderInquiryDto {
|
|||||||
|
|
||||||
return &OrderInquiryDto{
|
return &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", m.UserId),
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
DoctorId: doctorId,
|
DoctorId: doctorId,
|
||||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
@ -107,6 +109,7 @@ func GetOrderInquiryListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
|||||||
for i, v := range m {
|
for i, v := range m {
|
||||||
response := &OrderInquiryDto{
|
response := &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
@ -165,6 +168,7 @@ func GetOrderInquiryRecordListDto(m []*model.OrderInquiry) []*OrderInquiryDto {
|
|||||||
for i, v := range m {
|
for i, v := range m {
|
||||||
response := &OrderInquiryDto{
|
response := &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
@ -220,6 +224,7 @@ func GetOrderInquiryForAccountListDto(m []*model.OrderInquiry) []*OrderInquiryDt
|
|||||||
for i, v := range m {
|
for i, v := range m {
|
||||||
response := &OrderInquiryDto{
|
response := &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", v.UserId),
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
PatientId: fmt.Sprintf("%d", v.PatientId),
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
@ -276,6 +281,7 @@ func GetOrderInquiryRecordDto(m *model.OrderInquiry) *OrderInquiryDto {
|
|||||||
|
|
||||||
return &OrderInquiryDto{
|
return &OrderInquiryDto{
|
||||||
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
UserId: fmt.Sprintf("%d", m.UserId),
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
DoctorId: doctorId,
|
DoctorId: doctorId,
|
||||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
@ -331,7 +337,7 @@ func (r *OrderInquiryDto) LoadUserName(m *model.User) *OrderInquiryDto {
|
|||||||
// LoadOrderInquiryRefund 加载订单退款数据
|
// LoadOrderInquiryRefund 加载订单退款数据
|
||||||
func (r *OrderInquiryDto) LoadOrderInquiryRefund(m *model.OrderInquiryRefund) *OrderInquiryDto {
|
func (r *OrderInquiryDto) LoadOrderInquiryRefund(m *model.OrderInquiryRefund) *OrderInquiryDto {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
d := GetOrderInquiryRefundBankDto(m)
|
d := GetOrderInquiryRefundDto(m)
|
||||||
|
|
||||||
r.OrderInquiryRefund = d
|
r.OrderInquiryRefund = d
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import (
|
|||||||
"hospital-admin-api/api/dao"
|
"hospital-admin-api/api/dao"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
"hospital-admin-api/utils"
|
"hospital-admin-api/utils"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderInquiryCaseDto struct {
|
type OrderInquiryCaseDto struct {
|
||||||
@ -25,7 +24,7 @@ type OrderInquiryCaseDto struct {
|
|||||||
DiseaseClassName string `json:"disease_class_name"` // 疾病名称-系统
|
DiseaseClassName string `json:"disease_class_name"` // 疾病名称-系统
|
||||||
DiagnosisDate model.LocalTime `json:"diagnosis_date"` // 确诊日期
|
DiagnosisDate model.LocalTime `json:"diagnosis_date"` // 确诊日期
|
||||||
DiseaseDesc string `json:"disease_desc"` // 病情描述(主诉)
|
DiseaseDesc string `json:"disease_desc"` // 病情描述(主诉)
|
||||||
DiagnoseImages []*string `json:"diagnose_images"` // 复诊凭证(多个使用逗号分隔)
|
DiagnoseImages string `json:"diagnose_images"` // 复诊凭证(多个使用逗号分隔)
|
||||||
IsAllergyHistory *int `json:"is_allergy_history"` // 是否存在过敏史(0:否 1:是)
|
IsAllergyHistory *int `json:"is_allergy_history"` // 是否存在过敏史(0:否 1:是)
|
||||||
AllergyHistory string `json:"allergy_history"` // 过敏史描述
|
AllergyHistory string `json:"allergy_history"` // 过敏史描述
|
||||||
IsFamilyHistory *int `json:"is_family_history"` // 是否存在家族病史(0:否 1:是)
|
IsFamilyHistory *int `json:"is_family_history"` // 是否存在家族病史(0:否 1:是)
|
||||||
@ -48,16 +47,6 @@ type OrderInquiryCaseDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetOrderInquiryCaseDto(m *model.OrderInquiryCase) *OrderInquiryCaseDto {
|
func GetOrderInquiryCaseDto(m *model.OrderInquiryCase) *OrderInquiryCaseDto {
|
||||||
// 复诊凭证
|
|
||||||
var diagnoseImages []*string
|
|
||||||
if m.DiagnoseImages != "" {
|
|
||||||
diagnoseImages := strings.Split(m.DiagnoseImages, ",")
|
|
||||||
|
|
||||||
for i, image := range diagnoseImages {
|
|
||||||
diagnoseImages[i] = utils.AddOssDomain(image)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return &OrderInquiryCaseDto{
|
return &OrderInquiryCaseDto{
|
||||||
InquiryCaseId: fmt.Sprintf("%d", m.InquiryCaseId),
|
InquiryCaseId: fmt.Sprintf("%d", m.InquiryCaseId),
|
||||||
UserId: fmt.Sprintf("%d", m.InquiryCaseId),
|
UserId: fmt.Sprintf("%d", m.InquiryCaseId),
|
||||||
@ -75,7 +64,7 @@ func GetOrderInquiryCaseDto(m *model.OrderInquiryCase) *OrderInquiryCaseDto {
|
|||||||
DiseaseClassName: m.DiseaseClassName,
|
DiseaseClassName: m.DiseaseClassName,
|
||||||
DiagnosisDate: m.DiagnosisDate,
|
DiagnosisDate: m.DiagnosisDate,
|
||||||
DiseaseDesc: m.DiseaseDesc,
|
DiseaseDesc: m.DiseaseDesc,
|
||||||
DiagnoseImages: diagnoseImages,
|
DiagnoseImages: m.DiagnoseImages,
|
||||||
IsAllergyHistory: m.IsAllergyHistory,
|
IsAllergyHistory: m.IsAllergyHistory,
|
||||||
AllergyHistory: m.AllergyHistory,
|
AllergyHistory: m.AllergyHistory,
|
||||||
IsFamilyHistory: m.IsFamilyHistory,
|
IsFamilyHistory: m.IsFamilyHistory,
|
||||||
@ -104,6 +93,7 @@ func GetMaskOrderInquiryCaseDto(m *model.OrderInquiryCase) *OrderInquiryCaseDto
|
|||||||
DiseaseClassName: m.DiseaseClassName,
|
DiseaseClassName: m.DiseaseClassName,
|
||||||
DiagnosisDate: m.DiagnosisDate,
|
DiagnosisDate: m.DiagnosisDate,
|
||||||
DiseaseDesc: m.DiseaseDesc,
|
DiseaseDesc: m.DiseaseDesc,
|
||||||
|
DiagnoseImages: m.DiagnoseImages,
|
||||||
CreatedAt: m.CreatedAt,
|
CreatedAt: m.CreatedAt,
|
||||||
UpdatedAt: m.UpdatedAt,
|
UpdatedAt: m.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ type OrderInquiryRefundDto struct {
|
|||||||
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
InquiryNo string `json:"inquiry_no"` // 系统订单编号
|
||||||
InquiryRefundNo string `json:"inquiry_refund_no"` // 系统退款编号
|
InquiryRefundNo string `json:"inquiry_refund_no"` // 系统退款编号
|
||||||
RefundId string `json:"refund_id"` // 第三方退款单号
|
RefundId string `json:"refund_id"` // 第三方退款单号
|
||||||
InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
InquiryRefundStatus int `json:"inquiry_refund_status"` // 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4 // :拒绝退款 5:退款关闭 6:退款异常)
|
||||||
RefundTotal float64 `json:"refund_total"` // 退款金额
|
RefundTotal float64 `json:"refund_total"` // 退款金额
|
||||||
RefundReason string `json:"refund_reason"` // 退款原因
|
RefundReason string `json:"refund_reason"` // 退款原因
|
||||||
SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间
|
SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间
|
||||||
@ -20,7 +20,7 @@ type OrderInquiryRefundDto struct {
|
|||||||
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetOrderInquiryRefundBankDto(m *model.OrderInquiryRefund) *OrderInquiryRefundDto {
|
func GetOrderInquiryRefundDto(m *model.OrderInquiryRefund) *OrderInquiryRefundDto {
|
||||||
return &OrderInquiryRefundDto{
|
return &OrderInquiryRefundDto{
|
||||||
InquiryRefundId: fmt.Sprintf("%d", m.InquiryRefundId),
|
InquiryRefundId: fmt.Sprintf("%d", m.InquiryRefundId),
|
||||||
PatientId: fmt.Sprintf("%d", m.PatientId),
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package dto
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hospital-admin-api/api/model"
|
"hospital-admin-api/api/model"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OrderProductDto 订单详情
|
// OrderProductDto 订单详情
|
||||||
@ -10,6 +11,7 @@ type OrderProductDto struct {
|
|||||||
OrderProductId string `json:"order_product_id"` // 主键id
|
OrderProductId string `json:"order_product_id"` // 主键id
|
||||||
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL
|
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id;NOT NULL
|
||||||
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL
|
OrderPrescriptionId string `json:"order_prescription_id"` // 订单-处方id;NOT NULL
|
||||||
|
OrderId string `json:"order_id"` // 订单id
|
||||||
DoctorId string `json:"doctor_id"` // 医生id
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
PatientId string `json:"patient_id"` // 患者id
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
@ -56,6 +58,9 @@ type OrderProductDto struct {
|
|||||||
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||||
OrderPrescription *OrderPrescriptionDto `json:"order_prescription"` // 处方数据
|
OrderPrescription *OrderPrescriptionDto `json:"order_prescription"` // 处方数据
|
||||||
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
OrderInquiryCase *OrderInquiryCaseDto `json:"order_inquiry_case"` // 问诊病例
|
||||||
|
OrderProductCoupon *OrderProductCouponDto `json:"order_product_coupon"` // 优惠卷
|
||||||
|
ProductName string `json:"product_name"` // 药品数据
|
||||||
|
DiscountAmount float64 `json:"discount_amount"` // 优惠金额
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrderProductConsigneeDto 药品订单收货人数据
|
// OrderProductConsigneeDto 药品订单收货人数据
|
||||||
@ -113,8 +118,8 @@ func GetOrderProductDto(m *model.OrderProduct) *OrderProductDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOrderProductConsigneeDtoDto 药品订单收货人数据
|
// GetOrderProductConsigneeDto 药品订单收货人数据
|
||||||
func GetOrderProductConsigneeDtoDto(m *model.OrderProduct) *OrderProductConsigneeDto {
|
func GetOrderProductConsigneeDto(m *model.OrderProduct) *OrderProductConsigneeDto {
|
||||||
return &OrderProductConsigneeDto{
|
return &OrderProductConsigneeDto{
|
||||||
ProvinceId: m.ProvinceId,
|
ProvinceId: m.ProvinceId,
|
||||||
Province: m.Province,
|
Province: m.Province,
|
||||||
@ -179,6 +184,11 @@ func GetOrderProductListDto(m []*model.OrderProduct) []*OrderProductDto {
|
|||||||
response = response.LoadOrderPrescriptionCode(v.OrderPrescription)
|
response = response.LoadOrderPrescriptionCode(v.OrderPrescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载药品数据
|
||||||
|
if v.OrderProductItem != nil {
|
||||||
|
response = response.LoadProductName(v.OrderProductItem)
|
||||||
|
}
|
||||||
|
|
||||||
// 将转换后的结构体添加到新切片中
|
// 将转换后的结构体添加到新切片中
|
||||||
responses[i] = response
|
responses[i] = response
|
||||||
}
|
}
|
||||||
@ -262,3 +272,31 @@ func (r *OrderProductDto) LoadOrderProductRefund(m *model.OrderProductRefund) *O
|
|||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadOrderProductCoupon 加载药品订单优惠卷数据
|
||||||
|
func (r *OrderProductDto) LoadOrderProductCoupon(m *model.OrderProductCoupon) *OrderProductDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderProductCouponDto(m)
|
||||||
|
|
||||||
|
r.OrderProductCoupon = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadProductName 加载药品数据
|
||||||
|
func (r *OrderProductDto) LoadProductName(m []*model.OrderProductItem) *OrderProductDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
var products []string
|
||||||
|
|
||||||
|
for _, item := range m {
|
||||||
|
amount := fmt.Sprintf("%d", item.Amount)
|
||||||
|
productPrice := fmt.Sprintf("%.2f", item.ProductPrice)
|
||||||
|
|
||||||
|
product := item.ProductName + "(N:" + amount + " " + "P:" + productPrice + ")"
|
||||||
|
products = append(products, product)
|
||||||
|
|
||||||
|
r.ProductName = strings.Join(products, "; ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|||||||
52
api/dto/OrderProductCoupon.go
Normal file
52
api/dto/OrderProductCoupon.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderProductCouponDto struct {
|
||||||
|
OrderCouponId string `json:"order_coupon_id"` // 主键id
|
||||||
|
OrderProductId string `json:"order_product_id"` // 订单-商品id
|
||||||
|
UserCouponId string `json:"user_coupon_id"` // 用户优惠卷表id
|
||||||
|
CouponName string `json:"coupon_name"` // 优惠卷名称
|
||||||
|
CouponUsePrice float64 `json:"coupon_use_price"` // 优惠卷使用金额
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetOrderProductCouponDto(m *model.OrderProductCoupon) *OrderProductCouponDto {
|
||||||
|
return &OrderProductCouponDto{
|
||||||
|
OrderCouponId: fmt.Sprintf("%d", m.OrderCouponId),
|
||||||
|
OrderProductId: fmt.Sprintf("%d", m.OrderProductId),
|
||||||
|
UserCouponId: fmt.Sprintf("%d", m.UserCouponId),
|
||||||
|
CouponName: m.CouponName,
|
||||||
|
CouponUsePrice: m.CouponUsePrice,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetOrderProductCouponListDto(m []*model.OrderProductCoupon) []OrderProductCouponDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]OrderProductCouponDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := OrderProductCouponDto{
|
||||||
|
OrderCouponId: fmt.Sprintf("%d", v.OrderCouponId),
|
||||||
|
OrderProductId: fmt.Sprintf("%d", v.OrderProductId),
|
||||||
|
UserCouponId: fmt.Sprintf("%d", v.UserCouponId),
|
||||||
|
CouponName: v.CouponName,
|
||||||
|
CouponUsePrice: v.CouponUsePrice,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
299
api/dto/OrderServicePackage.go
Normal file
299
api/dto/OrderServicePackage.go
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageDto 订单-服务包
|
||||||
|
type OrderServicePackageDto struct {
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 主键id
|
||||||
|
OrderId string `json:"order_id"` // 订单id
|
||||||
|
UserId string `json:"user_id"` // 用户id-患者
|
||||||
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
|
OrderServiceType int `json:"order_service_type"` // 服务包类型(1:健康包 2:随访包)
|
||||||
|
OrderServiceStatus int `json:"order_service_status"` // 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||||
|
IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是)
|
||||||
|
RefundStatus int `json:"refund_status"` // 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||||
|
PayChannel int `json:"pay_channel"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||||
|
PayStatus int `json:"pay_status"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
|
OrderServiceNo string `json:"order_service_no"` // 系统订单编号
|
||||||
|
EscrowTradeNo string `json:"escrow_trade_no"` // 第三方支付流水号
|
||||||
|
AmountTotal float64 `json:"amount_total"` // 订单金额
|
||||||
|
CouponAmountTotal float64 `json:"coupon_amount_total"` // 优惠卷总金额
|
||||||
|
PaymentAmountTotal float64 `json:"payment_amount_total"` // 实际付款金额
|
||||||
|
PayTime model.LocalTime `json:"pay_time"` // 支付时间
|
||||||
|
StartTime model.LocalTime `json:"start_time"` // 开始服务时间
|
||||||
|
FinishTime model.LocalTime `json:"finish_time"` // 结束服务时间
|
||||||
|
CancelTime model.LocalTime `json:"cancel_time"` // 订单取消时间
|
||||||
|
CancelReason int `json:"cancel_reason"` // 取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)
|
||||||
|
CancelRemarks string `json:"cancel_remarks"` // 取消订单备注
|
||||||
|
AddFinishStatus int `json:"add_finish_status"` // 添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)
|
||||||
|
AddFinishTime model.LocalTime `json:"add_finish_time"` // 添加完成订单延迟队列时间
|
||||||
|
AddFinishFailReason string `json:"add_finish_fail_reason"` // 添加完成订单延迟队列失败原因
|
||||||
|
PatientName string `json:"patient_name"` // 患者姓名-就诊人
|
||||||
|
PatientNameMask string `json:"patient_name_mask"` // 患者姓名-就诊人(掩码)
|
||||||
|
PatientSex int `json:"patient_sex"` // 患者性别-就诊人(0:未知 1:男 2:女)
|
||||||
|
PatientAge int `json:"patient_age"` // 患者年龄-就诊人
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||||
|
DoctorName string `json:"doctor_name"` // 医生姓名
|
||||||
|
UserName string `json:"user_name"` // 用户姓名(患者)
|
||||||
|
UserDoctor *UserDoctorDto `json:"user_doctor"` // 医生数据
|
||||||
|
OrderServicePackageCase *OrderServicePackageCaseDto `json:"order_service_package_case"` // 病例
|
||||||
|
OrderServicePackageRefund *OrderServicePackageRefundDto `json:"order_service_package_refund"` // 退款数据
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderServicePackageDetailInfoDto 服务包权益
|
||||||
|
type OrderServicePackageDetailInfoDto struct {
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 主键id
|
||||||
|
OrderId string `json:"order_id"` // 订单id
|
||||||
|
UserId string `json:"user_id"` // 用户id-患者
|
||||||
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
|
DoctorId string `json:"doctor_id"` // 医生id
|
||||||
|
FamilyId string `json:"family_id"` // 家庭成员id(就诊用户)
|
||||||
|
OrderServiceType int `json:"order_service_type"` // 服务包类型(1:健康包 2:随访包)
|
||||||
|
OrderServiceStatus int `json:"order_service_status"` // 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||||
|
IsDelete int `json:"is_delete"` // 删除状态(0:否 1:是)
|
||||||
|
OrderServiceNo string `json:"order_service_no"` // 系统订单编号
|
||||||
|
PayTime model.LocalTime `json:"pay_time"` // 支付时间
|
||||||
|
StartTime model.LocalTime `json:"start_time"` // 开始服务时间
|
||||||
|
FinishTime model.LocalTime `json:"finish_time"` // 结束服务时间
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
OrderProduct []*OrderProductDto `json:"order_product"` // 关联商品订单
|
||||||
|
OrderInquiry []*OrderInquiryDto `json:"order_inquiry"` // 关联问诊订单
|
||||||
|
UserCoupon []*UserCouponDto `json:"user_coupon"` // 关联优惠卷
|
||||||
|
OrderServicePackageCase *OrderServicePackageCaseDto `json:"order_service_package_case"` // 关联病例
|
||||||
|
OrderServicePackageDetail *OrderServicePackageDetailDto `json:"order_service_package_detail"` // 服务包订单详情
|
||||||
|
CurrentMonthStartDate string `json:"current_month_start_date"` // 当月开始时间
|
||||||
|
CurrentMonthFinishDate string `json:"current_month_finish_date"` // 当月结束时间
|
||||||
|
MonthInquiryCount int `json:"month_inquiry_count"` // 当月问诊次数
|
||||||
|
RemainingInquiryCount string `json:"remaining_inquiry_count"` // 当月剩余问诊次数
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDto 服务包订单详情
|
||||||
|
func GetOrderServicePackageDto(m *model.OrderServicePackage) *OrderServicePackageDto {
|
||||||
|
return &OrderServicePackageDto{
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||||
|
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||||
|
OrderServiceType: m.OrderServiceType,
|
||||||
|
OrderServiceStatus: m.OrderServiceStatus,
|
||||||
|
IsDelete: m.IsDelete,
|
||||||
|
RefundStatus: m.RefundStatus,
|
||||||
|
PayChannel: m.PayChannel,
|
||||||
|
PayStatus: m.PayStatus,
|
||||||
|
OrderServiceNo: m.OrderServiceNo,
|
||||||
|
EscrowTradeNo: m.EscrowTradeNo,
|
||||||
|
AmountTotal: m.AmountTotal,
|
||||||
|
CouponAmountTotal: m.CouponAmountTotal,
|
||||||
|
PaymentAmountTotal: m.PaymentAmountTotal,
|
||||||
|
PayTime: m.PayTime,
|
||||||
|
StartTime: m.StartTime,
|
||||||
|
FinishTime: m.FinishTime,
|
||||||
|
CancelTime: m.CancelTime,
|
||||||
|
CancelReason: m.CancelReason,
|
||||||
|
CancelRemarks: m.CancelRemarks,
|
||||||
|
AddFinishStatus: m.AddFinishStatus,
|
||||||
|
AddFinishTime: m.AddFinishTime,
|
||||||
|
AddFinishFailReason: m.AddFinishFailReason,
|
||||||
|
PatientName: m.PatientName,
|
||||||
|
PatientNameMask: m.PatientNameMask,
|
||||||
|
PatientSex: m.PatientSex,
|
||||||
|
PatientAge: m.PatientAge,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageListDto 服务包订单列表
|
||||||
|
func GetOrderServicePackageListDto(m []*model.OrderServicePackage) []*OrderServicePackageDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageDto{
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", v.DoctorId),
|
||||||
|
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||||
|
OrderServiceType: v.OrderServiceType,
|
||||||
|
OrderServiceStatus: v.OrderServiceStatus,
|
||||||
|
IsDelete: v.IsDelete,
|
||||||
|
RefundStatus: v.RefundStatus,
|
||||||
|
PayChannel: v.PayChannel,
|
||||||
|
PayStatus: v.PayStatus,
|
||||||
|
OrderServiceNo: v.OrderServiceNo,
|
||||||
|
EscrowTradeNo: v.EscrowTradeNo,
|
||||||
|
AmountTotal: v.AmountTotal,
|
||||||
|
CouponAmountTotal: v.CouponAmountTotal,
|
||||||
|
PaymentAmountTotal: v.PaymentAmountTotal,
|
||||||
|
PayTime: v.PayTime,
|
||||||
|
StartTime: v.StartTime,
|
||||||
|
FinishTime: v.FinishTime,
|
||||||
|
CancelTime: v.CancelTime,
|
||||||
|
CancelReason: v.CancelReason,
|
||||||
|
CancelRemarks: v.CancelRemarks,
|
||||||
|
AddFinishStatus: v.AddFinishStatus,
|
||||||
|
AddFinishTime: v.AddFinishTime,
|
||||||
|
AddFinishFailReason: v.AddFinishFailReason,
|
||||||
|
PatientName: v.PatientName,
|
||||||
|
PatientNameMask: v.PatientNameMask,
|
||||||
|
PatientSex: v.PatientSex,
|
||||||
|
PatientAge: v.PatientAge,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载医生名称
|
||||||
|
if v.UserDoctor != nil {
|
||||||
|
response = response.LoadDoctorName(v.UserDoctor)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载用户姓名(患者)
|
||||||
|
if v.User != nil {
|
||||||
|
response = response.LoadUserName(v.User)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailInfoDto 服务包权益详情
|
||||||
|
func GetOrderServicePackageDetailInfoDto(m *model.OrderServicePackage) *OrderServicePackageDetailInfoDto {
|
||||||
|
return &OrderServicePackageDetailInfoDto{
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
DoctorId: fmt.Sprintf("%d", m.DoctorId),
|
||||||
|
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||||
|
OrderServiceType: m.OrderServiceType,
|
||||||
|
OrderServiceStatus: m.OrderServiceStatus,
|
||||||
|
IsDelete: m.IsDelete,
|
||||||
|
OrderServiceNo: m.OrderServiceNo,
|
||||||
|
PayTime: m.PayTime,
|
||||||
|
StartTime: m.StartTime,
|
||||||
|
FinishTime: m.FinishTime,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadDoctorName 加载医生名称
|
||||||
|
func (r *OrderServicePackageDto) LoadDoctorName(m *model.UserDoctor) *OrderServicePackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.DoctorName = m.UserName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserName 加载用户姓名(患者)
|
||||||
|
func (r *OrderServicePackageDto) LoadUserName(m *model.User) *OrderServicePackageDto {
|
||||||
|
if m != nil {
|
||||||
|
r.UserName = m.UserName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderServicePackageRefund 加载订单退款数据
|
||||||
|
func (r *OrderServicePackageDto) LoadOrderServicePackageRefund(m *model.OrderServicePackageRefund) *OrderServicePackageDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderServicePackageRefundDto(m)
|
||||||
|
|
||||||
|
r.OrderServicePackageRefund = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadMaskOrderServicePackageCase 加载病例
|
||||||
|
func (r *OrderServicePackageDto) LoadMaskOrderServicePackageCase(m *model.OrderServicePackageCase) *OrderServicePackageDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderServicePackageCaseDto(m)
|
||||||
|
|
||||||
|
r.OrderServicePackageCase = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderServicePackageProduct 加载关联商品订单
|
||||||
|
func (r *OrderServicePackageDetailInfoDto) LoadOrderServicePackageProduct(m []*model.OrderServicePackageProduct) *OrderServicePackageDetailInfoDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
responses := make([]*OrderProductDto, len(m))
|
||||||
|
|
||||||
|
for i, product := range m {
|
||||||
|
if product.OrderProduct != nil {
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
response := GetOrderProductDto(product.OrderProduct)
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r.OrderProduct = responses
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderServicePackageInquiry 加载关联问诊订单
|
||||||
|
func (r *OrderServicePackageDetailInfoDto) LoadOrderServicePackageInquiry(m []*model.OrderServicePackageInquiry) *OrderServicePackageDetailInfoDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
responses := make([]*OrderInquiryDto, len(m))
|
||||||
|
|
||||||
|
for i, inquiry := range m {
|
||||||
|
if inquiry.OrderInquiry != nil {
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
response := GetOrderInquiryDto(inquiry.OrderInquiry)
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r.OrderInquiry = responses
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserCoupon 加载优惠卷数据
|
||||||
|
func (r *OrderServicePackageDetailInfoDto) LoadUserCoupon(m []*model.UserCoupon) *OrderServicePackageDetailInfoDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
d := GetUserCouponListDto(m)
|
||||||
|
|
||||||
|
r.UserCoupon = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderServicePackageDetail 加载服务包订单详情数据
|
||||||
|
func (r *OrderServicePackageDetailInfoDto) LoadOrderServicePackageDetail(m *model.
|
||||||
|
OrderServicePackageDetail) *OrderServicePackageDetailInfoDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderServicePackageDetailDto(m)
|
||||||
|
|
||||||
|
r.OrderServicePackageDetail = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderServicePackageCase 加载服务包订单关联病例数据
|
||||||
|
func (r *OrderServicePackageDetailInfoDto) LoadOrderServicePackageCase(m *model.OrderServicePackageCase) *OrderServicePackageDetailInfoDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderServicePackageCaseDto(m)
|
||||||
|
|
||||||
|
r.OrderServicePackageCase = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
106
api/dto/OrderServicePackageCase.go
Normal file
106
api/dto/OrderServicePackageCase.go
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageCaseDto 订单-服务包病例表
|
||||||
|
type OrderServicePackageCaseDto struct {
|
||||||
|
OrderServiceCaseId string `json:"order_service_case_id"` // 主键id
|
||||||
|
UserId string `json:"user_id"` // 用户id; NOT NULL
|
||||||
|
PatientId string `json:"patient_id"` // 患者id; NOT NULL
|
||||||
|
OrderId string `json:"order_id"` // 订单id; NOT NULL
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 订单-服务包id; NOT NULL
|
||||||
|
FamilyId string `json:"family_id"` // 家庭成员id; NOT NULL
|
||||||
|
DiseaseClassId string `json:"disease_class_id"` // 疾病分类id-系统
|
||||||
|
Relation int `json:"relation"` // 与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )
|
||||||
|
Status int `json:"status"` // 状态(1:正常 2:删除)
|
||||||
|
Name string `json:"name"` // 患者名称
|
||||||
|
Sex int `json:"sex"` // 患者性别(0:未知 1:男 2:女)
|
||||||
|
Age int `json:"age"` // 患者年龄
|
||||||
|
DiseaseClassName string `json:"disease_class_name"` // 疾病名称-系统
|
||||||
|
DiagnosisDate model.LocalTime `json:"diagnosis_date"` // 确诊日期
|
||||||
|
DiseaseDesc string `json:"disease_desc"` // 病情描述(主诉)
|
||||||
|
DiagnoseImages string `json:"diagnose_images"` // 复诊凭证(多个使用逗号分隔)
|
||||||
|
IsAllergyHistory int `json:"is_allergy_history"` // 是否存在过敏史(0:否 1:是)
|
||||||
|
AllergyHistory string `json:"allergy_history"` // 过敏史描述
|
||||||
|
IsFamilyHistory int `json:"is_family_history"` // 是否存在家族病史(0:否 1:是)
|
||||||
|
FamilyHistory string `json:"family_history"` // 家族病史描述
|
||||||
|
IsPregnant int `json:"is_pregnant"` // 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||||
|
Pregnant string `json:"pregnant"` // 备孕、妊娠、哺乳期描述
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseDto 服务包订单病例详情
|
||||||
|
func GetOrderServicePackageCaseDto(m *model.OrderServicePackageCase) *OrderServicePackageCaseDto {
|
||||||
|
return &OrderServicePackageCaseDto{
|
||||||
|
OrderServiceCaseId: fmt.Sprintf("%d", m.OrderServiceCaseId),
|
||||||
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
FamilyId: fmt.Sprintf("%d", m.FamilyId),
|
||||||
|
DiseaseClassId: fmt.Sprintf("%d", m.DiseaseClassId),
|
||||||
|
Relation: m.Relation,
|
||||||
|
Status: m.Status,
|
||||||
|
Name: m.Name,
|
||||||
|
Sex: m.Sex,
|
||||||
|
Age: m.Age,
|
||||||
|
DiseaseClassName: m.DiseaseClassName,
|
||||||
|
DiagnosisDate: m.DiagnosisDate,
|
||||||
|
DiseaseDesc: m.DiseaseDesc,
|
||||||
|
DiagnoseImages: m.DiagnoseImages,
|
||||||
|
IsAllergyHistory: m.IsAllergyHistory,
|
||||||
|
AllergyHistory: m.AllergyHistory,
|
||||||
|
IsFamilyHistory: m.IsFamilyHistory,
|
||||||
|
FamilyHistory: m.FamilyHistory,
|
||||||
|
IsPregnant: m.IsPregnant,
|
||||||
|
Pregnant: m.Pregnant,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageCaseListDto 服务包订单病例列表
|
||||||
|
func GetOrderServicePackageCaseListDto(m []*model.OrderServicePackageCase) []*OrderServicePackageCaseDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageCaseDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageCaseDto{
|
||||||
|
OrderServiceCaseId: fmt.Sprintf("%d", v.OrderServiceCaseId),
|
||||||
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
FamilyId: fmt.Sprintf("%d", v.FamilyId),
|
||||||
|
DiseaseClassId: fmt.Sprintf("%d", v.DiseaseClassId),
|
||||||
|
Relation: v.Relation,
|
||||||
|
Status: v.Status,
|
||||||
|
Name: v.Name,
|
||||||
|
Sex: v.Sex,
|
||||||
|
Age: v.Age,
|
||||||
|
DiseaseClassName: v.DiseaseClassName,
|
||||||
|
DiagnosisDate: v.DiagnosisDate,
|
||||||
|
DiseaseDesc: v.DiseaseDesc,
|
||||||
|
DiagnoseImages: v.DiagnoseImages,
|
||||||
|
IsAllergyHistory: v.IsAllergyHistory,
|
||||||
|
AllergyHistory: v.AllergyHistory,
|
||||||
|
IsFamilyHistory: v.IsFamilyHistory,
|
||||||
|
FamilyHistory: v.FamilyHistory,
|
||||||
|
IsPregnant: v.IsPregnant,
|
||||||
|
Pregnant: v.Pregnant,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
77
api/dto/OrderServicePackageDetail.go
Normal file
77
api/dto/OrderServicePackageDetail.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageDetailDto 订单-服务包详情表
|
||||||
|
type OrderServicePackageDetailDto struct {
|
||||||
|
OrderServiceDetailId string `json:"order_service_detail_id"` // 主键id
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 服务包订单id
|
||||||
|
OrderId string `json:"order_id"` // 订单id
|
||||||
|
PackageId string `json:"package_id"` // 健康包配置id(随访包时为空)
|
||||||
|
OrderServiceNo string `json:"order_service_no"` // 系统订单编号
|
||||||
|
ServicePeriod int `json:"service_period"` // 服务周期(天)
|
||||||
|
ServiceCount int `json:"service_count"` // 总服务次数(0表示不限次)
|
||||||
|
MonthlyFrequency int `json:"monthly_frequency"` // 每月次数(0表示不限次)
|
||||||
|
SingleInquiryPrice float64 `json:"single_inquiry_price"` // 单次图文问诊价格
|
||||||
|
ServicePrice float64 `json:"service_price"` // 总服务价格
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
RemainingQuantity int `json:"remaining_quantity"` // 药品的剩余数量
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailDto 订单-服务包详情详情
|
||||||
|
func GetOrderServicePackageDetailDto(m *model.OrderServicePackageDetail) *OrderServicePackageDetailDto {
|
||||||
|
return &OrderServicePackageDetailDto{
|
||||||
|
OrderServiceDetailId: fmt.Sprintf("%d", m.OrderServiceDetailId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderId: fmt.Sprintf("%d", m.OrderId),
|
||||||
|
PackageId: fmt.Sprintf("%d", m.PackageId),
|
||||||
|
OrderServiceNo: m.OrderServiceNo,
|
||||||
|
ServicePeriod: m.ServicePeriod,
|
||||||
|
ServiceCount: m.ServiceCount,
|
||||||
|
MonthlyFrequency: m.MonthlyFrequency,
|
||||||
|
SingleInquiryPrice: m.SingleInquiryPrice,
|
||||||
|
ServicePrice: m.ServicePrice,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageDetailListDto 订单-服务包详情列表
|
||||||
|
func GetOrderServicePackageDetailListDto(m []*model.OrderServicePackageDetail) []*OrderServicePackageDetailDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageDetailDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageDetailDto{
|
||||||
|
OrderServiceDetailId: fmt.Sprintf("%d", v.OrderServiceDetailId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
OrderId: fmt.Sprintf("%d", v.OrderId),
|
||||||
|
PackageId: fmt.Sprintf("%d", v.PackageId),
|
||||||
|
OrderServiceNo: v.OrderServiceNo,
|
||||||
|
ServicePeriod: v.ServicePeriod,
|
||||||
|
ServiceCount: v.ServiceCount,
|
||||||
|
MonthlyFrequency: v.MonthlyFrequency,
|
||||||
|
SingleInquiryPrice: v.SingleInquiryPrice,
|
||||||
|
ServicePrice: v.ServicePrice,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadRemainingQuantity 加载药品剩余数量
|
||||||
|
func (r *OrderServicePackageDetailDto) LoadRemainingQuantity(remainingQuantity int) *OrderServicePackageDetailDto {
|
||||||
|
r.RemainingQuantity = remainingQuantity
|
||||||
|
return r
|
||||||
|
}
|
||||||
71
api/dto/OrderServicePackageInquiry.go
Normal file
71
api/dto/OrderServicePackageInquiry.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageInquiryDto 服务包关联问诊订单表
|
||||||
|
type OrderServicePackageInquiryDto struct {
|
||||||
|
ServiceInquiryId string `json:"service_inquiry_id"` // 主键id
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 订单-服务包id
|
||||||
|
OrderInquiryId string `json:"order_inquiry_id"` // 订单-问诊id
|
||||||
|
OrderServiceNo string `json:"order_service_no"` // 服务包系统订单编号
|
||||||
|
InquiryNo string `json:"inquiry_no"` // 问诊系统订单编号
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
OrderInquiry *OrderInquiryDto `json:"order_inquiry"` // 问诊订单
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryDto 服务包关联问诊订单详情
|
||||||
|
func GetOrderServicePackageInquiryDto(m *model.OrderServicePackageInquiry) *OrderServicePackageInquiryDto {
|
||||||
|
return &OrderServicePackageInquiryDto{
|
||||||
|
ServiceInquiryId: fmt.Sprintf("%d", m.ServiceInquiryId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderInquiryId: fmt.Sprintf("%d", m.OrderInquiryId),
|
||||||
|
OrderServiceNo: m.OrderServiceNo,
|
||||||
|
InquiryNo: m.InquiryNo,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageInquiryListDto 服务包关联问诊订单列表
|
||||||
|
func GetOrderServicePackageInquiryListDto(m []*model.OrderServicePackageInquiry) []*OrderServicePackageInquiryDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageInquiryDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageInquiryDto{
|
||||||
|
ServiceInquiryId: fmt.Sprintf("%d", v.ServiceInquiryId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
OrderInquiryId: fmt.Sprintf("%d", v.OrderInquiryId),
|
||||||
|
OrderServiceNo: v.OrderServiceNo,
|
||||||
|
InquiryNo: v.InquiryNo,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载问诊订单数据
|
||||||
|
if v.OrderInquiry != nil {
|
||||||
|
response = response.LoadOrderInquiry(v.OrderInquiry)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderInquiry 加载问诊订单数据
|
||||||
|
func (r *OrderServicePackageInquiryDto) LoadOrderInquiry(m *model.OrderInquiry) *OrderServicePackageInquiryDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderInquiryDto(m)
|
||||||
|
|
||||||
|
r.OrderInquiry = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
77
api/dto/OrderServicePackageProduct.go
Normal file
77
api/dto/OrderServicePackageProduct.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageProductDto 订单-服务包-关联商品订单表
|
||||||
|
type OrderServicePackageProductDto struct {
|
||||||
|
ServiceProductId string `json:"service_product_id"` // 主键id
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 订单-服务包id
|
||||||
|
OrderProductId string `json:"order_product_id"` // 订单-商品id
|
||||||
|
OrderProductNo string `json:"order_product_no"` // 订单-商品系统编号
|
||||||
|
ProductItemId string `json:"product_item_id"` // 订单-商品明细id
|
||||||
|
ProductId string `json:"product_id"` // 商品id
|
||||||
|
UsedQuantity int `json:"used_quantity"` // 商品使用数量
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
OrderProduct *OrderProductDto `json:"order_product"` // 药品订单
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductDto 服务包订单病例详情
|
||||||
|
func GetOrderServicePackageProductDto(m *model.OrderServicePackageProduct) *OrderServicePackageProductDto {
|
||||||
|
return &OrderServicePackageProductDto{
|
||||||
|
ServiceProductId: fmt.Sprintf("%d", m.ServiceProductId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderProductId: fmt.Sprintf("%d", m.OrderProductId),
|
||||||
|
OrderProductNo: m.OrderProductNo,
|
||||||
|
ProductItemId: fmt.Sprintf("%d", m.ProductItemId),
|
||||||
|
ProductId: fmt.Sprintf("%d", m.ProductId),
|
||||||
|
UsedQuantity: m.UsedQuantity,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageProductListDto 服务包订单病例列表
|
||||||
|
func GetOrderServicePackageProductListDto(m []*model.OrderServicePackageProduct) []*OrderServicePackageProductDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageProductDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageProductDto{
|
||||||
|
ServiceProductId: fmt.Sprintf("%d", v.ServiceProductId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
OrderProductId: fmt.Sprintf("%d", v.OrderProductId),
|
||||||
|
OrderProductNo: v.OrderProductNo,
|
||||||
|
ProductItemId: fmt.Sprintf("%d", v.ProductItemId),
|
||||||
|
ProductId: fmt.Sprintf("%d", v.ProductId),
|
||||||
|
UsedQuantity: v.UsedQuantity,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载问诊订单数据
|
||||||
|
if v.OrderProduct != nil {
|
||||||
|
response = response.LoadOrderProduct(v.OrderProduct)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadOrderProduct 加载药品订单数据
|
||||||
|
func (r *OrderServicePackageProductDto) LoadOrderProduct(m *model.OrderProduct) *OrderServicePackageProductDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetOrderProductDto(m)
|
||||||
|
|
||||||
|
r.OrderProduct = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
70
api/dto/OrderServicePackageRefund.go
Normal file
70
api/dto/OrderServicePackageRefund.go
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageRefundDto 订单-服务包-退款表
|
||||||
|
type OrderServicePackageRefundDto struct {
|
||||||
|
ServiceRefundId string `json:"service_refund_id"` // 主键id
|
||||||
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
|
OrderServiceId string `json:"order_service_id"` // 订单-服务包id
|
||||||
|
OrderServiceNo string `json:"order_service_no"` // 系统订单编号
|
||||||
|
ServiceRefundNo string `json:"service_refund_no"` // 系统退款编号
|
||||||
|
RefundId string `json:"refund_id"` // 第三方退款单号
|
||||||
|
RefundStatus int `json:"refund_status"` // 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6 // :退款异常 7:部分退款)
|
||||||
|
RefundTotal float64 `json:"refund_total"` // 退款金额
|
||||||
|
RefundReason string `json:"refund_reason"` // 退款原因
|
||||||
|
SuccessTime model.LocalTime `json:"success_time"` // 退款成功时间
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundDto 服务包订单病例详情
|
||||||
|
func GetOrderServicePackageRefundDto(m *model.OrderServicePackageRefund) *OrderServicePackageRefundDto {
|
||||||
|
return &OrderServicePackageRefundDto{
|
||||||
|
ServiceRefundId: fmt.Sprintf("%d", m.ServiceRefundId),
|
||||||
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", m.OrderServiceId),
|
||||||
|
OrderServiceNo: m.OrderServiceNo,
|
||||||
|
ServiceRefundNo: m.ServiceRefundNo,
|
||||||
|
RefundId: m.RefundId,
|
||||||
|
RefundStatus: m.RefundStatus,
|
||||||
|
RefundTotal: m.RefundTotal,
|
||||||
|
RefundReason: m.RefundReason,
|
||||||
|
SuccessTime: m.SuccessTime,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackageRefundListDto 服务包订单病例列表
|
||||||
|
func GetOrderServicePackageRefundListDto(m []*model.OrderServicePackageRefund) []*OrderServicePackageRefundDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*OrderServicePackageRefundDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &OrderServicePackageRefundDto{
|
||||||
|
ServiceRefundId: fmt.Sprintf("%d", v.ServiceRefundId),
|
||||||
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
|
OrderServiceId: fmt.Sprintf("%d", v.OrderServiceId),
|
||||||
|
OrderServiceNo: v.OrderServiceNo,
|
||||||
|
ServiceRefundNo: v.ServiceRefundNo,
|
||||||
|
RefundId: v.RefundId,
|
||||||
|
RefundStatus: v.RefundStatus,
|
||||||
|
RefundTotal: v.RefundTotal,
|
||||||
|
RefundReason: v.RefundReason,
|
||||||
|
SuccessTime: v.SuccessTime,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
94
api/dto/UserCoupon.go
Normal file
94
api/dto/UserCoupon.go
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserCouponDto 用户优惠卷表
|
||||||
|
type UserCouponDto struct {
|
||||||
|
UserCouponId string `json:"user_coupon_id"` // 主键id
|
||||||
|
UserId string `json:"user_id"` // 用户id
|
||||||
|
PatientId string `json:"patient_id"` // 患者id
|
||||||
|
CouponId string `json:"coupon_id"` // 优惠卷id
|
||||||
|
UserCouponStatus int `json:"user_coupon_status"` // 状态(0:未使用 1:已使用 3:已过期)
|
||||||
|
CouponUseDate *model.LocalTime `json:"coupon_use_date"` // 使用时间
|
||||||
|
ValidStartTime model.LocalTime `json:"valid_start_time"` // 有效使用时间
|
||||||
|
ValidEndTime model.LocalTime `json:"valid_end_time"` // 过期使用时间
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
Coupon *CouponDto `json:"coupon"` // 优惠卷
|
||||||
|
UserName string `json:"user_name"` // 用户名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserCouponDto 用户优惠卷详情
|
||||||
|
func GetUserCouponDto(m *model.UserCoupon) *UserCouponDto {
|
||||||
|
return &UserCouponDto{
|
||||||
|
UserCouponId: fmt.Sprintf("%d", m.UserCouponId),
|
||||||
|
UserId: fmt.Sprintf("%d", m.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", m.PatientId),
|
||||||
|
CouponId: fmt.Sprintf("%d", m.CouponId),
|
||||||
|
UserCouponStatus: m.UserCouponStatus,
|
||||||
|
CouponUseDate: m.CouponUseDate,
|
||||||
|
ValidStartTime: model.LocalTime(m.ValidStartTime),
|
||||||
|
ValidEndTime: model.LocalTime(m.ValidEndTime),
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserCouponListDto 用户优惠卷列表
|
||||||
|
func GetUserCouponListDto(m []*model.UserCoupon) []*UserCouponDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*UserCouponDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &UserCouponDto{
|
||||||
|
UserCouponId: fmt.Sprintf("%d", v.UserCouponId),
|
||||||
|
UserId: fmt.Sprintf("%d", v.UserId),
|
||||||
|
PatientId: fmt.Sprintf("%d", v.PatientId),
|
||||||
|
CouponId: fmt.Sprintf("%d", v.CouponId),
|
||||||
|
UserCouponStatus: v.UserCouponStatus,
|
||||||
|
CouponUseDate: v.CouponUseDate,
|
||||||
|
ValidStartTime: model.LocalTime(v.ValidStartTime),
|
||||||
|
ValidEndTime: model.LocalTime(v.ValidEndTime),
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载优惠卷数据
|
||||||
|
if v.Coupon != nil {
|
||||||
|
response = response.LoadCoupon(v.Coupon)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载用户属性
|
||||||
|
if v.User != nil {
|
||||||
|
response = response.LoadUserAttr(v.User)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadCoupon 加载优惠卷数据
|
||||||
|
func (r *UserCouponDto) LoadCoupon(m *model.Coupon) *UserCouponDto {
|
||||||
|
if m != nil {
|
||||||
|
d := GetCouponDto(m)
|
||||||
|
|
||||||
|
r.Coupon = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadUserAttr 加载用户属性
|
||||||
|
func (r *UserCouponDto) LoadUserAttr(m *model.User) *UserCouponDto {
|
||||||
|
if m != nil {
|
||||||
|
r.UserName = m.UserName
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
150
api/dto/coupon.go
Normal file
150
api/dto/coupon.go
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
package dto
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"hospital-admin-api/api/model"
|
||||||
|
"hospital-admin-api/utils"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CouponDto 优惠卷表
|
||||||
|
type CouponDto struct {
|
||||||
|
CouponId string `json:"coupon_id"` // 主键id
|
||||||
|
CouponName string `json:"coupon_name"` // 优惠卷名称
|
||||||
|
CouponIcon string `json:"coupon_icon"` // 优惠卷图片
|
||||||
|
CouponClient int `json:"coupon_client"` // 使用平台(1:小程序)
|
||||||
|
CouponType int `json:"coupon_type"` // 优惠卷类型(1:无门槛 2:满减 3:数量)
|
||||||
|
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||||
|
DistributionObject int `json:"distribution_object"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)
|
||||||
|
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)
|
||||||
|
InquiryType []string `json:"inquiry_type"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||||
|
BrandId string `json:"brand_id"` // 关联品牌id(如不限制品牌,此项为空)
|
||||||
|
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||||
|
IsDisplay int `json:"is_display"` // 是否展示(0:否 1:是)
|
||||||
|
DistributionWithDay *int `json:"distribution_with_day"` // 发放关联天数(发放对象为近期消费等类型时规定天数)
|
||||||
|
MinUsableNumber int `json:"min_usable_number"` // 单商品最小可使用数量(默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)
|
||||||
|
CouponCount int `json:"coupon_count"` // 发放数量
|
||||||
|
CouponTakeCount int `json:"coupon_take_count"` // 已领取数量
|
||||||
|
CouponUsedCount int `json:"coupon_used_count"` // 已使用数量
|
||||||
|
CouponPrice float64 `json:"coupon_price"` // 优惠卷金额
|
||||||
|
WithAmount float64 `json:"with_amount"` // 符合满减标准金额(优惠卷类型为满减时使用)
|
||||||
|
ValidType int `json:"valid_type"` // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||||
|
ValidDays int `json:"valid_days"` // 自领取之日起有效天数
|
||||||
|
ValidStartTime *model.LocalTime `json:"valid_start_time"` // 开始使用时间
|
||||||
|
ValidEndTime *model.LocalTime `json:"valid_end_time"` // 结束使用时间
|
||||||
|
ProductId string `json:"product_id"` // 关联商品id,逗号分隔,指定商品时,填入此项。
|
||||||
|
ReissueIntervalDays int `json:"reissue_interval_days"` // 确认收货后的再次发放间隔天数(如果设置为 0,则表示不再次发放。当适用范围为商品时生效)
|
||||||
|
IsReissuableAfterExpire int `json:"is_reissuable_after_expire"` // 过期之后是否允许再次发放(0:否 1:是)
|
||||||
|
IsPopup int `json:"is_popup"` // 是否首页弹窗(0:否 1:是)
|
||||||
|
CouponDesc string `json:"coupon_desc"` // 优惠卷描述
|
||||||
|
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt model.LocalTime `json:"updated_at"` // 修改时间
|
||||||
|
CouponGrant []*CouponGrantDto `json:"coupon_grant"` // 发放记录
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponDto 优惠卷详情
|
||||||
|
func GetCouponDto(m *model.Coupon) *CouponDto {
|
||||||
|
return &CouponDto{
|
||||||
|
CouponId: fmt.Sprintf("%d", m.CouponId),
|
||||||
|
CouponName: m.CouponName,
|
||||||
|
CouponIcon: utils.AddOssDomain(m.CouponIcon),
|
||||||
|
CouponClient: m.CouponClient,
|
||||||
|
CouponType: m.CouponType,
|
||||||
|
CouponStatus: m.CouponStatus,
|
||||||
|
DistributionObject: m.DistributionObject,
|
||||||
|
ApplicationScope: m.ApplicationScope,
|
||||||
|
BrandId: fmt.Sprintf("%d", m.BrandId),
|
||||||
|
IsMutex: *m.IsMutex,
|
||||||
|
IsDisplay: m.IsDisplay,
|
||||||
|
DistributionWithDay: &m.DistributionWithDay,
|
||||||
|
MinUsableNumber: *m.MinUsableNumber,
|
||||||
|
CouponCount: m.CouponCount,
|
||||||
|
CouponTakeCount: m.CouponTakeCount,
|
||||||
|
CouponUsedCount: m.CouponUsedCount,
|
||||||
|
CouponPrice: m.CouponPrice,
|
||||||
|
WithAmount: m.WithAmount,
|
||||||
|
ValidType: m.ValidType,
|
||||||
|
ValidDays: m.ValidDays,
|
||||||
|
ValidStartTime: m.ValidStartTime,
|
||||||
|
ValidEndTime: m.ValidEndTime,
|
||||||
|
ProductId: m.ProductId,
|
||||||
|
ReissueIntervalDays: m.ReissueIntervalDays,
|
||||||
|
IsReissuableAfterExpire: m.IsReissuableAfterExpire,
|
||||||
|
IsPopup: m.IsPopup,
|
||||||
|
CouponDesc: m.CouponDesc,
|
||||||
|
CreatedAt: m.CreatedAt,
|
||||||
|
UpdatedAt: m.UpdatedAt,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetCouponListDto 优惠卷列表
|
||||||
|
func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||||
|
// 处理返回值
|
||||||
|
responses := make([]*CouponDto, len(m))
|
||||||
|
|
||||||
|
if len(m) > 0 {
|
||||||
|
for i, v := range m {
|
||||||
|
response := &CouponDto{
|
||||||
|
CouponId: fmt.Sprintf("%d", v.CouponId),
|
||||||
|
CouponName: v.CouponName,
|
||||||
|
CouponIcon: utils.AddOssDomain(v.CouponIcon),
|
||||||
|
CouponClient: v.CouponClient,
|
||||||
|
CouponType: v.CouponType,
|
||||||
|
CouponStatus: v.CouponStatus,
|
||||||
|
DistributionObject: v.DistributionObject,
|
||||||
|
ApplicationScope: v.ApplicationScope,
|
||||||
|
BrandId: fmt.Sprintf("%d", v.BrandId),
|
||||||
|
IsMutex: *v.IsMutex,
|
||||||
|
IsDisplay: v.IsDisplay,
|
||||||
|
DistributionWithDay: &v.DistributionWithDay,
|
||||||
|
MinUsableNumber: *v.MinUsableNumber,
|
||||||
|
CouponCount: v.CouponCount,
|
||||||
|
CouponTakeCount: v.CouponTakeCount,
|
||||||
|
CouponUsedCount: v.CouponUsedCount,
|
||||||
|
CouponPrice: v.CouponPrice,
|
||||||
|
WithAmount: v.WithAmount,
|
||||||
|
ValidType: v.ValidType,
|
||||||
|
ValidDays: v.ValidDays,
|
||||||
|
ValidStartTime: v.ValidStartTime,
|
||||||
|
ValidEndTime: v.ValidEndTime,
|
||||||
|
ProductId: v.ProductId,
|
||||||
|
ReissueIntervalDays: v.ReissueIntervalDays,
|
||||||
|
IsReissuableAfterExpire: v.IsReissuableAfterExpire,
|
||||||
|
IsPopup: v.IsPopup,
|
||||||
|
CouponDesc: v.CouponDesc,
|
||||||
|
CreatedAt: v.CreatedAt,
|
||||||
|
UpdatedAt: v.UpdatedAt,
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载关联问诊类型
|
||||||
|
if v.InquiryType != "" {
|
||||||
|
response.LoadInquiryType(v.InquiryType)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将转换后的结构体添加到新切片中
|
||||||
|
responses[i] = response
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responses
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadCouponGrant 加载发放优惠卷数据
|
||||||
|
func (r *CouponDto) LoadCouponGrant(m []*model.CouponGrant) *CouponDto {
|
||||||
|
if len(m) > 0 {
|
||||||
|
d := GetCouponGrantListDto(m)
|
||||||
|
|
||||||
|
r.CouponGrant = d
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadInquiryType 加载关联问诊类型
|
||||||
|
func (r *CouponDto) LoadInquiryType(m string) *CouponDto {
|
||||||
|
if m != "" {
|
||||||
|
inquiryType := strings.Split(m, ",")
|
||||||
|
|
||||||
|
r.InquiryType = inquiryType
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}
|
||||||
59
api/model/coupon.go
Normal file
59
api/model/coupon.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Coupon 优惠卷表
|
||||||
|
type Coupon struct {
|
||||||
|
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);primary_key;comment:主键id" json:"coupon_id"`
|
||||||
|
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
|
||||||
|
CouponIcon string `gorm:"column:coupon_icon;type:varchar(255);comment:优惠卷图片" json:"coupon_icon"`
|
||||||
|
CouponClient int `gorm:"column:coupon_client;type:tinyint(1);comment:使用平台(1:小程序);NOT NULL" json:"coupon_client"`
|
||||||
|
CouponType int `gorm:"column:coupon_type;type:tinyint(1);comment:优惠卷类型(1:无门槛 2:满减 3:数量);NOT NULL" json:"coupon_type"`
|
||||||
|
CouponStatus int `gorm:"column:coupon_status;type:tinyint(1);default:1;comment:状态(1:正常 2:强制失效 3:结束 4:删除)" json:"coupon_status"`
|
||||||
|
DistributionObject int `gorm:"column:distribution_object;type:tinyint(1);default:1;comment:发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)" json:"distribution_object"`
|
||||||
|
ApplicationScope int `gorm:"column:application_scope;type:tinyint(1);default:1;comment:适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)" json:"application_scope"`
|
||||||
|
InquiryType string `gorm:"column:inquiry_type;type:varchar(100);comment:关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)" json:"inquiry_type"`
|
||||||
|
BrandId *int64 `gorm:"column:brand_id;type:bigint(19);comment:关联品牌id(如不限制品牌,此项为空)" json:"brand_id"`
|
||||||
|
IsMutex *int `gorm:"column:is_mutex;type:tinyint(1);default:1;comment:是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用" json:"is_mutex"`
|
||||||
|
IsDisplay int `gorm:"column:is_display;type:tinyint(1);comment:是否展示(0:否 1:是)" json:"is_display"`
|
||||||
|
DistributionWithDay int `gorm:"column:distribution_with_day;type:int(11);default:0;comment:发放关联天数(发放对象为近期消费等类型时规定天数)" json:"distribution_with_day"`
|
||||||
|
MinUsableNumber *int `gorm:"column:min_usable_number;type:int(11);default:1;comment:单商品最小可使用数量(默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)" json:"min_usable_number"`
|
||||||
|
CouponCount int `gorm:"column:coupon_count;type:int(10);default:0;comment:发放数量" json:"coupon_count"`
|
||||||
|
CouponTakeCount int `gorm:"column:coupon_take_count;type:int(10);default:0;comment:已领取数量" json:"coupon_take_count"`
|
||||||
|
CouponUsedCount int `gorm:"column:coupon_used_count;type:int(10);default:0;comment:已使用数量" json:"coupon_used_count"`
|
||||||
|
CouponPrice float64 `gorm:"column:coupon_price;type:decimal(10,2);default:0.00;comment:优惠卷金额" json:"coupon_price"`
|
||||||
|
WithAmount float64 `gorm:"column:with_amount;type:decimal(10,2);default:0.00;comment:符合满减标准金额(优惠卷类型为满减时使用)" json:"with_amount"`
|
||||||
|
ValidType int `gorm:"column:valid_type;type:tinyint(4);comment:有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效);NOT NULL" json:"valid_type"`
|
||||||
|
ValidDays int `gorm:"column:valid_days;type:int(3);comment:自领取之日起有效天数" json:"valid_days"`
|
||||||
|
ValidStartTime *LocalTime `gorm:"column:valid_start_time;type:datetime;comment:开始使用时间" json:"valid_start_time"`
|
||||||
|
ValidEndTime *LocalTime `gorm:"column:valid_end_time;type:datetime;comment:结束使用时间" json:"valid_end_time"`
|
||||||
|
ProductId string `gorm:"column:product_id;type:text;comment:关联商品id,逗号分隔,指定商品时,填入此项。" json:"product_id"`
|
||||||
|
ReissueIntervalDays int `gorm:"column:reissue_interval_days;type:int(5);default:0;comment:确认收货后的再次发放间隔天数(如果设置为 0,则表示不再次发放。当适用范围为商品时生效)" json:"reissue_interval_days"`
|
||||||
|
IsReissuableAfterExpire int `gorm:"column:is_reissuable_after_expire;type:tinyint(1);default:0;comment:过期之后是否允许再次发放(0:否 1:是)" json:"is_reissuable_after_expire"`
|
||||||
|
IsPopup int `gorm:"column:is_popup;type:tinyint(1);default:0;comment:是否首页弹窗(0:否 1:是)" json:"is_popup"`
|
||||||
|
CouponDesc string `gorm:"column:coupon_desc;type:text;comment:优惠卷描述" json:"coupon_desc"`
|
||||||
|
Model
|
||||||
|
CouponGrant []*CouponGrant `gorm:"foreignKey:CouponId;references:coupon_id" json:"coupon_grant"` // 优惠卷发放记录
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coupon) TableName() string {
|
||||||
|
return "gdxz_coupon"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coupon) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.CouponId == 0 {
|
||||||
|
m.CouponId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
api/model/couponGrant.go
Normal file
40
api/model/couponGrant.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CouponGrant 优惠卷发放记录表
|
||||||
|
type CouponGrant struct {
|
||||||
|
GrantId int64 `gorm:"column:grant_id;type:bigint(19);primary_key;comment:主键id" json:"grant_id"`
|
||||||
|
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);comment:优惠卷id" json:"coupon_id"`
|
||||||
|
GrantType int `gorm:"column:grant_type;type:tinyint(1);default:1;comment:发放类型(1:具体用户 2:未拥有用户)" json:"grant_type"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id(发放类型为具体用户时存在)" json:"user_id"`
|
||||||
|
TotalQuantity int `gorm:"column:total_quantity;type:int(5);default:0;comment:目标发放数量" json:"total_quantity"`
|
||||||
|
GrantQuantity int `gorm:"column:grant_quantity;type:int(5);comment:已发放数量" json:"grant_quantity"`
|
||||||
|
GrantResult int `gorm:"column:grant_result;type:tinyint(1);default:2;comment:发放结果(1:成功 2:发放中 3:部分 4:失败)" json:"grant_result"`
|
||||||
|
StopReason string `gorm:"column:stop_reason;type:varchar(255);comment:停止原因" json:"stop_reason"`
|
||||||
|
AdminUserId int64 `gorm:"column:admin_user_id;type:bigint(19);comment:后台操作用户id" json:"admin_user_id"`
|
||||||
|
Model
|
||||||
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CouponGrant) TableName() string {
|
||||||
|
return "gdxz_coupon_grant"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *CouponGrant) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.GrantId == 0 {
|
||||||
|
m.GrantId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
36
api/model/doctorConfigDifficultConsultation.go
Normal file
36
api/model/doctorConfigDifficultConsultation.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigDifficultConsultation 医生配置-疑难会诊
|
||||||
|
type DoctorConfigDifficultConsultation struct {
|
||||||
|
DifficultConsultationId int64 `gorm:"column:difficult_consultation_id;type:bigint(19);primary_key;comment:主键id" json:"difficult_consultation_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||||
|
ServiceContent string `gorm:"column:service_content;type:text;comment:服务内容" json:"service_content"`
|
||||||
|
ServiceProcess string `gorm:"column:service_process;type:text;comment:服务流程" json:"service_process"`
|
||||||
|
ServicePeriod uint `gorm:"column:service_period;type:int(10) unsigned;comment:服务周期;NOT NULL" json:"service_period"`
|
||||||
|
ServiceRounds uint `gorm:"column:service_rounds;type:int(1) unsigned;default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigDifficultConsultation) TableName() string {
|
||||||
|
return "gdxz_doctor_config_difficult_consultation"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigDifficultConsultation) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.DifficultConsultationId == 0 {
|
||||||
|
m.DifficultConsultationId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
36
api/model/doctorConfigFollowPackage.go
Normal file
36
api/model/doctorConfigFollowPackage.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigFollowPackage 医生配置-随访包
|
||||||
|
type DoctorConfigFollowPackage struct {
|
||||||
|
FollowPackageId int64 `gorm:"column:follow_package_id;type:bigint(19);primary_key;comment:主键id" json:"follow_package_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
|
||||||
|
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);default:0;comment:每月次数(0表示不限次)" json:"monthly_frequency"`
|
||||||
|
ServiceRounds int `gorm:"column:service_rounds;type:int(1);default:0;comment:服务回合数(0表示不限次)" json:"service_rounds"`
|
||||||
|
Model
|
||||||
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
|
DoctorConfigFollowPackageItem []*DoctorConfigFollowPackageItem `gorm:"foreignKey:FollowPackageId;references:follow_package_id" json:"doctor_config_follow_package_item"` // 明细
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigFollowPackage) TableName() string {
|
||||||
|
return "gdxz_doctor_config_follow_package"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigFollowPackage) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.FollowPackageId == 0 {
|
||||||
|
m.FollowPackageId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
34
api/model/doctorConfigFollowPackageItem.go
Normal file
34
api/model/doctorConfigFollowPackageItem.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigFollowPackageItem 医生配置-随访包-明细
|
||||||
|
type DoctorConfigFollowPackageItem struct {
|
||||||
|
FollowPackageItemId int64 `gorm:"column:follow_package_item_id;type:bigint(19);primary_key;comment:主键id" json:"follow_package_item_id"`
|
||||||
|
FollowPackageId int64 `gorm:"column:follow_package_id;type:bigint(19);comment:医生随访包id;NOT NULL" json:"follow_package_id"`
|
||||||
|
ServicePeriod int `gorm:"column:service_period;type:int(5);comment:服务周期(天)" json:"service_period"`
|
||||||
|
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);comment:服务价格" json:"service_price"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigFollowPackageItem) TableName() string {
|
||||||
|
return "gdxz_doctor_config_follow_package_item"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigFollowPackageItem) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.FollowPackageItemId == 0 {
|
||||||
|
m.FollowPackageItemId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
36
api/model/doctorConfigHealthPackage.go
Normal file
36
api/model/doctorConfigHealthPackage.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DoctorConfigHealthPackage 医生配置-健康包
|
||||||
|
type DoctorConfigHealthPackage struct {
|
||||||
|
HealthPackageId int64 `gorm:"column:health_package_id;type:bigint(19);primary_key;comment:主键id" json:"health_package_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||||
|
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包配置id;NOT NULL" json:"package_id"`
|
||||||
|
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);comment:服务价格(根据图文问诊价格计算)" json:"service_price"`
|
||||||
|
Model
|
||||||
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
|
HealthPackage *HealthPackage `gorm:"foreignKey:PackageId;references:package_id" json:"health_package"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigHealthPackage) TableName() string {
|
||||||
|
return "gdxz_doctor_config_health_package"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *DoctorConfigHealthPackage) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.HealthPackageId == 0 {
|
||||||
|
m.HealthPackageId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -15,7 +15,7 @@ type DoctorInquiryConfig struct {
|
|||||||
IsEnable int `gorm:"column:is_enable;type:tinyint(1);default:0;comment:是否启用(0:否 1:是)" json:"is_enable"`
|
IsEnable int `gorm:"column:is_enable;type:tinyint(1);default:0;comment:是否启用(0:否 1:是)" json:"is_enable"`
|
||||||
LastEnableMethod int `gorm:"column:last_enable_method;type:tinyint(1);default:1;comment:最后开启方式(1:自己 2:后台)" json:"last_enable_method"`
|
LastEnableMethod int `gorm:"column:last_enable_method;type:tinyint(1);default:1;comment:最后开启方式(1:自己 2:后台)" json:"last_enable_method"`
|
||||||
WorkNumDay int `gorm:"column:work_num_day;type:int(10);default:0;comment:每日接诊数量" json:"work_num_day"`
|
WorkNumDay int `gorm:"column:work_num_day;type:int(10);default:0;comment:每日接诊数量" json:"work_num_day"`
|
||||||
InquiryPrice float64 `gorm:"column:inquiry_price;type:decimal(10,2);comment:接诊价格(专家问诊-公益问诊)" json:"inquiry_price"`
|
InquiryPrice *float64 `gorm:"column:inquiry_price;type:decimal(10,2);comment:接诊价格(专家问诊-公益问诊)" json:"inquiry_price"`
|
||||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
Model
|
Model
|
||||||
}
|
}
|
||||||
|
|||||||
37
api/model/healthPackage.go
Normal file
37
api/model/healthPackage.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HealthPackage 健康包
|
||||||
|
type HealthPackage struct {
|
||||||
|
PackageId int64 `gorm:"column:package_id;type:bigint(20);primary_key;comment:主键id" json:"package_id"`
|
||||||
|
ServiceCount int `gorm:"column:service_count;type:int(1);comment:总服务次数" json:"service_count"`
|
||||||
|
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);comment:每月次数" json:"monthly_frequency"`
|
||||||
|
EffectiveDays string `gorm:"column:effective_days;type:varchar(20);comment:服务有效天数" json:"effective_days"`
|
||||||
|
ServiceRate string `gorm:"column:service_rate;type:varchar(20);comment:服务费率。100为满值,表示1,正常费率。" json:"service_rate"`
|
||||||
|
DiscountProductTotalAmount float64 `gorm:"column:discount_product_total_amount;type:decimal(10,2) unsigned;default:0.00;comment:折扣商品总价格" json:"discount_product_total_amount"`
|
||||||
|
Model
|
||||||
|
HealthPackageProduct []*HealthPackageProduct `gorm:"foreignKey:PackageId;references:package_id" json:"health_package_product"` // 健康包-关联商品
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HealthPackage) TableName() string {
|
||||||
|
return "gdxz_health_package"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HealthPackage) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.PackageId == 0 {
|
||||||
|
m.PackageId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
36
api/model/healthPackageProduct.go
Normal file
36
api/model/healthPackageProduct.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HealthPackageProduct 健康包-关联商品
|
||||||
|
type HealthPackageProduct struct {
|
||||||
|
PackageProductId int64 `gorm:"column:package_product_id;type:bigint(19);comment:主键id" json:"package_product_id"`
|
||||||
|
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包id" json:"package_id"`
|
||||||
|
ProductId int64 `gorm:"column:product_id;type:bigint(19);primary_key;comment:商品id" json:"product_id"`
|
||||||
|
ProductName string `gorm:"column:product_name;type:varchar(255);comment:商品名称" json:"product_name"`
|
||||||
|
Quantity int `gorm:"column:quantity;type:int(1);default:1;comment:数量" json:"quantity"`
|
||||||
|
DiscountProductPrice float64 `gorm:"column:discount_product_price;type:decimal(10,2) unsigned;default:0.00;comment:折扣商品价格" json:"discount_product_price"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HealthPackageProduct) TableName() string {
|
||||||
|
return "gdxz_health_package_product"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *HealthPackageProduct) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.PackageProductId == 0 {
|
||||||
|
m.PackageProductId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
51
api/model/order.go
Normal file
51
api/model/order.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Order 订单表
|
||||||
|
type Order struct {
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);primary_key;comment:主键id" json:"order_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id(存在为null的情况)" json:"doctor_id"`
|
||||||
|
OrderType int `gorm:"column:order_type;type:tinyint(1);comment:订单类型(1:问诊订单 2:药品订单 3:检测订单 4:随访包订单 5:健康包订单);NOT NULL" json:"order_type"`
|
||||||
|
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
|
||||||
|
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);default:1;comment:支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付);NOT NULL" json:"pay_channel"`
|
||||||
|
PayStatus int `gorm:"column:pay_status;type:tinyint(1);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款);NOT NULL" json:"pay_status"`
|
||||||
|
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
|
||||||
|
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款);NOT NULL" json:"refund_status"`
|
||||||
|
OrderNo string `gorm:"column:order_no;type:varchar(30);comment:系统订单编号;NOT NULL" json:"order_no"`
|
||||||
|
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"`
|
||||||
|
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2) unsigned;default:0.00;comment:订单金额" json:"amount_total"`
|
||||||
|
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2) unsigned;default:0.00;comment:优惠卷总金额" json:"coupon_amount_total"`
|
||||||
|
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2) unsigned;default:0.00;comment:实际付款金额" json:"payment_amount_total"`
|
||||||
|
CancelStatus int `gorm:"column:cancel_status;type:tinyint(1);default:0;comment:取消状态(0:否 1:是)" json:"cancel_status"`
|
||||||
|
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
|
||||||
|
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:取消订单备注" json:"cancel_remarks"`
|
||||||
|
OrderRemarks string `gorm:"column:order_remarks;type:varchar(255);comment:订单备注" json:"order_remarks"`
|
||||||
|
IsWithdrawal int `gorm:"column:is_withdrawal;type:tinyint(1);default:0;comment:是否提现(0:否 1:是 2:提现中 3:无需提现)" json:"is_withdrawal"`
|
||||||
|
WithdrawalTime LocalTime `gorm:"column:withdrawal_time;type:datetime;comment:提现时间" json:"withdrawal_time"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Order) TableName() string {
|
||||||
|
return "gdxz_order"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Order) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderId == 0 {
|
||||||
|
m.OrderId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
34
api/model/orderCoupon.go
Normal file
34
api/model/orderCoupon.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderCoupon struct {
|
||||||
|
OrderCouponId int64 `gorm:"column:order_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"order_coupon_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
|
||||||
|
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);comment:用户优惠卷表id;NOT NULL" json:"user_coupon_id"`
|
||||||
|
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
|
||||||
|
CouponUsePrice float64 `gorm:"column:coupon_use_price;type:decimal(10,2);default:0.00;comment:优惠卷使用金额" json:"coupon_use_price"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderCoupon) TableName() string {
|
||||||
|
return "gdxz_order_coupon"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderCoupon) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderCouponId == 0 {
|
||||||
|
m.OrderCouponId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@ import (
|
|||||||
// OrderInquiry 订单-问诊表
|
// OrderInquiry 订单-问诊表
|
||||||
type OrderInquiry struct {
|
type OrderInquiry struct {
|
||||||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"order_inquiry_id"`
|
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"order_inquiry_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
|
||||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
||||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id(未分配时为null)" json:"doctor_id"`
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id(未分配时为null)" json:"doctor_id"`
|
||||||
|
|||||||
37
api/model/orderPrescriptionFile.go
Normal file
37
api/model/orderPrescriptionFile.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderPrescriptionFile 订单-处方表-ca处方文件
|
||||||
|
type OrderPrescriptionFile struct {
|
||||||
|
PrescriptionFileId int64 `gorm:"column:prescription_file_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_file_id"`
|
||||||
|
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id" json:"order_prescription_id"`
|
||||||
|
DoctorCaFileId string `gorm:"column:doctor_ca_file_id;type:varchar(100);comment:医生签章pdf文件id(可请求ca下载)" json:"doctor_ca_file_id"`
|
||||||
|
HospitalCaFileId string `gorm:"column:hospital_ca_file_id;type:varchar(100);comment:医院签章pdf文件id(可请求ca下载)" json:"hospital_ca_file_id"`
|
||||||
|
PrescriptionImgOssPath string `gorm:"column:prescription_img_oss_path;type:varchar(255);comment:签章img文件oss路径" json:"prescription_img_oss_path"`
|
||||||
|
PrescriptionPdfOssPath string `gorm:"column:prescription_pdf_oss_path;type:varchar(255);comment:签章pdf文件oss路径" json:"prescription_pdf_oss_path"`
|
||||||
|
IsConvertedPdf int `gorm:"column:is_converted_pdf;type:tinyint(1);default:0;comment:是否已转换pdf为图片(0:否 1:是)" json:"is_converted_pdf"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderPrescriptionFile) TableName() string {
|
||||||
|
return "gdxz_order_prescription_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderPrescriptionFile) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.PrescriptionFileId == 0 {
|
||||||
|
m.PrescriptionFileId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -8,50 +8,53 @@ import (
|
|||||||
|
|
||||||
// OrderProduct 订单-商品订单表
|
// OrderProduct 订单-商品订单表
|
||||||
type OrderProduct struct {
|
type OrderProduct struct {
|
||||||
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(20);primary_key;comment:主键id" json:"order_product_id"`
|
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(20);primary_key;comment:主键id" json:"order_product_id"`
|
||||||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||||||
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"`
|
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id;NOT NULL" json:"order_prescription_id"`
|
||||||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
|
||||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
|
||||||
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户)" json:"family_id"`
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||||||
OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单编号" json:"order_product_no"`
|
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户)" json:"family_id"`
|
||||||
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"`
|
OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单编号" json:"order_product_no"`
|
||||||
OrderProductStatus int `gorm:"column:order_product_status;type:tinyint(1);comment:订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)" json:"order_product_status"`
|
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号" json:"escrow_trade_no"`
|
||||||
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道(1:小程序支付 2:微信扫码支付);NOT NULL" json:"pay_channel"`
|
OrderProductStatus int `gorm:"column:order_product_status;type:tinyint(1);comment:订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)" json:"order_product_status"`
|
||||||
PayStatus int `gorm:"column:pay_status;type:tinyint(4);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)" json:"pay_status"`
|
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道(1:小程序支付 2:微信扫码支付);NOT NULL" json:"pay_channel"`
|
||||||
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
|
PayStatus int `gorm:"column:pay_status;type:tinyint(4);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)" json:"pay_status"`
|
||||||
CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)" json:"cancel_reason"`
|
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
|
||||||
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"`
|
CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:订单取消原因(1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)" json:"cancel_reason"`
|
||||||
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"`
|
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"`
|
||||||
LogisticsFee float64 `gorm:"column:logistics_fee;type:decimal(10,2);default:0.00;comment:运费金额" json:"logistics_fee"`
|
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2);default:0.00;comment:优惠卷总金额" json:"coupon_amount_total"`
|
||||||
LogisticsNo string `gorm:"column:logistics_no;type:varchar(100);comment:物流编号" json:"logistics_no"`
|
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"`
|
||||||
LogisticsCompanyCode string `gorm:"column:logistics_company_code;type:varchar(255);comment:快递公司编码" json:"logistics_company_code"`
|
LogisticsFee float64 `gorm:"column:logistics_fee;type:decimal(10,2);default:0.00;comment:运费金额" json:"logistics_fee"`
|
||||||
SubLogisticsStatus int `gorm:"column:sub_logistics_status;type:tinyint(1);default:0;comment:快递推送订阅状态(0:未订阅/无需订阅 1:已订阅 2:订阅失败)" json:"sub_logistics_status"`
|
LogisticsNo string `gorm:"column:logistics_no;type:varchar(100);comment:物流编号" json:"logistics_no"`
|
||||||
DeliveryTime LocalTime `gorm:"column:delivery_time;type:datetime;comment:发货时间" json:"delivery_time"`
|
LogisticsCompanyCode string `gorm:"column:logistics_company_code;type:varchar(255);comment:快递公司编码" json:"logistics_company_code"`
|
||||||
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
|
SubLogisticsStatus int `gorm:"column:sub_logistics_status;type:tinyint(1);default:0;comment:快递推送订阅状态(0:未订阅/无需订阅 1:已订阅 2:订阅失败)" json:"sub_logistics_status"`
|
||||||
Remarks string `gorm:"column:remarks;type:varchar(255);comment:订单备注" json:"remarks"`
|
DeliveryTime LocalTime `gorm:"column:delivery_time;type:datetime;comment:发货时间" json:"delivery_time"`
|
||||||
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"refund_status"`
|
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
|
||||||
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
|
Remarks string `gorm:"column:remarks;type:varchar(255);comment:订单备注" json:"remarks"`
|
||||||
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:订单取消备注(自动添加)" json:"cancel_remarks"`
|
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:商品订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"refund_status"`
|
||||||
ReportPreStatus int `gorm:"column:report_pre_status;type:tinyint(1);default:0;comment:上报处方平台状态(0:未上报 1:已上报 2:上报失败))" json:"report_pre_status"`
|
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
|
||||||
ReportPreTime LocalTime `gorm:"column:report_pre_time;type:datetime;comment:上报处方平台时间" json:"report_pre_time"`
|
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:订单取消备注(自动添加)" json:"cancel_remarks"`
|
||||||
ReportPreFailReason string `gorm:"column:report_pre_fail_reason;type:text;comment:上报失败原因" json:"report_pre_fail_reason"`
|
ReportPreStatus int `gorm:"column:report_pre_status;type:tinyint(1);default:0;comment:上报处方平台状态(0:未上报 1:已上报 2:上报失败))" json:"report_pre_status"`
|
||||||
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
|
ReportPreTime LocalTime `gorm:"column:report_pre_time;type:datetime;comment:上报处方平台时间" json:"report_pre_time"`
|
||||||
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
|
ReportPreFailReason string `gorm:"column:report_pre_fail_reason;type:text;comment:上报失败原因" json:"report_pre_fail_reason"`
|
||||||
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
|
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
|
||||||
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
|
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
|
||||||
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
|
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
|
||||||
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
|
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
|
||||||
Address string `gorm:"column:address;type:varchar(255);comment:详细地址" json:"address"`
|
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
|
||||||
AddressMask string `gorm:"column:address_mask;type:varchar(255);comment:详细地址(掩码)" json:"address_mask"`
|
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
|
||||||
ConsigneeName string `gorm:"column:consignee_name;type:varchar(150);comment:收货人姓名" json:"consignee_name"`
|
Address string `gorm:"column:address;type:varchar(255);comment:详细地址" json:"address"`
|
||||||
ConsigneeNameMask string `gorm:"column:consignee_name_mask;type:varchar(150);comment:收货人姓名(掩码)" json:"consignee_name_mask"`
|
AddressMask string `gorm:"column:address_mask;type:varchar(255);comment:详细地址(掩码)" json:"address_mask"`
|
||||||
ConsigneeTel string `gorm:"column:consignee_tel;type:varchar(50);comment:收货人电话" json:"consignee_tel"`
|
ConsigneeName string `gorm:"column:consignee_name;type:varchar(150);comment:收货人姓名" json:"consignee_name"`
|
||||||
ConsigneeTelMask string `gorm:"column:consignee_tel_mask;type:varchar(50);comment:收货人电话(掩码)" json:"consignee_tel_mask"`
|
ConsigneeNameMask string `gorm:"column:consignee_name_mask;type:varchar(150);comment:收货人姓名(掩码)" json:"consignee_name_mask"`
|
||||||
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
ConsigneeTel string `gorm:"column:consignee_tel;type:varchar(50);comment:收货人电话" json:"consignee_tel"`
|
||||||
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 问诊
|
ConsigneeTelMask string `gorm:"column:consignee_tel_mask;type:varchar(50);comment:收货人电话(掩码)" json:"consignee_tel_mask"`
|
||||||
UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"` // 患者
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
OrderPrescription *OrderPrescription `gorm:"foreignKey:OrderPrescriptionId;references:order_prescription_id" json:"order_prescription"` // 处方
|
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 问诊
|
||||||
|
UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"` // 患者
|
||||||
|
OrderPrescription *OrderPrescription `gorm:"foreignKey:OrderPrescriptionId;references:order_prescription_id" json:"order_prescription"` // 处方
|
||||||
|
OrderProductItem []*OrderProductItem `gorm:"foreignKey:OrderProductId;references:order_product_id" json:"order_product_item"` // 处方
|
||||||
Model
|
Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
35
api/model/orderProductCoupon.go
Normal file
35
api/model/orderProductCoupon.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderProductCoupon 订单-商品-优惠卷表
|
||||||
|
type OrderProductCoupon struct {
|
||||||
|
OrderCouponId int64 `gorm:"column:order_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"order_coupon_id"`
|
||||||
|
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(19);comment:订单-商品id" json:"order_product_id"`
|
||||||
|
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);comment:用户优惠卷表id" json:"user_coupon_id"`
|
||||||
|
CouponName string `gorm:"column:coupon_name;type:varchar(255);comment:优惠卷名称" json:"coupon_name"`
|
||||||
|
CouponUsePrice float64 `gorm:"column:coupon_use_price;type:decimal(10,2);default:0.00;comment:优惠卷使用金额" json:"coupon_use_price"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderProductCoupon) TableName() string {
|
||||||
|
return "gdxz_order_product_coupon"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderProductCoupon) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderCouponId == 0 {
|
||||||
|
m.OrderCouponId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
api/model/orderRefund.go
Normal file
40
api/model/orderRefund.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderRefund 订单-退款表
|
||||||
|
type OrderRefund struct {
|
||||||
|
OrderRefundId int64 `gorm:"column:order_refund_id;type:bigint(19);primary_key;comment:主键id" json:"order_refund_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||||||
|
OrderNo string `gorm:"column:order_no;type:varchar(40);comment:系统订单编号" json:"order_no"`
|
||||||
|
RefundNo string `gorm:"column:refund_no;type:varchar(50);comment:系统退款编号;NOT NULL" json:"refund_no"`
|
||||||
|
RefundId string `gorm:"column:refund_id;type:varchar(50);comment:第三方退款单号" json:"refund_id"`
|
||||||
|
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)" json:"refund_status"`
|
||||||
|
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);default:0.00;comment:退款金额" json:"refund_total"`
|
||||||
|
RefundReason string `gorm:"column:refund_reason;type:varchar(255);comment:退款原因" json:"refund_reason"`
|
||||||
|
SuccessTime LocalTime `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderRefund) TableName() string {
|
||||||
|
return "gdxz_order_refund"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderRefund) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderRefundId == 0 {
|
||||||
|
m.OrderRefundId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
65
api/model/orderServicePackage.go
Normal file
65
api/model/orderServicePackage.go
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackage 订单-服务包表
|
||||||
|
type OrderServicePackage struct {
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id-患者;NOT NULL" json:"user_id"`
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||||
|
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||||||
|
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户);NOT NULL" json:"family_id"`
|
||||||
|
OrderServiceType int `gorm:"column:order_service_type;type:tinyint(1);comment:服务包类型(1:健康包 2:随访包);NOT NULL" json:"order_service_type"`
|
||||||
|
OrderServiceStatus int `gorm:"column:order_service_status;type:tinyint(4);comment:订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消);NOT NULL" json:"order_service_status"`
|
||||||
|
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
|
||||||
|
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款);NOT NULL" json:"refund_status"`
|
||||||
|
PayChannel int `gorm:"column:pay_channel;type:tinyint(1);comment:支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付);NOT NULL" json:"pay_channel"`
|
||||||
|
PayStatus int `gorm:"column:pay_status;type:tinyint(1);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款);NOT NULL" json:"pay_status"`
|
||||||
|
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:系统订单编号;NOT NULL" json:"order_service_no"`
|
||||||
|
EscrowTradeNo string `gorm:"column:escrow_trade_no;type:varchar(100);comment:第三方支付流水号;NOT NULL" json:"escrow_trade_no"`
|
||||||
|
AmountTotal float64 `gorm:"column:amount_total;type:decimal(10,2);default:0.00;comment:订单金额" json:"amount_total"`
|
||||||
|
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2);default:0.00;comment:优惠卷总金额" json:"coupon_amount_total"`
|
||||||
|
PaymentAmountTotal float64 `gorm:"column:payment_amount_total;type:decimal(10,2);default:0.00;comment:实际付款金额" json:"payment_amount_total"`
|
||||||
|
PayTime LocalTime `gorm:"column:pay_time;type:datetime;comment:支付时间" json:"pay_time"`
|
||||||
|
StartTime LocalTime `gorm:"column:start_time;type:datetime;comment:开始服务时间" json:"start_time"`
|
||||||
|
FinishTime LocalTime `gorm:"column:finish_time;type:datetime;comment:结束服务时间" json:"finish_time"`
|
||||||
|
CancelTime LocalTime `gorm:"column:cancel_time;type:datetime;comment:订单取消时间" json:"cancel_time"`
|
||||||
|
CancelReason int `gorm:"column:cancel_reason;type:tinyint(1);comment:取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)" json:"cancel_reason"`
|
||||||
|
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:取消订单备注" json:"cancel_remarks"`
|
||||||
|
AddFinishStatus int `gorm:"column:add_finish_status;type:tinyint(1);default:0;comment:添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)" json:"add_finish_status"`
|
||||||
|
AddFinishTime LocalTime `gorm:"column:add_finish_time;type:datetime;comment:添加完成订单延迟队列时间" json:"add_finish_time"`
|
||||||
|
AddFinishFailReason string `gorm:"column:add_finish_fail_reason;type:varchar(255);comment:添加完成订单延迟队列失败原因" json:"add_finish_fail_reason"`
|
||||||
|
PatientName string `gorm:"column:patient_name;type:varchar(255);comment:患者姓名-就诊人" json:"patient_name"`
|
||||||
|
PatientNameMask string `gorm:"column:patient_name_mask;type:varchar(255);comment:患者姓名-就诊人(掩码)" json:"patient_name_mask"`
|
||||||
|
PatientSex int `gorm:"column:patient_sex;type:tinyint(1);default:0;comment:患者性别-就诊人(0:未知 1:男 2:女)" json:"patient_sex"`
|
||||||
|
PatientAge int `gorm:"column:patient_age;type:int(1);comment:患者年龄-就诊人" json:"patient_age"`
|
||||||
|
Model
|
||||||
|
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
|
||||||
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 患者
|
||||||
|
OrderServicePackageInquiry []*OrderServicePackageInquiry `gorm:"foreignKey:OrderServiceId;references:order_service_id" json:"order_service_package_inquiry"` // 关联问诊订单
|
||||||
|
OrderServicePackageProduct []*OrderServicePackageProduct `gorm:"foreignKey:OrderServiceId;references:order_service_id" json:"order_service_package_product"` // 关联商品订单
|
||||||
|
UserPatient *UserPatient `gorm:"foreignKey:PatientId;references:patient_id" json:"user_patient"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackage) TableName() string {
|
||||||
|
return "gdxz_order_service_package"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackage) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderServiceId == 0 {
|
||||||
|
m.OrderServiceId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
51
api/model/orderServicePackageCase.go
Normal file
51
api/model/orderServicePackageCase.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderServicePackageCase struct {
|
||||||
|
OrderServiceCaseId int64 `gorm:"column:order_service_case_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_case_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id;NOT NULL" json:"order_id"`
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
|
||||||
|
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id;NOT NULL" json:"family_id"`
|
||||||
|
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
|
||||||
|
Relation int `gorm:"column:relation;type:tinyint(1);comment:与患者关系(1:本人 2:父母 3:爱人 4:子女 5:亲戚 6:其他 )" json:"relation"`
|
||||||
|
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:正常 2:删除)" json:"status"`
|
||||||
|
Name string `gorm:"column:name;type:varchar(50);comment:患者名称" json:"name"`
|
||||||
|
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:患者性别(0:未知 1:男 2:女)" json:"sex"`
|
||||||
|
Age int `gorm:"column:age;type:int(11);comment:患者年龄" json:"age"`
|
||||||
|
DiseaseClassName string `gorm:"column:disease_class_name;type:varchar(255);comment:疾病名称-系统" json:"disease_class_name"`
|
||||||
|
DiagnosisDate LocalTime `gorm:"column:diagnosis_date;type:datetime;comment:确诊日期" json:"diagnosis_date"`
|
||||||
|
DiseaseDesc string `gorm:"column:disease_desc;type:text;comment:病情描述(主诉)" json:"disease_desc"`
|
||||||
|
DiagnoseImages string `gorm:"column:diagnose_images;type:varchar(1000);comment:复诊凭证(多个使用逗号分隔)" json:"diagnose_images"`
|
||||||
|
IsAllergyHistory int `gorm:"column:is_allergy_history;type:tinyint(1);comment:是否存在过敏史(0:否 1:是)" json:"is_allergy_history"`
|
||||||
|
AllergyHistory string `gorm:"column:allergy_history;type:varchar(255);comment:过敏史描述" json:"allergy_history"`
|
||||||
|
IsFamilyHistory int `gorm:"column:is_family_history;type:tinyint(1);comment:是否存在家族病史(0:否 1:是)" json:"is_family_history"`
|
||||||
|
FamilyHistory string `gorm:"column:family_history;type:varchar(255);comment:家族病史描述" json:"family_history"`
|
||||||
|
IsPregnant int `gorm:"column:is_pregnant;type:tinyint(1);comment:是否备孕、妊娠、哺乳期(0:否 1:是)" json:"is_pregnant"`
|
||||||
|
Pregnant string `gorm:"column:pregnant;type:varchar(255);comment:备孕、妊娠、哺乳期描述" json:"pregnant"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageCase) TableName() string {
|
||||||
|
return "gdxz_order_service_package_case"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageCase) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderServiceCaseId == 0 {
|
||||||
|
m.OrderServiceCaseId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
api/model/orderServicePackageDetail.go
Normal file
40
api/model/orderServicePackageDetail.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageDetail 订单-服务包详情表
|
||||||
|
type OrderServicePackageDetail struct {
|
||||||
|
OrderServiceDetailId int64 `gorm:"column:order_service_detail_id;type:bigint(19);primary_key;comment:主键id" json:"order_service_detail_id"`
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:服务包订单id" json:"order_service_id"`
|
||||||
|
OrderId int64 `gorm:"column:order_id;type:bigint(19);comment:订单id" json:"order_id"`
|
||||||
|
PackageId int64 `gorm:"column:package_id;type:bigint(19);comment:健康包配置id(随访包时为空)" json:"package_id"`
|
||||||
|
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:系统订单编号" json:"order_service_no"`
|
||||||
|
ServicePeriod int `gorm:"column:service_period;type:int(1);comment:服务周期(天)" json:"service_period"`
|
||||||
|
ServiceCount int `gorm:"column:service_count;type:int(1);comment:总服务次数(0表示不限次)" json:"service_count"`
|
||||||
|
MonthlyFrequency int `gorm:"column:monthly_frequency;type:int(1);comment:每月次数(0表示不限次)" json:"monthly_frequency"`
|
||||||
|
SingleInquiryPrice float64 `gorm:"column:single_inquiry_price;type:decimal(10,2);default:0.00;comment:单次图文问诊价格" json:"single_inquiry_price"`
|
||||||
|
ServicePrice float64 `gorm:"column:service_price;type:decimal(10,2);default:0.00;comment:总服务价格" json:"service_price"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageDetail) TableName() string {
|
||||||
|
return "gdxz_order_service_package_detail"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageDetail) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.OrderServiceDetailId == 0 {
|
||||||
|
m.OrderServiceDetailId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
36
api/model/orderServicePackageInquiry.go
Normal file
36
api/model/orderServicePackageInquiry.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageInquiry 服务包关联问诊订单表
|
||||||
|
type OrderServicePackageInquiry struct {
|
||||||
|
ServiceInquiryId int64 `gorm:"column:service_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"service_inquiry_id"`
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
|
||||||
|
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||||||
|
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(30);comment:服务包系统订单编号" json:"order_service_no"`
|
||||||
|
InquiryNo string `gorm:"column:inquiry_no;type:varchar(30);comment:问诊系统订单编号" json:"inquiry_no"`
|
||||||
|
Model
|
||||||
|
OrderInquiry *OrderInquiry `gorm:"foreignKey:OrderInquiryId;references:order_inquiry_id" json:"order_inquiry"` // 关联问诊订单
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageInquiry) TableName() string {
|
||||||
|
return "gdxz_order_service_package_inquiry"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageInquiry) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.ServiceInquiryId == 0 {
|
||||||
|
m.ServiceInquiryId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
38
api/model/orderServicePackageProduct.go
Normal file
38
api/model/orderServicePackageProduct.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageProduct 订单-服务包-关联商品订单表
|
||||||
|
type OrderServicePackageProduct struct {
|
||||||
|
ServiceProductId int64 `gorm:"column:service_product_id;type:bigint(19);primary_key;comment:主键id" json:"service_product_id"`
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id;NOT NULL" json:"order_service_id"`
|
||||||
|
OrderProductId int64 `gorm:"column:order_product_id;type:bigint(19);comment:订单-商品id;NOT NULL" json:"order_product_id"`
|
||||||
|
OrderProductNo string `gorm:"column:order_product_no;type:varchar(100);comment:订单-商品系统编号;NOT NULL" json:"order_product_no"`
|
||||||
|
ProductItemId int64 `gorm:"column:product_item_id;type:bigint(19);comment:订单-商品明细id;NOT NULL" json:"product_item_id"`
|
||||||
|
ProductId int64 `gorm:"column:product_id;type:bigint(19);comment:商品id;NOT NULL" json:"product_id"`
|
||||||
|
UsedQuantity int `gorm:"column:used_quantity;type:int(1);default:0;comment:商品使用数量" json:"used_quantity"`
|
||||||
|
Model
|
||||||
|
OrderProduct *OrderProduct `gorm:"foreignKey:OrderProductId;references:order_product_id" json:"order_product"` // 关联药品订单
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageProduct) TableName() string {
|
||||||
|
return "gdxz_order_service_package_product"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageProduct) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.ServiceProductId == 0 {
|
||||||
|
m.ServiceProductId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
api/model/orderServicePackageRefund.go
Normal file
40
api/model/orderServicePackageRefund.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderServicePackageRefund 订单-服务包-退款表
|
||||||
|
type OrderServicePackageRefund struct {
|
||||||
|
ServiceRefundId int64 `gorm:"column:service_refund_id;type:bigint(19);primary_key;comment:主键id" json:"service_refund_id"`
|
||||||
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||||||
|
OrderServiceId int64 `gorm:"column:order_service_id;type:bigint(19);comment:订单-服务包id" json:"order_service_id"`
|
||||||
|
OrderServiceNo string `gorm:"column:order_service_no;type:varchar(100);comment:系统订单编号" json:"order_service_no"`
|
||||||
|
ServiceRefundNo string `gorm:"column:service_refund_no;type:varchar(50);comment:系统退款编号" json:"service_refund_no"`
|
||||||
|
RefundId string `gorm:"column:refund_id;type:varchar(50);comment:第三方退款单号" json:"refund_id"`
|
||||||
|
RefundStatus int `gorm:"column:refund_status;type:tinyint(1);default:0;comment:订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)" json:"refund_status"`
|
||||||
|
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);default:0.00;comment:退款金额" json:"refund_total"`
|
||||||
|
RefundReason string `gorm:"column:refund_reason;type:varchar(255);comment:退款原因" json:"refund_reason"`
|
||||||
|
SuccessTime LocalTime `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageRefund) TableName() string {
|
||||||
|
return "gdxz_order_service_package_refund"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderServicePackageRefund) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.ServiceRefundId == 0 {
|
||||||
|
m.ServiceRefundId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
40
api/model/popup.go
Normal file
40
api/model/popup.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"hospital-admin-api/global"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Popup 弹窗表
|
||||||
|
type Popup struct {
|
||||||
|
PopupId int64 `gorm:"column:popup_id;type:bigint(19);primary_key;comment:主键id" json:"popup_id"`
|
||||||
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
|
||||||
|
AppType int `gorm:"column:app_type;type:tinyint(4);comment:应用程序类型(1:小程序 2:app);NOT NULL" json:"app_type"`
|
||||||
|
ClientType int `gorm:"column:client_type;type:tinyint(4);comment:客户端类型(1:患者端 2:医生端 3:药师端);NOT NULL" json:"client_type"`
|
||||||
|
Status int `gorm:"column:status;type:tinyint(4);default:0;comment:状态(0:未弹 1:已弹)" json:"status"`
|
||||||
|
PopupType int `gorm:"column:popup_type;type:tinyint(4);comment:弹窗类型(1:结算费用规则 2:新优惠卷弹窗);NOT NULL" json:"popup_type"`
|
||||||
|
PopupTitle string `gorm:"column:popup_title;type:varchar(255);comment:标题" json:"popup_title"`
|
||||||
|
PopupContent string `gorm:"column:popup_content;type:varchar(1000);comment:内容" json:"popup_content"`
|
||||||
|
PopupImg string `gorm:"column:popup_img;type:varchar(255);comment:封面图片" json:"popup_img"`
|
||||||
|
PopupLink string `gorm:"column:popup_link;type:varchar(255);comment:跳转地址" json:"popup_link"`
|
||||||
|
Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Popup) TableName() string {
|
||||||
|
return "gdxz_popup"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Popup) BeforeCreate(tx *gorm.DB) error {
|
||||||
|
if m.PopupId == 0 {
|
||||||
|
m.PopupId = global.Snowflake.Generate().Int64()
|
||||||
|
}
|
||||||
|
|
||||||
|
m.CreatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("CreatedAt", m.CreatedAt)
|
||||||
|
|
||||||
|
m.UpdatedAt = LocalTime(time.Now())
|
||||||
|
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@ type Product struct {
|
|||||||
ProductPrice float64 `gorm:"column:product_price;type:decimal(10,2);comment:商品价格" json:"product_price"`
|
ProductPrice float64 `gorm:"column:product_price;type:decimal(10,2);comment:商品价格" json:"product_price"`
|
||||||
MnemonicCode string `gorm:"column:mnemonic_code;type:varchar(50);comment:商品助记码(首字母简拼)" json:"mnemonic_code"`
|
MnemonicCode string `gorm:"column:mnemonic_code;type:varchar(50);comment:商品助记码(首字母简拼)" json:"mnemonic_code"`
|
||||||
ProductType int `gorm:"column:product_type;type:tinyint(4);default:1;comment:药品类型(0:未知 1:中成药 2:西药)" json:"product_type"`
|
ProductType int `gorm:"column:product_type;type:tinyint(4);default:1;comment:药品类型(0:未知 1:中成药 2:西药)" json:"product_type"`
|
||||||
|
IsMajing int `gorm:"column:is_majing;type:tinyint(1);default:0;comment:是否麻精药品(0:否 1:是)" json:"is_majing"`
|
||||||
ProductPlatformCode string `gorm:"column:product_platform_code;type:varchar(100);comment:处方平台商品编码" json:"product_platform_code"`
|
ProductPlatformCode string `gorm:"column:product_platform_code;type:varchar(100);comment:处方平台商品编码" json:"product_platform_code"`
|
||||||
ProductPharmacyCode string `gorm:"column:product_pharmacy_code;type:varchar(100);comment:第三方药店商品编码" json:"product_pharmacy_code"`
|
ProductPharmacyCode string `gorm:"column:product_pharmacy_code;type:varchar(100);comment:第三方药店商品编码" json:"product_pharmacy_code"`
|
||||||
ProductCoverImg string `gorm:"column:product_cover_img;type:varchar(255);comment:商品封面图" json:"product_cover_img"`
|
ProductCoverImg string `gorm:"column:product_cover_img;type:varchar(255);comment:商品封面图" json:"product_cover_img"`
|
||||||
|
|||||||
@ -8,15 +8,17 @@ import (
|
|||||||
|
|
||||||
// UserCoupon 用户优惠卷表
|
// UserCoupon 用户优惠卷表
|
||||||
type UserCoupon struct {
|
type UserCoupon struct {
|
||||||
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"user_coupon_id"`
|
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"user_coupon_id"`
|
||||||
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
|
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
|
||||||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
|
||||||
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);comment:优惠卷id;NOT NULL" json:"coupon_id"`
|
CouponId int64 `gorm:"column:coupon_id;type:bigint(19);comment:优惠卷id;NOT NULL" json:"coupon_id"`
|
||||||
UserCouponStatus int `gorm:"column:user_coupon_status;type:tinyint(1);default:0;comment:状态(0:未使用 1:已使用 3:已过期)" json:"user_coupon_status"`
|
UserCouponStatus int `gorm:"column:user_coupon_status;type:tinyint(1);default:0;comment:状态(0:未使用 1:已使用 3:已过期)" json:"user_coupon_status"`
|
||||||
CouponUseDate time.Time `gorm:"column:coupon_use_date;type:datetime;comment:使用时间" json:"coupon_use_date"`
|
CouponUseDate *LocalTime `gorm:"column:coupon_use_date;type:datetime;comment:使用时间" json:"coupon_use_date"`
|
||||||
ValidStartTime time.Time `gorm:"column:valid_start_time;type:datetime;comment:有效使用时间" json:"valid_start_time"`
|
ValidStartTime time.Time `gorm:"column:valid_start_time;type:datetime;comment:有效使用时间" json:"valid_start_time"`
|
||||||
ValidEndTime time.Time `gorm:"column:valid_end_time;type:datetime;comment:过期使用时间" json:"valid_end_time"`
|
ValidEndTime time.Time `gorm:"column:valid_end_time;type:datetime;comment:过期使用时间" json:"valid_end_time"`
|
||||||
Model
|
Model
|
||||||
|
Coupon *Coupon `gorm:"foreignKey:CouponId;references:coupon_id" json:"coupon"`
|
||||||
|
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *UserCoupon) TableName() string {
|
func (m *UserCoupon) TableName() string {
|
||||||
|
|||||||
10
api/requests/DoctorConfigFollowPackageItem.go
Normal file
10
api/requests/DoctorConfigFollowPackageItem.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type DoctorConfigFollowPackageItemRequest struct {
|
||||||
|
DoctorConfigFollowPackageItem
|
||||||
|
}
|
||||||
|
|
||||||
|
type DoctorConfigFollowPackageItem struct {
|
||||||
|
ServicePeriod int `json:"service_period" form:"service_period" label:"服务周期(天)" validate:"required"`
|
||||||
|
ServicePrice float64 `json:"service_price" form:"service_price" label:"服务价格" validate:"required,min=1"` // (0表示不限次)
|
||||||
|
}
|
||||||
68
api/requests/OrderServicePackage.go
Normal file
68
api/requests/OrderServicePackage.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type OrderServicePackageRequest struct {
|
||||||
|
GetOrderServicePackagePage // 获取药品订单列表-分页
|
||||||
|
CancelOrderServicePackage // 取消服务包订单
|
||||||
|
OrderServicePackageExportList // 获取服务包订单列表-导出
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetOrderServicePackagePage 订单-服务包表
|
||||||
|
type GetOrderServicePackagePage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
OrderServiceId string `json:"order_service_id" form:"order_service_id" label:"主键id"` // 主键id
|
||||||
|
OrderId string `json:"order_id" form:"order_id" label:"订单id"` // 订单id
|
||||||
|
OrderServiceType *int `json:"order_service_type" form:"order_service_type" label:"服务包类型(1:健康包 2:随访包)"` // 服务包类型(1:健康包 2:随访包)
|
||||||
|
OrderServiceStatus *int `json:"order_service_status" form:"order_service_status" label:"订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)"` // 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||||
|
IsDelete *int `json:"is_delete" form:"is_delete" label:"删除状态(0:否 1:是)"` // 删除状态(0:否 1:是)
|
||||||
|
RefundStatus *int `json:"refund_status" form:"refund_status" label:"订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)"` // 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||||
|
PayChannel *int `json:"pay_channel" form:"pay_channel" label:"支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||||
|
PayStatus *int `json:"pay_status" form:"pay_status" label:"支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
|
OrderServiceNo string `json:"order_service_no" form:"order_service_no" label:"系统订单编号"` // 系统订单编号
|
||||||
|
EscrowTradeNo string `json:"escrow_trade_no" form:"escrow_trade_no" label:"第三方支付流水号"` // 第三方支付流水号
|
||||||
|
PayTime string `json:"pay_time" form:"pay_time" label:"支付时间"` // 支付时间
|
||||||
|
StartTime string `json:"start_time" form:"start_time" label:"开始服务时间"` // 开始服务时间
|
||||||
|
FinishTime string `json:"finish_time" form:"finish_time" label:"结束服务时间"` // 结束服务时间
|
||||||
|
CancelTime string `json:"cancel_time" form:"cancel_time" label:"订单取消时间"` // 订单取消时间
|
||||||
|
CancelReason *int `json:"cancel_reason" form:"cancel_reason" label:"取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)"` // 取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)
|
||||||
|
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" label:"取消订单备注"` // 取消订单备注
|
||||||
|
AddFinishStatus *int `json:"add_finish_status" form:"add_finish_status" label:"添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)"` // 添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)
|
||||||
|
AddFinishTime string `json:"add_finish_time" form:"add_finish_time" label:"添加完成订单延迟队列时间"` // 添加完成订单延迟队列时间
|
||||||
|
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"` // 患者姓名-就诊人
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"订单创建时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||||
|
DoctorName string `json:"doctor_name" form:"doctor_name" label:"医生姓名"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelOrderServicePackage 取消服务包订单
|
||||||
|
type CancelOrderServicePackage struct {
|
||||||
|
RefundAmount *float64 `json:"refund_amount" form:"refund_amount" label:"退款金额"`
|
||||||
|
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OrderServicePackageExportList 获取服务包订单列表-导出
|
||||||
|
type OrderServicePackageExportList struct {
|
||||||
|
Type int `json:"type" form:"type" label:"类型" validate:"required,oneof=1 2 3"` // 1:当前搜索数据 2:当前选择数据 3:全部数据
|
||||||
|
Id string `json:"id" form:"id" label:"id"` // 选择数据的id,逗号分隔,当type为2时必填
|
||||||
|
OrderId string `json:"order_id" form:"order_id" label:"订单id"` // 订单id
|
||||||
|
OrderServiceType *int `json:"order_service_type" form:"order_service_type" label:"服务包类型(1:健康包 2:随访包)"` // 服务包类型(1:健康包 2:随访包)
|
||||||
|
OrderServiceStatus *int `json:"order_service_status" form:"order_service_status" label:"订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)"` // 订单状态(1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
|
||||||
|
IsDelete *int `json:"is_delete" form:"is_delete" label:"删除状态(0:否 1:是)"` // 删除状态(0:否 1:是)
|
||||||
|
RefundStatus *int `json:"refund_status" form:"refund_status" label:"订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)"` // 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||||
|
PayChannel *int `json:"pay_channel" form:"pay_channel" label:"支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)"` // 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||||
|
PayStatus *int `json:"pay_status" form:"pay_status" label:"支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)"` // 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
|
OrderServiceNo string `json:"order_service_no" form:"order_service_no" label:"系统订单编号"` // 系统订单编号
|
||||||
|
EscrowTradeNo string `json:"escrow_trade_no" form:"escrow_trade_no" label:"第三方支付流水号"` // 第三方支付流水号
|
||||||
|
PayTime string `json:"pay_time" form:"pay_time" label:"支付时间"` // 支付时间
|
||||||
|
StartTime string `json:"start_time" form:"start_time" label:"开始服务时间"` // 开始服务时间
|
||||||
|
FinishTime string `json:"finish_time" form:"finish_time" label:"结束服务时间"` // 结束服务时间
|
||||||
|
CancelTime string `json:"cancel_time" form:"cancel_time" label:"订单取消时间"` // 订单取消时间
|
||||||
|
CancelReason *int `json:"cancel_reason" form:"cancel_reason" label:"取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)"` // 取消订单原因(1:医生未接受服务 2:主动取消 4:客服取消 5:支付超时)
|
||||||
|
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" label:"取消订单备注"` // 取消订单备注
|
||||||
|
AddFinishStatus *int `json:"add_finish_status" form:"add_finish_status" label:"添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)"` // 添加完成订单延迟队列状态(0:未添加 1:已添加 2:添加失败)
|
||||||
|
AddFinishTime string `json:"add_finish_time" form:"add_finish_time" label:"添加完成订单延迟队列时间"` // 添加完成订单延迟队列时间
|
||||||
|
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"` // 患者姓名-就诊人
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"订单创建时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||||
|
DoctorName string `json:"doctor_name" form:"doctor_name" label:"医生姓名"`
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ package requests
|
|||||||
|
|
||||||
type AreaRequest struct {
|
type AreaRequest struct {
|
||||||
GetAreaList // 获取地区列表
|
GetAreaList // 获取地区列表
|
||||||
|
AddArea // 新增地区
|
||||||
|
PutArea // 修改地区
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAreaList 获取地区列表
|
// GetAreaList 获取地区列表
|
||||||
@ -11,3 +13,19 @@ type GetAreaList struct {
|
|||||||
ParentId string `json:"parent_id" form:"parent_id" label:"上级编号"`
|
ParentId string `json:"parent_id" form:"parent_id" label:"上级编号"`
|
||||||
AreaType int `json:"area_type" form:"area_type" label:"类型(1:国家,2:省,3:市,4:区县)"`
|
AreaType int `json:"area_type" form:"area_type" label:"类型(1:国家,2:省,3:市,4:区县)"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddArea 新增地区
|
||||||
|
type AddArea struct {
|
||||||
|
AreaId string `json:"area_id" form:"area_id" label:"地区编号" validate:"required"`
|
||||||
|
AreaName string `json:"area_name" form:"area_name" label:"名称" validate:"required"`
|
||||||
|
ParentId string `json:"parent_id" form:"parent_id" label:"上级编号" validate:"required"`
|
||||||
|
AreaType *int `json:"area_type" form:"area_type" label:"类型(1:国家,2:省,3:市,4:区县)" validate:"required"`
|
||||||
|
Zip string `json:"zip" form:"zip" label:"邮编"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutArea 修改地区
|
||||||
|
type PutArea struct {
|
||||||
|
AreaId string `json:"area_id" form:"area_id" label:"地区编号" validate:"required"`
|
||||||
|
AreaName string `json:"area_name" form:"area_name" label:"名称" validate:"required"`
|
||||||
|
Zip string `json:"zip" form:"zip" label:"邮编"`
|
||||||
|
}
|
||||||
|
|||||||
108
api/requests/coupon.go
Normal file
108
api/requests/coupon.go
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type CouponRequest struct {
|
||||||
|
GetSystemCouponPage // 获取系统优惠卷列表-分页
|
||||||
|
AddSystemCoupon // 新增系统优惠卷
|
||||||
|
PutSystemCoupon // 修改系统优惠卷
|
||||||
|
PutSystemCouponStatus // 修改系统优惠卷状态
|
||||||
|
GetUserCouponPage // 获取用户优惠卷列表-分页
|
||||||
|
GrantSystemCoupon // 发放系统优惠卷
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSystemCouponPage 获取系统优惠卷列表-分页
|
||||||
|
type GetSystemCouponPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠卷名称"` // 优惠卷名称
|
||||||
|
CouponClient *int `json:"coupon_client" form:"coupon_client" label:"使用平台(1:小程序)"` // 使用平台(1:小程序)
|
||||||
|
CouponType *int `json:"coupon_type" form:"coupon_type" label:"优惠卷类型(1:无门槛 2:满减 3:数量)"` // 优惠卷类型(1:无门槛 2:满减 3:数量)
|
||||||
|
CouponStatus *int `json:"coupon_status" form:"coupon_status" label:"状态(1:正常 2:强制失效 3:结束 4:删除)"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||||
|
DistributionObject *int `json:"distribution_object" form:"distribution_object" label:"发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)
|
||||||
|
ApplicationScope *int `json:"application_scope" form:"application_scope" label:"适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)"` // 适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)
|
||||||
|
InquiryType string `json:"inquiry_type" form:"inquiry_type" label:"关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||||
|
BrandId string `json:"brand_id" form:"brand_id" label:"关联品牌id(如不限制品牌,此项为空)"` // 关联品牌id(如不限制品牌,此项为空)
|
||||||
|
IsMutex *int `json:"is_mutex" form:"is_mutex" label:"是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用"` // 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||||
|
IsDisplay *int `json:"is_display" form:"is_display" label:"是否展示(0:否 1:是)"` // 是否展示(0:否 1:是)
|
||||||
|
ValidType *int `json:"valid_type" form:"valid_type" label:"有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)"` // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||||
|
IsReissuableAfterExpire *int `json:"is_reissuable_after_expire" form:"is_reissuable_after_expire" label:"过期之后是否允许再次发放(0:否 1:是)"` // 过期之后是否允许再次发放(0:否 1:是)
|
||||||
|
IsPopup *int `json:"is_popup" form:"is_popup" label:"是否首页弹窗(0:否 1:是)"` // 是否首页弹窗(0:否 1:是)
|
||||||
|
CouponDesc string `json:"coupon_desc" form:"coupon_desc" label:"优惠卷描述"`
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"创建时间"` // 创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddSystemCoupon 新增系统优惠卷
|
||||||
|
type AddSystemCoupon struct {
|
||||||
|
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠卷名称" validate:"required"` // 优惠卷名称
|
||||||
|
CouponIcon string `json:"coupon_icon" form:"coupon_icon" label:"头像"` // 优惠卷名称
|
||||||
|
CouponClient *int `json:"coupon_client" form:"coupon_client" label:"使用平台" validate:"required,oneof=1"` // 使用平台(1:小程序)
|
||||||
|
CouponType *int `json:"coupon_type" form:"coupon_type" label:"优惠卷类型" validate:"required,oneof=1 2 3"` // 优惠卷类型(1 :无门槛 2:满减 3:数量)
|
||||||
|
DistributionObject *int `json:"distribution_object" form:"distribution_object" label:"发放对象" validate:"required,oneof=1 2 3 4 5 6 7"`
|
||||||
|
ApplicationScope *int `json:"application_scope" form:"application_scope" label:"适用范围" validate:"required,oneof=1 2 3 4 5 6"` // (1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)
|
||||||
|
InquiryType []string `json:"inquiry_type" form:"inquiry_type" label:"关联问诊类型"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||||
|
BrandId *string `json:"brand_id" form:"brand_id" label:"关联品牌id"` // 关联品牌id(如不限制品牌,此项为空)
|
||||||
|
IsMutex *int `json:"is_mutex" form:"is_mutex" label:"是否互斥" validate:"required,oneof=0 1"` // 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||||
|
IsDisplay *int `json:"is_display" form:"is_display" label:"是否展示" validate:"required,oneof=0 1"` // 是否展示(0:否 1:是)
|
||||||
|
DistributionWithDay *int `json:"distribution_with_day" form:"distribution_with_day" label:"发放关联天数" validate:"omitempty,numeric"` // (发放对象为近期消费等类型时规定天数)
|
||||||
|
MinUsableNumber *int `json:"min_usable_number" form:"min_usable_number" label:"单商品最小可使用数量" validate:"omitempty,numeric"` // (默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)
|
||||||
|
CouponCount *int `json:"coupon_count" form:"coupon_count" label:"发放数量" validate:"required,number,min=1"` // (默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)
|
||||||
|
CouponPrice *float64 `json:"coupon_price" form:"coupon_price" label:"优惠卷金额" validate:"required,numeric,gt=0"`
|
||||||
|
WithAmount *float64 `json:"with_amount" form:"with_amount" label:"符合满减标准金额" validate:"omitempty,gt=1"` // (优惠卷类型为满减时使用)
|
||||||
|
ValidType *int `json:"valid_type" form:"valid_type" label:"有效类型" validate:"required,oneof=1 2"` // 有效类型(1:绝对时效,xxx-xxx时间段有效 2:相对时效 n天内有效)
|
||||||
|
ValidDays *int `json:"valid_days" form:"valid_days" label:"自领取之日起有效天数" validate:"omitempty,numeric,min=1"` // 自领取之日起有效天数
|
||||||
|
ValidStartTime *string `json:"valid_start_time" form:"valid_start_time" label:"开始使用时间"` // 开始使用时间
|
||||||
|
ValidEndTime *string `json:"valid_end_time" form:"valid_end_time" label:"结束使用时间"` // 结束使用时间
|
||||||
|
ProductId []string `json:"product_id" form:"product_id" label:"关联商品id"` // ,逗号分隔,指定商品时,填入此项。
|
||||||
|
ReissueIntervalDays *int `json:"reissue_interval_days" form:"reissue_interval_days" label:"确认收货后的再次发放间隔天数" validate:"omitempty,numeric,min=0"` // (如果设置为 0,则表示不再次发放。当适用范围为商品时生效)
|
||||||
|
IsReissuableAfterExpire *int `json:"is_reissuable_after_expire" form:"is_reissuable_after_expire" label:"过期之后是否允许再次发放" validate:"omitempty,oneof=0 1"` // 过期之后是否允许再次发放(0:否 1:是)
|
||||||
|
IsPopup *int `json:"is_popup" form:"is_popup" label:"是否首页弹窗" validate:"required,oneof=0 1"` // 是否首页弹窗(0:否 1:是)
|
||||||
|
CouponDesc *string `json:"coupon_desc" form:"coupon_desc" label:"优惠卷描述"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutSystemCoupon 修改系统优惠卷
|
||||||
|
type PutSystemCoupon struct {
|
||||||
|
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠卷名称" validate:"required"` // 优惠卷名称
|
||||||
|
CouponIcon string `json:"coupon_icon" form:"coupon_icon" label:"头像"` // 优惠卷名称
|
||||||
|
DistributionObject *int `json:"distribution_object" form:"distribution_object" label:"发放对象" validate:"required,oneof=1 2 3 4 5 6 7"` // (1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)
|
||||||
|
InquiryType []string `json:"inquiry_type" form:"inquiry_type" label:"关联问诊类型"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||||
|
BrandId *string `json:"brand_id" form:"brand_id" label:"关联品牌id"` // 关联品牌id(如不限制品牌,此项为空)
|
||||||
|
IsMutex *int `json:"is_mutex" form:"is_mutex" label:"是否互斥" validate:"required,oneof=0 1"` // 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||||
|
IsDisplay *int `json:"is_display" form:"is_display" label:"是否展示" validate:"required,oneof=0 1"` // 是否展示(0:否 1:是)
|
||||||
|
DistributionWithDay *int `json:"distribution_with_day" form:"distribution_with_day" label:"发放关联天数" validate:"omitempty,numeric"` // (发放对象为近期消费等类型时规定天数)
|
||||||
|
MinUsableNumber *int `json:"min_usable_number" form:"min_usable_number" label:"单商品最小可使用数量" validate:"omitempty,numeric"` // (默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)
|
||||||
|
CouponCount *int `json:"coupon_count" form:"coupon_count" label:"发放数量" validate:"required,number,min=1"` // (默认为1,类型为数量时使用,如需限制优惠卷使用数量,请填写此处)
|
||||||
|
CouponPrice *float64 `json:"coupon_price" form:"coupon_price" label:"优惠卷金额" validate:"required,numeric,gt=0"` // 优惠卷金额
|
||||||
|
ProductId []string `json:"product_id" form:"product_id" label:"关联商品id"` // ,逗号分隔,指定商品时,填入此项。
|
||||||
|
ReissueIntervalDays *int `json:"reissue_interval_days" form:"reissue_interval_days" label:"确认收货后的再次发放间隔天数" validate:"omitempty,numeric,min=0"` // (如果设置为 0,则表示不再次发放。当适用范围为商品时生效)
|
||||||
|
IsReissuableAfterExpire *int `json:"is_reissuable_after_expire" form:"is_reissuable_after_expire" label:"过期之后是否允许再次发放" validate:"omitempty,oneof=0 1"` // 过期之后是否允许再次发放(0:否 1:是)
|
||||||
|
IsPopup *int `json:"is_popup" form:"is_popup" label:"是否首页弹窗" validate:"required,oneof=0 1"` // 是否首页弹窗(0:否 1:是)
|
||||||
|
CouponDesc *string `json:"coupon_desc" form:"coupon_desc" label:"优惠卷描述"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutSystemCouponStatus 修改系统优惠卷状态
|
||||||
|
type PutSystemCouponStatus struct {
|
||||||
|
CouponStatus int `json:"coupon_status" form:"coupon_status" label:"状态" validate:"required,oneof=2 3 4"` // (1:正常 2:强制失效 3:结束 4:删除)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserCouponPage 获取用户优惠卷列表-分页
|
||||||
|
type GetUserCouponPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
CouponName string `json:"coupon_name" form:"coupon_name" label:"优惠卷名称"` // 优惠卷名称
|
||||||
|
CouponId string `json:"coupon_id" form:"coupon_id" label:"优惠卷编号"` // 优惠卷名称
|
||||||
|
UserCouponStatus *int `json:"user_coupon_status" form:"user_coupon_status" label:"使用状态(0:未使用 1:已使用 3:已过期)"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||||
|
CouponUseDate string `json:"coupon_use_date" form:"coupon_use_date" label:"使用时间"` // 使用时间
|
||||||
|
ValidStartTime string `json:"valid_start_time" form:"valid_start_time" label:"有效使用时间"` // 有效使用时间
|
||||||
|
ValidEndTime string `json:"valid_end_time" form:"valid_end_time" label:"过期使用时间"` // 过期使用时间
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"创建时间"` // 创建时间
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
|
UserName string `json:"user_name" form:"user_name" label:"用户名"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GrantSystemCoupon 发放系统优惠卷
|
||||||
|
type GrantSystemCoupon struct {
|
||||||
|
Type int `json:"type" form:"type" label:"用户编号" validate:"required,oneof=1 2"` // 发放类型(1:具体用户 2:全部用户)
|
||||||
|
UserId string `json:"user_id" form:"user_id" label:"用户编号" validate:"number"` // 用户编号
|
||||||
|
TotalQuantity int `json:"total_quantity" form:"total_quantity" label:"总发放数量" validate:"required,number,min=1"` // 总发放数量-发完即止
|
||||||
|
SingleQuantity int `json:"single_quantity" form:"single_quantity" label:"个人可发放数量" validate:"required,number,min=1"` // 个人可发放数量-发完即止,依次发放,到达发放总数量后即停止
|
||||||
|
IsForce *int `json:"is_follow_rules" form:"is_force_grant" label:"是否遵循优惠卷发放对象规则" validate:"oneof=0 1"` // 是否遵循优惠卷发放对象规则(0:否 1:是)(是:遵循优惠卷发放对象规则进行发放。否:不满足优惠卷发放对象规则也会发放一张)
|
||||||
|
}
|
||||||
32
api/requests/doctorConfigFollowPackage.go
Normal file
32
api/requests/doctorConfigFollowPackage.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type DoctorConfigFollowPackageRequest struct {
|
||||||
|
GetDoctorFollowPage // 获取医生健康包列表-分页
|
||||||
|
PutDoctorFollow // 修改医生健康包配置
|
||||||
|
AddDoctorFollow // 新增医生健康包配置
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorFollowPage 获取医生健康包列表-分页
|
||||||
|
type GetDoctorFollowPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
|
DoctorName string `json:"doctor_name" form:"doctor_name" label:"医生姓名"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutDoctorFollow 修改医生健康包配置
|
||||||
|
type PutDoctorFollow struct {
|
||||||
|
MonthlyFrequency *int `json:"monthly_frequency" form:"monthly_frequency" label:"每月次数" validate:"required"` // (0表示不限次)
|
||||||
|
ServiceRounds *int `json:"service_rounds" form:"service_rounds" label:"服务回合数" validate:"required"` // (0表示不限次)
|
||||||
|
IsEnable *int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用" validate:"required"` // 0:否 1:是
|
||||||
|
DoctorConfigFollowPackageItem []*DoctorConfigFollowPackageItem `json:"doctor_config_follow_package_item" form:"doctor_config_follow_package_item" label:"医生健康包明细" validate:"required"` //
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorFollow 新增医生健康包配置
|
||||||
|
type AddDoctorFollow struct {
|
||||||
|
DoctorId string `json:"doctor_id" form:"doctor_id" label:"医生id" validate:"required"`
|
||||||
|
MonthlyFrequency *int `json:"monthly_frequency" form:"monthly_frequency" label:"每月次数" validate:"required"` // (0表示不限次)
|
||||||
|
ServiceRounds *int `json:"service_rounds" form:"service_rounds" label:"服务回合数" validate:"required"` // (0表示不限次)
|
||||||
|
IsEnable *int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用" validate:"required"` // 0:否 1:是
|
||||||
|
DoctorConfigFollowPackageItem []*DoctorConfigFollowPackageItem `json:"doctor_config_follow_package_item" form:"doctor_config_follow_package_item" label:"医生健康包明细" validate:"required"` //
|
||||||
|
}
|
||||||
30
api/requests/doctorConfigHealthPackage.go
Normal file
30
api/requests/doctorConfigHealthPackage.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type DoctorConfigHealthPackageRequest struct {
|
||||||
|
GetDoctorHealthPage // 获取医生健康包列表-分页
|
||||||
|
PutDoctorHealth // 修改医生健康包配置
|
||||||
|
AddDoctorHealth // 新增医生健康包配置
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDoctorHealthPage 获取医生健康包列表-分页
|
||||||
|
type GetDoctorHealthPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
|
DoctorName string `json:"doctor_name" form:"doctor_name" label:"医生姓名"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutDoctorHealth 修改医生健康包配置
|
||||||
|
type PutDoctorHealth struct {
|
||||||
|
PackageId string `json:"package_id" form:"package_id" label:"健康包配置id" validate:"required"`
|
||||||
|
ServicePrice string `json:"service_price" form:"service_price" label:"服务价格" validate:"required,min=1"`
|
||||||
|
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDoctorHealth 新增医生健康包配置
|
||||||
|
type AddDoctorHealth struct {
|
||||||
|
DoctorId string `json:"doctor_id" form:"doctor_id" label:"医生id" validate:"required"`
|
||||||
|
PackageId string `json:"package_id" form:"package_id" label:"健康包配置id" validate:"required"`
|
||||||
|
ServicePrice string `json:"service_price" form:"service_price" label:"服务价格" validate:"required,min=1"`
|
||||||
|
IsEnable int `json:"is_enable" form:"is_enable" validate:"oneof=0 1" label:"是否启用"` // 0:否 1:是
|
||||||
|
}
|
||||||
37
api/requests/healthPackage.go
Normal file
37
api/requests/healthPackage.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type HealthPackageRequest struct {
|
||||||
|
GetHealthPackagePage // 获取健康包列表-分页
|
||||||
|
PutHealthPackage // 修改健康包
|
||||||
|
AddHealthPackage // 新增健康包
|
||||||
|
GetHealthPackageList // 获取健康包列表-限制条数
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackagePage 获取健康包列表-分页
|
||||||
|
type GetHealthPackagePage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetHealthPackageList 获取健康包列表-限制条数
|
||||||
|
type GetHealthPackageList struct {
|
||||||
|
Limit int `json:"limit" form:"limit" label:"限制条数"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutHealthPackage 修改健康包
|
||||||
|
type PutHealthPackage struct {
|
||||||
|
ServiceCount int `json:"service_count" form:"service_count" label:"总服务次数" validate:"required,min=1"`
|
||||||
|
MonthlyFrequency int `json:"monthly_frequency" form:"monthly_frequency" label:"每月次数" validate:"required,min=1"`
|
||||||
|
EffectiveDays string `json:"effective_days" form:"effective_days" label:"服务有效天数" validate:"required,min=1"`
|
||||||
|
ServiceRate string `json:"service_rate" form:"service_rate" label:"服务费率。100为满值,表示1,正常费率。" validate:"required,min=1"`
|
||||||
|
HealthPackageProduct []*HealthPackageProduct `json:"health_package_product" form:"health_package_product" label:"关联商品" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHealthPackage 新增健康包
|
||||||
|
type AddHealthPackage struct {
|
||||||
|
ServiceCount int `json:"service_count" form:"service_count" label:"总服务次数" validate:"required,min=1"`
|
||||||
|
MonthlyFrequency int `json:"monthly_frequency" form:"monthly_frequency" label:"每月次数" validate:"required,min=1"`
|
||||||
|
EffectiveDays string `json:"effective_days" form:"effective_days" label:"服务有效天数" validate:"required,min=1"`
|
||||||
|
ServiceRate string `json:"service_rate" form:"service_rate" label:"服务费率。100为满值,表示1,正常费率。" validate:"required,min=1"`
|
||||||
|
HealthPackageProduct []*HealthPackageProduct `json:"health_package_product" form:"health_package_product" label:"关联商品" validate:"required"`
|
||||||
|
}
|
||||||
14
api/requests/healthPackageProduct.go
Normal file
14
api/requests/healthPackageProduct.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package requests
|
||||||
|
|
||||||
|
type HealthPackageProductRequest struct {
|
||||||
|
HealthPackageProduct // 健康包-关联商品
|
||||||
|
}
|
||||||
|
|
||||||
|
// HealthPackageProduct 健康包-关联商品
|
||||||
|
type HealthPackageProduct struct {
|
||||||
|
PackageId string `json:"package_id" form:"package_id" label:"健康包id"`
|
||||||
|
ProductId string `gorm:"primaryKey" json:"product_id" form:"product_id" label:"商品id"`
|
||||||
|
ProductName string `json:"product_name" form:"product_name" label:"商品名称"`
|
||||||
|
Quantity int `json:"quantity" form:"quantity" label:"数量"`
|
||||||
|
DiscountProductPrice float64 `json:"discount_product_price" form:"discount_product_price" label:"折扣商品价格"`
|
||||||
|
}
|
||||||
@ -1,13 +1,17 @@
|
|||||||
package requests
|
package requests
|
||||||
|
|
||||||
type HospitalRequest struct {
|
type HospitalRequest struct {
|
||||||
GetHospitalLimit // 获取医院列表-限制条数
|
GetHospitalList // 获取医院列表
|
||||||
|
GetHospitalPage // 获取医院列表-分页
|
||||||
|
AddHospital // 新增医院
|
||||||
|
PutHospital // 修改医院
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHospitalLimit 获取医院列表-限制条数
|
// GetHospitalList 获取医院列表
|
||||||
type GetHospitalLimit struct {
|
type GetHospitalList struct {
|
||||||
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称"`
|
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称"`
|
||||||
HospitalLevelName string `json:"hospital_level_name" form:"hospital_level_name" label:"医院等级名称"`
|
HospitalLevelName string `json:"hospital_level_name" form:"hospital_level_name" label:"医院等级名称"`
|
||||||
|
HospitalStatus int `json:"hospital_status" form:"hospital_status" label:"状态"` // 状态(0:禁用 1:正常 2:删除)
|
||||||
ProvinceId int `json:"province_id" form:"province_id" label:"省份id"`
|
ProvinceId int `json:"province_id" form:"province_id" label:"省份id"`
|
||||||
Province string `json:"province" form:"province" label:"省份"`
|
Province string `json:"province" form:"province" label:"省份"`
|
||||||
CityId int `json:"city_id" form:"city_id" label:"城市id"`
|
CityId int `json:"city_id" form:"city_id" label:"城市id"`
|
||||||
@ -15,3 +19,46 @@ type GetHospitalLimit struct {
|
|||||||
CountyId int `json:"county_id" form:"county_id" label:"区县id"`
|
CountyId int `json:"county_id" form:"county_id" label:"区县id"`
|
||||||
County string `json:"county" form:"county" label:"区县"`
|
County string `json:"county" form:"county" label:"区县"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetHospitalPage 获取医院列表-分页
|
||||||
|
type GetHospitalPage struct {
|
||||||
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称"`
|
||||||
|
HospitalLevelName string `json:"hospital_level_name" form:"hospital_level_name" label:"医院等级名称"`
|
||||||
|
ProvinceId int `json:"province_id" form:"province_id" label:"省份id"`
|
||||||
|
CityId int `json:"city_id" form:"city_id" label:"城市id"`
|
||||||
|
CountyId int `json:"county_id" form:"county_id" label:"区县id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddHospital 新增医院
|
||||||
|
type AddHospital struct {
|
||||||
|
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称" validate:"required"` // 医院名称
|
||||||
|
HospitalStatus *int `json:"hospital_status" form:"hospital_status" label:"状态" validate:"required,oneof=0 1 2"` // 状态(0:禁用 1:正常 2:删除)
|
||||||
|
HospitalLevelName string `json:"hospital_level_name" form:"hospital_level_name" label:"医院等级名称" validate:"required"` // 医院等级名称
|
||||||
|
PostCode string `json:"post_code" form:"post_code" label:"邮政编码"` // 邮政编码
|
||||||
|
TelePhone string `json:"tele_phone" form:"tele_phone" label:"电话"` // 电话
|
||||||
|
ProvinceId int `json:"province_id" form:"province_id" label:"省份id" validate:"required"` // 省份id
|
||||||
|
CityId int `json:"city_id" form:"city_id" label:"城市id" validate:"required"` // 城市id
|
||||||
|
CountyId int `json:"county_id" form:"county_id" label:"区县id" validate:"required"` // 区县id
|
||||||
|
Address string `json:"address" form:"address" label:"地址" validate:"required"` // 地址
|
||||||
|
Lat string `json:"lat" form:"lat" label:"纬度"` // 纬度
|
||||||
|
Lng string `json:"lng" form:"lng" label:"经度"` // 经度
|
||||||
|
Desc string `json:"desc" form:"desc" label:"简介"` // 简介
|
||||||
|
}
|
||||||
|
|
||||||
|
// PutHospital 修改医院
|
||||||
|
type PutHospital struct {
|
||||||
|
HospitalName string `json:"hospital_name" form:"hospital_name" label:"医院名称" validate:"required"` // 医院名称
|
||||||
|
HospitalStatus *int `json:"hospital_status" form:"hospital_status" label:"状态" validate:"required,oneof=0 1 2"` // 状态(0:禁用 1:正常 2:删除)
|
||||||
|
HospitalLevelName string `json:"hospital_level_name" form:"hospital_level_name" label:"医院等级名称" validate:"required"` // 医院等级名称
|
||||||
|
PostCode string `json:"post_code" form:"post_code" label:"邮政编码"` // 邮政编码
|
||||||
|
TelePhone string `json:"tele_phone" form:"tele_phone" label:"电话"` // 电话
|
||||||
|
ProvinceId int `json:"province_id" form:"province_id" label:"省份id" validate:"required"` // 省份id
|
||||||
|
CityId int `json:"city_id" form:"city_id" label:"城市id" validate:"required"` // 城市id
|
||||||
|
CountyId int `json:"county_id" form:"county_id" label:"区县id" validate:"required"` // 区县id
|
||||||
|
Address string `json:"address" form:"address" label:"地址" validate:"required"` // 地址
|
||||||
|
Lat string `json:"lat" form:"lat" label:"纬度"` // 纬度
|
||||||
|
Lng string `json:"lng" form:"lng" label:"经度"` // 经度
|
||||||
|
Desc string `json:"desc" form:"desc" label:"简介"` // 简介
|
||||||
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ type InquiryConfigRequest struct {
|
|||||||
GetSystemInquiryConfigPage // 获取系统问诊配置列表-分页
|
GetSystemInquiryConfigPage // 获取系统问诊配置列表-分页
|
||||||
PutSystemInquiryConfig // 修改系统问诊配置
|
PutSystemInquiryConfig // 修改系统问诊配置
|
||||||
GetSystemInquiryConfigDetail // 系统问诊配置详情-条件
|
GetSystemInquiryConfigDetail // 系统问诊配置详情-条件
|
||||||
|
GetDoctorInquiryConfig // 医生问诊配置详情
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDoctorInquiryConfigPage 获取开启问诊配置医生列表-分页
|
// GetDoctorInquiryConfigPage 获取开启问诊配置医生列表-分页
|
||||||
@ -20,6 +21,14 @@ type GetDoctorInquiryConfigPage struct {
|
|||||||
IsEnable *int `json:"is_enable" form:"is_enable" label:"是否启用"` // 0:否 1:是
|
IsEnable *int `json:"is_enable" form:"is_enable" label:"是否启用"` // 0:否 1:是
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDoctorInquiryConfig 医生问诊配置详情
|
||||||
|
type GetDoctorInquiryConfig struct {
|
||||||
|
InquiryConfigId string `json:"inquiry_config_id" form:"inquiry_config_id" label:"主键id"`
|
||||||
|
InquiryType *int `json:"inquiry_type" form:"inquiry_type" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||||
|
InquiryMode *int `json:"inquiry_mode" form:"inquiry_mode" label:"问诊方式"` // 1:图文 2:视频 3:语音 4:电话 5:会员
|
||||||
|
DoctorId string `json:"doctor_id" form:"doctor_id" label:"医生id"`
|
||||||
|
}
|
||||||
|
|
||||||
// PutDoctorInquiryConfig 修改医生问诊配置
|
// PutDoctorInquiryConfig 修改医生问诊配置
|
||||||
type PutDoctorInquiryConfig struct {
|
type PutDoctorInquiryConfig struct {
|
||||||
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
DoctorId string `json:"doctor_id" form:"doctor_id" validate:"required"` // 医生id
|
||||||
@ -88,5 +97,5 @@ type SystemInquiryTime struct {
|
|||||||
// GetSystemInquiryConfigDetail 系统问诊配置详情-条件
|
// GetSystemInquiryConfigDetail 系统问诊配置详情-条件
|
||||||
type GetSystemInquiryConfigDetail struct {
|
type GetSystemInquiryConfigDetail struct {
|
||||||
InquiryType *int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
InquiryType *int `json:"inquiry_type" form:"inquiry_type" validate:"required,oneof=1 2 3 4 5" label:"问诊类型"` // 1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测
|
||||||
InquiryMode *int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5 6" label:"问诊方式"`
|
InquiryMode *int `json:"inquiry_mode" form:"inquiry_mode" validate:"required,oneof=1 2 3 4 5 6 7 8 9" label:"问诊方式"`
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,8 +36,8 @@ type GetOrderInquiryPage struct {
|
|||||||
|
|
||||||
// CancelOrderInquiry 取消问诊订单
|
// CancelOrderInquiry 取消问诊订单
|
||||||
type CancelOrderInquiry struct {
|
type CancelOrderInquiry struct {
|
||||||
RefundAmount float64 `json:"refund_amount" form:"refund_amount" validate:"required" label:"退款金额"`
|
RefundAmount *float64 `json:"refund_amount" form:"refund_amount" label:"退款金额"`
|
||||||
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
CancelRemarks string `json:"cancel_remarks" form:"cancel_remarks" validate:"required" label:"取消订单备注"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
|
// GetOrderInquiryRecordPage 获取问诊记录列表-分页
|
||||||
|
|||||||
@ -31,6 +31,8 @@ type GetOrderProductPage struct {
|
|||||||
ConsigneeTel string `json:"consignee_tel" form:"cancel_reason" label:"收货人电话"`
|
ConsigneeTel string `json:"consignee_tel" form:"cancel_reason" label:"收货人电话"`
|
||||||
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"`
|
PatientName string `json:"patient_name" form:"patient_name" label:"患者姓名-就诊人"`
|
||||||
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
Mobile string `json:"mobile" form:"mobile" label:"手机号-医生/患者"`
|
||||||
|
ProductName string `json:"product_name" form:"product_name" label:"药品名称"`
|
||||||
|
CommonName string `json:"common_name" form:"common_name" label:"药品通用名"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CancelOrderProduct 取消药品订单
|
// CancelOrderProduct 取消药品订单
|
||||||
|
|||||||
@ -7,6 +7,8 @@ type ProductRequest struct {
|
|||||||
PutProduct // 修改商品
|
PutProduct // 修改商品
|
||||||
PutProductStatus // 修改商品状态(上/下架)
|
PutProductStatus // 修改商品状态(上/下架)
|
||||||
GetPlatformProductList // 获取平台商品列表
|
GetPlatformProductList // 获取平台商品列表
|
||||||
|
ProductExportList // 系统药品-导出
|
||||||
|
GetProductList // 获取系统商品列表-限制条数
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPlatformProductPage 获取平台商品列表-分页
|
// GetPlatformProductPage 获取平台商品列表-分页
|
||||||
@ -33,12 +35,31 @@ type GetPlatformProductList struct {
|
|||||||
|
|
||||||
// GetProductPage 获取系统商品列表-分页
|
// GetProductPage 获取系统商品列表-分页
|
||||||
type GetProductPage struct {
|
type GetProductPage struct {
|
||||||
Page int `json:"page" form:"page" label:"页码"`
|
Page int `json:"page" form:"page" label:"页码"`
|
||||||
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
PageSize int `json:"page_size" form:"page_size" label:"每页个数"`
|
||||||
|
ProductName string `json:"product_name" form:"product_name" label:"商品名称"` // 商品名称
|
||||||
|
CommonName string `json:"common_name" form:"common_name" label:"商品通用名"` // 商品通用名
|
||||||
|
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||||
|
ProductType *int `json:"product_type" form:"product_type" label:"药品类型"` // 药品类型(0:未知 1:中成药 2:西药)
|
||||||
|
IsMajing *int `json:"is_majing" form:"is_majing" label:"药品类型"` // 是否麻精药品(0:否 1:是)
|
||||||
|
ProductPlatformId string `json:"product_platform_id" form:"product_platform_id" label:"平台商品id"` // 处方平台商品id
|
||||||
|
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台编码"` // 处方平台商品编码
|
||||||
|
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"药店编码"` // 第三方药店商品编码
|
||||||
|
LicenseNumber string `json:"license_number" form:"license_number" label:"批准文号"` // 批准文号
|
||||||
|
Manufacturer string `json:"manufacturer" form:"manufacturer" label:"生产厂家"` // 生产厂家
|
||||||
|
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注"` // 商品备注
|
||||||
|
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态"` // 商品状态(1:正常 2:下架)
|
||||||
|
Order *GetProductPageOrder `json:"order" form:"order" label:"排序"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetProductList 获取系统商品列表-限制条数
|
||||||
|
type GetProductList struct {
|
||||||
|
ProductId string `json:"product_id" form:"product_id" label:"商品id"` // 商品id
|
||||||
ProductName string `json:"product_name" form:"product_name" label:"商品名称"` // 商品名称
|
ProductName string `json:"product_name" form:"product_name" label:"商品名称"` // 商品名称
|
||||||
CommonName string `json:"common_name" form:"common_name" label:"商品通用名"` // 商品通用名
|
CommonName string `json:"common_name" form:"common_name" label:"商品通用名"` // 商品通用名
|
||||||
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||||
ProductType *int `json:"product_type" form:"product_type" label:"药品类型"` // 药品类型(0:未知 1:中成药 2:西药)
|
ProductType *int `json:"product_type" form:"product_type" label:"药品类型"` // 药品类型(0:未知 1:中成药 2:西药)
|
||||||
|
IsMajing *int `json:"is_majing" form:"is_majing" label:"药品类型"` // 是否麻精药品(0:否 1:是)
|
||||||
ProductPlatformId string `json:"product_platform_id" form:"product_platform_id" label:"平台商品id"` // 处方平台商品id
|
ProductPlatformId string `json:"product_platform_id" form:"product_platform_id" label:"平台商品id"` // 处方平台商品id
|
||||||
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台编码"` // 处方平台商品编码
|
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台编码"` // 处方平台商品编码
|
||||||
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"药店编码"` // 第三方药店商品编码
|
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"药店编码"` // 第三方药店商品编码
|
||||||
@ -46,6 +67,11 @@ type GetProductPage struct {
|
|||||||
Manufacturer string `json:"manufacturer" form:"manufacturer" label:"生产厂家"` // 生产厂家
|
Manufacturer string `json:"manufacturer" form:"manufacturer" label:"生产厂家"` // 生产厂家
|
||||||
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注"` // 商品备注
|
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注"` // 商品备注
|
||||||
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态"` // 商品状态(1:正常 2:下架)
|
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态"` // 商品状态(1:正常 2:下架)
|
||||||
|
Limit int `json:"limit" form:"limit" label:"限制条数"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetProductPageOrder struct {
|
||||||
|
Stock string `json:"stock" form:"stock" label:"库存" validate:"oneof=desc asc"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddProduct 新增商品
|
// AddProduct 新增商品
|
||||||
@ -56,6 +82,7 @@ type AddProduct struct {
|
|||||||
ProductPrice float64 `json:"product_price" form:"product_price" label:"商品价格" validate:"required"` // 商品价格
|
ProductPrice float64 `json:"product_price" form:"product_price" label:"商品价格" validate:"required"` // 商品价格
|
||||||
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||||
ProductType *int `json:"product_type" form:"product_type" label:"药品类型" validate:"oneof=0 1 2"` // 药品类型(0:未知 1:中成药 2:西药)
|
ProductType *int `json:"product_type" form:"product_type" label:"药品类型" validate:"oneof=0 1 2"` // 药品类型(0:未知 1:中成药 2:西药)
|
||||||
|
IsMajing *int `json:"is_majing" form:"is_majing" label:"是否麻精药品" validate:"oneof=0 1"` // 是否麻精药品(0:否 1:是)
|
||||||
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台商品编码" validate:"required"` // 处方平台商品编码
|
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台商品编码" validate:"required"` // 处方平台商品编码
|
||||||
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"第三方药店商品编码" validate:"required"` // 第三方药店商品编码
|
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"第三方药店商品编码" validate:"required"` // 第三方药店商品编码
|
||||||
ProductCoverImg string `json:"product_cover_img" form:"product_cover_img" label:"商品封面图"` // 商品封面图
|
ProductCoverImg string `json:"product_cover_img" form:"product_cover_img" label:"商品封面图"` // 商品封面图
|
||||||
@ -89,3 +116,20 @@ type PutProduct struct {
|
|||||||
type PutProductStatus struct {
|
type PutProductStatus struct {
|
||||||
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态" validate:"required,oneof=1 2"` // 商品状态(1:正常 2:下架)
|
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态" validate:"required,oneof=1 2"` // 商品状态(1:正常 2:下架)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProductExportList 系统药品-导出
|
||||||
|
type ProductExportList struct {
|
||||||
|
Type int `json:"type" form:"type" label:"类型" validate:"required,oneof=1 2 3"` // 1:当前搜索数据 2:当前选择数据 3:全部数据
|
||||||
|
Id string `json:"id" form:"id" label:"id"` // 选择数据的id,逗号分隔,当type为2时必填
|
||||||
|
ProductName string `json:"product_name" form:"product_name" label:"商品名称"` // 商品名称
|
||||||
|
CommonName string `json:"common_name" form:"common_name" label:"商品通用名"` // 商品通用名
|
||||||
|
MnemonicCode string `json:"mnemonic_code" form:"mnemonic_code" label:"商品助记码"` // 商品助记码(首字母简拼)
|
||||||
|
ProductType *int `json:"product_type" form:"product_type" label:"药品类型"` // 药品类型(0:未知 1:中成药 2:西药)
|
||||||
|
ProductPlatformId string `json:"product_platform_id" form:"product_platform_id" label:"平台商品id"` // 处方平台商品id
|
||||||
|
ProductPlatformCode string `json:"product_platform_code" form:"product_platform_code" label:"处方平台编码"` // 处方平台商品编码
|
||||||
|
ProductPharmacyCode string `json:"product_pharmacy_code" form:"product_pharmacy_code" label:"药店编码"` // 第三方药店商品编码
|
||||||
|
LicenseNumber string `json:"license_number" form:"license_number" label:"批准文号"` // 批准文号
|
||||||
|
Manufacturer string `json:"manufacturer" form:"manufacturer" label:"生产厂家"` // 生产厂家
|
||||||
|
ProductRemarks string `json:"product_remarks" form:"product_remarks" label:"商品备注"` // 商品备注
|
||||||
|
ProductStatus *int `json:"product_status" form:"product_status" label:"商品状态"` // 商品状态(1:正常 2:下架)
|
||||||
|
}
|
||||||
|
|||||||
@ -138,6 +138,7 @@ type PutMulti struct {
|
|||||||
|
|
||||||
// GetUserDoctorList 获取医生列表
|
// GetUserDoctorList 获取医生列表
|
||||||
type GetUserDoctorList struct {
|
type GetUserDoctorList struct {
|
||||||
|
DoctorId string `json:"doctor_id" form:"doctor_id" label:"医生id"`
|
||||||
UserName string `json:"user_name" form:"user_name" label:"医生姓名"`
|
UserName string `json:"user_name" form:"user_name" label:"医生姓名"`
|
||||||
IDCardStatus *int `json:"idcard_status" form:"idcard_status" label:"身份证状态"` // (0:未认证 1:认证通过 2:认证失败)
|
IDCardStatus *int `json:"idcard_status" form:"idcard_status" label:"身份证状态"` // (0:未认证 1:认证通过 2:认证失败)
|
||||||
IdenAuthStatus *int `json:"iden_auth_status" form:"iden_auth_status" label:"认证状态"` // (0:未认证 1:认证通过 2:审核中 3:认证失败)
|
IdenAuthStatus *int `json:"iden_auth_status" form:"iden_auth_status" label:"认证状态"` // (0:未认证 1:认证通过 2:审核中 3:认证失败)
|
||||||
|
|||||||
@ -4,6 +4,7 @@ type UserPatientRequest struct {
|
|||||||
GetUserPatientPage // 获取患者列表-分页
|
GetUserPatientPage // 获取患者列表-分页
|
||||||
PutUserDoctorStatus // 修改患者状态
|
PutUserDoctorStatus // 修改患者状态
|
||||||
UserPatientExportList // 患者列表-导出
|
UserPatientExportList // 患者列表-导出
|
||||||
|
GetUserPatientList // 获取患者列表-限制条数
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserPatientPage 获取患者列表-分页
|
// GetUserPatientPage 获取患者列表-分页
|
||||||
@ -31,3 +32,11 @@ type UserPatientExportList struct {
|
|||||||
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
CreatedAt string `json:"created_at" form:"created_at" label:"注册时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
CreatedAt string `json:"created_at" form:"created_at" label:"注册时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserPatientList 获取患者列表-限制条数
|
||||||
|
type GetUserPatientList struct {
|
||||||
|
UserName string `json:"user_name" form:"user_name" label:"用户名称"`
|
||||||
|
Status *int `json:"status" form:"status" label:"状态"` // (0:禁用 1:正常 2:删除)
|
||||||
|
Mobile string `json:"mobile" form:"mobile" label:"手机号"`
|
||||||
|
CreatedAt string `json:"created_at" form:"created_at" label:"注册时间"` // 时间区间,数组形式,下标0为开始时间,下标1为结束时间
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user