项目简介
Open-His 是以完整的基层医疗机构-信息化解决方案为出发点,打 造连接诊所、医生、 患者、一站式互联网医疗服务系统,深度挖掘基层医疗机构需求, 解决其真正的痛点;全面 提升医疗管理质量和可执行落地的综合性解决方案。
项目特色
1) 前后端分离,基于shiro 的 API 授权机制 ;
2) 基于 SpringCloud Alibaba的分布式架构,扩展更容易 ;
3) MySQL、Redis多种数据存储方式,只为更快 ;
4) 使用Mycat进行主从复制、读写分离技术,解决数据库高并发、 高可靠问题 ;
5) RocketMQ 发布订阅消息队列,实现模块解耦和异步处理;
6) 支付模块,支持支付宝沙箱及现金支付环境;
7) 精准细粒的业务功能讲解;
8) Docker 的项目发布和动态扩容;
9) Nginx 的负载均衡。
技术特点
项目开发采用SSM架构,数据持久层框架使用mybatis,数据库使
用mysql5.7,以及其它中间件,具体名称及作用如下表所示:
组件名称 |
作用 |
版本 |
JDK |
编译运行平台 |
1.8 |
spring framework |
轻量级的控制反转(IOC)和面向切面(AOP)的容器框架 |
5.2.5 |
spring mvc framework |
基于MVC的轻量级web开发框架 |
5.2.5 |
spring boot |
用注解方式实现对spring框架的自动配置 |
2.2.6 |
shiro |
Java安全框架,用于身份验证、授权、密码和会话管理 |
1.5.3 |
Mybatis-plus |
Mybatis增强工具包,简化CRUD操作 |
3.3.1 |
dubbo |
SCA-轻量级、高性能分布式RPC框架 |
2.7.5 |
nacos |
SCA-微服务注册配置与管理组件 |
1.2.0 |
sentinel |
SCA-分布式高可用流量防护组件 |
1.8.2 |
redis |
内存数据库,用于缓存数据 |
5.0.5 |
rocketmq |
消息中间件,用于发送接收消息 |
4.5.1 |
swagger |
接口测试工具,用于生成、描述、调用和可视化 RESTful 风格的 |
|
模块设计及功能演示
系统管理模块
系统基础数据模块,主要包含科室管理、用户管理、角色管理、菜 单管理、字典管理、通知公告、登陆日志管理、操作日志管理、检 查费用设置、挂号费用设置,主要包含 RBAC 权限设置功能,字典 模块,基础数据维护模块,日志管理模块。
进销存模块
一个小型的药品 ERP 系统,包含生产厂家维护、药品信息维护、供 应商维护、采购入库、审核、库存等查询。
就诊模块(核心-难点)
看病就诊、门诊挂号、挂号列表、新开就诊、我的排班、医生排 班、患者库,里面的核心业务为挂号,就诊,排班。
收费管理模块
主要处理挂号收费、检查收费、药品处方收费等业务功能的处理。
检查管理模块
主要处理检查业务功能,医生可以接收检查及上传检查结果。
数据统计模块
整个系统数据统计分支,包含 收支统计、药品销售统计、检查项目 统计、工作量统计等功能。
项目架构
部署架构
项目环境准备
开发时最好准备两台云服务器,如果没有,也可以在本地安装一台 虚拟机,但是老师推荐使用云服务器,这样每次开发就不用启动那 么多东西了。
配置ucloud云服务器
https://www.ucloud.cn
设置外网防火墙
可根据实际情况自行添加安全规则,为防止网络攻击建议设置源地 址,如嫌麻烦可全部放行【不推荐】。
docker安装
yum -y install docker 安装
systemctl start docker 启动
systemctl restart docker 重启
systemctl stop docker 停止
systemctl enable docker 开机自启
前方有坑---------如果你在 docker 运行期间操作了防火墙[启动或关 闭]必须重启
docker systemctl restart docker
编辑配置文件
vi /etc/docker/daemon.json
拷贝下面的内容/etc/docker/daemon.json 中
{ "registry-mirrors":
["https://32xw0apq.mirror.aliyuncs.com"] } systemctl daemon-reload
systemctl restart docker
JDK安装
安装JDK11
如果是tar.gz文件,则执行解压缩命令
tar -zxvf jdk-11.0.11_linux-x64_bin.tar.gz
解压缩后,默认安装在当前目录下
在/etc/profile文件中设置java环境变量
输入命令检查安装是否完成
java -version
出现上面的提示,表示jdk安装正常
redis安装
使用 docker 运行 redis
docker run -d --name redis -p 6390:6379 redis --requirepass "123456"
安装完成后,查看redis进程,如上图所示则安装正常
nacos控制台安装
下载nacos压缩包,使用下面的命令解压缩
tar -zxvf nacos-server-1.2.0.tar.gz
进入nacos安装路径下的bin目录执行启动命令
./startup.sh -m standalone
使用ps命令查看进程情况
输入http://你的ip:8848,启动nacos控制台
sentinel控制台安装
下载sentinel-dashboard-1.8.2.jar包,在jar包所在目录打开命令行 窗口,执行以下命令启动控制台
java -jar sentinel-dashboard-1.8.2.jar
输入默认用户名、密码sentinel,进入主界面
rocketmq环境搭建
环境要求
JDK 11.0.5
4G+ free
可使用wget命令下载、解压缩并安装
wget https://archive.apache.org/dist/rocketmq/4.5.1/ rocketmq-all-4.5.1-bin-release.zip
修改脚本
bin/runserver.sh
bin/runbroker.sh
bin/tools.sh
nameserver:
#!/bin/sh
6
# 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.
#==============================================
=============================================
# Java Environment Setting #==============================================
=============================================
error_exit ()
{
echo "ERROR: $1 !!"
exit 1
}
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=$HOME/jdk/java
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=/usr/java
[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME variable in your environment, We need java(x64)!"
export JAVA_HOME
export JAVA="$JAVA_HOME/bin/java"
export BASE_DIR=$(dirname $0)/..
export CLASSPATH=${BASE_DIR}/lib/rocketmq- namesrv-
4.5.0.jar:${BASE_DIR}/lib/*:${BASE_DIR}/conf:${ CLASSPATH}
#export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH}
#echo "BASE_DIR:$BASE_DIR"
#echo "CLASSPATH:$CLASSPATH"
7
#==============================================
=============================================
# JVM Configuration #==============================================
=============================================
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g - Xmn512m -XX:MetaspaceSize=128m - XX:MaxMetaspaceSize=320m"
#JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g - Xmn2g -XX:MetaspaceSize=128m - XX:MaxMetaspaceSize=320m"
JAVA_OPT="${JAVA_OPT} - XX:CMSInitiatingOccupancyFraction=70 - XX:+CMSParallelRemarkEnabled - XX:SoftRefLRUPolicyMSPerMB=0 - XX:+CMSClassUnloadingEnabled - XX:SurvivorRatio=8"
JAVA_OPT="${JAVA_OPT} -verbose:gc - Xlog:gc:/dev/shm/rmq_srv_gc.log"
JAVA_OPT="${JAVA_OPT} -XX:- OmitStackTraceInFastThrow"
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" #JAVA_OPT="${JAVA_OPT} -Xdebug - Xrunjdwp:transport=dt_socket,address=9555,serve r=y,suspend=n"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"
$JAVA ${JAVA_OPT} $@
vim bin/runserver.sh
删除 UseCMSCompactAtFullCollection
UseParNewGC UseConcMarkSweepGC
修改内存:
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m
-Xmn128m -
XX:MetaspaceSize=64mm -
XX:MaxMetaspaceSize=160mm"
-Xloggc修改为-Xlog:gc
broker:
#!/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. #==============================================
============================
# Java Environment Setting #==============================================
============================
error_exit ()
{
echo "ERROR: $1 !!"
exit 1
}
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=$HOME/jdk/java
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=/usr/java
[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME
variable in your environment, We need java(x64)!"
export JAVA_HOME
export JAVA="$JAVA_HOME/bin/java"
export BASE_DIR=$(dirname $0)/..
export
10
CLASSPATH=.${JAVA_HOME}/jre/lib/ext:${BASE_DIR} /lib/*:${BASE_DIR}/conf:${CLASSPATH} #==============================================
============================
# JVM Configuration #==============================================
============================
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m
-Xmn128m"
JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC - XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25
-XX:InitiatingHeapOccupancyPercent=30 - XX:SoftRefLRUPolicyMSPerMB=0"
JAVA_OPT="${JAVA_OPT} -verbose:gc - Xloggc:/dev/shm/mq_gc_%p.log - XX:+PrintGCDetails"
JAVA_OPT="${JAVA_OPT} -XX:- OmitStackTraceInFastThrow"
JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" JAVA_OPT="${JAVA_OPT} - XX:MaxDirectMemorySize=15g"
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:- UseBiasedLocking"
#JAVA_OPT="${JAVA_OPT} -Xdebug - Xrunjdwp:transport=dt_socket,address=9555,serve r=y,suspend=n"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"
numactl --interleave=all pwd > /dev/null 2>&1
if [ $? -eq 0 ]
then
if [ -z "$RMQ_NUMA_NODE" ] ; then
11
numactl --interleave=all $JAVA ${JAVA_OPT} $@
else
numactl --cpunodebind=$RMQ_NUMA_NODE -- membind=$RMQ_NUMA_NODE $JAVA
${JAVA_OPT} $@
fi
else
$JAVA ${JAVA_OPT} --add-
exports=java.base/jdk.internal.ref=ALL-UNNAMED $@
fi
vim bin/runbroker.sh
删除:
PrintGCDateStamps
PrintGCApplicationStoppedTime
PrintAdaptiveSizePolicy
UseGCLogFileRotation
NumberOfGCLogFiles=5
GCLogFileSize=30m
tools:
#!/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.
12
# 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. #==============================================
============================
=================
# Java Environment Setting #==============================================
============================
=================
error_exit ()
{
echo "ERROR: $1 !!"
exit 1
}
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=$HOME/jdk/java
13
[ ! -e "$JAVA_HOME/bin/java" ] &&
JAVA_HOME=/usr/java
[ ! -e "$JAVA_HOME/bin/java" ] && error_exit "Please set the JAVA_HOME
variable in your environment, We need java(x64)!"
export JAVA_HOME
export JAVA="$JAVA_HOME/bin/java"
export BASE_DIR=$(dirname $0)/..
# export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} export
CLASSPATH=.${JAVA_HOME}/jre/lib/ext:${BASE_DIR} /lib/*:${BASE_DIR}/conf:${CL
ASSPATH}
#==============================================
============================
=================
# JVM Configuration #==============================================
============================
=================
JAVA_OPT="${JAVA_OPT} -server -Xms256m -Xmx256m
-Xmn256m -XX:PermSize=128m
-XX:MaxPermSize=128m"
# JAVA_OPT="${JAVA_OPT} -
Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre /lib/ext"
JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}"
$JAVA ${JAVA_OPT} $@
14
vim bin/tools.sh
# 删除 JAVA_OPT="${JAVA_OPT} -
Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre /lib/ext"
进入rocketmq目录,启动nameserver
nohup sh mqnamesrv > /dev/null 2>&1 &
然后启动broker
nohup sh mqbroker -n localhost:9876 > /dev/null 2>&1 &
fastdfs安装
1、下载fastdfs镜像
docker pull registry.cn-
beijing.aliyuncs.com/tianzuo/fastdfs
2、启动镜像
docker run -d --restart=always --
privileged=true --net=host --name=fastdfs -e IP=192.168.139.128 -e WEB_PORT=8888 -v ${HOME}/fastdfs:/var/local/fdfs registry.cn- beijing.aliyuncs.com/tianzuo/fastdfs
3、查看镜像
docker ps -a
5、测试上传
vim /etc/fdfs/client.conf
#需要修改的内容如下
base_path=/home/fastdfs
#tracker服务器IP和端口
tracker_server=192.168.139.128:22122
#保存后测试,返回ID表示成功 如: group1/M00/00/00/xxx.png /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/fastdfs/1.png group1/M00/00/00/wKjTiF7h5EWASb5aAACGZa9JdFo611 .png
mysql安装
下载必要的安装文件,按顺序执行安装命令,完成后初始化mysql, 修改初始密码
先移除mariadb,再安装
解压缩mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar,解压完成后会 生成一系列rpm安装包,安装的顺序是
1)mysql-community-common-5.7.28-1.el7.x86_64.rpm
2)mysql-community-libs-5.7.28-1.el7.x86_64.rpm
3)mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm
4)mysql-community-client-5.7.28-1.el7.x86_64.rpm
5)mysql-community-server-5.7.28-1.el7.x86_64.rpm
6)mysql-community-devel-5.7.28-1.el7.x86_64.rpm
初始化mysql
mysqld --initialize --user=mysql
查看初始密码
cat /var/log/mysqld.log
进入mysql,修改初始密码
>mysql -uroot -p
>set password=password('123456');
mycat安装
下载Mycat-server-1.6.7.5-release-linux.tar.gz,解压后进入 mycat/bin目录,执行启动命令
./mycat start 启动
./mycat stop 停止
./mycat restart 重启 ./mycat status 查看状态
访问mycat,连接成功后和操作mysql一样
mysql -uroot -proot -h127.0.0.1 -P8066
mysql主从搭建
后面再细说
读写分离配置
后面再细说
idea安装
自行下载安装,项目中使用的是2020.2版本