| | |
| | | |
| | | results := make([]*db.ModelTaskResults, 0) |
| | | var baseFilter, labelFilter, keyFilter, lastFilter []LocationPersonInfo |
| | | var document_number_map map[string]LocationPersonInfo |
| | | var document_number_map = make(map[string]LocationPersonInfo) |
| | | var document_number_list []string |
| | | err := db.GetDB().Raw(` |
| | | SELECT |
| | | p.id, |
| | | s.document_number, |
| | | -- s.community_id, |
| | | -- s.org_id, |
| | | -- p.person_name, |
| | | -- p.id_card, |
| | | s.last_appearance_time, |
| | | -- s.last_direction, |
| | | -- s.last_location |
| | | s.last_appearance_time |
| | | FROM |
| | | snapshot_count_summary AS s |
| | | JOIN person AS p ON p.id = s.document_number |
| | | WHERE |
| | | p.id_card != "" |
| | | AND (s.community_id IN ? |
| | | OR s.org_id IN ?) |
| | | AND (s.community_id IN ? OR s.org_id IN ?) |
| | | AND s.status IN ? |
| | | `, m.AreaIds, m.OrgIds, m.PersonIdentity).Scan(&baseFilter).Error |
| | | if err != nil { |
| | |
| | | for _, i := range baseFilter { |
| | | if _, ok := document_number_map[i.DocumentNumber]; !ok { |
| | | document_number_list = append(document_number_list, i.DocumentNumber) |
| | | tmp := i |
| | | document_number_map[i.DocumentNumber] = tmp |
| | | } |
| | | document_number_map[i.DocumentNumber] = i |
| | | } |
| | | if m.PersonLabel != "" { |
| | | labels := strings.Split(m.PersonLabel, ",") |