作者 tangxvhui

bug 修复

... ... @@ -283,7 +283,7 @@ type chanceCheckResultTotal struct {
Child []*chanceCheckResultTotal
}
//collectChanceCheckResultData 汇总机会自查内容筛选结果
//collectChanceCheckResultData 汇总机会自查内容筛选结果(只要一级)
func collectChanceCheckResultData(checkResultData []models.ChanceCheckResult) []models.ChanceSelfCheckData {
checkResultMap := map[int64]*chanceCheckResultTotal{}
checkReusltSlice := []*chanceCheckResultTotal{}
... ... @@ -318,15 +318,15 @@ 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 {
... ... @@ -346,22 +346,22 @@ 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{
// 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
}
... ...