23 Commity 4241491627 ... ed1dbe63b7

Autor SHA1 Wiadomość Data
  huangzhiyong ed1dbe63b7 Merge branch 'master' of http://192.168.1.220:10080/EHR/svr-inspection 6 lat temu
  huangzhiyong 85443bac6b Merge branch 'fuzhou' of http://192.168.192.92:3000/jkzl.cloud/svr-inspection 6 lat temu
  huangzhiyong 72537dd1c9 添加返回类型 6 lat temu
  majian 58d61ebd37 添加私有库地址 6 lat temu
  huangzhiyong df13510332 处理状态修改 6 lat temu
  huangzhiyong 802e8b0ca2 撤销的申请改为未申请状态 6 lat temu
  huangzhiyong a3b5062ed8 检查检验收据抽取 6 lat temu
  huangzhiyong 242e5103cf 检验申请 撤回接口 6 lat temu
  huangzhiyong 781b5646ff 添加检验员字段 6 lat temu
  huangzhiyong 6c76d4fee6 Merge branch 'fuzhou' of http://192.168.192.92:3000/jkzl.cloud/svr-inspection 6 lat temu
  huangzhiyong e54e43f902 字段类型修改 6 lat temu
  huangzhiyong a5b825a244 医院端今日新增 6 lat temu
  majian 036e7721f4 为福州配置 6 lat temu
  majian 0b3603bd41 合并 6 lat temu
  huangzhiyong 8157a2fd5d demo 问题提交 6 lat temu
  huangzhiyong c3df308077 区域检验-统计接口2 6 lat temu
  huangzhiyong 04c2bb4c4a 区域检验-统计接口1 6 lat temu
  huangzhiyong 87253f4acf 检验申请接口-实现添加 6 lat temu
  majian 91599c5220 为福州配置 6 lat temu
  huangzhiyong b9a2297923 pom修改 6 lat temu
  huangzhiyong 4d866f3b92 无用配置删除 6 lat temu
  huangzhiyong 9b68f49f9d demo接口提交 6 lat temu
  huangzhiyong 9fcd670169 首次提交 6 lat temu
23 zmienionych plików z 2241 dodań i 10 usunięć
  1. 23 10
      .gitignore
  2. 286 0
      mvnw
  3. 161 0
      mvnw.cmd
  4. 107 0
      pom.xml
  5. 1 0
      readme.MD
  6. 29 0
      src/main/java/com/yihu/ehr/SvrInspectionApplication.java
  7. 54 0
      src/main/java/com/yihu/ehr/svrinspection/commons/config/SchedulerConfig.java
  8. 28 0
      src/main/java/com/yihu/ehr/svrinspection/commons/exception/ManageException.java
  9. 53 0
      src/main/java/com/yihu/ehr/svrinspection/commons/model/IntegerIdentityEntity.java
  10. 48 0
      src/main/java/com/yihu/ehr/svrinspection/commons/service/BaseService.java
  11. 216 0
      src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyController.java
  12. 118 0
      src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyControllerDemo.java
  13. 31 0
      src/main/java/com/yihu/ehr/svrinspection/dao/AssistanceApplyDao.java
  14. 43 0
      src/main/java/com/yihu/ehr/svrinspection/feign/AddressClient.java
  15. 54 0
      src/main/java/com/yihu/ehr/svrinspection/job/InspectionExtractJob.java
  16. 105 0
      src/main/java/com/yihu/ehr/svrinspection/job/SchedulerManager.java
  17. 285 0
      src/main/java/com/yihu/ehr/svrinspection/model/AssistanceApplyModel.java
  18. 189 0
      src/main/java/com/yihu/ehr/svrinspection/service/AssistanceApplyService.java
  19. 298 0
      src/main/java/com/yihu/ehr/svrinspection/service/ExamStatisticsService.java
  20. 49 0
      src/main/resources/application.yml
  21. 16 0
      src/main/resources/banner.txt
  22. 31 0
      src/main/resources/bootstrap.yml
  23. 16 0
      src/test/java/com/yihu/ehr/svrinspection/SvrInspectionApplicationTests.java

+ 23 - 10
.gitignore

@ -1,14 +1,27 @@
# ---> Java
*.class
/target/
!.mvn/wrapper/maven-wrapper.jar
# Mobile Tools for Java (J2ME)
.mtj.tmp/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
# Package Files #
*.jar
*.war
*.ear
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
logs/

+ 286 - 0
mvnw

@ -0,0 +1,286 @@
#!/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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
#   JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
#   M2_HOME - location of maven2's installed home dir
#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
#     e.g. to debug Maven itself, use
#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
  if [ -f /etc/mavenrc ] ; then
    . /etc/mavenrc
  fi
  if [ -f "$HOME/.mavenrc" ] ; then
    . "$HOME/.mavenrc"
  fi
fi
# OS specific support.  $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
  CYGWIN*) cygwin=true ;;
  MINGW*) mingw=true;;
  Darwin*) darwin=true
    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
    if [ -z "$JAVA_HOME" ]; then
      if [ -x "/usr/libexec/java_home" ]; then
        export JAVA_HOME="`/usr/libexec/java_home`"
      else
        export JAVA_HOME="/Library/Java/Home"
      fi
    fi
    ;;
esac
if [ -z "$JAVA_HOME" ] ; then
  if [ -r /etc/gentoo-release ] ; then
    JAVA_HOME=`java-config --jre-home`
  fi
fi
if [ -z "$M2_HOME" ] ; then
  ## resolve links - $0 may be a link to maven's home
  PRG="$0"
  # need this for relative symlinks
  while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
      PRG="$link"
    else
      PRG="`dirname "$PRG"`/$link"
    fi
  done
  saveddir=`pwd`
  M2_HOME=`dirname "$PRG"`/..
  # make it fully qualified
  M2_HOME=`cd "$M2_HOME" && pwd`
  cd "$saveddir"
  # echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --unix "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
  [ -n "$M2_HOME" ] &&
    M2_HOME="`(cd "$M2_HOME"; pwd)`"
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
  # TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
  javaExecutable="`which javac`"
  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
    # readlink(1) is not available as standard on Solaris 10.
    readLink=`which readlink`
    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
      if $darwin ; then
        javaHome="`dirname \"$javaExecutable\"`"
        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
      else
        javaExecutable="`readlink -f \"$javaExecutable\"`"
      fi
      javaHome="`dirname \"$javaExecutable\"`"
      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
      JAVA_HOME="$javaHome"
      export JAVA_HOME
    fi
  fi
fi
if [ -z "$JAVACMD" ] ; then
  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"
    else
      JAVACMD="$JAVA_HOME/bin/java"
    fi
  else
    JAVACMD="`which java`"
  fi
fi
if [ ! -x "$JAVACMD" ] ; then
  echo "Error: JAVA_HOME is not defined correctly." >&2
  echo "  We cannot execute $JAVACMD" >&2
  exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
  echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
  if [ -z "$1" ]
  then
    echo "Path not specified to find_maven_basedir"
    return 1
  fi
  basedir="$1"
  wdir="$1"
  while [ "$wdir" != '/' ] ; do
    if [ -d "$wdir"/.mvn ] ; then
      basedir=$wdir
      break
    fi
    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
    if [ -d "${wdir}" ]; then
      wdir=`cd "$wdir/.."; pwd`
    fi
    # end of workaround
  done
  echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
  if [ -f "$1" ]; then
    echo "$(tr -s '\n' ' ' < "$1")"
  fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
  exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Found .mvn/wrapper/maven-wrapper.jar"
    fi
else
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
    fi
    jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
    while IFS="=" read key value; do
      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
      esac
    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
    if [ "$MVNW_VERBOSE" = true ]; then
      echo "Downloading from: $jarUrl"
    fi
    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
    if command -v wget > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found wget ... using wget"
        fi
        wget "$jarUrl" -O "$wrapperJarPath"
    elif command -v curl > /dev/null; then
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Found curl ... using curl"
        fi
        curl -o "$wrapperJarPath" "$jarUrl"
    else
        if [ "$MVNW_VERBOSE" = true ]; then
          echo "Falling back to using Java to download"
        fi
        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
        if [ -e "$javaClass" ]; then
            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Compiling MavenWrapperDownloader.java ..."
                fi
                # Compiling the Java class
                ("$JAVA_HOME/bin/javac" "$javaClass")
            fi
            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
                # Running the downloader
                if [ "$MVNW_VERBOSE" = true ]; then
                  echo " - Running MavenWrapperDownloader.java ..."
                fi
                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
            fi
        fi
    fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
  echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
  [ -n "$M2_HOME" ] &&
    M2_HOME=`cygpath --path --windows "$M2_HOME"`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  [ -n "$CLASSPATH" ] &&
    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
  $MAVEN_OPTS \
  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 161 - 0
mvnw.cmd

@ -0,0 +1,161 @@
@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 Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM     e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
	IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
    echo Found %WRAPPER_JAR%
) else (
    echo Couldn't find %WRAPPER_JAR%, downloading it ...
	echo Downloading from: %DOWNLOAD_URL%
    powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
    echo Finished downloading %WRAPPER_JAR%
)
@REM End of extension
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

+ 107 - 0
pom.xml

@ -0,0 +1,107 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.yihu.ehr</groupId>
		<artifactId>ehr-cloud-parent</artifactId>
		<version>1.13.0</version>
	</parent>
	<artifactId>svr-inspection</artifactId>
	<packaging>jar</packaging>
	<name>svr-inspection</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-feign</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-config</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-eureka</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>
		<!-- 医疗云私有包 -->
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-ui-swagger</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-web</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-data-mysql</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-util</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-rest-model</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-data-solr</artifactId>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-data-query</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.yihu.ehr</groupId>
			<artifactId>commons-data-redis</artifactId>
		</dependency>
		<dependency>
			<groupId>org.quartz-scheduler</groupId>
			<artifactId>quartz</artifactId>
		</dependency>
	</dependencies>
    <repositories>
        <repository>
            <id>cloud-public</id>
            <name>cloud-public</name>
            <url>http://192.168.192.92:8081/repository/cloud-public/</url>
        </repository>
    </repositories>
	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>

+ 1 - 0
readme.MD

@ -0,0 +1 @@
svr-inspection 医疗云-区域检验平台微服务

+ 29 - 0
src/main/java/com/yihu/ehr/SvrInspectionApplication.java

@ -0,0 +1,29 @@
package com.yihu.ehr;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.data.web.config.EnableSpringDataWebSupport;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients
@SpringBootApplication
@EnableScheduling
public class SvrInspectionApplication extends SpringBootServletInitializer {
	public static void main(String[] args) {
		SpringApplication.run(SvrInspectionApplication.class, args);
	}
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(SvrInspectionApplication.class);
	}
}

+ 54 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/config/SchedulerConfig.java

@ -0,0 +1,54 @@
package com.yihu.ehr.svrinspection.commons.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.util.Assert;
/***
 * @author HZY
 * @created 2018/11/27 14:47
 */
@ConfigurationProperties(prefix = "extract.job")
@Configuration
public class SchedulerConfig {
    private int initSize;
    private int maxSize;
    private String cronExp;
    public int getInitSize() {
        return initSize;
    }
    public void setInitSize(int initSize) {
        this.initSize = initSize;
    }
    public int getMaxSize() {
        return maxSize;
    }
    public void setMaxSize(int maxSize) {
        this.maxSize = maxSize;
    }
    public String getCronExp() {
        return cronExp;
    }
    public void setCronExp(String cronExp) {
        this.cronExp = cronExp;
    }
    @Bean
    SchedulerFactoryBean schedulerFactoryBean(){
        Assert.notNull(cronExp, "Can not found extract job config");
        SchedulerFactoryBean bean = new SchedulerFactoryBean();
        bean.setAutoStartup(true);
        bean.setSchedulerName("InspectionExtractScheduler");
        return bean;
    }
}

+ 28 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/exception/ManageException.java

@ -0,0 +1,28 @@
package com.yihu.ehr.svrinspection.commons.exception;
/**
 *  公共异常类
 *
 * @author HZY
 * @created 2018/11/15 10:21
 */
public class ManageException extends Exception{
    public ManageException() {
    }
    public ManageException(String message) {
        super(message);
    }
    public ManageException(String message, Throwable cause) {
        super(message, cause);
    }
    public ManageException(Throwable cause) {
        super(cause);
    }
    public ManageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}

+ 53 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/model/IntegerIdentityEntity.java

@ -0,0 +1,53 @@
package com.yihu.ehr.svrinspection.commons.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
 *  integer实体类-基类
 *
 * @author HZY
 * @created 2018/11/14 16:23
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class IntegerIdentityEntity implements Serializable {
    protected Integer id;
    protected Date createTime;
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 48 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/service/BaseService.java

@ -0,0 +1,48 @@
package com.yihu.ehr.svrinspection.commons.service;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
/**
 *  公共业务类
 *
 * @author HZY
 * @created 2018/11/16 9:58
 */
public class BaseService {
    /**
     *  降序排序
     * @param list          排序集合
     * @param orderField    排序字段
     */
    public void comparator(List<Map<String, Object>> list , String orderField){
        Collections.sort(list, new Comparator<Map<String, Object>>() {
            @Override
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                return getIntegerValue(o2.get(orderField)).compareTo(getIntegerValue(o1.get(orderField)));
            }
        });
    }
    /**
     * 获取值
     * @param objValue
     * @return
     */
    public Integer getIntegerValue(Object objValue) {
        int value = 0;
        try {
            if (objValue != null) {
                value = Integer.parseInt(objValue.toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return value;
    }
}

+ 216 - 0
src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyController.java

@ -0,0 +1,216 @@
package com.yihu.ehr.svrinspection.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.controller.EnvelopRestEndPoint;
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import com.yihu.ehr.svrinspection.service.AssistanceApplyService;
import com.yihu.ehr.svrinspection.service.ExamStatisticsService;
import com.yihu.ehr.util.rest.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
 *  机构检验申请控制类
 *
 * @author HZY
 * @created 2018/11/9 16:23
 */
@RequestMapping( "/api/v1.1/exam")
@RestController
@Api(value = "assistanceApply", description = "区域检验相关接口", tags = {"区域检验"})
public class AssistanceApplyController extends EnvelopRestEndPoint {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private AssistanceApplyService assistanceApplyService;
    @Autowired
    private ExamStatisticsService examStatisticsService;
    @GetMapping(value = "/area")
    @ApiOperation(value = "区域检验-【区域排行】")
    public Envelop examAreaRanking(
            @ApiParam(name = "pid", value = "上级区域编码", defaultValue = "361100")
            @RequestParam(value = "pid", required = false,defaultValue = "361100") Integer pid,
            @ApiParam(name = "eventDate", value = "就诊时间(年月)",required = true, defaultValue = "")
            @RequestParam(value = "eventDate", required = false) String eventDate) throws Exception {
        List<Map<String,Object>> list = examStatisticsService.areaGroupCount(pid,"org_area",eventDate);
        return success(list);
    }
    @GetMapping(value = "/hospital")
    @ApiOperation(value = "区域检验-【医院排行】")
    public Envelop examHospitalRanking(
            @ApiParam(name = "areaCode", value = "区域编码(为空显示全市数据)", defaultValue = "")
            @RequestParam(value = "areaCode", required = false) String areaCode,
            @ApiParam(name = "eventDate", value = "就诊时间(年月)", defaultValue = "")
            @RequestParam(value = "eventDate", required = false) String eventDate)  {
        List<Map<String,Object>> list = null;
        try {
            list = examStatisticsService.hospitalGroupCount(areaCode,"org_code",eventDate);
        } catch (Exception e) {
           return failed(e.getMessage());
        }
        return success(list);
    }
    @GetMapping(value = "/statistics")
    @ApiOperation(value = "区域检验数-【统计信息】",notes = "包含今日新增量,检验次数业务分布")
    public Envelop statistics(
            @ApiParam(name = "areaCode", value = "区域编码(不传默认全市)", defaultValue = "")
            @RequestParam(value = "areaCode", required = false) String areaCode,
            @ApiParam(name = "date", value = "日期", defaultValue = "")
            @RequestParam(value = "date", required = false) String date) throws IOException {
        Map<String,Object> map = null;
        try {
            map = examStatisticsService.areaExamStatistics(areaCode,date);
        } catch (ManageException e) {
            return failed(e.getMessage());
        } catch (Exception e) {
            return failed(e.getMessage());
        }
        return success(map);
    }
    @GetMapping(value = "/organizations/statistics")
    @ApiOperation(value = "机构今日检验统计查询-【医生端-头部统计信息】",notes = "医生端的头部统计信息,数据为当日的数据统计")
    public Envelop orgStatistics(
            @ApiParam(name = "orgCode", value = "机构编码(不传默认全市)", defaultValue = "")
            @RequestParam(value = "orgCode", required = false) String orgCode) throws IOException {
        Map<String,Object> map = null;
        try {
            map = examStatisticsService.organizationExamStatistics(orgCode);
        } catch (ManageException e) {
            return failed(e.getMessage());
        } catch (Exception e) {
            return failed(e.getMessage());
        }
        return success(map);
    }
    @GetMapping(value = "/organizations/basic/statistics")
    @ApiOperation(value = "机构今日检验统计查询-【基层机构端-头部统计信息】",notes = "基层机构端的头部统计信息,主要包含总检验数,及今日已处理数,今日未处理数")
    public Envelop basicOrgStatistics(
            @ApiParam(name = "orgCode", value = "机构编码(不传默认全市)", defaultValue = "")
            @RequestParam(value = "orgCode", required = false) String orgCode) throws IOException {
        Map<String,Object> map = null;
        try {
            map = examStatisticsService.basicOrgExamStatistics(orgCode);
        } catch (ManageException e) {
            return failed(e.getMessage());
        } catch (Exception e) {
            return failed(e.getMessage());
        }
        return success(map);
    }
    @GetMapping(value = "/apply/list")
    @ApiOperation(value = "机构申请/处理列表查询",notes = "filters 的like查询用“?”,")
    public Envelop applyList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,like用?,为空检索所有信息eg:applyOrg=jkzl;createTime>=2018-11-14T18:43:57Z;createTime<2018-11-14T22:59:59Z;", defaultValue = "")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,升序+,降序-(eg:+id)", defaultValue = "+id")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws IOException, ParseException {
        List<AssistanceApplyModel> assistanceApplyModelList = (List<AssistanceApplyModel>)assistanceApplyService.search(fields, filters, sorts, page, size);
        Envelop envelop = new Envelop();
        envelop.setTotalCount((int)assistanceApplyService.getCount(filters));
        envelop.setCurrPage(page);
        envelop.setPageSize(size);
        envelop.setDetailModelList(assistanceApplyModelList);
        envelop.setSuccessFlg(true);
        envelop.setTotalPage(envelop.getTotalPage());
        return envelop;
//        pagedResponse(request, response, assistanceApplyService.getCount(filters), page, size);
//        return convertToModels(assistanceApplyModelList, new ArrayList<AssistanceApplyModel>(assistanceApplyModelList.size()), AssistanceApplyModel.class, fields);
    }
    @GetMapping(value = "/apply/detail")
    @ApiOperation(value = "下级机构申请详情-查看")
    public Envelop applyDetail(
            @ApiParam(name = "applyId", value = "申请记录ID")
            @RequestParam(value = "applyId", required = false) int applyId) {
        AssistanceApplyModel applyModel = assistanceApplyService.findById(applyId);
        return success(applyModel);
    }
    @ApiOperation(value = "检验协助申请", response = AssistanceApplyModel.class,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = "apply",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop createAssistanceApply(
            @ApiParam(name = "apply", value = "档案申请JSON结构",required = true)
            @RequestBody(required = true) AssistanceApplyModel apply)  {
        AssistanceApplyModel save = null;
        try {
            save = assistanceApplyService.saveOrUpdateApply(apply);
        } catch (ManageException e) {
            return failed(e.getMessage());
        }
        return success(save);
    }
    @ApiOperation(value = "检验申请处理", response = AssistanceApplyModel.class,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = "apply/solution",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop applySolution (
            @ApiParam(name = "applyId", value = "申请记录ID", defaultValue = "")
            @RequestParam(value = "applyId", required = false) int applyId,
            @ApiParam(name = "replyUserId", value = "处理人ID", defaultValue = "")
            @RequestParam(value = "replyUserId", required = false) String replyUserId,
            @ApiParam(name = "replyContent", value = "回复内容", defaultValue = "")
            @RequestParam(value = "replyContent", required = false) String replyContent)  {
        AssistanceApplyModel save = null;
        try {
            save = assistanceApplyService.solutionApply(applyId,replyUserId,replyContent);
        } catch (ManageException e) {
            return failed(e.getMessage());
        }
        return success(save);
    }
    @ApiOperation(value = "检验申请撤回", response = AssistanceApplyModel.class)
    @PostMapping(value = "apply/retract",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop applyRetract (
            @ApiParam(name = "applyId", value = "申请记录ID", defaultValue = "")
            @RequestParam(value = "applyId", required = false) int applyId)  {
        AssistanceApplyModel save = null;
        try {
            save = assistanceApplyService.retractApply(applyId,-1);
        } catch (ManageException e) {
            return failed(e.getMessage());
        }
        return success(save);
    }
}

Plik diff jest za duży
+ 118 - 0
src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyControllerDemo.java


+ 31 - 0
src/main/java/com/yihu/ehr/svrinspection/dao/AssistanceApplyDao.java

@ -0,0 +1,31 @@
package com.yihu.ehr.svrinspection.dao;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * @author HZY
 * @created 2018/11/14 15:34
 */
public interface AssistanceApplyDao extends PagingAndSortingRepository<AssistanceApplyModel, Integer> {
    Page<AssistanceApplyModel> queryAllByApplyOrgAndExamTypeAndExamDeptAndPatientNameLike(String appOrg, String type, String dept, String patientName, Pageable pageable);
    long countAllBySolutionStatusAndCreateTimeBetween(int solutionStatus, Date startDate, Date endDate);
    long countAllBySolutionOrgAndCreateTimeBetween(String orgCode, Date start, Date end);
    long countAllBySolutionOrgAndSolutionStatusAndCreateTimeBetween(String orgCode,int solutionStatus ,Date start, Date end);
    long countAllByApplyOrgAndSolutionStatus(String orgCode, int solutionStatus);
    long countAllByApplyOrgAndCreateTimeBetween(String orgCode, Date start, Date end);
    long countAllByApplyOrgAndSolutionStatusAndCreateTimeBetween(String orgCode,int solutionStatus ,Date start, Date end);
}

+ 43 - 0
src/main/java/com/yihu/ehr/svrinspection/feign/AddressClient.java

@ -0,0 +1,43 @@
package com.yihu.ehr.svrinspection.feign;
import com.yihu.ehr.constants.ApiVersion;
import com.yihu.ehr.constants.MicroServices;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.ehr.model.common.ObjectResult;
import com.yihu.ehr.model.geography.MGeography;
import com.yihu.ehr.model.geography.MGeographyDict;
import com.yihu.ehr.model.org.MOrganization;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Collection;
import java.util.List;
/**
 * Created by AndyCai on 2016/1/20.
 */
@FeignClient(name=MicroServices.Geography)
@RequestMapping(ApiVersion.Version1_0)
@ApiIgnore
public interface AddressClient {
    @RequestMapping(value = "/geography_entries/pid/{pid}", method = RequestMethod.GET)
    @ApiOperation(value = "根据上级编号查询行政区划地址")
    List<MGeographyDict> getAddressDictByPid(
            @ApiParam(name = "pid", value = "上级id", defaultValue = "")
            @PathVariable(value = "pid") Integer pid) ;
    @ApiOperation(value = "根据地区代码获取机构列表")
    @RequestMapping(value = "/organizations/areas/{area}", method = RequestMethod.GET)
    public List<MOrganization> getOrganizationByAreaCode(
            @ApiParam(name = "area", value = "地区代码", defaultValue = "")
            @PathVariable(value = "area") String area);
}

+ 54 - 0
src/main/java/com/yihu/ehr/svrinspection/job/InspectionExtractJob.java

@ -0,0 +1,54 @@
package com.yihu.ehr.svrinspection.job;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.lang.SpringContext;
import com.yihu.ehr.profile.queue.RedisCollection;
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import com.yihu.ehr.svrinspection.service.AssistanceApplyService;
import org.quartz.*;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.Serializable;
/**
 * 检验记录抽取任务
 *
 * @author HZY
 * @created 2018/11/27 14:47
 */
@Component
@DisallowConcurrentExecution
public class InspectionExtractJob implements InterruptableJob {
    @Override
    public void interrupt() throws UnableToInterruptJobException {
    }
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //该对象要采用名称的方式获取,否则:expected single matching bean but found 3: redisTemplate,sessionRedisTemplate,stringRedisTemplate
        RedisTemplate<String, Serializable> redisTemplate = SpringContext.getService("redisTemplate");
        ObjectMapper objectMapper = SpringContext.getService(ObjectMapper.class);
        AssistanceApplyService assistanceApplyService =  SpringContext.getService(AssistanceApplyService.class);
        Serializable serializable = redisTemplate.opsForList().rightPop(RedisCollection.INSPECTION_EXTRACT_QUEUE);
        AssistanceApplyModel applyModel = null;
        try {
            if (serializable != null) {
                String packStr = serializable.toString();
                applyModel = objectMapper.readValue(packStr, AssistanceApplyModel.class);
                if (applyModel !=null) {
                    assistanceApplyService.addApply(applyModel);
                }
            }
        }catch (IOException e) {
            e.printStackTrace();
        } catch (ManageException e) {
            e.printStackTrace();
        }
    }
}

+ 105 - 0
src/main/java/com/yihu/ehr/svrinspection/job/SchedulerManager.java

@ -0,0 +1,105 @@
package com.yihu.ehr.svrinspection.job;
import com.yihu.ehr.svrinspection.commons.config.SchedulerConfig;
import org.quartz.*;
import org.quartz.impl.matchers.GroupMatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Set;
import java.util.UUID;
import static org.quartz.JobBuilder.newJob;
import static org.quartz.TriggerBuilder.newTrigger;
/**
 * 抽取任务管理
 *
 * @author HZY
 * @created 2018/11/27 14:47
 */
@Component
public class SchedulerManager {
    private int jobSetSize;
    @Autowired
    private Scheduler scheduler;
    @Autowired
    private SchedulerConfig schedulerConfig;
    @PostConstruct
    private void init() throws Exception {
        try {
            for (int i = 0; i < schedulerConfig.getInitSize(); i++) {
                String suffix = UUID.randomUUID().toString().substring(0, 8);
                JobDetail jobDetail = newJob(InspectionExtractJob.class)
                        .withIdentity("PackResolveJob-" + suffix, "inspectionTract")
                        .build();
                CronTrigger trigger = newTrigger()
                        .withIdentity("inspectionTractTrigger-" + suffix, "inspectionTract")
                        .withSchedule(CronScheduleBuilder.cronSchedule(schedulerConfig.getCronExp()))
                        .startNow()
                        .build();
                scheduler.scheduleJob(jobDetail, trigger);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.jobSetSize = schedulerConfig.getInitSize();
    }
    public int getJobSetSize() {
        return jobSetSize;
    }
    public int getJobSize() throws Exception {
        GroupMatcher groupMatcher = GroupMatcher.groupEquals("inspectionTract");
        Set<JobKey> jobKeys = scheduler.getJobKeys(groupMatcher);
        return jobKeys.size();
    }
    public void addJob (int count, String cronExp) throws Exception {
        int addCount = 0;
        GroupMatcher groupMatcher = GroupMatcher.groupEquals("inspectionTract");
        Set<JobKey> jobKeys = scheduler.getJobKeys(groupMatcher);
        int activeJob = jobKeys.size();
        for (int i = 0; i < count; i++) {
            if (i + activeJob >= schedulerConfig.getMaxSize()) {
                break;
            }
            String suffix = UUID.randomUUID().toString().substring(0, 8);
            JobDetail jobDetail = newJob(InspectionExtractJob.class)
                    .withIdentity("inspectionTractJob-" + suffix, "inspectionTract")
                    .build();
            CronTrigger trigger = newTrigger()
                    .withIdentity("inspectionTractJob-" + suffix, "inspectionTract")
                    .withSchedule(CronScheduleBuilder.cronSchedule(cronExp))
                    .startNow()
                    .build();
            scheduler.scheduleJob(jobDetail, trigger);
            addCount = i + 1;
        }
        this.jobSetSize += addCount;
        if (this.jobSetSize > schedulerConfig.getMaxSize()) {
            jobSetSize = schedulerConfig.getMaxSize();
        }
    }
    public void minusJob (int count) throws Exception {
        int minusCount = count;
        GroupMatcher groupMatcher = GroupMatcher.groupEquals("inspectionTract");
        Set<JobKey> jobKeySet = scheduler.getJobKeys(groupMatcher);
        for (JobKey jobKey : jobKeySet) {
            scheduler.deleteJob(jobKey);
            if (--count == 0) {
                break;
            }
        }
        this.jobSetSize -= minusCount;
        if (this.jobSetSize < 0) {
            jobSetSize = 0;
        }
    }
}

+ 285 - 0
src/main/java/com/yihu/ehr/svrinspection/model/AssistanceApplyModel.java

@ -0,0 +1,285 @@
package com.yihu.ehr.svrinspection.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.ehr.svrinspection.commons.model.IntegerIdentityEntity;
import javax.persistence.*;
import java.util.Date;
/**
 * @author HZY
 * @created 2018/11/9 16:02
 */
@Entity
@Table(name = "org_assistance_apply", schema = "", catalog = "healtharchive")
public class AssistanceApplyModel extends IntegerIdentityEntity {
    private String applyOrg;
    private String applyUserId;
    private Date applyDate;
    private String remark;
    private String picture;
    private Integer isRead;
    private String solutionOrg;
    private Integer solutionStatus;
    private Date solutionDate;
    private String solutionReply;
    private String solutionUserId;
    private String solutionUserName;
    private String profileId;
    private Integer examType;
    private String examDept;
    private String examItemName;
    private String patientName;
    private String patientAge;
    private String patientSex;
    private String inspector;
    private String examDeptName;
    private String examItemCode;
    private String applyOrgName;
    private String solutionOrgName;
    @Basic
    @Column(name = "apply_org", nullable = true, length = 32)
    public String getApplyOrg() {
        return applyOrg;
    }
    public void setApplyOrg(String applyOrg) {
        this.applyOrg = applyOrg;
    }
    @Basic
    @Column(name = "apply_user_id", nullable = true, length = 32)
    public String getApplyUserId() {
        return applyUserId;
    }
    public void setApplyUserId(String applyUserId) {
        this.applyUserId = applyUserId;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "apply_date", nullable = true)
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
    @Basic
    @Column(name = "remark", nullable = true, length = 255)
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Basic
    @Column(name = "picture", nullable = true, length = 255)
    public String getPicture() {
        return picture;
    }
    public void setPicture(String picture) {
        this.picture = picture;
    }
    @Basic
    @Column(name = "is_read", nullable = true)
    public Integer getIsRead() {
        return isRead;
    }
    public void setIsRead(Integer isRead) {
        this.isRead = isRead;
    }
    @Basic
    @Column(name = "solution_org", nullable = true, length = 255)
    public String getSolutionOrg() {
        return solutionOrg;
    }
    public void setSolutionOrg(String solutionOrg) {
        this.solutionOrg = solutionOrg;
    }
    @Basic
    @Column(name = "solution_status", nullable = true)
    public Integer getSolutionStatus() {
        return solutionStatus;
    }
    public void setSolutionStatus(Integer solutionStatus) {
        this.solutionStatus = solutionStatus;
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "solution_date", nullable = true)
    public Date getSolutionDate() {
        return solutionDate;
    }
    public void setSolutionDate(Date solutionDate) {
        this.solutionDate = solutionDate;
    }
    @Basic
    @Column(name = "solution_reply", nullable = true, length = 255)
    public String getSolutionReply() {
        return solutionReply;
    }
    public void setSolutionReply(String solutionReply) {
        this.solutionReply = solutionReply;
    }
    @Basic
    @Column(name = "solution_user_id", nullable = true, length = 32)
    public String getSolutionUserId() {
        return solutionUserId;
    }
    public void setSolutionUserId(String solutionUserId) {
        this.solutionUserId = solutionUserId;
    }
    @Basic
    @Column(name = "solution_user_name", nullable = true, length = 255)
    public String getSolutionUserName() {
        return solutionUserName;
    }
    public void setSolutionUserName(String solutionUserName) {
        this.solutionUserName = solutionUserName;
    }
    @Basic
    @Column(name = "profile_id", nullable = true, length = 32)
    public String getProfileId() {
        return profileId;
    }
    public void setProfileId(String profileId) {
        this.profileId = profileId;
    }
    @Basic
    @Column(name = "exam_type", nullable = true, length = 2)
    public Integer getExamType() {
        return examType;
    }
    public void setExamType(Integer examType) {
        this.examType = examType;
    }
    @Basic
    @Column(name = "exam_dept", nullable = true, length = 25)
    public String getExamDept() {
        return examDept;
    }
    public void setExamDept(String examDept) {
        this.examDept = examDept;
    }
    @Basic
    @Column(name = "exam_item_name", nullable = true, length = 255)
    public String getExamItemName() {
        return examItemName;
    }
    public void setExamItemName(String examItemName) {
        this.examItemName = examItemName;
    }
    @Basic
    @Column(name = "patient_name", nullable = true, length = 25)
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Basic
    @Column(name = "patient_age", nullable = true, length = 4)
    public String getPatientAge() {
        return patientAge;
    }
    public void setPatientAge(String patientAge) {
        this.patientAge = patientAge;
    }
    @Basic
    @Column(name = "patient_sex", nullable = true, length = 2)
    public String getPatientSex() {
        return patientSex;
    }
    public void setPatientSex(String patientSex) {
        this.patientSex = patientSex;
    }
    @Basic
    @Column(name = "inspector", nullable = true, length = 255)
    public String getInspector() {
        return inspector;
    }
    public void setInspector(String inspector) {
        this.inspector = inspector;
    }
    @Basic
    @Column(name = "exam_dept_name", nullable = true, length = 255)
    public String getExamDeptName() {
        return examDeptName;
    }
    public void setExamDeptName(String examDeptName) {
        this.examDeptName = examDeptName;
    }
    @Basic
    @Column(name = "exam_item_code", nullable = true, length = 255)
    public String getExamItemCode() {
        return examItemCode;
    }
    public void setExamItemCode(String examItemCode) {
        this.examItemCode = examItemCode;
    }
    @Basic
    @Column(name = "apply_org_name", nullable = true, length = 255)
    public String getApplyOrgName() {
        return applyOrgName;
    }
    public void setApplyOrgName(String applyOrgName) {
        this.applyOrgName = applyOrgName;
    }
    @Basic
    @Column(name = "solution_org_name", nullable = true, length = 255)
    public String getSolutionOrgName() {
        return solutionOrgName;
    }
    public void setSolutionOrgName(String solutionOrgName) {
        this.solutionOrgName = solutionOrgName;
    }
}

+ 189 - 0
src/main/java/com/yihu/ehr/svrinspection/service/AssistanceApplyService.java

@ -0,0 +1,189 @@
package com.yihu.ehr.svrinspection.service;
import com.yihu.ehr.query.BaseJpaService;
import com.yihu.ehr.redis.schema.OrgKeySchema;
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
import com.yihu.ehr.svrinspection.dao.AssistanceApplyDao;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import com.yihu.ehr.util.datetime.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
 * 检验申请 业务类
 *
 * @author HZY
 * @created 2018/11/14 9:21
 */
@Transactional
@Service
public class AssistanceApplyService extends BaseJpaService<AssistanceApplyModel, AssistanceApplyDao> {
    @Autowired
    private AssistanceApplyDao assistanceApplyDao;
    @Autowired
    private OrgKeySchema orgKeySchema;
    public AssistanceApplyModel findById(int id) {
        return assistanceApplyDao.findOne(id);
    }
    public AssistanceApplyModel addApply(AssistanceApplyModel assistanceApplyModel) throws ManageException {
        assistanceApplyModel.setCreateTime(new Date());
        assistanceApplyModel.setSolutionStatus(-1);
        assistanceApplyModel.setIsRead(0);
        assistanceApplyModel = assistanceApplyDao.save(assistanceApplyModel);
        return assistanceApplyModel;
    }
    //申请
    public AssistanceApplyModel saveOrUpdateApply(AssistanceApplyModel assistanceApplyModel) throws ManageException {
        //申请机构名
        String applyOrgName = getOrgName(assistanceApplyModel.getApplyOrg());
        //处理机构名
        String solutionOrgName = getOrgName(assistanceApplyModel.getSolutionOrg());
        assistanceApplyModel.setCreateTime(new Date());
        //已申请
        assistanceApplyModel.setSolutionStatus(0);
        assistanceApplyModel.setIsRead(0);
        assistanceApplyModel.setApplyOrgName(applyOrgName);
        assistanceApplyModel.setSolutionOrgName(solutionOrgName);
        assistanceApplyModel = assistanceApplyDao.save(assistanceApplyModel);
        return assistanceApplyModel;
    }
    /**
     *  申请处理
     *
     * @param id                申请记录ID
     * @param replyUserId      处理人ID
     * @param replyContent      回复内容
     * @return
     * @throws ManageException
     */
    public AssistanceApplyModel solutionApply(int id, String replyUserId, String replyContent) throws ManageException {
        AssistanceApplyModel applyModel = findById(id);
        if (applyModel == null) {
            throw new ManageException("申请记录不存在!");
        }
        applyModel.setSolutionUserId(replyUserId);
        applyModel.setSolutionReply(replyContent);
        applyModel.setSolutionDate(new Date());
        applyModel.setSolutionStatus(1);
        assistanceApplyDao.save(applyModel);
        return applyModel;
    }
    /**
     * 根据申请状态-获取今日统计量
     *
     * @param status
     * @return
     */
    public long toDayCount(int status) {
        String toDay = DateUtil.getNowDate(DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Date start = DateUtil.parseDate(toDay + " 00:00:00", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        Date end = DateUtil.parseDate(toDay + " 23:59:59", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        long todayCount = assistanceApplyDao.countAllBySolutionStatusAndCreateTimeBetween(status, start, end);
        return todayCount;
    }
    /* ****************  基层医疗机构 ********** */
    /**
     * 通过申请机构 获取检验处理总数
     *
     * @param applyOrg 申请机构编码
     * @param status   处理状态
     * @return
     */
    public long toDayIncreaseByApplyOrg(String applyOrg, int status) {
        long count = assistanceApplyDao.countAllByApplyOrgAndSolutionStatus(applyOrg, status);
        return count;
    }
    /**
     * 通过申请机构获取 今日已处理/未处理量
     *
     * @param solutionOrg 申请处理机构
     * @return
     */
    public long toDayCountByApplyOrg(String solutionOrg, int status) {
        String toDay = DateUtil.getNowDate(DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Date start = DateUtil.parseDate(toDay + " 00:00:00", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        Date end = DateUtil.parseDate(toDay + " 23:59:59", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        long todayCount = assistanceApplyDao.countAllByApplyOrgAndSolutionStatusAndCreateTimeBetween(solutionOrg, status, start, end);
        return todayCount;
    }
    /***************************  医生端 ************************************/
    /**
     * 通过处理机构获取 今日新增申请量
     *
     * @param solutionOrg 申请处理机构
     * @return
     */
    public long toDayIncreaseBySolutionOrg(String solutionOrg) {
        String toDay = DateUtil.getNowDate(DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Date start = DateUtil.parseDate(toDay + " 00:00:00", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        Date end = DateUtil.parseDate(toDay + " 23:59:59", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        long count = assistanceApplyDao.countAllBySolutionOrgAndCreateTimeBetween(solutionOrg, start, end);
        return count;
    }
    /**
     * 通过处理机构获取 今日已处理/未处理量
     *
     * @param solutionOrg 申请处理机构
     * @return
     */
    public long toDayCountBySolutionOrg(String solutionOrg, int status) {
        String toDay = DateUtil.getNowDate(DateUtil.DEFAULT_DATE_YMD_FORMAT);
        Date start = DateUtil.parseDate(toDay + " 00:00:00", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        Date end = DateUtil.parseDate(toDay + " 23:59:59", DateUtil.DEFAULT_YMDHMSDATE_FORMAT);
        long todayCount = assistanceApplyDao.countAllBySolutionOrgAndSolutionStatusAndCreateTimeBetween(solutionOrg, status, start, end);
        return todayCount;
    }
    /**
     * 申请撤回
     *
     * @param id     申请记录id
     * @param status 申请记录状态
     * @return
     * @throws ManageException
     */
    public AssistanceApplyModel retractApply(int id, int status) throws ManageException {
        AssistanceApplyModel applyModel = findById(id);
        if (applyModel == null) {
            throw new ManageException("申请记录不存在!");
        }
        applyModel.setSolutionStatus(status);
        assistanceApplyDao.save(applyModel);
        return applyModel;
    }
    /**
     *获取机构名称redis
     * @return
     */
    public String getOrgName(String key) {
        if (StringUtils.isEmpty(key)) {
            return "";
        }else {
            return orgKeySchema.get(key);
        }
    }
}

+ 298 - 0
src/main/java/com/yihu/ehr/svrinspection/service/ExamStatisticsService.java

@ -0,0 +1,298 @@
package com.yihu.ehr.svrinspection.service;
import com.yihu.ehr.model.geography.MGeographyDict;
import com.yihu.ehr.model.org.MOrganization;
import com.yihu.ehr.profile.core.ResourceCore;
import com.yihu.ehr.solr.SolrUtil;
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
import com.yihu.ehr.svrinspection.commons.service.BaseService;
import com.yihu.ehr.svrinspection.feign.AddressClient;
import com.yihu.ehr.util.datetime.DateUtil;
import com.yihu.ehr.util.log.LogService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
/**
 *  检验数据统计-solr
 * @author HZY
 * @created 2018/11/15 14:01
 */
@Component
public class ExamStatisticsService extends BaseService {
    private static String core = ResourceCore.SubTable;
    @Autowired
    private AddressClient addressClient;
    @Autowired
    private SolrUtil solrUtil;
    @Autowired
    private AssistanceApplyService assistanceApplyService;
    /**
     *  区域检验统计分布
     *
     * @param pid           上级区域编码
     * @param field         分组字段
     * @param eventDate
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> areaGroupCount(Integer pid, String field, String eventDate) throws Exception {
       List<Map<String,Object>> resultList = new ArrayList<>();
        StringBuilder fq = new StringBuilder();
        Map<String, Long> result = new TreeMap<>();
        String q = "(rowkey:*HDSD00_79* OR rowkey:*HDSD00_77*)";//solr细表中的检查检验
        if (StringUtils.isBlank(eventDate)) {
            LogService.getLogger().error("eventDate is null,check your params");
            throw new Exception("eventDate is null,check your params");
        }
        //事件日期
        fq.append("event_date:[" + eventDate + "T00:00:00Z TO " + eventDate + "T23:59:59Z]");
        //统计查询
        Map<String, Long> facetField = solrUtil.groupCount(core,q, fq.toString(),field, 0, -1);
        //获取区县列表
        List<MGeographyDict> addressList = addressClient.getAddressDictByPid(pid);
        addressList.stream().forEach(address ->{
            Map<String,Object> areaData = areaData = new HashMap<>();
            areaData.put("areaCode",address.getPid());
            areaData.put("areaName",address.getName());
            if (facetField.get(String.valueOf(address.getId())) == null) {
                areaData.put("count",0);
            }else {
                areaData.put("count",facetField.get(String.valueOf(address.getId())));
            }
            resultList.add(areaData);
        });
        comparator(resultList,"count");
        return resultList;
    }
    /**
     * 医院检验统计分布
     *
     * @param areaCode      区域编码
     * @param field         分组字段
     * @param eventDate     事件时间
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> hospitalGroupCount(String areaCode, String field, String eventDate) throws Exception {
        List<Map<String,Object>> resultList = new ArrayList<>();
        StringBuilder fq = new StringBuilder();
        String q = "(rowkey:*HDSD00_79* OR rowkey:*HDSD00_77*)";//solr细表中的检查检验
        if (!StringUtils.isBlank(areaCode)) {
            //区域编码
            fq.append("org_area:").append(areaCode).append(" && ");
//            throw new ManageException("医院检验统计分布:areaCode is null,check your params");
        }
        if (StringUtils.isBlank(eventDate)) {
            throw new ManageException("eventDate is null,check your params");
        }
        //事件日期
        fq.append("event_date:[" + eventDate + "T00:00:00Z TO " + eventDate + "T23:59:59Z]");
        //统计查询
        Map<String, Long> facetField = solrUtil.groupCount(core,q, fq.toString(),field, 0, -1);
        //获取区县列表
        List<MOrganization> addressList = addressClient.getOrganizationByAreaCode(areaCode);
        addressList.stream().forEach(organization ->{
           //只显示有检验数的医院
            if (facetField.get(organization.getOrgCode()) != null) {
                Map<String,Object> areaData = areaData = new HashMap<>();
                areaData.put("orgCode",organization.getOrgCode());
                areaData.put("orgName",organization.getFullName());
                areaData.put("count",facetField.get(organization.getOrgCode()));
                resultList.add(areaData);
            }
        });
        comparator(resultList,"count");
        return resultList;
    }
    /**
     *  区域检验数统计
     *
     * TODO 累计数和新增数先从solr获取,后期考虑是否同步到mysql中
     * @param areaCode
     * @param eventDate
     * @return
     */
    public Map<String,Object> areaExamStatistics(String areaCode, String eventDate) throws Exception {
        Map<String,Object> result = new HashMap<>();
        //累计检验数
        long total = totalCount(areaCode, eventDate);
        //今日新增数
        long today = areaTodayIncreaseCount(areaCode);
        //已申请数
        long apply = assistanceApplyService.toDayCount(0);
        //已处理数
        long solution = assistanceApplyService.toDayCount(1);
        //业务分布
        List<Map<String, Object>> list = examEventRanking(areaCode, eventDate);
        result.put("total",total);
        result.put("increase",today);
        result.put("applied",apply);
        result.put("solution",solution);
        result.put("eventPercentage",list);
        return result;
    }
    /**
     *  【医院端】-医院今日检验数统计
     * @param orgCode
     * @return
     * @throws Exception
     */
    public Map<String,Object> organizationExamStatistics(String orgCode) throws Exception {
        Map<String,Object> result = new HashMap<>();
        //今日新增量
        long today = assistanceApplyService.toDayIncreaseBySolutionOrg(orgCode);
        //已申请,未处理数
        long apply = assistanceApplyService.toDayCountBySolutionOrg(orgCode,0);
        //已处理数
        long solution = assistanceApplyService.toDayCountBySolutionOrg(orgCode,1);
        result.put("waitSolution",apply);
        result.put("solution",solution);
        result.put("increase",today);
        return result;
    }
    /**
     *  【基层医疗结构端】-医院今日检验数统计
     * @param orgCode
     * @return
     * @throws Exception
     */
    public Map<String,Object> basicOrgExamStatistics(String orgCode) throws Exception {
        Map<String,Object> result = new HashMap<>();
        //处理总量
        long total = assistanceApplyService.toDayIncreaseByApplyOrg(orgCode,1);
        //已申请,未处理数
        long apply = assistanceApplyService.toDayCountByApplyOrg(orgCode,0);
        //已处理数
        long solution = assistanceApplyService.toDayCountByApplyOrg(orgCode,1);
        result.put("waitSolution",apply);
        result.put("solution",solution);
        result.put("total",total);
        return result;
    }
    /**
     *  solr 获取检验累计总数
     *
     * @param areaCode      区域编码
     * @param eventDate     时间
     * @return
     * @throws ManageException
     */
    public long totalCount(String areaCode, String eventDate) throws ManageException {
        long total = 0;
        StringBuilder fq = new StringBuilder();
        String q = "(rowkey:*HDSD00_79* OR rowkey:*HDSD00_77*)";//solr细表中的检查检验
        if (!StringUtils.isBlank(areaCode)) {
            //区域编码
            fq.append("org_area:").append(areaCode).append(" AND ");
        }
        if (StringUtils.isBlank(eventDate)) {
            throw new ManageException("eventDate is null,check your params");
        }
        //事件日期
        fq.append("event_date:[" + eventDate + "T00:00:00Z TO " + eventDate + "T23:59:59Z]");
        //统计查询
        try {
             total = solrUtil.count(core,q, fq.toString());
        } catch (Exception e) {
            throw new ManageException("获取累计统计数异常",e);
        }
        return total;
    }
    /**
     *  今日新增检验数
     *
     * @param areaCode  区域编码
     * @return
     * @throws ManageException
     */
    public long areaTodayIncreaseCount(String areaCode) throws ManageException {
        long total = 0;
        StringBuilder fq = new StringBuilder();
        String q = "(rowkey:*HDSD00_79* OR rowkey:*HDSD00_77*)";//solr细表中的检查检验
        if (!StringUtils.isBlank(areaCode)) {
            //区域编码
            fq.append("org_area:").append(areaCode).append(" AND ");
        }
        String createDate = DateUtil.getNowDate(DateUtil.DEFAULT_DATE_YMD_FORMAT);
        //创建日期 TODO 就诊时间或者是入库的时间
        fq.append("event_date:[" + createDate + "T00:00:00Z TO " + createDate + "T23:59:59Z]");
        //统计查询
        try {
            total = solrUtil.count(core,q, fq.toString());
        } catch (Exception e) {
            throw new ManageException("获取今日新增档案数异常",e);
        }
        return total;
    }
    /**
     * 检验次数业务分布
     *
     * @param areaCode      区域编码
     * @param eventDate     时间
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> examEventRanking(String areaCode, String eventDate) throws Exception {
        List<Map<String,Object>> resultList = new ArrayList<>();
        StringBuilder fq = new StringBuilder();
        String q = "(rowkey:*HDSD00_79* OR rowkey:*HDSD00_77*)";//solr细表中的检查检验
        if (!StringUtils.isBlank(areaCode)) {
            //区域编码
            fq.append("org_area:").append(areaCode).append(" && ");
//            throw new ManageException("检验次数业务分布:areaCode is null,check your params");
        }
        if (StringUtils.isBlank(eventDate)) {
            throw new ManageException("eventDate is null,check your params");
        }
        //事件日期
        fq.append("event_date:[" + eventDate + "T00:00:00Z TO " + eventDate + "T23:59:59Z]");
        //统计查询
        Map<String, Long> facetField = solrUtil.groupCount(core,q, fq.toString(),"event_type", 0, -1);
        comparator(resultList,"count");
        return resultList;
    }
}

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

@ -0,0 +1,49 @@
server:
  port: 10420
info:
  app:
    name: SVR-INSPECTION
    description: EHR Platform Microservice.
    version: 1.0.0
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 20
    max-idle: 8
    min-idle: 8
    validation-query: SELECT 1
    test-on-borrow: true
  # REDIS
  redis:
    database: 0 # Database index used by the connection factory.
    port: 6379 # Redis server port.
    password: # Login password of the redis server.
    timeout: 0 # Connection timeout in milliseconds.
    pool:
      max-active: 8
      max-idle: 8
      max-wait: -1
      min-idle: 1
extract:
  job:
    init-size: 5 #抽取初始任务数
    max-size: 5 #抽取最大任务数
    cron-exp: 0/1 * * * * ? #抽取任务触发间隔表达式
---
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.18.20.105:3312/healtharchive?useUnicode=true&characterEncoding=UTF-8&useSSL=false
    username: cloud
    password: o8t$P39ekYSZ
  data:
    solr:
      zk-host: 11.1.2.35:2181/solr
  redis:
    host: 172.18.20.20 # Redis server host.
    port: 6381
    password: jkzl2015

+ 16 - 0
src/main/resources/banner.txt

@ -0,0 +1,16 @@
                                        __                                                      __      __
                                       |  \                                                    |  \    |  \
  _______  __     __   ______           \$$ _______    _______   ______    ______    _______  _| $$_    \$$  ______   _______
 /       \|  \   /  \ /      \  ______ |  \|       \  /       \ /      \  /      \  /       \|   $$ \  |  \ /      \ |       \
|  $$$$$$$ \$$\ /  $$|  $$$$$$\|      \| $$| $$$$$$$\|  $$$$$$$|  $$$$$$\|  $$$$$$\|  $$$$$$$ \$$$$$$  | $$|  $$$$$$\| $$$$$$$\
 \$$    \   \$$\  $$ | $$   \$$ \$$$$$$| $$| $$  | $$ \$$    \ | $$  | $$| $$    $$| $$        | $$ __ | $$| $$  | $$| $$  | $$
 _\$$$$$$\   \$$ $$  | $$              | $$| $$  | $$ _\$$$$$$\| $$__/ $$| $$$$$$$$| $$_____   | $$|  \| $$| $$__/ $$| $$  | $$
|       $$    \$$$   | $$              | $$| $$  | $$|       $$| $$    $$ \$$     \ \$$     \   \$$  $$| $$ \$$    $$| $$  | $$
 \$$$$$$$      \$     \$$               \$$ \$$   \$$ \$$$$$$$ | $$$$$$$   \$$$$$$$  \$$$$$$$    \$$$$  \$$  \$$$$$$  \$$   \$$
                                                               | $$
                                                               | $$
                                                                \$$
************************************************** spring-boot.version: ${spring-boot.version} *******************************************************

+ 31 - 0
src/main/resources/bootstrap.yml

@ -0,0 +1,31 @@
spring:
  application:
    name: svr-inspection
  cloud:
    config:
      password: configuration
---
spring:
  profiles: dev
  cloud:
    config:
      uri: ${spring.config.uri:http://11.1.2.31:1221}
      label: ${spring.config.label:fuzhou}
---
spring:
  profiles: test
  cloud:
    config:
      uri: ${spring.config.uri:http://172.19.103.73:1221}
      label: ${spring.config.label:dev}
---
spring:
  profiles: prod
  cloud:
    config:
      uri: ${spring.config.uri}
      label: ${spring.config.label}

+ 16 - 0
src/test/java/com/yihu/ehr/svrinspection/SvrInspectionApplicationTests.java

@ -0,0 +1,16 @@
package com.yihu.ehr.svrinspection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SvrInspectionApplicationTests {
	@Test
	public void contextLoads() {
	}
}