fixed: 给药json格式

This commit is contained in:
republicline 2024-08-09 17:29:25 +08:00
parent ea24609c7e
commit 6f6643752d
4 changed files with 12 additions and 4 deletions

View File

@ -116,10 +116,12 @@ public class AddMedicineHandler implements WebSocketHandler {
JSONObject result = new JSONObject();
result.put("msgType", "pong");
// 当前时间戳
result.put("msg", new Date().getTime() - timeStamp);
Long diff = new Date().getTime() - timeStamp;
result.put("msg", diff);
session.sendMessage(new TextMessage(result.toJSONString().getBytes()));
}
}
}

View File

@ -116,7 +116,8 @@ public class MachineFeedbackHandler implements WebSocketHandler {
JSONObject result = new JSONObject();
result.put("msgType", "pong");
// 当前时间戳
result.put("msg", new Date().getTime() - timeStamp);
Long diff = new Date().getTime() - timeStamp;
result.put("msg", diff);
session.sendMessage(new TextMessage(result.toJSONString().getBytes()));
}

View File

@ -1,5 +1,6 @@
package com.rax.vital.medicine.service.impl;
import cn.hutool.core.collection.ListUtil;
import com.mongodb.BasicDBObject;
import com.rax.vital.medicine.service.AIMedicineService;
import lombok.AllArgsConstructor;
@ -186,8 +187,11 @@ public class AIMedicineServiceImpl implements AIMedicineService {
}
aiMedicines.remove(0);
aiMedicines.add(medicine);
return aiMedicines.get(0);
}else {
return Map.of();
}
return aiMedicines.get(0);
}
@Override

View File

@ -279,7 +279,8 @@ public class VitalSignTimerWS {
String sessionId = machineDatabaseSessionMap.get(database);
WebSocketSession machineSession = machineSessionMap.get(sessionId);
if (machineSession != null) {
result.put(medicine, value);
result.put("medicine",medicine);
result.put("value",value);
result.put("flag", flag);
result.put("msgType", "addMedicine");
machineSession.sendMessage(new TextMessage(result.toJSONString().getBytes()));