mirror of
https://gitee.com/republicline/rax-remote-v2.git
synced 2025-08-24 00:25:00 +08:00
parent
51c7e78405
commit
158129e56e
|
@ -8,8 +8,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rax.admin.api.dto.SysLogDTO;
|
||||
import com.rax.admin.api.entity.SysLog;
|
||||
import com.rax.admin.api.entity.SysRole;
|
||||
import com.rax.admin.mapper.SysLogMapper;
|
||||
import com.rax.admin.service.SysLogService;
|
||||
import com.rax.admin.service.SysRoleService;
|
||||
import com.rax.common.security.service.RaxUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -26,15 +31,25 @@ import java.util.Map;
|
|||
*/
|
||||
@Service
|
||||
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
|
||||
private final static String ADMIN_ROLE_CODE = "ROLE_ADMIN";
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
@Override
|
||||
public Page getLogByPage(Page page, SysLogDTO sysLog) {
|
||||
RaxUser raxUser = (RaxUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
List<SysRole> roleList = roleService.findRolesByUserId(raxUser.getId());
|
||||
List<SysRole> adminRoleList = roleList.stream().filter(predicate -> ADMIN_ROLE_CODE.contains(predicate.getRoleCode())).toList();
|
||||
|
||||
LambdaQueryWrapper<SysLog> wrapper = Wrappers.lambdaQuery();
|
||||
if (StrUtil.isNotBlank(sysLog.getLogType())) {
|
||||
wrapper.eq(SysLog::getLogType, sysLog.getLogType());
|
||||
}
|
||||
|
||||
if (adminRoleList.isEmpty()) {
|
||||
wrapper.eq(SysLog::getCreateBy, raxUser.getName());
|
||||
}
|
||||
|
||||
if (ArrayUtil.isNotEmpty(sysLog.getTimeInterval())) {
|
||||
wrapper.ge(SysLog::getCreateTime, sysLog.getTimeInterval()[0])
|
||||
.le(SysLog::getCreateTime, sysLog.getTimeInterval()[1]);
|
||||
|
|
|
@ -8,13 +8,15 @@ import jakarta.annotation.Resource;
|
|||
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
|
||||
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||
import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 网站发送给仪器给药信息
|
||||
|
@ -26,9 +28,16 @@ public class AddMedicineHandler implements WebSocketHandler {
|
|||
@Resource
|
||||
private OAuth2AuthorizationService authorizationService;
|
||||
|
||||
private static final long HEARTBEAT_INTERVAL = 30; // 心跳间隔秒数
|
||||
private ScheduledExecutorService scheduler;
|
||||
private ScheduledFuture<?> heartbeatTask;
|
||||
private int pingTime = 0;
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
vitalSignTimerWS.setWSAIFlagSession(session);
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
heartbeatTask = scheduler.scheduleAtFixedRate(() -> sendPing(session), 0, HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,31 +48,69 @@ public class AddMedicineHandler implements WebSocketHandler {
|
|||
OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
|
||||
String username = authorization.getPrincipalName();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject((String) message.getPayload());
|
||||
// 病人名
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
// 病人身份证
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
// yyyyMMdd
|
||||
String date = jsonObject.getString("date");
|
||||
String databaseName = patientName + idNum;
|
||||
vitalSignTimerWS.changeWSAIFlag(databaseName, username, session, jsonObject.getString("flag"),
|
||||
jsonObject.getString("medicine"), jsonObject.getString("value"));
|
||||
if (message.getPayload() instanceof String) {
|
||||
JSONObject jsonObject = JSONObject.parseObject((String) message.getPayload());
|
||||
// 病人名
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
// 病人身份证
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
// yyyyMMdd
|
||||
String date = jsonObject.getString("date");
|
||||
String databaseName = patientName + idNum;
|
||||
vitalSignTimerWS.changeWSAIFlag(databaseName, username, session, jsonObject.getString("flag"),
|
||||
jsonObject.getString("medicine"), jsonObject.getString("value"));
|
||||
} else {
|
||||
session.sendMessage(new PongMessage());
|
||||
pingTime--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
||||
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.removeWSAIFlagSession(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
||||
vitalSignTimerWS.removeWSAIFlagSession(session);
|
||||
System.out.println(this.getClass().getName() + " Connection closed:" + closeStatus.getReason());
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPartialMessages() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendPing(WebSocketSession session) {
|
||||
try {
|
||||
if (pingTime > 3) {
|
||||
session.close();
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.removeWSAIFlagSession(session);
|
||||
} else {
|
||||
session.sendMessage(new PingMessage());
|
||||
pingTime++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
vitalSignTimerWS.removeWSAIFlagSession(session);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,15 @@ import jakarta.annotation.Resource;
|
|||
import org.springframework.security.oauth2.server.authorization.OAuth2Authorization;
|
||||
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||
import org.springframework.security.oauth2.server.authorization.OAuth2TokenType;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ChatHandler implements WebSocketHandler {
|
||||
@Resource
|
||||
|
@ -22,8 +24,15 @@ public class ChatHandler implements WebSocketHandler {
|
|||
@Resource
|
||||
private ChatService chatService;
|
||||
|
||||
private static final long HEARTBEAT_INTERVAL = 30; // 心跳间隔秒数
|
||||
private ScheduledExecutorService scheduler;
|
||||
private ScheduledFuture<?> heartbeatTask;
|
||||
private int pingTime = 0;
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
heartbeatTask = scheduler.scheduleAtFixedRate(() -> sendPing(session), 0, HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,23 +44,41 @@ public class ChatHandler implements WebSocketHandler {
|
|||
if (authorization != null) {
|
||||
String username = authorization.getPrincipalName();
|
||||
|
||||
String payload = (String) message.getPayload();
|
||||
JSONObject jsonObject = JSONObject.parseObject(payload);
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
String date = jsonObject.getString("date");
|
||||
// 消息内容
|
||||
String msg = jsonObject.getString("msg");
|
||||
chatService.sendMessageMysql(username, patientName, idNum, date, session, msg);
|
||||
if (message.getPayload() instanceof String) {
|
||||
String payload = (String) message.getPayload();
|
||||
JSONObject jsonObject = JSONObject.parseObject(payload);
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
String date = jsonObject.getString("date");
|
||||
// 消息内容
|
||||
String msg = jsonObject.getString("msg");
|
||||
chatService.sendMessageMysql(username, patientName, idNum, date, session, msg);
|
||||
} else {
|
||||
session.sendMessage(new PongMessage());
|
||||
pingTime--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
chatService.stopTask(session.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
chatService.stopTask(session.getId());
|
||||
}
|
||||
|
||||
|
@ -59,4 +86,25 @@ public class ChatHandler implements WebSocketHandler {
|
|||
public boolean supportsPartialMessages() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendPing(WebSocketSession session) {
|
||||
try {
|
||||
if (pingTime > 3) {
|
||||
session.close();
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
chatService.stopTask(session.getId());
|
||||
} else {
|
||||
session.sendMessage(new PingMessage());
|
||||
pingTime++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
chatService.stopTask(session.getId());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,13 @@ import com.rax.vital.timer.VitalSignTimerWS;
|
|||
import com.rax.vital.util.DatabaseNameUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketMessage;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 仪器获取网站给药信息
|
||||
|
@ -20,33 +23,58 @@ public class MachineFeedbackHandler implements WebSocketHandler {
|
|||
@Resource
|
||||
private VitalSignTimerWS vitalSignTimerWS;
|
||||
|
||||
private static final long HEARTBEAT_INTERVAL = 30; // 心跳间隔秒数
|
||||
private ScheduledExecutorService scheduler;
|
||||
private ScheduledFuture<?> heartbeatTask;
|
||||
private int pingTime = 0;
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
vitalSignTimerWS.setMachineSessionMap(session);
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
heartbeatTask = scheduler.scheduleAtFixedRate(() -> sendPing(session), 0, HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
|
||||
JSONObject jsonObject = JSONObject.parseObject((String) message.getPayload());
|
||||
// 病人名
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
// 病人身份证住院号
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
// yyyyMMdd
|
||||
String date = jsonObject.getString("date");
|
||||
String databaseName = patientName + idNum;
|
||||
String code = jsonObject.getString("code");
|
||||
if (message.getPayload() instanceof String) {
|
||||
JSONObject jsonObject = JSONObject.parseObject((String) message.getPayload());
|
||||
// 病人名
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
// 病人身份证住院号
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
// yyyyMMdd
|
||||
String date = jsonObject.getString("date");
|
||||
String databaseName = patientName + idNum;
|
||||
String code = jsonObject.getString("code");
|
||||
|
||||
vitalSignTimerWS.sendMachineFlag(databaseName, code, session);
|
||||
vitalSignTimerWS.sendMachineFlag(databaseName, code, session);
|
||||
} else {
|
||||
session.sendMessage(new PongMessage());
|
||||
pingTime--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.removeMachineSessionMap(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
||||
vitalSignTimerWS.removeMachineSessionMap(session);
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
System.out.println(this.getClass().getName() + " Connection closed:" + closeStatus.getReason());
|
||||
}
|
||||
|
||||
|
@ -54,4 +82,25 @@ public class MachineFeedbackHandler implements WebSocketHandler {
|
|||
public boolean supportsPartialMessages() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void sendPing(WebSocketSession session) {
|
||||
try {
|
||||
if (pingTime > 3) {
|
||||
session.close();
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.removeMachineSessionMap(session);
|
||||
} else {
|
||||
session.sendMessage(new PingMessage());
|
||||
pingTime++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
vitalSignTimerWS.removeMachineSessionMap(session);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,11 +29,12 @@ public class MedicineHandler implements WebSocketHandler {
|
|||
private static final long HEARTBEAT_INTERVAL = 30; // 心跳间隔秒数
|
||||
private ScheduledExecutorService scheduler;
|
||||
private ScheduledFuture<?> heartbeatTask;
|
||||
private int pingTime = 0;
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
// scheduler = Executors.newScheduledThreadPool(1);
|
||||
// heartbeatTask = scheduler.scheduleAtFixedRate(() -> sendPing(session), 0, HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
heartbeatTask = scheduler.scheduleAtFixedRate(() -> sendPing(session), 0, HEARTBEAT_INTERVAL, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,17 +45,29 @@ public class MedicineHandler implements WebSocketHandler {
|
|||
OAuth2Authorization authorization = authorizationService.findByToken(token, OAuth2TokenType.ACCESS_TOKEN);
|
||||
String username = authorization.getPrincipalName();
|
||||
|
||||
String payload = (String) message.getPayload();
|
||||
JSONObject jsonObject = JSONObject.parseObject(payload);
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
String databaseName = patientName + idNum;
|
||||
vitalSignTimerWS.createAndSendMessageMySQL(databaseName, username, session);
|
||||
if (message.getPayload() instanceof String) {
|
||||
String payload = (String) message.getPayload();
|
||||
JSONObject jsonObject = JSONObject.parseObject(payload);
|
||||
String patientName = jsonObject.getString("patientName");
|
||||
String idNum = jsonObject.getString("idNum");
|
||||
String databaseName = patientName + idNum;
|
||||
vitalSignTimerWS.createAndSendMessageMySQL(databaseName, username, session);
|
||||
} else {
|
||||
session.sendMessage(new PongMessage());
|
||||
pingTime--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
||||
System.out.println("Error: " + exception.getMessage());
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.stopTimerTask(session.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,8 +89,21 @@ public class MedicineHandler implements WebSocketHandler {
|
|||
|
||||
private void sendPing(WebSocketSession session) {
|
||||
try {
|
||||
session.sendMessage(new PingMessage());
|
||||
if (pingTime > 3) {
|
||||
session.close();
|
||||
if (heartbeatTask != null) {
|
||||
heartbeatTask.cancel(true);
|
||||
}
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
}
|
||||
vitalSignTimerWS.stopTimerTask(session.getId());
|
||||
} else {
|
||||
session.sendMessage(new PingMessage());
|
||||
pingTime++;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
vitalSignTimerWS.stopTimerTask(session.getId());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ public class AIMedicineServiceImpl implements AIMedicineService {
|
|||
try {
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet resultSet = statement.executeQuery("SELECT id, phase, `丙泊酚`, `舒芬太尼`, `瑞芬太尼`, `顺阿曲库胺`, `尼卡地平`, `艾司洛尔`, `麻黄素`, `阿托品`, time FROM `aimedicinetable` ORDER BY time DESC LIMIT 1;");
|
||||
Map medicine = new HashMap();
|
||||
while (resultSet.next()) {
|
||||
Map medicine = new HashMap();
|
||||
medicine.put("id", resultSet.getString("id"));
|
||||
medicine.put("phase", resultSet.getString("phase"));
|
||||
medicine.put("丙泊酚", resultSet.getString("丙泊酚"));
|
||||
|
@ -69,8 +69,24 @@ public class AIMedicineServiceImpl implements AIMedicineService {
|
|||
medicine.put("麻黄素", resultSet.getString("麻黄素"));
|
||||
medicine.put("阿托品", resultSet.getString("阿托品"));
|
||||
medicine.put("Time", resultSet.getString("time"));
|
||||
medicineList.add(medicine);
|
||||
}
|
||||
String sql = "SELECT sum(`丙泊酚`) \"丙泊酚sum\", sum(`舒芬太尼`) \"舒芬太尼sum\", " +
|
||||
"sum(`瑞芬太尼`) \"瑞芬太尼sum\", sum(`顺阿曲库胺`) \"顺阿曲库胺sum\", " +
|
||||
"sum(`尼卡地平`) \"尼卡地平sum\", sum(`艾司洛尔`) \"艾司洛尔sum\", " +
|
||||
"sum(`麻黄素`) \"麻黄素sum\", sum(`阿托品`) \"阿托品sum\" FROM `aimedicinetable`";
|
||||
ResultSet sumSet = statement.executeQuery(sql);
|
||||
while (sumSet.next()) {
|
||||
medicine.put("丙泊酚sum", sumSet.getString("丙泊酚sum"));
|
||||
medicine.put("舒芬太尼sum", sumSet.getString("舒芬太尼sum"));
|
||||
medicine.put("瑞芬太尼sum", sumSet.getString("瑞芬太尼sum"));
|
||||
medicine.put("顺阿曲库胺sum", sumSet.getString("顺阿曲库胺sum"));
|
||||
medicine.put("尼卡地平sum", sumSet.getString("尼卡地平sum"));
|
||||
medicine.put("艾司洛尔sum", sumSet.getString("艾司洛尔sum"));
|
||||
medicine.put("麻黄素sum", sumSet.getString("麻黄素sum"));
|
||||
medicine.put("阿托品sum", sumSet.getString("阿托品sum"));
|
||||
}
|
||||
|
||||
medicineList.add(medicine);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -228,6 +228,7 @@ public class ChatServiceImpl implements ChatService {
|
|||
preparedStatement.setString(2, now);
|
||||
param.put("createTime", now);
|
||||
preparedStatement.setString(3, username);
|
||||
param.put("createUser", username);
|
||||
String name = userInfo.getSysUser().getName();
|
||||
preparedStatement.setString(4, name);
|
||||
param.put("createName", name);
|
||||
|
|
|
@ -41,10 +41,10 @@ public class DoctorMedicineServiceImpl implements DoctorMedicineService {
|
|||
public List<Map> getDocMedicine(Connection connection) {
|
||||
List<Map> medicineList = new ArrayList<>();
|
||||
try {
|
||||
Map medicine = new HashMap();
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet resultSet = statement.executeQuery("SELECT id, phase, `丙泊酚`, `舒芬太尼`, `瑞芬太尼`, `顺阿曲库胺`, `尼卡地平`, `艾司洛尔`, `麻黄素`, `阿托品`, time FROM `doctormedicinetable` ORDER BY time DESC LIMIT 1;");
|
||||
while (resultSet.next()) {
|
||||
Map medicine = new HashMap();
|
||||
medicine.put("id", resultSet.getString("id"));
|
||||
medicine.put("phase", resultSet.getString("phase"));
|
||||
medicine.put("丙泊酚", resultSet.getString("丙泊酚"));
|
||||
|
@ -56,8 +56,25 @@ public class DoctorMedicineServiceImpl implements DoctorMedicineService {
|
|||
medicine.put("麻黄素", resultSet.getString("麻黄素"));
|
||||
medicine.put("阿托品", resultSet.getString("阿托品"));
|
||||
medicine.put("Time", resultSet.getString("time"));
|
||||
medicineList.add(medicine);
|
||||
}
|
||||
|
||||
String sql = "SELECT sum(`丙泊酚`) \"丙泊酚sum\", sum(`舒芬太尼`) \"舒芬太尼sum\", " +
|
||||
"sum(`瑞芬太尼`) \"瑞芬太尼sum\", sum(`顺阿曲库胺`) \"顺阿曲库胺sum\", " +
|
||||
"sum(`尼卡地平`) \"尼卡地平sum\", sum(`艾司洛尔`) \"艾司洛尔sum\", " +
|
||||
"sum(`麻黄素`) \"麻黄素sum\", sum(`阿托品`) \"阿托品sum\" FROM `doctormedicinetable`";
|
||||
ResultSet sumSet = statement.executeQuery(sql);
|
||||
while (sumSet.next()) {
|
||||
medicine.put("丙泊酚sum", sumSet.getString("丙泊酚sum"));
|
||||
medicine.put("舒芬太尼sum", sumSet.getString("舒芬太尼sum"));
|
||||
medicine.put("瑞芬太尼sum", sumSet.getString("瑞芬太尼sum"));
|
||||
medicine.put("顺阿曲库胺sum", sumSet.getString("顺阿曲库胺sum"));
|
||||
medicine.put("尼卡地平sum", sumSet.getString("尼卡地平sum"));
|
||||
medicine.put("艾司洛尔sum", sumSet.getString("艾司洛尔sum"));
|
||||
medicine.put("麻黄素sum", sumSet.getString("麻黄素sum"));
|
||||
medicine.put("阿托品sum", sumSet.getString("阿托品sum"));
|
||||
}
|
||||
|
||||
medicineList.add(medicine);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -100,10 +100,13 @@ public class VitalSignServiceImpl implements VitalSignsService {
|
|||
List<Map> vitalList = new ArrayList<>();
|
||||
try {
|
||||
Statement statement = connection.createStatement();
|
||||
ResultSet resultSet = statement.executeQuery("SELECT id, Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time FROM `featuretable` ORDER BY time DESC LIMIT 1;");
|
||||
String sql = "SELECT Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " +
|
||||
" FROM `featuretable` " +
|
||||
" GROUP BY Phase, BIS, HR, SBP, DBP, ST, TEMP, SPO2, EtCO2, PPG, ABG, TOF, Time " +
|
||||
" ORDER BY time DESC LIMIT 10;";
|
||||
ResultSet resultSet = statement.executeQuery(sql);
|
||||
while (resultSet.next()) {
|
||||
Map<String, Object> vital = new HashMap();
|
||||
vital.put("id", resultSet.getString("id"));
|
||||
vital.put("Phase", resultSet.getString("Phase"));
|
||||
vital.put("BIS", resultSet.getString("BIS"));
|
||||
vital.put("HR", resultSet.getString("HR"));
|
||||
|
|
|
@ -256,11 +256,11 @@ public class VitalSignTimerWS {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void setMachineSessionMap(WebSocketSession session) throws IOException {
|
||||
public synchronized void setMachineSessionMap(WebSocketSession session) {
|
||||
machineSessionMap.put(session.getId(), session);
|
||||
}
|
||||
|
||||
public void removeMachineSessionMap(WebSocketSession session) throws Exception {
|
||||
public void removeMachineSessionMap(WebSocketSession session) {
|
||||
machineSessionMap.remove(session.getId());
|
||||
if (machineDatabaseSessionMap.containsValue(session.getId())) {
|
||||
for (String database : machineDatabaseSessionMap.keySet()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user