|
@@ -49,8 +49,8 @@ type selfCheckResult struct { |
|
@@ -49,8 +49,8 @@ type selfCheckResult struct { |
49
|
type SelfCheck struct {
|
49
|
type SelfCheck struct {
|
50
|
CheckItem string `json:"checkItem"`
|
50
|
CheckItem string `json:"checkItem"`
|
51
|
GroupId int64 `json:"groupId"` //分组
|
51
|
GroupId int64 `json:"groupId"` //分组
|
52
|
- Answer string `json:"answer,omitempty"`
|
|
|
53
|
- Reason string `json:"reason,omitempty"`
|
52
|
+ Answer string `json:"answer"`
|
|
|
53
|
+ Reason string `json:"reason"`
|
54
|
|
54
|
|
55
|
Id int64 `json:"id"`
|
55
|
Id int64 `json:"id"`
|
56
|
ParentId int64 `json:"parentId"`
|
56
|
ParentId int64 `json:"parentId"`
|
|
@@ -234,15 +234,29 @@ func (s SelfChecks) SetSelfChecksLevel1ByRule() (err error) { |
|
@@ -234,15 +234,29 @@ func (s SelfChecks) SetSelfChecksLevel1ByRule() (err error) { |
234
|
}
|
234
|
}
|
235
|
|
235
|
|
236
|
//格式化数据结构
|
236
|
//格式化数据结构
|
237
|
-func (s SelfChecks) Format() {
|
237
|
+func (s SelfChecks) Format() SelfChecks {
|
238
|
if len(s) == 0 {
|
238
|
if len(s) == 0 {
|
239
|
- return
|
239
|
+ return s
|
240
|
}
|
240
|
}
|
241
|
for i := range s {
|
241
|
for i := range s {
|
242
|
if strings.TrimSpace(s[i].Answer) == OptionNo {
|
242
|
if strings.TrimSpace(s[i].Answer) == OptionNo {
|
243
|
s[i].Reason = strings.TrimSpace(s[i].Reason)
|
243
|
s[i].Reason = strings.TrimSpace(s[i].Reason)
|
244
|
}
|
244
|
}
|
245
|
}
|
245
|
}
|
|
|
246
|
+ return s
|
|
|
247
|
+}
|
|
|
248
|
+
|
|
|
249
|
+//格式化数据结构
|
|
|
250
|
+func (s SelfChecks) ClearEmpty() (rsp SelfChecks) {
|
|
|
251
|
+ if len(s) == 0 {
|
|
|
252
|
+ return
|
|
|
253
|
+ }
|
|
|
254
|
+ for i := range s {
|
|
|
255
|
+ if len(s[i].Answer) > 0 {
|
|
|
256
|
+ rsp = append(rsp, s[i])
|
|
|
257
|
+ }
|
|
|
258
|
+ }
|
|
|
259
|
+ return
|
246
|
}
|
260
|
}
|
247
|
|
261
|
|
248
|
//新建自查问题
|
262
|
//新建自查问题
|