新增上报处方平台接口

This commit is contained in:
2023-09-13 19:09:14 +08:00
parent 84c7997f12
commit 296199e760
14 changed files with 867 additions and 70 deletions
+35
View File
@@ -0,0 +1,35 @@
package model
import (
"gorm.io/gorm"
"hospital-admin-api/global"
"time"
)
// OrderPrescriptionIcd 订单-处方关联疾病表
type OrderPrescriptionIcd struct {
PrescriptionIcdId int64 `gorm:"column:prescription_icd_id;type:bigint(19);primary_key;comment:主键id" json:"prescription_icd_id"`
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);comment:订单-处方id" json:"order_prescription_id"`
IcdId int64 `gorm:"column:icd_id;type:bigint(19);comment:疾病id(icd)" json:"icd_id"`
IcdName string `gorm:"column:icd_name;type:varchar(255);comment:疾病名称(icd)" json:"icd_name"`
IcdCode string `gorm:"column:icd_code;type:varchar(255);comment:icd编码" json:"icd_code"`
Model
}
func (m *OrderPrescriptionIcd) TableName() string {
return "gdxz_order_prescription_icd"
}
func (m *OrderPrescriptionIcd) BeforeCreate(tx *gorm.DB) error {
if m.PrescriptionIcdId == 0 {
m.PrescriptionIcdId = 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
}