package models

type Role struct {
	Id           int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	RoleName     string `gorm:"column:role_name" json:"name"`
	RoleIntro    string `gorm:"column:role_introduction" json:"intro"`
	Creator      int64  `json:"-"`
	OrgId        int64  `gorm:"column:org_id" json:"-"`
	AppId        int64  `gorm:"column:app_id" json:"-"`
	IsSuperAdmin bool   `gorm:"column:is_super_admin" json:"is_super_admin"`
	Status       int8   `json:"status"`                // 状态 0.无效 1.有效 2.禁用
	CreateTime   int64  `gorm:"column:ctime" json:"-"` // 创建时间
	ModifyTime   int64  `gorm:"column:mtime" json:"-"` // 修改时间
	StaffNumber  int64  `gorm:"-" json:"staff_number"`
	Number       int64  `gorm:"number" json:"number"`
	IsSystem     int64  `gorm:"column:is_system" json:"is_system" form:"is_system"`
}

func (Role) TableName() string {
	return "sgj_user_role"
}

type App_Roles struct {
	Id          int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id"`
	OrgId       int64  `gorm:"column:org_id" json:"org_id"`
	AppId       int64  `gorm:"column:app_id" json:"app_id"`
	RoleId      int64  `gorm:"column:role_id" json:"role_id"`
	Avatar      string `json:"avatar" json:"avatar"`
	UserName    string `gorm:"column:user_name" json:"user_name"`   // 用户名称
	Intro       string `json:"intro"`                               // 简介
	UserType    int8   `gorm:"column:user_type" json:"user_type"`   // 用户类型(1.管理员;2.医生;3.护士;4.运营)
	UserTitle   int8   `gorm:"column:user_title" json:"user_title"` // 用户职称(1.医士;2.医师;3.住院医师;4.主治医师;5.副主任医师;6.主任医师;7.护士;8.护师;9.主管护师;10.副主任护师;11.主任护师;12.运营专员;13.运营主管)
	Status      int8   `json:"status"`                              // 状态 0.无效 1.有效
	CreateTime  int64  `gorm:"column:ctime" json:"ctime"`           // 创建时间
	ModifyTime  int64  `gorm:"column:mtime" json:"mtime"`           // 修改时间
	Url         string `gorm:"column:url" json:"url" form:"url"`
}

type App_Role struct {
	Id            int64     `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	AdminUserId   int64     `gorm:"column:admin_user_id" json:"admin_user_id"`
	OrgId         int64     `gorm:"column:org_id" json:"org_id"`
	AppId         int64     `gorm:"column:app_id" json:"app_id"`
	RoleId        int64     `gorm:"column:role_id" json:"role_id"`
	Avatar        string    `json:"avatar" json:"avatar"`
	UserName      string    `gorm:"column:user_name" json:"user_name"`   // 用户名称
	Intro         string    `json:"intro"`                               // 简介
	UserType      int8      `gorm:"column:user_type" json:"user_type"`   // 用户类型(1.管理员;2.医生;3.护士;4.运营)
	UserTitle     int8      `gorm:"column:user_title" json:"user_title"` // 用户职称(1.医士;2.医师;3.住院医师;4.主治医师;5.副主任医师;6.主任医师;7.护士;8.护师;9.主管护师;10.副主任护师;11.主任护师;12.运营专员;13.运营主管)
	Status        int8      `json:"status"`                              // 状态 0.无效 1.有效
	CreateTime    int64     `gorm:"column:ctime" json:"ctime"`           // 创建时间
	ModifyTime    int64     `gorm:"column:mtime" json:"mtime"`           // 修改时间UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
	UserTitleName string    `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
	RoleIds       string    `gorm:"column:role_ids" json:"role_ids" form:"role_ids"`
	AdminUser     AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:AdminUserId" json:"admin"`
	//AdminUser     AdminUser `gorm:"ForeignKey:ID;AssociationForeignKey:AdminUserId" json:"admin"`
	IsSubSuperAdmin bool   `gorm:"-" json:"is_sub_super_admin" form:"is_sub_super_admin"`
	Message         string `gorm:"column:message" json:"message" form:"message"`
	Sex             int64  `gorm:"column:sex" json:"sex" form:"sex"`
	Birthday        int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
	Sort            int64  `gorm:"column:sort" json:"sort" form:"sort"`
	IsSort          int64  `gorm:"column:is_sort" json:"is_sort" form:"is_sort"`
	DepartmentId    int64  `gorm:"column:department_id" json:"department_id" form:"department_id"`
	Department      string `gorm:"column:department" json:"department" form:"department"`
}

func (App_Role) TableName() string {
	return "sgj_user_admin_role"
}

var UserType = map[int]string{
	1: "管理员",
	2: "医生",
	3: "护士",
	4: "运营",
}

var UserTitle = map[int]string{
	1:  "医士",
	2:  "医师",
	3:  "住院医师",
	4:  "主治医师",
	5:  "副主任医师",
	6:  "主任医师",
	7:  "护士",
	8:  "护师",
	9:  "主管护师",
	10: "副主任护师",
	11: "主任护师",
	12: "运营专员",
	13: "运营主管",
}

type SgjUserRoleFuncPurview struct {
	ID         int64  `gorm:"column:id" json:"id" form:"id"`
	OrgId      int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
	AppId      int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
	RoleId     int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
	PurviewIds string `gorm:"column:purview_ids" json:"purview_ids" form:"purview_ids"`
	Status     int64  `gorm:"column:status" json:"status" form:"status"`
	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (SgjUserRoleFuncPurview) TableName() string {
	return "sgj_user_role_func_purview"
}

type Roles struct {
	Id           int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"`
	RoleName     string `gorm:"column:role_name" json:"role_name"`
	RoleIntro    string `gorm:"column:role_introduction" json:"intro"`
	Creator      int64  `json:"-"`
	OrgId        int64  `gorm:"column:org_id" json:"-"`
	AppId        int64  `gorm:"column:app_id" json:"-"`
	IsSuperAdmin bool   `gorm:"column:is_super_admin" json:"is_super_admin"`
	Status       int8   `json:"status"`                // 状态 0.无效 1.有效 2.禁用
	CreateTime   int64  `gorm:"column:ctime" json:"-"` // 创建时间
	ModifyTime   int64  `gorm:"column:mtime" json:"-"` // 修改时间
	StaffNumber  int64  `gorm:"-" json:"staff_number"`
	Number       int64  `gorm:"column:number" json:"number" form:"number"`
	IsSystem     int64  `gorm:"column:is_system" json:"is_system" form:"is_system"`
}

func (Roles) TableName() string {
	return "sgj_user_role"
}