修改采集保存路径

master
linjj 1 year ago
parent 4433370d56
commit 4e8edf16d8

@ -9,7 +9,7 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.shibofu.spring</groupId>
<artifactId>pacs</artifactId>
<artifactId>ECG</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
@ -46,14 +46,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
@ -95,13 +94,6 @@
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>

@ -1,61 +0,0 @@
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);
}
}

@ -1,48 +0,0 @@
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.db3.dao", sqlSessionTemplateRef = "db3SqlSessionTemplate")
public class DataSource3Config {
@Bean(name = "db3DataSource")
@ConfigurationProperties(prefix = "spring.datasource.hikari.db3")
public DataSource testDataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "db3SqlSessionFactory")
public SqlSessionFactory testSqlSessionFactory(@Qualifier("db3DataSource") DataSource dataSource) throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/db3/*.xml"));
return bean.getObject();
}
@Bean(name = "db3TransactionManager")
public DataSourceTransactionManager testTransactionManager(@Qualifier("db3DataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "db3SqlSessionTemplate")
public SqlSessionTemplate testSqlSessionTemplate(@Qualifier("db3SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
}

@ -1,16 +1,13 @@
package com.shibofu.spring.controller;
import com.shibofu.spring.db1.service.PacsPollingService;
import com.shibofu.spring.db2.service.MoneyService;
import com.shibofu.spring.db3.service.CostListService;
import com.shibofu.spring.db1.service.ECGPollingService;
import com.shibofu.spring.db1.serviceImpl.ECGPollingServiceImpl;
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
@ -19,24 +16,25 @@ import java.util.Map;
@RequestMapping("/makeUp")
public class MoneyController {
@Autowired
private PacsPollingService pacsPollingService;
@Autowired
private CostListService costListService;
private ECGPollingService ecgPollingService;
@GetMapping("/makeUpByPacsAndTime")
public String makeUpByNeed() {
pacsPollingService.pacsAnxu();
return "采集完成";
@GetMapping("/makeUpECG")
public Msg makeUpByNeed() {
Msg msg = ecgPollingService.ECGDayPolling();
return msg;
}
@GetMapping("/makeUpPacsByMasterId")
public Msg makeUpPacsByMasterId(String masterId) {
return pacsPollingService.makeUpPacsByMasterId(masterId);
@GetMapping("/makeUpECGByPatientId")
public Msg makeUpECGByPatientId(String patientId) {
Msg msg = ecgPollingService.ECGDayPollingByPatientId(patientId);
return msg;
}
@GetMapping("/costList")
public String getCostList(){
costListService.collectionCostList();
return "采集完成";
@GetMapping("/makeUpTime")
public Msg makeUp() {
return ecgPollingService.makeUp();
}
}

@ -19,8 +19,8 @@ public interface ArchiveDetailDao {
boolean addArchiveDetail(@Param("list") List<ArchiveDetailDto> list);
List<ArchiveDetailVo> getSubAssort(String subAssort);
List<ArchiveDetailVo> getArchiveDetailBySourceAndMid(@Param("source")String source,@Param("mid")String mid);
int delSubAssort(String subAssort);
boolean delDetailBySourceAndMid(@Param("source")String source,@Param("mid")String mid);
}

@ -15,20 +15,10 @@ import java.util.List;
@Mapper
public interface ArchiveMasterDao {
//查询24小时内出院病历
List<ArchiveMasterVo> PollingPacs();
List<ArchiveMasterVo> PollingPacsAnXu();
//查询168小时内出院病历
List<ArchiveMasterVo> PacsEveryWeekPolling();
List<ArchiveMasterVo> makeUpPacsByMasterId(String masterId);
int updatePacsCompenSate(String masterId);
String selectPacsPush();
String getIdbyJzh(String jzh);
List<ArchiveMasterVo> PollingECG();
//根据记帐号查询病历
List<ArchiveMasterVo> PollingECGByPatientId(String patientId);
//整年心电数据补偿
List<ArchiveMasterVo> makeUp();
}

@ -0,0 +1,25 @@
package com.shibofu.spring.db1.service;
import com.shibofu.spring.util.Msg;
/**
* @InterfaceName ECGPollingService
* @Description
* @Author linjj
* @Date 2024/7/8 8:55
* @Version 1.0
*/
public interface ECGPollingService {
/**
* @description:
* @author linjj
* @date: 2024/1/18 9:29
*/
Msg ECGDayPolling() ;
Msg ECGDayPollingByPatientId(String patientId);
Msg makeUp();
}

@ -1,48 +0,0 @@
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
*/
void PacsEveryDayPolling() ;
Msg pacsAnxu();
/**
* @description:
* @author linjj
* @date: 2024/1/18 9:29
*/
Msg PacsEveryWeekPolling();
/**
* @description: pacs
* @author linjj
* @date: 2024/4/29 10:36
*/
Msg makeUpPacsByMasterId(String masterId);
/**
* @description: pacs
* @author linjj
* @date: 2024/4/29 10:36
*/
Msg makeUpPacsPush();
}

@ -0,0 +1,228 @@
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.ECGPollingService;
import com.shibofu.spring.db2.dao.ECGDao;
import com.shibofu.spring.dto.ArchiveDetailDto;
import com.shibofu.spring.util.Msg;
import com.shibofu.spring.vo.ArchiveDetailVo;
import com.shibofu.spring.vo.ArchiveMasterVo;
import com.shibofu.spring.vo.ECGVo;
import lombok.extern.slf4j.Slf4j;
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.StringUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName ECGPollingServiceImpl
* @Description
* @Author linjj
* @Date 2024/7/8 8:55
* @Version 1.0
*/
@Service
@Slf4j
public class ECGPollingServiceImpl implements ECGPollingService {
@Autowired
private ArchiveMasterDao archiveMasterDao;
@Autowired
private ECGDao ecgDao;
@Value("${savePath}")
private String savePath;
@Autowired
private ArchiveDetailDao archiveDetailDao;
@Override
public Msg ECGDayPolling() {
//查询当前时间24小时内需要采集数据
List<ArchiveMasterVo> archiveMasters = archiveMasterDao.PollingECG();
if (CollectionUtils.isEmpty(archiveMasters)) {
log.info("当前时间段查询不到心跳数据");
return Msg.success("当前时间段查询不到心跳数据");
}
log.info("--------------------------------------------当前时间段心电需要采集:" + archiveMasters.size() + "个患者--------------------------------------------");
//循环所有患者采集
for (ArchiveMasterVo list : archiveMasters) {
log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
List<ECGVo> ecgs = ecgDao.getECG(list.getPatientId());
if (CollectionUtils.isEmpty(ecgs)) {
log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
continue;
}
//获取需要插入archiveDetai表数据
ArrayList<ArchiveDetailDto> archiveDetailList = getArchiveDetailDtos(list, ecgs);
if (CollectionUtils.isEmpty(archiveDetailList)) {
log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
continue;
}
//更新文件表
updateArchiveDetail(list, archiveDetailList);
}
log.info("--------------------------------------------此时间段采集完成--------------------------------------------");
return Msg.success("此时间段采集完成");
}
@Override
public Msg ECGDayPollingByPatientId(String patientId){
List<ArchiveMasterVo> archiveMasters = archiveMasterDao.PollingECGByPatientId(patientId);
if (CollectionUtils.isEmpty(archiveMasters)) {
log.info("当前时间段查询不到心跳数据");
return Msg.success("当前时间段查询不到心跳数据");
}
log.info("--------------------------------------------心电按需:" + archiveMasters.size() + "个患者--------------------------------------------");
//循环所有患者采集
for (ArchiveMasterVo list : archiveMasters) {
log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
List<ECGVo> ecgs = ecgDao.getECG(list.getPatientId());
if (CollectionUtils.isEmpty(ecgs)) {
log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
continue;
}
//获取需要插入archiveDetai表数据
ArrayList<ArchiveDetailDto> archiveDetailList = getArchiveDetailDtos(list, ecgs);
if (CollectionUtils.isEmpty(archiveDetailList)) {
log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
continue;
}
//更新文件表
updateArchiveDetail(list, archiveDetailList);
}
log.info("--------------------------------------------心电按需采集完成--------------------------------------------");
return Msg.success("心电按需采集完成");
}
@Override
public Msg makeUp() {
List<ArchiveMasterVo> archiveMasters = archiveMasterDao.makeUp();
if (CollectionUtils.isEmpty(archiveMasters)) {
log.info("当前时间段查询不到心跳数据");
return Msg.success("当前时间段查询不到心跳数据");
}
log.info("--------------------------------------------心电补偿:" + archiveMasters.size() + "个患者--------------------------------------------");
//循环所有患者采集
for (ArchiveMasterVo list : archiveMasters) {
log.info("---------------------开始采集记帐号为:" + list.getPatientId() + "的患者---------------------");
List<ECGVo> ecgs = ecgDao.getECG(list.getPatientId());
if (CollectionUtils.isEmpty(ecgs)) {
log.info("记帐号为:" + list.getPatientId() + "的患者没有心电数据");
continue;
}
//获取需要插入archiveDetai表数据
ArrayList<ArchiveDetailDto> archiveDetailList = getArchiveDetailDtos(list, ecgs);
if (CollectionUtils.isEmpty(archiveDetailList)) {
log.info("记帐号为:" + list.getPatientId()+"没有保存文件表数据");
continue;
}
//更新文件表
updateArchiveDetail(list, archiveDetailList);
}
log.info("--------------------------------------------心电补偿采集完成--------------------------------------------");
return Msg.success("心电补偿采集完成");
}
//更新文件表数据
private void updateArchiveDetail(ArchiveMasterVo list, ArrayList<ArchiveDetailDto> archiveDetailList) {
//判断是否存在数据,存在删除并且删除原文件
List<ArchiveDetailVo> ecgList = archiveDetailDao.getArchiveDetailBySourceAndMid("ECG", list.getId());
if (!CollectionUtils.isEmpty(ecgList)) {
archiveDetailDao.delDetailBySourceAndMid("ECG", list.getId());
//删除原文件数据
deleteFliepath(ecgList);
}
if (archiveDetailDao.addArchiveDetail(archiveDetailList)){
log.info("记帐号为:" + list.getPatientId()+"采集了"+ archiveDetailList.size()+"张图像");
}
}
private ArrayList<ArchiveDetailDto> getArchiveDetailDtos(ArchiveMasterVo list, List<ECGVo> ecgs) {
ArrayList<ArchiveDetailDto> archiveDetailList = null;
try {
String filePathdir;
//文件保存目录
filePathdir = savePath + File.separatorChar + list.getPatientId();
// 本地磁盘的路径
Path localPath = Paths.get(filePathdir);
//确保目录存在
if (createDirectory(localPath)) return null;
//保存文件表集合
archiveDetailList = new ArrayList<>();
//患者所有心电记录采集到本地磁盘
for (ECGVo ecg : ecgs) {
String newPath;
String pPath = ecg.getPPath();
//使用yyyyMMddHHmmssSSS格式作为文件名
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String newDate = format.format(date);
String savaPath = filePathdir + File.separatorChar + newDate + ".PDF";
if (pPath.contains("E:\\ecgdata\\ECG")) {
newPath = pPath.replace("E:\\ecgdata\\ECG", "Z:");
} else {
newPath = pPath.replace("E:\\ECGDATA\\ECG", "Z:");
}
// 构建网络文件的完整路径
Path networkFilePath = Paths.get(newPath);
// 从网络磁盘拷贝文件到本地磁盘
try {
Files.copy(networkFilePath, Paths.get(savaPath));
} catch (Exception e) {
log.error("记帐号为:" + list.getPatientId() + "的病历文件名为:" + networkFilePath.getFileName() + "的文件拷贝失败", e);
continue;
}
//组织保存文件表数据
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
archiveDetailDto.setMasterId(list.getId());
archiveDetailDto.setUploadDateTime(new Date());
archiveDetailDto.setAssortId("DA342ED81CEE4A8EA827424626F3F577");
archiveDetailDto.setSource("ECG");
archiveDetailDto.setFlag("0");
archiveDetailDto.setSys("ECG");
archiveDetailDto.setTitle("心电图报告");
archiveDetailDto.setPdfPath(savaPath);
archiveDetailList.add(archiveDetailDto);
}
} catch (Exception e) {
log.error("记帐号为:" + list.getPatientId() + "的病历异常处理");
return null;
}
return archiveDetailList;
}
private void deleteFliepath(List<ArchiveDetailVo> ecgList) {
for (ArchiveDetailVo list : ecgList) {
File file = new File(list.getPdfPath());
try {
file.delete(); // 删除照片
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static boolean createDirectory(Path localPath) {
try {
if (!Files.exists(localPath)) {
Files.createDirectories(localPath);
}
} catch (IOException e) {
log.error(e.getMessage());
return true;
}
return false;
}
}

@ -1,228 +0,0 @@
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.BeansException;
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.*;
/**
* @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 void PacsEveryDayPolling() {
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.PollingPacs();
if (!CollectionUtils.isEmpty(archiveMasterVos)) {
logger.info("一共:"+archiveMasterVos.size()+"条病历!!!!");
gather(archiveMasterVos);
}
}
@Override
public Msg pacsAnxu() {
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.PollingPacsAnXu();
if (CollectionUtils.isEmpty(archiveMasterVos)) {
return Msg.fail("无需采集数据");
}
gather(archiveMasterVos);
return Msg.success("采集完成");
}
@Override
public Msg PacsEveryWeekPolling() {
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.PacsEveryWeekPolling();
if (CollectionUtils.isEmpty(archiveMasterVos)) {
return Msg.fail("无需采集数据");
}
gather(archiveMasterVos);
return Msg.success("采集完成");
}
@Override
public Msg makeUpPacsByMasterId(String masterId) {
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.makeUpPacsByMasterId(masterId);
if (CollectionUtils.isEmpty(archiveMasterVos)) {
return Msg.fail("无需采集数据");
}
logger.info("一共:"+archiveMasterVos.size()+"条病历!!!!");
gather(archiveMasterVos);
return Msg.success("采集完成");
}
@Override
public Msg makeUpPacsPush() {
String masterId = archiveMasterDao.selectPacsPush();
List<ArchiveMasterVo> archiveMasterVos = archiveMasterDao.makeUpPacsByMasterId(masterId);
if (CollectionUtils.isEmpty(archiveMasterVos)) {
return Msg.fail("无需采集数据");
}
gather(archiveMasterVos);
archiveMasterDao.updatePacsCompenSate(masterId);
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();
}
}
}
private void gather(List<ArchiveMasterVo> archiveMasterVos) {
// 创建 JNI 实例
PacsAutoPrintPDF.INSTANCE.setServerInfo("10.36.116.100", 204);
for (ArchiveMasterVo list : archiveMasterVos) {
try {
ArchiveMasterDto dto = new ArchiveMasterDto();
BeanUtils.copyProperties(list, dto);
//根据入院前六小时出院后六小时住院号查询要下载pdf的路径
List<PacsVo> vo = pacsDao.getVo(dto);
if (CollectionUtils.isEmpty(vo)) {
logger.info("该住院号时间内无数据" + list.getInpNo() + "住院次数为:" + list.getVisitId());
continue;
}
logger.info("住院号为:"+list.getInpNo() + "住院次数为:" + list.getVisitId()+"当前记录为:"+vo.size()+"条");
//插入文件表数据集合
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 + File.separatorChar + list.getInpNo() + File.separatorChar + list.getVisitId();
File file = new File(filePathdir);
//判断文件夹是否存在不存在创建文件夹
if (!file.exists()) {
file.mkdirs();
}
String filePath = filePathdir + File.separatorChar + newDate + ".pdf";
logger.info("-----------------文件id:" + pacsList.getAccessionnumber() + ",路径:" + filePath);
// 调用 GetPDF 函数
try {
boolean result = PacsAutoPrintPDF.INSTANCE.GetPDF(pacsList.getAccessionnumber(), filePath);
} catch (Throwable e) {
logger.info(pacsList.getAccessionnumber()+"异常处理");
continue;
}
//成功存在文件表中,不成功输出到日志中
saveArchiveDetailDto(list, dto, ArchiveDetailList, pacsList, filePath);
}
//插入文件表
boolean b = archiveDetailDao.addArchiveDetail(ArchiveDetailList);
if (b) {
ArchiveDetailList.clear();
logger.info("住院号:" + list.getInpNo() + "住院次数为:" + list.getVisitId() + "采集完成");
}
} catch (Exception e) {
logger.info(list.getId()+"异常处理");
}
}
}
private static void saveArchiveDetailDto(ArchiveMasterVo list, ArchiveMasterDto dto, List<ArchiveDetailDto> ArchiveDetailList, PacsVo pacsList, String filePath) {
//成功存在文件表中,不成功输出到日志中
if (new File(filePath).exists()) {
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
archiveDetailDto.setMasterId(dto.getId());
archiveDetailDto.setUploadDateTime(new Date());
String emrAssort = getEmrAssort(pacsList.getProf());
archiveDetailDto.setAssortId(emrAssort);
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() + "解析不返回图片");
}
}
public static String getEmrAssort(String prof) {
Map<String, String> map = new HashMap<>();
map.put("1", "DA342ED81CEE4A8EA827424626F3F577");
map.put("2", "DA342ED81CEE4A8EA827424626F3F577");
map.put("3", "DA342ED81CEE4A8EA827424626F3F577");
map.put("4", "DA342ED81CEE4A8EA827424626F3F577");
map.put("5", "DA342ED81CEE4A8EA827424626F3F577");
map.put("6", "DA342ED81CEE4A8EA827424626F3F577");
map.put("7", "DA342ED81CEE4A8EA827424626F3F577");
map.put("8", "DA342ED81CEE4A8EA827424626F3F577");
map.put("9", "DA342ED81CEE4A8EA827424626F3F577");
map.put("20", "DA342ED81CEE4A8EA827424626F3F577");
map.put("22", "DA342ED81CEE4A8EA827424626F3F577");
map.put("23", "DA342ED81CEE4A8EA827424626F3F577");
map.put("24", "DA342ED81CEE4A8EA827424626F3F577");
map.put("25", "DA342ED81CEE4A8EA827424626F3F577");
map.put("26", "DA342ED81CEE4A8EA827424626F3F577");
map.put("27", "DA342ED81CEE4A8EA827424626F3F577");
map.put("28", "DA342ED81CEE4A8EA827424626F3F577");
map.put("29", "DA342ED81CEE4A8EA827424626F3F577");
map.put("30", "DE599D770E8347CCB5122BC357D96F37");
map.put("32", "DA342ED81CEE4A8EA827424626F3F577");
map.put("33", "DA342ED81CEE4A8EA827424626F3F577");
map.put("34", "DA342ED81CEE4A8EA827424626F3F577");
map.put("36", "DE599D770E8347CCB5122BC357D96F37");
map.put("37", "DE599D770E8347CCB5122BC357D96F37");
map.put("38", "DE599D770E8347CCB5122BC357D96F37");
map.put("39", "DA342ED81CEE4A8EA827424626F3F577");
return map.get(prof);
}
}

@ -0,0 +1,20 @@
package com.shibofu.spring.db2.dao;
import com.shibofu.spring.vo.ECGVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName ECGDao
* @Description
* @Author linjj
* @Date 2024/7/8 9:05
* @Version 1.0
*/
@Mapper
public interface ECGDao {
List<ECGVo> getECG(@Param("patientID") String patientID);
}

@ -1,20 +0,0 @@
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);
}

@ -1,21 +0,0 @@
package com.shibofu.spring.db3.dao;
import com.shibofu.spring.vo.CostListVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @InterfaceName CostListServiceMapper
* @Description
* @Author linjj
* @Date 2024/5/22 10:30
* @Version 1.0
*/
@Mapper
public interface CostListDao {
List<CostListVo>getCostList(int offset);
int getConut();
}

@ -1,13 +0,0 @@
package com.shibofu.spring.db3.service;
/**
* @InterfaceName CostListService
* @Description
* @Author linjj
* @Date 2024/5/22 10:18
* @Version 1.0
*/
public interface CostListService {
void collectionCostList();
}

@ -1,141 +0,0 @@
package com.shibofu.spring.db3.serviceImpl;
import com.shibofu.spring.db1.dao.ArchiveDetailDao;
import com.shibofu.spring.db1.dao.ArchiveMasterDao;
import com.shibofu.spring.db3.dao.CostListDao;
import com.shibofu.spring.db3.service.CostListService;
import com.shibofu.spring.dto.ArchiveDetailDto;
import com.shibofu.spring.vo.ArchiveDetailVo;
import com.shibofu.spring.vo.CostListVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
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.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName CostListServiceImpl
* @Description
* @Author linjj
* @Date 2024/5/22 10:19
* @Version 1.0
*/
@Service
@Slf4j
public class CostListServiceImpl implements CostListService {
@Autowired
private CostListDao costListDao;
@Autowired
private ArchiveMasterDao archiveMasterDao;
@Autowired
private ArchiveDetailDao archiveDetailDao;
@Value("${savePath}")
private String savePath;
/**
* @description:
* @author linjj
* @date: 2024/5/22 10:21
*/
@Override
public void collectionCostList() {
//插入文件表数据集合
List<ArchiveDetailDto> ArchiveDetailList = new ArrayList<>();
//查询一共有多条记录
int conut = costListDao.getConut();
//每次查询50条记录
int pollingNum = (int) Math.floor((double) conut / (double) 50);
for (int i = 0; i <= pollingNum; i++) {
//每次查询50条记录
int offset = i * 50;
//查询需要采集清单病历
List<CostListVo> costList = costListDao.getCostList(offset);
if (!CollectionUtils.isEmpty(costList)) {
log.info("费用清单本次采集" + costList.size() + "份!!!");
for (CostListVo list : costList) {
if (StringUtils.isEmpty(list.getFpdf())) {
log.info(list.getFjzh() + "路径为空!!");
continue;
}
try {
download(list, ArchiveDetailList);
} catch (IOException e) {
log.info(e.getMessage());
}
}
archiveDetailDao.addArchiveDetail(ArchiveDetailList);
log.info("完成采集" + ArchiveDetailList.size() + "份!!!");
ArchiveDetailList.clear();
}
}
log.info("本次采集没有费用清单记录");
}
private void download(CostListVo costListVo, List<ArchiveDetailDto> ArchiveDetailList) throws IOException {
ArchiveDetailDto archiveDetailDto = new ArchiveDetailDto();
//使用yyyyMMddHHmmssSSS格式作为文件名
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String newDate = format.format(date);
//根据jzh查询患者主键id
String masterId = archiveMasterDao.getIdbyJzh(costListVo.getFjzh());
//判断文件是否存在存在删除后新增不存在新增
List<ArchiveDetailVo> subAssort = archiveDetailDao.getSubAssort(masterId);
if (subAssort.size() > 0) {
deleteFliepath(subAssort);
}
//组织保存目录
String filePathdir = savePath + File.separatorChar + costListVo.getFpatid() + File.separatorChar + costListVo.getFtimes();
File file = new File(filePathdir);
//判断文件夹是否存在不存在创建文件夹
if (!file.exists()) {
file.mkdirs();
}
//文件保存路径
String filePath = filePathdir + File.separatorChar + newDate + ".pdf";
//下载文件
try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {
// 将二进制数据写入文件
fileOutputStream.write(costListVo.getFpdf());
fileOutputStream.flush();
} catch (IOException e) {
log.info(masterId + "异常处理" + e.getMessage());
}
//保存文件表
archiveDetailDto.setMasterId(masterId);
archiveDetailDto.setUploadDateTime(new Date());
archiveDetailDto.setAssortId("DE599D770E8347CCB5122BC357D96F47");
archiveDetailDto.setSource("pacs");
archiveDetailDto.setFlag("0");
archiveDetailDto.setTitle("费用结算清单");
archiveDetailDto.setPdfPath(filePath);
archiveDetailDto.setSubAssort(masterId);
ArchiveDetailList.add(archiveDetailDto);
}
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,28 @@
package com.shibofu.spring.quartz;
import com.shibofu.spring.db1.service.ECGPollingService;
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 ECGQuartz extends QuartzJobBean {
@Resource
private ECGPollingService ecgPollingService;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) {
//每天轮询查询昨天数据进来采集
ecgPollingService.ECGDayPolling();
}
}

@ -1,29 +0,0 @@
package com.shibofu.spring.quartz;
import com.shibofu.spring.db1.dao.ArchiveMasterDao;
import com.shibofu.spring.db1.service.PacsPollingService;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import javax.annotation.Resource;
/**
* @description: pacs
* @author linjj
* @date: 2024/41/29 9:22
*/
public class PacsPushQuartz extends QuartzJobBean {
@Resource
private PacsPollingService pacsPollingService;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) {
//查询1条需要采集的记录
pacsPollingService.makeUpPacsPush();
}
}

@ -1,33 +0,0 @@
package com.shibofu.spring.quartz;
import com.shibofu.spring.db1.service.PacsPollingService;
import com.shibofu.spring.db3.service.CostListService;
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;
@Resource
private CostListService costListService;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) {
//每天轮询查询昨天数据进来采集
pacsPollingService.PacsEveryDayPolling();
//费用清单采集
costListService.collectionCostList();
//每天轮询查询一周内数据进来采集
pacsPollingService.PacsEveryWeekPolling();
}
}

@ -18,21 +18,14 @@ public class QuartzConfig {
@Value("${quartzTime}")
private String quartzTime;
@Value("${pacsQuartzTime}")
private String pacsQuartzTime;
@Bean
public JobDetail teatQuartzDetail() {
return JobBuilder.newJob(PacsQuartz.class).withIdentity("PacsQuartz").storeDurably().build();
return JobBuilder.newJob(ECGQuartz.class).withIdentity("ECGQuartz").storeDurably().build();
}
@Bean
public JobDetail pacsPush() {
return JobBuilder.newJob(PacsPushQuartz.class).withIdentity("PacsPushQuartz").storeDurably().build();
}
@Bean
@ -40,7 +33,7 @@ public class QuartzConfig {
return TriggerBuilder.newTrigger().forJob(teatQuartzDetail())
.withIdentity("PacsQuartz")
.withIdentity("ECGQuartz")
.withSchedule(CronScheduleBuilder.cronSchedule(quartzTime))
.build();
@ -48,16 +41,6 @@ public class QuartzConfig {
@Bean
public Trigger pacsPushTrigger() {
return TriggerBuilder.newTrigger().forJob(pacsPush())
.withIdentity("PacsPushQuartz")
.withSchedule(CronScheduleBuilder.cronSchedule(pacsQuartzTime))
.build();
}
}

@ -1,8 +1,6 @@
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;
@ -33,17 +31,20 @@ public class test {
private String savePath;
private final static Logger logger = LoggerFactory.getLogger(test.class);
@Autowired
private PacsPollingService pacsPollingService;
@Test
public void testDemo() {
File temporaryFile = new File("D:\\jiashi\\scanning\\35131\\1412");
try {
temporaryFile.delete(); // 删除临时照片
} catch (Exception e) {
e.printStackTrace();
String newPath;
String path = "E:\\ecgdata\\ECG\\2024-02-28\\1.2.826.0.1.3680043.2.377.114.21.20240228005228255.141737_1.PDF";
if (path.contains("E:\\ecgdata\\ECG")) {
newPath = path.replace("E:\\ecgdata\\ECG", "Z:");
} else {
newPath = path.replace("E:\\ECGDATA\\ECG", "Z:");
}
System.out.println("newPath" + newPath);
}
}

@ -1,14 +0,0 @@
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);
}

@ -25,4 +25,6 @@ public class ArchiveMasterVo {
private String admissionDateTime;
//出院时间
private String dischargeDateTime;
//记帐号
private String patientId;
}

@ -1,29 +0,0 @@
package com.shibofu.spring.vo;
import lombok.Data;
/**
* @ClassName CostListVo
* @Description
* @Author linjj
* @Date 2024/5/22 10:32
* @Version 1.0
*/
@Data
public class CostListVo {
//住院号
private String fpatid;
//住院次数
private String ftimes;
//二进制文件
private byte[] fpdf;
//记帐号
private String fjzh;
//出院时间
private String ffirstdate;
//最后更新时间
private String fnewdate;
//文件地址
private String filepath;
}

@ -0,0 +1,19 @@
package com.shibofu.spring.vo;
import lombok.Data;
/**
* @ClassName ECGVo
* @Description
* @Author linjj
* @Date 2024/7/8 9:09
* @Version 1.0
*/
@Data
public class ECGVo {
private String patientId;
private String WriteDateTime;
private String PPath;
}

@ -1,20 +0,0 @@
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;
private String prof;
}

@ -1,36 +1,27 @@
server.port=3391
server.port=3397
#sqlserver
spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=yd_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
##sqlserver
spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=yd_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
#pg
spring.datasource.hikari.db3.jdbc-url=jdbc:postgresql://localhost:5432/yd
spring.datasource.hikari.db3.username=postgres
spring.datasource.hikari.db3.password=admin123
spring.datasource.hikari.db3.driver-class-name=org.postgresql.Driver
#sqlserver
#spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://10.36.116.108:1433;DatabaseName=emr_record
#spring.datasource.hikari.db1.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=yd_record
#spring.datasource.hikari.db1.username=sa
#spring.datasource.hikari.db1.password=xjgs+docus911
#spring.datasource.hikari.db1.password=admin123
#spring.datasource.hikari.db1.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
##sqlserver
#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
###sqlserver
#spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=qf_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
##pg
#spring.datasource.hikari.db3.jdbc-url=jdbc:postgresql://192.168.55.230:5432/postgres
#spring.datasource.hikari.db3.username=postgres
#spring.datasource.hikari.db3.password=pl4grWwt
#spring.datasource.hikari.db3.driver-class-name=org.postgresql.Driver
#sqlserver
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
#ECG
spring.datasource.hikari.db2.jdbc-url=jdbc:sqlserver://192.168.10.50:1433;DatabaseName=medexmemrsECG
spring.datasource.hikari.db2.username=sa
spring.datasource.hikari.db2.password=MedExSQLServerAdmin
spring.datasource.hikari.db2.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# MyBatis-Plus ??
mybatis-plus.mapper-locations=classpath:mapper/db1/*.xml,classpath:mapper/db2/*.xml
mybatis-plus.type-aliases-package=com.shibofu.spring.vo

@ -1,7 +1,4 @@
#文件保存路径
savePath: F:\jiashi\reload
savePath: F:\ECG\reload
#定时补偿任务时间
quartzTime: 0 0 1 * * ?
#定时轮速pacs任务表时间
pacsQuartzTime: 0 */1 * * * ?
#quartzTime: "0 10 16 * * ?
quartzTime: 0 0 3 * * ?

@ -14,7 +14,7 @@
<Prudent>true</Prudent>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>
pacsLog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
ECGLog/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
</FileNamePattern>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">

@ -6,20 +6,19 @@
<insert id="addArchiveDetail">
insert into
archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,SubAssort,Title,flag
archive_detail(id,PDF_PATH,MasterID,UpLoadDateTime,AssortID,Source,Title,flag,Sys
)
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})
#{item.title},#{item.flag},#{item.sys})
</foreach>
</insert>
<delete id="delSubAssort">
delete from archive_detail where id=#{id} and Source='pacs'
<delete id="delDetailBySourceAndMid">
delete from archive_detail where MasterID=#{mid} and Source=#{source}
</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 id="getArchiveDetailBySourceAndMid" resultType="com.shibofu.spring.vo.ArchiveDetailVo">
select id,PDF_PATH pdfPath from archive_detail where MasterID=#{mid} and Source=#{source}
</select>
</mapper>

@ -3,14 +3,12 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shibofu.spring.db1.dao.ArchiveMasterDao">
<update id="updatePacsCompenSate">
update pacs_compensate set compensateState=1 where masterId=#{masterId}
</update>
<select id="PollingPacs" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
<select id="PollingECG" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
SELECT
id,
name,
patient_id AS patientId,
visit_id AS visitId,
inp_no AS inpNo,
admission_date_time AS admissionDateTime,
@ -19,11 +17,13 @@
archive_master
WHERE
discharge_date_time BETWEEN DATEADD( hh, - 24,GETDATE() ) AND GETDATE()
order by discharge_date_time ASC
</select>
<select id="PacsEveryWeekPolling" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
<select id="PollingECGByPatientId" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
SELECT
id,
name,
patient_id AS patientId,
visit_id AS visitId,
inp_no AS inpNo,
admission_date_time AS admissionDateTime,
@ -31,12 +31,14 @@
FROM
archive_master
WHERE
discharge_date_time BETWEEN DATEADD( hh, - 168,GETDATE() ) AND GETDATE()
patient_id=#{patientId}
order by discharge_date_time ASC
</select>
<select id="makeUpPacsByMasterId" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
<select id="makeUp" resultType="com.shibofu.spring.vo.ArchiveMasterVo">
SELECT
id,
name,
patient_id AS patientId,
visit_id AS visitId,
inp_no AS inpNo,
admission_date_time AS admissionDateTime,
@ -44,27 +46,8 @@
FROM
archive_master
WHERE
id=#{masterId}
</select>
<select id="PollingPacsAnXu" 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 '2024-04-01 00:00:00' AND '2024-05-14 23:59:59'
discharge_date_time BETWEEN '2024-01-01 00:00:00' AND '2024-05-31 23:59:59'
order by discharge_date_time ASC
</select>
<select id="selectPacsPush" resultType="java.lang.String">
select top 1 masterId from pacs_compensate where compensateState=0
</select>
<select id="getIdbyJzh" resultType="java.lang.String">
select id from archive_master where patient_id=#{jzh}
</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.shibofu.spring.db2.dao.ECGDao">
<select id="getECG" resultType="com.shibofu.spring.vo.ECGVo">
select patientid AS patientId, WriteDateTime, ReportFileLocate+reportfileName 'PPath' from [dbo].[v_EMR_Report] where PatientID=#{patientID}
</select>
</mapper>

@ -1,16 +0,0 @@
<?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,
prof
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>

@ -1,19 +0,0 @@
<?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.db3.dao.CostListDao">
<select id="getConut" resultType="java.lang.Integer">
select count(*)
from public.bajsdpdf
where fnewdate between CURRENT_DATE - INTERVAL '6 days' AND CURRENT_DATE
</select>
<select id="getCostList" resultType="com.shibofu.spring.vo.CostListVo">
SELECT fpatid, ftimes, fpdf, fjzh, ffirstdate, fnewdate, filepath
FROM public.bajsdpdf
where fnewdate between CURRENT_DATE - INTERVAL '6 days' AND CURRENT_DATE
order by fnewdate DESC
LIMIT 50 OFFSET #{offset}
</select>
</mapper>
Loading…
Cancel
Save