作者 tangxvhui

微调

... ... @@ -116,8 +116,8 @@ type ChanceSelfCheckData struct {
CheckItem string `json:"checkItem"`
GroupId int64 `json:"groupId"`
Answer string `json::"answer"`
Id int `json:"id"`
ParentId int `json:"parentId"`
Id int64 `json:"id"`
ParentId int64 `json:"parentId"`
}
func (m *Chance) GetSelfCheckData() []ChanceSelfCheckData {
... ...
... ... @@ -318,21 +318,23 @@ func collectChanceCheckResultData(checkResultData []models.ChanceCheckResult) []
}
}
//构建层级关系
// for i := range checkReusltSlice {
// if checkReusltSlice[i].CheckPid == 0 {
// continue
// }
// pid := checkReusltSlice[i].CheckPid
// if _, ok := checkResultMap[pid]; ok {
// checkResultMap[pid].Child = append(checkResultMap[pid].Child, checkReusltSlice[i])
// }
// }
for i := range checkReusltSlice {
if checkReusltSlice[i].CheckPid == 0 {
continue
}
pid := checkReusltSlice[i].CheckPid
if _, ok := checkResultMap[pid]; ok {
checkResultMap[pid].Child = append(checkResultMap[pid].Child, checkReusltSlice[i])
}
}
var selfCheckData []models.ChanceSelfCheckData
for i := range checkReusltSlice {
if checkReusltSlice[i].CheckPid > 0 {
continue
}
dd := models.ChanceSelfCheckData{
Id: checkReusltSlice[i].CheckId,
ParentId: checkReusltSlice[i].CheckPid,
CheckItem: checkReusltSlice[i].CheckItem,
GroupId: checkReusltSlice[i].GroupId,
}
... ... @@ -346,22 +348,24 @@ func collectChanceCheckResultData(checkResultData []models.ChanceCheckResult) []
dd.Answer = "不清楚"
}
selfCheckData = append(selfCheckData, dd)
// for _, childdata := range checkReusltSlice[i].Child {
// dd := models.ChanceSelfCheckData{
// CheckItem: childdata.CheckItem,
// GroupId: childdata.GroupId,
// }
// if childdata.AnswerNo > 0 {
// dd.Answer = "否"
// }
// if childdata.AnswerYes > 0 && childdata.AnswerNo == 0 && childdata.AnswerAny == 0 {
// dd.Answer = "是"
// }
// if childdata.AnswerNo == 0 && childdata.AnswerAny > 0 {
// dd.Answer = "不清楚"
// }
// selfCheckData = append(selfCheckData, dd)
// }
for _, childdata := range checkReusltSlice[i].Child {
dd := models.ChanceSelfCheckData{
Id: childdata.CheckId,
ParentId: childdata.CheckPid,
CheckItem: childdata.CheckItem,
GroupId: childdata.GroupId,
}
if childdata.AnswerNo > 0 {
dd.Answer = "否"
}
if childdata.AnswerYes > 0 && childdata.AnswerNo == 0 && childdata.AnswerAny == 0 {
dd.Answer = "是"
}
if childdata.AnswerNo == 0 && childdata.AnswerAny > 0 {
dd.Answer = "不清楚"
}
selfCheckData = append(selfCheckData, dd)
}
}
return selfCheckData
}
... ...