commit d19e678060a1ef31b6cbf003b941c42654f19d8e Author: zrh050423 <14331304+zrh050423@user.noreply.gitee.com> Date: Thu Nov 21 21:10:56 2024 +0800 2.0 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3b41682 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/mvnw text eol=lf +*.cmd text eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..d58dfb7 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# +# http://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. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/lib/servlet-api.jar b/lib/servlet-api.jar new file mode 100644 index 0000000..f7bba51 Binary files /dev/null and b/lib/servlet-api.jar differ diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..19529dd --- /dev/null +++ b/mvnw @@ -0,0 +1,259 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# +# http://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.2 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..249bdf3 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,149 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.2 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' +$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +if ($env:MAVEN_USER_HOME) { + $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" +} +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ba59be7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.3.5 + + + edu.zrh + healthSystem + 0.0.1-SNAPSHOT + healthSystem + healthSystem + + + + + + + + + + + + + + + 23 + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-web + 3.3.5 + + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.boot + spring-boot-starter-test + test + + + mysql + mysql-connector-java + 8.0.12 + + + + org.projectlombok + lombok + provided + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java b/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java new file mode 100644 index 0000000..22be50e --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java @@ -0,0 +1,17 @@ +package edu.zrh.healthsystem; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + + +/** + * @author han + */ + +@SpringBootApplication +public class HealthSystemApplication { + + public static void main(String[] args) { + SpringApplication.run(HealthSystemApplication.class, args); + } +} diff --git a/src/main/java/edu/zrh/healthsystem/config/WebConfig.java b/src/main/java/edu/zrh/healthsystem/config/WebConfig.java new file mode 100644 index 0000000..ca0d828 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/config/WebConfig.java @@ -0,0 +1,22 @@ +package edu.zrh.healthsystem.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.web.client.RestTemplate; + +/** + * @author han + */ +@Configuration +public class WebConfig { + @Bean + public BCryptPasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/HelloController.java b/src/main/java/edu/zrh/healthsystem/controller/HelloController.java new file mode 100644 index 0000000..3b46db2 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/HelloController.java @@ -0,0 +1,18 @@ +package edu.zrh.healthsystem.controller; + +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author han + */ +@CrossOrigin(origins = "*") +@RestController +public class HelloController { + + @GetMapping("/hello") + public String home() { + return "Hello, World!"; + } +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/controller/RegularCheckupController.java b/src/main/java/edu/zrh/healthsystem/controller/RegularCheckupController.java new file mode 100644 index 0000000..b964ed9 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/RegularCheckupController.java @@ -0,0 +1,77 @@ +package edu.zrh.healthsystem.controller; + +import edu.zrh.healthsystem.model.Elderly; +import edu.zrh.healthsystem.model.elderly.RegularCheckupInfoResponse; +import edu.zrh.healthsystem.repository.RegularCheckupInfoRespository; +import edu.zrh.healthsystem.service.RegularCheckupService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@CrossOrigin(origins = "*") +@RestController +@RequestMapping("/regularcheckup") +public class RegularCheckupController { + private final RegularCheckupService regularCheckupService; + @Autowired + public RegularCheckupController(RegularCheckupService regularCheckupService) { + this.regularCheckupService = regularCheckupService; + } + @PostMapping("/add") + public Map add(@RequestBody Elderly elderly) { + RegularCheckupInfoResponse result = regularCheckupService.add(elderly); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } + + @PostMapping("/delete") + public Map delete(@RequestBody Elderly elderly) { + RegularCheckupInfoResponse result = regularCheckupService.delete(elderly); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } + + @PostMapping("/update") + public Map update(@RequestBody Elderly elderly) { + RegularCheckupInfoResponse result = regularCheckupService.update(elderly); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } + + @PostMapping("/get") + public Map get(@RequestBody Elderly elderly) { + RegularCheckupInfoResponse result = regularCheckupService.get(elderly); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } + + @GetMapping("/getall") + public Map getAll() { + RegularCheckupInfoResponse result = regularCheckupService.getAll(); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } + + +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/TalkController.java b/src/main/java/edu/zrh/healthsystem/controller/TalkController.java new file mode 100644 index 0000000..92cae19 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/TalkController.java @@ -0,0 +1,39 @@ +package edu.zrh.healthsystem.controller; + +import edu.zrh.healthsystem.model.Talk; +import edu.zrh.healthsystem.model.TalkResponse; +import edu.zrh.healthsystem.service.TalkService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * @author han + */ +@CrossOrigin(origins = "*") +@RestController +public class TalkController { + private final TalkService talkService; + + @Autowired + public TalkController(TalkService talkService) { + this.talkService = talkService; + } + + @GetMapping("/talk/test") + public String callApi() { + return talkService.callApi("http://10.10.10.44:11434/"); + } + + @PostMapping("/talk/main") + public Map callApiChat(@RequestBody Talk talk) { + TalkResponse result = talkService.callApiChat(talk); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "登录失败"); + } + } +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderMainController.java b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderMainController.java new file mode 100644 index 0000000..d5e8ba5 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderMainController.java @@ -0,0 +1,35 @@ +package edu.zrh.healthsystem.controller.elderly; + +import edu.zrh.healthsystem.service.elderly.ElderMainService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Map; + +/** + * @author han + */ +@CrossOrigin(origins = "*") +@RestController +public class ElderMainController { + private ElderMainService elderMainService; + + @Autowired + public ElderMainController(ElderMainService elderMainService) { + this.elderMainService = elderMainService; + } + + @GetMapping("/elderly/main") + public Map elderMain() { + List result = elderMainService.elderMain(); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "登录失败"); + } + } +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyConnectController.java b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyConnectController.java new file mode 100644 index 0000000..79b9c7c --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyConnectController.java @@ -0,0 +1,33 @@ +package edu.zrh.healthsystem.controller.elderly; + +import edu.zrh.healthsystem.model.elderly.ElderlyConnect; +import edu.zrh.healthsystem.model.elderly.ElderlyConnectResponse; +import edu.zrh.healthsystem.service.elderly.ElderlyConnectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@CrossOrigin(origins = "*") +@RestController +public class ElderlyConnectController { + private final ElderlyConnectService elderlyConnectService; + @Autowired + public ElderlyConnectController(ElderlyConnectService elderlyConnectService) { + this.elderlyConnectService = elderlyConnectService; + } + @PostMapping("/elderly/Connect") + public Map elderlyConnect(@RequestBody ElderlyConnect elderlyConnect){ + + ElderlyConnectResponse result= elderlyConnectService.getElderlyConnectResponse(elderlyConnect); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "创建失败"); + } + } +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyNewController.java b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyNewController.java new file mode 100644 index 0000000..e13cbdc --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyNewController.java @@ -0,0 +1,33 @@ +package edu.zrh.healthsystem.controller.elderly; + +import edu.zrh.healthsystem.model.elderly.ElderlyNew; +import edu.zrh.healthsystem.model.elderly.ElderlyNewResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import edu.zrh.healthsystem.service.elderly.ElderlyNewService; + +import java.util.Map; + +@CrossOrigin(origins = "*") +@RestController +public class ElderlyNewController { + private final ElderlyNewService elderlyNewService; + @Autowired + public ElderlyNewController(ElderlyNewService elderlyNewService) { + this.elderlyNewService = elderlyNewService; + } + @PostMapping("/elderly/new") + public Map elderlyNew(@RequestBody ElderlyNew elderlyNew){ + + ElderlyNewResponse result= elderlyNewService.elderly(elderlyNew); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "创建失败"); + } + } +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyShowController.java b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyShowController.java new file mode 100644 index 0000000..877ef03 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/elderly/ElderlyShowController.java @@ -0,0 +1,34 @@ +package edu.zrh.healthsystem.controller.elderly; + + +import edu.zrh.healthsystem.model.Elderly; +import edu.zrh.healthsystem.model.elderly.ElderlyShowResponse; +import edu.zrh.healthsystem.service.elderly.ElderlyShowService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@CrossOrigin(origins = "*") +@RestController +public class ElderlyShowController { + private final ElderlyShowService elderlyShowService; + @Autowired + public ElderlyShowController(ElderlyShowService elderlyShowService) { + this.elderlyShowService = elderlyShowService; + } + @PostMapping("/elderly/show") + public Map elderlyShow(@RequestBody Elderly elderly){ + + ElderlyShowResponse result= elderlyShowService.getElderlyShow(elderly); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "连接失败"); + } + } +} diff --git a/src/main/java/edu/zrh/healthsystem/controller/user/LoginController.java b/src/main/java/edu/zrh/healthsystem/controller/user/LoginController.java new file mode 100644 index 0000000..3a4d747 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/user/LoginController.java @@ -0,0 +1,38 @@ +package edu.zrh.healthsystem.controller.user; + +import edu.zrh.healthsystem.model.user.UserLogin; +import edu.zrh.healthsystem.model.user.UserLoginResponse; +import edu.zrh.healthsystem.service.LoginService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * @author han + */ +@CrossOrigin(origins = "*") +@RestController +public class LoginController { + private final LoginService loginService; + + @Autowired + public LoginController(LoginService loginService) { + this.loginService = loginService; + } + + @PostMapping("/login") + public Map login(@RequestBody UserLogin userLogin) { + // 调用登录服务 + UserLoginResponse result = loginService.login(userLogin); + + // 如果登录成功,返回成功信息和用户信息 + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "登录失败"); + } + } +} + diff --git a/src/main/java/edu/zrh/healthsystem/controller/user/RegisterController.java b/src/main/java/edu/zrh/healthsystem/controller/user/RegisterController.java new file mode 100644 index 0000000..c649e5f --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/controller/user/RegisterController.java @@ -0,0 +1,35 @@ +package edu.zrh.healthsystem.controller.user; + +import edu.zrh.healthsystem.model.user.UserRegister; +import edu.zrh.healthsystem.model.user.UserRegisterResponse; +import edu.zrh.healthsystem.service.RegisterService; +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.RestController; + +import java.util.Map; + +/** + * @author han + */ + +@RestController +public class RegisterController { + private final RegisterService registerService; + @Autowired + public RegisterController(RegisterService registerService) { + this.registerService = registerService; + } + + @PostMapping("/register") + public Map register(@RequestBody UserRegister userRegister) { + UserRegisterResponse result = registerService.register(userRegister); + if (result != null) { + return Map.of("status", "success", "data", result); + } else { + // 如果登录失败,返回失败信息 + return Map.of("status", "fail", "message", "登录失败"); + } + } +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/BasicInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/BasicInfo.java new file mode 100644 index 0000000..2239175 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/BasicInfo.java @@ -0,0 +1,75 @@ +package edu.zrh.healthsystem.eneity; + + +import jakarta.persistence.*; +import lombok.Data; + +import java.util.Date; + +/** + * @author han + */ +@Data +@Entity +@Table(name = "basic_info") + +public class BasicInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "elderly_id") + private int elderlyId; + + @Column(name = "full_name") + private String fullName; + + + @Column(name = "gender") + private String gender; + + @Column(name = "date_of_birth") + private Date dateOfBirth; + + @Column(name = "ethnicity") + private String ethnicity; + + @Column(name = "native_place") + private String nativePlace; + + @Column(name = "id_number") + private String idNumber; + + @Column(name = "permanent_address") + private String permanentAddress; + + @Column(name = "occupation") + private String occupation; + + @Column(name = "education_level") + private String educationLevel; + + @Column(name = "living_alone") + private String livingAlone; + + @Column(name = "marital_status") + private String maritalStatus; + + @Column(name = "phone_number") + private String phoneNumber; + + @Column(name = "contact_name") + private String contactName; + + @Column(name = "contact_relation") + private String contactRelation; + + @Column(name = "contact_phone") + private String contactPhone; + + @Column(name = "eating_habits") + private String eatingHabits; + + @Column(name = "exercise_frequency") + private String exerciseFrequency; + + +} diff --git a/src/main/java/edu/zrh/healthsystem/eneity/DailyScheduleInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/DailyScheduleInfo.java new file mode 100644 index 0000000..349c0df --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/DailyScheduleInfo.java @@ -0,0 +1,31 @@ +package edu.zrh.healthsystem.eneity; + + +import jakarta.persistence.*; +import lombok.Data; + +import java.sql.Timestamp; + +@Entity +@Table(name = "daily_schedule_info") +@Data +public class DailyScheduleInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int checkInId; + + @Column(name = "Elderly_id") + private Integer elderlyId; + + @Column(name = "Schedule_id") + private Integer scheduleId; + + @Column(name = "Check_in_time") + private Timestamp checkInTime; + + @Column(name = "Check_out_time") + private Timestamp checkOutTime; + + @Column(name = "notes") + private String notes; +} diff --git a/src/main/java/edu/zrh/healthsystem/eneity/DiseaseRecordInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/DiseaseRecordInfo.java new file mode 100644 index 0000000..2f30fc5 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/DiseaseRecordInfo.java @@ -0,0 +1,65 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Entity +@Table(name = "diseaserecord_info") +public class DiseaseRecordInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "DiseaseID", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "ProfileID", nullable = false) + private MainProfileInfo profileID; + + @Lob + @Column(name = "PastMedicalHistory") + private String pastMedicalHistory; + + @Lob + @Column(name = "CurrentMedicalHistory") + private String currentMedicalHistory; + + @Lob + @Column(name = "FamilyMedicalHistory") + private String familyMedicalHistory; + + @Lob + @Column(name = "Allergies") + private String allergies; + + @Lob + @Column(name = "Disability") + private String disability; + + @Lob + @Column(name = "VaccinationHistory") + private String vaccinationHistory; + + @Lob + @Column(name = "ExposureHistory") + private String exposureHistory; + + @Lob + @Column(name = "GeneticDiseaseHistory") + private String geneticDiseaseHistory; + + @Lob + @Column(name = "TreatmentHistory") + private String treatmentHistory; + + @Lob + @Column(name = "NursingHistory") + private String nursingHistory; + + @Lob + @Column(name = "FollowUpManagement") + private String followUpManagement; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/HealthBehaviorInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/HealthBehaviorInfo.java new file mode 100644 index 0000000..221d0cd --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/HealthBehaviorInfo.java @@ -0,0 +1,27 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Entity +@Table(name = "healthbehavior_info") +public class HealthBehaviorInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "BehaviorID", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "ProfileID", nullable = false) + private MainProfileInfo profileID; + + @Column(name = "SmokingStatus", nullable = false) + private String smokingStatus; + + @Column(name = "DrinkingStatus", nullable = false) + private String drinkingStatus; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/MainProfileInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/MainProfileInfo.java new file mode 100644 index 0000000..fffa373 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/MainProfileInfo.java @@ -0,0 +1,17 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Data; + +@Data +@Entity +@Table(name = "mainprofile_info") +public class MainProfileInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int profileId; + + @OneToOne + @JoinColumn(name = "elderly_id") + private BasicInfo elderlyId; +} diff --git a/src/main/java/edu/zrh/healthsystem/eneity/MentalHealthInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/MentalHealthInfo.java new file mode 100644 index 0000000..664d827 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/MentalHealthInfo.java @@ -0,0 +1,29 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Entity +@Table(name = "mentalhealth_info") +public class MentalHealthInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "MentalHealthID", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "Elderly_id", nullable = false) + private MainProfileInfo elderly; + + @Lob + @Column(name = "PsychologicalIssues") + private String psychologicalIssues; + + @Lob + @Column(name = "FollowUpRecord") + private String followUpRecord; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/PastMedicalHistoryrecordInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/PastMedicalHistoryrecordInfo.java new file mode 100644 index 0000000..27c8806 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/PastMedicalHistoryrecordInfo.java @@ -0,0 +1,37 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Entity +@Table(name = "pastmedicalhistoryrecord_info") +public class PastMedicalHistoryrecordInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "PastMedicalHistoryID", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "ProfileID", nullable = false) + private MainProfileInfo profileID; + + @Lob + @Column(name = "CurrentMedicalHistory") + private String currentMedicalHistory; + + @Lob + @Column(name = "ExposureHistory") + private String exposureHistory; + + @Lob + @Column(name = "TreatmentHistory") + private String treatmentHistory; + + @Lob + @Column(name = "NursingHistory") + private String nursingHistory; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/RegularCheckupInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/RegularCheckupInfo.java new file mode 100644 index 0000000..a36cc2f --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/RegularCheckupInfo.java @@ -0,0 +1,67 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +import java.math.BigDecimal; +import java.time.LocalDate; + +@Getter +@Setter +@Entity +@Table(name = "regularcheckup_info") +public class RegularCheckupInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "CheckupID", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "ProfileID", nullable = false) + private MainProfileInfo profileID; + + @Column(name = "WeightStatus", nullable = false) + private String weightStatus; + + @Column(name = "BloodType", nullable = false) + private String bloodType; + + @Lob + @Column(name = "ChronicDiseases") + private String chronicDiseases; + + @Column(name = "Height", precision = 5, scale = 2) + private BigDecimal height; + + @Column(name = "Weight", precision = 5, scale = 2) + private BigDecimal weight; + + @Column(name = "HeartRate") + private Integer heartRate; + + @Column(name = "Temperature", precision = 3, scale = 1) + private BigDecimal temperature; + + @Column(name = "OxygenSaturation") + private Integer oxygenSaturation; + + @Column(name = "BloodPressure", length = 10) + private String bloodPressure; + + @Column(name = "GlucoseLevel", precision = 5, scale = 2) + private BigDecimal glucoseLevel; + + @Column(name = "Pulse") + private Integer pulse; + + @Column(name = "face_image") + private byte[] faceImage; + + @Column(name = "tongue_image") + private byte[] tongueImage; + + @Column(name = "CheckupDate") + private LocalDate checkupDate; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/ScheduleInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/ScheduleInfo.java new file mode 100644 index 0000000..7d77396 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/ScheduleInfo.java @@ -0,0 +1,29 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; + +import java.time.Instant; + +@Getter +@Setter +@Entity +@Table(name = "schedule_info") +public class ScheduleInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "schedule_id", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "elderly_id", nullable = false) + private BasicInfo elderly; + + @Column(name = "event_description") + private String eventDescription; + + @Column(name = "event_time") + private Instant eventTime; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/TcmDiagnosisInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/TcmDiagnosisInfo.java new file mode 100644 index 0000000..08ec3fb --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/TcmDiagnosisInfo.java @@ -0,0 +1,31 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.ColumnDefault; + +import java.time.Instant; + +@Getter +@Setter +@Entity +@Table(name = "tcm_diagnosis_info") +public class TcmDiagnosisInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "diagnosis_id", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "elderly_id", nullable = false) + private BasicInfo elderly; + + @Column(name = "diagnosis", nullable = false) + private String diagnosis; + + @ColumnDefault("CURRENT_TIMESTAMP") + @Column(name = "diagnosis_time") + private Instant diagnosisTime; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/TcmQaInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/TcmQaInfo.java new file mode 100644 index 0000000..6a9c13a --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/TcmQaInfo.java @@ -0,0 +1,36 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.ColumnDefault; + +import java.time.Instant; + +@Getter +@Setter +@Entity +@Table(name = "tcm_qa_info") +public class TcmQaInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "qa_id", nullable = false) + private Integer id; + + @ManyToOne(fetch = FetchType.LAZY, optional = false) + @JoinColumn(name = "elderly_id", nullable = false) + private BasicInfo elderly; + + @ColumnDefault("CURRENT_TIMESTAMP") + @Column(name = "asked_time") + private Instant askedTime; + + @Lob + @Column(name = "question", nullable = false) + private String question; + + @Lob + @Column(name = "answer", nullable = false) + private String answer; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/eneity/UserInfo.java b/src/main/java/edu/zrh/healthsystem/eneity/UserInfo.java new file mode 100644 index 0000000..6b6a733 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/eneity/UserInfo.java @@ -0,0 +1,29 @@ +package edu.zrh.healthsystem.eneity; + +import jakarta.persistence.*; +import lombok.Data; + +/** + * @author han + */ +@Data +@Entity +@Table(name = "user_info") +public class UserInfo { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int userId; + + @Column(name = "User_name") + private String userName; + + @Column(name = "User_password") + private String userPassword; + + @Column(name = "User_elderly") + private Integer userElderly; + + @Column(name = "User_email") + private String userEmail; + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/model/Basic.java b/src/main/java/edu/zrh/healthsystem/model/Basic.java new file mode 100644 index 0000000..021a118 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/Basic.java @@ -0,0 +1,20 @@ +package edu.zrh.healthsystem.model; + +/** + * @author han + */ +public class Basic { + private int elderlyId; + private String fullName; + private char gender; + private String dateOfBirth; + private String ethnicity; + private String nativePlace; + private String idNumber; + private String permanentAddress; + private String occupation; + private String educationLevel; + private boolean livingAlone; + private String maritalStatus; + private String phoneNumber; +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/model/Elderly.java b/src/main/java/edu/zrh/healthsystem/model/Elderly.java new file mode 100644 index 0000000..f5246e4 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/Elderly.java @@ -0,0 +1,43 @@ +package edu.zrh.healthsystem.model; + +import edu.zrh.healthsystem.eneity.MainProfileInfo; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; + +public @Data class Elderly { + private int elderlyId; + + private MainProfileInfo profileId; + + private String weightStatus; + + private String bloodType; + + private String chronicDiseases; + + private BigDecimal height; + + private BigDecimal weight; + + private Integer heartRate; + + private BigDecimal temperature; + + private Integer oxygenSaturation; + + private String bloodPressure; + + private BigDecimal glucoseLevel; + + private Integer pulse; + + private byte[] faceImage; + + private byte[] tongueImage; + + private LocalDate checkupDate; + + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/Message.java b/src/main/java/edu/zrh/healthsystem/model/Message.java new file mode 100644 index 0000000..7b87390 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/Message.java @@ -0,0 +1,8 @@ +package edu.zrh.healthsystem.model; + +import lombok.Data; + +public @Data class Message { + private String role="user"; + private String content; +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/model/Talk.java b/src/main/java/edu/zrh/healthsystem/model/Talk.java new file mode 100644 index 0000000..874ec57 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/Talk.java @@ -0,0 +1,15 @@ +package edu.zrh.healthsystem.model; + +import lombok.Data; + +import java.util.List; + + +/** + * @author han + */ +public @Data class Talk { + private String model="qwen2"; + private List messages; + private Boolean stream=false; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/TalkResponse.java b/src/main/java/edu/zrh/healthsystem/model/TalkResponse.java new file mode 100644 index 0000000..11be9e1 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/TalkResponse.java @@ -0,0 +1,21 @@ +package edu.zrh.healthsystem.model; + +import lombok.Data; + +import java.util.List; + +/** + * @author han + */ +public @Data class TalkResponse { + private String model; + private String created_at; + private String done; + private String total_duration; + private String load_duration; + private String prompt_eval_count; + private String prompt_eval_duration; + private String eval_count; + private String eval_duration; + private List messages; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnect.java b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnect.java new file mode 100644 index 0000000..56155b7 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnect.java @@ -0,0 +1,8 @@ +package edu.zrh.healthsystem.model.elderly; + +import lombok.Data; + +public @Data class ElderlyConnect { + private int userId; + private int userElderly; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnectResponse.java b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnectResponse.java new file mode 100644 index 0000000..9ebd8cb --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyConnectResponse.java @@ -0,0 +1,8 @@ +package edu.zrh.healthsystem.model.elderly; + +import lombok.Data; + +public @Data class ElderlyConnectResponse { + private int userId; + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNew.java b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNew.java new file mode 100644 index 0000000..8f29091 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNew.java @@ -0,0 +1,32 @@ +package edu.zrh.healthsystem.model.elderly; + + +import lombok.Data; + +import java.util.Date; + +/** + * @author han + */ +public @Data class ElderlyNew { + + private String fullName; + private String gender; + private Date dateOfBirth; + private String ethnicity; + private String nativePlace; + private String idNumber; + private String permanentAddress; + private String occupation; + private String educationLevel; + private String livingAlone; + private String maritalStatus; + private String phoneNumber; + private String contactName; + private String contactRelation; + private String contactPhone; + private String eatingHabits; + private String exerciseFrequency; + + +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNewResponse.java b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNewResponse.java new file mode 100644 index 0000000..ed868de --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyNewResponse.java @@ -0,0 +1,8 @@ +package edu.zrh.healthsystem.model.elderly; + +import lombok.Data; + +public @Data class ElderlyNewResponse { + private int elderlyId; + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyShowResponse.java b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyShowResponse.java new file mode 100644 index 0000000..f6b2475 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/ElderlyShowResponse.java @@ -0,0 +1,27 @@ +package edu.zrh.healthsystem.model.elderly; + +import lombok.Data; + +import java.util.Date; + +public @Data class ElderlyShowResponse { + private int ElderlyId; + private String fullName; + private String gender; + private Date dateOfBirth; + private String ethnicity; + private String nativePlace; + private String idNumber; + private String permanentAddress; + private String occupation; + private String educationLevel; + private String livingAlone; + private String maritalStatus; + private String phoneNumber; + private String contactName; + private String contactRelation; + private String contactPhone; + private String eatingHabits; + private String exerciseFrequency; + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/elderly/RegularCheckupInfoResponse.java b/src/main/java/edu/zrh/healthsystem/model/elderly/RegularCheckupInfoResponse.java new file mode 100644 index 0000000..deb67e9 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/elderly/RegularCheckupInfoResponse.java @@ -0,0 +1,47 @@ +package edu.zrh.healthsystem.model.elderly; + +import edu.zrh.healthsystem.eneity.MainProfileInfo; +import jakarta.persistence.*; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * @author han + */ +public @Data class RegularCheckupInfoResponse { + private Integer id; + + private MainProfileInfo profileId; + + private String weightStatus; + + private String bloodType; + + private String chronicDiseases; + + private BigDecimal height; + + private BigDecimal weight; + + private Integer heartRate; + + private BigDecimal temperature; + + private Integer oxygenSaturation; + + private String bloodPressure; + + private BigDecimal glucoseLevel; + + private Integer pulse; + + private byte[] faceImage; + + private byte[] tongueImage; + + private LocalDate checkupDate; + + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/user/UserLogin.java b/src/main/java/edu/zrh/healthsystem/model/user/UserLogin.java new file mode 100644 index 0000000..e034589 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/user/UserLogin.java @@ -0,0 +1,10 @@ +package edu.zrh.healthsystem.model.user; +import lombok.Data; + +/** + * @author han + */ +public @Data class UserLogin { + private String userName; + private String userPassword; +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/model/user/UserLoginResponse.java b/src/main/java/edu/zrh/healthsystem/model/user/UserLoginResponse.java new file mode 100644 index 0000000..ecd9a44 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/user/UserLoginResponse.java @@ -0,0 +1,14 @@ +package edu.zrh.healthsystem.model.user; + + +import lombok.Data; + +/** + * @author han + */ + +public @Data class UserLoginResponse { + private boolean userRe; + private int userId; + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/user/UserRegister.java b/src/main/java/edu/zrh/healthsystem/model/user/UserRegister.java new file mode 100644 index 0000000..880394f --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/user/UserRegister.java @@ -0,0 +1,13 @@ +package edu.zrh.healthsystem.model.user; + +import lombok.Data; + +/** + * @author han + */ + +public @Data class UserRegister { + private String userName; + private String userPassword; + private String userEmail; +} diff --git a/src/main/java/edu/zrh/healthsystem/model/user/UserRegisterResponse.java b/src/main/java/edu/zrh/healthsystem/model/user/UserRegisterResponse.java new file mode 100644 index 0000000..c53c91d --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/model/user/UserRegisterResponse.java @@ -0,0 +1,10 @@ +package edu.zrh.healthsystem.model.user; + +import lombok.Data; + +public @Data class UserRegisterResponse { + + private boolean userRe; + private int userId; + private String message; +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/DailyScheduleRepository.java b/src/main/java/edu/zrh/healthsystem/repository/DailyScheduleRepository.java new file mode 100644 index 0000000..dd6ddeb --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/DailyScheduleRepository.java @@ -0,0 +1,7 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.DailyScheduleInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface DailyScheduleRepository extends JpaRepository { +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/DiseaseRecordRepository.java b/src/main/java/edu/zrh/healthsystem/repository/DiseaseRecordRepository.java new file mode 100644 index 0000000..aa8fbd0 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/DiseaseRecordRepository.java @@ -0,0 +1,7 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.DiseaseRecordInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface DiseaseRecordRepository extends JpaRepository { +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/HealthBehaviorInfoRespository.java b/src/main/java/edu/zrh/healthsystem/repository/HealthBehaviorInfoRespository.java new file mode 100644 index 0000000..9992c76 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/HealthBehaviorInfoRespository.java @@ -0,0 +1,7 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.HealthBehaviorInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface HealthBehaviorInfoRespository extends JpaRepository { +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java b/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java new file mode 100644 index 0000000..cbb111f --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java @@ -0,0 +1,16 @@ +package edu.zrh.healthsystem.repository; + + +import edu.zrh.healthsystem.eneity.UserInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +/** + * @author han + */ +@Repository +public interface LoginRepository extends JpaRepository { + Optional findByUserName(String username); +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/MainProfileInfoRepository.java b/src/main/java/edu/zrh/healthsystem/repository/MainProfileInfoRepository.java new file mode 100644 index 0000000..5d71ebd --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/MainProfileInfoRepository.java @@ -0,0 +1,8 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.MainProfileInfo; +import edu.zrh.healthsystem.eneity.UserInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface MainProfileInfoRepository extends JpaRepository { +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/RegisterRepository.java b/src/main/java/edu/zrh/healthsystem/repository/RegisterRepository.java new file mode 100644 index 0000000..bee9992 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/RegisterRepository.java @@ -0,0 +1,18 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.UserInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +/** + * @author han + */ + +@Repository +public interface RegisterRepository extends JpaRepository { + Optional findByUserName(String username); + + Optional findByUserEmail(String userEmail); +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/RegularCheckupInfoRespository.java b/src/main/java/edu/zrh/healthsystem/repository/RegularCheckupInfoRespository.java new file mode 100644 index 0000000..3cb58bb --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/RegularCheckupInfoRespository.java @@ -0,0 +1,12 @@ +package edu.zrh.healthsystem.repository; + +import edu.zrh.healthsystem.eneity.RegularCheckupInfo; +import edu.zrh.healthsystem.model.Elderly; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.lang.classfile.Opcode; +import java.util.Optional; + +public interface RegularCheckupInfoRespository extends JpaRepository { + Optional findByElderlyId(int elderlyId); +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderMainRepository.java b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderMainRepository.java new file mode 100644 index 0000000..6c94d69 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderMainRepository.java @@ -0,0 +1,7 @@ +package edu.zrh.healthsystem.repository.elderly; + +import edu.zrh.healthsystem.eneity.BasicInfo; +import org.springframework.data.jpa.repository.JpaRepository; + + public interface ElderMainRepository extends JpaRepository { +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyConnectRepository.java b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyConnectRepository.java new file mode 100644 index 0000000..e05b100 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyConnectRepository.java @@ -0,0 +1,13 @@ +package edu.zrh.healthsystem.repository.elderly; + +import edu.zrh.healthsystem.eneity.UserInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface ElderlyConnectRepository extends JpaRepository { + Optional findByUserId(int userId); + Optional findByUserElderly(int userElderly); +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyNewRepository.java b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyNewRepository.java new file mode 100644 index 0000000..190f251 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyNewRepository.java @@ -0,0 +1,11 @@ +package edu.zrh.healthsystem.repository.elderly; + +import edu.zrh.healthsystem.eneity.BasicInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; +@Repository +public interface ElderlyNewRepository extends JpaRepository { + Optional findByFullName(String fullName); +} diff --git a/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyShowRepository.java b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyShowRepository.java new file mode 100644 index 0000000..94d0b5c --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/repository/elderly/ElderlyShowRepository.java @@ -0,0 +1,10 @@ +package edu.zrh.healthsystem.repository.elderly; + +import edu.zrh.healthsystem.eneity.BasicInfo; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface ElderlyShowRepository extends JpaRepository { + Optional findByElderlyId(int elderlyId); +} diff --git a/src/main/java/edu/zrh/healthsystem/service/LoginService.java b/src/main/java/edu/zrh/healthsystem/service/LoginService.java new file mode 100644 index 0000000..cb0c476 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/LoginService.java @@ -0,0 +1,57 @@ +package edu.zrh.healthsystem.service; + +import edu.zrh.healthsystem.eneity.UserInfo; +import edu.zrh.healthsystem.model.user.UserLogin; +import edu.zrh.healthsystem.model.user.UserLoginResponse; +import edu.zrh.healthsystem.repository.LoginRepository; +import jakarta.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.Optional; + +/** + * @author han + */ +@Service +public class LoginService { + + private final LoginRepository loginRepository; + @Resource + private BCryptPasswordEncoder passwordEncoder; + @Autowired + public LoginService( LoginRepository loginRepository){ + this.loginRepository = loginRepository; + } + + public UserLoginResponse login(UserLogin userLogin) { + Optional optionalUserInfo = loginRepository.findByUserName(userLogin.getUserName()); + UserLoginResponse userLoginResponse = new UserLoginResponse(); + if (optionalUserInfo.isPresent()) { + UserInfo userInfo = optionalUserInfo.get(); + + // 检查提供的密码是否与数据库中存储的密码匹配 + if (passwordEncoder.matches(userLogin.getUserPassword(), userInfo.getUserPassword())) { + // 如果密码正确,返回userLogin对象 + userLoginResponse.setUserId(userInfo.getUserId()); + userLoginResponse.setUserRe(true); + userLoginResponse.setMessage("登录成功"); + } else { + + // 如果密码不正确,抛出异常或返回null + userLoginResponse.setUserId(-1); + userLoginResponse.setUserRe(true); + userLoginResponse.setMessage("密码错误"); + } + } else { + // 如果找不到用户,抛出异常或返回null + userLoginResponse.setUserId(-2); + userLoginResponse.setUserRe(true); + userLoginResponse.setMessage("未注册用户"); + } + return userLoginResponse; + } + +} diff --git a/src/main/java/edu/zrh/healthsystem/service/RegisterService.java b/src/main/java/edu/zrh/healthsystem/service/RegisterService.java new file mode 100644 index 0000000..1a74dfa --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/RegisterService.java @@ -0,0 +1,55 @@ +package edu.zrh.healthsystem.service; + +import edu.zrh.healthsystem.eneity.UserInfo; +import edu.zrh.healthsystem.model.user.UserRegister; +import edu.zrh.healthsystem.model.user.UserRegisterResponse; +import edu.zrh.healthsystem.repository.RegisterRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; + +import java.util.Optional; + +/** + * @author han + */ + +@Service + +public class RegisterService { + private final RegisterRepository registerRepository; + // 密码加密 + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + @Autowired + public RegisterService(RegisterRepository registerRepository) { + this.registerRepository = registerRepository; + } + + public UserRegisterResponse register(UserRegister userRegister) { + // 检查用户名和电子邮件是否已存在 + Optional optionalName = registerRepository.findByUserName(userRegister.getUserName()); + Optional optionalEmail = registerRepository.findByUserEmail(userRegister.getUserEmail()); + UserRegisterResponse userRegisterResponse = new UserRegisterResponse(); + if (optionalName.isPresent()) { + userRegisterResponse.setMessage("已经存在账户名"); + } + else + { + if (optionalEmail.isPresent()) { + userRegisterResponse.setMessage("已经存在电子邮件"); + } + else + { + UserInfo user = new UserInfo(); + user.setUserName(userRegister.getUserName()); + user.setUserEmail(userRegister.getUserEmail()); + user.setUserPassword(passwordEncoder.encode(userRegister.getUserPassword())); + registerRepository.save(user); + userRegisterResponse.setUserId(user.getUserId()); + userRegisterResponse.setMessage("注册成功"); + } + } + + return userRegisterResponse; + } +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/service/RegularCheckupService.java b/src/main/java/edu/zrh/healthsystem/service/RegularCheckupService.java new file mode 100644 index 0000000..3840768 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/RegularCheckupService.java @@ -0,0 +1,137 @@ +package edu.zrh.healthsystem.service; + +import edu.zrh.healthsystem.eneity.RegularCheckupInfo; +import edu.zrh.healthsystem.eneity.UserInfo; +import edu.zrh.healthsystem.model.Elderly; +import edu.zrh.healthsystem.model.elderly.RegularCheckupInfoResponse; +import edu.zrh.healthsystem.repository.RegularCheckupInfoRespository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +@Service +public class RegularCheckupService { + private final RegularCheckupInfoRespository regularCheckupInfoRespository; + + @Autowired + public RegularCheckupService(RegularCheckupInfoRespository regularCheckupInfoRespository) { + this.regularCheckupInfoRespository = regularCheckupInfoRespository; + } + RegularCheckupInfoResponse regularCheckupInfoResponse = new RegularCheckupInfoResponse(); + + public RegularCheckupInfoResponse add(Elderly elderly) { + Optional optionalElderly = regularCheckupInfoRespository.findByElderlyId(elderly.getElderlyId()); + if (optionalElderly.isPresent()) { + regularCheckupInfoResponse.setMessage("已经有表"); + } else { + RegularCheckupInfo regularCheckupInfo = new RegularCheckupInfo(); + regularCheckupInfo.setBloodType(elderly.getBloodType()); + regularCheckupInfo.setId(elderly.getElderlyId()); + regularCheckupInfo.setCheckupDate(elderly.getCheckupDate()); + regularCheckupInfo.setBloodPressure(elderly.getBloodPressure()); + regularCheckupInfo.setFaceImage(elderly.getFaceImage()); + regularCheckupInfo.setHeight(elderly.getHeight()); + regularCheckupInfo.setGlucoseLevel(elderly.getGlucoseLevel()); + regularCheckupInfo.setPulse(elderly.getPulse()); + regularCheckupInfo.setHeartRate(elderly.getHeartRate()); + regularCheckupInfo.setChronicDiseases(elderly.getChronicDiseases()); + regularCheckupInfo.setTemperature(elderly.getTemperature()); + regularCheckupInfo.setWeight(elderly.getWeight()); + regularCheckupInfo.setTongueImage(elderly.getTongueImage()); + regularCheckupInfo.setWeightStatus(elderly.getWeightStatus()); + regularCheckupInfo.setOxygenSaturation(elderly.getOxygenSaturation()); + regularCheckupInfoRespository.save(regularCheckupInfo); + regularCheckupInfoResponse.setMessage("添加成功"); + } + return regularCheckupInfoResponse; + } + public RegularCheckupInfoResponse delete(Elderly elderly) { + Optional optionalElderly = regularCheckupInfoRespository.findByElderlyId(elderly.getElderlyId()); + if (optionalElderly.isPresent()) { + RegularCheckupInfo regularCheckupInfo = optionalElderly.get(); + regularCheckupInfo.setBloodType(elderly.getBloodType()); + regularCheckupInfo.setId(elderly.getElderlyId()); + regularCheckupInfo.setCheckupDate(elderly.getCheckupDate()); + regularCheckupInfo.setBloodPressure(elderly.getBloodPressure()); + regularCheckupInfo.setFaceImage(elderly.getFaceImage()); + regularCheckupInfo.setHeight(elderly.getHeight()); + regularCheckupInfo.setGlucoseLevel(elderly.getGlucoseLevel()); + regularCheckupInfo.setPulse(elderly.getPulse()); + regularCheckupInfo.setHeartRate(elderly.getHeartRate()); + regularCheckupInfo.setChronicDiseases(elderly.getChronicDiseases()); + regularCheckupInfo.setTemperature(elderly.getTemperature()); + regularCheckupInfo.setWeight(elderly.getWeight()); + regularCheckupInfo.setTongueImage(elderly.getTongueImage()); + regularCheckupInfo.setWeightStatus(elderly.getWeightStatus()); + regularCheckupInfo.setOxygenSaturation(elderly.getOxygenSaturation()); + regularCheckupInfoRespository.save(regularCheckupInfo); + regularCheckupInfoResponse.setMessage("删除成功"); + } else { + regularCheckupInfoResponse.setMessage("没有该表"); + } + return regularCheckupInfoResponse; + } + + public RegularCheckupInfoResponse update(Elderly elderly) { + Optional optionalElderly = regularCheckupInfoRespository.findByElderlyId(elderly.getElderlyId()); + if (optionalElderly.isPresent()) { + RegularCheckupInfo regularCheckupInfo = optionalElderly.get(); + regularCheckupInfo.setBloodType(elderly.getBloodType()); + regularCheckupInfo.setId(elderly.getElderlyId()); + regularCheckupInfo.setCheckupDate(elderly.getCheckupDate()); + regularCheckupInfo.setBloodPressure(elderly.getBloodPressure()); + regularCheckupInfo.setFaceImage(elderly.getFaceImage()); + regularCheckupInfo.setHeight(elderly.getHeight()); + regularCheckupInfo.setGlucoseLevel(elderly.getGlucoseLevel()); + regularCheckupInfo.setPulse(elderly.getPulse()); + regularCheckupInfo.setHeartRate(elderly.getHeartRate()); + regularCheckupInfo.setChronicDiseases(elderly.getChronicDiseases()); + regularCheckupInfo.setTemperature(elderly.getTemperature()); + regularCheckupInfo.setWeight(elderly.getWeight()); + regularCheckupInfo.setTongueImage(elderly.getTongueImage()); + regularCheckupInfo.setWeightStatus(elderly.getWeightStatus()); + regularCheckupInfo.setOxygenSaturation(elderly.getOxygenSaturation()); + regularCheckupInfoRespository.save(regularCheckupInfo); + regularCheckupInfoResponse.setMessage("更新成功"); + } else { + regularCheckupInfoResponse.setMessage("没有该表"); + } + return regularCheckupInfoResponse; + } + public RegularCheckupInfoResponse get(Elderly elderly) { + Optional optionalElderly = regularCheckupInfoRespository.findByElderlyId(elderly.getElderlyId()); + if (optionalElderly.isPresent()) { + regularCheckupInfoResponse.setBloodType(elderly.getBloodType()); + regularCheckupInfoResponse.setId(elderly.getElderlyId()); + regularCheckupInfoResponse.setCheckupDate(elderly.getCheckupDate()); + regularCheckupInfoResponse.setBloodPressure(elderly.getBloodPressure()); + regularCheckupInfoResponse.setFaceImage(elderly.getFaceImage()); + regularCheckupInfoResponse.setHeight(elderly.getHeight()); + regularCheckupInfoResponse.setGlucoseLevel(elderly.getGlucoseLevel()); + regularCheckupInfoResponse.setPulse(elderly.getPulse()); + regularCheckupInfoResponse.setHeartRate(elderly.getHeartRate()); + regularCheckupInfoResponse.setChronicDiseases(elderly.getChronicDiseases()); + regularCheckupInfoResponse.setTemperature(elderly.getTemperature()); + regularCheckupInfoResponse.setWeight(elderly.getWeight()); + regularCheckupInfoResponse.setProfileId(elderly.getProfileId()); + regularCheckupInfoResponse.setTongueImage(elderly.getTongueImage()); + regularCheckupInfoResponse.setWeightStatus(elderly.getWeightStatus()); + regularCheckupInfoResponse.setOxygenSaturation(elderly.getOxygenSaturation()); + regularCheckupInfoResponse.setMessage("查找成功"); + } else { + regularCheckupInfoResponse.setMessage("没有该表"); + } + return regularCheckupInfoResponse; + } + public RegularCheckupInfoResponse getAll() { + + //待实现 + regularCheckupInfoResponse.setMessage("查找全部成功"); + + return regularCheckupInfoResponse; + } + +} diff --git a/src/main/java/edu/zrh/healthsystem/service/TalkService.java b/src/main/java/edu/zrh/healthsystem/service/TalkService.java new file mode 100644 index 0000000..3f6f254 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/TalkService.java @@ -0,0 +1,28 @@ +package edu.zrh.healthsystem.service; + +import edu.zrh.healthsystem.model.Talk; +import edu.zrh.healthsystem.model.TalkResponse; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +/** + * @author han + */ +@Service +public class TalkService { + private final RestTemplate restTemplate; + + public TalkService(RestTemplate restTemplate) { + this.restTemplate = restTemplate; + } + + public String callApi(String url) { + return restTemplate.getForObject(url, String.class); + } + + public TalkResponse callApiChat(Talk request) { + return restTemplate.postForObject("http://10.10.10.44:11434/api/chat", request, TalkResponse.class); + } +} diff --git a/src/main/java/edu/zrh/healthsystem/service/elderly/ElderMainService.java b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderMainService.java new file mode 100644 index 0000000..fca4709 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderMainService.java @@ -0,0 +1,25 @@ +package edu.zrh.healthsystem.service.elderly; + +import edu.zrh.healthsystem.eneity.BasicInfo; +import edu.zrh.healthsystem.repository.elderly.ElderMainRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author han + */ +@Service +public class ElderMainService { + private final ElderMainRepository elderMainRepository; + + @Autowired + public ElderMainService(ElderMainRepository elderMainRepository) {this.elderMainRepository = elderMainRepository;} + + public List elderMain(){ + List basicInfoList = elderMainRepository.findAll(); + return basicInfoList; + } + +} \ No newline at end of file diff --git a/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyConnectService.java b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyConnectService.java new file mode 100644 index 0000000..6f16522 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyConnectService.java @@ -0,0 +1,44 @@ +package edu.zrh.healthsystem.service.elderly; + +import edu.zrh.healthsystem.eneity.UserInfo; +import edu.zrh.healthsystem.model.elderly.ElderlyConnect; +import edu.zrh.healthsystem.model.elderly.ElderlyConnectResponse; +import edu.zrh.healthsystem.repository.elderly.ElderlyConnectRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Optional; + +@Service +public class ElderlyConnectService { + private final ElderlyConnectRepository elderlyConnectRepository; + + @Autowired + public ElderlyConnectService(ElderlyConnectRepository elderlyConnectRepository) { + this.elderlyConnectRepository = elderlyConnectRepository; + } + public ElderlyConnectResponse getElderlyConnectResponse(ElderlyConnect elderlyConnect) { + Optional optionalUserId = elderlyConnectRepository.findByUserId(elderlyConnect.getUserId()); + Optional optionalUserElderly = elderlyConnectRepository.findByUserElderly(elderlyConnect.getUserElderly()); + ElderlyConnectResponse elderlyConnectResponse = new ElderlyConnectResponse(); + if (optionalUserId.isPresent()) { + if(optionalUserElderly.isPresent()) + { + UserInfo userInfo = optionalUserId.get(); + userInfo.setUserElderly(elderlyConnect.getUserElderly()); + elderlyConnectResponse.setUserId(elderlyConnect.getUserId()); + elderlyConnectResponse.setMessage("添加成功"); + } + else { + elderlyConnectResponse.setUserId(-2); + elderlyConnectResponse.setMessage("该老人不存在"); + } + + } + else { + elderlyConnectResponse.setUserId(-1); + elderlyConnectResponse.setMessage("该用户不存在"); + } + return elderlyConnectResponse; + } +} diff --git a/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyNewService.java b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyNewService.java new file mode 100644 index 0000000..08cc9cf --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyNewService.java @@ -0,0 +1,66 @@ +package edu.zrh.healthsystem.service.elderly; + + +import edu.zrh.healthsystem.eneity.BasicInfo; +import edu.zrh.healthsystem.eneity.MainProfileInfo; +import edu.zrh.healthsystem.model.elderly.ElderlyNew; +import edu.zrh.healthsystem.model.elderly.ElderlyNewResponse; +import edu.zrh.healthsystem.repository.elderly.ElderlyNewRepository; +import edu.zrh.healthsystem.repository.MainProfileInfoRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Optional; + +/** + * @author han + */ +@Service +public class ElderlyNewService { + private final ElderlyNewRepository elderlyNewRepository; + private final MainProfileInfoRepository mainProfileInfoRepository; + @Autowired + public ElderlyNewService(ElderlyNewRepository elderlyNewRepository, MainProfileInfoRepository mainProfileInfoRepository) { + this.elderlyNewRepository = elderlyNewRepository; + this.mainProfileInfoRepository = mainProfileInfoRepository; + } + + public ElderlyNewResponse elderly(ElderlyNew elderlyNew) { + Optional optionalBasicInfo = elderlyNewRepository.findByFullName(elderlyNew.getFullName()); + ElderlyNewResponse elderlyNewResponse = new ElderlyNewResponse(); + if (optionalBasicInfo.isPresent()) { + elderlyNewResponse.setElderlyId(-1); + elderlyNewResponse.setMessage("该用户已存在"); + } + else { + BasicInfo basic = new BasicInfo(); + + basic.setContactRelation(elderlyNew.getContactRelation()); + basic.setContactPhone(elderlyNew.getContactPhone()); + basic.setContactName(elderlyNew.getContactName()); + basic.setFullName(elderlyNew.getFullName()); + basic.setGender(elderlyNew.getGender()); + basic.setDateOfBirth(elderlyNew.getDateOfBirth()); + basic.setEthnicity(elderlyNew.getEthnicity()); + basic.setNativePlace(elderlyNew.getNativePlace()); + basic.setIdNumber(elderlyNew.getIdNumber()); + basic.setPermanentAddress(elderlyNew.getPermanentAddress()); + basic.setOccupation(elderlyNew.getOccupation()); + basic.setEducationLevel(elderlyNew.getEducationLevel()); + basic.setLivingAlone(elderlyNew.getLivingAlone()); + basic.setMaritalStatus(elderlyNew.getMaritalStatus()); + basic.setPhoneNumber(elderlyNew.getPhoneNumber()); + basic.setEatingHabits(elderlyNew.getEatingHabits()); + basic.setExerciseFrequency(elderlyNew.getExerciseFrequency()); + elderlyNewRepository.save(basic); + // 创建MainProfile记录 + MainProfileInfo mainProfile = new MainProfileInfo(); + mainProfile.setElderlyId(basic); + // 保存MainProfile记录 + mainProfileInfoRepository.save(mainProfile); + elderlyNewResponse.setElderlyId(basic.getElderlyId()); + elderlyNewResponse.setMessage("提交成功"); + } + return elderlyNewResponse; + } +} diff --git a/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyShowService.java b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyShowService.java new file mode 100644 index 0000000..5ca91f0 --- /dev/null +++ b/src/main/java/edu/zrh/healthsystem/service/elderly/ElderlyShowService.java @@ -0,0 +1,51 @@ +package edu.zrh.healthsystem.service.elderly; + +import edu.zrh.healthsystem.eneity.BasicInfo; +import edu.zrh.healthsystem.model.Elderly; +import edu.zrh.healthsystem.repository.elderly.ElderlyShowRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import edu.zrh.healthsystem.model.elderly.ElderlyShowResponse; + +import java.util.Optional; + +@Service +public class ElderlyShowService { + private final ElderlyShowRepository elderlyShowRepository; + + @Autowired + public ElderlyShowService(ElderlyShowRepository elderlyShowRepository) { + this.elderlyShowRepository = elderlyShowRepository; + } + + public ElderlyShowResponse getElderlyShow(Elderly elderly) { + Optional optionalelderlyId = elderlyShowRepository.findByElderlyId(elderly.getElderlyId()); + ElderlyShowResponse elderlyShowResponse = new ElderlyShowResponse(); + if (optionalelderlyId.isPresent()) { + BasicInfo basic=optionalelderlyId.get(); + elderlyShowResponse.setElderlyId(basic.getElderlyId()); + elderlyShowResponse.setContactName(basic.getContactName()); + elderlyShowResponse.setContactPhone(basic.getContactPhone()); + elderlyShowResponse.setEatingHabits(basic.getEatingHabits()); + elderlyShowResponse.setContactRelation(basic.getContactRelation()); + elderlyShowResponse.setEthnicity(basic.getEthnicity()); + elderlyShowResponse.setEducationLevel(basic.getEducationLevel()); + elderlyShowResponse.setExerciseFrequency(basic.getExerciseFrequency()); + elderlyShowResponse.setGender(basic.getGender()); + elderlyShowResponse.setMaritalStatus(basic.getMaritalStatus()); + elderlyShowResponse.setDateOfBirth(basic.getDateOfBirth()); + elderlyShowResponse.setOccupation(basic.getOccupation()); + elderlyShowResponse.setLivingAlone(basic.getLivingAlone()); + elderlyShowResponse.setNativePlace(basic.getNativePlace()); + elderlyShowResponse.setFullName(basic.getFullName()); + elderlyShowResponse.setMessage("获取成功"); + elderlyShowResponse.setPermanentAddress(basic.getPermanentAddress()); + elderlyShowResponse.setIdNumber(basic.getIdNumber()); + elderlyShowResponse.setPhoneNumber(basic.getPhoneNumber()); + } + else { + elderlyShowResponse.setMessage("该用户不存在"); + } + return elderlyShowResponse; + } +} diff --git a/src/main/resources/WEB-INF/spring-conf/mvc.xml b/src/main/resources/WEB-INF/spring-conf/mvc.xml new file mode 100644 index 0000000..5559581 --- /dev/null +++ b/src/main/resources/WEB-INF/spring-conf/mvc.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/WEB-INF/web.xml b/src/main/resources/WEB-INF/web.xml new file mode 100644 index 0000000..4956bae --- /dev/null +++ b/src/main/resources/WEB-INF/web.xml @@ -0,0 +1,23 @@ + + + + springmvc + org.springframework.web.servlet.DispatcherServlet + + + contextConfigLocation + classpath:/WEB-INF/spring-conf/mvc.xml + + + + 1 + + + springmvc + / + + + \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..28c4ea1 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,7 @@ +spring.application.name=healthSystem +# DataSource settings +spring.datasource.url= jdbc:mysql://localhost:3306/healthsystem?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=Asia/Shanghai + +spring.datasource.username=root +spring.datasource.password=1234 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver diff --git a/src/test/java/edu/zrh/healthsystem/HealthSystemApplicationTests.java b/src/test/java/edu/zrh/healthsystem/HealthSystemApplicationTests.java new file mode 100644 index 0000000..1802e9f --- /dev/null +++ b/src/test/java/edu/zrh/healthsystem/HealthSystemApplicationTests.java @@ -0,0 +1,22 @@ +package edu.zrh.healthsystem; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import java.sql.DriverManager; +import java.sql.Driver; + +import java.util.Enumeration; + +@SpringBootTest +class HealthSystemApplicationTests { + + @Test + void contextLoads() { + Enumeration drivers = DriverManager.getDrivers(); + while (drivers.hasMoreElements()) { + Driver driver = drivers.nextElement(); + System.out.println("驱动名称: " + driver.getClass().getName()); + } + } +}