package models import "time" //检测项目 type CheckItem struct { Id int `json:"id" gorm:"type:int(11) auto_increment; NOT NULL; primary_key; COMMENT:'检测项目ID'" description:"检测项目ID"` CheckItemNumber int `json:"check_item_number" gorm:"type:int(11); COMMENT:'排序'" description:"排序"` Language string `json:"language" gorm:"type:varchar(255); COMMENT:'cn: 中文 en 英文'" description:"cn: 中文 en 英文"` NameEn string `json:"name_en" gorm:"type:varchar(255); COMMENT:'检测项目英文名'" description:"检测项目英文名"` NameCn string `json:"name_cn" gorm:"type:varchar(255); COMMENT:'检测项目中文名'" description:"检测项目中文名"` DeviceType string `json:"device_type" gorm:"type:varchar(11); COMMENT:'设备类型'" description:"设备类型"` CheckType string `json:"check_type" gorm:"type:varchar(255); COMMENT:'检测类型(试纸类型)'" description:"检测类型(试纸类型)"` ReferenceValue string `json:"reference_value" gorm:"type:varchar(255); COMMENT:' 参考值'" description:" 参考值"` ScopeList string `json:"scope_list" gorm:"type:text; COMMENT:'范围value 值,type =1为正常、2及以上为异 常'" description:"范围value 值,type =1为正常、2及以上为异 常"` Text string `json:"text" gorm:"type:varchar(255); COMMENT:'文本'" description:"文本"` Details string `json:"details" gorm:"type:text; COMMENT:'描述'" description:"描述"` Unit string `json:"unit" gorm:"type:varchar(255); COMMENT:'单位'" description:"单位"` Remark string `json:"remark" gorm:"type:varchar(255); COMMENT:'备注'" description:"备注"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '" description:"更新时间 "` DeleteFlag int `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'" description:"删除标志"` } func (CheckItem) TableName() string { return "check_item" } //检测记录 type CheckRecord struct { Id int64 `json:"id" gorm:"type:bigint(20); NOT NULL; primary_key; COMMENT:'检测记录ID'" description:"检测记录ID"` CheckType string `json:"check_type" gorm:"type:varchar(255); COMMENT:'检测类型(试纸类型)'" description:"检测类型(试纸类型)"` PutSources string `json:"put_sources" gorm:"type:varchar(255); COMMENT:'上传数据来源'" description:"上传数据来源"` DeviceId uint64 `json:"device_id" gorm:"type:bigint(20) unsigned; COMMENT:'设备ID'" description:"设备ID"` DeviceStatus int `json:"device_status" gorm:"type:int(2); COMMENT:'设备状态'" description:"设备状态"` MessageId string `json:"message_id" gorm:"type:varchar(255); COMMENT:'设备消息id'" description:"设备消息id"` UserId uint64 `json:"user_id" gorm:"type:bigint(20) unsigned; DEFAULT:'0'; COMMENT:'用户ID'" description:"用户ID"` UserHealthProfileId int64 `json:"user_health_profile_id" gorm:"type:bigint(20); DEFAULT:'0'; COMMENT:'健康档案ID'" description:"健康档案ID"` View int `json:"view" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'查看:1(已查看) 0(未查看)'" description:"查看:1(已查看) 0(未查看)"` AlertItemIds string `json:"alert_item_ids" gorm:"type:varchar(255); COMMENT:'异常项目id (1,2,3)'" description:"异常项目id (1,2,3)"` Acc int `json:"acc" gorm:"type:int(10); COMMENT:'设备检测次数'" description:"设备检测次数"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间 '" description:"创建时间 "` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间'" description:"更新时间"` DeleteFlag int `json:"delete_flag" gorm:"type:int(1); DEFAULT:'0'; COMMENT:'删除标志'" description:"删除标志"` } func (CheckRecord) TableName() string { return "check_record" } //检测记录详情 type CheckRecordItem struct { Id int64 `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key"` CheckId int64 `json:"check_id" gorm:"type:bigint(20); NOT NULL; DEFAULT:'0'"` CheckItemId int `json:"check_item_id" gorm:"type:int(11); COMMENT:'检测项目id'" description:"检测项目id"` CheckValue string `json:"check_value" gorm:"type:varchar(255); COMMENT:'检测结果数值'" description:"检测结果数值"` CheckValueIndex int `json:"check_value_index" gorm:"type:int(3); COMMENT:'check_item value index'" description:"check_item value index"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"` DeleteFlag int `json:"delete_flag" gorm:"type:int(11); COMMENT:'删除标志'" description:"删除标志"` } func (CheckRecordItem) TableName() string { return "check_record_item" } //设备表 type Device struct { Id uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'设备ID'" description:"设备ID"` Name string `json:"name" gorm:"type:varchar(255); COMMENT:'设备名称'" description:"设备名称"` Serialno string `json:"serialno" gorm:"type:varchar(64); COMMENT:'设备编号'" description:"设备编号"` DeviceName string `json:"device_name" gorm:"type:varchar(255); COMMENT:'设备名称'" description:"设备名称"` DeviceType string `json:"device_type" gorm:"type:varchar(11); COMMENT:'设备类型'" description:"设备类型"` InformType int `json:"inform_type" gorm:"type:int(1); COMMENT:'通知类型:0跳转小程序、1跳转网页 、默认跳转小程序'" description:"通知类型:0跳转小程序、1跳转网页 、默认跳转小程序"` Mac string `json:"mac" gorm:"type:varchar(255)"` Mcu string `json:"mcu" gorm:"type:varchar(255)"` BatchNumber int `json:"batch_number" gorm:"type:int(10); COMMENT:'批号'" description:"批号"` ProductionDateNumber int `json:"production_date_number" gorm:"type:int(10); COMMENT:'生产日期'" description:"生产日期"` Number int `json:"number" gorm:"type:int(10); COMMENT:'序号'" description:"序号"` QrCodeId int64 `json:"qr_code_id" gorm:"type:bigint(20)"` EmqPassword string `json:"emq_password" gorm:"type:varchar(255); COMMENT:'emq密码'" description:"emq密码"` Status int `json:"status" gorm:"type:int(2); DEFAULT:'0'; COMMENT:'状态(0:未分配 1:已分配 2:包装中 3:待出厂 6:废弃 99:已出厂 100:销售中 101:已售出)'" description:"状态(0:未分配 1:已分配 2:包装中 3:待出厂 6:废弃 99:已出厂 100:销售中 101:已售出)"` Ver string `json:"ver" gorm:"type:varchar(255); COMMENT:'软件版本'" description:"软件版本"` OemCompany int `json:"oem_company" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'厂商(0:自营 1:艾玛OEM)'" description:"厂商(0:自营 1:艾玛OEM)"` McuType string `json:"mcu_type" gorm:"type:varchar(32); COMMENT:'MCU芯片类型'" description:"MCU芯片类型"` SensorMode string `json:"sensor_mode" gorm:"type:varchar(32); COMMENT:'传感放大倍数'" description:"传感放大倍数"` Language string `json:"language" gorm:"type:varchar(32); COMMENT:'语言'" description:"语言"` PaperCheck int `json:"paper_check" gorm:"type:int(11); COMMENT:'试纸检查状态'" description:"试纸检查状态"` WifiVer string `json:"wifi_ver" gorm:"type:varchar(32); COMMENT:'WIFI版本'" description:"WIFI版本"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '" description:"更新时间 "` DeleteFlag int `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志'" description:"删除标志"` } func (Device) TableName() string { return "device" } //设备消息日志 type DeviceMessageLog struct { Id uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key"` MessageId string `json:"message_id" gorm:"type:varchar(255)"` DeviceName string `json:"device_name" gorm:"type:varchar(255)"` Topic string `json:"topic" gorm:"type:varchar(255)"` EventType string `json:"event_type" gorm:"type:varchar(255)"` Content string `json:"content" gorm:"type:text; COMMENT:'消息内容'" description:"消息内容"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` } func (DeviceMessageLog) TableName() string { return "device_message_log" } //设备绑定表 type DeviceRelate struct { Id int64 `json:"id" gorm:"type:bigint(20) auto_increment; NOT NULL; primary_key; COMMENT:'id'" description:"id"` Name string `json:"name" gorm:"type:varchar(255); COMMENT:'名称'" description:"名称"` DeviceId uint64 `json:"device_id" gorm:"type:bigint(20) unsigned; COMMENT:'设备Id'" description:"设备Id"` UserId uint64 `json:"user_id" gorm:"type:bigint(20) unsigned; COMMENT:'会员Id'" description:"会员Id"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '" description:"更新时间 "` DeleteFlag int `json:"delete_flag" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'删除标志(解绑时标记为删除)'" description:"删除标志(解绑时标记为删除)"` } func (DeviceRelate) TableName() string { return "device_relate" } type SysDictionary struct { Id int `json:"id" gorm:"type:int(11) auto_increment; NOT NULL; primary_key"` NameEn string `json:"name_en" gorm:"type:varchar(255)"` NameCh string `json:"name_ch" gorm:"type:text"` Type string `json:"type" gorm:"type:varchar(255)"` ParentId int `json:"parent_id" gorm:"type:int(11)"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP"` DeleteFlag int `json:"delete_flag" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'删除标志'" description:"删除标志"` } func (SysDictionary) TableName() string { return "sys_dictionary" } //用户健康档案 type UserHealthProfile struct { Id uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'" description:"Primary Key ID"` UserId uint64 `json:"user_id" gorm:"type:bigint(20) unsigned; NOT NULL; COMMENT:'用户ID'" description:"用户ID"` RealName string `json:"real_name" gorm:"type:varchar(64); COMMENT:'真实姓名'" description:"真实姓名"` IdCard string `json:"id_card" gorm:"type:varchar(64); COMMENT:'身份证号'" description:"身份证号"` InpatientRegPhone string `json:"inpatient_reg_phone" gorm:"type:varchar(32); COMMENT:'住院登记手机号'" description:"住院登记手机号"` Gender int `json:"gender" gorm:"type:int(11); DEFAULT:'0'; COMMENT:'性别(0:未知 1:男 2:女)'" description:"性别(0:未知 1:男 2:女)"` Height int `json:"height" gorm:"type:int(11); COMMENT:'身高'" description:"身高"` Weight int `json:"weight" gorm:"type:int(11); COMMENT:'体重'" description:"体重"` BloodType string `json:"blood_type" gorm:"type:varchar(32); COMMENT:'血型'" description:"血型"` Birthday time.Time `json:"birthday" gorm:"type:datetime; COMMENT:'生日'" description:"生日"` IllnessState string `json:"illness_state" gorm:"type:varchar(255); COMMENT:'病情'" description:"病情"` RenalFunctionStatus int `json:"renal_function_status" gorm:"type:int(11); COMMENT:'肾功能情况(0:未透析,1: 血液透析,2:腹膜透析,3:肾脏移植)'" description:"肾功能情况(0:未透析,1: 血液透析,2:腹膜透析,3:肾脏移植)"` Creatinine int `json:"creatinine" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'血肌酐'" description:"血肌酐"` CreatinineUnit string `json:"creatinine_unit" gorm:"type:varchar(32); COMMENT:'肌酐单位(umol/L,mg/dl)'" description:"肌酐单位(umol/L,mg/dl)"` CreatineTime time.Time `json:"creatine_time" gorm:"type:datetime; COMMENT:'肌酐检测时间'" description:"肌酐检测时间"` UrineProtein24hUnit string `json:"urine_protein_24h_unit" gorm:"column:urine_protein_24h_unit; type:varchar(32); COMMENT:'24小时尿蛋白单位(g/24h,mg/24h)'" description:"24小时尿蛋白单位(g/24h,mg/24h)"` UrineProtein24h int `json:"urine_protein_24h" gorm:"column:urine_protein_24h;type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'24小时尿蛋白'" description:"24小时尿蛋白"` UrineProtein24hTime time.Time `json:"urine_protein_24h_time" gorm:"column:urine_protein_24h_time;type:datetime; COMMENT:'24小时尿蛋白检测时间'" description:"24小时尿蛋白检测时间"` UrineProtein int `json:"urine_protein" gorm:"type:int(11); NOT NULL; DEFAULT:'0'; COMMENT:'尿蛋白'" description:"尿蛋白"` UrineProteinUnit string `json:"urine_protein_unit" gorm:"column:urine_protein_unit; type:varchar(32); COMMENT:'尿蛋白单位(g,mg)'" description:"尿蛋白单位(g,mg)"` UrineProteinTime time.Time `json:"urine_protein_time" gorm:"column:urine_protein_time;type:datetime; COMMENT:'尿蛋白检测时间'" description:"尿蛋白检测时间"` Status int `json:"status" gorm:"type:int(11); DEFAULT:'1'; COMMENT:'状态(1:有效 0:无效 )'" description:"状态(1:有效 0:无效 )"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '" description:"更新时间 "` } func (UserHealthProfile) TableName() string { return "user_health_profile" } //小程序用户表(个人中心) type XcxUser struct { Id uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment; NOT NULL; primary_key; COMMENT:'Primary Key ID'" description:"Primary Key ID"` Phone string `json:"phone" gorm:"type:varchar(32); COMMENT:'手机号码'" description:"手机号码"` Email string `json:"email" gorm:"type:varchar(255); COMMENT:'邮件'" description:"邮件"` OpenId string `json:"open_id" gorm:"type:varchar(255); COMMENT:'OpenID'" description:"OpenID"` UnionId string `json:"union_id" gorm:"type:varchar(255); COMMENT:'unionid'" description:"unionid"` NickName string `json:"nick_name" gorm:"type:varchar(64); COMMENT:'昵称'" description:"昵称"` Avatar string `json:"avatar" gorm:"type:varchar(255); COMMENT:'头像'" description:"头像"` Status int `json:"status" gorm:"type:int(11); DEFAULT:'1'; COMMENT:'状态(1:有效 0: 无效)'" description:"状态(1:有效 0: 无效)"` RoleType int `json:"role_type" gorm:"type:int(2); COMMENT:'角色类型 0或空:普通 1:管理员 2:测试'" description:"角色类型 0或空:普通 1:管理员 2:测试"` Source string `json:"source" gorm:"type:varchar(255); COMMENT:'用户来源'" description:"用户来源"` PrivacyProtocolVersions int `json:"privacy_protocol_versions" gorm:"type:int(2); COMMENT:'隐私政策版本'" description:"隐私政策版本"` Ctime time.Time `json:"ctime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP; COMMENT:'创建时间'" description:"创建时间"` Mtime time.Time `json:"mtime" gorm:"type:datetime; DEFAULT: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; COMMENT:'更新时间 '" description:"更新时间 "` SessionKey string `json:"session_key" gorm:"-"` } func (XcxUser) TableName() string { return "xcx_user" }