health

package
v0.0.0-...-23f3ce9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MianHost
	MianHost = "hmgr.sec.lit.edu.cn"
	// MianUrl 主网址
	MianUrl = "http://" + MianHost + "/wms"
	// MuyunUrl 木云反代
	MuyunUrl = MianUrl + "/web/"
	// LoginUrl 登录接口
	LoginUrl = MianUrl + "/healthyLogin"
	// GetTokenUrl 获取 Token
	GetTokenUrl = MianUrl + "/getToken"
	// SecLoginUrl 门户统一登录接口
	SecLoginUrl = "http://ids.lit.edu.cn/authserver/login?service=" + GetTokenUrl
	// LastRecordUrl 获取上次记录
	LastRecordUrl = MianUrl + "/lastHealthyRecord"
	// FirstRecordUrl 第一次上报
	FirstRecordUrl = MianUrl + "/addHealthyRecord"
	// SecondRecordUrl 第二次上报
	SecondRecordUrl = MianUrl + "/addTwoHealthyRecord"
	// ThirdRecordUrl 第三次上报
	ThirdRecordUrl = MianUrl + "/addThreeHealthyRecord"
	// HealthyReportCount 上报统计
	HealthyReportCountUrl = MianUrl + "/healthyReportCount"
	// MainHeaders 主请求头
	MainHeaders = map[string]string{
		"Proxy-Connection": "keep-alive",
		"Accept":           "application/json, text/plain, */*",
		"DNT":              "1",
		"User-Agent":       "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36",
		"Content-Type":     "application/json;charset=UTF-8;Access-Control-Allow-Headers",
		"Origin":           MianUrl,
		"Referer":          MuyunUrl,
		"Accept-Language":  "zh-CN,zh;q=0.9",
	}

	// IdentityNameList 身份
	IdentityNameList = map[string]int{
		"student": 1000401,
		"teacher": 1000402,
		"other":   1000405,
	}

	// IdentityCodeList 身份
	IdentityList = map[int]string{
		1000401: "student",
		1000402: "teacher",
		1000405: "other",
	}

	// TimeLayout 时间格式
	TimeLayout = "2006-01-02 15:04:05"
	// TimeLayoutLite 时间格式
	TimeLayoutLite = "2006-01-02"
)

Functions

func GenRandomSafeTemp

func GenRandomSafeTemp() float64

GenRandomSafeTemp 随机生成安全体温

func IsReportedTodayByRaw

func IsReportedTodayByRaw(lastRecord LastRecord, rtime uint) (isReported bool, err error)

IsReportedTodayByRaw 今日是否上报 rtime: 次数 [0,1,2,3] 0: 为三次是否全上报 1: 第一次 2: 第二次 3: 第三次

Types

type ExtraRecordParam

type ExtraRecordParam struct {
	HealthyRecordID   int64  `json:"healthyRecordId"`
	Temperature       string `json:"temperature"`
	TemperatureNormal int64  `json:"temperatureNormal"`
}

ExtraRecordParam 补充上报参数 (第二, 三次)

type FirstRecordParam

type FirstRecordParam struct {
	AbroadInfo               string      `json:"abroadInfo"`
	CaseAddress              interface{} `json:"caseAddress"`
	ContactAddress           string      `json:"contactAddress"`
	ContactCity              string      `json:"contactCity"`
	ContactDistrict          string      `json:"contactDistrict"`
	ContactLocation          string      `json:"contactLocation"`
	ContactPatient           string      `json:"contactPatient"`
	ContactProvince          string      `json:"contactProvince"`
	ContactTime              interface{} `json:"contactTime"`
	CureTime                 interface{} `json:"cureTime"`
	CurrentAddress           string      `json:"currentAddress"`
	CurrentCity              string      `json:"currentCity"`
	CurrentDistrict          string      `json:"currentDistrict"`
	CurrentLocation          string      `json:"currentLocation"`
	CurrentProvince          string      `json:"currentProvince"`
	CurrentStatus            string      `json:"currentStatus"`
	DiagnosisTime            interface{} `json:"diagnosisTime"`
	ExceptionalCase          int64       `json:"exceptionalCase"`
	ExceptionalCaseInfo      string      `json:"exceptionalCaseInfo"`
	FriendHealthy            int64       `json:"friendHealthy"`
	GoHuBeiCity              string      `json:"goHuBeiCity"`
	GoHuBeiTime              interface{} `json:"goHuBeiTime"`
	HealthyStatus            int64       `json:"healthyStatus"`
	IsAbroad                 int64       `json:"isAbroad"`
	IsInTeamCity             int64       `json:"isInTeamCity"`
	IsTrip                   int64       `json:"isTrip"`
	Isolation                int64       `json:"isolation"`
	LocalAddress             string      `json:"localAddress"`
	Mobile                   string      `json:"mobile"`
	NativePlaceAddress       string      `json:"nativePlaceAddress"`
	NativePlaceCity          string      `json:"nativePlaceCity"`
	NativePlaceDistrict      string      `json:"nativePlaceDistrict"`
	NativePlaceProvince      string      `json:"nativePlaceProvince"`
	PeerAddress              interface{} `json:"peerAddress"`
	PeerIsCase               int64       `json:"peerIsCase"`
	ReportDate               string      `json:"reportDate"`
	SeekMedical              int64       `json:"seekMedical"`
	SeekMedicalInfo          string      `json:"seekMedicalInfo"`
	SelfHealthy              int64       `json:"selfHealthy"`
	SelfHealthyInfo          string      `json:"selfHealthyInfo"`
	SelfHealthyTime          interface{} `json:"selfHealthyTime"`
	TeamID                   int64       `json:"teamId"`
	Temperature              string      `json:"temperature"`
	TemperatureNormal        int64       `json:"temperatureNormal"`
	TemperatureThree         string      `json:"temperatureThree"`
	TemperatureTwo           string      `json:"temperatureTwo"`
	TravelPatient            string      `json:"travelPatient"`
	TreatmentHospitalAddress string      `json:"treatmentHospitalAddress"`
	UserID                   int64       `json:"userId"`
	VillageIsCase            int64       `json:"villageIsCase"`
}

FirstRecordParam 首次上报参数结构

type HealthUser

type HealthUser struct {
	Username    string
	Password    string
	SecPassword string
	UserInfo    UserInfo
	Client      *resty.Client // 测试用
}

HealthUser 健康平台用户结构体

func NewHealthUser

func NewHealthUser() *HealthUser

NewHealthUser 新建健康平台用户

func (*HealthUser) FirstReport

func (u *HealthUser) FirstReport(firstTemp float64, secondTemp float64, thirdTemp float64) (err error)

FirstReport 进行今日第一次上报

func (*HealthUser) FirstReportByRaw

func (u *HealthUser) FirstReportByRaw(param FirstRecordParam) (err error)

FirstReportByRaw 使用原始参数进行今日第一次上报

func (*HealthUser) GetHealthyReportCount

func (u *HealthUser) GetHealthyReportCount(identity string, orgIDs []uint, createTime string) (healthyReportCount HealthyReportCount, err error)

GetHealthyReportCount 获取上报统计 identity 身份 (student, teacher, other) 如果为空字符串则为全部 , orgIDs 部门列表, createTime 时间 2021-10-27

func (*HealthUser) GetLastRecord

func (u *HealthUser) GetLastRecord() (lastRecord LastRecord, err error)

GetLastRecord 获取上次上报记录

func (*HealthUser) GetToken

func (u *HealthUser) GetToken() (ret UserInfo, err error)

GetToken 根据 Cookies 获取Token信息

func (*HealthUser) IsLogged

func (u *HealthUser) IsLogged() bool

IsLogged 判断是否登录

func (*HealthUser) IsReportedToday

func (u *HealthUser) IsReportedToday(rtime uint) (isReported bool, err error)

IsReportedToday 今日是否上报 rtime: 次数 [0,1,2,3] 0: 为三次是否全上报 1: 第一次 2: 第二次 3: 第三次

func (*HealthUser) Login

func (u *HealthUser) Login() (err error)

Login 登录健康平台

func (*HealthUser) LoginWithSec

func (u *HealthUser) LoginWithSec() (err error)

LoginWithSec 健康平台使用统一登陆

func (*HealthUser) PerSetCooikes

func (u *HealthUser) PerSetCooikes() (err error)

PerSetCooikes 访问一下反代页面

func (*HealthUser) SecondReport

func (u *HealthUser) SecondReport(temp float64) (err error)

SecondReport 进行今日第二次上报

func (*HealthUser) SecondReportByRaw

func (u *HealthUser) SecondReportByRaw(param ExtraRecordParam) (err error)

SecondReportByRaw 使用原始参数进行今日第二次上报

func (*HealthUser) SetPassword

func (u *HealthUser) SetPassword(password string) *HealthUser

SetPassword 设置密码

func (*HealthUser) SetSecPassword

func (u *HealthUser) SetSecPassword(secPassword string) *HealthUser

SetSecPassword 设置门户密码

func (*HealthUser) SetUsername

func (u *HealthUser) SetUsername(username string) *HealthUser

SetPassword 设置用户名

func (*HealthUser) ThirdReport

func (u *HealthUser) ThirdReport(temp float64) (err error)

ThirdReport 进行今日第三次上报

func (*HealthUser) ThirdReportByRaw

func (u *HealthUser) ThirdReportByRaw(param ExtraRecordParam) (err error)

ThirdReportByRaw 使用原始参数进行今日第三次上报

type HealthyReportCount

type HealthyReportCount struct {
	NotReported int64 `json:"notReported"`
	RecordTotal int64 `json:"recordTotal"`
	Reported    int64 `json:"reported"`
}

HealthyReportCount 上报统计结构

type LastRecord

type LastRecord struct {
	AbroadInfo               string      `json:"abroadInfo"`
	CaseAddress              interface{} `json:"caseAddress"`
	ContactAddress           string      `json:"contactAddress"`
	ContactCity              string      `json:"contactCity"`
	ContactDistrict          string      `json:"contactDistrict"`
	ContactPatient           string      `json:"contactPatient"`
	ContactProvince          string      `json:"contactProvince"`
	ContactTime              interface{} `json:"contactTime"`
	CreateTime               string      `json:"createTime"`
	CureTime                 interface{} `json:"cureTime"`
	CurrentAddress           string      `json:"currentAddress"`
	CurrentCity              string      `json:"currentCity"`
	CurrentDistrict          string      `json:"currentDistrict"`
	CurrentProvince          string      `json:"currentProvince"`
	CurrentStatus            string      `json:"currentStatus"`
	DiagnosisTime            interface{} `json:"diagnosisTime"`
	ExceptionalCase          int64       `json:"exceptionalCase"`
	ExceptionalCaseInfo      string      `json:"exceptionalCaseInfo"`
	FriendHealthy            int64       `json:"friendHealthy"`
	GoHuBeiCity              string      `json:"goHuBeiCity"`
	GoHuBeiTime              interface{} `json:"goHuBeiTime"`
	HealthyStatus            int64       `json:"healthyStatus"`
	ID                       int64       `json:"id"`
	IsAbroad                 int64       `json:"isAbroad"`
	IsInTeamCity             int64       `json:"isInTeamCity"`
	Isolation                int64       `json:"isolation"`
	PeerAddress              interface{} `json:"peerAddress"`
	PeerIsCase               int64       `json:"peerIsCase"`
	ReportDate               string      `json:"reportDate"`
	SeekMedical              int64       `json:"seekMedical"`
	SeekMedicalInfo          string      `json:"seekMedicalInfo"`
	SelfHealthy              int64       `json:"selfHealthy"`
	SelfHealthyInfo          string      `json:"selfHealthyInfo"`
	SelfHealthyTime          interface{} `json:"selfHealthyTime"`
	TeamID                   int64       `json:"teamId"`
	Temperature              string      `json:"temperature"`
	TemperatureNormal        int64       `json:"temperatureNormal"`
	TemperatureThree         string      `json:"temperatureThree"`
	TemperatureTwo           string      `json:"temperatureTwo"`
	TravelPatient            string      `json:"travelPatient"`
	TreatmentHospitalAddress string      `json:"treatmentHospitalAddress"`
	UserID                   int64       `json:"userId"`
	VillageIsCase            int64       `json:"villageIsCase"`
}

LastRecord 上次上报结构

type LoginParam

type LoginParam struct {
	CardNo   string `json:"cardNo"`
	Password string `json:"password"`
}

LoginParam 登陆参数

type Result

type Result struct {
	Success bool        `json:"success"`
	Code    int64       `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
}

Result 响应结果

type UserInfo

type UserInfo struct {
	Age                    int64       `json:"age"`
	CardNo                 interface{} `json:"cardNo"`
	ExpireTime             string      `json:"expireTime"`
	Identity               int64       `json:"identity"`
	IsAdmin                int64       `json:"isAdmin"`
	IsApprover             interface{} `json:"isApprover"`
	IsGeneralAdmin         int64       `json:"isGeneralAdmin"`
	IsReportAdmin          int64       `json:"isReportAdmin"`
	IsReturnSchoolApprover int64       `json:"isReturnSchoolApprover"`
	IsTwoTemperature       int64       `json:"isTwoTemperature"`
	LastUpdateTime         string      `json:"lastUpdateTime"`
	LocalAddress           string      `json:"localAddress"`
	LogoURL                string      `json:"logoUrl"`
	Mobile                 string      `json:"mobile"`
	Name                   string      `json:"name"`
	NativePlaceAddress     string      `json:"nativePlaceAddress"`
	NativePlaceCity        string      `json:"nativePlaceCity"`
	NativePlaceDistrict    string      `json:"nativePlaceDistrict"`
	NativePlaceProvince    string      `json:"nativePlaceProvince"`
	OrganizationName       string      `json:"organizationName"`
	Sex                    int64       `json:"sex"`
	TeamCity               string      `json:"teamCity"`
	TeamID                 int64       `json:"teamId"`
	TeamName               string      `json:"teamName"`
	TeamNo                 string      `json:"teamNo"`
	TeamProvince           string      `json:"teamProvince"`
	Token                  string      `json:"token"`
	UserID                 int64       `json:"userId"`
	UserOrganizationID     int64       `json:"userOrganizationId"`
}

UserInfo 用户信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL