commit: 提交北检所测试版本V0

This commit is contained in:
republicline 2025-04-01 11:20:30 +08:00
parent 9193e945df
commit 4eb089d803
9 changed files with 556 additions and 280 deletions

View File

@ -132,6 +132,7 @@ public class SysUserController {
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('sys_user_add')") @PreAuthorize("@pms.hasPermission('sys_user_add')")
public R user(@RequestBody UserDTO userDto) { public R user(@RequestBody UserDTO userDto) {
System.out.println("userDto = " + userDto);
boolean matches = Pattern.matches(PASSWD_PATTERN, userDto.getPassword()); boolean matches = Pattern.matches(PASSWD_PATTERN, userDto.getPassword());
if (!matches) { if (!matches) {
return R.failed("密码至少8~16位字母或数字区分大小写"); return R.failed("密码至少8~16位字母或数字区分大小写");

View File

@ -112,9 +112,14 @@ public class ChatHandler implements WebSocketHandler {
// redisTemplate.opsForHash().putAll("chat_sessionId_" + dbName, sessionDbMap); // redisTemplate.opsForHash().putAll("chat_sessionId_" + dbName, sessionDbMap);
// redisTemplate.expire("chat_" + dbName, 60 * 60, TimeUnit.SECONDS); // redisTemplate.expire("chat_" + dbName, 60 * 60, TimeUnit.SECONDS);
} }
else if ("msg".equals(jsonObject.getString("msgType"))) { else if ("msg".equals(jsonObject.getString("msgType"))) { // 消息推送
//String patientName = jsonObject.getString("patientName"); //String patientName = jsonObject.getString("patientName");
String dbName = "a" + jsonObject.getString("idNum"); String dbName = "a" + jsonObject.getString("idNum");
for (WebSocketSession webSocketSession : dbNameSessionList.get(dbName)) {
System.out.println("webSocketSession Size = " + dbNameSessionList.get(dbName).size());
System.out.println("webSocketSession = " + webSocketSession);
}
//String date = jsonObject.getString("date"); //String date = jsonObject.getString("date");
String msgType = jsonObject.getString("msgType"); String msgType = jsonObject.getString("msgType");
// 消息内容 // 消息内容
@ -129,7 +134,9 @@ public class ChatHandler implements WebSocketHandler {
param.put("msg", content); param.put("msg", content);
param.put("dbName", dbName); param.put("dbName", dbName);
for (WebSocketSession webSocketSession : webSocketSessions) { for (WebSocketSession webSocketSession : webSocketSessions) {
webSocketSession.sendMessage(new TextMessage(param.toJSONString().getBytes())); if (webSocketSession.isOpen()) {
webSocketSession.sendMessage(new TextMessage(param.toJSONString().getBytes()));
}
} }
// 异步入库 // 异步入库
EXECUTOR_SERVICE.execute(() -> saveChatMsg(param.toJSONString())); EXECUTOR_SERVICE.execute(() -> saveChatMsg(param.toJSONString()));
@ -145,7 +152,7 @@ public class ChatHandler implements WebSocketHandler {
Connection connection = source.getConnection(); Connection connection = source.getConnection();
if (connection != null) { if (connection != null) {
Statement statement = connection.createStatement(); Statement statement = connection.createStatement();
String sql = "select content, create_time, create_user from t_chat where deleted = 0 and revoked = 0 order by create_time asc "; String sql = "select content, create_time, create_user from t_chat_server where deleted = 0 and revoked = 0 order by create_time asc ";
ResultSet resultSet = statement.executeQuery(sql); ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) { while (resultSet.next()) {
Map map = new HashMap(); Map map = new HashMap();
@ -217,11 +224,25 @@ public class ChatHandler implements WebSocketHandler {
} }
private void stopMap(WebSocketSession session) { private void stopMap(WebSocketSession session) {
System.out.println("stopMap is running");
String dbName = sessionDbMap.get(session.getId()); String dbName = sessionDbMap.get(session.getId());
if (dbName != null) { if (dbName != null) {
dbNameSessionList.remove(dbName); List<WebSocketSession> sessionList = dbNameSessionList.get(dbName);
if (sessionList.isEmpty()) {
dbNameSessionList.remove(dbName);
sessionDbMap.remove(session.getId());
}else {
// 定时删除
boolean remove = sessionList.remove(session);
System.out.println("remove = " + remove + "removeListSize = " + sessionList.size());
String remove1 = sessionDbMap.remove(session.getId());
System.out.println("remove1 = " + remove1);
ScheduledExecutorService scheduledRemoveService = Executors.newScheduledThreadPool(1);
scheduledRemoveService.schedule(() -> {
dbNameSessionList.remove(dbName);
}, 180, TimeUnit.MINUTES);
}
} }
sessionDbMap.remove(session.getId());
} }
// 初始化聊天表格 // 初始化聊天表格
@ -232,7 +253,7 @@ public class ChatHandler implements WebSocketHandler {
source.open(); source.open();
Connection connection = source.getConnection(); Connection connection = source.getConnection();
if (connection != null) { if (connection != null) {
String tableName = "t_chat"; String tableName = "t_chat_server";
Statement statement = connection.createStatement(); Statement statement = connection.createStatement();
// 检查表是否存在的 SQL 语句 // 检查表是否存在的 SQL 语句
String checkTableSQL = "SELECT COUNT(*) FROM information_schema.tables " + String checkTableSQL = "SELECT COUNT(*) FROM information_schema.tables " +
@ -292,8 +313,6 @@ public class ChatHandler implements WebSocketHandler {
// } // }
// } // }
} }
// 保存聊天消息到数据库 // 保存聊天消息到数据库
private void saveChatMsg(String jsonStr) { private void saveChatMsg(String jsonStr) {
// 发消息, 入库 // 发消息, 入库
@ -312,7 +331,7 @@ public class ChatHandler implements WebSocketHandler {
Connection connection = source.getConnection(); Connection connection = source.getConnection();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try { try {
preparedStatement = connection.prepareStatement("INSERT INTO t_chat (content, create_time, create_user, msg_type, deleted, revoked) VALUES (?, ?, ?, ?, ?, ?)"); preparedStatement = connection.prepareStatement("INSERT INTO t_chat_server (content, create_time, create_user, msg_type, deleted, revoked) VALUES (?, ?, ?, ?, ?, ?)");
preparedStatement.setString(1, content); preparedStatement.setString(1, content);
preparedStatement.setString(2, now); preparedStatement.setString(2, now);
preparedStatement.setString(3, username); preparedStatement.setString(3, username);

View File

@ -33,10 +33,10 @@ public class AIMedicineServiceImpl implements AIMedicineService {
put("丙泊酚", "丙泊酚"); put("丙泊酚", "丙泊酚");
put("舒芬太尼", "舒芬太尼"); put("舒芬太尼", "舒芬太尼");
put("瑞芬太尼", "瑞芬太尼"); put("瑞芬太尼", "瑞芬太尼");
put("顺阿曲库", "顺阿曲库胺"); put("顺阿曲库", "顺阿曲库铵");
put("尼卡地平", "尼卡地平"); put("尼卡地平", "尼卡地平");
put("艾司洛尔", "艾司洛尔"); put("艾司洛尔", "艾司洛尔");
put("麻黄", "麻黄素"); put("麻黄", "麻黄碱");
put("阿托品", "阿托品"); put("阿托品", "阿托品");
} }
}; };
@ -123,14 +123,14 @@ public class AIMedicineServiceImpl implements AIMedicineService {
medicine.put("舒芬太尼sum", resultSet.getString("cumu_2")); medicine.put("舒芬太尼sum", resultSet.getString("cumu_2"));
medicine.put("瑞芬太尼", resultSet.getString("rate_3")); medicine.put("瑞芬太尼", resultSet.getString("rate_3"));
medicine.put("瑞芬太尼sum", resultSet.getString("cumu_3")); medicine.put("瑞芬太尼sum", resultSet.getString("cumu_3"));
medicine.put("顺阿曲库", resultSet.getString("rate_4")); medicine.put("顺阿曲库", resultSet.getString("rate_4"));
medicine.put("顺阿曲库sum", resultSet.getString("cumu_4")); medicine.put("顺阿曲库sum", resultSet.getString("cumu_4"));
medicine.put("尼卡地平", resultSet.getString("rate_5")); medicine.put("尼卡地平", resultSet.getString("rate_5"));
medicine.put("尼卡地平sum", resultSet.getString("cumu_5")); medicine.put("尼卡地平sum", resultSet.getString("cumu_5"));
medicine.put("艾司洛尔", resultSet.getString("rate_6")); medicine.put("艾司洛尔", resultSet.getString("rate_6"));
medicine.put("艾司洛尔sum", resultSet.getString("cumu_6")); medicine.put("艾司洛尔sum", resultSet.getString("cumu_6"));
medicine.put("麻黄", resultSet.getString("rate_7")); medicine.put("麻黄", resultSet.getString("rate_7"));
medicine.put("麻黄sum", resultSet.getString("cumu_7")); medicine.put("麻黄sum", resultSet.getString("cumu_7"));
medicine.put("阿托品", resultSet.getString("rate_8")); medicine.put("阿托品", resultSet.getString("rate_8"));
medicine.put("阿托品sum", resultSet.getString("cumu_8")); medicine.put("阿托品sum", resultSet.getString("cumu_8"));
medicine.put("Time", resultSet.getString("time")); medicine.put("Time", resultSet.getString("time"));

View File

@ -101,90 +101,226 @@ public class VitalSignServiceImpl implements VitalSignsService {
return vitalList; return vitalList;
} }
//@Override
//public Map getVitalSignsList(Connection connection, String username, String dbName) {
// // 获取生命体征数据, 10条
// List<Map> vitalList = getVitalList(connection);
// //System.out.println("vitalList = " + vitalList);
// Collections.reverse(vitalList); // time 小到大 十条数据
// List<Map> last = (List<Map>) redisTemplate.opsForValue().get(dbName + "_" + username + "_vital_last");
//
// if (last != null && !last.isEmpty()) {
// if (redisTemplate.hasKey(dbName + "_" + username + "_vital")) {
// // 数据有变化, 更新缓存
// if (!last.get(last.size() - 1).get("Time").equals(vitalList.get(vitalList.size() - 1).get("Time"))) {
// // 比较last和vitalList 计算出需要更新的条目
// for (int i = 0; i < vitalList.size(); i++) {
// if (last.get(last.size() - 1).get("Time").equals(vitalList.get(i).get("Time"))) {
// List<Map> updateList = vitalList.subList(i, vitalList.size());
// System.out.println("updateList = " + updateList);
// // todo delete
// for (Map map : updateList) {
// // ->
// redisTemplate.opsForList().rightPush(dbName + "_" + username + "_vital", map);
// }
// // 更新缓存
// //redisTemplate.delete(dbName + "_" + username + "_vital_last");
// //redisTemplate.opsForValue().set(dbName + "_" + username + "_vital_last", vitalList, 100, TimeUnit.SECONDS);
//
// redisTemplate.opsForList().trim(dbName + "_" + username + "_vital_last", 0, 9); // 保留最新的10条数据
// redisTemplate.delete(dbName + "_" + username + "_vital_last");
// redisTemplate.opsForValue().set(dbName + "_" + username + "_vital_last", vitalList, 100, TimeUnit.SECONDS);
//
// break;
// }
// }
// }
// }else {
// // 缓存中没有数据,存进去, ->
// redisTemplate.opsForList().rightPushAll(dbName + "_" + username + "_vital", last);
// redisTemplate.opsForList().trim(dbName + "_" + username + "_vital", 0, 9);
// // 设置过期时间
// redisTemplate.expire(dbName + "_" + username + "_vital", Duration.ofSeconds(100));
// }
// // 右进左出
// Object o = redisTemplate.opsForList().leftPop(dbName + "_" + username + "_vital");
// return (Map) o;
// }
// // 第一个缓存存储上一次查询到的数据
// redisTemplate.opsForValue().set(dbName + "_" + username + "_vital_last", vitalList, 100, TimeUnit.SECONDS);
// return Map.of();
//}
@Override @Override
public Map getVitalSignsList(Connection connection, String username, String dbName) { public Map getVitalSignsList(Connection connection, String username, String dbName) {
String sbpKey = dbName + username + "_sbp";
String dbpKey = dbName + username + "_dbp";
// 获取生命体征数据, 10条 // 获取生命体征数据, 10条
List<Map> vitalList = getVitalList(connection); List<Map> vitalList = getVitalList(connection, sbpKey, dbpKey);
Collections.reverse(vitalList);
List<Map> last = (List<Map>) redisTemplate.opsForValue().get(dbName + "_" + username + "_vital_last");
if (last != null && !last.isEmpty()) { String key = dbName + "_" + username + "_vital";
if (redisTemplate.hasKey(dbName + "_" + username + "_vital")) { String lastKey = dbName + "_" + username + "_vital_last";
// 数据有变化, 更新缓存
if (!last.get(last.size() - 1).get("Time").equals(vitalList.get(vitalList.size() - 1).get("Time"))) { // 从缓存中获取最新的生命体征列表
// 比较last和vitalList 计算出需要更新的条目 List<Map> cachedVitals = (List<Map>) redisTemplate.opsForValue().get(lastKey);
for (int i = 0; i < vitalList.size(); i++) {
if (last.get(last.size() - 1).get("Time").equals(vitalList.get(i).get("Time"))) { // 如果缓存有数据且数据库查询结果与缓存不同则更新缓存
List<Map> updateList = vitalList.subList(i, vitalList.size()); if (cachedVitals != null && !cachedVitals.isEmpty() && !cachedVitals.get(cachedVitals.size() - 1).get("Time").equals(vitalList.get(vitalList.size() - 1).get("Time"))) {
// todo delete // 清空已有的Redis列表
// System.out.println("updateList = " + updateList); redisTemplate.delete(key);
for (Map map : updateList) { // 将新的生命体征数据推入Redis列表
// -> redisTemplate.opsForList().rightPushAll(key, vitalList);
redisTemplate.opsForList().rightPush(dbName + "_" + username + "_vital", map); // 保留最新的10条数据
} redisTemplate.opsForList().trim(key, 0, 9);
// 更新缓存 // 更新缓存中的生命体征列表
redisTemplate.delete(dbName + "_" + username + "_vital_last"); redisTemplate.delete(lastKey);
redisTemplate.opsForValue().set(dbName + "_" + username + "_vital_last", vitalList, 100, TimeUnit.SECONDS); redisTemplate.opsForValue().set(lastKey, vitalList, 100, TimeUnit.SECONDS);
break;
}
}
}
}else {
// 缓存中没有数据,存进去, ->
redisTemplate.opsForList().rightPushAll(dbName + "_" + username + "_vital", last);
redisTemplate.opsForList().trim(dbName + "_" + username + "_vital", 0, 10);
// 设置过期时间
redisTemplate.expire(dbName + "_" + username + "_vital", Duration.ofSeconds(100));
}
// 右进左出
Object o = redisTemplate.opsForList().leftPop(dbName + "_" + username + "_vital");
return (Map) o;
} }
// 第一个缓存存储上一次查询到的数据
redisTemplate.opsForValue().set(dbName + "_" + username + "_vital_last", vitalList, 100, TimeUnit.SECONDS); // 如果没有缓存则初始化缓存
return Map.of(); if (cachedVitals == null || cachedVitals.isEmpty()) {
redisTemplate.opsForList().rightPushAll(key, vitalList);
redisTemplate.opsForList().trim(key, 0, 9);
// 设置过期时间
redisTemplate.expire(key, Duration.ofSeconds(100));
redisTemplate.opsForValue().set(lastKey, vitalList, 100, TimeUnit.SECONDS);
}
// 返回最新的数据
Object latestVital = redisTemplate.opsForList().index(key, 0);
return latestVital != null ? (Map) latestVital : Map.of();
} }
private List<Map> getVitalList(Connection connection) { // done
private List<Map> getVitalList(Connection connection,String sbpKey, String dbpKey) {
//List<Map> vitalList = new ArrayList<>();
//try {
// 查询生命体征数据
// String sql2 = "SELECT id,Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " +
// " FROM `featuretable` " +
// " ORDER BY id DESC LIMIT 10;";
// PreparedStatement statement = connection.prepareStatement(sql2);
// ResultSet resultSet = statement.executeQuery(sql2);
//
//while (resultSet.next()) {
// Map<String, Object> vital = new HashMap();
// vital.put("Phase", resultSet.getString("Phase"));
// vital.put("BIS", resultSet.getString("BIS"));
// vital.put("HR", resultSet.getString("HR"));
// vital.put("ST", resultSet.getString("ST"));
// vital.put("TEMP", resultSet.getString("TEMP"));
// vital.put("SPO2", resultSet.getString("SPO2"));
// vital.put("EtCO2", resultSet.getString("EtCO2"));
// vital.put("PPG", resultSet.getString("PPG"));
// vital.put("ABG", resultSet.getString("ABG"));
// vital.put("TOF", resultSet.getString("TOF"));
// vital.put("Time", resultSet.getString("Time"));
//
// Double bis = resultSet.getDouble("BIS");
// // exception
// vital.put("BIS_except", bis <= 39 || bis >= 61);
// Double hr = resultSet.getDouble("HR");
// vital.put("HR_except", hr <= 45 || hr >= 90);
// Double sbp = resultSet.getDouble("SBP");
// if (sbp == 0) {
// sbp = lastSbp != null ? lastSbp : sbp;
// } else {
// lastSbp = sbp; // 更新上一次的非零值
// }
// vital.put("SBP", sbp);
// vital.put("SBP_except", sbp > 0 && sbp < 80 || sbp > 130);
// Double dbp = resultSet.getDouble("DBP");
// if (dbp == 0) {
// dbp = lastDbp != null ? lastDbp : dbp;
// } else {
// lastDbp = dbp; // 更新上一次的非零值
// }
// vital.put("DBP", dbp);
// vital.put("DBP_except", dbp > 0 && dbp < 60 || dbp > 90);
// Double st = resultSet.getDouble("ST");
// vital.put("ST_except", st < -0.2 || st > 0.2);
// Double etCO2 = resultSet.getDouble("EtCO2");
// vital.put("EtCO2_except", etCO2 < 30 || etCO2 > 45);
// vitalList.add(vital);
//}
List<Map> vitalList = new ArrayList<>(); List<Map> vitalList = new ArrayList<>();
try { try {
// 查询生命体征数据 // 查询生命体征数据
String sql2 = "SELECT id,Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " + String sql2 = "SELECT id,Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " +
" FROM `featuretable` " + " FROM `featuretable` " +
// " GROUP BY Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " + " ORDER BY id DESC LIMIT 10;";
" ORDER BY id DESC LIMIT 20;";
PreparedStatement statement = connection.prepareStatement(sql2); PreparedStatement statement = connection.prepareStatement(sql2);
ResultSet resultSet = statement.executeQuery(sql2); ResultSet rs = statement.executeQuery(sql2);
while (resultSet.next()) {
// 将结果集存储在一个临时列表中
List<Map<String, Object>> tempVitalList = new ArrayList<>();
while (rs.next()) {
Map<String, Object> vital = new HashMap(); Map<String, Object> vital = new HashMap();
vital.put("Phase", resultSet.getString("Phase")); vital.put("BIS", rs.getDouble("BIS"));
vital.put("BIS", resultSet.getString("BIS")); vital.put("HR", rs.getDouble("HR"));
vital.put("HR", resultSet.getString("HR")); vital.put("SBP", rs.getDouble("SBP"));
vital.put("SBP", resultSet.getString("SBP")); vital.put("DBP", rs.getDouble("DBP"));
vital.put("DBP", resultSet.getString("DBP")); vital.put("ST", rs.getDouble("ST"));
vital.put("ST", resultSet.getString("ST")); vital.put("TEMP", rs.getDouble("TEMP"));
vital.put("TEMP", resultSet.getString("TEMP")); vital.put("SPO2", rs.getDouble("SPO2"));
vital.put("SPO2", resultSet.getString("SPO2")); vital.put("EtCO2", rs.getDouble("EtCO2"));
vital.put("EtCO2", resultSet.getString("EtCO2")); vital.put("PPG", rs.getDouble("PPG"));
vital.put("PPG", resultSet.getString("PPG")); vital.put("ABG", rs.getDouble("ABG"));
vital.put("ABG", resultSet.getString("ABG")); vital.put("TOF", rs.getDouble("TOF"));
vital.put("TOF", resultSet.getString("TOF")); vital.put("Time", rs.getString("Time"));
vital.put("Time", resultSet.getString("Time")); tempVitalList.add(vital);
Double bis = resultSet.getDouble("BIS"); }
vital.put("BIS_except", bis <= 40 || bis >= 60);
Double hr = resultSet.getDouble("HR"); Collections.reverse(tempVitalList);
vital.put("HR_except", hr <= 50 || hr >= 80);
Double sbp = resultSet.getDouble("SBP"); // 从后向前遍历临时列表替换0值
vital.put("SBP_except", sbp <= 90 || sbp >= 120); for (Map<String, Object> tempVital : tempVitalList) {
Double dbp = resultSet.getDouble("DBP"); Map<String, Object> vital = new HashMap();
vital.put("DBP_except", dbp <= 60 || dbp >= 90); Double bis = (Double) tempVital.get("BIS");
Double st = resultSet.getDouble("ST"); vital.put("BIS", bis);
vital.put("ST_except", st <= -0.2 || st >= 0.2); vital.put("BIS_except", bis <= 39 || bis >= 61);
Double etCO2 = resultSet.getDouble("EtCO2"); Double hr = (Double) tempVital.get("HR");
vital.put("EtCO2_except", etCO2 <= 30 || etCO2 >= 45); vital.put("HR", hr);
vital.put("HR_except", (hr <= 45 && hr >= 0) || hr >= 90);
Double sbp = (Double) tempVital.get("SBP");
if (sbp != 0) {
redisTemplate.opsForValue().set(sbpKey, sbp);
}
Double sbpValue = (Double) redisTemplate.opsForValue().get(sbpKey);
vital.put("SBP", sbpValue);
vital.put("SBP_except", sbpValue != null && sbpValue > 0 && sbpValue < 80 || sbpValue !=null && sbpValue > 130);
Double dbp = (Double) tempVital.get("DBP");
if (dbp != 0) {
redisTemplate.opsForValue().set(dbpKey, dbp);
}
Double dbpValue = (Double) redisTemplate.opsForValue().get(dbpKey);
vital.put("DBP", redisTemplate.opsForValue().get(dbpKey));
vital.put("DBP_except", dbpValue!= null && dbpValue > 0 && dbpValue < 60 || dbpValue!=null && dbpValue > 90);
Double st = (Double) tempVital.get("ST");
vital.put("ST", st);
vital.put("ST_except", st < -0.2 || st > 0.2);
Double etCO2 = (Double) tempVital.get("EtCO2");
vital.put("EtCO2", etCO2);
vital.put("EtCO2_except", etCO2 < 30 || etCO2 > 45);
Double spo2 = (Double) tempVital.get("SPO2");
vital.put("SPO2", spo2);
Double temp = (Double) tempVital.get("TEMP");
vital.put("TEMP", temp);
Object ppg = tempVital.get("PPG");
Object abg = tempVital.get("ABG");
Double tof = (Double) tempVital.get("TOF");
vital.put("TOF", tof);
vital.put("TOF_except", tof >= 10);
Object time = tempVital.get("Time");
vital.put("Time", time);
vitalList.add(vital); vitalList.add(vital);
} }
//System.out.println("vitalList = " + vitalList);
return vitalList; return vitalList;
} catch (SQLException e) { } catch (SQLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -224,13 +224,16 @@ public class VitalSignTimerWS {
// 诱导期给药, 暂时不用 // 诱导期给药, 暂时不用
// List revulsionList = revulsionService.getRevulsionServiceList(connection); // List revulsionList = revulsionService.getRevulsionServiceList(connection);
// jsonObject.put("revulsionList", revulsionList); // jsonObject.put("revulsionList", revulsionList);
Map flags = flagService.getFlag(connection); // 暂时不用
jsonObject.put("flags", flags); // Map flags = flagService.getFlag(connection);
// jsonObject.put("flags", flags);
jsonObject.put("msgType", "msg"); jsonObject.put("msgType", "msg");
WebSocketMessage message = new TextMessage(jsonObject.toJSONString().getBytes()); WebSocketMessage message = new TextMessage(jsonObject.toJSONString().getBytes());
try { try {
session.sendMessage(message); if (session.isOpen()) {
session.sendMessage(message);
}
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -0,0 +1,115 @@
server:
port: 6679
servlet:
context-path: /admin
address: 0.0.0.0
spring:
# 定时任务属性配置
quartz:
properties:
org:
quartz:
scheduler:
instanceName: clusteredScheduler
instanceId: AUTO
jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_
isClustered: true
clusterCheckinInterval: 10000
useProperties: false
threadPool:
class: org.quartz.simpl.SimpleThreadPool
threadCount: 50
threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true
job-store-type: jdbc
jdbc:
initialize-schema: never # 生产注意设置为 never
# 上传文件大小限制
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
# 静态资源文件
mvc:
static-path-pattern: /static/**
# 缓存相关配置
cache:
type: redis
# 数据库相关配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: Xg137839
# 一期
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
data:
redis:
host: 110.41.142.124
port: 16373
password: rax137839
connect-timeout: 5000
database: 1 # 一期
# 本地文件系统
file:
local:
enable: true
base-path: /Users/wangchi/Downloads/img
## spring security 对外暴露接口设置
security:
oauth2:
ignore:
urls:
- /webjars/**
- /v3/api-docs/**
- /doc.html
- /swagger-ui.html
- /swagger-ui/**
- /swagger-resources
- /token/check_token
- /error
- /actuator/**
- /code/**
- /rax/**
- /hospital/getHospitalList
# 临时白名单
#--------------如下配置尽量不要变动-------------
# mybatis-plus 配置
mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml
global-config:
banner: false
db-config:
id-type: auto
where-strategy: not_empty
insert-strategy: not_empty
update-strategy: not_null
type-handlers-package: com.rax.common.mybatis.handler
configuration:
jdbc-type-for-null: 'null'
call-setters-on-nulls: true
shrink-whitespaces-in-sql: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
vital-sign:
mongodb:
host: localhost
port: 27017
username: xxx
password: xxx
except-database: admin,config
information-database: adaw
mysql:
host: 110.41.142.124:3306
password: Xg137839
username: root

View File

@ -45,12 +45,12 @@ spring:
username: root username: root
password: Xg137839 password: Xg137839
# 一期 # 一期
# url: jdbc:mysql://localhost:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true url: jdbc:mysql://localhost:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
data: data:
redis: redis:
host: 110.41.142.124 # host: 110.41.142.124
# host: localhost host: localhost
port: 16373 port: 16373
password: rax137839 password: rax137839
connect-timeout: 5000 connect-timeout: 5000
@ -112,6 +112,6 @@ vital-sign:
except-database: admin,config except-database: admin,config
information-database: adaw information-database: adaw
mysql: mysql:
host: 110.41.142.124:3306 host: localhost:3306
password: Xg137839 password: Xg137839
username: root username: root

View File

@ -1,187 +1,187 @@
spring: #spring:
profiles: # profiles:
active: prod # active: prod
application: # application:
name: ${project.artifactId} # name: ${project.artifactId}
# 定时任务属性配置 # # 定时任务属性配置
quartz: # quartz:
properties: # properties:
org: # org:
quartz: # quartz:
scheduler: # scheduler:
instanceName: clusteredScheduler # instanceName: clusteredScheduler
instanceId: AUTO # instanceId: AUTO
jobStore: # jobStore:
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore # class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate # driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
tablePrefix: QRTZ_ # tablePrefix: QRTZ_
isClustered: true # isClustered: true
clusterCheckinInterval: 10000 # clusterCheckinInterval: 10000
useProperties: false # useProperties: false
threadPool: # threadPool:
class: org.quartz.simpl.SimpleThreadPool # class: org.quartz.simpl.SimpleThreadPool
threadCount: 50 # threadCount: 50
threadPriority: 5 # threadPriority: 5
threadsInheritContextClassLoaderOfInitializingThread: true # threadsInheritContextClassLoaderOfInitializingThread: true
job-store-type: jdbc # job-store-type: jdbc
jdbc: # jdbc:
initialize-schema: always # 生产注意设置为 never # initialize-schema: always # 生产注意设置为 never
# 上传文件大小限制 # # 上传文件大小限制
servlet: # servlet:
multipart: # multipart:
max-file-size: 100MB # max-file-size: 100MB
max-request-size: 100MB # max-request-size: 100MB
# 静态资源文件 # # 静态资源文件
mvc: # mvc:
static-path-pattern: /static/** # static-path-pattern: /static/**
#
gateway: #gateway:
# 前端密码登录解密密钥,和前端 .env 保存一致16位 # # 前端密码登录解密密钥,和前端 .env 保存一致16位
encodeKey: thanks,rax4cloud # encodeKey: thanks,rax4cloud
# 跳过验证码的客户端 clientId1,clientId2 # # 跳过验证码的客户端 clientId1,clientId2
ignore-clients: test,rax # ignore-clients: test,rax
#
# 本地文件系统 ## 本地文件系统
file: #file:
local: # local:
enable: true # enable: true
base-path: /Users/lengleng/Downloads/img # base-path: /Users/lengleng/Downloads/img
#
## spring security 对外暴露接口设置 ### spring security 对外暴露接口设置
security: #security:
oauth2: # oauth2:
ignore: # ignore:
urls: # urls:
- /webjars/** # - /webjars/**
- /v3/api-docs/** # - /v3/api-docs/**
- /doc.html # - /doc.html
- /swagger-ui.html # - /swagger-ui.html
- /swagger-ui/** # - /swagger-ui/**
- /swagger-resources # - /swagger-resources
- /token/check_token # - /token/check_token
- /error # - /error
- /actuator/** # - /actuator/**
- /code/** # - /code/**
- /rax/** # - /rax/**
- /hospital/getHospitalList # - /hospital/getHospitalList
# 临时白名单 ## 临时白名单
#
# 阿里云短信 ## 阿里云短信
ali: #ali:
sms: # sms:
templateCode: SMS_471660037 # 模板code # templateCode: SMS_471660037 # 模板code
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK # accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK # accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名 # signName: AAceshi #阿里云签名名
#
# 使用阿里提供的smsClient类 ## 使用阿里提供的smsClient类
aliyun: #aliyun:
sms: # sms:
SMS_471660037: # SMS_471660037:
accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK # accessKeyId: LTAI5tPrmvr4zavsjHXMozrc #阿里云AK
accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK # accessKeySecret: R4aGC4qYaYGcl41xc9anpBPQ0gzxD3 #阿里云SK
signName: AAceshi #阿里云签名名 # signName: AAceshi #阿里云签名名
templateCode: SMS_471660037 # 模板code # templateCode: SMS_471660037 # 模板code
#
#
#--------------如下配置尽量不要变动------------- ##--------------如下配置尽量不要变动-------------
# mybatis-plus 配置 ## mybatis-plus 配置
mybatis-plus: #mybatis-plus:
mapper-locations: classpath*:/mapper/*Mapper.xml # mapper-locations: classpath*:/mapper/*Mapper.xml
global-config: # global-config:
banner: false # banner: false
db-config: # db-config:
id-type: auto # id-type: auto
where-strategy: not_empty # where-strategy: not_empty
insert-strategy: not_empty # insert-strategy: not_empty
update-strategy: not_null # update-strategy: not_null
type-handlers-package: com.rax.common.mybatis.handler # type-handlers-package: com.rax.common.mybatis.handler
configuration: # configuration:
jdbc-type-for-null: 'null' # jdbc-type-for-null: 'null'
call-setters-on-nulls: true # call-setters-on-nulls: true
shrink-whitespaces-in-sql: true # shrink-whitespaces-in-sql: true
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl ## log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#
--- #---
spring: #spring:
config: # config:
activate: # activate:
on-profile: prod # on-profile: prod
# 缓存相关配置 # # 缓存相关配置
cache: # cache:
type: redis # type: redis
data: # data:
redis: # redis:
host: 110.41.142.124 # host: 110.41.142.124
port: 16373 # port: 16373
password: rax137839 # password: rax137839
connect-timeout: 5000 # connect-timeout: 5000
# database: 0 # 二期 # # database: 0 # 二期
database: 1 # 一期 # database: 1 # 一期
#
# 数据库相关配置 # # 数据库相关配置
datasource: # datasource:
driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
username: root # username: root
password: Xg137839 # password: Xg137839
# 一期 # # 一期
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
# 二期 # # 二期
# url: jdbc:mysql://110.41.142.124:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true ## url: jdbc:mysql://110.41.142.124:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true
#
server: #server:
port: 6679 #一期 # port: 6679 #一期
# port: 6379 #二期 # # port: 6379 #二期
servlet: # servlet:
context-path: /admin # context-path: /admin
#
vital-sign: #vital-sign:
except-database: admin,config,local # except-database: admin,config,local
information-database: information # information-database: information
mongodb: # mongodb:
host: 110.41.142.124:27017 # host: 110.41.142.124:27017
password: Xg137839mg # password: Xg137839mg
username: useradmin # username: useradmin
#
mysql: # mysql:
host: 110.41.142.124:3306 # host: 110.41.142.124:3306
password: Xg137839 # password: Xg137839
username: root # username: root
#
--- #---
spring: #spring:
config: # config:
activate: # activate:
on-profile: dev # on-profile: dev
# 缓存相关配置 # # 缓存相关配置
cache: # cache:
type: redis # type: redis
data: # data:
redis: # redis:
host: localhost # host: localhost
#
# 数据库相关配置 # # 数据库相关配置
datasource: # datasource:
driver-class-name: com.mysql.cj.jdbc.Driver # driver-class-name: com.mysql.cj.jdbc.Driver
username: root # username: root
password: root # password: root
url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 一期 # url: jdbc:mysql://110.41.142.124:3306/rax_backend1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 一期
# url: jdbc:mysql://localhost:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 二期 # # url: jdbc:mysql://localhost:3306/rax_backend?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowPublicKeyRetrieval=true&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&nullCatalogMeansCurrent=true # 二期
#
server: #server:
port: 9999 # port: 9999
servlet: # servlet:
context-path: /admin # context-path: /admin
#
vital-sign: #vital-sign:
except-database: admin,config,local # except-database: admin,config,local
information-database: information # information-database: information
mongodb: # mongodb:
host: localhost:27017 # host: localhost:27017
password: root # password: root
username: root # username: root
#
mysql: # mysql:
host: localhost:3306 # host: localhost:3306
password: root # password: root
username: root # username: root

View File

@ -2,10 +2,12 @@ spring:
profiles: profiles:
active: loc active: loc
gateway: gateway:
# 前端密码登录解密密钥,和前端 .env 保存一致16位 # 前端密码登录解密密钥,和前端 .env 保存一致16位
encodeKey: thanks,rax4cloud encodeKey: thanks,rax4cloud
# 跳过验证码的客户端 clientId1,clientId2 # 跳过验证码的客户端 clientId1,clientId2
ignore-clients: test,rax ignore-clients: test,rax
# a202503280555000000:
# t_chat: