Compare commits
48 Commits
Author | SHA1 | Date |
---|---|---|
|
50c750f684 | 5 months ago |
|
eeb022da85 | 5 months ago |
|
9381ec0d0e | 6 months ago |
|
41817cbfbf | 7 months ago |
|
34480ad8d5 | 7 months ago |
|
b2888557cb | 7 months ago |
|
a9cb442250 | 7 months ago |
|
7ec1634b80 | 8 months ago |
|
4d063d76c2 | 8 months ago |
|
a5e43d82a5 | 10 months ago |
|
e1abd3bdbe | 1 year ago |
|
d34b8d64a8 | 1 year ago |
|
8c505bbad9 | 1 year ago |
|
9c0b5f8a46 | 1 year ago |
|
8c7a98a025 | 1 year ago |
|
67fd6d57e8 | 1 year ago |
|
941eb07ba1 | 1 year ago |
|
90f76c7d3f | 1 year ago |
|
3a6801300b | 1 year ago |
|
757c0df053 | 1 year ago |
|
ce38d65c96 | 1 year ago |
|
09995ef181 | 1 year ago |
|
11fce9d130 | 1 year ago |
|
77cb3b3029 | 1 year ago |
|
16dc209139 | 2 years ago |
|
d644c4a187 | 2 years ago |
|
ca48bd9dd5 | 2 years ago |
|
e0c6936c1c | 2 years ago |
|
552b705e76 | 2 years ago |
|
89a45ea24e | 2 years ago |
|
23da7cf02e | 2 years ago |
|
10a4f72937 | 2 years ago |
|
119e2bbfdd | 2 years ago |
|
145705e82f | 2 years ago |
|
8c2160da27 | 2 years ago |
|
664510dab3 | 2 years ago |
|
9f7e53a050 | 2 years ago |
|
b8a0f08d38 | 2 years ago |
|
4ac0f2ff4d | 2 years ago |
|
48eeb5be29 | 2 years ago |
|
635a1cee5f | 2 years ago |
|
ba29c4a1fc | 2 years ago |
|
973a15a526 | 2 years ago |
|
af9c1504f5 | 2 years ago |
|
9b5ddbb727 | 2 years ago |
|
f1e4a8298a | 2 years ago |
|
451f04c002 | 2 years ago |
|
5404536caa | 2 years ago |
@ -1,4 +1,15 @@
|
||||
{
|
||||
"blocking": ["xdxt","yx","jc"],
|
||||
"notHandled":["lis","bl","nh"]
|
||||
"blocking": [
|
||||
"xdxt",
|
||||
"yx",
|
||||
"jc"
|
||||
],
|
||||
"notHandled": [
|
||||
"lis",
|
||||
"bl",
|
||||
"nh"
|
||||
],
|
||||
"fetchBase64": [
|
||||
"cta"
|
||||
]
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.docus.server.collection.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BedDoctorDto {
|
||||
private String serialId;
|
||||
private String receive;
|
||||
private String send;
|
||||
/**
|
||||
* 病案号
|
||||
*/
|
||||
private String inpatientNo;
|
||||
/**
|
||||
* 住院次数
|
||||
*/
|
||||
private Integer admissTimes;
|
||||
/**
|
||||
*管床医生工号
|
||||
*/
|
||||
private String bedDoctor;
|
||||
/**
|
||||
*管床医生姓名
|
||||
*/
|
||||
private String bedDoctorName;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.docus.server.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.docus.server.collection.entity.CqcPushConfig;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CqcPushConfigMapper extends BaseMapper<CqcPushConfig> {
|
||||
|
||||
/**
|
||||
* @description 根据业务类型查询推送配置
|
||||
*/
|
||||
List<CqcPushConfig> getCqcPushConfigByBusinessTypes(@Param("ids") List<Long> ids);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.docus.server.collection.util;
|
||||
|
||||
import com.docus.server.collection.entity.TBasic;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @description 退回推送event
|
||||
* @author chierhao
|
||||
* @date 2023-02-14 15:12
|
||||
*/
|
||||
public class BackPushEventEntity extends ApplicationEvent{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private TBasic tBasic ;
|
||||
|
||||
public BackPushEventEntity(Object source, TBasic tBasic ) {
|
||||
super(source);
|
||||
this.tBasic = tBasic;
|
||||
}
|
||||
|
||||
public TBasic getTBasic() {
|
||||
return tBasic;
|
||||
}
|
||||
|
||||
public void setTBasic( TBasic tBasic ) {
|
||||
this.tBasic = tBasic;
|
||||
}
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
package com.docus.server.collection.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.docus.core.util.DateUtil;
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.infrastructure.core.exception.BaseException;
|
||||
import com.docus.server.collection.dto.BacklPushDto;
|
||||
import com.docus.server.collection.entity.CqcPushConfig;
|
||||
import com.docus.server.collection.entity.TBasic;
|
||||
import com.docus.server.collection.mapper.CqcPushConfigMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.axis.encoding.XMLType;
|
||||
import org.apache.cxf.endpoint.Client;
|
||||
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
||||
import org.apache.shiro.util.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.rpc.ParameterMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.axis.client.Call;
|
||||
import org.apache.axis.client.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chierhao
|
||||
* @description 退回消息推送监听
|
||||
* @date 2023-02-14 14:38
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
@Async
|
||||
public class CqcPushListenerUtil {
|
||||
|
||||
@Autowired
|
||||
private CqcPushConfigMapper cqcPushConfigMapper;
|
||||
|
||||
@Value("${docus.basic.pushconfig:}")
|
||||
private String pushConfigId;
|
||||
|
||||
@Value("${docus.basic.pushusername:}")
|
||||
private String userName;
|
||||
|
||||
@Value("${docus.basic.pushname:}")
|
||||
private String name;
|
||||
|
||||
@Value("${docus.basic.day:}")
|
||||
private String day;
|
||||
|
||||
/*
|
||||
* @description 质控退回推送
|
||||
* @author jiashi
|
||||
* @date 2023-07-13 15:20
|
||||
* @param event
|
||||
*/
|
||||
@Async
|
||||
@EventListener
|
||||
public void backPushListener(BackPushEventEntity event) {
|
||||
TBasic tBasic= event.getTBasic();
|
||||
String[] split = pushConfigId.split(",");
|
||||
List<Long> ids=new ArrayList<>();
|
||||
for(String str:split){
|
||||
long l = Long.parseLong(str);
|
||||
ids.add(l);
|
||||
}
|
||||
if(Func.isEmpty(ids)){
|
||||
log.info("推送配置id为空");
|
||||
return;
|
||||
}
|
||||
List<CqcPushConfig> configs = cqcPushConfigMapper.getCqcPushConfigByBusinessTypes(ids);
|
||||
if(Func.isEmpty(configs)){
|
||||
log.info("推送配置查询为空");
|
||||
return;
|
||||
}
|
||||
for(CqcPushConfig config:configs){
|
||||
//顺德人医解档推送
|
||||
liberationMethod(tBasic,config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 顺德人医解档webservice推送
|
||||
* @author jiashi
|
||||
* @date 2023-07-12 10:51
|
||||
* @param cqcPushConfig
|
||||
*/
|
||||
public void liberationMethod(TBasic tBasic, CqcPushConfig cqcPushConfig) {
|
||||
//解档推送消息
|
||||
if (Func.isNotEmpty(tBasic)) {
|
||||
String archiveType = "";
|
||||
if (cqcPushConfig.getBusinessType().equals("8")) {
|
||||
archiveType = "0";
|
||||
}
|
||||
if (cqcPushConfig.getBusinessType().equals("9")) {
|
||||
archiveType = "1";
|
||||
}
|
||||
if (cqcPushConfig.getBusinessType().equals("12")) {
|
||||
archiveType = "2";
|
||||
}
|
||||
//组装参数
|
||||
BacklPushDto dto = new BacklPushDto();
|
||||
dto.setPatientId(tBasic.getPatientId());
|
||||
dto.setInpatientNo(tBasic.getInpatientNo());
|
||||
dto.setAdmissTimes(tBasic.getAdmissTimes());
|
||||
dto.setJzh(tBasic.getInpatientNo() + "_" + tBasic.getAdmissTimes());
|
||||
dto.setName(tBasic.getName());
|
||||
dto.setDisDept(tBasic.getDisDept());
|
||||
dto.setDisDeptName(tBasic.getDisDeptName());
|
||||
dto.setApplyUserName(userName);
|
||||
dto.setApplyName(name);
|
||||
dto.setControlUserName(userName);
|
||||
dto.setControlName(name);
|
||||
dto.setAuditTime(DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME));
|
||||
dto.setDay(day);
|
||||
dto.setIsArchive(0);
|
||||
dto.setCollectIds(archiveType);
|
||||
|
||||
String wsParam = BackPushUtil.getXml(dto);
|
||||
//发送消息
|
||||
//请求地址
|
||||
String wsUrl = cqcPushConfig.getUrl();
|
||||
//命名空间
|
||||
String namespance = cqcPushConfig.getNamespace();
|
||||
// 推送方法名
|
||||
String wsMethod = cqcPushConfig.getMethod();
|
||||
//参数
|
||||
String parameterListStr = cqcPushConfig.getParameterList();
|
||||
parameterListStr = String.format(parameterListStr, JSON.toJSONString(wsParam));
|
||||
|
||||
List<Map<String, Object>> parameterList = new ArrayList<>();
|
||||
|
||||
parameterList = JSON.parseObject(parameterListStr, new TypeReference<List<Map<String, Object>>>() {
|
||||
});
|
||||
|
||||
List<Object> parameters = parameterList.stream().map(e -> e.get("parameter")).collect(Collectors.toList());
|
||||
log.info("推送入参: parameterList:{}", JSON.toJSONString(parameterList));
|
||||
|
||||
|
||||
//回调值
|
||||
String result = "";
|
||||
for (int i = 0; i < 3; i++) {
|
||||
try {
|
||||
Thread.sleep(i * 5 * 100);
|
||||
} catch (InterruptedException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
if (wsUrl.contains("?wsdl")) {
|
||||
result = requestFunctionWebServiceCXF(wsUrl, namespance, wsMethod, parameters);
|
||||
} else {
|
||||
result = requestFunctionWebService(wsUrl, namespance, wsMethod, parameterList);
|
||||
}
|
||||
log.info("得到的结果:" + result);
|
||||
if (result.contains("成功") || result.contains("success")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BaseException("病案基础信息为空,推送消息失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url wsdl文件地址
|
||||
* @param namespace 命名空间
|
||||
* @param method 方法名
|
||||
*/
|
||||
public String requestFunctionWebService(String url, String namespace, String method, List<Map<String,Object>> parameterList) {
|
||||
String result = null;
|
||||
try {
|
||||
Service service = new Service();
|
||||
Call call = (Call) service.createCall();
|
||||
call.setTargetEndpointAddress(url);
|
||||
call.setOperationName(new QName(namespace, method));
|
||||
for (Map<String,Object> paramMap:parameterList){
|
||||
call.addParameter((String) paramMap.get("parameterName"), XMLType.XSD_STRING, ParameterMode.IN);
|
||||
}
|
||||
List<Object> parameter = parameterList.stream().map(e -> e.get("parameter")).collect(Collectors.toList());
|
||||
Object[] opAddEntryArgs = parameter.toArray();
|
||||
call.setReturnType(XMLType.XSD_STRING);//设置返回类型
|
||||
result = (String) call.invoke(opAddEntryArgs);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result = e.getMessage();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public String requestFunctionWebServiceCXF(String url, String namespace, String method, List<Object> params) {
|
||||
String result;
|
||||
try {
|
||||
//创建动态客户端工厂 创建客户端
|
||||
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
|
||||
Client client = dcf.createClient(url);
|
||||
//命名空间和方法
|
||||
QName name = new QName(namespace, method);
|
||||
//调用,省中医ChasMessageServer方法特殊处理
|
||||
Object[] opAddEntryArgs;
|
||||
opAddEntryArgs = params.toArray();
|
||||
Object[] objects = client.invoke(name, opAddEntryArgs);
|
||||
result = objects[0].toString();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result = e.getMessage();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.docus.server.common.mapper;
|
||||
|
||||
import com.docus.server.common.entity.RemoteCallResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 远程调用过程信息表
|
||||
* @author wyb
|
||||
*
|
||||
*/
|
||||
public interface RemoteCallResultMapper {
|
||||
/**
|
||||
* 远程调用结果存储
|
||||
* @param remoteCallResult 远程调用结果
|
||||
* @return 保存结果
|
||||
*/
|
||||
int save(@Param("result") RemoteCallResult remoteCallResult);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.docus.server.common.mapper;
|
||||
|
||||
import com.docus.server.common.entity.SdryPacsPrintExcept;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顺德人医pacs接口获取base64报告出错的记录 mapper
|
||||
* @author wyb
|
||||
*/
|
||||
public interface SdryPacsPrintExceptMapper {
|
||||
int saveExcept(@Param("except") SdryPacsPrintExcept pacsPrintExcept);
|
||||
|
||||
SdryPacsPrintExcept getById(@Param("id") Long id);
|
||||
|
||||
int compensateSuccuss(@Param("id") Long id);
|
||||
|
||||
List<Long> getCompensateIds(@Param("beginDateTime") String beginDateTime);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.docus.server.common.service;
|
||||
|
||||
import com.docus.server.common.entity.RemoteCallResult;
|
||||
|
||||
/**
|
||||
* 远程调用存储服务业务接口
|
||||
* @author WYBDEV
|
||||
*/
|
||||
public interface RemoteCallResultService {
|
||||
/**
|
||||
* 远程调用结果存储
|
||||
* @param remoteCallResult 远程调用结果
|
||||
*/
|
||||
void save(RemoteCallResult remoteCallResult);
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.docus.server.common.service;
|
||||
|
||||
import com.docus.server.common.entity.SdryPacsPrintExcept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 顺德pacs打印出错补偿的服务
|
||||
* @author WYBDEV
|
||||
*/
|
||||
public interface SdryPacsPrintExceptService {
|
||||
|
||||
|
||||
int insert(SdryPacsPrintExcept pacsPrintExcept);
|
||||
|
||||
SdryPacsPrintExcept getById(Long id);
|
||||
|
||||
int compensateSuccuss(Long id);
|
||||
|
||||
List<Long> getCompensateIds(String beginDateTime);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.docus.server.common.service.impl;
|
||||
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.infrastructure.redis.service.IdService;
|
||||
import com.docus.server.common.entity.RemoteCallResult;
|
||||
import com.docus.server.common.mapper.RemoteCallResultMapper;
|
||||
import com.docus.server.common.service.RemoteCallResultService;
|
||||
import com.docus.server.common.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* 远程调用存储服务业务实现
|
||||
*
|
||||
* @author wyb
|
||||
*/
|
||||
@Service
|
||||
public class RemoteCallResultServiceImpl implements RemoteCallResultService {
|
||||
@Resource
|
||||
private IdService idService;
|
||||
@Resource
|
||||
private RemoteCallResultMapper remoteCallResultMapper;
|
||||
|
||||
private final static int SAVE_DISK_DATA_LENGTH = 1024;
|
||||
|
||||
private final static String REMOTE_CALL_SAVE_PATH = FileUtil.currentPath() + File.separator + "remote-call";
|
||||
|
||||
@Override
|
||||
public void save(RemoteCallResult remoteCallResult) {
|
||||
remoteCallResult.setRequestStorageType(0);
|
||||
remoteCallResult.setResponseStorageType(0);
|
||||
|
||||
Long id = remoteCallResult.getId() == null ? idService.getDateSeq() : remoteCallResult.getId();
|
||||
remoteCallResult.setId(id);
|
||||
String request = remoteCallResult.getRequest();
|
||||
String response = remoteCallResult.getResponse();
|
||||
if (Func.isNotBlank(request) && request.length() > SAVE_DISK_DATA_LENGTH) {
|
||||
String saveReqPath = REMOTE_CALL_SAVE_PATH + File.separator + id + "_request";
|
||||
FileUtil.saveStrData(response, new File(saveReqPath));
|
||||
remoteCallResult.setRequestStorageType(1);
|
||||
remoteCallResult.setRequest(saveReqPath);
|
||||
}
|
||||
if (Func.isNotBlank(response) && response.length() > SAVE_DISK_DATA_LENGTH) {
|
||||
String saveRespPath = REMOTE_CALL_SAVE_PATH + File.separator + id + "_response";
|
||||
FileUtil.saveStrData(response, new File(saveRespPath));
|
||||
remoteCallResult.setResponseStorageType(1);
|
||||
remoteCallResult.setResponse(saveRespPath);
|
||||
}
|
||||
remoteCallResultMapper.save(remoteCallResult);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.docus.server.common.service.impl;
|
||||
|
||||
import com.docus.infrastructure.redis.service.IdService;
|
||||
import com.docus.server.common.entity.SdryPacsPrintExcept;
|
||||
import com.docus.server.common.mapper.SdryPacsPrintExceptMapper;
|
||||
import com.docus.server.common.service.SdryPacsPrintExceptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 远程调用存储服务业务实现
|
||||
*
|
||||
* @author wyb
|
||||
*/
|
||||
@Service
|
||||
public class SdryPacsPrintExceptServiceImpl implements SdryPacsPrintExceptService {
|
||||
@Resource
|
||||
private IdService idService;
|
||||
@Resource
|
||||
private SdryPacsPrintExceptMapper sdryPacsPrintExceptMapper;
|
||||
|
||||
@Override
|
||||
public int insert(SdryPacsPrintExcept pacsPrintExcept) {
|
||||
Long id = pacsPrintExcept.getId();
|
||||
id = id == null ? idService.getDateSeq() : id;
|
||||
pacsPrintExcept.setId(id);
|
||||
return sdryPacsPrintExceptMapper.saveExcept(pacsPrintExcept);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdryPacsPrintExcept getById(Long id) {
|
||||
return sdryPacsPrintExceptMapper.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compensateSuccuss(Long id) {
|
||||
return sdryPacsPrintExceptMapper.compensateSuccuss(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getCompensateIds(String beginDateTime) {
|
||||
List<Long> ids= sdryPacsPrintExceptMapper.getCompensateIds(beginDateTime);
|
||||
if(Objects.isNull(ids)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.docus.server.report.api.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/6/25 14:18
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("顺德人医量表报告单查询结果")
|
||||
public class SdRyLiangBiaoReportVO {
|
||||
@ApiModelProperty("文件下载地址")
|
||||
private String fileUrl;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.docus.server.report.controller;
|
||||
|
||||
import com.docus.infrastructure.web.api.CommonResult;
|
||||
import com.docus.server.report.job.FetchPacsBase64Job;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "pacs获取base64异常相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/fetchPacsBase64Except")
|
||||
public class FetchPacsBase64ExceptController {
|
||||
@Resource
|
||||
private FetchPacsBase64Job fetchPacsBase64Job;
|
||||
|
||||
|
||||
@ApiOperation(value = "根据异常数据表的id补偿")
|
||||
@GetMapping("/compenstateById")
|
||||
public CommonResult<Object> compenstateById(@Param("id") Long exceptId) {
|
||||
fetchPacsBase64Job.compensateFetchBase64Report(exceptId);
|
||||
return CommonResult.success("完成");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.docus.server.report.mapper;
|
||||
|
||||
import com.docus.server.report.entity.DelayedMessages;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 延迟消息 mapper
|
||||
* @author wyb
|
||||
*/
|
||||
public interface DelayedMessagesMapper {
|
||||
|
||||
int delById(@Param("id") Long id);
|
||||
|
||||
int updateById(@Param("message") DelayedMessages message);
|
||||
|
||||
int insert(@Param("message") DelayedMessages message);
|
||||
|
||||
List<DelayedMessages> findExecutableMessages(@Param("condition") DelayedMessages condition,@Param("currentDateTime") String formatCurrentDateTime);
|
||||
|
||||
DelayedMessages findMessage(@Param("condition") DelayedMessages condition);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.docus.server.report.scheduler;
|
||||
|
||||
import com.docus.server.report.thread.VerifyNisReportHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/1/23 14:04
|
||||
*/
|
||||
|
||||
public class JobScheduler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JobScheduler.class);
|
||||
|
||||
public void init() throws Exception {
|
||||
VerifyNisReportHelper.getInstance().start();
|
||||
|
||||
logger.info(">>>>>>>>> init job admin success.");
|
||||
}
|
||||
|
||||
|
||||
public void destroy() throws Exception {
|
||||
VerifyNisReportHelper.getInstance().toStop();
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.docus.server.report.thread;
|
||||
|
||||
import com.docus.core.util.DateUtil;
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.server.report.config.JobAdminConfig;
|
||||
import com.docus.server.report.consts.ReportDownloadWait;
|
||||
import com.docus.server.report.entity.DelayedMessages;
|
||||
import com.docus.server.report.listener.NisReportDownloadWaitHandler;
|
||||
import com.docus.server.report.mapper.DelayedMessagesMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/1/23 10:59
|
||||
*/
|
||||
|
||||
public class VerifyNisReportHelper {
|
||||
private static Logger logger = LoggerFactory.getLogger(VerifyNisReportHelper.class);
|
||||
private static VerifyNisReportHelper instance = new VerifyNisReportHelper();
|
||||
|
||||
public static VerifyNisReportHelper getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Thread nisVerifyThread;
|
||||
private volatile boolean toStop = false;
|
||||
|
||||
public void start() {
|
||||
nisVerifyThread = new Thread(() -> {
|
||||
final String messageType = ReportDownloadWait.NIS_REPORT_DOWNLOAD_WAIT_DELAY_MSG_TYPE;
|
||||
DelayedMessages condition = new DelayedMessages();
|
||||
condition.setMessageType(messageType);
|
||||
DelayedMessagesMapper delayedMessagesMapper = JobAdminConfig.getJobAdminConfig().getDelayedMessagesMapper();
|
||||
NisReportDownloadWaitHandler handler = JobAdminConfig.getJobAdminConfig().getNisReportDownloadWaitHandler();
|
||||
while (!toStop) {
|
||||
try {
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
String formatCurrentDateTime = Func.formatDateTime(currentDateTime);
|
||||
// 数据量暂时不大,使用
|
||||
List<DelayedMessages> delayedMessages = delayedMessagesMapper.findExecutableMessages(condition, formatCurrentDateTime);
|
||||
if (Func.isNotEmpty(delayedMessages)) {
|
||||
for (DelayedMessages message : delayedMessages) {
|
||||
try {
|
||||
String patientId = message.getMessage();
|
||||
handler.verify(patientId);
|
||||
delayedMessagesMapper.delById(message.getId());
|
||||
} catch (Exception ex) {
|
||||
if (!toStop) {
|
||||
logger.error(">>>>>>>>>>> verify nis report thread error:" + ex.getMessage() + " ,delayMessage:" + Func.toJson(message), ex);
|
||||
int retries = message.getRetries() + 1;
|
||||
Integer delaySeconds = message.getDelaySeconds();
|
||||
LocalDateTime nexExecuteLocalDateTime = LocalDateTime.now().plusSeconds(delaySeconds);
|
||||
String dateTime = Func.formatDateTime(nexExecuteLocalDateTime);
|
||||
Date nexExecuteTime = Func.parseDate(dateTime, DateUtil.PATTERN_DATETIME);
|
||||
|
||||
message.setRetries(retries);
|
||||
message.setErrorMessage(ex.getMessage());
|
||||
message.setNextExecutionTime(nexExecuteTime);
|
||||
delayedMessagesMapper.updateById(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (Exception ex) {
|
||||
if (!toStop) {
|
||||
logger.error(">>>>>>>>>>> verify nis report thread error:" + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
logger.info(">>>>>>>>>>> verify nis report thread stop");
|
||||
});
|
||||
nisVerifyThread.setDaemon(true);
|
||||
nisVerifyThread.setName("verifyNisReportHelper");
|
||||
nisVerifyThread.start();
|
||||
}
|
||||
|
||||
public void toStop() {
|
||||
toStop = false;
|
||||
nisVerifyThread.interrupt();
|
||||
try {
|
||||
nisVerifyThread.join();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?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.collection.mapper.CqcPushConfigMapper">
|
||||
|
||||
<select id="getCqcPushConfigByBusinessTypes" resultType="com.docus.server.collection.entity.CqcPushConfig">
|
||||
SELECT
|
||||
id,
|
||||
business_type,
|
||||
protocol_type,
|
||||
namespace,
|
||||
url,
|
||||
method,
|
||||
effective,
|
||||
title,
|
||||
create_user,
|
||||
create_time,
|
||||
update_user,
|
||||
update_time,
|
||||
parameter_list
|
||||
FROM
|
||||
cqc_push_config
|
||||
WHERE id in
|
||||
<foreach collection="ids" open="(" close=")" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND effective=1
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,56 @@
|
||||
<?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.DelayedMessagesMapper">
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
`docus_medicalrecord`.`delayed_messages` (`id`, `message_type`, `keyword`, `message`, `next_execution_time`, `delay_seconds`, `create_time`, `retries`, `error_message`)
|
||||
VALUES (#{message.id}, #{message.messageType}, #{message.keyword}, #{message.message}, #{message.nextExecutionTime}, #{message.delaySeconds}, #{message.createTime}, 0, #{message.errorMessage})
|
||||
</insert>
|
||||
<update id="updateById">
|
||||
UPDATE `docus_medicalrecord`.`delayed_messages`
|
||||
SET
|
||||
`message_type` = #{message.messageType},
|
||||
`keyword` = #{message.keyword},
|
||||
`message` = #{message.message},
|
||||
`next_execution_time` = #{message.nextExecutionTime},
|
||||
`delay_seconds` = #{message.delaySeconds},
|
||||
`create_time` = #{message.createTime},
|
||||
`retries` = #{message.retries},
|
||||
`error_message` = #{message.errorMessage}
|
||||
WHERE `id` = #{message.id}
|
||||
</update>
|
||||
|
||||
<delete id="delById">
|
||||
DELETE FROM `docus_medicalrecord`.`delayed_messages` WHERE `id`=#{id}
|
||||
</delete>
|
||||
<select id="findExecutableMessages" resultType="com.docus.server.report.entity.DelayedMessages">
|
||||
select
|
||||
*
|
||||
from
|
||||
`docus_medicalrecord`.`delayed_messages`
|
||||
where
|
||||
`next_execution_time` <![CDATA[<=]]> #{currentDateTime}
|
||||
<if test="condition.keyword != null and condition.keyword != '' ">
|
||||
and `keyword` = #{condition.keyword}
|
||||
</if>
|
||||
<if test="condition.messageType != null and condition.messageType != '' ">
|
||||
and `message_type` = #{condition.messageType}
|
||||
</if>
|
||||
</select>
|
||||
<select id="findMessage" resultType="com.docus.server.report.entity.DelayedMessages">
|
||||
select
|
||||
*
|
||||
from
|
||||
`docus_medicalrecord`.`delayed_messages`
|
||||
where
|
||||
1=1
|
||||
<if test="condition.keyword != null and condition.keyword != '' ">
|
||||
and `keyword` = #{condition.keyword}
|
||||
</if>
|
||||
<if test="condition.messageType != null and condition.messageType != '' ">
|
||||
and `message_type` = #{condition.messageType}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,11 @@
|
||||
<?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.common.mapper.RemoteCallResultMapper">
|
||||
|
||||
<insert id="save">
|
||||
INSERT INTO `docus_archivefile`.`remote_call_result`(`id`, `keyword`, `url`, `header`, `request`, `response`, `remark`, `description`, `request_storage_type`, `response_storage_type`, `call_status`, `call_start_time`, `call_end_time`)
|
||||
VALUES (#{result.id}, #{result.keyword}, #{result.url}, #{result.header}, #{result.request}, #{result.response}, #{result.remark}, #{result.description}, #{result.requestStorageType}, #{result.responseStorageType}, #{result.callStatus}, #{result.callStartTime}, #{result.callEndTime})
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,38 @@
|
||||
<?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.common.mapper.SdryPacsPrintExceptMapper">
|
||||
|
||||
|
||||
<insert id="saveExcept">
|
||||
INSERT INTO `docus_archivefile`.`sdry_pacs_print_except`(`id`, `inpatient_no`, `admiss_times`, `jzh`, `report_message_path`, `state`, `create_time`, `service_flag`,`exam_report_sn`)
|
||||
VALUES (#{except.id}, #{except.inpatientNo}, #{except.admissTimes}, #{except.jzh}, #{except.reportMessagePath}, 0, #{except.createTime}, #{except.serviceFlag},#{except.examReportSn})
|
||||
</insert>
|
||||
<update id="compensateSuccuss">
|
||||
update
|
||||
`docus_archivefile`.`sdry_pacs_print_except`
|
||||
set `state`=1
|
||||
where id=#{id}
|
||||
</update>
|
||||
<select id="getById" resultType="com.docus.server.common.entity.SdryPacsPrintExcept">
|
||||
select
|
||||
`id`,
|
||||
`inpatient_no`,
|
||||
`admiss_times`,
|
||||
`jzh`,
|
||||
`report_message_path`,
|
||||
`state`,
|
||||
`create_time`,
|
||||
`service_flag`
|
||||
from `docus_archivefile`.`sdry_pacs_print_except`
|
||||
where id=#{id}
|
||||
</select>
|
||||
<select id="getCompensateIds" resultType="java.lang.Long">
|
||||
select
|
||||
`id`
|
||||
from
|
||||
`docus_archivefile`.`sdry_pacs_print_except`
|
||||
where `state`=0 and `create_time` > #{beginDateTime}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue