This commit is contained in:
Leufolium 2024-07-22 13:45:57 +08:00
parent b283c34f44
commit 62efdad5c0
3 changed files with 37 additions and 27 deletions

View File

@ -1,25 +1,23 @@
package proto package proto
import ( import (
"service/apollostruct"
"service/dbstruct" "service/dbstruct"
) )
type ApiListVO struct { type ApiListVO struct {
Id int64 `json:"id"` // 瑞文智商测试表id Id int64 `json:"id"` // 瑞文智商测试表id
UserId int64 `json:"user_id"` // 用户id UserId int64 `json:"user_id"` // 用户id
Age int64 `json:"age"` // 年龄 Age int64 `json:"age"` // 年龄
TotalScore float64 `json:"total_score"` // 总得分 TotalScore float64 `json:"total_score"` // 总得分
IQBlockId int64 `json:"IQ_block_id"` // 智商值 *apollostruct.IQResult
Percentile int64 `json:"percentile"` // 百分位 ClassScoreList []*ApiClassScoreVO `json:"class_score_list"` // 大类得分list
Description string `json:"description"` // 描述
ClassScoreList []*ApiClassSocreVO `json:"class_score_list"` // 大类得分list
} }
type ApiClassSocreVO struct { type ApiClassScoreVO struct {
ClassId int64 `json:"class_id"` // 大类id ClassBlockId int64 `json:"class_block_id"` // 大类得分key
Score int64 `json:"score"` // 得分 Score int64 `json:"score"` // 总分
ClassBlockId int64 `json:"class_block_id"` // 大类得分key *apollostruct.ClassResult
Suggestions string `json:"suggestions"` // 建议
} }
func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO { func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO {
@ -31,12 +29,14 @@ func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO {
vo.Age = test.GetAge() vo.Age = test.GetAge()
vo.TotalScore = test.GetTotalScore() vo.TotalScore = test.GetTotalScore()
vo.IQBlockId = test.GetIQBlockId() vo.IQBlockId = test.GetIQBlockId()
vo.ClassScoreList = make([]*ApiClassSocreVO, 0) vo.ClassScoreList = make([]*ApiClassScoreVO, 0)
for _, score := range test.ClassScoreList { for _, score := range test.ClassScoreList {
vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassSocreVO{ vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassScoreVO{
ClassId: score.GetClassId(),
Score: score.GetScore(),
ClassBlockId: score.GetClassBlockId(), ClassBlockId: score.GetClassBlockId(),
Score: score.GetScore(),
ClassResult: &apollostruct.ClassResult{
ClassId: score.GetClassId(),
},
}) })
} }
return vo return vo

View File

@ -11,9 +11,10 @@ type RavenIQTestQuestion struct {
} }
type IQResult struct { type IQResult struct {
IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id
Percentile int64 `json:"percentile"` // 百分位 Percentile int64 `json:"percentile"` // 百分位
Description string `json:"description"` // 描述 Description string `json:"description"` // 描述
Suggestions []string `json:"suggestions"` // 建议
} }
type AgeScore2IQResultMapCfg struct { type AgeScore2IQResultMapCfg struct {
@ -31,8 +32,20 @@ type IQResultMapCfg struct {
} }
type ClassResult struct { type ClassResult struct {
ClassId int64 `json:"class_id"` // 大类id ClassId int64 `json:"class_id"` // 大类id
Description string `json:"description"` // 描述 Description string `json:"description"` // 描述
Analysis string `json:"analysis"` // 成绩分析
Suggestions []*Suggestion `json:"suggestions"` // 建议
}
type Suggestion struct {
Title string `json:"title"`
Tips []*Tip `json:"tips"`
}
type Tip struct {
Summary string `json:"summary"` // 概括
Content string `json:"content"` // 内容
} }
type ClassResultMapCfg struct { type ClassResultMapCfg struct {

View File

@ -3696,13 +3696,10 @@ func (s *Service) ApiGetRavenIQTestList(ctx *gin.Context, req *Raven_IQ_testprot
return return
} }
IQResult := IQResultMpcfg.Map[vo.IQBlockId] vo.IQResult = IQResultMpcfg.Map[vo.IQBlockId]
vo.Percentile = IQResult.Percentile
vo.Description = IQResult.Description
for _, classScore := range vo.ClassScoreList { for _, classScore := range vo.ClassScoreList {
classResult := classResultMpCfg.Map[classScore.ClassBlockId] classScore.ClassResult = classResultMpCfg.Map[classScore.ClassBlockId]
classScore.Suggestions = classResult.Description
} }
return return