|
@@ -11,7 +11,9 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Component("callPoliceTiming")
|
|
@Component("callPoliceTiming")
|
|
public class CallPoliceTiming {
|
|
public class CallPoliceTiming {
|
|
@@ -37,7 +39,7 @@ public class CallPoliceTiming {
|
|
//已经处理过的不处理
|
|
//已经处理过的不处理
|
|
List<TEarlyWarning> tEarlyWarnings = itEarlyWarningService.selectTEarlyWarningByAlarmId(info.getId());
|
|
List<TEarlyWarning> tEarlyWarnings = itEarlyWarningService.selectTEarlyWarningByAlarmId(info.getId());
|
|
if (tEarlyWarnings != null && !tEarlyWarnings.isEmpty()) {
|
|
if (tEarlyWarnings != null && !tEarlyWarnings.isEmpty()) {
|
|
- return;
|
|
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
TEarlyWarning earlyWarning = new TEarlyWarning();
|
|
TEarlyWarning earlyWarning = new TEarlyWarning();
|
|
//查找对应的手环绑定用户
|
|
//查找对应的手环绑定用户
|
|
@@ -51,7 +53,9 @@ public class CallPoliceTiming {
|
|
// 类型:0-其他;1-SOS;2-跌倒;3-围栏;4-健康
|
|
// 类型:0-其他;1-SOS;2-跌倒;3-围栏;4-健康
|
|
earlyWarning.setType(info.getAlarm_type());
|
|
earlyWarning.setType(info.getAlarm_type());
|
|
//告警内容
|
|
//告警内容
|
|
- earlyWarning.setContent(getContentByType(info.getAlarm_type(), info.getCreatetime(), earlyWarning.getUserId()));
|
|
|
|
|
|
+ Map<String, String> map = getContentByType(info.getAlarm_type(), info.getCreatetime(), earlyWarning.getUserId());
|
|
|
|
+ earlyWarning.setTypeDesc(map.get("type_desc"));
|
|
|
|
+ earlyWarning.setContent(map.get("content"));
|
|
//事件记录
|
|
//事件记录
|
|
earlyWarning.setEventRecord("");
|
|
earlyWarning.setEventRecord("");
|
|
//预警定位
|
|
//预警定位
|
|
@@ -79,7 +83,7 @@ public class CallPoliceTiming {
|
|
* @param userId
|
|
* @param userId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getContentByType(Integer alarmType, Date createtime, Long userId) {
|
|
|
|
|
|
+ private Map<String, String> getContentByType(Integer alarmType, Date createtime, Long userId) {
|
|
//健康告警求助:成浪平于2023-09-27 15:17:02发起健康告警求助
|
|
//健康告警求助:成浪平于2023-09-27 15:17:02发起健康告警求助
|
|
//设备对应的用户
|
|
//设备对应的用户
|
|
TUserProfile tUserProfile = null;
|
|
TUserProfile tUserProfile = null;
|
|
@@ -91,12 +95,15 @@ public class CallPoliceTiming {
|
|
// 使用SimpleDateFormat对象将日期格式化为指定格式的字符串
|
|
// 使用SimpleDateFormat对象将日期格式化为指定格式的字符串
|
|
String time = dateFormat.format(createtime);
|
|
String time = dateFormat.format(createtime);
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ String typeDesc = "";
|
|
if (alarmType != null) {
|
|
if (alarmType != null) {
|
|
if (alarmType == 0) {
|
|
if (alarmType == 0) {
|
|
- stringBuilder.append("无效报警!");
|
|
|
|
|
|
+ typeDesc = "无效报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append("!");
|
|
} else if (alarmType == 16) {
|
|
} else if (alarmType == 16) {
|
|
//16:SOS报警;
|
|
//16:SOS报警;
|
|
- stringBuilder.append("SOS报警求助:");
|
|
|
|
|
|
+ typeDesc = "SOS报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append("求助:");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -105,7 +112,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起SOS报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起SOS报警求助!");
|
|
} else if (alarmType == 17) {
|
|
} else if (alarmType == 17) {
|
|
//17:低电报警;
|
|
//17:低电报警;
|
|
- stringBuilder.append("低电报警:");
|
|
|
|
|
|
+ typeDesc = "低电报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -114,7 +122,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起低电报警!");
|
|
stringBuilder.append("于").append(time).append("发起低电报警!");
|
|
} else if (alarmType == 20) {
|
|
} else if (alarmType == 20) {
|
|
//20:手环拆除报警;
|
|
//20:手环拆除报警;
|
|
- stringBuilder.append("手环拆除报警:");
|
|
|
|
|
|
+ typeDesc = "手环拆除报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -123,7 +132,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起手环拆除报警!");
|
|
stringBuilder.append("于").append(time).append("发起手环拆除报警!");
|
|
} else if (alarmType == 21) {
|
|
} else if (alarmType == 21) {
|
|
//21:跌倒报警;
|
|
//21:跌倒报警;
|
|
- stringBuilder.append("跌倒报警:");
|
|
|
|
|
|
+ typeDesc = "跌倒报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -132,7 +142,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起跌倒报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起跌倒报警求助!");
|
|
} else if (alarmType == 22) {
|
|
} else if (alarmType == 22) {
|
|
//22:心率异常报警,
|
|
//22:心率异常报警,
|
|
- stringBuilder.append("心率异常报警:");
|
|
|
|
|
|
+ typeDesc = "心率异常报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -141,7 +152,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起心率异常报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起心率异常报警求助!");
|
|
} else if (alarmType == 23) {
|
|
} else if (alarmType == 23) {
|
|
//23:血压异常报警,
|
|
//23:血压异常报警,
|
|
- stringBuilder.append("血压异常报警:");
|
|
|
|
|
|
+ typeDesc = "血压异常报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -150,7 +162,8 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起血压异常报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起血压异常报警求助!");
|
|
} else if (alarmType == 24) {
|
|
} else if (alarmType == 24) {
|
|
//24:体温异常报警
|
|
//24:体温异常报警
|
|
- stringBuilder.append("体温异常报警:");
|
|
|
|
|
|
+ typeDesc = "体温异常报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
@@ -159,18 +172,26 @@ public class CallPoliceTiming {
|
|
stringBuilder.append("于").append(time).append("发起体温异常报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起体温异常报警求助!");
|
|
} else if (alarmType == 25) {
|
|
} else if (alarmType == 25) {
|
|
//25:血氧异常报警
|
|
//25:血氧异常报警
|
|
- stringBuilder.append("血氧异常报警:");
|
|
|
|
|
|
+ typeDesc = "血氧异常报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append(":");
|
|
if (tUserProfile != null) {
|
|
if (tUserProfile != null) {
|
|
stringBuilder.append(tUserProfile.getName());
|
|
stringBuilder.append(tUserProfile.getName());
|
|
} else {
|
|
} else {
|
|
stringBuilder.append("设备");
|
|
stringBuilder.append("设备");
|
|
}
|
|
}
|
|
stringBuilder.append("于").append(time).append("发起血氧异常报警求助!");
|
|
stringBuilder.append("于").append(time).append("发起血氧异常报警求助!");
|
|
|
|
+ } else {
|
|
|
|
+ typeDesc = "无效报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append("!");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
-
|
|
|
|
|
|
+ typeDesc = "无效报警";
|
|
|
|
+ stringBuilder.append(typeDesc).append("!");
|
|
}
|
|
}
|
|
- return stringBuilder.toString();
|
|
|
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
|
+ map.put("content", stringBuilder.toString());
|
|
|
|
+ map.put("type_desc", typeDesc);
|
|
|
|
+ return map;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|