Commit 3f14b70dbfc344bec08a5754d5faefbe05165927

Authored by changpengfei
1 parent c7cb1e2007
Exists in master

热门搜索 统计

Showing 2 changed files with 5 additions and 3 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/IndexMapper.java View file @ 3f14b70
... ... @@ -42,7 +42,7 @@
42 42 @Select("select count(1) cnt from lyms_tkrecord tk where stat=1 ")
43 43 public Map<String,Object> getSumTkCntFs();
44 44  
45   - @Select("SELECT searchtxt,COUNT(1) cnt FROM lyms_searchlogs s GROUP BY searchtxt ORDER BY cnt DESC ")
  45 + @Select("SELECT searchtxt,COUNT(1) cnt FROM lyms_searchlogs s GROUP BY searchtxt ORDER BY cnt DESC LIMIT 5")
46 46 List<Map<String,Object>> getSearch();
47 47  
48 48 @Select("SELECT COUNT(1) cnt FROM lyms_searchlogs s ")
... ... @@ -51,5 +51,8 @@
51 51 // 科室类别占比
52 52 @Select("SELECT hd.`dname`,COUNT(1) cnt FROM lyms_tkrecord tk,lyms_doctor d,lyms_hdepart hd WHERE tk.`did`=d.`did` AND d.`dpid`=hd.`did` GROUP BY hd.`dname`")
53 53 List<Map<String,Object>> getDepart();
  54 +
  55 + @Select("SELECT DATE(s.`createdtime`) dt,COUNT(1) cnt FROM lyms_searchlogs s GROUP BY DATE(s.`createdtime`) ORDER BY cnt DESC LIMIT 7")
  56 + List<Map<String,Object>> getSearchByDay();
54 57 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/IndexServiceImpl.java View file @ 3f14b70
... ... @@ -34,14 +34,13 @@
34 34  
35 35 // 热门搜索
36 36 rs.put("serch",indexMapper.getSearch());
  37 + rs.put("serchByDay",indexMapper.getSearchByDay());
37 38 rs.put("serchSum",indexMapper.getSearchSum());
38 39  
39 40 // 科室类别占比
40 41 List<Map<String,Object>> dLst=indexMapper.getDepart();
41 42 rs.put("depart",dLst);
42 43 rs.put("departCnt",dLst.stream().mapToInt(m-> Math.toIntExact((long) m.get("cnt"))).sum());
43   -
44   -
45 44  
46 45 return rs;
47 46 }