Commit f52b828f1d36bdc6cab0daf4583fa3d8429382dc

Authored by shiyang
1 parent 273d3891e1
Exists in master

首页-转化率统计

Showing 11 changed files with 159 additions and 11 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/IndexController.java View file @ f52b828
1 1 package com.lyms.talkonlineweb.controller;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
3 5 import com.lyms.talkonlineweb.domain.*;
4 6 import com.lyms.talkonlineweb.result.BaseResponse;
5 7 import com.lyms.talkonlineweb.service.IndexService;
  8 +import com.lyms.talkonlineweb.service.LymsHospitalService;
6 9 import com.lyms.talkonlineweb.service.TkRecordStatService;
7 10 import org.springframework.beans.factory.annotation.Autowired;
8 11 import org.springframework.web.bind.annotation.GetMapping;
9 12 import org.springframework.web.bind.annotation.RequestMapping;
10 13 import org.springframework.web.bind.annotation.RestController;
11 14  
  15 +import java.util.HashMap;
12 16 import java.util.List;
13 17 import java.util.Map;
14 18  
... ... @@ -22,6 +26,7 @@
22 26 @Autowired
23 27 private TkRecordStatService tkRecordStatService;
24 28  
  29 +
25 30 /**
26 31 * 访问统计
27 32 * @return
... ... @@ -105,6 +110,22 @@
105 110 BaseResponse baseResponse=new BaseResponse();
106 111 List<TkRecordStatRankingInfo> tkRecordStatRanking = tkRecordStatService.getTkRecordStatRanking();
107 112 baseResponse.setObject(tkRecordStatRanking);
  113 + return baseResponse;
  114 + }
  115 + /**
  116 + * 首页-转化率-按医院分时段筛选
  117 + * @param
  118 + * @return
  119 + */
  120 + @GetMapping("getLogsRecordVisitsInfo")
  121 + public BaseResponse getLogsRecordVisitsInfo(String startdate,String enddate,Integer hid){
  122 + BaseResponse baseResponse=new BaseResponse();
  123 + Map<String,Object>map=new HashMap<>();
  124 + List<LogsRecordVisitsInfo> listVisits = tkRecordStatService.getLogsRecordVisits(startdate,enddate);
  125 + List<LogsRecordVisitsInfo> listRecord = tkRecordStatService.getLogsRecordRecord(startdate,enddate,hid);
  126 + map.put("listVisits",listVisits);
  127 + map.put("listRecord",listRecord);
  128 + baseResponse.setObject(map);
108 129 return baseResponse;
109 130 }
110 131  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LogsRecordVisitsInfo.java View file @ f52b828
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import lombok.Data;
  7 +
  8 +import java.io.Serializable;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + *首页-转化率-按医院分时段筛选统计图
  13 + * @TableName logsRecord_Visits_info
  14 + */
  15 +@Data
  16 +@TableName(value ="logsRecord_Visits_info")
  17 +public class LogsRecordVisitsInfo implements Serializable {
  18 +
  19 + /**
  20 + * 筛选时间
  21 + */
  22 + @TableField(value = "ldate")
  23 + private String ldate;
  24 + /**
  25 + * 医院ID
  26 + */
  27 + @TableField(value = "hid")
  28 + private long hid;
  29 + /**
  30 + * 医院名称
  31 + */
  32 + @TableField(value = "hname")
  33 + private String hname;
  34 + /**
  35 + * 访问量
  36 + */
  37 + @TableField(value = "visits")
  38 + private long visits;
  39 + /**
  40 + * 问诊量
  41 + */
  42 + @TableField(value = "dcount")
  43 + private long dcount;
  44 + /**
  45 + * 转化率
  46 + */
  47 + @TableField(exist = false)
  48 + private long conversion;
  49 +
  50 +
  51 +
  52 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatDateInfo.java View file @ f52b828
... ... @@ -4,13 +4,15 @@
4 4 import com.baomidou.mybatisplus.annotation.TableName;
5 5 import lombok.Data;
6 6  
  7 +import java.io.Serializable;
  8 +
7 9 /**
8 10 *首页-日期筛选问诊量视图
9 11 * @TableName tkRecordStat_date_info
10 12 */
11 13 @Data
12 14 @TableName(value ="tkRecordStat_date_info")
13   -public class TkRecordStatDateInfo {
  15 +public class TkRecordStatDateInfo implements Serializable {
14 16  
15 17 /**
16 18 * 医院ID
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatHInfo.java View file @ f52b828
... ... @@ -4,13 +4,15 @@
4 4 import com.baomidou.mybatisplus.annotation.TableName;
5 5 import lombok.Data;
6 6  
  7 +import java.io.Serializable;
  8 +
7 9 /**
8 10 *首页-今日视图
9 11 * @TableName tkRecordStat_h_info
10 12 */
11 13 @TableName(value ="tkRecordStat_h_info")
12 14 @Data
13   -public class TkRecordStatHInfo {
  15 +public class TkRecordStatHInfo implements Serializable {
14 16  
15 17 /**
16 18 * 医院ID
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatMInfo.java View file @ f52b828
... ... @@ -4,13 +4,15 @@
4 4 import com.baomidou.mybatisplus.annotation.TableName;
5 5 import lombok.Data;
6 6  
  7 +import java.io.Serializable;
  8 +
7 9 /**
8 10 *首页-本周视图
9 11 * @TableName tkRecordStat_m_info
10 12 */
11 13 @Data
12 14 @TableName(value ="tkRecordStat_m_info")
13   -public class TkRecordStatMInfo {
  15 +public class TkRecordStatMInfo implements Serializable {
14 16  
15 17 /**
16 18 * 医院ID
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatRankingInfo.java View file @ f52b828
... ... @@ -5,13 +5,15 @@
5 5 import com.baomidou.mybatisplus.annotation.TableName;
6 6 import lombok.Data;
7 7  
  8 +import java.io.Serializable;
  9 +
8 10 /**
9   - *首页-日期筛选问诊量视图
  11 + *首页-医院问诊量排名
10 12 * @TableName tkRecordStat_ranking_info
11 13 */
12 14 @Data
13 15 @TableName(value ="tkRecordStat_ranking_info")
14   -public class TkRecordStatRankingInfo {
  16 +public class TkRecordStatRankingInfo implements Serializable {
15 17  
16 18 /**
17 19 * 医院ID
18 20  
... ... @@ -21,12 +23,12 @@
21 23 /**
22 24 * 医院名称
23 25 */
24   - @TableField(value = "hid")
  26 + @TableField(value = "hname")
25 27 private String hname;
26 28 /**
27 29 * 医院总问诊量
28 30 */
29   - @TableField(value = "hid")
  31 + @TableField(value = "total")
30 32 private long total;
31 33  
32 34  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatWInfo.java View file @ f52b828
... ... @@ -4,13 +4,15 @@
4 4 import com.baomidou.mybatisplus.annotation.TableName;
5 5 import lombok.Data;
6 6  
  7 +import java.io.Serializable;
  8 +
7 9 /**
8 10 *首页-本周视图
9 11 * @TableName tkRecordStat_w_info
10 12 */
11 13 @Data
12 14 @TableName(value ="tkRecordStat_w_info")
13   -public class TkRecordStatWInfo {
  15 +public class TkRecordStatWInfo implements Serializable {
14 16  
15 17 /**
16 18 * 医院ID
... ... @@ -26,7 +28,7 @@
26 28 * 问诊量
27 29 */
28 30 @TableField(value = "dcount")
29   - private long wcount;
  31 + private long dcount;
30 32  
31 33  
32 34  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatYInfo.java View file @ f52b828
... ... @@ -5,13 +5,15 @@
5 5 import com.baomidou.mybatisplus.annotation.TableName;
6 6 import lombok.Data;
7 7  
  8 +import java.io.Serializable;
  9 +
8 10 /**
9 11 *首页-本年视图
10 12 * @TableName tkRecordStat_y_info
11 13 */
12 14 @Data
13 15 @TableName(value ="tkRecordStat_y_info")
14   -public class TkRecordStatYInfo {
  16 +public class TkRecordStatYInfo implements Serializable {
15 17  
16 18 /**
17 19 * 医院ID
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/TkRecordStatMapper.java View file @ f52b828
... ... @@ -144,7 +144,8 @@
144 144 "</choose>",
145 145 "from tkRecordStat_date_info",
146 146 "where 1=1",
147   - "<![CDATA[ and DATE(days)>=DATE(#{startdate}) and DATE(days)<=DATE(#{enddate}) ]]>",
  147 +// "<![CDATA[ and DATE(days)>=DATE(#{startdate}) and DATE(days)<=DATE(#{enddate}) ]]>",
  148 + "<![CDATA[ and (days between #{startdate} and #{enddate}) ]]>",
148 149 "<choose>",
149 150 "<when test='hid!=null'>",
150 151 "and hid=#{hid}",
... ... @@ -164,5 +165,53 @@
164 165 */
165 166 @Select("select hid,hname,total from tkRecordStat_ranking_info")
166 167 List<TkRecordStatRankingInfo> getTkRecordStatRanking();
  168 +
  169 + /**
  170 + * 首页-转化率-全部医院分时段筛选转化率
  171 + * @return
  172 + */
  173 + @Select({"<script>",
  174 + "select ",
  175 + "ho.hid,ho.hname,a.conversion ",
  176 + "from lyms_hospital ho",
  177 + "left join (",
  178 + "select",
  179 + " ldate,hid,hname,sum(visits) as 'visits',sum(dcount) as 'dcount',TRUNCATE(sum(dcount)/sum(visits)*100,0) as 'conversion'",
  180 + "from logsRecord_Visits_info",
  181 + "where 1=1",
  182 + "<choose>",
  183 + "<when test='startdate!=null and enddate!=null' >",
  184 + "<![CDATA[ and (ldate between #{startdate} and #{enddate}) ]]>",
  185 + "</when>",
  186 + "<otherwise>",
  187 + "<![CDATA[ and date_format(ldate,'%Y-%m') = date_format(NOW(),'%Y-%m') ]]>",
  188 + "</otherwise>",
  189 + "</choose>",
  190 + "GROUP BY hid",
  191 + "ORDER BY ldate ASC",
  192 + ") a on a.hid=ho.hid",
  193 + "</script>"})
  194 + List<LogsRecordVisitsInfo> getLogsRecordVisits(@Param("startdate") String startdate,@Param("enddate") String enddate);
  195 +
  196 + /**
  197 + * 首页-转化率-按医院分时段筛选-访问量和问诊量
  198 + * @return
  199 + */
  200 + @Select({"<script>",
  201 + "select",
  202 + " ldate,hid,hname,visits,dcount",
  203 + "from logsRecord_Visits_info",
  204 + "where hid=#{hid}",
  205 + "<choose>",
  206 + "<when test='startdate!=null and enddate!=null' >",
  207 + "<![CDATA[ and (ldate between #{startdate} and #{enddate}) ]]>",
  208 + "</when>",
  209 + "<otherwise>",
  210 + "<![CDATA[ and date_format(ldate,'%Y-%m') = date_format(NOW(),'%Y-%m') ]]>",
  211 + "</otherwise>",
  212 + "</choose>",
  213 + "ORDER BY ldate ASC",
  214 + "</script>"})
  215 + List<LogsRecordVisitsInfo> getLogsRecordRecord(@Param("startdate") String startdate,@Param("enddate") String enddate,@Param("hid") Integer hid);
167 216 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/TkRecordStatService.java View file @ f52b828
... ... @@ -19,5 +19,9 @@
19 19 List<TkRecordStatDateInfo> getTkRecordStatDate(String startdate, String enddate, Integer hid);
20 20  
21 21 List<TkRecordStatRankingInfo> getTkRecordStatRanking();
  22 +
  23 + List<LogsRecordVisitsInfo> getLogsRecordVisits(String startdate,String enddate);
  24 +
  25 + List<LogsRecordVisitsInfo> getLogsRecordRecord(String startdate, String enddate, Integer hid);
22 26 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/TkRecordStatServiceImpl.java View file @ f52b828
... ... @@ -46,5 +46,15 @@
46 46 public List<TkRecordStatRankingInfo> getTkRecordStatRanking() {
47 47 return tkRecordStatMapper.getTkRecordStatRanking();
48 48 }
  49 +
  50 + @Override
  51 + public List<LogsRecordVisitsInfo> getLogsRecordVisits(String startdate,String enddate) {
  52 + return tkRecordStatMapper.getLogsRecordVisits(startdate, enddate);
  53 + }
  54 +
  55 + @Override
  56 + public List<LogsRecordVisitsInfo> getLogsRecordRecord(String startdate, String enddate, Integer hid) {
  57 + return tkRecordStatMapper.getLogsRecordRecord(startdate, enddate, hid);
  58 + }
49 59 }