42 lines
2.0 KiB
Go
42 lines
2.0 KiB
Go
package model
|
||
|
||
import (
|
||
"gorm.io/gorm"
|
||
"hospital-admin-api/global"
|
||
"time"
|
||
)
|
||
|
||
// OrderEvaluation 订单-评价表
|
||
type OrderEvaluation struct {
|
||
EvaluationId int64 `gorm:"column:evaluation_id;type:bigint(19);primary_key;comment:主键id" json:"evaluation_id"`
|
||
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
|
||
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id;NOT NULL" json:"patient_id"`
|
||
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
|
||
NameMask string `gorm:"column:name_mask;type:varchar(255);comment:患者姓名(掩码)" json:"name_mask"`
|
||
ReplyQuality float64 `gorm:"column:reply_quality;type:float(10,2);default:100.00;comment:回复质量(百分制)" json:"reply_quality"`
|
||
ServiceAttitude float64 `gorm:"column:service_attitude;type:float(10,2);default:100.00;comment:服务态度(百分制)" json:"service_attitude"`
|
||
ReplyProgress float64 `gorm:"column:reply_progress;type:float(10,2);default:100.00;comment:回复速度(百分制)" json:"reply_progress"`
|
||
AvgScore float64 `gorm:"column:avg_score;type:float(10,2);default:100.00;comment:平均得分(百分制,回复质量占4、服务态度占3、回复速度占3,计算公式:每个得分 * 占比 相加)" json:"avg_score"`
|
||
Type int `gorm:"column:type;type:tinyint(1);default:1;comment:类型(1:默认评价 2:主动评价)" json:"type"`
|
||
Content string `gorm:"column:content;type:text;comment:评价内容" json:"content"`
|
||
Model
|
||
}
|
||
|
||
func (m *OrderEvaluation) TableName() string {
|
||
return "gdxz_order_evaluation"
|
||
}
|
||
|
||
func (m *OrderEvaluation) BeforeCreate(tx *gorm.DB) error {
|
||
if m.EvaluationId == 0 {
|
||
m.EvaluationId = 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
|
||
}
|