初始化提交

This commit is contained in:
2023-08-31 17:32:45 +08:00
parent 88dc1bbe74
commit 7826652e11
101 changed files with 6127 additions and 2 deletions
+33
View File
@@ -0,0 +1,33 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DiseaseClassExpertise 疾病分类表-医生专长
type DiseaseClassExpertise struct {
ExpertiseId int64 `gorm:"column:expertise_id;type:bigint(19);primary_key;comment:主键id" json:"expertise_id"`
ExpertiseName string `gorm:"column:expertise_name;type:varchar(255);comment:专长名称" json:"expertise_name"`
ExpertiseSort int `gorm:"column:expertise_sort;type:int(11);default:0;comment:排序(越大排序越靠前)" json:"expertise_sort"`
Model
}
func (m *DiseaseClassExpertise) TableName() string {
return "gdxz_disease_class_expertise"
}
func (m *DiseaseClassExpertise) BeforeCreate(tx *gorm.DB) error {
if m.ExpertiseId == 0 {
m.ExpertiseId = 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
}
+41
View File
@@ -0,0 +1,41 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorBankCard 医生银行卡
type DoctorBankCard struct {
BankCardId int64 `gorm:"column:bank_card_id;type:bigint(19);primary_key;comment:主键id" json:"bank_card_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id;NOT NULL" json:"doctor_id"`
BankId int64 `gorm:"column:bank_id;type:bigint(19);comment:银行id" json:"bank_id"`
BankCardCode string `gorm:"column:bank_card_code;type:varchar(100);comment:银行卡号" json:"bank_card_code"`
BankCardCodeMask string `gorm:"column:bank_card_code_mask;type:varchar(100);comment:银行卡号(掩码)" json:"bank_card_code_mask"`
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
Province string `gorm:"column:province;type:varchar(40);comment:省份" json:"province"`
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
City string `gorm:"column:city;type:varchar(40);comment:城市" json:"city"`
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
Model
}
func (m *DoctorBankCard) TableName() string {
return "gdxz_doctor_bank_card"
}
func (m *DoctorBankCard) BeforeCreate(tx *gorm.DB) error {
if m.BankCardId == 0 {
m.BankCardId = 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
}
+33
View File
@@ -0,0 +1,33 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorExpertise 医生专长表
type DoctorExpertise struct {
DoctorExpertiseId int64 `gorm:"column:doctor_expertise_id;type:bigint(19);primary_key;comment:主键id" json:"doctor_expertise_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
ExpertiseId int64 `gorm:"column:expertise_id;type:bigint(19);comment:专长id" json:"expertise_id"`
Model
}
func (m *DoctorExpertise) TableName() string {
return "gdxz_doctor_expertise"
}
func (m *DoctorExpertise) BeforeCreate(tx *gorm.DB) error {
if m.DoctorExpertiseId == 0 {
m.DoctorExpertiseId = 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
View File
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// DoctorIdenFail 医生身份审核失败原因表
type DoctorIdenFail struct {
IdenFailId int64 `gorm:"column:iden_fail_id;type:bigint(19);primary_key;comment:主键id" json:"iden_fail_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
FieldName string `gorm:"column:field_name;type:varchar(50);comment:字段名称" json:"field_name"`
FailReason string `gorm:"column:fail_reason;type:varchar(255);comment:失败原因" json:"fail_reason"`
Model
}
func (m *DoctorIdenFail) TableName() string {
return "gdxz_doctor_iden_fail"
}
func (m *DoctorIdenFail) BeforeCreate(tx *gorm.DB) error {
if m.IdenFailId == 0 {
m.IdenFailId = 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
}
+46
View File
@@ -0,0 +1,46 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// Hospital 医院表
type Hospital struct {
HospitalID int64 `gorm:"column:hospital_id;type:bigint(19);primary_key;comment:主键id" json:"hospital_id"`
HospitalName string `gorm:"column:hospital_name;type:varchar(255);comment:医院名称" json:"hospital_name"`
HospitalStatus int `gorm:"column:hospital_status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"hospital_status"`
HospitalLevelName string `gorm:"column:hospital_level_name;type:varchar(20);comment:医院等级名称" json:"hospital_level_name"`
PostCode string `gorm:"column:post_code;type:varchar(50);comment:邮政编码" json:"post_code"`
TelePhone string `gorm:"column:tele_phone;type:varchar(20);comment:电话" json:"tele_phone"`
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
Province string `gorm:"column:province;type:varchar(50);comment:省份" json:"province"`
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
County string `gorm:"column:county;type:varchar(50);comment:区县" json:"county"`
Address string `gorm:"column:address;type:varchar(255);comment:地址" json:"address"`
Lat string `gorm:"column:lat;type:varchar(255);comment:纬度" json:"lat"`
Lng string `gorm:"column:lng;type:varchar(255);comment:经度" json:"lng"`
Desc string `gorm:"column:desc;type:varchar(255);comment:简介" json:"desc"`
Model
}
func (m *Hospital) TableName() string {
return "gdxz_hospital"
}
func (m *Hospital) BeforeCreate(tx *gorm.DB) error {
if m.HospitalID == 0 {
m.HospitalID = 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
View File
@@ -0,0 +1,34 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// HospitalDepartment 医院科室表-标准
type HospitalDepartment struct {
DepartmentId int64 `gorm:"column:department_id;type:bigint(19);primary_key;comment:主键id" json:"department_id"`
DepartmentName string `gorm:"column:department_name;type:varchar(255);comment:科室名称" json:"department_name"`
DepartmentCode string `gorm:"column:department_code;type:varchar(100);comment:科室代码" json:"department_code"`
DepartmentType int `gorm:"column:department_type;type:tinyint(1);default:0;comment:科室类型(0:未知 1:肝脏病)" json:"department_type"`
Model
}
func (m *HospitalDepartment) TableName() string {
return "gdxz_hospital_department"
}
func (m *HospitalDepartment) BeforeCreate(tx *gorm.DB) error {
if m.DepartmentId == 0 {
m.DepartmentId = 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
View File
@@ -0,0 +1,36 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// HospitalDepartmentCustom 医院科室表-自定义
type HospitalDepartmentCustom struct {
DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);primary_key;comment:主键id" json:"department_custom_id"`
DepartmentId int64 `gorm:"column:department_id;type:bigint(19);comment:医院科室-标准id" json:"department_id"`
DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称-自定义" json:"department_custom_name"`
DepartmentName string `gorm:"column:department_name;type:varchar(255);comment:科室名称-标准" json:"department_name"`
DepartmentCode string `gorm:"column:department_code;type:varchar(100);comment:科室编码-标准" json:"department_code"`
DepartmentStatus int `gorm:"column:department_status;type:tinyint(1);default:1;comment:状态(1:正常 2:删除)" json:"department_status"`
Model
}
func (m *HospitalDepartmentCustom) TableName() string {
return "gdxz_hospital_department_custom"
}
func (m *HospitalDepartmentCustom) BeforeCreate(tx *gorm.DB) error {
if m.DepartmentCustomId == 0 {
m.DepartmentCustomId = 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
View File
@@ -0,0 +1,38 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// LogSms 日志-短信发送表
type LogSms struct {
LogId int64 `gorm:"column:log_id;type:bigint(19);primary_key;comment:主键id" json:"log_id"`
Type int `gorm:"column:type;type:tinyint(1);comment:类型(1:短信 2:邮件);NOT NULL" json:"type"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:发送成功 2:发送失败)" json:"status"`
Phone string `gorm:"column:phone;type:varchar(20);comment:手机号" json:"phone"`
TemplateCode string `gorm:"column:template_code;type:varchar(20);comment:模版code" json:"template_code"`
ThirdCode string `gorm:"column:third_code;type:varchar(100);comment:第三方编码" json:"third_code"`
SceneDesc string `gorm:"column:scene_desc;type:varchar(255);comment:场景描述" json:"scene_desc"`
Remarks string `gorm:"column:remarks;type:varchar(255);comment:备注" json:"remarks"`
Model
}
func (m *LogSms) TableName() string {
return "gdxz_log_sms"
}
func (m *LogSms) BeforeCreate(tx *gorm.DB) error {
if m.LogId == 0 {
m.LogId = 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
}
+87
View File
@@ -0,0 +1,87 @@
package model
import (
"database/sql/driver"
"errors"
"fmt"
"gorm.io/gorm"
"strings"
"time"
)
type Model struct {
CreatedAt LocalTime `gorm:"column:created_at;type:datetime;comment:创建时间" json:"created_at"`
UpdatedAt LocalTime `gorm:"column:updated_at;type:datetime;comment:修改时间" json:"updated_at"`
}
// LocalTime 自定义数据类型
type LocalTime time.Time
func (t *LocalTime) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
return nil
}
var err error
// 前端接收的时间字符串
str := string(data)
// 去除接收的str收尾多余的"
timeStr := strings.Trim(str, "\"")
t1, err := time.Parse("2006-01-02 15:04:05", timeStr)
*t = LocalTime(t1)
return err
}
func (t LocalTime) MarshalJSON() ([]byte, error) {
formatted := fmt.Sprintf("\"%v\"", time.Time(t).Format("2006-01-02 15:04:05"))
return []byte(formatted), nil
}
func (t LocalTime) Value() (driver.Value, error) {
// MyTime 转换成 time.Time 类型
tTime := time.Time(t)
return tTime.Format("2006-01-02 15:04:05"), nil
}
func (t *LocalTime) Scan(v interface{}) error {
switch vt := v.(type) {
case time.Time:
// 字符串转成 time.Time 类型
*t = LocalTime(vt)
default:
return errors.New("类型处理错误")
}
return nil
}
func (t *LocalTime) String() string {
return fmt.Sprintf("hhh:%s", time.Time(*t).String())
}
func (t *LocalTime) IsEmpty() bool {
return time.Time(*t).IsZero()
}
func (m *Model) BeforeUpdate(tx *gorm.DB) (err error) {
m.UpdatedAt = LocalTime(time.Now())
tx.Statement.SetColumn("UpdatedAt", m.UpdatedAt)
return nil
}
func Paginate(page, pageSize int) func(db *gorm.DB) *gorm.DB {
return func(db *gorm.DB) *gorm.DB {
if page <= 0 {
page = 1
}
switch {
case pageSize > 100:
pageSize = 100
case pageSize <= 0:
pageSize = 10
}
offset := (page - 1) * pageSize
return db.Offset(offset).Limit(pageSize)
}
}
+35
View File
@@ -0,0 +1,35 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OpenKey 开放平台密钥表
type OpenKey struct {
OpenId int64 `gorm:"column:open_id;type:bigint(19) unsigned;primary_key;comment:主键id" json:"open_id"`
AppId string `gorm:"column:app_id;type:varchar(50);NOT NULL" json:"app_id"`
AppSecret string `gorm:"column:app_secret;type:varchar(200);comment:秘钥" json:"app_secret"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:正常 2:作废)" json:"status"`
UserType string `gorm:"column:user_type;type:varchar(255);comment:下发用户类型" json:"user_type"`
Model
}
func (m *OpenKey) TableName() string {
return "gdxz_open_key"
}
func (m *OpenKey) BeforeCreate(tx *gorm.DB) error {
if m.OpenId == 0 {
m.OpenId = 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
}
+64
View File
@@ -0,0 +1,64 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OrderInquiry 订单-问诊表
type OrderInquiry struct {
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);primary_key;comment:主键id" json:"order_inquiry_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"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户);NOT NULL" json:"family_id"`
InquiryType int `gorm:"column:inquiry_type;type:tinyint(1);comment:订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药 5:检测);NOT NULL" json:"inquiry_type"`
InquiryMode int `gorm:"column:inquiry_mode;type:tinyint(1);comment:订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员);NOT NULL" json:"inquiry_mode"`
InquiryStatus int `gorm:"column:inquiry_status;type:tinyint(1);default:1;comment:问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消);NOT NULL" json:"inquiry_status"`
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:删除状态(0:否 1:是)" json:"is_delete"`
InquiryRefundStatus int `gorm:"column:inquiry_refund_status;type:tinyint(1);default:0;comment:问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"inquiry_refund_status"`
InquiryPayChannel int `gorm:"column:inquiry_pay_channel;type:tinyint(1);comment:支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)" json:"inquiry_pay_channel"`
InquiryPayStatus int `gorm:"column:inquiry_pay_status;type:tinyint(1);default:1;comment:支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款);NOT NULL" json:"inquiry_pay_status"`
InquiryNo string `gorm:"column:inquiry_no;type:varchar(30);comment:系统订单编号;NOT NULL" json:"inquiry_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);default:0.00;comment:订单金额" json:"amount_total"`
CouponAmountTotal float64 `gorm:"column:coupon_amount_total;type:decimal(10,2);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"`
ReceptionTime LocalTime `gorm:"column:reception_time;type:datetime;comment:接诊时间(已接诊)" json:"reception_time"`
CompleteTime LocalTime `gorm:"column:complete_time;type:datetime;comment:订单完成时间(问诊完成时间)" json:"complete_time"`
FinishTime LocalTime `gorm:"column:finish_time;type:datetime;comment:订单结束时间" json:"finish_time"`
StatisticsStatus int `gorm:"column:statistics_status;type:tinyint(1);default:0;comment:订单统计状态(0:未统计 1:已统计 2:统计失败)" json:"statistics_status"`
StatisticsTime LocalTime `gorm:"column:statistics_time;type:datetime;comment:订单统计时间" json:"statistics_time"`
IsWithdrawal int `gorm:"column:is_withdrawal;type:tinyint(1);default:0;comment:是否提现(0:否 1:是 2:提现中)" json:"is_withdrawal"`
WithdrawalTime LocalTime `gorm:"column:withdrawal_time;type:datetime;comment:提现时间" json:"withdrawal_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:主动取消 3:无可分配医生 4:客服取消 5:支付超时)" json:"cancel_reason"`
CancelRemarks string `gorm:"column:cancel_remarks;type:varchar(255);comment:取消订单备注(自动添加)" json:"cancel_remarks"`
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"`
UserDoctor *UserDoctor `gorm:"foreignKey:DoctorId;references:doctor_id" json:"user_doctor"` // 医生
PatientUser *User `gorm:"foreignKey:UserId;references:user_id" json:"patient_user"` // 用户-患者
Model
}
func (m *OrderInquiry) TableName() string {
return "gdxz_order_inquiry"
}
func (m *OrderInquiry) BeforeCreate(tx *gorm.DB) error {
if m.OrderInquiryId == 0 {
m.OrderInquiryId = 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
}
+54
View File
@@ -0,0 +1,54 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OrderInquiryCase 订单-问诊病例表
type OrderInquiryCase struct {
InquiryCaseId int64 `gorm:"column:inquiry_case_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_case_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id" json:"family_id"`
Relation int `gorm:"column:relation;type:tinyint(1);default: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"`
Height string `gorm:"column:height;type:varchar(100);comment:身高(cm" json:"height"`
Weight string `gorm:"column:weight;type:varchar(100);comment:体重(kg" json:"weight"`
DiseaseClassId int64 `gorm:"column:disease_class_id;type:bigint(19);comment:疾病分类id-系统" json:"disease_class_id"`
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"`
IsTaboo int `gorm:"column:is_taboo;type:tinyint(1);comment:是否服用过禁忌药物,且无相关禁忌(0:否 1:是)问诊购药时存在" json:"is_taboo"`
Model
}
func (m *OrderInquiryCase) TableName() string {
return "gdxz_order_inquiry_case"
}
func (m *OrderInquiryCase) BeforeCreate(tx *gorm.DB) error {
if m.InquiryCaseId == 0 {
m.InquiryCaseId = 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
}
+35
View File
@@ -0,0 +1,35 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OrderInquiryCoupon 订单-问诊-优惠卷表
type OrderInquiryCoupon struct {
OrderCouponId int64 `gorm:"column:order_coupon_id;type:bigint(19);primary_key;comment:主键id" json:"order_coupon_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_id"`
UserCouponId int64 `gorm:"column:user_coupon_id;type:bigint(19);comment:用户优惠卷表;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 *OrderInquiryCoupon) TableName() string {
return "gdxz_order_inquiry_coupon"
}
func (m *OrderInquiryCoupon) 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
}
+39
View File
@@ -0,0 +1,39 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OrderInquiryRefund 订单-问诊-退款表
type OrderInquiryRefund struct {
InquiryRefundId int64 `gorm:"column:inquiry_refund_id;type:bigint(19);primary_key;comment:主键id" json:"inquiry_refund_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id" json:"order_inquiry_id"`
InquiryNo string `gorm:"column:inquiry_no;type:varchar(40);comment:系统订单编号" json:"inquiry_no"`
InquiryRefundNo string `gorm:"column:inquiry_refund_no;type:varchar(50);comment:系统退款编号" json:"inquiry_refund_no"`
RefundId string `gorm:"column:refund_id;type:varchar(50);comment:第三方退款单号" json:"refund_id"`
InquiryRefundStatus int `gorm:"column:inquiry_refund_status;type:tinyint(4);comment:问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)" json:"inquiry_refund_status"`
RefundTotal float64 `gorm:"column:refund_total;type:decimal(10,2);comment:退款金额" json:"refund_total"`
RefundReason string `gorm:"column:refund_reason;type:varchar(255);comment:退款原因" json:"refund_reason"`
SuccessTime time.Time `gorm:"column:success_time;type:datetime;comment:退款成功时间" json:"success_time"`
Model
}
func (m *OrderInquiryRefund) TableName() string {
return "gdxz_order_inquiry_refund"
}
func (m *OrderInquiryRefund) BeforeCreate(tx *gorm.DB) error {
if m.InquiryRefundId == 0 {
m.InquiryRefundId = 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
}
+54
View File
@@ -0,0 +1,54 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// OrderPrescription 订单-处方表
type OrderPrescription struct {
OrderPrescriptionId int64 `gorm:"column:order_prescription_id;type:bigint(19);primary_key;comment:主键id" json:"order_prescription_id"`
OrderInquiryId int64 `gorm:"column:order_inquiry_id;type:bigint(19);comment:订单-问诊id;NOT NULL" json:"order_inquiry_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" json:"patient_id"`
FamilyId int64 `gorm:"column:family_id;type:bigint(19);comment:家庭成员id(就诊用户)" json:"family_id"`
PharmacistId int64 `gorm:"column:pharmacist_id;type:bigint(19);comment:药师id" json:"pharmacist_id"`
PrescriptionStatus int `gorm:"column:prescription_status;type:tinyint(1);comment:处方状态(1:待审核 2:待使用 3:已失效 4:已使用)" json:"prescription_status"`
PharmacistAuditStatus int `gorm:"column:pharmacist_audit_status;type:tinyint(1);default:0;comment:药师审核状态(0:审核中 1:审核成功 2:审核驳回)" json:"pharmacist_audit_status"`
PharmacistVerifyTime time.Time `gorm:"column:pharmacist_verify_time;type:datetime;comment:药师审核时间" json:"pharmacist_verify_time"`
PharmacistFailReason string `gorm:"column:pharmacist_fail_reason;type:varchar(255);comment:药师审核驳回原因" json:"pharmacist_fail_reason"`
PlatformAuditStatus int `gorm:"column:platform_audit_status;type:tinyint(1);default:0;comment:处方平台审核状态(0:审核中 1:审核成功 2:审核驳回)" json:"platform_audit_status"`
PlatformFailTime time.Time `gorm:"column:platform_fail_time;type:datetime;comment:平台审核失败时间" json:"platform_fail_time"`
PlatformFailReason string `gorm:"column:platform_fail_reason;type:varchar(255);comment:处方平台驳回原因" json:"platform_fail_reason"`
IsAutoPharVerify int `gorm:"column:is_auto_phar_verify;type:tinyint(1);default:0;comment:是否药师自动审核(0:否 1:是)" json:"is_auto_phar_verify"`
DoctorCreatedTime time.Time `gorm:"column:doctor_created_time;type:datetime;comment:医生开具处方时间" json:"doctor_created_time"`
ExpiredTime time.Time `gorm:"column:expired_time;type:datetime;comment:处方过期时间" json:"expired_time"`
VoidTime time.Time `gorm:"column:void_time;type:datetime;comment:处方作废时间" json:"void_time"`
IsDelete int `gorm:"column:is_delete;type:tinyint(1);default:0;comment:是否删除(0:否 1:是)" json:"is_delete"`
PrescriptionCode string `gorm:"column:prescription_code;type:varchar(255);comment:处方编号" json:"prescription_code"`
DoctorName string `gorm:"column:doctor_name;type:varchar(100);comment:医生名称" json:"doctor_name"`
PatientName string `gorm:"column:patient_name;type:varchar(100);comment:患者姓名-就诊人" json:"patient_name"`
PatientSex int `gorm:"column:patient_sex;type:tinyint(1);comment:患者性别-就诊人(1:男 2:女)" json:"patient_sex"`
PatientAge int `gorm:"column:patient_age;type:int(11);comment:患者年龄-就诊人" json:"patient_age"`
DoctorAdvice string `gorm:"column:doctor_advice;type:varchar(255);comment:医嘱" json:"doctor_advice"`
Model
}
func (m *OrderPrescription) TableName() string {
return "gdxz_order_prescription"
}
func (m *OrderPrescription) BeforeCreate(tx *gorm.DB) error {
if m.OrderPrescriptionId == 0 {
m.OrderPrescriptionId = 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
}
+57
View File
@@ -0,0 +1,57 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// PatientFamily 患者家庭成员信息表-基本信息
type PatientFamily struct {
FamilyId int64 `gorm:"column:family_id;type:bigint(19);primary_key;comment:主键id" json:"family_id"`
PatientId int64 `gorm:"column:patient_id;type:bigint(19);comment:患者id" json:"patient_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"`
IsDefault int `gorm:"column:is_default;type:tinyint(1);default:0;comment:是否默认(0:否 1:是)" json:"is_default"`
CardName string `gorm:"column:card_name;type:varchar(50);comment:姓名" json:"card_name"`
CardNameMask string `gorm:"column:card_name_mask;type:varchar(50);comment:姓名(掩码)" json:"card_name_mask"`
Mobile string `gorm:"column:mobile;type:varchar(20);comment:电话" json:"mobile"`
MobileMask string `gorm:"column:mobile_mask;type:varchar(20);comment:电话(掩码)" json:"mobile_mask"`
Type int `gorm:"column:type;type:tinyint(1);default:1;comment:身份类型(1:身份证 2:护照 3:港澳通行证 4:台胞证)" json:"type"`
IdNumber string `gorm:"column:id_number;type:varchar(30);comment:证件号码" json:"id_number"`
IdNumberMask string `gorm:"column:id_number_mask;type:varchar(30);comment:证件号码(掩码)" json:"id_number_mask"`
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"`
ProvinceId int `gorm:"column:province_id;type:int(11);comment:省份id" json:"province_id"`
Province string `gorm:"column:province;type:varchar(50);comment:省份" json:"province"`
CityId int `gorm:"column:city_id;type:int(11);comment:城市id" json:"city_id"`
City string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
CountyId int `gorm:"column:county_id;type:int(11);comment:区县id" json:"county_id"`
County string `gorm:"column:county;type:varchar(255);comment:区县" json:"county"`
Height string `gorm:"column:height;type:varchar(100);comment:身高(cm" json:"height"`
Weight string `gorm:"column:weight;type:varchar(100);comment:体重(kg" json:"weight"`
MaritalStatus int `gorm:"column:marital_status;type:tinyint(1);comment:婚姻状况(0:未婚 1:已婚 2:离异)" json:"marital_status"`
NationId int64 `gorm:"column:nation_id;type:bigint(19);comment:民族" json:"nation_id"`
NationName string `gorm:"column:nation_name;type:varchar(50);comment:民族名称" json:"nation_name"`
JobId int64 `gorm:"column:job_id;type:bigint(19);comment:职业" json:"job_id"`
JobName string `gorm:"column:job_name;type:varchar(50);comment:职业名称" json:"job_name"`
Model
}
func (m *PatientFamily) TableName() string {
return "gdxz_patient_family"
}
func (m *PatientFamily) BeforeCreate(tx *gorm.DB) error {
if m.FamilyId == 0 {
m.FamilyId = 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
}
+45
View File
@@ -0,0 +1,45 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// User 用户主表
type User struct {
UserId int64 `gorm:"column:user_id;type:bigint(19);primary_key;comment:主键" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(50);comment:用户名称" json:"user_name"`
UserAccount string `gorm:"column:user_account;type:varchar(50);comment:账号" json:"user_account"`
Mobile string `gorm:"column:mobile;type:varchar(20);comment:手机号" json:"mobile"`
WxMobile string `gorm:"column:wx_mobile;type:varchar(20);comment:微信手机号" json:"wx_mobile"`
UserPassword string `gorm:"column:user_password;type:varchar(50);comment:密码" json:"user_password"`
Salt string `gorm:"column:salt;type:varchar(50);comment:密码混淆码" json:"salt"`
UserType int `gorm:"column:user_type;type:tinyint(1);comment:用户类型(1:患者 2:医师 3:药师);NOT NULL" json:"user_type"`
UserStatus int `gorm:"column:user_status;type:tinyint(4);default:1;comment:状态(0:禁用 1:正常 2:删除)" json:"user_status"`
RegisterMethod int `gorm:"column:register_method;type:tinyint(1);comment:注册方式(1:微信小程序 " json:"register_method"`
Age uint `gorm:"column:age;type:int(10) unsigned;comment:年龄" json:"age"`
Sex int `gorm:"column:sex;type:tinyint(1);default:0;comment:性别(0:未知 1:男 2:女)" json:"sex"`
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
LoginIp string `gorm:"column:login_ip;type:varchar(255);comment:登陆ip" json:"login_ip"`
LastLoginAt LocalTime `gorm:"column:last_login_at;type:datetime;comment:最后登陆时间" json:"last_login_at"`
CreatedBy string `gorm:"column:created_by;type:varchar(100);comment:创建者id(后台用户表id null:自己注册)" json:"created_by"`
Model
}
func (m *User) TableName() string {
return "gdxz_user"
}
func (m *User) BeforeCreate(tx *gorm.DB) error {
if m.UserId == 0 {
m.UserId = 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
View File
@@ -0,0 +1,40 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// UserCaCert 医师/药师ca监管证书表
type UserCaCert struct {
CertId int64 `gorm:"column:cert_id;type:bigint(19);primary_key;comment:主键id" json:"cert_id"`
UserId *int64 `gorm:"column:user_id;type:bigint(19);comment:用户id(系统证书时为null)" json:"user_id"`
IsSystem int `gorm:"column:is_system;type:tinyint(1);default:0;comment:是否系统证书(0:否 1:是)" json:"is_system"`
Type int `gorm:"column:type;type:tinyint(1);comment:证书类型(1:线下 2:线上)" json:"type"`
CertBase64 string `gorm:"column:cert_base64;type:text;comment:签名值证书" json:"cert_base64"`
CertChainP7 string `gorm:"column:cert_chain_p7;type:text;comment:证书链" json:"cert_chain_p7"`
CertSerialNumber string `gorm:"column:cert_serial_number;type:varchar(100);comment:证书序列号" json:"cert_serial_number"`
CaPin string `gorm:"column:ca_pin;type:varchar(100);comment:ca认证pin值" json:"ca_pin"`
IsSignConfig int `gorm:"column:is_sign_config;type:tinyint(1);default:0;comment:是否已添加签章配置(第一次需申请)" json:"is_sign_config"`
SignConfig string `gorm:"column:sign_config;type:text;comment:签章坐标配置" json:"sign_config"`
Model
}
func (m *UserCaCert) TableName() string {
return "gdxz_user_ca_cert"
}
func (m *UserCaCert) BeforeCreate(tx *gorm.DB) error {
if m.CertId == 0 {
m.CertId = 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
View File
@@ -0,0 +1,38 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// UserCoupon 用户优惠卷表
type UserCoupon struct {
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"`
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"`
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"`
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"`
Model
}
func (m *UserCoupon) TableName() string {
return "gdxz_user_coupon"
}
func (m *UserCoupon) BeforeCreate(tx *gorm.DB) error {
if m.UserCouponId == 0 {
m.UserCouponId = 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
}
+68
View File
@@ -0,0 +1,68 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// UserDoctor 用户-医生表
type UserDoctor struct {
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);primary_key;comment:主键" json:"doctor_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id;NOT NULL" json:"user_id"`
UserName string `gorm:"column:user_name;type:varchar(50);comment:用户名称" json:"user_name"`
OpenId string `gorm:"column:open_id;type:varchar(100);comment:微信open_id" json:"open_id"`
UnionId string `gorm:"column:union_id;type:varchar(100);comment:微信开放平台唯一标识" json:"union_id"`
WxSessionKey string `gorm:"column:wx_session_key;type:varchar(255);comment:微信会话密钥" json:"wx_session_key"`
Status int `gorm:"column:status;type:tinyint(1);default:1;comment:状态(0:禁用 1:正常 2:删除);NOT NULL" json:"status"`
IdcardStatus int `gorm:"column:idcard_status;type:tinyint(1);default:0;comment:实名认证状态(0:未认证 1:认证通过 2:认证失败)" json:"idcard_status"`
IdenAuthStatus int `gorm:"column:iden_auth_status;type:tinyint(1);default:0;comment:身份认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败);NOT NULL" json:"iden_auth_status"`
IdenAuthTime LocalTime `gorm:"column:iden_auth_time;type:datetime;comment:审核时间" json:"iden_auth_time"`
IdenAuthFailReason string `gorm:"column:iden_auth_fail_reason;type:text;comment:身份认证失败原因" json:"iden_auth_fail_reason"`
MultiPointStatus int `gorm:"column:multi_point_status;type:tinyint(1);default:0;comment:医生多点执业认证状态(0:未认证 1:认证通过 2:审核中 3:认证失败)" json:"multi_point_status"`
MultiPointTime LocalTime `gorm:"column:multi_point_time;type:datetime;comment:审核时间" json:"multi_point_time"`
MultiPointFailReason string `gorm:"column:multi_point_fail_reason;type:varchar(255);comment:多点执业认证失败原因" json:"multi_point_fail_reason"`
IsBindBank int `gorm:"column:is_bind_bank;type:tinyint(1);default:0;comment:是否已绑定结算银行卡(0:否 1:是);NOT NULL" json:"is_bind_bank"`
IsRecommend int `gorm:"column:is_recommend;type:tinyint(1);default:0;comment:是否首页推荐(0:否 1:是)" json:"is_recommend"`
Avatar string `gorm:"column:avatar;type:varchar(255);comment:头像" json:"avatar"`
DoctorTitle int `gorm:"column:doctor_title;type:tinyint(1);comment:医生职称(1:主任医师 2:主任中医师 3:副主任医师 4:副主任中医师 5:主治医师 6:住院医师)" json:"doctor_title"`
DepartmentCustomId int64 `gorm:"column:department_custom_id;type:bigint(19);comment:科室id-自定义" json:"department_custom_id"`
DepartmentCustomName string `gorm:"column:department_custom_name;type:varchar(100);comment:科室名称(如未自己输入,填入标准科室名称)" json:"department_custom_name"`
DepartmentCustomMobile string `gorm:"column:department_custom_mobile;type:varchar(30);comment:科室电话" json:"department_custom_mobile"`
HospitalID int64 `gorm:"column:hospital_id;type:bigint(19);comment:所属医院id" json:"hospital_id"`
ServedPatientsNum int `gorm:"column:served_patients_num;type:int(11);default:0;comment:服务患者数量(订单结束时统计)" json:"served_patients_num"`
PraiseRate float64 `gorm:"column:praise_rate;type:float(10,2);default:0.00;comment:好评率(百分制。订单平均评价中超过4-5分的订单总数 / 总订单数 * 5" json:"praise_rate"`
AvgResponseTime float64 `gorm:"column:avg_response_time;type:float(10,2);default:0.00;comment:平均响应时间(分钟制)" json:"avg_response_time"`
NumberOfFans uint `gorm:"column:number_of_fans;type:int(10) unsigned;default:0;comment:被关注数量" json:"number_of_fans"`
IsOnline int `gorm:"column:is_online;type:tinyint(1);default:0;comment:是否在线(0:不在线 1:在线)" json:"is_online"`
IsImgExpertReception int `gorm:"column:is_img_expert_reception;type:tinyint(1);default:0;comment:是否参加专家图文接诊(0:否 1:是)" json:"is_img_expert_reception"`
IsImgWelfareReception int `gorm:"column:is_img_welfare_reception;type:tinyint(1);default:0;comment:是否参加公益图文问诊(0:否 1:是)" json:"is_img_welfare_reception"`
IsImgQuickReception int `gorm:"column:is_img_quick_reception;type:tinyint(1);default:0;comment:是否参加快速图文接诊(0:否 1:是)" json:"is_img_quick_reception"`
IsPlatformDeepCooperation int `gorm:"column:is_platform_deep_cooperation;type:tinyint(1);default:0;comment:是否平台深度合作医生(0:否 1:是)" json:"is_platform_deep_cooperation"`
IsEnterpriseDeepCooperation int `gorm:"column:is_enterprise_deep_cooperation;type:tinyint(1);default:0;comment:是否企业深度合作医生(0:否 1:是)" json:"is_enterprise_deep_cooperation"`
IsSysDiagnoCooperation int `gorm:"column:is_sys_diagno_cooperation;type:tinyint(1);default:0;comment:是否先思达合作医生(0:否 1:是)" json:"is_sys_diagno_cooperation"`
QrCode string `gorm:"column:qr_code;type:varchar(255);comment:分享二维码" json:"qr_code"`
BeGoodAt string `gorm:"column:be_good_at;type:text;comment:擅长" json:"be_good_at"`
BriefIntroduction string `gorm:"column:brief_introduction;type:text;comment:医生简介" json:"brief_introduction"`
Model
User *User `gorm:"foreignKey:UserId;references:user_id" json:"user"` // 用户
Hospital *Hospital `gorm:"foreignKey:HospitalID;references:hospital_id" json:"hospital"` // 医院
}
func (m *UserDoctor) TableName() string {
return "gdxz_user_doctor"
}
func (m *UserDoctor) BeforeCreate(tx *gorm.DB) error {
if m.DoctorId == 0 {
m.DoctorId = 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
}
+46
View File
@@ -0,0 +1,46 @@
package model
import (
"gorm.io/gorm"
"hospital-open-api/global"
"time"
)
// UserDoctorInfo 用户-医生详情表
type UserDoctorInfo struct {
DoctorInfoId int64 `gorm:"column:doctor_info_id;type:bigint(19);primary_key;comment:主键" json:"doctor_info_id"`
UserId int64 `gorm:"column:user_id;type:bigint(19);comment:用户id" json:"user_id"`
DoctorId int64 `gorm:"column:doctor_id;type:bigint(19);comment:医生id" json:"doctor_id"`
CardType int `gorm:"column:card_type;type:tinyint(1);comment:类型(1:身份证 2:护照 3:港澳通行证 4:台胞证);NOT NULL" json:"card_type"`
CardName string `gorm:"column:card_name;type:varchar(50);comment:证件姓名" json:"card_name"`
CardNameMask string `gorm:"column:card_name_mask;type:varchar(50);comment:证件姓名(掩码)" json:"card_name_mask"`
CardNum string `gorm:"column:card_num;type:varchar(30);comment:证件号码" json:"card_num"`
CardNumMask string `gorm:"column:card_num_mask;type:varchar(50);comment:证件号码(掩码)" json:"card_num_mask"`
LicenseCert string `gorm:"column:license_cert;type:varchar(255);comment:医师执业证(逗号分隔)" json:"license_cert"`
QualificationCert string `gorm:"column:qualification_cert;type:varchar(255);comment:医师资格证(逗号分隔)" json:"qualification_cert"`
QualificationCertNum string `gorm:"column:qualification_cert_num;type:varchar(255);comment:医师资格证号(逗号分隔)" json:"qualification_cert_num"`
WorkCert string `gorm:"column:work_cert;type:varchar(255);comment:医师工作证(逗号分隔)" json:"work_cert"`
MultiPointImages string `gorm:"column:multi_point_images;type:varchar(255);comment:多点执业备案信息(逗号分隔)" json:"multi_point_images"`
IdCardFront string `gorm:"column:id_card_front;type:varchar(255);comment:身份证正面图片" json:"id_card_front"`
IdCardBack string `gorm:"column:id_card_back;type:varchar(255);comment:身份证背面图片" json:"id_card_back"`
SignImage string `gorm:"column:sign_image;type:varchar(255);comment:签名图片" json:"sign_image"`
Model
}
func (m *UserDoctorInfo) TableName() string {
return "gdxz_user_doctor_info"
}
func (m *UserDoctorInfo) BeforeCreate(tx *gorm.DB) error {
if m.DoctorInfoId == 0 {
m.DoctorInfoId = 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
}