初始化
commit
1fb56e5500
@ -0,0 +1,16 @@
|
||||
package com.shibofu.spring;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:40
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class MainApplication {
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(MainApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.shibofu.spring.config;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:27
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.shibofu.spring.db1.dao", sqlSessionTemplateRef = "db1SqlSessionTemplate")
|
||||
public class DataSource1Config {
|
||||
/**
|
||||
* 生成数据源. @Primary 注解声明为默认数据源
|
||||
*/
|
||||
@Bean(name = "db1DataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.hikari.db1")
|
||||
@Primary
|
||||
public DataSource testDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 SqlSessionFactory
|
||||
*/
|
||||
@Bean(name = "db1SqlSessionFactory")
|
||||
@Primary
|
||||
public SqlSessionFactory testSqlSessionFactory(@Qualifier("db1DataSource") DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/db1/*.xml"));
|
||||
return bean.getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置事务管理
|
||||
*/
|
||||
@Bean(name = "db1TransactionManager")
|
||||
@Primary
|
||||
public DataSourceTransactionManager testTransactionManager(@Qualifier("db1DataSource") DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "db1SqlSessionTemplate")
|
||||
@Primary
|
||||
public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.shibofu.spring.config;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.SqlSessionTemplate;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:30
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.shibofu.spring.db2.dao", sqlSessionTemplateRef = "db2SqlSessionTemplate")
|
||||
public class DataSource2Config {
|
||||
|
||||
@Bean(name = "db2DataSource")
|
||||
@ConfigurationProperties(prefix = "spring.datasource.hikari.db2")
|
||||
public DataSource testDataSource() {
|
||||
return DataSourceBuilder.create().build();
|
||||
}
|
||||
|
||||
@Bean(name = "db2SqlSessionFactory")
|
||||
public SqlSessionFactory testSqlSessionFactory(@Qualifier("db2DataSource") DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/db2/*.xml"));
|
||||
return bean.getObject();
|
||||
}
|
||||
|
||||
@Bean(name = "db2TransactionManager")
|
||||
public DataSourceTransactionManager testTransactionManager(@Qualifier("db2DataSource") DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
|
||||
@Bean(name = "db2SqlSessionTemplate")
|
||||
public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
|
||||
return new SqlSessionTemplate(sqlSessionFactory);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.shibofu.spring.controller;
|
||||
|
||||
import com.shibofu.spring.db1.service.PacsPollingService;
|
||||
import com.shibofu.spring.db2.service.MoneyService;
|
||||
import com.shibofu.spring.util.Msg;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:38
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/makeUp")
|
||||
public class MoneyController {
|
||||
@Autowired
|
||||
private PacsPollingService pacsPollingService;
|
||||
|
||||
@GetMapping("/makeUpByPacsAndTime")
|
||||
public String makeUpByNeed() {
|
||||
pacsPollingService.PacsEveryDayPolling();
|
||||
return "采集完成";
|
||||
}
|
||||
|
||||
@GetMapping("/makeUpPacsByMasterId")
|
||||
public Msg makeUpPacsByMasterId(String masterId) {
|
||||
return pacsPollingService.makeUpPacsByMasterId(masterId);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.shibofu.spring.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:38
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.shibofu.spring.db1.dao;
|
||||
|
||||
import com.shibofu.spring.dto.ArchiveDetailDto;
|
||||
import com.shibofu.spring.vo.ArchiveDetailVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @InterfaceName ArchiveDetailDao
|
||||
* @Description 操作文件表接口
|
||||
* @Author linjj
|
||||
* @Date 2024/1/19 9:01
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArchiveDetailDao {
|
||||
|
||||
boolean addArchiveDetail(@Param("list") List<ArchiveDetailDto> list);
|
||||
|
||||
List<ArchiveDetailVo> getSubAssort(String subAssort);
|
||||
|
||||
int delSubAssort(String subAssort);
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.shibofu.spring.db1.dao;
|
||||
|
||||
import com.shibofu.spring.vo.ArchiveMasterVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @InterfaceName ArchiveMasterDao
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArchiveMasterDao {
|
||||
//查询24小时内出院病历
|
||||
List<ArchiveMasterVo> PollingPacs();
|
||||
|
||||
|
||||
//查询24小时内出院病历
|
||||
List<ArchiveMasterVo> PacsEveryWeekPolling();
|
||||
|
||||
|
||||
List<ArchiveMasterVo> makeUpPacsByMasterId(String masterId);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.shibofu.spring.db1.service;
|
||||
|
||||
import com.shibofu.spring.util.Msg;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @InterfaceName PollingService
|
||||
* @Description pacs轮询接口
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:26
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface PacsPollingService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定时查询每天出院患者
|
||||
* @author linjj
|
||||
* @date: 2024/1/18 9:29
|
||||
*/
|
||||
Msg PacsEveryDayPolling() ;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 定时查询每星期出院患者
|
||||
* @author linjj
|
||||
* @date: 2024/1/18 9:29
|
||||
*/
|
||||
Msg PacsEveryWeekPolling() ;
|
||||
|
||||
Msg makeUpPacsByMasterId(String masterId);
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
package com.shibofu.spring.db1.serviceImpl;
|
||||
|
||||
import com.shibofu.spring.db1.dao.ArchiveDetailDao;
|
||||
import com.shibofu.spring.db1.dao.ArchiveMasterDao;
|
||||
import com.shibofu.spring.db1.service.PacsPollingService;
|
||||
import com.shibofu.spring.db2.dao.PacsDao;
|
||||
import com.shibofu.spring.dto.ArchiveDetailDto;
|
||||
import com.shibofu.spring.dto.ArchiveMasterDto;
|
||||
import com.shibofu.spring.util.*;
|
||||
import com.shibofu.spring.vo.ArchiveDetailVo;
|
||||
import com.shibofu.spring.vo.ArchiveMasterVo;
|
||||
|
||||
import com.shibofu.spring.vo.PacsVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName PollingServiceImpl
|
||||
* @Description pacs轮询实现类
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:26
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PacsPollingServiceImpl implements PacsPollingService {
|
||||
@Value("${savePath}")
|
||||
private String savePath;
|
||||
|
||||
@Autowired
|
||||
private ArchiveDetailDao archiveDetailDao;
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(PacsPollingServiceImpl.class);
|
||||
@Autowired
|
||||
private ArchiveMasterDao archiveMasterDao;
|
||||
@Autowired
|
||||
private PacsDao pacsDao;
|
||||
|
||||
@Override
|
||||
public Msg PacsEveryDayPolling() {
|
||||
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.PollingPacs();
|
||||
if (CollectionUtils.isEmpty(archiveMasterVos)) {
|
||||
return Msg.fail("无需采集数据");
|
||||
}
|
||||
// 创建 JNI 实例
|
||||
PacsAutoPrintPDF.INSTANCE.setServerInfo("10.36.116.100", 204);
|
||||
for (ArchiveMasterVo list : archiveMasterVos) {
|
||||
logger.info("本次需要采集病历数量:" + list.getVisitId());
|
||||
ArchiveMasterDto dto = new ArchiveMasterDto();
|
||||
BeanUtils.copyProperties(list, dto);
|
||||
logger.info("该住院号时间内无数据" + dto.getInpNo() + "住院次数为:" + dto.getVisitId());
|
||||
//根据入院前六小时出院后六小时住院号查询要下载pdf的路径
|
||||
List<PacsVo> vo = pacsDao.getVo(dto);
|
||||
if (CollectionUtils.isEmpty(vo)) {
|
||||
logger.info("该住院号时间内无数据" + list.getInpNo() + "住院次数为:" + list.getVisitId());
|
||||
continue;
|
||||
}
|
||||
//插入文件表数据集合
|
||||
List<ArchiveDetailDto> ArchiveDetailList = new ArrayList<>();
|
||||
//需要同步的数据
|
||||
for (PacsVo pacsList : vo) {
|
||||
//使用yyyyMMddHHmmssSSS格式作为文件名
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
String newDate = format.format(date);
|
||||
//组织路径
|
||||
String filePathdir = savePath + "\\" + list.getInpNo() + "\\" + list.getVisitId();
|
||||
File file = new File(filePathdir);
|
||||
//判断文件夹是否存在不存在创建文件夹
|
||||
logger.info("创建文件的路径:" + file.getAbsolutePath());
|
||||
if (!file.exists()) {
|
||||
logger.info("尝试创建文件:" + file.getAbsolutePath());
|
||||
file.mkdirs();
|
||||
}
|
||||
String filePath = filePathdir + "/" + newDate + ".pdf";
|
||||
logger.info("-----------------文件id:" + pacsList.getAccessionnumber() + ",路径:" + filePath);
|
||||
// 调用 GetPDF 函数
|
||||
boolean result = PacsAutoPrintPDF.INSTANCE.GetPDF(pacsList.getAccessionnumber(), filePath);
|
||||
//成功存在文件表中,不成功输出到日志中
|
||||
if (result) {
|
||||
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
|
||||
archiveDetailDto.setMasterId(dto.getId());
|
||||
archiveDetailDto.setUploadDateTime(new Date());
|
||||
archiveDetailDto.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
|
||||
archiveDetailDto.setSource("pacs");
|
||||
archiveDetailDto.setFlag("0");
|
||||
archiveDetailDto.setTitle(pacsList.getExamItem());
|
||||
archiveDetailDto.setPdfPath(filePath);
|
||||
archiveDetailDto.setSubAssort(pacsList.getAccessionnumber());
|
||||
ArchiveDetailList.add(archiveDetailDto);
|
||||
//记录保存文件表
|
||||
} else {
|
||||
logger.info("-----------------住院号:" + list.getInpNo() + ",文件名:" + pacsList.getExamItem() + "解析失败");
|
||||
}
|
||||
}
|
||||
//插入文件表
|
||||
boolean b = archiveDetailDao.addArchiveDetail(ArchiveDetailList);
|
||||
if (b) {
|
||||
ArchiveDetailList.clear();
|
||||
logger.info("住院号:" + list.getInpNo() + "住院次数为:" + list.getVisitId() + "采集完成");
|
||||
}
|
||||
}
|
||||
return Msg.success("采集完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Msg PacsEveryWeekPolling() {
|
||||
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.PacsEveryWeekPolling();
|
||||
if (CollectionUtils.isEmpty(archiveMasterVos)) {
|
||||
return Msg.fail("无需采集数据");
|
||||
}
|
||||
// 创建 JNI 实例
|
||||
PacsAutoPrintPDF.INSTANCE.setServerInfo("10.36.116.100", 204);
|
||||
for (ArchiveMasterVo list : archiveMasterVos) {
|
||||
logger.info(list.getVisitId());
|
||||
ArchiveMasterDto dto = new ArchiveMasterDto();
|
||||
BeanUtils.copyProperties(list, dto);
|
||||
logger.info("该住院号时间内无数据" + dto.getInpNo() + "住院次数为:" + dto.getVisitId());
|
||||
//根据入院前六小时出院后六小时住院号查询要下载pdf的路径
|
||||
List<PacsVo> vo = pacsDao.getVo(dto);
|
||||
if (CollectionUtils.isEmpty(vo)) {
|
||||
logger.info("该住院号时间内无数据" + list.getInpNo() + "住院次数为:" + list.getVisitId());
|
||||
continue;
|
||||
}
|
||||
//插入文件表数据集合
|
||||
List<ArchiveDetailDto> ArchiveDetailList = new ArrayList<>();
|
||||
//需要同步的数据
|
||||
for (PacsVo pacsList : vo) {
|
||||
//查询文件是否存在,如果存在先删除后新增
|
||||
List<ArchiveDetailVo> subAssort = archiveDetailDao.getSubAssort(pacsList.getAccessionnumber());
|
||||
if (subAssort.size() > 0) {
|
||||
deleteFliepath(subAssort);
|
||||
}
|
||||
//使用yyyyMMddHHmmssSSS格式作为文件名
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
String newDate = format.format(date);
|
||||
//组织路径
|
||||
String filePathdir = savePath + "\\" + list.getInpNo() + "\\" + list.getVisitId();
|
||||
File file = new File(filePathdir);
|
||||
//判断文件夹是否存在不存在创建文件夹
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
String filePath = filePathdir + "/" + newDate + ".pdf";
|
||||
logger.info("-----------------文件id:" + pacsList.getAccessionnumber() + ",路径:" + filePath);
|
||||
// 调用 GetPDF 函数
|
||||
boolean result = PacsAutoPrintPDF.INSTANCE.GetPDF(pacsList.getAccessionnumber(), filePath);
|
||||
//成功存在文件表中,不成功输出到日志中
|
||||
if (result) {
|
||||
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
|
||||
archiveDetailDto.setMasterId(dto.getId());
|
||||
archiveDetailDto.setUploadDateTime(new Date());
|
||||
archiveDetailDto.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
|
||||
archiveDetailDto.setSource("pacs");
|
||||
archiveDetailDto.setFlag("0");
|
||||
archiveDetailDto.setTitle(pacsList.getExamItem());
|
||||
archiveDetailDto.setPdfPath(filePath);
|
||||
archiveDetailDto.setSubAssort(pacsList.getAccessionnumber());
|
||||
ArchiveDetailList.add(archiveDetailDto);
|
||||
//记录保存文件表
|
||||
} else {
|
||||
logger.info("-----------------住院号:" + list.getInpNo() + ",文件名:" + pacsList.getExamItem() + "解析失败");
|
||||
}
|
||||
}
|
||||
//插入文件表
|
||||
boolean b = archiveDetailDao.addArchiveDetail(ArchiveDetailList);
|
||||
if (b) {
|
||||
ArchiveDetailList.clear();
|
||||
logger.info("住院号:" + list.getInpNo() + "住院次数为:" + list.getVisitId() + "采集完成");
|
||||
}
|
||||
}
|
||||
return Msg.success("采集完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Msg makeUpPacsByMasterId(String masterId) {
|
||||
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.makeUpPacsByMasterId(masterId);
|
||||
if (CollectionUtils.isEmpty(archiveMasterVos)) {
|
||||
return Msg.fail("无需采集数据");
|
||||
}
|
||||
// 创建 JNI 实例
|
||||
PacsAutoPrintPDF.INSTANCE.setServerInfo("10.36.116.100", 204);
|
||||
for (ArchiveMasterVo list : archiveMasterVos) {
|
||||
logger.info("本次需要采集病历数量:" + list.getVisitId());
|
||||
ArchiveMasterDto dto = new ArchiveMasterDto();
|
||||
BeanUtils.copyProperties(list, dto);
|
||||
logger.info("该住院号时间内无数据" + dto.getInpNo() + "住院次数为:" + dto.getVisitId());
|
||||
//根据入院前六小时出院后六小时住院号查询要下载pdf的路径
|
||||
List<PacsVo> vo = pacsDao.getVo(dto);
|
||||
if (CollectionUtils.isEmpty(vo)) {
|
||||
logger.info("该住院号时间内无数据" + list.getInpNo() + "住院次数为:" + list.getVisitId());
|
||||
continue;
|
||||
}
|
||||
//插入文件表数据集合
|
||||
List<ArchiveDetailDto> ArchiveDetailList = new ArrayList<>();
|
||||
//需要同步的数据
|
||||
for (PacsVo pacsList : vo) {
|
||||
//使用yyyyMMddHHmmssSSS格式作为文件名
|
||||
Date date = new Date();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
String newDate = format.format(date);
|
||||
//组织路径
|
||||
String filePathdir = savePath + "\\" + list.getInpNo() + "\\" + list.getVisitId();
|
||||
File file = new File(filePathdir);
|
||||
//判断文件夹是否存在不存在创建文件夹
|
||||
logger.info("创建文件的路径:" + file.getAbsolutePath());
|
||||
if (!file.exists()) {
|
||||
logger.info("尝试创建文件:" + file.getAbsolutePath());
|
||||
file.mkdirs();
|
||||
}
|
||||
String filePath = filePathdir + "/" + newDate + ".pdf";
|
||||
logger.info("-----------------文件id:" + pacsList.getAccessionnumber() + ",路径:" + filePath);
|
||||
// 调用 GetPDF 函数
|
||||
boolean result = PacsAutoPrintPDF.INSTANCE.GetPDF(pacsList.getAccessionnumber(), filePath);
|
||||
//成功存在文件表中,不成功输出到日志中
|
||||
if (result) {
|
||||
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
|
||||
archiveDetailDto.setMasterId(dto.getId());
|
||||
archiveDetailDto.setUploadDateTime(new Date());
|
||||
archiveDetailDto.setAssortId("EABEEB5D628449A7930F4C0A9953A754");
|
||||
archiveDetailDto.setSource("pacs");
|
||||
archiveDetailDto.setFlag("0");
|
||||
archiveDetailDto.setTitle(pacsList.getExamItem());
|
||||
archiveDetailDto.setPdfPath(filePath);
|
||||
archiveDetailDto.setSubAssort(pacsList.getAccessionnumber());
|
||||
ArchiveDetailList.add(archiveDetailDto);
|
||||
//记录保存文件表
|
||||
} else {
|
||||
logger.info("-----------------住院号:" + list.getInpNo() + ",文件名:" + pacsList.getExamItem() + "解析失败");
|
||||
}
|
||||
}
|
||||
//插入文件表
|
||||
boolean b = archiveDetailDao.addArchiveDetail(ArchiveDetailList);
|
||||
if (b) {
|
||||
ArchiveDetailList.clear();
|
||||
logger.info("住院号:" + list.getInpNo() + "住院次数为:" + list.getVisitId() + "采集完成");
|
||||
}
|
||||
}
|
||||
return Msg.success("采集完成");
|
||||
}
|
||||
|
||||
private void deleteFliepath(List<ArchiveDetailVo> listPath) {
|
||||
for (ArchiveDetailVo list : listPath) {
|
||||
archiveDetailDao.delSubAssort(list.getId());
|
||||
File file = new File(list.getPdfPath());
|
||||
try {
|
||||
file.delete(); // 删除照片
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.shibofu.spring.db2.dao;
|
||||
|
||||
import com.shibofu.spring.dto.ArchiveMasterDto;
|
||||
import com.shibofu.spring.vo.PacsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @InterfaceName PacsDao
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 15:35
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface PacsDao {
|
||||
|
||||
List<PacsVo> getVo(ArchiveMasterDto archiveMasterDto);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.shibofu.spring.db2.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author potter.fu
|
||||
* @date 2018-12-07 15:34
|
||||
*/
|
||||
@Service
|
||||
public class MoneyService {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.shibofu.spring.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName ArchiveDetailDto
|
||||
* @Description 保存文件表记录dto
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 17:29
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ArchiveDetailDto {
|
||||
//文件id
|
||||
private String id;
|
||||
//文件路径
|
||||
private String pdfPath;
|
||||
//病案id
|
||||
private String masterId;
|
||||
//生成时间
|
||||
private Date uploadDateTime;
|
||||
//分段id
|
||||
private String assortId;
|
||||
//来源
|
||||
private String source;
|
||||
//来源id
|
||||
private String subAssort;
|
||||
//文件名
|
||||
private String title;
|
||||
private String flag;
|
||||
private String sys;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.shibofu.spring.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName ArchiveMasterVo
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:33
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ArchiveMasterDto {
|
||||
//病案id
|
||||
private String id;
|
||||
//患者姓名
|
||||
private String name;
|
||||
//住院次数
|
||||
private String visitId;
|
||||
//住院号
|
||||
private String inpNo;
|
||||
//入院时间
|
||||
private String admissionDateTime;
|
||||
//出院时间
|
||||
private String dischargeDateTime;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.shibofu.spring.quartz;
|
||||
|
||||
|
||||
|
||||
import com.shibofu.spring.db1.service.PacsPollingService;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @description: pacs定时任务采集
|
||||
* @author linjj
|
||||
* @date: 2024/1/18 9:22
|
||||
*/
|
||||
public class PacsQuartz extends QuartzJobBean {
|
||||
|
||||
@Resource
|
||||
private PacsPollingService pacsPollingService;
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext jobExecutionContext) {
|
||||
//每天轮询查询昨天数据进来采集
|
||||
pacsPollingService.PacsEveryDayPolling();
|
||||
//每天轮询查询一周内数据进来采集
|
||||
pacsPollingService.PacsEveryWeekPolling();
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.shibofu.spring.quartz;
|
||||
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @ClassName QuartzConfig
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2023/8/14 15:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Configuration
|
||||
public class QuartzConfig {
|
||||
|
||||
@Value("${quartzTime}")
|
||||
private String quartzTime;
|
||||
|
||||
@Bean
|
||||
public JobDetail teatQuartzDetail() {
|
||||
|
||||
return JobBuilder.newJob(PacsQuartz.class).withIdentity("PacsQuartz").storeDurably().build();
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Trigger testQuartzTrigger() {
|
||||
|
||||
return TriggerBuilder.newTrigger().forJob(teatQuartzDetail())
|
||||
|
||||
.withIdentity("PacsQuartz")
|
||||
.withSchedule(CronScheduleBuilder.cronSchedule(quartzTime))
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.shibofu.spring.text;
|
||||
|
||||
import com.shibofu.spring.MainApplication;
|
||||
import com.shibofu.spring.db1.service.PacsPollingService;
|
||||
import com.shibofu.spring.db1.serviceImpl.PacsPollingServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName test
|
||||
* @Description 测试类
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:54
|
||||
* @Version 1.0
|
||||
*/
|
||||
@SpringBootTest(classes = MainApplication.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
@Slf4j
|
||||
public class test {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(test.class);
|
||||
@Autowired
|
||||
private PacsPollingService pacsPollingService;
|
||||
|
||||
@Test
|
||||
public void testDemo() {
|
||||
// String filePath = "D:\\脐血库1期图像\\1.jpg";
|
||||
// File file = new File(filePath);
|
||||
// file.delete();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.shibofu.spring.util;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 自定义的异常类
|
||||
* @author: ChenJ
|
||||
* @date: 2022/5/9 17:29
|
||||
* @param:
|
||||
* @return:
|
||||
**/
|
||||
public class BusinessException extends Exception {
|
||||
/**
|
||||
* 枚举类型,内含状态码code和信息msg
|
||||
*/
|
||||
private final ExceptionCode exceptionCode;
|
||||
|
||||
public ExceptionCode getExceptionCode() {
|
||||
return exceptionCode;
|
||||
}
|
||||
|
||||
public BusinessException(ExceptionCode exceptionCode) {
|
||||
super(exceptionCode.getMessage());
|
||||
this.exceptionCode = exceptionCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.shibofu.spring.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 这是一个给fastJSON/jackson准备的一个对象
|
||||
*/
|
||||
public class JsonResult implements Serializable {
|
||||
private Map<String, Object> dataMap = new HashMap<>(3);
|
||||
|
||||
public JsonResult() {
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return dataMap.get("code").toString();
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.dataMap.put("code", code);
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return dataMap.get("msg").toString();
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.dataMap.put("msg", msg);
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return dataMap.get("data");
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.dataMap.put("data", data);
|
||||
}
|
||||
|
||||
public Map<String, Object> getDataMap() {
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public void setDataMap(Map<String, Object> dataMap) {
|
||||
this.dataMap = dataMap;
|
||||
}
|
||||
|
||||
public void put(String name, Object value) {
|
||||
this.dataMap.put(name, value);
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.shibofu.spring.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>Title:Msg </p>
|
||||
* <p>Description:common return class </p>
|
||||
* <p>Company: </p>
|
||||
* @author hu
|
||||
* @date
|
||||
*/
|
||||
public class Msg {
|
||||
//state:100-success 200-fail
|
||||
private int code;
|
||||
//提示信息
|
||||
private String msg;
|
||||
//用户要返回给浏览器的数据
|
||||
private Map<String,Object> extend=new HashMap<String,Object>();
|
||||
|
||||
|
||||
|
||||
public static Msg fail(String msg){
|
||||
Msg result=new Msg();
|
||||
result.setCode(100);
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static Msg success(String msg){
|
||||
Msg result=new Msg();
|
||||
result.setCode(200);
|
||||
result.setMsg(msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Msg add(String key, Object value){
|
||||
this.getExtend().put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Map<String, Object> getExtend() {
|
||||
return extend;
|
||||
}
|
||||
|
||||
public void setExtend(Map<String, Object> extend) {
|
||||
this.extend = extend;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.shibofu.spring.util;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.win32.StdCallLibrary;
|
||||
|
||||
public interface PacsAutoPrintPDF extends StdCallLibrary {
|
||||
PacsAutoPrintPDF INSTANCE = (PacsAutoPrintPDF) Native.loadLibrary(
|
||||
(Platform.isWindows() ? "PacsAutoPrintPDF" : "c"),
|
||||
PacsAutoPrintPDF.class);
|
||||
|
||||
boolean GetPDF(String accessionNumber, String filename);
|
||||
void setServerInfo(String host, int port);
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.shibofu.spring.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName Archive_detail
|
||||
* @Author linjj
|
||||
* @Date 2024/3/10 20:59
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ArchiveDetailVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String pdfPath;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.shibofu.spring.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* @ClassName ArchiveMasterVo
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 9:33
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class ArchiveMasterVo {
|
||||
|
||||
//病案id
|
||||
private String id;
|
||||
//患者姓名
|
||||
private String name;
|
||||
//住院次数
|
||||
private String visitId;
|
||||
//住院号
|
||||
private String inpNo;
|
||||
//入院时间
|
||||
private String admissionDateTime;
|
||||
//出院时间
|
||||
private String dischargeDateTime;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.shibofu.spring.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName PacsVo
|
||||
* @Description pacs视图返回
|
||||
* @Author linjj
|
||||
* @Date 2024/1/18 15:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PacsVo {
|
||||
//文件唯一标识
|
||||
private String accessionnumber;
|
||||
//文件名
|
||||
private String ExamItem;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
server.port=3391
|
||||
#spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=gm_record
|
||||
#spring.datasource.hikari.db1.username=sa
|
||||
#spring.datasource.hikari.db1.password=admin123
|
||||
#spring.datasource.hikari.db1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
#spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=gm_record
|
||||
#spring.datasource.hikari.db2.username=sa
|
||||
#spring.datasource.hikari.db2.password=admin123
|
||||
#spring.datasource.hikari.db2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
|
||||
|
||||
|
||||
spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://10.36.116.108:1433;DatabaseName=emr_record
|
||||
spring.datasource.hikari.db1.username=sa
|
||||
spring.datasource.hikari.db1.password=xjgs+docus911
|
||||
spring.datasource.hikari.db1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://10.36.116.100:1433;DatabaseName=pacsdb
|
||||
spring.datasource.hikari.db2.username=AP
|
||||
spring.datasource.hikari.db2.password=AP
|
||||
spring.datasource.hikari.db2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
#文件保存路径
|
||||
savePath: F:\\jiashi\\reload
|
||||
#定时补偿任务时间
|
||||
quartzTime: 0 0 1 * * ?
|
||||
#quartzTime: "0 10 16 * * ?
|
@ -0,0 +1,25 @@
|
||||
<?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.shibofu.spring.db1.dao.ArchiveDetailDao">
|
||||
|
||||
<insert id="addArchiveDetail">
|
||||
insert into
|
||||
archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(replace(newid(), '-', ''),#{item.pdfPath},#{item.masterId},#{item.uploadDateTime},#{item.assortId},#{item.source},
|
||||
#{item.subAssort},#{item.title},#{item.flag})
|
||||
</foreach>
|
||||
</insert>
|
||||
<delete id="delSubAssort">
|
||||
delete from archive_detail where id=#{id} and Source='pacs'
|
||||
</delete>
|
||||
|
||||
<select id="getSubAssort" resultType="com.shibofu.spring.vo.ArchiveDetailVo">
|
||||
select id,PDF_PATH as pdfPath from archive_detail where SubAssort=#{subAssort} and Source='pacs'
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,46 @@
|
||||
<?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.shibofu.spring.db1.dao.ArchiveMasterDao">
|
||||
|
||||
<select id="PollingPacs" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
visit_id AS visitId,
|
||||
inp_no AS inpNo,
|
||||
admission_date_time AS admissionDateTime,
|
||||
discharge_date_time AS dischargeDateTime
|
||||
FROM
|
||||
archive_master
|
||||
WHERE
|
||||
discharge_date_time BETWEEN DATEADD( hh, - 24,GETDATE() ) AND GETDATE()
|
||||
</select>
|
||||
<select id="PacsEveryWeekPolling" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
visit_id AS visitId,
|
||||
inp_no AS inpNo,
|
||||
admission_date_time AS admissionDateTime,
|
||||
discharge_date_time AS dischargeDateTime
|
||||
FROM
|
||||
archive_master
|
||||
WHERE
|
||||
discharge_date_time BETWEEN DATEADD( hh, - 168,GETDATE() ) AND GETDATE()
|
||||
</select>
|
||||
<select id="makeUpPacsByMasterId" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
visit_id AS visitId,
|
||||
inp_no AS inpNo,
|
||||
admission_date_time AS admissionDateTime,
|
||||
discharge_date_time AS dischargeDateTime
|
||||
FROM
|
||||
archive_master
|
||||
WHERE
|
||||
id=#{masterId}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,15 @@
|
||||
<?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.shibofu.spring.db2.dao.PacsDao">
|
||||
|
||||
|
||||
<select id="getVo" resultType="com.shibofu.spring.vo.PacsVo">
|
||||
SELECT accessionnumber,
|
||||
ExamItem
|
||||
FROM pacsdb.dbo.AutoPrint_1
|
||||
WHERE RegisterDT BETWEEN DATEADD(hh, -6, #{admissionDateTime}) and DATEADD(hh, 6, #{dischargeDateTime})
|
||||
AND (OutHospitalNo = #{inpNo} OR InHospitalNo = #{inpNo} OR PhysicalNumber = #{inpNo} )
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
CREATE TABLE `money` (
|
||||
`id` int(33) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`basic` int(33) DEFAULT NULL COMMENT '基本工资',
|
||||
`reward` int(33) DEFAULT NULL COMMENT '奖金',
|
||||
`punishment` int(33) DEFAULT NULL COMMENT '惩罚金',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
@ -0,0 +1,7 @@
|
||||
CREATE TABLE `user` (
|
||||
`id` int(13) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`name` varchar(33) DEFAULT NULL COMMENT '姓名',
|
||||
`age` int(3) DEFAULT NULL COMMENT '年龄',
|
||||
`money` double DEFAULT NULL COMMENT '账户余额',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
Loading…
Reference in New Issue