Browse Source

Merge branch 'dev/zzcx20200202_init' into 122run

gaodm 5 năm trước cách đây
mục cha
commit
098dbae418
34 tập tin đã thay đổi với 1433 bổ sung3 xóa
  1. 4 0
      config-server/src/main/resources/shared/zzcx-service-dev.yml
  2. 4 0
      config-server/src/main/resources/shared/zzcx-service-local.yml
  3. 4 0
      config-server/src/main/resources/shared/zzcx-service-pre.yml
  4. 4 0
      config-server/src/main/resources/shared/zzcx-service-pro.yml
  5. 4 0
      config-server/src/main/resources/shared/zzcx-service-test.yml
  6. 4 0
      config-server/src/main/resources/shared/zzcxtzsl-service-tzsl.yml
  7. 11 0
      zzcx-service/pom.xml
  8. 1 1
      zzcx-service/src/main/java/com/diagbot/ZzcxServiceApplication.java
  9. 106 0
      zzcx-service/src/main/java/com/diagbot/aggregate/OptHospAggregate.java
  10. 47 0
      zzcx-service/src/main/java/com/diagbot/config/wx/WxMpConfiguration.java
  11. 46 0
      zzcx-service/src/main/java/com/diagbot/config/wx/WxMpProperties.java
  12. 18 0
      zzcx-service/src/main/java/com/diagbot/dto/HospNameDTO.java
  13. 25 0
      zzcx-service/src/main/java/com/diagbot/dto/OptHospDTO.java
  14. 18 0
      zzcx-service/src/main/java/com/diagbot/dto/PVHospDTO.java
  15. 17 0
      zzcx-service/src/main/java/com/diagbot/dto/PVHospSumDTO.java
  16. 18 0
      zzcx-service/src/main/java/com/diagbot/dto/UVHospDTO.java
  17. 17 0
      zzcx-service/src/main/java/com/diagbot/dto/UVHospSumDTO.java
  18. 18 0
      zzcx-service/src/main/java/com/diagbot/dto/ZZHospDTO.java
  19. 17 0
      zzcx-service/src/main/java/com/diagbot/dto/ZZHospSumDTO.java
  20. 47 0
      zzcx-service/src/main/java/com/diagbot/facade/OptInfoFacade.java
  21. 197 0
      zzcx-service/src/main/java/com/diagbot/facade/WeixinFacade.java
  22. 22 1
      zzcx-service/src/main/java/com/diagbot/mapper/OptInfoMapper.java
  23. 21 0
      zzcx-service/src/main/java/com/diagbot/service/OptInfoService.java
  24. 35 0
      zzcx-service/src/main/java/com/diagbot/service/impl/OptInfoServiceImpl.java
  25. 19 0
      zzcx-service/src/main/java/com/diagbot/vo/WeixinVO.java
  26. 22 1
      zzcx-service/src/main/java/com/diagbot/web/OptInfoController.java
  27. 67 0
      zzcx-service/src/main/java/com/diagbot/web/ViewController.java
  28. 61 0
      zzcx-service/src/main/java/com/diagbot/web/WeXinJsSdkController.java
  29. 69 0
      zzcx-service/src/main/java/com/diagbot/web/WexinController.java
  30. 24 0
      zzcx-service/src/main/resources/bootstrap.yml
  31. 188 0
      zzcx-service/src/main/resources/mapper/OptInfoMapper.xml
  32. 10 0
      zzcx-service/src/main/resources/static/index.html
  33. 173 0
      zzcx-service/src/main/resources/templates/index_all.ftl
  34. 95 0
      zzcx-service/src/main/resources/templates/index_lantong.ftl

+ 4 - 0
config-server/src/main/resources/shared/zzcx-service-dev.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxedd53be102996426
+  secret: c164e280950342f166a933dd7aa6daf7

+ 4 - 0
config-server/src/main/resources/shared/zzcx-service-local.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxedd53be102996426
+  secret: c164e280950342f166a933dd7aa6daf7

+ 4 - 0
config-server/src/main/resources/shared/zzcx-service-pre.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxe4e2b88ec9c578bd
+  secret: 16ae52c464d2a201c7ede0820dadb4a9

+ 4 - 0
config-server/src/main/resources/shared/zzcx-service-pro.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxe4e2b88ec9c578bd
+  secret: 16ae52c464d2a201c7ede0820dadb4a9

+ 4 - 0
config-server/src/main/resources/shared/zzcx-service-test.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxe4e2b88ec9c578bd
+  secret: 16ae52c464d2a201c7ede0820dadb4a9

+ 4 - 0
config-server/src/main/resources/shared/zzcxtzsl-service-tzsl.yml

@@ -98,3 +98,7 @@ mybatis-plus:
 io.github.lvyahui8.spring:
   base-packages: com.diagbot.aggregate
   thread-number: 12
+
+weixin:
+  appid: wxe4e2b88ec9c578bd
+  secret: 16ae52c464d2a201c7ede0820dadb4a9

+ 11 - 0
zzcx-service/pom.xml

@@ -51,6 +51,11 @@
             <artifactId>spring-boot-starter-undertow</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+
         <!-- 开启feign-->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -154,6 +159,12 @@
             <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-mp</artifactId>
+            <version>3.6.0</version>
+        </dependency>
+
         <dependency>
             <groupId>io.github.lvyahui8</groupId>
             <artifactId>spring-boot-data-aggregator-starter</artifactId>

+ 1 - 1
zzcx-service/src/main/java/com/diagbot/ZzcxServiceApplication.java

@@ -20,7 +20,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  * @time: 2018/8/7 9:26
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
-        JmxAutoConfiguration.class, ThymeleafAutoConfiguration.class })
+        JmxAutoConfiguration.class })
 @EnableEurekaClient
 @EnableFeignClients({ "com.diagbot.client" })
 @EnableHystrixDashboard

+ 106 - 0
zzcx-service/src/main/java/com/diagbot/aggregate/OptHospAggregate.java

@@ -0,0 +1,106 @@
+package com.diagbot.aggregate;
+
+import com.diagbot.dto.OptHospDTO;
+import com.diagbot.dto.PVHospDTO;
+import com.diagbot.dto.PVHospSumDTO;
+import com.diagbot.dto.UVHospDTO;
+import com.diagbot.dto.UVHospSumDTO;
+import com.diagbot.dto.ZZHospDTO;
+import com.diagbot.dto.ZZHospSumDTO;
+import com.diagbot.facade.OptInfoFacade;
+import com.diagbot.util.ListUtil;
+import com.diagbot.vo.OptVO;
+import io.github.lvyahui8.spring.annotation.DataConsumer;
+import io.github.lvyahui8.spring.annotation.DataProvider;
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 10:38
+ */
+@Component
+public class OptHospAggregate {
+    @Autowired
+    private OptInfoFacade optInfoFacade;
+
+    @DataProvider("getAllOptSumHosp")
+    public OptHospDTO getAllOptSumHosp(
+            @InvokeParameter("optVO") OptVO optVO,
+            @DataConsumer("getPVHosp") List<PVHospDTO> pvHospDto,
+            @DataConsumer("getPVSumHosp") List<PVHospSumDTO> pvHospSumDto,
+            @DataConsumer("getUVHosp") List<UVHospDTO> uvHospDto,
+            @DataConsumer("getUVSumHosp") List<UVHospSumDTO> uvHospSumDto,
+            @DataConsumer("getZZHosp") List<ZZHospDTO> zzHospDto,
+            @DataConsumer("getZZSumHosp") List<ZZHospSumDTO> zzHospSumDto) {
+        OptHospDTO optHospDTO = new OptHospDTO();
+        if (ListUtil.isNotEmpty(pvHospDto)) {
+            optHospDTO.setPvHospDto(pvHospDto);
+        }
+        if (ListUtil.isNotEmpty(pvHospSumDto)) {
+            optHospDTO.setPvHospSumDto(pvHospSumDto);
+            Long pvSum = 0L;
+            for (PVHospSumDTO pvHospSumDTO : pvHospSumDto) {
+                pvSum += pvHospSumDTO.getPvSum();
+            }
+            optHospDTO.setPvSum(pvSum);
+        }
+        if (ListUtil.isNotEmpty(uvHospDto)) {
+            optHospDTO.setUvHospDto(uvHospDto);
+        }
+        if (ListUtil.isNotEmpty(uvHospSumDto)) {
+            optHospDTO.setUvHospSumDto(uvHospSumDto);
+            Long uvSum = 0L;
+            for (UVHospSumDTO uvHospSumDTO : uvHospSumDto) {
+                uvSum += uvHospSumDTO.getUvSum();
+            }
+            optHospDTO.setUvSum(uvSum);
+        }
+        if (ListUtil.isNotEmpty(zzHospDto)) {
+            optHospDTO.setZzHospDto(zzHospDto);
+        }
+        if (ListUtil.isNotEmpty(zzHospSumDto)) {
+            optHospDTO.setZzHospSumDto(zzHospSumDto);
+            Long zzSum = 0L;
+            for (ZZHospSumDTO zzHospSumDTO : zzHospSumDto) {
+                zzSum += zzHospSumDTO.getZzSum();
+            }
+            optHospDTO.setZzSum(zzSum);
+        }
+        return optHospDTO;
+    }
+
+    @DataProvider("getPVHosp")
+    public List<PVHospDTO> getPVHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getPVHosp(optVO);
+    }
+
+    @DataProvider("getPVSumHosp")
+    public List<PVHospSumDTO> getPVSumHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getPVSumHosp(optVO);
+    }
+
+    @DataProvider("getUVHosp")
+    public List<UVHospDTO> getUVHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getUVHosp(optVO);
+    }
+
+    @DataProvider("getUVSumHosp")
+    public List<UVHospSumDTO> getUVSumHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getUVSumHosp(optVO);
+    }
+
+    @DataProvider("getZZHosp")
+    public List<ZZHospDTO> getZZHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getZZHosp(optVO);
+    }
+
+    @DataProvider("getZZSumHosp")
+    public List<ZZHospSumDTO> getZZSumHosp(@InvokeParameter("optVO") OptVO optVO) {
+        return optInfoFacade.getZZSumHosp(optVO);
+    }
+}

+ 47 - 0
zzcx-service/src/main/java/com/diagbot/config/wx/WxMpConfiguration.java

@@ -0,0 +1,47 @@
+package com.diagbot.config.wx;
+
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
+import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/5 19:52
+ */
+@AllArgsConstructor
+@Configuration
+@EnableConfigurationProperties(WxMpProperties.class)
+public class WxMpConfiguration {
+
+    private final WxMpProperties properties;
+
+    @Bean
+    public WxMpService wxMpService() {
+        // 代码里 getConfigs()处报错的同学,请注意仔细阅读项目说明,你的IDE需要引入lombok插件!!!!
+        final List<WxMpProperties.MpConfig> configs = this.properties.getConfigs();
+        if (configs == null) {
+            throw new RuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!");
+        }
+
+        WxMpService service = new WxMpServiceImpl();
+        service.setMultiConfigStorages(configs
+                .stream().map(a -> {
+                    WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl();
+                    configStorage.setAppId(a.getAppId());
+                    configStorage.setSecret(a.getSecret());
+                    configStorage.setToken(a.getToken());
+                    configStorage.setAesKey(a.getAesKey());
+                    return configStorage;
+                }).collect(Collectors.toMap(WxMpDefaultConfigImpl::getAppId, a -> a, (o, n) -> o)));
+        return service;
+    }
+
+}

+ 46 - 0
zzcx-service/src/main/java/com/diagbot/config/wx/WxMpProperties.java

@@ -0,0 +1,46 @@
+package com.diagbot.config.wx;
+
+import com.diagbot.util.FastJsonUtils;
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/5 20:00
+ */
+@Data
+@ConfigurationProperties(prefix = "wx.mp")
+public class WxMpProperties {
+    private List<MpConfig> configs;
+
+    @Data
+    public static class MpConfig {
+        /**
+         * 设置微信公众号的appid
+         */
+        private String appId;
+
+        /**
+         * 设置微信公众号的app secret
+         */
+        private String secret;
+
+        /**
+         * 设置微信公众号的token
+         */
+        private String token;
+
+        /**
+         * 设置微信公众号的EncodingAESKey
+         */
+        private String aesKey;
+    }
+
+    @Override
+    public String toString() {
+        return FastJsonUtils.getBeanToJson(this);
+    }
+}

+ 18 - 0
zzcx-service/src/main/java/com/diagbot/dto/HospNameDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class HospNameDTO {
+    //医院名称
+    private List<String> hospitalCode;
+}

+ 25 - 0
zzcx-service/src/main/java/com/diagbot/dto/OptHospDTO.java

@@ -0,0 +1,25 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:50
+ */
+@Getter
+@Setter
+public class OptHospDTO {
+    private List<PVHospDTO> pvHospDto;
+    private List<PVHospSumDTO> pvHospSumDto;
+    private Long pvSum;
+    private List<UVHospDTO> uvHospDto;
+    private List<UVHospSumDTO> uvHospSumDto;
+    private Long uvSum;
+    private List<ZZHospDTO> zzHospDto;
+    private List<ZZHospSumDTO> zzHospSumDto;
+    private Long zzSum;
+}

+ 18 - 0
zzcx-service/src/main/java/com/diagbot/dto/PVHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class PVHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long pvCnt;
+}

+ 17 - 0
zzcx-service/src/main/java/com/diagbot/dto/PVHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class PVHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long pvSum;
+}

+ 18 - 0
zzcx-service/src/main/java/com/diagbot/dto/UVHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class UVHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long uvCnt;
+}

+ 17 - 0
zzcx-service/src/main/java/com/diagbot/dto/UVHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class UVHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long uvSum;
+}

+ 18 - 0
zzcx-service/src/main/java/com/diagbot/dto/ZZHospDTO.java

@@ -0,0 +1,18 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class ZZHospDTO {
+    //医院名称
+    private String hospitalCode;
+    private String days;
+    private Long zzCnt;
+}

+ 17 - 0
zzcx-service/src/main/java/com/diagbot/dto/ZZHospSumDTO.java

@@ -0,0 +1,17 @@
+package com.diagbot.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:27
+ */
+@Getter
+@Setter
+public class ZZHospSumDTO {
+    //医院名称
+    private String hospitalCode;
+    private Long zzSum;
+}

+ 47 - 0
zzcx-service/src/main/java/com/diagbot/facade/OptInfoFacade.java

@@ -1,12 +1,15 @@
 package com.diagbot.facade;
 
+import com.diagbot.dto.HospNameDTO;
 import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
 import com.diagbot.entity.OptInfo;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.OptInfoServiceImpl;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.HttpUtils;
+import com.diagbot.util.ListUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.HospitalVO;
 import com.diagbot.vo.OptVO;
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -27,6 +31,8 @@ import java.util.Map;
 public class OptInfoFacade extends OptInfoServiceImpl {
     @Autowired
     DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
+    @Autowired
+    private OptInfoFacade optInfoFacade;
 
     public Boolean saveOptOnfo(HospitalVO hospitalVO, String optType) {
         OptInfo optInfo = new OptInfo();
@@ -74,4 +80,45 @@ public class OptInfoFacade extends OptInfoServiceImpl {
         //        optDTO.setZzSum(this.getZZSum(optVO));
         return optDTO;
     }
+
+
+
+    public OptHospDTO getOptSumHosp(OptVO optVO) {
+        //入参验证
+        if (null != optVO && null != optVO.getStartDate()) {
+            optVO.setStartDate(DateUtil.getFirstTimeOfDay(optVO.getStartDate()));
+        }
+        if (null != optVO && null != optVO.getEndDate()) {
+            optVO.setEndDate(DateUtil.getLastTimeOfDay(optVO.getEndDate()));
+        }
+
+        if (null != optVO && null != optVO.getStartDate() && null != optVO.getEndDate()) {
+            if (DateUtil.after(optVO.getStartDate(), optVO.getEndDate())) {
+                throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "开始时间大于结束时间!");
+            }
+        }
+
+        //获取统计数据
+        OptHospDTO optHospDTO = new OptHospDTO();
+
+        try {
+            Map<String, Object> invokeParams = new HashMap<>();
+            invokeParams.put("optVO", optVO);
+            optHospDTO
+                    = dataBeanAggregateQueryFacade.get("getAllOptSumHosp", invokeParams, OptHospDTO.class);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
+        }
+
+        return optHospDTO;
+    }
+
+    public HospNameDTO getAllHospitalName(){
+        HospNameDTO hospNameDTO = new HospNameDTO();
+        List<String> hospitalList = optInfoFacade.getAllHospital();
+        if(ListUtil.isNotEmpty(hospitalList)){
+            hospNameDTO.setHospitalCode(hospitalList);
+        }
+        return hospNameDTO;
+    }
 }

+ 197 - 0
zzcx-service/src/main/java/com/diagbot/facade/WeixinFacade.java

@@ -0,0 +1,197 @@
+package com.diagbot.facade;
+
+import com.alibaba.fastjson.JSON;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.vo.WeixinVO;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2020/2/6 12:22
+ */
+@Component
+public class WeixinFacade {
+
+    @Value("${weixin.appid}")
+    private String appid;
+
+    @Value("${weixin.secret}")
+    private String secret;
+
+    // 存储accessToken 和 ticket
+    public static Map<String, String> cacheMap = new HashMap<>();
+
+    public Map getConfig(WeixinVO weixinVO) {
+        Map<String, String> map = new LinkedHashMap<>();
+        String url= weixinVO.getUrl();
+        try {
+           /* Map<String, Object> map2  = WxUtil.oppen_id(request, request.getSession());
+            String oppen_id = (String) map2.get("oppen_id");
+            String accessToken  = (String) map2.get("access_token");*/
+
+           // 1.获取accessToken
+           String accessToken = "";
+           if (cacheMap.get("accessTokenExpire") == null
+                   || Long.parseLong(cacheMap.get("accessTokenExpire")) < System.currentTimeMillis()) {
+               accessToken = getAccessToken(appid, secret);
+               cacheMap.put("accessTokenExpire", String.valueOf(System.currentTimeMillis() + 7200 * 1000)); // 过期时间
+               cacheMap.put("accessToken", accessToken);
+           } else {
+               accessToken = cacheMap.get("accessToken");
+           }
+
+            //2、获取Ticket
+            String jsapi_ticket = "";
+            if (cacheMap.get("ticketExpire") == null
+                    || Long.parseLong(cacheMap.get("ticketExpire")) < System.currentTimeMillis()) {
+                jsapi_ticket = getTicket(accessToken);
+                cacheMap.put("ticketExpire", String.valueOf(System.currentTimeMillis() + 7200 * 1000)); // 过期时间
+                cacheMap.put("ticket", jsapi_ticket);
+            } else {
+                jsapi_ticket = cacheMap.get("ticket");
+            }
+
+            //3、时间戳和随机字符串
+            String noncestr = UUID.randomUUID().toString().replace("-", "").substring(0, 16);//随机字符串
+            String timestamp = String.valueOf(System.currentTimeMillis() / 1000);//时间戳
+
+            System.out.println("accessToken:"+accessToken+"\njsapi_ticket:"+jsapi_ticket+"\n时间戳:"+timestamp+"\n随机字符串:"+noncestr);
+
+            //4、获取url
+            //String url="http://shuiqitong.com/xzw/jNotice/jNotice_templet/templet.jsp";
+                /*根据JSSDK上面的规则进行计算
+                String[] ArrTmp = {"jsapi_ticket","timestamp","nonce","url"};
+                Arrays.sort(ArrTmp);
+                StringBuffer sf = new StringBuffer();
+                for(int i=0;i<ArrTmp.length;i++){
+                    sf.append(ArrTmp[i]);
+                }
+                */
+
+            //5、将参数排序并拼接字符串
+            String str = "jsapi_ticket="+jsapi_ticket+"&noncestr="+noncestr+"&timestamp="+timestamp+"&url="+url;
+
+            //6、将字符串进行sha1加密
+            String signature =SHA1(str);
+            System.out.println("参数:"+str+"\n签名:"+signature);
+            map.put("ticket", jsapi_ticket);
+            map.put("timestamp", timestamp);
+            map.put("noncestr", noncestr);
+            map.put("signature", signature);
+            map.put("url", url);
+            map.put("appid", appid);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return map;
+    }
+
+
+    //获取access_token
+    public static String getAccessToken(String appid,String secret) {
+        String access_token = "";
+        String grant_type = "client_credential";//获取access_token填写client_credential
+        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type="+grant_type+"&appid="+appid+"&secret="+secret;
+        //这个url链接地址和参数皆不能变
+        String requestUrl = "";
+        String oppid="";
+        String openid ="";
+        String requestUrl2="";
+        String userInfoStr="";
+        try {
+            //获取code后,请求以下链接获取access_token
+            URL urlGet = new URL(url);
+            HttpURLConnection http = (HttpURLConnection) urlGet.openConnection();
+            http.setRequestMethod("GET"); // 必须是get方式请求
+            http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
+            http.setDoOutput(true);
+            http.setDoInput(true);
+            System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒
+            System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒
+            http.connect();
+            InputStream is = http.getInputStream();
+            int size = is.available();
+            byte[] jsonBytes = new byte[size];
+            is.read(jsonBytes);
+            String message = new String(jsonBytes, "UTF-8");
+            Map<String,String> map = JSON.parseObject(message, Map.class);
+           // System.out.println(map);
+            access_token = map.get("access_token");
+            // System.out.println(access_token);
+            //            is.close();
+            //
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return access_token;
+    }
+
+    //获取ticket
+    public static String getTicket(String access_token) {
+        String ticket = null;
+        String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="+ access_token +"&type=jsapi";//这个url链接和参数不能变
+        try {
+            URL urlGet = new URL(url);
+            HttpURLConnection http = (HttpURLConnection) urlGet.openConnection();
+            http.setRequestMethod("GET"); // 必须是get方式请求
+            http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
+            http.setDoOutput(true);
+            http.setDoInput(true);
+            System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒
+            System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒
+            http.connect();
+            InputStream is = http.getInputStream();
+            int size = is.available();
+            byte[] jsonBytes = new byte[size];
+            is.read(jsonBytes);
+            String message = new String(jsonBytes, "UTF-8");
+
+            Map<String,String> map = JSON.parseObject(message, Map.class);
+            //System.out.println(map);
+            ticket = map.get("ticket");
+            //            JSONObject demoJson = JSONObject.fromObject(message);
+            //            System.out.println("JSON字符串:"+demoJson);
+            //            ticket = demoJson.getString("ticket");
+            //            is.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ticket;
+    }
+
+
+    public static String SHA1(String decript) {
+        try {
+            MessageDigest digest = java.security.MessageDigest.getInstance("SHA-1");
+            digest.update(decript.getBytes());
+            byte messageDigest[] = digest.digest();
+            // Create Hex String
+            StringBuffer hexString = new StringBuffer();
+            // 字节数组转换为 十六进制 数
+            for (int i = 0; i < messageDigest.length; i++) {
+                String shaHex = Integer.toHexString(messageDigest[i] & 0xFF);
+                if (shaHex.length() < 2) {
+                    hexString.append(0);
+                }
+                hexString.append(shaHex);
+            }
+            return hexString.toString();
+
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+}

+ 22 - 1
zzcx-service/src/main/java/com/diagbot/mapper/OptInfoMapper.java

@@ -1,10 +1,16 @@
 package com.diagbot.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.dto.PVDTO;
+import com.diagbot.dto.PVHospDTO;
+import com.diagbot.dto.PVHospSumDTO;
 import com.diagbot.dto.UVDTO;
+import com.diagbot.dto.UVHospDTO;
+import com.diagbot.dto.UVHospSumDTO;
 import com.diagbot.dto.ZZDTO;
+import com.diagbot.dto.ZZHospDTO;
+import com.diagbot.dto.ZZHospSumDTO;
 import com.diagbot.entity.OptInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.diagbot.vo.OptVO;
 
 import java.util.List;
@@ -29,4 +35,19 @@ public interface OptInfoMapper extends BaseMapper<OptInfo> {
     List<ZZDTO> getZZ(OptVO optVO);
 
     Long getZZSum(OptVO optVO);
+
+    //医院合计
+    List<PVHospDTO> getPVHosp(OptVO optVO);
+
+    List<PVHospSumDTO> getPVSumHosp(OptVO optVO);
+
+    List<UVHospDTO> getUVHosp(OptVO optVO);
+
+    List<UVHospSumDTO> getUVSumHosp(OptVO optVO);
+
+    List<ZZHospDTO> getZZHosp(OptVO optVO);
+
+    List<ZZHospSumDTO> getZZSumHosp(OptVO optVO);
+
+    List<String> getAllHospital();
 }

+ 21 - 0
zzcx-service/src/main/java/com/diagbot/service/OptInfoService.java

@@ -1,8 +1,14 @@
 package com.diagbot.service;
 
 import com.diagbot.dto.PVDTO;
+import com.diagbot.dto.PVHospDTO;
+import com.diagbot.dto.PVHospSumDTO;
 import com.diagbot.dto.UVDTO;
+import com.diagbot.dto.UVHospDTO;
+import com.diagbot.dto.UVHospSumDTO;
 import com.diagbot.dto.ZZDTO;
+import com.diagbot.dto.ZZHospDTO;
+import com.diagbot.dto.ZZHospSumDTO;
 import com.diagbot.entity.OptInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.vo.OptVO;
@@ -31,4 +37,19 @@ public interface OptInfoService extends IService<OptInfo> {
 
     Long getZZSum(OptVO optVO);
 
+    //医院合计
+    List<PVHospDTO> getPVHosp(OptVO optVO);
+
+    List<PVHospSumDTO> getPVSumHosp(OptVO optVO);
+
+    List<UVHospDTO> getUVHosp(OptVO optVO);
+
+    List<UVHospSumDTO> getUVSumHosp(OptVO optVO);
+
+    List<ZZHospDTO> getZZHosp(OptVO optVO);
+
+    List<ZZHospSumDTO> getZZSumHosp(OptVO optVO);
+
+    List<String> getAllHospital();
+
 }

+ 35 - 0
zzcx-service/src/main/java/com/diagbot/service/impl/OptInfoServiceImpl.java

@@ -2,8 +2,14 @@ package com.diagbot.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.dto.PVDTO;
+import com.diagbot.dto.PVHospDTO;
+import com.diagbot.dto.PVHospSumDTO;
 import com.diagbot.dto.UVDTO;
+import com.diagbot.dto.UVHospDTO;
+import com.diagbot.dto.UVHospSumDTO;
 import com.diagbot.dto.ZZDTO;
+import com.diagbot.dto.ZZHospDTO;
+import com.diagbot.dto.ZZHospSumDTO;
 import com.diagbot.entity.OptInfo;
 import com.diagbot.mapper.OptInfoMapper;
 import com.diagbot.service.OptInfoService;
@@ -45,4 +51,33 @@ public class OptInfoServiceImpl extends ServiceImpl<OptInfoMapper, OptInfo> impl
     public Long getZZSum(OptVO optVO) {
         return this.baseMapper.getZZSum(optVO);
     }
+
+    //医院合计
+    public List<PVHospDTO> getPVHosp(OptVO optVO) {
+        return this.baseMapper.getPVHosp(optVO);
+    }
+
+    public List<PVHospSumDTO> getPVSumHosp(OptVO optVO) {
+        return this.baseMapper.getPVSumHosp(optVO);
+    }
+
+    public List<UVHospDTO> getUVHosp(OptVO optVO) {
+        return this.baseMapper.getUVHosp(optVO);
+    }
+
+    public List<UVHospSumDTO> getUVSumHosp(OptVO optVO) {
+        return this.baseMapper.getUVSumHosp(optVO);
+    }
+
+    public List<ZZHospDTO> getZZHosp(OptVO optVO) {
+        return this.baseMapper.getZZHosp(optVO);
+    }
+
+    public List<ZZHospSumDTO> getZZSumHosp(OptVO optVO) {
+        return this.baseMapper.getZZSumHosp(optVO);
+    }
+
+    public List<String> getAllHospital(){
+        return this.baseMapper.getAllHospital();
+    }
 }

+ 19 - 0
zzcx-service/src/main/java/com/diagbot/vo/WeixinVO.java

@@ -0,0 +1,19 @@
+package com.diagbot.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/3 9:21
+ */
+@Getter
+@Setter
+public class WeixinVO {
+    private String url;
+}

+ 22 - 1
zzcx-service/src/main/java/com/diagbot/web/OptInfoController.java

@@ -1,7 +1,9 @@
 package com.diagbot.web;
 
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.HospNameDTO;
 import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.OptInfoFacade;
 import com.diagbot.vo.HospitalVO;
@@ -39,7 +41,7 @@ public class OptInfoController {
         return RespDTO.onSuc(optInfoFacade.saveOptOnfo(hospitalVO, "1"));
     }
 
-    @ApiOperation(value = "获取合计数据[by:gaodm]",
+    @ApiOperation(value = "获取合计数据不带医院名称[by:gaodm]",
             notes = "hospitalCode: 医院名称,String<br>" +
                     "startDate: 开始时间,Date<br>" +
                     "endDate: 结束时间,Date<br>")
@@ -48,4 +50,23 @@ public class OptInfoController {
     public RespDTO<OptDTO> getOptSum(@RequestBody OptVO optVO) {
         return RespDTO.onSuc(optInfoFacade.getOptSum(optVO));
     }
+
+
+    @ApiOperation(value = "获取合计数据带医院名称[by:gaodm]",
+            notes = "hospitalCode: 医院名称,String<br>" +
+                    "startDate: 开始时间,Date<br>" +
+                    "endDate: 结束时间,Date<br>")
+    @PostMapping("/getOptSumHosp")
+    @SysLogger("getOptSumHosp")
+    public RespDTO<OptHospDTO> getOptSumHosp(@RequestBody OptVO optVO) {
+        return RespDTO.onSuc(optInfoFacade.getOptSumHosp(optVO));
+    }
+
+    @ApiOperation(value = "获取所有医院名称[by:gaodm]",
+            notes = "")
+    @PostMapping("/getAllHospitalName")
+    @SysLogger("getAllHospitalName")
+    public RespDTO<HospNameDTO> getAllHospitalName() {
+        return RespDTO.onSuc(optInfoFacade.getAllHospitalName());
+    }
 }

+ 67 - 0
zzcx-service/src/main/java/com/diagbot/web/ViewController.java

@@ -0,0 +1,67 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.OptDTO;
+import com.diagbot.dto.OptHospDTO;
+import com.diagbot.facade.OptInfoFacade;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.OptVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/7 13:17
+ */
+@Controller
+public class ViewController {
+    @Autowired
+    private OptInfoFacade optInfoFacade;
+
+    @RequestMapping("/view/indexlantone")
+    public String indexlantone(Map<String, Object> map, String hospitalCode) {
+        Date now = DateUtil.now();
+        OptVO optVO = new OptVO();
+        if (StringUtil.isNotBlank(hospitalCode)) {
+            optVO.setHospitalCode(hospitalCode);
+        }
+        optVO.setStartDate(DateUtil.addDay(now, -60));
+        optVO.setEndDate(now);
+        OptDTO optDTO = optInfoFacade.getOptSum(optVO);
+        map.put("pvSum", optDTO.getPvSum());
+        map.put("pvdto", optDTO.getPvdto());
+        map.put("uvSum", optDTO.getUvSum());
+        map.put("uvdto", optDTO.getUvdto());
+        map.put("zzSum", optDTO.getZzSum());
+        map.put("zzdto", optDTO.getZzdto());
+
+        return "index_lantong";
+    }
+
+    @RequestMapping("/view/indexall")
+    public String indexall(Map<String, Object> map, String hospitalCode) {
+        Date now = DateUtil.now();
+        OptVO optVO = new OptVO();
+        if (StringUtil.isNotBlank(hospitalCode)) {
+            optVO.setHospitalCode(hospitalCode);
+        }
+        optVO.setStartDate(DateUtil.addDay(now, -60));
+        optVO.setEndDate(now);
+        OptHospDTO optHospDTO = optInfoFacade.getOptSumHosp(optVO);
+        map.put("pvSum", optHospDTO.getPvSum());
+        map.put("pvHospDto", optHospDTO.getPvHospDto());
+        map.put("pvHospSumDto", optHospDTO.getPvHospSumDto());
+        map.put("uvSum", optHospDTO.getUvSum());
+        map.put("uvHospDto", optHospDTO.getUvHospDto());
+        map.put("uvHospSumDto", optHospDTO.getUvHospSumDto());
+        map.put("zzSum", optHospDTO.getZzSum());
+        map.put("zzHospDto", optHospDTO.getZzHospDto());
+        map.put("zzHospSumDto", optHospDTO.getZzHospSumDto());
+        return "index_all";
+    }
+}

+ 61 - 0
zzcx-service/src/main/java/com/diagbot/web/WeXinJsSdkController.java

@@ -0,0 +1,61 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.RespDTO;
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.bean.WxJsapiSignature;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/2/5 18:03
+ */
+@AllArgsConstructor
+@RestController
+@Api(value = "微信验证", tags = { "微信验证API" })
+@SuppressWarnings("unchecked")
+@Slf4j
+@RequestMapping("jssdk/{appid}")
+public class WeXinJsSdkController {
+
+    private final WxMpService wxMpService;
+
+    @RequestMapping(value = "/config", method = RequestMethod.GET)
+    public RespDTO<WxJsapiSignature> wxJsSdkConfig(HttpServletRequest request, @PathVariable String appid, String url) {
+        if (!this.wxMpService.switchover(appid)) {
+            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+        }
+
+        try { // 直接调用wxMpServer 接口
+            WxJsapiSignature wxJsapiSignature = wxMpService.createJsapiSignature(url);
+            log.info("createJsapiSignature被调用了~~~");
+            return RespDTO.onSuc(wxJsapiSignature);
+        } catch (WxErrorException e) {
+            return null;
+        }
+    }
+
+    @RequestMapping(value = "/ticket", method = RequestMethod.GET)
+    public RespDTO<String> wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
+        if (!this.wxMpService.switchover(appid)) {
+            throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
+        }
+
+        try { // 直接调用wxMpServer 接口
+            String jsapiTicket = wxMpService.getJsapiTicket();
+            return RespDTO.onSuc(jsapiTicket);
+        } catch (WxErrorException e) {
+            return null;
+        }
+    }
+
+}

+ 69 - 0
zzcx-service/src/main/java/com/diagbot/web/WexinController.java

@@ -0,0 +1,69 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.WeixinFacade;
+import com.diagbot.vo.WeixinVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @Author:zhoutg
+ * @time: 2020/2/6 10:48
+ */
+@RestController
+@Api(value = "微信", tags = { "微信API" })
+@SuppressWarnings("unchecked")
+@RequestMapping("/weixin")
+@Slf4j
+public class WexinController {
+
+    @Autowired
+    WeixinFacade weixinFacade;
+
+    @GetMapping("/getConfig")
+    public RespDTO<Map> getConfig(HttpServletRequest request) {
+        WeixinVO weixinVO = new WeixinVO();
+        weixinVO.setUrl(request.getParameter("url"));
+        Map<String, String> map = weixinFacade.getConfig(weixinVO);
+        return RespDTO.onSuc(map);
+    }
+
+    @RequestMapping(value = "/test", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" })
+    @ApiOperation(value = "测试微信公众号的接口配置信息", notes = "接口配置信息", httpMethod = "GET")
+    public String getWxUserInfo(HttpServletRequest request,
+                                @ApiParam(value = "微信求的 echostr") String echostr
+    ) {
+        try {
+            Map<String, String> map = new LinkedHashMap<>();
+            //只需要把微信请求的 echostr, 返回给微信就可以了
+            log.info("测试来过===================" + echostr);
+            Enumeration pNames = request.getParameterNames();
+            while (pNames.hasMoreElements()) {
+                String name = (String) pNames.nextElement();
+                String value = request.getParameter(name);
+                map.put(name, value);
+            }
+            log.info(map.toString());
+            return echostr;
+        } catch (Exception e) {
+            log.info("测试微信公众号的接口配置信息发生异常:", e);
+            return null;
+        }
+    }
+}

+ 24 - 0
zzcx-service/src/main/resources/bootstrap.yml

@@ -11,9 +11,33 @@ spring:
   profiles:
     active: local
 
+  freemarker:
+    allow-request-override: false
+    cache: true
+    check-template-location: true
+    charset: utf-8
+    content-type: text/html
+    expose-request-attributes: false
+    expose-session-attributes: false
+    expose-spring-macro-helpers: false
+    suffix: .ftl
+    template-loader-path: classpath:/templates/
+
 eureka:
   client:
     serviceUrl:
       defaultZone: http://${myuri}:8761/eureka/
 
+wx:
+  mp:
+    configs:
+    - appId: wxedd53be102996426
+      secret: c164e280950342f166a933dd7aa6daf7
+      token: testwxshare123
+      aesKey:
+    - appId: 2222 (另一个公众号的appid,以下同上)
+      secret: 1111
+      token: 111
+      aesKey: 111
+
 myuri: localhost

+ 188 - 0
zzcx-service/src/main/resources/mapper/OptInfoMapper.xml

@@ -163,4 +163,192 @@
         ) t;
     </select>
 
+    <!--按照医院合计-->
+    <select id="getPVHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.PVHospDTO">
+        SELECT
+        hospital_code AS hospitalCode,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d') AS days,
+        count(1) AS pvCnt
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 1
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        GROUP BY
+        hospital_code,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d')
+        ORDER BY
+        hospital_code,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d');
+    </select>
+
+    <select id="getPVSumHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.PVHospSumDTO">
+        SELECT
+        hospital_code AS hospitalCode,
+        count(1) AS pvSum
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 1
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        GROUP BY
+        hospital_code
+        ORDER BY
+        hospital_code;
+    </select>
+
+    <select id="getUVHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.UVHospDTO">
+        SELECT
+        t.hospitalCode AS hospitalCode,
+        t.days AS days,
+        count(ip) AS uvCnt
+        FROM
+        (
+        SELECT DISTINCT
+        hospital_code AS hospitalCode,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d') AS days,
+        ip
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 1
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        ) t
+        GROUP BY
+        hospitalCode,
+        days
+        ORDER BY
+        hospitalCode,
+        days;
+
+    </select>
+
+    <select id="getUVSumHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.UVHospSumDTO">
+        SELECT
+        t.hospitalCode AS hospitalCode,
+        count(ip) AS uvSum
+        FROM
+        (
+        SELECT DISTINCT
+        hospital_code AS hospitalCode,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d') AS days,
+        ip
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 1
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        ) t
+        GROUP BY
+        hospitalCode
+        ORDER BY
+        hospitalCode;
+    </select>
+
+    <select id="getZZHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.ZZHospDTO">
+        SELECT
+        t.hospitalCode AS hospitalCode,
+        t.days AS days,
+        count(ip) AS zzCnt
+        FROM
+        (
+        SELECT DISTINCT
+        hospital_code AS hospitalCode,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d') AS days,
+        ip
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 2
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        ) t
+        GROUP BY
+        hospitalCode,
+        days
+        ORDER BY
+        hospitalCode,
+        days;
+
+    </select>
+
+    <select id="getZZSumHosp" parameterType="com.diagbot.vo.OptVO" resultType="com.diagbot.dto.ZZHospSumDTO">
+        SELECT
+        t.hospitalCode AS hospitalCode,
+        count(ip) AS zzSum
+        FROM
+        (
+        SELECT DISTINCT
+        hospital_code AS hospitalCode,
+        DATE_FORMAT(gmt_create, '%Y-%m-%d') AS days,
+        ip
+        FROM
+        zzcx_opt_info
+        WHERE
+        opt_type = 2
+        <if test="hospitalCode != null and hospitalCode != ''">
+            AND hospital_code = #{hospitalCode}
+        </if>
+        <if test="startDate!=null">
+            AND gmt_create &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            AND gmt_create &lt;= #{endDate}
+        </if>
+--         AND hospital_code !='朗通通用'
+        ) t
+        GROUP BY
+        hospitalCode
+        ORDER BY
+        hospitalCode;
+    </select>
+
+    <select id="getAllHospital" resultType="java.lang.String">
+        SELECT DISTINCT(hospital_code) AS hospitalCode FROM `zzcx_opt_info`;
+    </select>
+
 </mapper>

+ 10 - 0
zzcx-service/src/main/resources/static/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+</head>
+<body>
+    欢迎!
+</body>
+</html>

+ 173 - 0
zzcx-service/src/main/resources/templates/index_all.ftl

@@ -0,0 +1,173 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>数据统计各个医院</title>
+    <style type="text/css">
+        table
+        {
+            border-collapse: collapse;
+            margin: 0 auto;
+            text-align: center;
+        }
+        table td, table th
+        {
+            border: 1px solid #cad9ea;
+            color: #666;
+            height: 30px;
+        }
+        table thead th
+        {
+            background-color: #CCE8EB;
+            width: 100px;
+        }
+        table tr:nth-child(odd)
+        {
+            background: #fff;
+        }
+        table tr:nth-child(even)
+        {
+            background: #F5FAFA;
+        }
+    </style>
+</head>
+<body>
+<table valign="top" class="table">
+    <tr>
+        <th>
+            PV(点击数量) 总合计: ${pvSum}
+        </th>
+        <th>
+            UV(用户数量) 总合计: ${uvSum}
+        </th>
+        <th>
+            完成自诊量 总合计: ${zzSum}
+        </th>
+    </tr>
+    <tr>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <th>每日情况</th>
+                    <th>医院统计</th>
+                </tr>
+                <tr>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>日期</td>
+                                <td>数量</td>
+                            </tr>
+                 <#list pvHospDto ! as pvHospDto>
+                     <tr>
+                         <td>${pvHospDto.hospitalCode!}</td>
+                         <td>${pvHospDto.days!}</td>
+                         <td>${pvHospDto.pvCnt!}</td>
+                     </tr>
+                 </#list>
+                        </table>
+                    </th>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>合计</td>
+                            </tr>
+                 <#list pvHospSumDto ! as pvHospSumDto>
+                     <tr>
+                         <td>${pvHospSumDto.hospitalCode!}</td>
+                         <td>${pvHospSumDto.pvSum!}</td>
+                     </tr>
+                 </#list>
+                        </table>
+                    </th>
+                </tr>
+            </table>
+
+        </th>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <th>每日情况</th>
+                    <th>医院统计</th>
+                </tr>
+                <tr>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>日期</td>
+                                <td>数量</td>
+                            </tr>
+                <#list uvHospDto ! as uvHospDto>
+                    <tr>
+                        <td>${uvHospDto.hospitalCode!}</td>
+                        <td>${uvHospDto.days!}</td>
+                        <td>${uvHospDto.uvCnt!}</td>
+                    </tr>
+                </#list>
+                        </table>
+                    </th>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>合计</td>
+                            </tr>
+                 <#list uvHospSumDto ! as uvHospSumDto>
+                     <tr>
+                         <td>${uvHospSumDto.hospitalCode!}</td>
+                         <td>${uvHospSumDto.uvSum!}</td>
+                     </tr>
+                 </#list>
+                        </table>
+                    </th>
+                </tr>
+            </table>
+        </th>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <th>每日情况</th>
+                    <th>医院统计</th>
+                </tr>
+                <tr>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>日期</td>
+                                <td>数量</td>
+                            </tr>
+                 <#list zzHospDto ! as zzHospDto>
+                     <tr>
+                         <td>${zzHospDto.hospitalCode!}</td>
+                         <td>${zzHospDto.days!}</td>
+                         <td>${zzHospDto.zzCnt!}</td>
+                     </tr>
+                 </#list>
+                        </table>
+                    </th>
+                    <th valign="top">
+                        <table valign="top" class="table">
+                            <tr>
+                                <td>医院名称</td>
+                                <td>合计</td>
+                            </tr>
+                 <#list zzHospSumDto ! as zzHospSumDto>
+                     <tr>
+                         <td>${zzHospSumDto.hospitalCode!}</td>
+                         <td>${zzHospSumDto.zzSum!}</td>
+                     </tr>
+                 </#list>
+                        </table>
+                    </th>
+                </tr>
+            </table>
+        </th>
+    </tr>
+</table>
+
+</body>
+</html>

+ 95 - 0
zzcx-service/src/main/resources/templates/index_lantong.ftl

@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>数据统计朗通</title>
+    <style type="text/css">
+        table
+        {
+            border-collapse: collapse;
+            margin: 0 auto;
+            text-align: center;
+        }
+        table td, table th
+        {
+            border: 1px solid #cad9ea;
+            color: #666;
+            height: 30px;
+        }
+        table thead th
+        {
+            background-color: #CCE8EB;
+            width: 100px;
+        }
+        table tr:nth-child(odd)
+        {
+            background: #fff;
+        }
+        table tr:nth-child(even)
+        {
+            background: #F5FAFA;
+        }
+    </style>
+</head>
+<body>
+<table valign="top" class="table">
+    <tr>
+        <th>
+            PV(点击数量) 合计: ${pvSum}
+        </th>
+        <th>
+            UV(用户数量) 合计: ${uvSum}
+        </th>
+        <th>
+            完成自诊量 合计: ${zzSum}
+        </th>
+    </tr>
+    <tr>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <td>日期</td>
+                    <td>数量</td>
+                </tr>
+                 <#list pvdto ! as pvdto>
+                     <tr>
+                         <td>${pvdto.days!}</td>
+                         <td>${pvdto.pvCnt!}</td>
+                     </tr>
+                 </#list>
+            </table>
+        </th>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <td>日期</td>
+                    <td>数量</td>
+                </tr>
+                <#list uvdto ! as uvdto>
+                    <tr>
+                        <td>${uvdto.days!}</td>
+                        <td>${uvdto.uvCnt!}</td>
+                    </tr>
+                </#list>
+            </table>
+        </th>
+        <th valign="top">
+            <table valign="top" class="table">
+                <tr>
+                    <td>日期</td>
+                    <td>数量</td>
+                </tr>
+                 <#list zzdto ! as zzdto>
+                     <tr>
+                         <td>${zzdto.days!}</td>
+                         <td>${zzdto.zzCnt!}</td>
+                     </tr>
+                 </#list>
+            </table>
+        </th>
+    </tr>
+
+</table>
+
+</body>
+</html>