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

View File

@ -11,9 +11,10 @@ type RavenIQTestQuestion struct {
}
type IQResult struct {
IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id
Percentile int64 `json:"percentile"` // 百分位
Description string `json:"description"` // 描述
IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id
Percentile int64 `json:"percentile"` // 百分位
Description string `json:"description"` // 描述
Suggestions []string `json:"suggestions"` // 建议
}
type AgeScore2IQResultMapCfg struct {
@ -31,8 +32,20 @@ type IQResultMapCfg struct {
}
type ClassResult struct {
ClassId int64 `json:"class_id"` // 大类id
Description string `json:"description"` // 描述
ClassId int64 `json:"class_id"` // 大类id
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 {

View File

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