新增问诊病例接口查询,修改问诊订单详情问诊病例返回数据

This commit is contained in:
2023-09-15 16:20:07 +08:00
parent 744fb8d067
commit a0b7726115
6 changed files with 145 additions and 18 deletions
+34
View File
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// InquiryCaseProduct 问诊病例-用药意向表
type InquiryCaseProduct struct {
CaseProductId int64 `gorm:"column:case_product_id;type:bigint(19);primary_key;comment:主键id" json:"case_product_id"`
InquiryCaseId int64 `gorm:"column:inquiry_case_id;type:bigint(19);comment:病例id" json:"inquiry_case_id"`
ProductId int64 `gorm:"column:product_id;type:bigint(19);comment:商品id" json:"product_id"`
CaseProductNum int `gorm:"column:case_product_num;type:int(11);default:1;comment:药品数量" json:"case_product_num"`
Model
}
func (m *InquiryCaseProduct) TableName() string {
return "gdxz_inquiry_case_product"
}
func (m *InquiryCaseProduct) BeforeCreate(tx *gorm.DB) error {
if m.CaseProductId == 0 {
m.CaseProductId = 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
}