|
|
package protocol
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
/*机会-自查内容*/
|
|
|
|
|
|
//自查结果列表
|
|
|
type SelfCheckResults []selfCheckResult
|
|
|
type selfCheckResult struct {
|
|
|
CheckItem string `json:"checkItem"`
|
|
|
Total int `json:"total"`
|
|
|
}
|
|
|
|
|
|
//自查项列表
|
|
|
type SelfChecks []SelfCheck
|
|
|
type SelfCheck struct {
|
|
|
Id int64 `json:"id"`
|
|
|
CheckItem string `json:"checkItem"`
|
|
|
Answer string `json:"answer,omitempty"`
|
|
|
Reason string `json:"reason,omitempty"`
|
|
|
Group int `json:"group"` //分组
|
|
|
}
|
|
|
|
|
|
//统计自查结果
|
|
|
func (s SelfChecks) Static() SelfCheckResults {
|
|
|
results := []selfCheckResult{{CheckItem: "是"}, {CheckItem: "否"}, {CheckItem: "不清楚"}}
|
|
|
for i := range s {
|
|
|
check := (s)[i]
|
|
|
for k := range results {
|
|
|
if strings.EqualFold(results[k].CheckItem, check.CheckItem) {
|
|
|
results[k].Total = results[k].Total + 1
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return SelfCheckResults(results)
|
|
|
} |
...
|
...
|
|