fix(doctor): 修正医生满意度统计中的回复数计算逻辑

- 排除音视频会话数,只统计文字回复数量
- 回复数计算结果取非负值避免出现负数
- 24小时回复率统计不再包含音视频会话

fix(watch): 修复手表设备绑定时的组织代码比较逻辑

- 修正绑定验证时使用正确的组织代码字段
- 防止因字段引用错误导致的绑定权限检查失败

refactor(watch): 将警告开关异步保存以提高系统稳定性

- 使用异步任务执行外部系统调用
- 避免外部系统异常影响主业务流程
- 解绑非必要操作以增强系统容错性
This commit is contained in:
2026-04-08 17:17:18 +08:00
parent 10d7a2f908
commit 15dfd6a9c7
2 changed files with 19 additions and 13 deletions
@@ -353,7 +353,10 @@ public class ConDoctorServiceImpl extends ServiceImpl<ConDoctorMapper, ConDoctor
}
String userScore = conDoctorSatisfy.getUserScore();
String userScoreNum = conDoctorSatisfy.getUserScoreNum();
String replyNum = conDoctorSatisfy.getReplyNum();
// 回复数排除音视频会话数(音视频为实时通话,不计入文字回复统计),结果取非负值
int replyNumVal = Math.max(Integer.parseInt(conDoctorSatisfy.getReplyNum()) - item.getAudioVideo(), 0);
String replyNum = String.valueOf(replyNumVal);
//24小时回复率不计算音视频
String messageNum = conDoctorSatisfy.getMessageNum();
String a = conDoctorApiService.averageJudgment(item.getId(), new BigDecimal(userScore), new BigDecimal(userScoreNum));
@@ -300,9 +300,9 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
// 新增手表只能绑定给本单位的人
LoginUser userById = sysBaseAPI.getUserById(dto.getBindUserId());
if (userById.getOrgCode() == null || dto.getOrgCode() == null ||
userById.getOrgCode().length() < 6 || dto.getOrgCode().length() < 6 ||
!userById.getOrgCode().substring(0, 6).equals(dto.getOrgCode().substring(0, 6))) {
if (userById.getOrgCode() == null || watchDevice.getOrgCode() == null ||
userById.getOrgCode().length() < 6 || watchDevice.getOrgCode().length() < 6 ||
!userById.getOrgCode().substring(0, 6).equals(watchDevice.getOrgCode().substring(0, 6))) {
return Result.error("手表只能绑定给本单位人员");
}
@@ -504,15 +504,18 @@ public class WatchDeviceServiceImpl extends ServiceImpl<WatchDeviceMapper, Watch
switchUpdateWrapper.eq(WatchDeviceSwitch::getWatchNo, dto.getWatchNo());
watchDeviceSwitchService.update(switchUpdateWrapper);
String[] wdTypes = {"heart_rate", "spo2", "stress", "temperature"};
for (int i = 0; i < wdTypes.length; i++) {
WarnSwitch warnSwitch = new WarnSwitch();
warnSwitch.setWatchNo(dto.getWatchNo());
warnSwitch.setWdType(wdTypes[i]);
warnSwitch.setSwitchFlag("1");
dataCenterExecutor.saveWarnSwitch(warnSwitch);
}
//通知更新
dataCenterExecutor.cmdUpdateSwitch(dto.getWatchNo());
// 异步调用外部系统,防止外部系统异常导致功能异常,解绑这里非必要
asyncTaskExecutor.execute(() -> {
for (int i = 0; i < wdTypes.length; i++) {
WarnSwitch warnSwitch = new WarnSwitch();
warnSwitch.setWatchNo(dto.getWatchNo());
warnSwitch.setWdType(wdTypes[i]);
warnSwitch.setSwitchFlag("1");
dataCenterExecutor.saveWarnSwitch(warnSwitch);
}
//通知更新
dataCenterExecutor.cmdUpdateSwitch(dto.getWatchNo());
});
}
/**