Commit e7de99b043df692e8e1d546ba759a6661843a5b4

Authored by shiyang
1 parent ace1de95da
Exists in master

首页-问诊统计

Showing 5 changed files with 162 additions and 48 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/IndexController.java View file @ e7de99b
1 1 package com.lyms.talkonlineweb.controller;
2 2  
3   -import com.lyms.talkonlineweb.domain.TkRecordStatHInfo;
4   -import com.lyms.talkonlineweb.domain.TkRecordStatMInfo;
5   -import com.lyms.talkonlineweb.domain.TkRecordStatWInfo;
6   -import com.lyms.talkonlineweb.domain.TkRecordStatYInfo;
  3 +import com.lyms.talkonlineweb.domain.*;
7 4 import com.lyms.talkonlineweb.result.BaseResponse;
8 5 import com.lyms.talkonlineweb.service.IndexService;
9 6 import com.lyms.talkonlineweb.service.TkRecordStatService;
... ... @@ -40,7 +37,7 @@
40 37  
41 38 /**
42 39 * 首页-今日问诊数量
43   - * @param hid 不传默认返回所有医院今日问诊次数
  40 + * @param hid 不传默认返回所有医院今日问诊
44 41 * @return
45 42 */
46 43 @GetMapping("getTkRecordStatH")
... ... @@ -52,7 +49,7 @@
52 49 }
53 50 /**
54 51 * 首页-本周问诊数量
55   - * @param hid 不传默认返回所有医院本周问诊次数
  52 + * @param hid 不传默认返回所有医院本周问诊
56 53 * @return
57 54 */
58 55 @GetMapping("getTkRecordStatW")
... ... @@ -64,7 +61,7 @@
64 61 }
65 62 /**
66 63 * 首页-本月问诊数量
67   - * @param hid 不传默认返回所有医院本月问诊次数
  64 + * @param hid 不传默认返回所有医院本月问诊
68 65 * @return
69 66 */
70 67 @GetMapping("getTkRecordStatM")
71 68  
... ... @@ -76,13 +73,25 @@
76 73 }
77 74 /**
78 75 * 首页-本年问诊数量
79   - * @param hid 不传默认返回所有医院本年问诊次数
  76 + * @param hid 不传默认返回所有医院本年问诊
80 77 * @return
81 78 */
82 79 @GetMapping("getTkRecordStatY")
83 80 public BaseResponse getTkRecordStatY(Integer hid){
84 81 BaseResponse baseResponse=new BaseResponse();
85 82 List<TkRecordStatYInfo> tkRecordStatW = tkRecordStatService.getTkRecordStatY(hid);
  83 + baseResponse.setObject(tkRecordStatW);
  84 + return baseResponse;
  85 + }
  86 + /**
  87 + * 首页-日期筛选问诊量
  88 + * @param hid 不传默认返回所有医院日起筛选问诊量。
  89 + * @return
  90 + */
  91 + @GetMapping("getTkRecordStatDate")
  92 + public BaseResponse getTkRecordStatDate(String startdate,String enddate,Integer hid){
  93 + BaseResponse baseResponse=new BaseResponse();
  94 + List<TkRecordStatDateInfo> tkRecordStatW = tkRecordStatService.getTkRecordStatDate(startdate,enddate,hid);
86 95 baseResponse.setObject(tkRecordStatW);
87 96 return baseResponse;
88 97 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/TkRecordStatDateInfo.java View file @ e7de99b
  1 +package com.lyms.talkonlineweb.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.TableField;
  4 +import com.baomidou.mybatisplus.annotation.TableName;
  5 +import lombok.Data;
  6 +
  7 +/**
  8 + *首页-本年视图
  9 + * @TableName tkRecordStat_date_info
  10 + */
  11 +@Data
  12 +@TableName(value ="tkRecordStat_date_info")
  13 +public class TkRecordStatDateInfo {
  14 +
  15 + /**
  16 + * 医院ID
  17 + */
  18 + @TableField(value = "hid")
  19 + private long hid;
  20 + /**
  21 + * 筛选日期
  22 + */
  23 + @TableField(value = "days")
  24 + private String days;
  25 + /**
  26 + * 问诊量
  27 + */
  28 + @TableField(value = "dcount")
  29 + private long dcount;
  30 +
  31 +
  32 +
  33 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/TkRecordStatMapper.java View file @ e7de99b
1 1 package com.lyms.talkonlineweb.mapper;
2 2  
3 3  
4   -import com.lyms.talkonlineweb.domain.TkRecordStatHInfo;
5   -import com.lyms.talkonlineweb.domain.TkRecordStatMInfo;
6   -import com.lyms.talkonlineweb.domain.TkRecordStatWInfo;
7   -import com.lyms.talkonlineweb.domain.TkRecordStatYInfo;
  4 +import com.lyms.talkonlineweb.domain.*;
8 5 import org.apache.ibatis.annotations.Mapper;
9 6 import org.apache.ibatis.annotations.Param;
10 7 import org.apache.ibatis.annotations.Select;
11 8  
... ... @@ -21,14 +18,25 @@
21 18 * @return
22 19 */
23 20 @Select({"<script>",
24   - "select hid,hours,hcount from tkRecordStat_h_info",
  21 + "select hid,hours ",
  22 + "<choose>",
  23 + "<when test='hid!=null'>",
  24 + ",hcount ",
  25 + "</when>",
  26 + "<otherwise>",
  27 + ",sum(hcount) as hcount ",
  28 + "</otherwise>",
  29 + "</choose>",
  30 + "from tkRecordStat_h_info",
25 31 "where 1=1",
26   - "<when test='hid!=null'>",
27   - "and hid=#{hid}",
28   - "</when>",
29   - "<when test='hid==null'>",
30   - "GROUP BY hours",
31   - "</when>",
  32 + "<choose>",
  33 + "<when test='hid!=null'>",
  34 + "and hid=#{hid}",
  35 + "</when>",
  36 + "<otherwise>",
  37 + "GROUP BY hours",
  38 + "</otherwise>",
  39 + "</choose>",
32 40 "ORDER BY hours ASC",
33 41 "</script>"})
34 42 public List<TkRecordStatHInfo> getTkRecordStatH(@Param("hid") Integer hid);
35 43  
... ... @@ -39,14 +47,25 @@
39 47 * @return
40 48 */
41 49 @Select({"<script>",
42   - "select hid,theweek,dcount from tkRecordStat_w_info",
  50 + "select hid,theweek ",
  51 + "<choose>",
  52 + "<when test='hid!=null'>",
  53 + ",dcount ",
  54 + "</when>",
  55 + "<otherwise>",
  56 + ",sum(dcount) as dcount ",
  57 + "</otherwise>",
  58 + "</choose>",
  59 + "from tkRecordStat_w_info",
43 60 "where 1=1",
44   - "<when test='hid!=null'>",
45   - "and hid=#{hid}",
46   - "</when>",
47   - "<when test='hid==null'>",
48   - "GROUP BY theweek",
49   - "</when>",
  61 + "<choose>",
  62 + "<when test='hid!=null'>",
  63 + "and hid=#{hid}",
  64 + "</when>",
  65 + "<otherwise>",
  66 + "GROUP BY theweek",
  67 + "</otherwise>",
  68 + "</choose>",
50 69 "ORDER BY theweek ASC",
51 70 "</script>"})
52 71 List<TkRecordStatWInfo> getTkRecordStatW(@Param("hid") Integer hid);
53 72  
... ... @@ -57,14 +76,25 @@
57 76 * @return
58 77 */
59 78 @Select({"<script>",
60   - "select hid,days,dcount from tkRecordStat_m_info",
  79 + "select hid,days ",
  80 + "<choose>",
  81 + "<when test='hid!=null'>",
  82 + ",dcount ",
  83 + "</when>",
  84 + "<otherwise>",
  85 + ",sum(dcount) as dcount ",
  86 + "</otherwise>",
  87 + "</choose>",
  88 + "from tkRecordStat_m_info",
61 89 "where 1=1",
62   - "<when test='hid!=null'>",
63   - "and hid=#{hid}",
64   - "</when>",
65   - "<when test='hid==null'>",
66   - "GROUP BY days",
67   - "</when>",
  90 + "<choose>",
  91 + "<when test='hid!=null'>",
  92 + "and hid=#{hid}",
  93 + "</when>",
  94 + "<otherwise>",
  95 + "GROUP BY days",
  96 + "</otherwise>",
  97 + "</choose>",
68 98 "ORDER BY days ASC",
69 99 "</script>"})
70 100 List<TkRecordStatMInfo> getTkRecordStatM(@Param("hid") Integer hid);
71 101  
72 102  
... ... @@ -75,16 +105,57 @@
75 105 * @return
76 106 */
77 107 @Select({"<script>",
78   - "select hid,months,mcount from tkRecordStat_y_info",
  108 + "select hid,months ",
  109 + "<choose>",
  110 + "<when test='hid!=null'>",
  111 + ",mcount ",
  112 + "</when>",
  113 + "<otherwise>",
  114 + ",sum(mcount) as mcount ",
  115 + "</otherwise>",
  116 + "</choose>",
  117 + "from tkRecordStat_y_info",
79 118 "where 1=1",
80   - "<when test='hid!=null'>",
81   - "and hid=#{hid}",
82   - "</when>",
83   - "<when test='hid==null'>",
84   - "GROUP BY months",
85   - "</when>",
  119 + "<choose>",
  120 + "<when test='hid!=null'>",
  121 + "and hid=#{hid}",
  122 + "</when>",
  123 + "<otherwise>",
  124 + "GROUP BY months",
  125 + "</otherwise>",
  126 + "</choose>",
86 127 "ORDER BY months ASC",
87 128 "</script>"})
88 129 List<TkRecordStatYInfo> getTkRecordStatY(@Param("hid") Integer hid);
  130 + /**
  131 + * 日期筛选问诊量
  132 + * @param hid
  133 + * @return
  134 + */
  135 + @Select({"<script>",
  136 + "select hid,days",
  137 + "<choose>",
  138 + "<when test='hid!=null'>",
  139 + ",dcount ",
  140 + "</when>",
  141 + "<otherwise>",
  142 + ",sum(dcount) as dcount ",
  143 + "</otherwise>",
  144 + "</choose>",
  145 + "from tkRecordStat_date_info",
  146 + "where 1=1",
  147 + "<![CDATA[ and DATE(days)>=DATE(#{startdate}) and DATE(days)<=DATE(#{enddate}) ]]>",
  148 + "<choose>",
  149 + "<when test='hid!=null'>",
  150 + "and hid=#{hid}",
  151 + "</when>",
  152 + "<otherwise>",
  153 + "GROUP BY days",
  154 + "</otherwise>",
  155 + "</choose>",
  156 + "ORDER BY days ASC",
  157 + "</script>"})
  158 + List<TkRecordStatDateInfo> getTkRecordStatDate(@Param("startdate") String startdate,@Param("enddate") String enddate,@Param("hid") Integer hid);
  159 +
89 160 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/TkRecordStatService.java View file @ e7de99b
1 1 package com.lyms.talkonlineweb.service;
2 2  
3   -import com.lyms.talkonlineweb.domain.TkRecordStatHInfo;
4   -import com.lyms.talkonlineweb.domain.TkRecordStatMInfo;
5   -import com.lyms.talkonlineweb.domain.TkRecordStatWInfo;
6   -import com.lyms.talkonlineweb.domain.TkRecordStatYInfo;
  3 +import com.lyms.talkonlineweb.domain.*;
7 4 import org.springframework.stereotype.Service;
8 5  
9 6 import java.util.List;
... ... @@ -18,5 +15,7 @@
18 15 List<TkRecordStatMInfo> getTkRecordStatM(Integer hid);
19 16  
20 17 List<TkRecordStatYInfo> getTkRecordStatY(Integer hid);
  18 +
  19 + List<TkRecordStatDateInfo> getTkRecordStatDate(String startdate, String enddate, Integer hid);
21 20 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/TkRecordStatServiceImpl.java View file @ e7de99b
1 1 package com.lyms.talkonlineweb.service.impl;
2 2  
3   -import com.lyms.talkonlineweb.domain.TkRecordStatHInfo;
4   -import com.lyms.talkonlineweb.domain.TkRecordStatMInfo;
5   -import com.lyms.talkonlineweb.domain.TkRecordStatWInfo;
6   -import com.lyms.talkonlineweb.domain.TkRecordStatYInfo;
  3 +import com.lyms.talkonlineweb.domain.*;
7 4 import com.lyms.talkonlineweb.mapper.TkRecordStatMapper;
8 5 import com.lyms.talkonlineweb.service.TkRecordStatService;
9 6 import lombok.extern.log4j.Log4j2;
... ... @@ -38,6 +35,11 @@
38 35 @Override
39 36 public List<TkRecordStatYInfo> getTkRecordStatY(Integer hid) {
40 37 return tkRecordStatMapper.getTkRecordStatY(hid);
  38 + }
  39 +
  40 + @Override
  41 + public List<TkRecordStatDateInfo> getTkRecordStatDate(String startdate, String enddate, Integer hid) {
  42 + return tkRecordStatMapper.getTkRecordStatDate(startdate, enddate, hid);
41 43 }
42 44 }