Bläddra i källkod

公众号服务后台。

lighter 4 år sedan
incheckning
6eacb36930
65 ändrade filer med 2780 tillägg och 0 borttagningar
  1. 118 0
      .mvn/wrapper/MavenWrapperDownloader.java
  2. 103 0
      pom.xml
  3. 25 0
      src/main/java/thyyxxk/wxservice_server/WxserviceServerApplication.java
  4. 26 0
      src/main/java/thyyxxk/wxservice_server/config/CorsConfig.java
  5. 28 0
      src/main/java/thyyxxk/wxservice_server/config/TaskConfig.java
  6. 30 0
      src/main/java/thyyxxk/wxservice_server/config/exception/BizException.java
  7. 37 0
      src/main/java/thyyxxk/wxservice_server/config/exception/ExceptionEnum.java
  8. 33 0
      src/main/java/thyyxxk/wxservice_server/config/exception/GlobalExceptionHandler.java
  9. 38 0
      src/main/java/thyyxxk/wxservice_server/controller/assessments/Covid19AssessmentController.java
  10. 29 0
      src/main/java/thyyxxk/wxservice_server/controller/assessments/DepressionAssessmentController.java
  11. 168 0
      src/main/java/thyyxxk/wxservice_server/controller/wechat/WeChatOfficialController.java
  12. 39 0
      src/main/java/thyyxxk/wxservice_server/controller/wechat/WeChatRedirectController.java
  13. 39 0
      src/main/java/thyyxxk/wxservice_server/dao/assessments/Covid19AssessmentDao.java
  14. 23 0
      src/main/java/thyyxxk/wxservice_server/dao/assessments/DepressionAssessmentDao.java
  15. 144 0
      src/main/java/thyyxxk/wxservice_server/dao/wechat/WeChatOfficialDao.java
  16. 57 0
      src/main/java/thyyxxk/wxservice_server/impl/assessments/Covid19AssessmentImpl.java
  17. 35 0
      src/main/java/thyyxxk/wxservice_server/impl/assessments/DepressionAssessmentImpl.java
  18. 268 0
      src/main/java/thyyxxk/wxservice_server/impl/wechat/WeChatOfficialImpl.java
  19. 126 0
      src/main/java/thyyxxk/wxservice_server/impl/wechat/WxApiImpl.java
  20. 206 0
      src/main/java/thyyxxk/wxservice_server/impl/wechat/checkExam/CheckExamImpl.java
  21. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/HrgResponse.java
  22. 43 0
      src/main/java/thyyxxk/wxservice_server/pojo/XxkRet.java
  23. 31 0
      src/main/java/thyyxxk/wxservice_server/pojo/assessment/CovidPojo.java
  24. 32 0
      src/main/java/thyyxxk/wxservice_server/pojo/assessment/DepressionPojo.java
  25. 9 0
      src/main/java/thyyxxk/wxservice_server/pojo/assessment/RegionPojo.java
  26. 23 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/BindPatientIdParam.java
  27. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/CollectDoctorParam.java
  28. 16 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/DoctorInfoPojo.java
  29. 12 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/DoctorSourcesPojo.java
  30. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetDoctorSourcesParam.java
  31. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetSourcesByDateParam.java
  32. 11 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetZyFeeParam.java
  33. 15 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/InpatientInfo.java
  34. 13 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/JsApiSHA1.java
  35. 13 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/MzClassPojo.java
  36. 9 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/MzDeptPojo.java
  37. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/PrepaidPojo.java
  38. 11 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/SourcesByDatePojo.java
  39. 11 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/WeChatPayParam.java
  40. 15 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/ZyFee.java
  41. 10 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/CheckExamParam.java
  42. 35 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/ExamIndexResult.java
  43. 15 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/AntibioticResult.java
  44. 16 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/BacteriaResult.java
  45. 11 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ExamDetailResult.java
  46. 57 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ReportHeader.java
  47. 32 0
      src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ReportItem.java
  48. 43 0
      src/main/java/thyyxxk/wxservice_server/scheduled/GetWeChatAccessTokenSchedule.java
  49. 15 0
      src/main/java/thyyxxk/wxservice_server/service/assessments/Covid19AssessmentService.java
  50. 10 0
      src/main/java/thyyxxk/wxservice_server/service/assessments/DepressionAssessmentService.java
  51. 48 0
      src/main/java/thyyxxk/wxservice_server/service/wechat/WeChatOfficialService.java
  52. 12 0
      src/main/java/thyyxxk/wxservice_server/service/wechat/WxApiService.java
  53. 10 0
      src/main/java/thyyxxk/wxservice_server/service/wechat/checkExam/CheckExamService.java
  54. 14 0
      src/main/java/thyyxxk/wxservice_server/socket/ServletInitializer.java
  55. 15 0
      src/main/java/thyyxxk/wxservice_server/socket/WebSocketConfig.java
  56. 77 0
      src/main/java/thyyxxk/wxservice_server/socket/WebSocketServer.java
  57. 17 0
      src/main/java/thyyxxk/wxservice_server/utils/DecimalTool.java
  58. 44 0
      src/main/java/thyyxxk/wxservice_server/utils/HrgHttp.java
  59. 49 0
      src/main/java/thyyxxk/wxservice_server/utils/PropertiesUtil.java
  60. 89 0
      src/main/java/thyyxxk/wxservice_server/utils/Sign.java
  61. 95 0
      src/main/java/thyyxxk/wxservice_server/utils/SnowFlakeId.java
  62. 24 0
      src/main/resources/application.yml
  63. 133 0
      src/main/resources/logback-spring.xml
  64. 10 0
      src/main/resources/weChatOfficialAccounts.properties
  65. 13 0
      src/test/java/thyyxxk/wxservice_server/WxserviceServerApplicationTests.java

+ 118 - 0
.mvn/wrapper/MavenWrapperDownloader.java

@@ -0,0 +1,118 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+    private static final String WRAPPER_VERSION = "0.5.6";
+    /**
+     * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+     */
+    private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+            + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+    /**
+     * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+     * use instead of the default one.
+     */
+    private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+            ".mvn/wrapper/maven-wrapper.properties";
+
+    /**
+     * Path where the maven-wrapper.jar will be saved to.
+     */
+    private static final String MAVEN_WRAPPER_JAR_PATH =
+            ".mvn/wrapper/maven-wrapper.jar";
+
+    /**
+     * Name of the property which should be used to override the default download url for the wrapper.
+     */
+    private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+    public static void main(String args[]) {
+        System.out.println("- Downloader started");
+        File baseDirectory = new File(args[0]);
+        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+        // If the maven-wrapper.properties exists, read it and check if it contains a custom
+        // wrapperUrl parameter.
+        File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+        String url = DEFAULT_DOWNLOAD_URL;
+        if (mavenWrapperPropertyFile.exists()) {
+            FileInputStream mavenWrapperPropertyFileInputStream = null;
+            try {
+                mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+                Properties mavenWrapperProperties = new Properties();
+                mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+                url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+            } catch (IOException e) {
+                System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+            } finally {
+                try {
+                    if (mavenWrapperPropertyFileInputStream != null) {
+                        mavenWrapperPropertyFileInputStream.close();
+                    }
+                } catch (IOException e) {
+                    // Ignore ...
+                }
+            }
+        }
+        System.out.println("- Downloading from: " + url);
+
+        File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+        if (!outputFile.getParentFile().exists()) {
+            if (!outputFile.getParentFile().mkdirs()) {
+                System.out.println(
+                        "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+            }
+        }
+        System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+        try {
+            downloadFileFromURL(url, outputFile);
+            System.out.println("Done");
+            System.exit(0);
+        } catch (Throwable e) {
+            System.out.println("- Error downloading");
+            e.printStackTrace();
+            System.exit(1);
+        }
+    }
+
+    private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+            String username = System.getenv("MVNW_USERNAME");
+            char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+            Authenticator.setDefault(new Authenticator() {
+                @Override
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(username, password);
+                }
+            });
+        }
+        URL website = new URL(urlString);
+        ReadableByteChannel rbc;
+        rbc = Channels.newChannel(website.openStream());
+        FileOutputStream fos = new FileOutputStream(destination);
+        fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+        fos.close();
+        rbc.close();
+    }
+
+}

+ 103 - 0
pom.xml

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.3.5.RELEASE</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>thyyxxk</groupId>
+    <artifactId>wxservice-server</artifactId>
+    <version>0.8</version>
+    <name>wxservice-server</name>
+    <description>vue3 web server</description>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.sourceforge.jtds</groupId>
+            <artifactId>jtds</artifactId>
+            <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.59</version>
+        </dependency>
+        <dependency>
+            <groupId>org.dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>3.1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>3.1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 25 - 0
src/main/java/thyyxxk/wxservice_server/WxserviceServerApplication.java

@@ -0,0 +1,25 @@
+package thyyxxk.wxservice_server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@EnableTransactionManagement
+@EnableScheduling
+@SpringBootApplication
+
+// 测试地址:
+// 页面:192.168.200.3:8085
+// 服务端口: 8805
+
+// 正式地址:
+// 页面:192.168.200.3:8083
+// 服务端口: 8806
+public class WxserviceServerApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(WxserviceServerApplication.class, args);
+    }
+
+}

+ 26 - 0
src/main/java/thyyxxk/wxservice_server/config/CorsConfig.java

@@ -0,0 +1,26 @@
+package thyyxxk.wxservice_server.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+@Configuration
+public class CorsConfig {
+    private CorsConfiguration buildConfig() {
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
+        corsConfiguration.addAllowedOrigin("*");
+        corsConfiguration.addAllowedHeader("*");
+        corsConfiguration.addAllowedMethod("*");
+        corsConfiguration.setAllowCredentials(true);
+        return corsConfiguration;
+    }
+
+    @Bean
+    public CorsFilter corsFilter() {
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        source.registerCorsConfiguration("/**", buildConfig());
+        return new CorsFilter(source);
+    }
+}

+ 28 - 0
src/main/java/thyyxxk/wxservice_server/config/TaskConfig.java

@@ -0,0 +1,28 @@
+package thyyxxk.wxservice_server.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+@EnableAsync
+public class TaskConfig {
+
+    @Bean
+    public TaskExecutor taskExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(10);
+        executor.setMaxPoolSize(30);
+        executor.setQueueCapacity(50);
+        executor.setKeepAliveSeconds(60);
+        executor.setThreadNamePrefix("thread-bean-");
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        executor.setWaitForTasksToCompleteOnShutdown(true);
+        return executor;
+    }
+
+}

+ 30 - 0
src/main/java/thyyxxk/wxservice_server/config/exception/BizException.java

@@ -0,0 +1,30 @@
+package thyyxxk.wxservice_server.config.exception;
+
+public class BizException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    protected ExceptionEnum errorEnum;
+
+    public BizException() {
+        super();
+    }
+
+    public BizException(ExceptionEnum errorEnum) {
+        super(errorEnum.getMessage());
+        this.errorEnum = errorEnum;
+    }
+
+    public BizException(ExceptionEnum errorEnum, Throwable cause) {
+        super(errorEnum.getMessage(), cause);
+        this.errorEnum = errorEnum;
+    }
+
+    @Override
+    public Throwable fillInStackTrace() {
+        return this;
+    }
+
+    public ExceptionEnum getErrorEnum() {
+        return this.errorEnum;
+    }
+}

+ 37 - 0
src/main/java/thyyxxk/wxservice_server/config/exception/ExceptionEnum.java

@@ -0,0 +1,37 @@
+package thyyxxk.wxservice_server.config.exception;
+
+public enum ExceptionEnum {
+    SUCCESS(200, "成功。"),
+    // 以下是需要消息提示的错误
+    INTERNAL_SERVER_ERROR(1001, "服务器内部错误!"),
+    NULL_POINTER(1002, "空指针异常!"),
+    NETWORK_ERROR(1003, "网络异常!"),
+    // 以下是需要弹窗提示的错误
+    LOGICAL_ERROR(2001, ""),
+    // 以下是需要弹窗提示并且重定向到登录页面
+    TOKEN_ERROR(3001, "令牌错误,请重新登录!"),
+    USER_NOT_EXIST(3002, "用户不存在,请重新登录!"),
+    INVALID_PASSWORD(3003, "密码错误,请重新登录!"),
+    // 以下是不需要提示的错误
+    SLIGHTLY_ERROR(4001, "未知错误!");
+
+    private final int code;
+    private String message;
+
+    ExceptionEnum(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}

+ 33 - 0
src/main/java/thyyxxk/wxservice_server/config/exception/GlobalExceptionHandler.java

@@ -0,0 +1,33 @@
+package thyyxxk.wxservice_server.config.exception;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+
+@Slf4j
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+    @ExceptionHandler(value = BizException.class)
+    @ResponseBody
+    public XxkRet bizExceptionHandler(BizException e){
+        e.printStackTrace();
+        return XxkRet.fail(e.getErrorEnum());
+    }
+
+    @ExceptionHandler(value = NullPointerException.class)
+    @ResponseBody
+    public XxkRet exceptionHandler(NullPointerException e){
+        e.printStackTrace();
+        return XxkRet.fail(ExceptionEnum.NULL_POINTER);
+    }
+
+    @ExceptionHandler(value = Exception.class)
+    @ResponseBody
+    public XxkRet exceptionHandler(Exception e){
+        e.printStackTrace();
+        return XxkRet.fail(ExceptionEnum.INTERNAL_SERVER_ERROR);
+    }
+}

+ 38 - 0
src/main/java/thyyxxk/wxservice_server/controller/assessments/Covid19AssessmentController.java

@@ -0,0 +1,38 @@
+package thyyxxk.wxservice_server.controller.assessments;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+import thyyxxk.wxservice_server.service.assessments.Covid19AssessmentService;
+
+@RestController
+@RequestMapping("/covid19Assessment")
+public class Covid19AssessmentController {
+    private final Covid19AssessmentService service;
+
+    @Autowired
+    public Covid19AssessmentController(Covid19AssessmentService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/getPatientInfo")
+    public XxkRet getPatientInfo(@RequestParam("patientId") String patientId) {
+        return service.getPatientInfo(patientId);
+    }
+
+    @GetMapping("/getRegionProvince")
+    public XxkRet getRegionProvince() {
+        return service.getRegionProvince();
+    }
+
+    @GetMapping("/getChildRegion")
+    public XxkRet getChildRegion(@RequestParam("parentCode") Integer parentCode) {
+        return service.getChildRegion(parentCode);
+    }
+
+    @PostMapping("/submit")
+    public XxkRet submit(@RequestBody CovidPojo pojo) {
+        return service.submit(pojo);
+    }
+}

+ 29 - 0
src/main/java/thyyxxk/wxservice_server/controller/assessments/DepressionAssessmentController.java

@@ -0,0 +1,29 @@
+package thyyxxk.wxservice_server.controller.assessments;
+
+import org.springframework.beans.factory.annotation.Autowired;
+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.RestController;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.DepressionPojo;
+import thyyxxk.wxservice_server.service.assessments.DepressionAssessmentService;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping("/depressionAssessment")
+public class DepressionAssessmentController {
+    private final DepressionAssessmentService service;
+
+    @Autowired
+    public DepressionAssessmentController(DepressionAssessmentService service) {
+        this.service = service;
+    }
+
+    @PostMapping("/submit")
+    public XxkRet submit(HttpServletRequest request, @RequestBody DepressionPojo pojo) {
+        return service.submit(request, pojo);
+    }
+
+}

+ 168 - 0
src/main/java/thyyxxk/wxservice_server/controller/wechat/WeChatOfficialController.java

@@ -0,0 +1,168 @@
+package thyyxxk.wxservice_server.controller.wechat;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.*;
+import thyyxxk.wxservice_server.pojo.wechat.checkExam.CheckExamParam;
+import thyyxxk.wxservice_server.service.wechat.WeChatOfficialService;
+import thyyxxk.wxservice_server.service.wechat.WxApiService;
+import thyyxxk.wxservice_server.service.wechat.checkExam.CheckExamService;
+
+import javax.servlet.http.HttpServletRequest;
+
+@Slf4j
+@RestController
+@RequestMapping("/wechat")
+public class WeChatOfficialController {
+    private final WeChatOfficialService service;
+    private final CheckExamService checkExamService;
+    private final WxApiService wxApiService;
+
+    @Autowired
+    public WeChatOfficialController(WeChatOfficialService service, CheckExamService checkExamService, WxApiService payService) {
+        this.service = service;
+        this.checkExamService = checkExamService;
+        this.wxApiService = payService;
+    }
+
+    @GetMapping("/getOpenId")
+    public XxkRet getOpenId(@RequestParam("code") String code) {
+        return service.getOpenId(code);
+    }
+
+    @GetMapping("/getPatientIdByOpenId")
+    public XxkRet getPatientIdByOpenId(@RequestParam("openId") String openId) {
+        return service.getPatientIdByOpenId(openId);
+    }
+
+    @PostMapping("/bindPatientId")
+    public XxkRet bindPatientId(@RequestBody BindPatientIdParam param) {
+        return service.bindPatientId(param);
+    }
+
+    @GetMapping("/setDefaultCard")
+    public XxkRet setDefaultCard(@RequestParam("patientId") String patientId,
+                                 @RequestParam("openId") String openId) {
+        return service.setDefaultCard(patientId, openId);
+    }
+
+    @PostMapping("/relieveBindCard")
+    public XxkRet relieveBindCard(@RequestBody BindPatientIdParam param) {
+        return service.relieveBindCard(param);
+    }
+
+    @PostMapping("/relieveBindCardButCanceled")
+    public void relieveBindCardButCanceled(@RequestBody BindPatientIdParam param) {
+        final String logInfo = String.format("【 姓名:%s,就诊卡号:%s,手机:%s 】",
+                param.getName(), param.getPatientId(), param.getPhone());
+        log.info("点击了解除绑定,但是选择了取消:{}", logInfo);
+    }
+
+    @GetMapping("/getAllDepartments")
+    public XxkRet getAllDepartments() {
+        return service.getAllDepartments();
+    }
+
+    @PostMapping("/getSourcesByDate")
+    public XxkRet getSourcesByDate(@RequestBody GetSourcesByDateParam param) {
+        return service.getSourcesByDate(param);
+    }
+
+    @PostMapping("/getDoctorSources")
+    public XxkRet getDoctorSources(@RequestBody GetDoctorSourcesParam param) {
+        return service.getDoctorSources(param);
+    }
+
+    @PostMapping("/getDoctorArrangement")
+    public XxkRet getDoctorArrangement(@RequestBody GetDoctorSourcesParam param) {
+        return service.getDoctorArrangement(param);
+    }
+
+    @GetMapping("/getDoctorInfo")
+    public XxkRet getDoctorInfo(@RequestParam("doctorCode") String doctorCode,
+                                @RequestParam("openId") String openId) {
+        return service.getDoctorInfo(doctorCode, openId);
+    }
+
+    @PostMapping("/getSourcesByDateAndDoctor")
+    public XxkRet getSourcesByDateAndDoctor(@RequestBody GetDoctorSourcesParam param) {
+        return service.getSourcesByDateAndDoctor(param);
+    }
+
+    @GetMapping("/hasDoneCovidAssessment")
+    public XxkRet hasDoneCovidAssessment(@RequestParam("patientId") String patientId) {
+        return service.hasDoneCovidAssessment(patientId);
+    }
+
+    @PostMapping("/checkExamIndex")
+    public XxkRet checkExamIndex(@RequestBody CheckExamParam param) {
+        return checkExamService.getExamIndex(param);
+    }
+
+    @GetMapping("/checkExamDetail")
+    public XxkRet checkExamDetail(@RequestParam("orderId") String orderId) {
+        return checkExamService.getExamDetail(orderId);
+    }
+
+    @PostMapping("/collectDoctor")
+    public XxkRet collectDoctor(@RequestBody CollectDoctorParam param) {
+        return service.collectDoctor(param);
+    }
+
+    @PostMapping("/disCollectDoctor")
+    public XxkRet disCollectDoctor(@RequestBody CollectDoctorParam param) {
+        return service.disCollectDoctor(param);
+    }
+
+    @GetMapping("/getMyCollections")
+    public XxkRet getMyCollections(@RequestParam("openId") String openId) {
+        return service.getMyCollections(openId);
+    }
+
+    @GetMapping("/getDoctorQrCode")
+    public XxkRet getDoctorQrCode(@RequestParam("doctorCode") String doctorCode) {
+        return service.getDoctorQrCode(doctorCode);
+    }
+
+    @PostMapping("/createPayOrder")
+    public XxkRet createPayOrder(HttpServletRequest request, @RequestBody WeChatPayParam param) {
+        param.setClientIp(request.getRemoteAddr());
+        return wxApiService.createPayOrder(param);
+    }
+
+    @GetMapping("/getJsApiSHA1")
+    public XxkRet getJsapiSHA1Sign(@RequestParam("url") String url) {
+        JsApiSHA1 data = new JsApiSHA1();
+        data.setUrl(url);
+//        data.setUrl("staticweb.hnthyy.cn/wxService");
+        return wxApiService.getJsapiSHA1Sign(data);
+    }
+
+    @GetMapping("/getUnPaidFee")
+    public XxkRet getUnPaidFee(@RequestParam("patientId") String patientId) {
+        return service.getUnPaidFee(patientId);
+    }
+
+    @GetMapping("/getUnPaidDetail")
+    public XxkRet getUnPaidDetail(@RequestParam("patientId") String patientId,
+                                  @RequestParam("hisOrdNum") String hisOrdNum) {
+        return service.getUnPaidDetail(patientId, hisOrdNum);
+    }
+
+    @GetMapping("/getInpatientInfo")
+    public XxkRet getInpatientInfo(String patientId) {
+        return service.getInpatientInfo(patientId);
+    }
+
+    @PostMapping("/getZyFees")
+    public XxkRet getZyFees(@RequestBody GetZyFeeParam param) {
+        return service.getZyFees(param);
+    }
+
+    @GetMapping("/getPrepaidHistory")
+    public XxkRet getPrepaidHistory(String patientId) {
+        return service.getPrepaidHistory(patientId);
+    }
+}

+ 39 - 0
src/main/java/thyyxxk/wxservice_server/controller/wechat/WeChatRedirectController.java

@@ -0,0 +1,39 @@
+package thyyxxk.wxservice_server.controller.wechat;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@RestController
+@RequestMapping("/redirect")
+public class WeChatRedirectController {
+    @GetMapping("/echo")
+    public String echo(@RequestParam("signature") String signature,
+                       @RequestParam("timestamp") String timestamp,
+                       @RequestParam("nonce") String nonce,
+                       @RequestParam("echostr") String echostr) {
+        return echostr;
+    }
+
+    @GetMapping("/page")
+    public void redirectRequest(@RequestParam("code") String code, HttpServletResponse response){
+        try {
+            response.sendRedirect("http://staticweb.hnthyy.cn/wxService/" + code); // 线上
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @GetMapping("/devpage")
+    public void redirectRequestDev(@RequestParam("code") String code, HttpServletResponse response){
+        try {
+            response.sendRedirect("http://192.168.3.20:8081/wxService/" + code); // 测试
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 39 - 0
src/main/java/thyyxxk/wxservice_server/dao/assessments/Covid19AssessmentDao.java

@@ -0,0 +1,39 @@
+package thyyxxk.wxservice_server.dao.assessments;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+import thyyxxk.wxservice_server.pojo.assessment.RegionPojo;
+
+import java.util.List;
+
+@Mapper
+public interface Covid19AssessmentDao {
+
+    @Select("select rtrim(social_no) idcard,rtrim(phone_no) phone,rtrim(name) name " +
+            "from mz_patient_mi where patient_id=#{patientId}")
+    CovidPojo getPatientInfo(@Param("patientId") String patientId);
+
+    @Select("select top 1 rtrim(patient_id) from mz_patient_mi where social_no=#{idcard} order by lv_date desc")
+    String getPatientId(@Param("idcard") String idcard);
+
+    @Select("select code, name from t_region where level=1 and del_flag=0 order by code")
+    List<RegionPojo> getRegionProvince();
+
+    @Select("select code, name from t_region where parent_code=#{parentCode} and del_flag=0 order by code")
+    List<RegionPojo> getChildRegion(@Param("parentCode") Integer parentCode);
+
+    @Select("select top 1 datediff(day, date, getdate()) from t_covid19_assessment " +
+            "where idcard=#{idcard} or patient_id=#{patientId} order by date desc")
+    Integer getDateDiff(@Param("idcard") String idcard, @Param("patientId") String patientId);
+
+    @Insert("insert into t_covid19_assessment (name, phone, idcard, temperature, fever_number, " +
+            "date, item1, item2, item3, item4, item5, symptoms, addr_province, addr_city, addr_district, " +
+            "addr_additional, patient_id) values " +
+            "(#{name},#{phone},#{idcard},#{temperature},#{feverNumber},#{date},#{item1}," +
+            "#{item2},#{item3},#{item4},#{item5},#{symptomsString},#{addrProvince},#{addrCity}," +
+            "#{addrDistrict},#{addrAdditional},#{patientId})")
+    void insertNewCovid19Assessment(CovidPojo pojo);
+}

+ 23 - 0
src/main/java/thyyxxk/wxservice_server/dao/assessments/DepressionAssessmentDao.java

@@ -0,0 +1,23 @@
+package thyyxxk.wxservice_server.dao.assessments;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.wxservice_server.pojo.assessment.DepressionPojo;
+
+@Mapper
+public interface DepressionAssessmentDao {
+
+    @Select("select top 1 datediff(day, date, getdate()) from " +
+            "t_depression_assessment where idcard=#{idcard} order by id desc")
+    Integer getDateDiff(@Param("idcard") String idcard);
+
+    @Insert("insert into t_depression_assessment (name, phone, idcard, item1, item2, item3, item4, " +
+            "item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, " +
+            "item16, item17, item18, item19, item20, score, note, date) " +
+            "values (#{name}, #{phone}, #{idcard}, #{item1}, #{item2}, #{item3}, #{item4}, #{item5}, " +
+            "#{item6}, #{item7}, #{item8}, #{item9}, #{item10}, #{item11}, #{item12}, #{item13}, #{item14}, " +
+            "#{item15}, #{item16}, #{item17}, #{item18}, #{item19}, #{item20}, #{score}, #{note}, getDate())")
+    void insertNewDepressionAssessment(DepressionPojo pojo);
+}

+ 144 - 0
src/main/java/thyyxxk/wxservice_server/dao/wechat/WeChatOfficialDao.java

@@ -0,0 +1,144 @@
+package thyyxxk.wxservice_server.dao.wechat;
+
+import org.apache.ibatis.annotations.*;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+import thyyxxk.wxservice_server.pojo.wechat.*;
+
+import java.util.List;
+
+@Mapper
+public interface WeChatOfficialDao {
+    @Select("select name, patient_id, phone, is_default from t_wechat_patient_bind where open_id=#{openId} and del_flag=0")
+    List<BindPatientIdParam> getBindPatientCard(@Param("openId") String openId);
+
+    @Select("select rtrim(name) name, rtrim(patient_id) patientId, rtrim(social_no) socialNo, " +
+            "convert(varchar(10), lv_date, 21) lvDate " +
+            "from mz_patient_mi where patient_id=#{cardNo}")
+    List<BindPatientIdParam> getPatientBaseInfoByPatientId(@Param("cardNo") String cardNo);
+
+    @Select("select rtrim(name) name, rtrim(patient_id) patientId, rtrim(social_no) socialNo, " +
+            "convert(varchar(10), lv_date, 21) lvDate " +
+            "from mz_patient_mi where social_no=#{cardNo}")
+    List<BindPatientIdParam> getPatientBaseInfoBySocialNo(@Param("cardNo") String cardNo);
+
+    @Select("select count(1) from t_wechat_patient_bind where patient_id=#{patientId} and open_id=#{openId}")
+    Integer isThisCardBindBefore(@Param("patientId") String patientId, @Param("openId") String openId);
+
+    @Select("select count(1) from t_wechat_patient_bind where open_id=#{openId} and del_flag=0")
+    Integer validBindCount(@Param("openId") String openId);
+
+    @Insert("insert into t_wechat_patient_bind " +
+            "(name, patient_id, social_no, phone, province, city, district, street, open_id, del_flag, is_default) " +
+            "values (#{name}, #{patientId}, #{socialNo}, #{phone}, #{province}, #{city}, " +
+            "#{district}, #{street}, #{openId}, 0, #{isDefault})")
+    void bindPatientCard(BindPatientIdParam param);
+
+    @Select("update t_wechat_patient_bind set is_default=#{isDefault} where " +
+            "open_id=#{openId} and patient_id like #{patientId}")
+    void updateDefaultCard(@Param("patientId") String patientId,
+                             @Param("openId") String openId,
+                             @Param("isDefault") int isDefault);
+
+    @Update("update t_wechat_patient_bind set del_flag=0,name=#{name},phone=#{phone}, " +
+            "province=#{province}, city=#{city}, district=#{district}, street=#{street} " +
+            "where patient_id=#{patientId} and open_id=#{openId}")
+    void bindPatientCardAgain(BindPatientIdParam param);
+
+    @Delete("update t_wechat_patient_bind set del_flag=1 where patient_id=#{patientId} and open_id=#{openId}")
+    void unBindPatientCard(@Param("patientId") String patientId, @Param("openId") String openId);
+
+    @Select("select rtrim(code) id, rtrim(name) text from zd_mz_class")
+    List<MzClassPojo> getAllMzClasses();
+
+    @Select("select rtrim(code) id, rtrim(name) text from zd_unit_code where mz_class=#{mzClass}")
+    List<MzDeptPojo> getMzDeptsByMzClass(@Param("mzClass") String mzClass);
+
+    @Select("select " +
+            "rtrim(a.code) doctorCode, " +
+            "rtrim(a.name) doctorName, " +
+            "rtrim(b.name) doctorTitle, " +
+            "rtrim(a.dept_code) deptCode, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dept_code), " +
+            "specialty=c.specialty, " +
+            "introduction=c.emp_comment, " +
+            "portrait=(select image_base64 from a_employee_image where code=a.code), " +
+            "collected=(select count(1) from t_wechat_patient_collection where " +
+            "doctor_code=#{doctorCode} and open_id=#{openId}) " +
+            "from a_employee_mi a, zd_emp_title b, a_employee_comment c " +
+            "where a.code=#{doctorCode} and " +
+            "a.emp_tit_code=b.code and " +
+            "b.tit_grade =1 and " +
+            "a.code not in ('00000', '00026') and " +
+            "isnull(a.del_flag,0)<>1 and " +
+            "a.code=c.code")
+    DoctorInfoPojo getDoctorInfo(@Param("doctorCode") String doctorCode, @Param("openId") String openId);
+
+    @Select("select top 1 * from t_covid19_assessment where patient_id=#{patientId} and " +
+            "datediff(day, date, getdate()) <= 3 order by date desc")
+    CovidPojo validCovidAssessment(@Param("patientId") String patientId);
+
+    @Insert("insert into t_wechat_patient_collection (open_id, doctor_code, dept_code)" +
+            " values (#{openId},#{doctorCode},#{deptCode})")
+    void collectDoctor(CollectDoctorParam param);
+
+    @Delete("delete from t_wechat_patient_collection where open_id=#{openId} and doctor_code=#{doctorCode}")
+    void disCollectDoctor(CollectDoctorParam param);
+
+    @Select("select " +
+            "rtrim(a.code) doctorCode, " +
+            "rtrim(a.name) doctorName, " +
+            "rtrim(b.name) doctorTitle, " +
+            "rtrim(a.dept_code) deptCode, " +
+            "deptName=(select rtrim(name) from zd_unit_code where code=a.dept_code), " +
+            "portrait=(select image_base64 from a_employee_image where code=a.code) " +
+            "from a_employee_mi a, zd_emp_title b, a_employee_comment c, t_wechat_patient_collection d " +
+            "where d.open_id=#{openId} and " +
+            "a.code=d.doctor_code and " +
+            "a.emp_tit_code=b.code and " +
+            "b.tit_grade =1 and " +
+            "a.code not in ('00000', '00026') and " +
+            "isnull(a.del_flag,0)<>1 and " +
+            "a.code=c.code")
+    List<DoctorInfoPojo> getCollections(@Param("openId") String openId);
+
+    @Select("select rtrim(code_rs) from a_employee_mi where code=#{code}")
+    String getCodeRsByCode(@Param("code") String code);
+
+    @Select("select rtrim(a.inpatient_no) inpatientNo, " +
+            "rtrim(b.name) name, " +
+            "a.admiss_times, " +
+            "convert(varchar(10), admiss_date, 21) admissDate, " +
+            "rtrim(d.name) deptName, " +
+            "doctorName=(select rtrim(name) from a_employee_mi where code=isnull(a.refer_physician,a.admiss_physician)), " +
+            "rtrim(c.total_charge) totalCharge, " +
+            "rtrim(c.last_balance) lastBalance " +
+            "from zy_actpatient a, a_patient_mi b, zy_ledger_file c, zd_unit_code d " +
+            "where a.inpatient_no=b.inpatient_no and " +
+            "a.inpatient_no=c.inpatient_no and " +
+            "a.admiss_times=c.admiss_times and " +
+            "d.code=a.small_dept and " +
+            "b.mz_no=#{patientId} ")
+    InpatientInfo getInpatientInfo(@Param("patientId") String patientId);
+
+
+    @Update("execute zy_receive_drug #{inpatientNo} , #{admissTimes} , 1 , '0'")
+    void receiveMedicineFees(@Param("inpatientNo") String inpatientNo,
+                             @Param("admissTimes") Integer admissTimes);
+
+    @Update("execute zy_receive_one #{inpatientNo} , #{admissTimes} , 1 , '0' ")
+    void receiveProjectFees(@Param("inpatientNo") String inpatientNo,
+                            @Param("admissTimes") Integer admissTimes);
+
+    @Select("exec p_zz_zyfy_cx #{inpatientNo}, #{admissTimes}, null, 1, '', #{start}, #{end}")
+    List<ZyFee> getZyFees(GetZyFeeParam param);
+
+    @Select("select " +
+            "depo_times, " +
+            "convert(varchar(19), depo_date, 21) depoDate, " +
+            "rtrim(depo_amount) depoAmount  " +
+            "from zy_deposit_file " +
+            "where inpatient_no=#{inpatientNo} and " +
+            "admiss_times=#{admissTimes}")
+    List<PrepaidPojo> getPrepaidHistory(@Param("inpatientNo") String inpatientNo,
+                                        @Param("admissTimes") Integer admissTimes);
+}

+ 57 - 0
src/main/java/thyyxxk/wxservice_server/impl/assessments/Covid19AssessmentImpl.java

@@ -0,0 +1,57 @@
+package thyyxxk.wxservice_server.impl.assessments;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.wxservice_server.dao.assessments.Covid19AssessmentDao;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+import thyyxxk.wxservice_server.service.assessments.Covid19AssessmentService;
+
+@Slf4j
+@Service
+public class Covid19AssessmentImpl implements Covid19AssessmentService {
+    private final Covid19AssessmentDao dao;
+
+    @Autowired
+    public Covid19AssessmentImpl(Covid19AssessmentDao dao) {
+        this.dao = dao;
+    }
+
+    @Override
+    public XxkRet getPatientInfo(String patientId) {
+        return XxkRet.success(dao.getPatientInfo(patientId));
+    }
+
+    @Override
+    public XxkRet getRegionProvince() {
+        return XxkRet.success(dao.getRegionProvince());
+    }
+
+    @Override
+    public XxkRet getChildRegion(Integer parentCode) {
+        return XxkRet.success(dao.getChildRegion(parentCode));
+    }
+
+    @Override
+    public XxkRet submit(CovidPojo covidPojo) {
+        log.info("新冠感染流行病史问卷:{}", covidPojo);
+        if (null == covidPojo.getPatientId()) {
+            final String patientId = dao.getPatientId(covidPojo.getIdcard());
+            log.info("根据身份证获取病人id: {}, {}", covidPojo.getIdcard(), patientId);
+            if (null == patientId) {
+                covidPojo.setPatientId("");
+            } else {
+                covidPojo.setPatientId(patientId);
+            }
+        }
+        Integer dateDiff = dao.getDateDiff(covidPojo.getIdcard(), covidPojo.getPatientId());
+        if (null == dateDiff || dateDiff > 0) {
+            dao.insertNewCovid19Assessment(covidPojo);
+            return XxkRet.success();
+        } else {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "您今天已提交过此问卷,请明天再试。");
+        }
+    }
+}

+ 35 - 0
src/main/java/thyyxxk/wxservice_server/impl/assessments/DepressionAssessmentImpl.java

@@ -0,0 +1,35 @@
+package thyyxxk.wxservice_server.impl.assessments;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.wxservice_server.dao.assessments.DepressionAssessmentDao;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.DepressionPojo;
+import thyyxxk.wxservice_server.service.assessments.DepressionAssessmentService;
+
+import javax.servlet.http.HttpServletRequest;
+
+@Slf4j
+@Service
+public class DepressionAssessmentImpl implements DepressionAssessmentService {
+    private final DepressionAssessmentDao dao;
+
+    @Autowired
+    public DepressionAssessmentImpl(DepressionAssessmentDao dao) {
+        this.dao = dao;
+    }
+
+    @Override
+    public XxkRet submit(HttpServletRequest request, DepressionPojo depressionPojo) {
+        log.info("SDS抑郁自评量:{}", depressionPojo);
+        Integer dateDiff = dao.getDateDiff(depressionPojo.getIdcard());
+        if (null == dateDiff || dateDiff > 0) {
+            dao.insertNewDepressionAssessment(depressionPojo);
+            return XxkRet.success();
+        } else {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "您今天已提交过此问卷,请明天再试。");
+        }
+    }
+}

+ 268 - 0
src/main/java/thyyxxk/wxservice_server/impl/wechat/WeChatOfficialImpl.java

@@ -0,0 +1,268 @@
+package thyyxxk.wxservice_server.impl.wechat;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.dao.wechat.WeChatOfficialDao;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+import thyyxxk.wxservice_server.pojo.wechat.*;
+import thyyxxk.wxservice_server.service.wechat.WeChatOfficialService;
+import thyyxxk.wxservice_server.utils.DecimalTool;
+import thyyxxk.wxservice_server.utils.HrgHttp;
+import thyyxxk.wxservice_server.utils.PropertiesUtil;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Slf4j
+@Service
+public class WeChatOfficialImpl implements WeChatOfficialService {
+    private final WeChatOfficialDao dao;
+
+    @Autowired
+    public WeChatOfficialImpl(WeChatOfficialDao dao) {
+        this.dao = dao;
+    }
+
+    @Override
+    public XxkRet getOpenId(String code) {
+        RestTemplate template = new RestTemplate();
+        String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx19fc85fd5bfcc164&" +
+                "secret=ffdf6f4ae704d374966dfb82bc300257&code="+code+"&grant_type=authorization_code";
+        String str = template.getForObject(url, String.class);
+        JSONObject json = JSONObject.parseObject(str);
+        String openid = json.getString("openid");
+        if (openid != null) {
+            return XxkRet.success(openid);
+        } else {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, json.getString("errmsg"));
+        }
+    }
+
+    @Override
+    public XxkRet getPatientIdByOpenId(String openId) {
+        return XxkRet.success(dao.getBindPatientCard(openId));
+    }
+
+    @Override
+    public XxkRet bindPatientId(BindPatientIdParam param) {
+        log.info("绑定就诊卡:{}", param);
+        final List<BindPatientIdParam> list = param.getCardType() == 1 ?
+                dao.getPatientBaseInfoByPatientId(param.getCardNo())
+                : dao.getPatientBaseInfoBySocialNo(param.getCardNo());
+        if (null == list || list.isEmpty()) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到对应的就诊卡信息!");
+        } else {
+            HashMap<String, Object> map = new HashMap<>();
+            if (list.size() == 1) {
+                BindPatientIdParam temp = list.get(0);
+                if (param.getName().trim().equals(temp.getName())) {
+                    param.setPatientId(temp.getPatientId());
+                    param.setSocialNo(temp.getSocialNo());
+                    final int count = dao.isThisCardBindBefore(param.getPatientId(), param.getOpenId());
+                    if (count > 0) {
+                        dao.bindPatientCardAgain(param);
+                    } else {
+                        if (dao.validBindCount(param.getOpenId()) == 0) {
+                            param.setIsDefault(1);
+                        } else {
+                            param.setIsDefault(0);
+                        }
+                        dao.bindPatientCard(param);
+                    }
+                    map.put("code", 0);
+                    map.put("cards", dao.getBindPatientCard(param.getOpenId()));
+                    log.info("绑定就诊卡成功。");
+                    return XxkRet.success(map);
+                } else {
+                    return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "就诊卡姓名信息不匹配!");
+                }
+            } else {
+                map.put("code", 1);
+                map.put("cards", list);
+                log.info("绑定就诊卡: 身份证{} 有多张就诊卡:{}", param.getCardNo(), list);
+                return XxkRet.success(map);
+            }
+        }
+    }
+
+    @Override
+    public XxkRet setDefaultCard(String patientId, String openId) {
+        String temp = "%%";
+        dao.updateDefaultCard(temp, openId, 0);
+        temp = "%" + patientId + "%";
+        dao.updateDefaultCard(temp, openId, 1);
+        return XxkRet.success();
+    }
+
+    @Override
+    public XxkRet relieveBindCard(BindPatientIdParam param) {
+        log.info("解除就诊卡绑定:{}", param);
+        dao.unBindPatientCard(param.getPatientId(), param.getOpenId());
+        return XxkRet.success(dao.getBindPatientCard(param.getOpenId()));
+    }
+
+    @Override
+    public XxkRet getAllDepartments() {
+        List<MzClassPojo> mzClasses = dao.getAllMzClasses();
+        for (MzClassPojo mzClass : mzClasses) {
+            mzClass.setChildren(dao.getMzDeptsByMzClass(mzClass.getId()));
+        }
+        return XxkRet.success(mzClasses);
+    }
+
+    @Override
+    public XxkRet getSourcesByDate(GetSourcesByDateParam param) {
+        String url = String.format("http://webhis.thyy.cn:81/thmz/api/v1/getNumByDateAndDept?" +
+                "beginDate=%s&endDate=%s&unitCode=%s", param.getStart(), param.getEnd(), param.getDept());
+        return HrgHttp.getResponseFromHrg(url);
+    }
+
+    @Override
+    public XxkRet getDoctorSources(GetDoctorSourcesParam param) {
+        String url = String.format("http://webhis.thyy.cn:81/thmz/api/v1/getDoctorByDateAndDept?" +
+                "requestDay=%s&unitCode=%s", param.getDate(), param.getDeptCode());
+        return HrgHttp.getResponseFromHrg(url);
+    }
+
+    @Override
+    public XxkRet getDoctorArrangement(GetDoctorSourcesParam param) {
+        String url = String.format("http://webhis.thyy.cn:81/thmz/api/v1/getRequestByDateAndDeptAndDoctor?" +
+                "requestDay=%s&unitCode=%s&doctorCode=%s", param.getDate(), param.getDeptCode(), param.getDoctorCode());
+        return HrgHttp.getResponseFromHrg(url);
+    }
+
+    @Override
+    public XxkRet getDoctorInfo(String doctorCode, String openId) {
+        return XxkRet.success(dao.getDoctorInfo(doctorCode, openId));
+    }
+
+    @Override
+    public XxkRet getSourcesByDateAndDoctor(GetDoctorSourcesParam param) {
+        int[] source = new int[7];
+        source[0] = getDoctorArrangement(param).getCode();
+        Calendar calendar = Calendar.getInstance();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        for (int i = 1; i < 7; i++) {
+            calendar.add(Calendar.DATE, 1);
+            param.setDate(dateFormat.format(calendar.getTime()));
+            source[i] = getDoctorArrangement(param).getCode();
+        }
+        return XxkRet.success(source);
+    }
+
+    @Override
+    public XxkRet hasDoneCovidAssessment(String patientId) {
+        CovidPojo covid = dao.validCovidAssessment(patientId);
+        if (null == covid) {
+            return XxkRet.success("no valid assessment");
+        } else {
+            if (covid.getTemperature() == 2 ||
+                    covid.getItem1() != 14 ||
+                    covid.getItem2() != 24 ||
+                    covid.getItem3() != 32 ||
+                    covid.getItem4() != 42 ||
+                    covid.getItem5() != 52) {
+                return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "您新型冠状病毒感染流行病学史问卷未通过,请挂发热门诊。");
+            } else {
+                return XxkRet.success("valid assessment");
+            }
+        }
+    }
+
+    @Override
+    public XxkRet collectDoctor(CollectDoctorParam param) {
+        dao.collectDoctor(param);
+        return XxkRet.success();
+    }
+
+    @Override
+    public XxkRet disCollectDoctor(CollectDoctorParam param) {
+        dao.disCollectDoctor(param);
+        return XxkRet.success();
+    }
+
+    @Override
+    public XxkRet getMyCollections(String openId) {
+        return XxkRet.success(dao.getCollections(openId));
+    }
+
+    @Override
+    public XxkRet getDoctorQrCode(String doctorCode) {
+        final String token = PropertiesUtil.getProperty("qywxToken");
+        final String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=" + token +
+                "&userid=" + dao.getCodeRsByCode(doctorCode);
+        RestTemplate restTemplate = new RestTemplate();
+        final String result = restTemplate.getForObject(url, String.class);
+        JSONObject json = JSONObject.parseObject(result);
+        return XxkRet.success(json.getString("qr_code"));
+    }
+
+    @Override
+    public XxkRet getUnPaidFee(String patientId) {
+        String url = "http://webhis.thyy.cn:81/thmz/api/v1/getMzChargeDetailForUnPaid";
+        JSONObject obj = new JSONObject();
+        obj.put("patCardType", "1");
+        obj.put("patCardNo", patientId.trim());
+        return HrgHttp.postResponseFromHrg(url, obj);
+    }
+
+    @Override
+    public XxkRet getUnPaidDetail(String patientId, String hisOrdNum) {
+        String url = "http://webhis.thyy.cn:81/thmz/api/v1/getChargeDetailByHisOrdNum";
+        JSONObject obj = new JSONObject();
+        obj.put("patCardType", "1");
+        obj.put("patCardNo", patientId.trim());
+        obj.put("hisOrdNum", hisOrdNum.trim());
+        return HrgHttp.postResponseFromHrg(url, obj);
+    }
+
+    @Override
+    public XxkRet getInpatientInfo(String patientId) {
+        InpatientInfo info = dao.getInpatientInfo(patientId.trim());
+        if (null != info && null != info.getInpatientNo()) {
+            return XxkRet.success(info);
+        } else {
+            return XxkRet.fail(ExceptionEnum.NULL_POINTER, "没有找到此卡号的在院信息。");
+        }
+    }
+
+    @Override
+    public XxkRet getZyFees(GetZyFeeParam param) {
+        dao.receiveProjectFees(param.getInpatientNo(), param.getAdmissTimes());
+        dao.receiveMedicineFees(param.getInpatientNo(), param.getAdmissTimes());
+        Map<String, Object> map = new HashMap<>();
+        List<ZyFee> fees = dao.getZyFees(param);
+        map.put("fees", fees);
+        map.put("totalCost", getZyTotalCost(fees));
+        return XxkRet.success(map);
+    }
+
+    private String getZyTotalCost(List<ZyFee> fees) {
+        String total = "0.00";
+        if (null == fees || fees.isEmpty()) {
+            return total;
+        }
+        for (ZyFee fee : fees) {
+            total = DecimalTool.add(total, fee.getJe());
+        }
+        return total;
+    }
+
+    @Override
+    public XxkRet getPrepaidHistory(String patientId) {
+        InpatientInfo info = dao.getInpatientInfo(patientId.trim());
+        if (null != info && null != info.getInpatientNo()) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("baseInfo", info);
+            map.put("prepaid", dao.getPrepaidHistory(info.getInpatientNo(), info.getAdmissTimes()));
+            return XxkRet.success(map);
+        } else {
+            return XxkRet.fail(ExceptionEnum.NULL_POINTER, "没有找到此卡号的在院信息。");
+        }
+    }
+}

+ 126 - 0
src/main/java/thyyxxk/wxservice_server/impl/wechat/WxApiImpl.java

@@ -0,0 +1,126 @@
+package thyyxxk.wxservice_server.impl.wechat;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.JsApiSHA1;
+import thyyxxk.wxservice_server.pojo.wechat.WeChatPayParam;
+import thyyxxk.wxservice_server.service.wechat.WxApiService;
+import thyyxxk.wxservice_server.utils.PropertiesUtil;
+import thyyxxk.wxservice_server.utils.Sign;
+import thyyxxk.wxservice_server.utils.SnowFlakeId;
+
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.TreeMap;
+
+@Slf4j
+@Service
+public class WxApiImpl implements WxApiService {
+
+    @Override
+    public XxkRet getJsapiSHA1Sign(JsApiSHA1 data) {
+        data.setAppId(PropertiesUtil.getProperty("appId"));
+        data.setTicket(PropertiesUtil.getProperty("ticket"));
+        data.setNoncestr(SnowFlakeId.instance().nextId());
+        data.setTimestamp(String.valueOf(System.currentTimeMillis() / 1000));
+        String toSign = "jsapi_ticket=" + data.getTicket() + "&noncestr=" + data.getNoncestr() +
+                "&timestamp=" + data.getTimestamp() + "&url=" + data.getUrl();
+        data.setSignature(Sign.sha1Encode(toSign));
+        log.info("获取wxJsApi签名:{}", data);
+        return XxkRet.success(data);
+    }
+
+    @Override
+    public XxkRet createPayOrder(WeChatPayParam param) {
+        String appId = PropertiesUtil.getProperty("appId");
+        String merchantId = PropertiesUtil.getProperty("merchantId");
+        String tradeNo = SnowFlakeId.instance().nextId();
+        String nonceStr = SnowFlakeId.instance().nextId();
+        String notifyUrl = "http://www.hnthyy.cn";
+        TreeMap<String, String> map = new TreeMap<>();
+        map.put("appid", appId);
+        map.put("mch_id", merchantId);
+        map.put("device_info", "WEB");
+        map.put("body", param.getBody());
+        map.put("trade_type", "JSAPI");
+        map.put("nonce_str", nonceStr);
+        map.put("notify_url", notifyUrl);
+        map.put("out_trade_no", tradeNo);
+        map.put("total_fee", param.getTotalFee());
+        map.put("spbill_create_ip", param.getClientIp());
+        map.put("openid", param.getOpenId());
+        String sign = Sign.createSign(map);
+        String xml = "<xml>" +
+                "<appid>" + appId + "</appid>" +
+                "<body>" + param.getBody() + "</body>" +
+                "<device_info>WEB</device_info>" +
+                "<mch_id>" + merchantId + "</mch_id>" +
+                "<nonce_str>" + nonceStr + "</nonce_str>" +
+                "<notify_url>" + notifyUrl +"</notify_url>" +
+                "<openid>" + param.getOpenId() + "</openid>" +
+                "<out_trade_no>" + tradeNo + "</out_trade_no>" +
+                "<total_fee>" + param.getTotalFee() + "</total_fee>" +
+                "<spbill_create_ip>" + param.getClientIp() + "</spbill_create_ip>" +
+                "<trade_type>JSAPI</trade_type>" +
+                "<sign>" + sign + "</sign>" +
+                "</xml>";
+        String url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
+        String str = getRestTemplate().postForObject(url, xml, String.class);
+        try {
+            assert str != null;
+            Document document = DocumentHelper.parseText(str);
+            Element root = document.getRootElement();
+            if (root.element("return_code").getStringValue().equals("SUCCESS")) {
+
+                TreeMap<String, String> back = new TreeMap<>();
+                String time = Long.toString(System.currentTimeMillis());
+                back.put("appId", PropertiesUtil.getProperty("appId"));
+                back.put("timeStamp", time);
+                back.put("nonceStr", nonceStr);
+                back.put("package", "prepay_id=" + root.element("prepay_id").getStringValue());
+                back.put("signType", "MD5");
+                String sign2 = Sign.createSign(back);
+
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("appId", PropertiesUtil.getProperty("appId"));
+                jsonObject.put("timeStamp", time);
+                jsonObject.put("nonceStr", nonceStr);
+                jsonObject.put("package", "prepay_id=" + root.element("prepay_id").getStringValue());
+                jsonObject.put("signType", "MD5");
+                jsonObject.put("paySign", sign2);
+                jsonObject.put("totalFee", param.getTotalFee());
+                log.info("微信统一下单成功:{}", jsonObject);
+                return XxkRet.success(jsonObject);
+            } else {
+                final String message = root.element("return_msg").getStringValue();
+                log.info("微信统一下单失败:{}", message);
+                return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, message);
+            }
+        } catch (DocumentException e) {
+            e.printStackTrace();
+            return XxkRet.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, e.getMessage());
+        }
+    }
+
+    private RestTemplate getRestTemplate() {
+        RestTemplate restTemplate = new RestTemplate();
+        List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters();
+        for (HttpMessageConverter<?> httpMessageConverter : list) {
+            if(httpMessageConverter instanceof StringHttpMessageConverter) {
+                ((StringHttpMessageConverter) httpMessageConverter).setDefaultCharset(StandardCharsets.UTF_8);
+                break;
+            }
+        }
+        return restTemplate;
+    }
+}

+ 206 - 0
src/main/java/thyyxxk/wxservice_server/impl/wechat/checkExam/CheckExamImpl.java

@@ -0,0 +1,206 @@
+package thyyxxk.wxservice_server.impl.wechat.checkExam;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.springframework.stereotype.Service;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.checkExam.CheckExamParam;
+import thyyxxk.wxservice_server.pojo.wechat.checkExam.ExamIndexResult;
+import thyyxxk.wxservice_server.pojo.wechat.checkExam.detail.*;
+import thyyxxk.wxservice_server.service.wechat.checkExam.CheckExamService;
+
+import org.dom4j.*;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.*;
+
+@Slf4j
+@Service
+public class CheckExamImpl implements CheckExamService {
+
+    private static final String SOAP_URL = "http://172.16.32.178:622/pushservice.asmx?wsdl";
+
+    @Override
+    public XxkRet getExamIndex(CheckExamParam param) {
+        final int year = param.getYear();
+        final int month = param.getMonth();
+        final String start = year + "-" + month + "-01";
+        final String end = year + "-" + month + "-" + getMaxDaysOfOneMonth(year, month);
+        final String send =
+                "<message>" +
+                        "<PATIENT_TYPE>0</PATIENT_TYPE>" +
+                        "<PTNT_NO>" + param.getPatientId() + "</PTNT_NO>" +
+                        "<START_TIME>" + start + "</START_TIME>" +
+                        "<END_TIME>" + end + "</END_TIME>" +
+                        "</message>";
+        log.info("查询检验列表>>> {}", send);
+        String xml = invokeRemoteMethod("GetLabReportIndex", new Object[]{send});
+        return analyzeExamIndex(xml.substring(1, xml.length() - 1));
+    }
+
+    private int getMaxDaysOfOneMonth(int year, int month) {
+        int day = 1;
+        Calendar cal = Calendar.getInstance();
+        cal.set(year,month - 1, day);
+        return cal.getActualMaximum(Calendar.DATE);
+    }
+
+    @Override
+    public XxkRet getExamDetail(String orderId) {
+        if (orderId == null || orderId.trim().equals("") || orderId.trim().equals("undefined")) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "报告ID不能为空!");
+        }
+        String send = "<message><ORDR_ID>" + orderId + "</ORDR_ID></message>";
+        log.info("查询检验详细>>> {}", send);
+        String xml = invokeRemoteMethod("GetLabReport", new Object[]{send});
+        return analyzeExamDetail(xml.substring(1, xml.length() - 1));
+    }
+
+    private String invokeRemoteMethod(String operation, Object[] parameters) {
+        JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
+        Client client = dcf.createClient(SOAP_URL);
+        //处理webService接口和实现类namespace不同的情况,CXF动态客户端在处理此问题时,会报No operation was found with the name的异常
+        Endpoint endpoint = client.getEndpoint();
+        QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), operation);
+        BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
+        if (bindingInfo.getOperation(opName) == null) {
+            for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
+                if (operation.equals(operationInfo.getName().getLocalPart())) {
+                    opName = operationInfo.getName();
+                    break;
+                }
+            }
+        }
+        Object[] res = null;
+        try {
+            res = client.invoke(opName, parameters);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Arrays.toString(res);
+    }
+
+    private Element getReturnElement(String xml) {
+        try {
+            Document document = DocumentHelper.parseText(xml);
+            Element root = document.getRootElement();
+            return root.element("return");
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private XxkRet analyzeExamIndex(String xml) {
+        Element retEle = getReturnElement(xml);
+        if (retEle == null) {
+            return XxkRet.fail(ExceptionEnum.NETWORK_ERROR);
+        }
+        Element codeEl = retEle.element("Code");
+        String code = codeEl.getStringValue();
+        if (code.equals("1")) {
+            List<ExamIndexResult> examList = new ArrayList<>();
+            Element resEl = retEle.element("Result");
+            List<Element> reports = resEl.elements("ReportList");
+            reports.forEach(item -> {
+                ExamIndexResult pojo = new ExamIndexResult();
+                Field[] fields = pojo.getClass().getDeclaredFields();
+                for (Field field : fields) {
+                    try {
+                        field.setAccessible(true);
+                        String name = field.getName();
+                        Method m = pojo.getClass().getMethod("set" + name, String.class);
+                        m.invoke(pojo, item.elementTextTrim(name));
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                examList.add(pojo);
+            });
+            return XxkRet.success(examList);
+        } else {
+            Element errorMsgEl = retEle.element("ErrorMsg");
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, errorMsgEl.getStringValue());
+        }
+    }
+
+    private XxkRet analyzeExamDetail(String xml) {
+        Element retEle = getReturnElement(xml);
+        ExamDetailResult detail = new ExamDetailResult();
+
+        if (retEle == null) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "结果集为空!");
+        }
+
+        String code = retEle.elementTextTrim("Code");
+        if (code.equals("0")) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, retEle.elementTextTrim("ErrorMsg"));
+        }
+
+        Element reportListEle = retEle.element("Result").element("ReportList");
+        ReportHeader header = new ReportHeader();
+        detail.setReportHeader((ReportHeader) reflect(header, reportListEle.element("ReportHeader")));
+        log.info("写入ReportHeader>>> ok");
+        List<ReportItem> reportItems = new ArrayList<>();
+        List<Element> reportItemElements = reportListEle.elements("ReportItem");
+        reportItemElements.forEach(reportItemElement -> {
+            ReportItem reportItem = new ReportItem();
+            reflect(reportItem, reportItemElement);
+            List<Element> bacteriaResultElements = reportItemElement.elements("BacteriaResult");
+            if (bacteriaResultElements.size() > 0) {
+                List<BacteriaResult> bacteriaResults = new ArrayList<>();
+                bacteriaResultElements.forEach(bacterialResultElement -> {
+                    BacteriaResult bacteriaResult = new BacteriaResult();
+                    reflect(bacteriaResult, bacterialResultElement);
+                    List<Element> antibioticResultElements = bacterialResultElement.elements("AntibioticResult");
+                    if (antibioticResultElements.size() > 0) {
+                        List<AntibioticResult> antibioticResults = new ArrayList<>();
+                        antibioticResultElements.forEach(antibioticResultElement -> {
+                            AntibioticResult antibioticResult = new AntibioticResult();
+                            antibioticResults.add((AntibioticResult) reflect(antibioticResult, antibioticResultElement));
+                        });
+                        bacteriaResult.setAntibioticResults(antibioticResults);
+                        log.info("写入AntibioticResult>>> ok");
+                    }
+                    if (notNull(bacteriaResult.getBAC_ID()))
+                        bacteriaResults.add(bacteriaResult);
+                });
+                reportItem.setBacteriaResults(bacteriaResults);
+                log.info("写入BacteriaResult>>> ok");
+            }
+            if (notNull(reportItem.getITM_VALUE()) || notNull(reportItem.getITM_STR_VALUE())
+                    || reportItem.getBacteriaResults().size() > 0)
+                reportItems.add(reportItem);
+        });
+        detail.setReportItems(reportItems);
+        log.info("写入ReportItem>>> ok");
+        return XxkRet.success(detail);
+    }
+
+    private boolean notNull(String target) {
+        return target != null && !target.equals("");
+    }
+
+    private Object reflect(Object pojo, Element element) {
+        Field[] fields = pojo.getClass().getDeclaredFields();
+        for (Field field : fields) {
+            try {
+                String name = field.getName();
+                if (name.equals("bacteriaResults") || name.equals("antibioticResults"))
+                    continue;
+                Method m = pojo.getClass().getMethod("set" + name, String.class);
+                m.invoke(pojo, element.elementTextTrim(name));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return pojo;
+    }
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/HrgResponse.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo;
+
+import lombok.Data;
+
+@Data
+public class HrgResponse {
+    private Integer resultCode;
+    private String resultMessage;
+    private Object data;
+}

+ 43 - 0
src/main/java/thyyxxk/wxservice_server/pojo/XxkRet.java

@@ -0,0 +1,43 @@
+package thyyxxk.wxservice_server.pojo;
+
+import lombok.Data;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+
+@Data
+public class XxkRet {
+    private Integer code;
+    private String message;
+    private Object data;
+
+    public static XxkRet success() {
+        XxkRet ret = new XxkRet();
+        ret.setCode(0);
+        ret.setMessage("success");
+        ret.setData(null);
+        return ret;
+    }
+
+    public static XxkRet success(Object data) {
+        XxkRet ret = new XxkRet();
+        ret.setCode(0);
+        ret.setMessage("success");
+        ret.setData(data);
+        return ret;
+    }
+
+    public static XxkRet fail(ExceptionEnum exceptionEnum) {
+        XxkRet ret = new XxkRet();
+        ret.setCode(exceptionEnum.getCode());
+        ret.setMessage(exceptionEnum.getMessage());
+        ret.setData(null);
+        return ret;
+    }
+
+    public static XxkRet fail(ExceptionEnum exceptionEnum, String message) {
+        XxkRet ret = new XxkRet();
+        ret.setCode(exceptionEnum.getCode());
+        ret.setMessage(message);
+        ret.setData(null);
+        return ret;
+    }
+}

+ 31 - 0
src/main/java/thyyxxk/wxservice_server/pojo/assessment/CovidPojo.java

@@ -0,0 +1,31 @@
+package thyyxxk.wxservice_server.pojo.assessment;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class CovidPojo {
+    private String patientId;
+    private String name;
+    private String phone;
+    private String idcard;
+    private Integer addrProvince;
+    private Integer addrCity;
+    private Integer addrDistrict;
+    private String addrAdditional;
+    private Integer temperature;
+    private String feverNumber;
+    private String date;
+    private Integer item1;
+    private Integer item2;
+    private Integer item3;
+    private Integer item4;
+    private Integer item5;
+    private List<Integer> symptoms;
+    private String symptomsString;
+
+    public String getSymptomsString() {
+        return null == symptoms ? "[]" : symptoms.toString();
+    }
+}

+ 32 - 0
src/main/java/thyyxxk/wxservice_server/pojo/assessment/DepressionPojo.java

@@ -0,0 +1,32 @@
+package thyyxxk.wxservice_server.pojo.assessment;
+
+import lombok.Data;
+
+@Data
+public class DepressionPojo {
+    private String name;
+    private String phone;
+    private String idcard;
+    private Integer item1;
+    private Integer item2;
+    private Integer item3;
+    private Integer item4;
+    private Integer item5;
+    private Integer item6;
+    private Integer item7;
+    private Integer item8;
+    private Integer item9;
+    private Integer item10;
+    private Integer item11;
+    private Integer item12;
+    private Integer item13;
+    private Integer item14;
+    private Integer item15;
+    private Integer item16;
+    private Integer item17;
+    private Integer item18;
+    private Integer item19;
+    private Integer item20;
+    private Integer score;
+    private String note;
+}

+ 9 - 0
src/main/java/thyyxxk/wxservice_server/pojo/assessment/RegionPojo.java

@@ -0,0 +1,9 @@
+package thyyxxk.wxservice_server.pojo.assessment;
+
+import lombok.Data;
+
+@Data
+public class RegionPojo {
+    private Integer code;
+    private String name;
+}

+ 23 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/BindPatientIdParam.java

@@ -0,0 +1,23 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class BindPatientIdParam {
+    private String openId;
+    private Integer relation; // 1:本人,2:他人
+    private String name;
+    private Integer cardType;
+    private String cardNo;
+    private String phone;
+    private Integer province;
+    private Integer city;
+    private Integer district;
+    private String street;
+
+    private Integer isDefault;
+
+    private String patientId;
+    private String socialNo;
+    private String lvDate;
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/CollectDoctorParam.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class CollectDoctorParam {
+    private String openId;
+    private String doctorCode;
+    private String deptCode;
+}

+ 16 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/DoctorInfoPojo.java

@@ -0,0 +1,16 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class DoctorInfoPojo {
+    private String doctorCode;
+    private String doctorName;
+    private String doctorTitle;
+    private String deptCode;
+    private String deptName;
+    private String specialty;
+    private String introduction;
+    private String portrait;
+    private Integer collected;
+}

+ 12 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/DoctorSourcesPojo.java

@@ -0,0 +1,12 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class DoctorSourcesPojo {
+    private String fee;
+    private String doctorCode;
+    private String doctorName;
+    private String doctorTitle;
+    private Integer leftNum;
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetDoctorSourcesParam.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class GetDoctorSourcesParam {
+    private String date;
+    private String deptCode;
+    private String doctorCode;
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetSourcesByDateParam.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class GetSourcesByDateParam {
+    private String start;
+    private String end;
+    private String dept;
+}

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/GetZyFeeParam.java

@@ -0,0 +1,11 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class GetZyFeeParam {
+    private String inpatientNo;
+    private Integer admissTimes;
+    private String start;
+    private String end;
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/InpatientInfo.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class InpatientInfo {
+    private String inpatientNo;
+    private Integer admissTimes;
+    private String admissDate;
+    private String name;
+    private String deptName;
+    private String doctorName;
+    private String totalCharge;
+    private String lastBalance;
+}

+ 13 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/JsApiSHA1.java

@@ -0,0 +1,13 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class JsApiSHA1 {
+    private String appId;
+    private String ticket;
+    private String noncestr;
+    private String timestamp;
+    private String url;
+    private String signature;
+}

+ 13 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/MzClassPojo.java

@@ -0,0 +1,13 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MzClassPojo {
+    // id,text,children 这样的字段命名是为了匹配 vant 的 van-tree-select 组件, MzDeptPojo里的命名也一样
+    private String id;
+    private String text;
+    private List<MzDeptPojo> children;
+}

+ 9 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/MzDeptPojo.java

@@ -0,0 +1,9 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class MzDeptPojo {
+    private String id;
+    private String text;
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/PrepaidPojo.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class PrepaidPojo {
+    private Integer depoTimes;
+    private String depoDate;
+    private String depoAmount;
+}

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/SourcesByDatePojo.java

@@ -0,0 +1,11 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class SourcesByDatePojo {
+    private Integer leftNum;
+    private Integer totalNum;
+    private String scheduleDate;
+    private Integer status;
+}

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/WeChatPayParam.java

@@ -0,0 +1,11 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class WeChatPayParam {
+    private String body;
+    private String openId = "oLxi7wLsKAekcp0-UEhFBOTW7iCk";
+    private String totalFee;
+    private String clientIp;
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/ZyFee.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.wechat;
+
+import lombok.Data;
+
+@Data
+public class ZyFee {
+    // 项目名称
+    private String xmmc;
+    // 单价
+    private String dj;
+    // 数量
+    private String sl;
+    // 金额
+    private String je;
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/CheckExamParam.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam;
+
+import lombok.Data;
+
+@Data
+public class CheckExamParam {
+    private String patientId;
+    private Integer year;
+    private Integer month;
+}

+ 35 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/ExamIndexResult.java

@@ -0,0 +1,35 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam;
+
+import lombok.Data;
+
+@Data
+public class ExamIndexResult {
+    // 报告ID
+    private String ORDR_ID;
+    // 病历号类型   0|1|3 -- 门诊号|住院号|体检号
+    private String PTNT_NO_TYPE;
+    // 患者姓名
+    private String PTNT_NAME;
+    // 患者性别
+    private String PTNT_SEX;
+    // 出生日期
+    private String PTNT_BIRTH;
+    // 年龄
+    private String PTNT_AGE;
+    // 样本编号
+    private String SAMPLE_NUMBER;
+    // 报告类别   1|2 -- 普通报告|微生物报告
+    private String INFO_TYPE;
+    // 报告录入时间
+    private String ORDR_CREATE_DATE;
+    // 患者类别   0|1|3 -- 门诊|住院|体检
+    private String PATIENT_TYPE;
+    // 患者编号
+    private String PTNT_ID;
+    // 身份证号
+    private String ID_CARD;
+    // 就诊卡号
+    private String IC_CARD;
+    // 检查目的
+    private String APLY_CTNT;
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/AntibioticResult.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam.detail;
+
+import lombok.Data;
+
+@Data
+public class AntibioticResult {
+    private String BAC_ID; // 细菌 ID --
+    private String ANTI_ID; // 抗菌药物 ID --
+    private String ANTI_NAME_UK; // 抗菌药物英文名 --
+    private String ANTI_NAME_CN; // 抗菌药物中文名
+    private String ANTI_ABB; // 抗菌药物编码 --
+    private String ANTI_MIC; // MIC 值
+    private String ANTI_VALUE; // 敏感性
+    private String ANTI_ORDR; // 抗菌药物顺序号
+}

+ 16 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/BacteriaResult.java

@@ -0,0 +1,16 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam.detail;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class BacteriaResult {
+    private String BAC_ID; // 细菌 ID --
+    private String BAC_NAME_UK; // 细菌英文名 --
+    private String BAC_NAME_CN; // 细菌中文名 --
+    private String BAC_ABB; // 细菌编码 --
+    private String IDEN_NO; // 鉴定号 --
+    private String ITM_CALG; // 项目类型 33 代表细菌鉴定
+    private List<AntibioticResult> antibioticResults;
+}

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ExamDetailResult.java

@@ -0,0 +1,11 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam.detail;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ExamDetailResult {
+    private ReportHeader reportHeader;
+    private List<ReportItem> reportItems;
+}

+ 57 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ReportHeader.java

@@ -0,0 +1,57 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam.detail;
+
+import lombok.Data;
+
+@Data
+public class ReportHeader {
+    // 报告ID
+    private String ORDR_ID;
+    // 报告类别   1|2|99 -- 普通报告|微生物报告|尚未审核的报告
+    private String INFO_TYPE;
+    // 申请时间
+    private String APLY_DATE;
+    // 报告录入时间
+    private String ORDR_CREATE_DATE;
+    // 审核时间
+    private String AUDT_TIME;
+    // 打印时间
+    private String PRNT_TIME;
+    // 审核状态   0|1 -- 未审核|已审核
+    private String AUDT_STATUS;
+    // 打印状态   0|1 -- 未打印|已打印
+    private String PRNT_STATUS;
+    // 样本编号
+    private String SMPL_NUM;
+    // 样本类型
+    private String SMPL_NAME;
+    // 检验者
+    private String TEST_USR_NAME;
+    // 录入者
+    private String ORDR_USR_NAME;
+    // 审核者
+    private String AUDT_USR_NAME;
+    // 打印者
+    private String PRNT_USR_NAME;
+    // 检查目的
+    private String APLY_CNTN;
+    // 报告备注
+    private String ORDR_REMARK;
+    //	样本条码号	--
+    private String 	APLY_FLOW_NUM;
+    //	急诊标志	0|1	--	普通|急诊
+    private String 	EMCY_MRK;
+    //	来源科室	--
+    private String 	DEPT_NAME;
+    private String 	EMPI; //	EMPI	--
+    private String 	ID_CARD; //	身份证号	--
+    private String 	IC_CARD; //	就诊卡号	--
+    private String 	PATIENT_TYPE; //	患者类别	同病历号类型
+    private String 	PTNT_NO; //	病历号	--
+    private String 	PTNT_NO_TYPE; //	病历号类型	0|1|2|3|4	--	门诊号|住院号|验单号|体检号|婚检号
+    private String 	PTNT_NAME; //	患者姓名	--
+    private String 	PTNT_SEX; //	患者性别	0|1|2|3	--	未填|男|女|未知性别
+    private String 	PTNT_BIRTH; //	出生日期	--
+    private String 	PTNT_AGE; //	年龄	--
+    private String 	PTNT_AGE_UNIT; //	年龄单位	0|1|2|3	--	岁|月|天|时
+    private String 	PTNT_BED_NO; //	PTNT_BED_NO	床号
+}

+ 32 - 0
src/main/java/thyyxxk/wxservice_server/pojo/wechat/checkExam/detail/ReportItem.java

@@ -0,0 +1,32 @@
+package thyyxxk.wxservice_server.pojo.wechat.checkExam.detail;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class ReportItem {
+    private String ITM_ID; // 检验项目ID
+    private String ITM_CODE; // 检验项目代码
+    private String ITM_NAME; // 检验项目名称
+    private String ITM_UNIT; // 计量单位
+    private String ITM_ORDR; // 顺序号
+    private String ITM_VALUE; // 定量及半定量的定量部分检验结果
+    private String ITM_SRC_VALUE; // 定量原始结果(仪器检测的原始记录)
+    private String RANGE_LOW; // 定量参考值低限
+    private String RANGE_HIGH; // 定量参考值高限
+    private String RANGE; // 定量参考值
+    private String ITM_ALERT; // 异常标记L|H 偏低|偏高
+    private String CRITICAL_LOW; // 危急值低限
+    private String CRITICAL_HIGH; // 危急值高限
+    private String CRITICAL; // 危急值范围
+    private String CRITICAL_ALERT; // 危急值标记 L|H 低于危急值下限|高于危急值上限
+    private String ITM_STR_VALUE; // 定性及描述性结果
+    private String RANGE_STR; // 定性、半定量描述部分及描述性参考值
+    private String RES_TYPE; // 结果类型 1|2|3|4 定量|半定量|定性|描述性
+    private String SRC_APLY_ID; // 来源申请项目 ID来源系统的申请项目ID
+    private String SRC_APLY_FLOW_NUM; // 来源申请单编号
+    private String MAP_CODE; // 检验项目输出对照码
+    private List<BacteriaResult> bacteriaResults = new ArrayList<>(); // 细菌鉴定结果
+}

+ 43 - 0
src/main/java/thyyxxk/wxservice_server/scheduled/GetWeChatAccessTokenSchedule.java

@@ -0,0 +1,43 @@
+package thyyxxk.wxservice_server.scheduled;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.wxservice_server.utils.PropertiesUtil;
+
+@Slf4j
+@Component
+public class GetWeChatAccessTokenSchedule {
+
+    @Scheduled(fixedRate = 6900 * 1000)
+    public void getAccessToken() {
+        RestTemplate restTemplate = new RestTemplate();
+        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&" +
+                "appid=wx19fc85fd5bfcc164&secret=ffdf6f4ae704d374966dfb82bc300257";
+        String httpRes = restTemplate.getForObject(url, String.class);
+        JSONObject json = JSONObject.parseObject(httpRes);
+        String token = json.getString("access_token");
+        log.info("获取微信公众号ACCESS_TOKEN: {}", token);
+        PropertiesUtil.writeAccessToken("access_token", token);
+
+        url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" +
+                PropertiesUtil.getProperty("access_token") + "&type=jsapi";
+        httpRes = restTemplate.getForObject(url, String.class);
+        json = JSONObject.parseObject(httpRes);
+        String ticket = json.getString("ticket");
+        log.info("获取微信公众号JSAPI票据: {}", ticket);
+        PropertiesUtil.writeAccessToken("ticket", ticket);
+
+
+        url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wwf0b23c8b36012b34&" +
+                "corpsecret=wpHuNePfiDyotmpXjy5hUYGF0w8Ks5OPHSQp22z8oBk";
+        httpRes = restTemplate.getForObject(url, String.class);
+        json = JSONObject.parseObject(httpRes);
+        token = json.getString("access_token");
+        log.info("获取企业微信ACCESS_TOKEN: {}", token);
+        PropertiesUtil.writeAccessToken("qywxToken",token);
+    }
+
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/service/assessments/Covid19AssessmentService.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.service.assessments;
+
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
+
+public interface Covid19AssessmentService {
+
+    XxkRet getRegionProvince();
+
+    XxkRet getPatientInfo(String patientId);
+
+    XxkRet getChildRegion(Integer parentCode);
+
+    XxkRet submit(CovidPojo pojo);
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/service/assessments/DepressionAssessmentService.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.service.assessments;
+
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.assessment.DepressionPojo;
+
+import javax.servlet.http.HttpServletRequest;
+
+public interface DepressionAssessmentService {
+    XxkRet submit(HttpServletRequest request, DepressionPojo pojo);
+}

+ 48 - 0
src/main/java/thyyxxk/wxservice_server/service/wechat/WeChatOfficialService.java

@@ -0,0 +1,48 @@
+package thyyxxk.wxservice_server.service.wechat;
+
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.*;
+
+public interface WeChatOfficialService {
+    XxkRet getOpenId(String code);
+
+    XxkRet getPatientIdByOpenId(String openId);
+
+    XxkRet bindPatientId(BindPatientIdParam param);
+
+    XxkRet setDefaultCard(String patientId, String openId);
+
+    XxkRet relieveBindCard(BindPatientIdParam param);
+
+    XxkRet getAllDepartments();
+
+    XxkRet getSourcesByDate(GetSourcesByDateParam param);
+
+    XxkRet getDoctorSources(GetDoctorSourcesParam param);
+
+    XxkRet getDoctorArrangement(GetDoctorSourcesParam param);
+
+    XxkRet getDoctorInfo(String doctorCode, String openId);
+
+    XxkRet getSourcesByDateAndDoctor(GetDoctorSourcesParam param);
+
+    XxkRet hasDoneCovidAssessment(String patientId);
+
+    XxkRet collectDoctor(CollectDoctorParam param);
+
+    XxkRet disCollectDoctor(CollectDoctorParam param);
+
+    XxkRet getMyCollections(String openId);
+
+    XxkRet getDoctorQrCode(String doctorCode);
+
+    XxkRet getUnPaidFee(String patientId);
+
+    XxkRet getUnPaidDetail(String patientId, String hisOrdNum);
+
+    XxkRet getInpatientInfo(String patientId);
+
+    XxkRet getZyFees(GetZyFeeParam param);
+
+    XxkRet getPrepaidHistory(String patientId);
+}

+ 12 - 0
src/main/java/thyyxxk/wxservice_server/service/wechat/WxApiService.java

@@ -0,0 +1,12 @@
+package thyyxxk.wxservice_server.service.wechat;
+
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.JsApiSHA1;
+import thyyxxk.wxservice_server.pojo.wechat.WeChatPayParam;
+
+public interface WxApiService {
+
+    XxkRet getJsapiSHA1Sign(JsApiSHA1 data);
+
+    XxkRet createPayOrder(WeChatPayParam param);
+}

+ 10 - 0
src/main/java/thyyxxk/wxservice_server/service/wechat/checkExam/CheckExamService.java

@@ -0,0 +1,10 @@
+package thyyxxk.wxservice_server.service.wechat.checkExam;
+
+import thyyxxk.wxservice_server.pojo.XxkRet;
+import thyyxxk.wxservice_server.pojo.wechat.checkExam.CheckExamParam;
+
+public interface CheckExamService {
+    XxkRet getExamIndex(CheckExamParam param);
+
+    XxkRet getExamDetail(String orderId);
+}

+ 14 - 0
src/main/java/thyyxxk/wxservice_server/socket/ServletInitializer.java

@@ -0,0 +1,14 @@
+package thyyxxk.wxservice_server.socket;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+import thyyxxk.wxservice_server.WxserviceServerApplication;
+
+public class ServletInitializer extends SpringBootServletInitializer {
+
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+        return application.sources(WxserviceServerApplication.class);
+    }
+
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/socket/WebSocketConfig.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.socket;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+@Configuration
+public class WebSocketConfig {
+
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        return new ServerEndpointExporter();
+    }
+
+}

+ 77 - 0
src/main/java/thyyxxk/wxservice_server/socket/WebSocketServer.java

@@ -0,0 +1,77 @@
+package thyyxxk.wxservice_server.socket;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+@Slf4j
+@ServerEndpoint("/websocket/{sid}")
+@Component
+public class WebSocketServer {
+    private static int onlineCount = 0;
+    private static final CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<>();
+    private Session session;
+    private String sid = "";
+
+    @OnOpen
+    public void onOpen(Session session, @PathParam("sid") String sid) {
+        this.session = session;
+        webSocketSet.add(this);
+        addOnlineCount();
+        this.sid = sid;
+        log.info("有新窗口加入: {}, 当前在线人数为 {}", sid, getOnlineCount());
+    }
+
+    @OnClose
+    public void onClose() {
+        webSocketSet.remove(this);
+        subOnlineCount();
+        log.info("有一连接关闭。当前在线人数为: {}", getOnlineCount());
+    }
+
+    @OnMessage
+    public void onMessage(String message) {
+        log.info("收到来自窗口 {} 的信息:{}", sid, message);
+    }
+
+    @OnError
+    public void onError(Session session, Throwable error) {
+        error.printStackTrace();
+        log.error("发生错误>>> session: {},错误:{} ", session.getId(), error.getMessage());
+    }
+
+    public void sendMessage(String message) {
+        try {
+            this.session.getBasicRemote().sendText(message);
+        } catch (Exception e) {
+            log.warn("发送socket消息出错>>> {}", e.getMessage());
+        }
+    }
+
+    private static synchronized int getOnlineCount() {
+        return onlineCount;
+    }
+
+    private static synchronized void addOnlineCount() {
+        WebSocketServer.onlineCount++;
+    }
+
+    private static synchronized void subOnlineCount() {
+        WebSocketServer.onlineCount--;
+    }
+
+    public static CopyOnWriteArraySet<WebSocketServer> getWebSocketSet() {
+        return webSocketSet;
+    }
+
+    public static WebSocketServer getSocketBySid(String sid) {
+        for (WebSocketServer server : getWebSocketSet()) {
+            if (server.sid.equals(sid)) return server;
+        }
+        return null;
+    }
+}

+ 17 - 0
src/main/java/thyyxxk/wxservice_server/utils/DecimalTool.java

@@ -0,0 +1,17 @@
+package thyyxxk.wxservice_server.utils;
+
+import java.math.BigDecimal;
+
+public class DecimalTool {
+    public static String add(String a, String b) {
+        BigDecimal aDecimal = new BigDecimal(a);
+        BigDecimal bDecimal = new BigDecimal(b);
+        return aDecimal.add(bDecimal).toPlainString();
+    }
+
+    public static String minus(String a, String b) {
+        BigDecimal aDecimal = new BigDecimal(a);
+        BigDecimal bDecimal = new BigDecimal(b);
+        return aDecimal.subtract(bDecimal).toPlainString();
+    }
+}

+ 44 - 0
src/main/java/thyyxxk/wxservice_server/utils/HrgHttp.java

@@ -0,0 +1,44 @@
+package thyyxxk.wxservice_server.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.pojo.HrgResponse;
+import thyyxxk.wxservice_server.pojo.XxkRet;
+
+public class HrgHttp {
+
+    public static XxkRet getResponseFromHrg(String url) {
+        RestTemplate template = new RestTemplate();
+        HrgResponse data = template.getForObject(url, HrgResponse.class);
+        if (null == data || null == data.getResultCode()) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "网络服务错误!");
+        } else {
+            if (data.getResultCode() == -1) {
+                if (url.contains("getDoctorByDateAndDept") || url.contains("getRequestByDateAndDeptAndDoctor")) {
+                    return XxkRet.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
+                } else {
+                    return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, data.getResultMessage());
+                }
+            } else {
+                return XxkRet.success(data.getData());
+            }
+        }
+    }
+
+    public static XxkRet postResponseFromHrg(String url, JSONObject param) {
+        RestTemplate template = new RestTemplate();
+        HrgResponse data = template.postForObject(url, param, HrgResponse.class);
+
+        if (null == data || null == data.getResultCode()) {
+            return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, "网络服务错误!");
+        } else {
+            if (data.getResultCode() == 0) {
+                return XxkRet.success(data.getData());
+            } else {
+                return XxkRet.fail(ExceptionEnum.LOGICAL_ERROR, data.getResultMessage());
+            }
+        }
+    }
+
+}

+ 49 - 0
src/main/java/thyyxxk/wxservice_server/utils/PropertiesUtil.java

@@ -0,0 +1,49 @@
+package thyyxxk.wxservice_server.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.Properties;
+
+public class PropertiesUtil {
+    private static Properties props;
+
+    static {
+        loadProps();
+    }
+
+    synchronized static private void loadProps() {
+        props = new Properties();
+        InputStream in = null;
+        try {
+            in = PropertiesUtil.class.getClassLoader().getResourceAsStream("weChatOfficialAccounts.properties");
+            if (null != in)
+                props.load(new InputStreamReader(in, StandardCharsets.UTF_8));
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (null != in) {
+                    in.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static String getProperty(String key) {
+        if (null == props) {
+            loadProps();
+        }
+        return props.getProperty(key);
+    }
+
+    public static void writeAccessToken(String key, String token) {
+        if (null == props) {
+            loadProps();
+        }
+        props.setProperty(key, token);
+    }
+}

+ 89 - 0
src/main/java/thyyxxk/wxservice_server/utils/Sign.java

@@ -0,0 +1,89 @@
+package thyyxxk.wxservice_server.utils;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.util.*;
+
+public class Sign {
+
+    /**
+     * 生成签名,用于在微信支付前,获取预支付时候需要使用的参数sign
+     * <p>算法参考:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3</p>
+     * @param params 需要发送的所有数据设置为的Map
+     * @return 签名sign
+     */
+    public static String createSign(TreeMap<String, String> params) {
+        List<Map.Entry<String, String>> infoIds = new ArrayList<>(params.entrySet());
+        // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序)
+        infoIds.sort(Map.Entry.comparingByKey());
+        StringBuilder stringA = new StringBuilder();
+        for (Map.Entry<String, String> item : infoIds) {
+            String key = item.getKey();
+            String val = item.getValue();
+            if (!val.equals("")) {
+                stringA.append(key).append("=").append(val).append("&");
+            }
+        }
+        String stringSignTemp = stringA.substring(0, stringA.length() - 1) + "&key=zxKl2oaid8KXA8dkai2DKk23ZIQE2X2e";
+        return encryptByMD5(stringSignTemp).toUpperCase();
+    }
+
+    /**
+     * MD5加密
+     */
+    private static String encryptByMD5(String sourceStr) {
+        String result = "";
+        try {
+            MessageDigest md = MessageDigest.getInstance("MD5");
+            md.update(sourceStr.getBytes(StandardCharsets.UTF_8));
+            byte[] b = md.digest();
+            int i;
+            StringBuilder buf = new StringBuilder();
+            for (byte value : b) {
+                i = value;
+                if (i < 0)
+                    i += 256;
+                if (i < 16)
+                    buf.append("0");
+                buf.append(Integer.toHexString(i));
+            }
+            result = buf.toString();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     * Takes the raw bytes from the digest and formats them correct.
+     *
+     * @param bytes the raw bytes from the digest.
+     * @return the formatted bytes.
+     */
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        // 把密文转换成十六进制的字符串形式
+        for (byte aByte : bytes) {
+            buf.append(HEX_DIGITS[(aByte >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[aByte & 0x0f]);
+        }
+        return buf.toString();
+    }
+
+    public static String sha1Encode(String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
+            messageDigest.update(str.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 95 - 0
src/main/java/thyyxxk/wxservice_server/utils/SnowFlakeId.java

@@ -0,0 +1,95 @@
+package thyyxxk.wxservice_server.utils;
+
+public class SnowFlakeId {
+    //下面两个每个5位,加起来就是10位的工作机器id
+    private final long workerId;    //工作id
+    private final long datacenterId;   //数据id
+    //12位的序列号
+    private long sequence;
+    private static SnowFlakeId INSTANCE;
+
+    public static SnowFlakeId instance() {
+        synchronized (SnowFlakeId.class) {
+            if (null == INSTANCE) {
+                INSTANCE = new SnowFlakeId(1, 1, 2011140217L);
+            }
+        }
+        return INSTANCE;
+    }
+
+
+    private SnowFlakeId(long workerId, long datacenterId, long sequence){
+        //最大值
+        long maxWorkerId = ~(-1L << workerIdBits);
+        if (workerId > maxWorkerId || workerId < 0) {
+            throw new IllegalArgumentException(
+                    String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
+        }
+        long maxDatacenterId = ~(-1L << datacenterIdBits);
+        if (datacenterId > maxDatacenterId || datacenterId < 0) {
+            throw new IllegalArgumentException(
+                    String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
+        }
+        this.workerId = workerId;
+        this.datacenterId = datacenterId;
+        this.sequence = sequence;
+    }
+
+    //长度为5位
+    private final long workerIdBits = 5L;
+    private final long datacenterIdBits = 5L;
+
+    //上次时间戳,初始值为负数
+    private long lastTimestamp = -1L;
+
+    //下一个ID生成算法
+    public synchronized String nextId() {
+        long timestamp = System.currentTimeMillis();
+
+        //获取当前时间戳如果小于上次时间戳,则表示时间戳获取出现异常
+        if (timestamp < lastTimestamp) {
+            System.err.printf("clock is moving backwards.  Rejecting requests until %d.", lastTimestamp);
+            throw new RuntimeException(String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds",
+                    lastTimestamp - timestamp));
+        }
+
+        //获取当前时间戳如果等于上次时间戳(同一毫秒内),则在序列号加1;否则序列号赋值为0,从0开始。
+        //序列号id长度
+        long sequenceBits = 12L;
+        if (lastTimestamp == timestamp) {
+            //序列号最大值
+            long sequenceMask = ~(-1L << sequenceBits);
+            sequence = (sequence + 1) & sequenceMask;
+            if (sequence == 0) {
+                timestamp = tilNextMillis(lastTimestamp);
+            }
+        } else {
+            sequence = 0;
+        }
+
+        //将上次时间戳值刷新
+        lastTimestamp = timestamp;
+
+        //初始时间戳
+        long twepoch = 1288834974657L;
+        //工作id需要左移的位数,12位
+        //数据id需要左移位数 12+5=17位
+        long datacenterIdShift = sequenceBits + workerIdBits;
+        //时间戳需要左移位数 12+5+5=22位
+        long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+        long id = ((timestamp - twepoch) << timestampLeftShift) |
+                (datacenterId << datacenterIdShift) |
+                (workerId << sequenceBits) |
+                sequence;
+        return String.valueOf(id);
+    }
+
+    //获取时间戳,并与上次时间戳比较
+    private long tilNextMillis(long lastTimestamp) {
+        long timestamp = System.currentTimeMillis();
+        while (timestamp <= lastTimestamp) {
+            timestamp = System.currentTimeMillis();
+        }
+        return timestamp;
+    }
+}

+ 24 - 0
src/main/resources/application.yml

@@ -0,0 +1,24 @@
+server:
+  port: 8805
+  servlet:
+    context-path: /wxserver
+spring:
+  application:
+    name: wxservice-server
+  thymeleaf:
+    cache: false
+  datasource:
+    url: jdbc:jtds:sqlserver://172.16.32.160:1433/thxyhisdb
+    hikari:
+      username: sa
+      password:
+      minimum-idle: 5
+      idle-timeout: 180000
+      maximum-pool-size: 8
+      auto-commit: true
+      pool-name: MyHikariCP
+      connection-timeout: 30000
+      connection-test-query: select 1
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true

+ 133 - 0
src/main/resources/logback-spring.xml

@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+
+    <!-- 日志根目录-->
+    <springProperty scope="context" name="LOG_HOME" source="logging.path"
+                    defaultValue="log-wxservice"/>
+
+    <!-- 日志级别 -->
+    <springProperty scope="context" name="LOG_ROOT_LEVEL" source="logging.level.root" defaultValue="INFO"/>
+
+    <!--  标识这个"STDOUT" 将会添加到这个logger -->
+    <springProperty scope="context" name="STDOUT" source="log.stdout" defaultValue="STDOUT"/>
+
+    <!-- 日志文件名称-->
+    <property name="LOG_PREFIX" value="spring-boot-logback" />
+
+    <!-- 日志文件编码-->
+    <property name="LOG_CHARSET" value="UTF-8" />
+
+    <!-- 日志文件路径+日期-->
+    <property name="LOG_DIR" value="${LOG_HOME}/%d{yyyy-MM-dd}" />
+
+    <!--对日志进行格式化-->
+    <property name="LOG_MSG" value="- [%d{yyyy-MM-dd HH:mm:ss.SSS}] [%level] [%logger{16}] --> %msg%n "/>
+
+    <!--文件大小,默认10MB-->
+    <property name="MAX_FILE_SIZE" value="3MB" />
+
+    <!-- 配置日志的滚动时间 ,value表示保留日志的天数,0表示永久保存 -->
+    <property name="MAX_HISTORY" value="0"/>
+
+
+    <!-- 彩色日志 -->
+    <!-- 彩色日志依赖的渲染类 -->
+    <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
+    <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
+    <conversionRule conversionWord="wEx"
+                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
+    <!-- 彩色日志格式 -->
+    <property name="CONSOLE_LOG_PATTERN"
+              value="-[%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){blue}] [%clr(%level)] [%clr(%logger{16}){cyan}] %clr(-->){red} %clr(%msg%n){yellow}"/>
+
+    <!--输出到控制台-->
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- 输出的日志内容格式化-->
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
+        </layout>
+    </appender>
+
+    <!--输出到文件-->
+    <appender name="0" class="ch.qos.logback.core.rolling.RollingFileAppender">
+    </appender>
+
+    <!-- 定义 ALL 日志的输出方式:-->
+    <appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!--日志文件路径,日志文件名称-->
+        <File>${LOG_HOME}/all_${LOG_PREFIX}.log</File>
+
+        <!-- 设置滚动策略,当天的日志大小超过 ${MAX_FILE_SIZE} 文件大小时候,新的内容写入新的文件, 默认10MB -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+
+            <!--日志文件路径,新的 ALL 日志文件名称,“ i ” 是个变量 -->
+            <FileNamePattern>${LOG_DIR}/all_${LOG_PREFIX}%i.log</FileNamePattern>
+
+            <!-- 配置日志的滚动时间 ,表示只保留最近 10 天的日志-->
+            <MaxHistory>${MAX_HISTORY}</MaxHistory>
+
+            <!--当天的日志大小超过 ${MAX_FILE_SIZE} 文件大小时候,新的内容写入新的文件, 默认10MB-->
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+
+        </rollingPolicy>
+
+        <!-- 输出的日志内容格式化-->
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <pattern>${LOG_MSG}</pattern>
+        </layout>
+    </appender>
+
+    <!-- 定义 ERROR 日志的输出方式:-->
+    <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 下面为配置只输出error级别的日志 -->
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>ERROR</level>
+            <OnMismatch>DENY</OnMismatch>
+            <OnMatch>ACCEPT</OnMatch>
+        </filter>
+        <!--日志文件路径,日志文件名称-->
+        <File>${LOG_HOME}/err_${LOG_PREFIX}.log</File>
+
+        <!-- 设置滚动策略,当天的日志大小超过 ${MAX_FILE_SIZE} 文件大小时候,新的内容写入新的文件, 默认10MB -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+
+            <!--日志文件路径,新的 ERR 日志文件名称,“ i ” 是个变量 -->
+            <FileNamePattern>${LOG_DIR}/err_${LOG_PREFIX}%i.log</FileNamePattern>
+
+            <!-- 配置日志的滚动时间 ,表示只保留最近 10 天的日志-->
+            <MaxHistory>${MAX_HISTORY}</MaxHistory>
+
+            <!--当天的日志大小超过 ${MAX_FILE_SIZE} 文件大小时候,新的内容写入新的文件, 默认10MB-->
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>${MAX_FILE_SIZE}</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+
+        <!-- 输出的日志内容格式化-->
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <Pattern>${LOG_MSG}</Pattern>
+        </layout>
+    </appender>
+
+    <!-- additivity 设为false,则logger内容不附加至root ,配置以配置包下的所有类的日志的打印,级别是 ERROR-->
+
+    <logger name="org.springframework"     level="ERROR" />
+    <logger name="org.apache.commons"      level="ERROR" />
+<!--    <logger name="th.itcenter.apps.controller.LoggingController" level="WARN"/>-->
+
+    <!-- ${LOG_ROOT_LEVEL} 日志级别 -->
+    <root level="${LOG_ROOT_LEVEL}">
+
+        <!-- 标识这个"${STDOUT}"将会添加到这个logger -->
+        <appender-ref ref="${STDOUT}"/>
+
+        <!-- FILE_ALL 日志输出添加到 logger -->
+        <appender-ref ref="FILE_ALL"/>
+
+        <!-- FILE_ERROR 日志输出添加到 logger -->
+        <appender-ref ref="FILE_ERROR"/>
+    </root>
+
+</configuration>

+ 10 - 0
src/main/resources/weChatOfficialAccounts.properties

@@ -0,0 +1,10 @@
+# 此appId关联的商户号登录账号为 2801@1375971802
+appId=wx19fc85fd5bfcc164
+appSecret=ffdf6f4ae704d374966dfb82bc300257
+access_token=
+ticket=
+merchantId=1375971802
+
+qywxCorpId=wwf0b23c8b36012b34
+qywxSecret=wpHuNePfiDyotmpXjy5hUYGF0w8Ks5OPHSQp22z8oBk
+qywxToken=

+ 13 - 0
src/test/java/thyyxxk/wxservice_server/WxserviceServerApplicationTests.java

@@ -0,0 +1,13 @@
+package thyyxxk.wxservice_server;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+class WxserviceServerApplicationTests {
+
+    @Test
+    void contextLoads() {
+    }
+
+}