refactor: adjust project structure

This commit is contained in:
2024-11-14 01:15:55 +08:00
parent c219d81b89
commit 70d7229dd8
20 changed files with 320 additions and 132 deletions

11
model/hospital.go Normal file
View File

@ -0,0 +1,11 @@
package model
type Hospital struct {
HospitalID int `gorm:"column:hospital_id" json:"hospital_id" binding:"required"`
HospitalName string `gorm:"column:hospital_name" json:"hospital_name" binding:"required"`
Address string `gorm:"column:address" json:"address" binding:"required"`
}
func (Hospital) TableName() string {
return "hospital"
}

55
model/record.go Normal file
View File

@ -0,0 +1,55 @@
package model
import "time"
type Check struct {
CheckID int `gorm:"column:check_id"`
UserID int `gorm:"column:user_id"`
CheckDate time.Time `gorm:"column:check_date"`
Hospital int `gorm:"column:check_hospital"`
InsertTime time.Time `gorm:"column:insert_time"`
UpdateTime time.Time `gorm:"column:update_time"`
}
func (Check) TableName() string {
return "checks"
}
type CheckItem struct {
CheckItemID int `gorm:"column:check_item_id"`
CheckID int `gorm:"column:check_id"`
ItemID int `gorm:"column:item_id"`
ItemValue float32 `gorm:"column:item_value"`
}
func (CheckItem) TableName() string {
return "check_items"
}
type Item struct {
ItemID int `gorm:"column:item_id"`
ItemName string `gorm:"column:item_name"`
ItemNormalMin string `gorm:"column:item_normal_min"`
ItemNormalMax string `gorm:"column:item_normal_max"`
}
func (Item) TableName() string {
return "items"
}
type UserInput struct {
Date string `json:"date"`
Hospital int `json:"checkHospital"`
Ca125 float32 `json:"ca125Value"`
Ca199 float32 `json:"ca199Value"`
Cea float32 `json:"ceaValue"`
Ca153 float32 `json:"ca153Value"`
Ca724 float32 `json:"ca724Value"`
He4 float32 `json:"he4Value"`
Rbc float32 `json:"rbcValue"`
Hb float32 `json:"hbValue"`
Wbc float32 `json:"wbcValue"`
Plt float32 `json:"pltValue"`
Neut float32 `json:"neutValue"`
Weight float32 `json:"weightValue"`
}

17
model/user.go Normal file
View File

@ -0,0 +1,17 @@
package model
import "time"
type User struct {
UserID int `gorm:"column:user_id"`
UserName string `gorm:"column:user_name"`
Password string `gorm:"column:password"`
Birth time.Time `gorm:"column:birth"`
Height float32 `gorm:"column:height"`
Tel string `gorm:"column:tel" json:"tel"`
SMSTry int `gorm:"column:SMS_try"`
}
func (User) TableName() string {
return "user"
}