| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @lombok.extern.slf4j.Slf4j |
| | | public class CallServiceImpl implements CallService { |
| | | |
| | | @Resource |
| | |
| | | return callMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | /** |
| | | * 重叫:再生成一条叫号记录,让大屏 / 诊间屏重新播报。 |
| | | * |
| | | * <p>【本次修复】原实现: |
| | | * <pre> |
| | | * CallDO callDO = callMapper.getLatestPatientCall(patId); |
| | | * if (null != callDO && callDO.getCalled() == 0) return 0; // ← 永远成立 |
| | | * return createCall(createReqVO); |
| | | * </pre> |
| | | * 而**全项目没有任何地方把 {@code called} 置为 1**({@code getNextCall} / |
| | | * {@code getNextInstallCall} 只查 {@code called = 0})⇒ 该守卫每次都命中 ⇒ |
| | | * <b>重叫从不写入新记录</b>,两块屏也就完全没有反应(现场反馈即此)。 |
| | | * |
| | | * <p>现在只做"防连点":同一患者 **3 秒内**的重复重叫忽略,其余情况一律正常新建。 |
| | | */ |
| | | @Override |
| | | public Integer callAgain(CallSaveReqVO createReqVO) { |
| | | CallDO callDO = callMapper.getLatestPatientCall(createReqVO.getPatId()); |
| | | if (null != callDO && callDO.getCalled() == 0) |
| | | return 0; |
| | | |
| | | CallDO latest = callMapper.getLatestPatientCall(createReqVO.getPatId()); |
| | | if (null != latest && null != latest.getCreateTime()) { |
| | | long seconds = Duration.between(latest.getCreateTime(), LocalDateTime.now()).getSeconds(); |
| | | if (seconds >= 0 && seconds < 3) { |
| | | log.info("[callAgain] 3 秒内重复重叫,忽略. patId={} 上次={}", createReqVO.getPatId(), latest.getCreateTime()); |
| | | return 0; |
| | | } |
| | | } |
| | | return createCall(createReqVO); |
| | | } |
| | | } |