验证护理文件数量,进行质控或者异常的推送
parent
9eebb5e800
commit
ef9b0aa3a6
@ -0,0 +1,37 @@
|
|||||||
|
package com.docus.server.common.config;
|
||||||
|
|
||||||
|
import com.docus.server.common.util.RedisKeyExpirationListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.data.redis.listener.PatternTopic;
|
||||||
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RedisConfig {
|
||||||
|
@Autowired
|
||||||
|
private RedisConnectionFactory redisConnectionFactory;
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisKeyExpirationListener redisKeyExpirationListener() {
|
||||||
|
return new RedisKeyExpirationListener(stringRedisTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisMessageListenerContainer redisMessageListenerContainer(){
|
||||||
|
RedisMessageListenerContainer redisMessageListenerContainer = new RedisMessageListenerContainer();
|
||||||
|
redisMessageListenerContainer.setConnectionFactory(redisConnectionFactory);
|
||||||
|
// 监听 __keyevent@0__:expired ,使用键时间监听key的过期
|
||||||
|
redisMessageListenerContainer.addMessageListener(redisKeyExpirationListener(),
|
||||||
|
new PatternTopic("__keyevent@*__:expired"));
|
||||||
|
|
||||||
|
return redisMessageListenerContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.docus.server.common.util;
|
||||||
|
|
||||||
|
import org.springframework.data.redis.connection.Message;
|
||||||
|
import org.springframework.data.redis.connection.MessageListener;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis 键过期监听
|
||||||
|
*
|
||||||
|
* @author wyb
|
||||||
|
*/
|
||||||
|
public class RedisKeyExpirationListener implements MessageListener {
|
||||||
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
|
private final List<RedisKeyExpirationHandler> handlers = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
|
public RedisKeyExpirationListener(StringRedisTemplate stringRedisTemplate) {
|
||||||
|
this.stringRedisTemplate = stringRedisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Message message, byte[] bytes) {
|
||||||
|
byte[] body = message.getBody();
|
||||||
|
String expireRedisKey = stringRedisTemplate.getStringSerializer().deserialize(body);
|
||||||
|
for (RedisKeyExpirationHandler handler : handlers) {
|
||||||
|
handler.handle(expireRedisKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 注册redisKey过期的处理器
|
||||||
|
*
|
||||||
|
* @param handler redisKey过期的处理器
|
||||||
|
*/
|
||||||
|
public void register(RedisKeyExpirationHandler handler) {
|
||||||
|
Objects.requireNonNull(handler);
|
||||||
|
handlers.add(handler);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.docus.server.report.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顺德人医 移动护理文档异常推送请求返回体
|
||||||
|
*
|
||||||
|
* @author jiashi
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SdNurDocFailResponse {
|
||||||
|
/**
|
||||||
|
* 接收代码
|
||||||
|
*/
|
||||||
|
private String error_code;
|
||||||
|
/**
|
||||||
|
* 接收提示
|
||||||
|
*/
|
||||||
|
private String error_msg;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.docus.server.report.consts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报告下载等待参数
|
||||||
|
*/
|
||||||
|
public interface ReportDownloadWait {
|
||||||
|
/**
|
||||||
|
* 等待报告下载完成的时间 单位秒
|
||||||
|
*/
|
||||||
|
int REPORT_DOWNLOAD_WAIT_TIME = 30 * 60;
|
||||||
|
/**
|
||||||
|
* 等待报告下载完成的redisKey,docus:collect:report:download:wait:{采集器id}:{病案主键}
|
||||||
|
*/
|
||||||
|
String REPORT_DOWNLOAD_WAIT_KEY = "docus:collect:report:download:wait:%s:%s";
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.docus.server.report.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件表mapper
|
||||||
|
*
|
||||||
|
* @author wyb
|
||||||
|
*/
|
||||||
|
public interface AfScanAssortMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据病案主键和采集器id查询文件表数量
|
||||||
|
*
|
||||||
|
* @param patientId 病案主键
|
||||||
|
* @param collectorId 采集器id
|
||||||
|
* @return 文件表数量
|
||||||
|
*/
|
||||||
|
Integer countByPatientAndCollectorId(@Param("patientId") String patientId, @Param("collectorId") String collectorId);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.docus.server.report.service;
|
||||||
|
|
||||||
|
public interface ShunDePeopleBusinessService {
|
||||||
|
/**
|
||||||
|
* 护理文件数量校验不成功
|
||||||
|
*
|
||||||
|
* @param inpatientNo 病案号
|
||||||
|
* @param admissTimes 住院次数
|
||||||
|
* @param errorMsg 错误信息
|
||||||
|
*/
|
||||||
|
void nurseFileCountError(String inpatientNo, Integer admissTimes, String errorMsg);
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.docus.server.report.service.impl;
|
||||||
|
|
||||||
|
import com.docus.server.report.api.ShunDePeopleService;
|
||||||
|
import com.docus.server.report.api.dto.SdNurDocFailRequest;
|
||||||
|
import com.docus.server.report.service.ShunDePeopleBusinessService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ShunDePeopleBusinessServiceImpl implements ShunDePeopleBusinessService {
|
||||||
|
@Resource
|
||||||
|
private ShunDePeopleService shunDePeopleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void nurseFileCountError(String inpatientNo, Integer admissTimes,String errorMsg) {
|
||||||
|
final String traceCode = "nurse_doc_fail";
|
||||||
|
final String errorCode = "-1";
|
||||||
|
SdNurDocFailRequest failRequest = new SdNurDocFailRequest(inpatientNo,admissTimes.toString(),traceCode,errorCode,errorMsg);
|
||||||
|
shunDePeopleService.pushSdNurDocFail(failRequest);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.docus.server.report.mapper.AfScanAssortMapper">
|
||||||
|
|
||||||
|
<select id="countByPatientAndCollectorId" resultType="java.lang.Integer">
|
||||||
|
SELECT count(1)
|
||||||
|
from `docus_archivefile`.`t_scan_assort`
|
||||||
|
WHERE `patient_id` = #{patientId}
|
||||||
|
and `source` = #{collectorId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue