11、将图片地址改成可配置文件
2、删除老代码 3、给清单新增页码功能,包括护理的,以及重症的 4、新增统一接口下载方式,统一协议为FTP,文件类型为pdf,账号密码都为commonmaster
parent
bace7fcf7f
commit
ce66fbac70
@ -1,134 +0,0 @@
|
|||||||
package com.ann.controller;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
||||||
import com.ann.entity.filing.MessageSubordinate;
|
|
||||||
import com.ann.entity.filing.dto.MessageDto;
|
|
||||||
import com.ann.entity.filing.dto.PatientMainDto;
|
|
||||||
import com.ann.entity.interfaceEntity.MessageLog;
|
|
||||||
import com.ann.entity.other.QuartzBean;
|
|
||||||
import com.ann.repository.MessageSubordinateRepository;
|
|
||||||
import com.ann.service.ArchiveDetailService;
|
|
||||||
import com.ann.utils.*;
|
|
||||||
import jcifs.smb.SmbFileInputStream;
|
|
||||||
import org.apache.cxf.endpoint.Client;
|
|
||||||
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
|
|
||||||
import org.omg.SendingContext.RunTime;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import sun.net.ftp.FtpClient;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/7/18 10:47
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/")
|
|
||||||
public class TestController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ArchiveDetailService archiveDetailService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
MessageSubordinateRepository messageSubordinateRepository;
|
|
||||||
|
|
||||||
@RequestMapping("/demo")
|
|
||||||
public String aa() {
|
|
||||||
return "demo";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/haha")
|
|
||||||
public String createJob(QuartzBean quartzBean) {
|
|
||||||
|
|
||||||
|
|
||||||
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
|
|
||||||
Client client = dcf.createClient("http://localhost:8080/services/HomepageDictionary?wsdl");
|
|
||||||
Object[] objects = new Object[0];
|
|
||||||
// invoke("方法名",参数1,参数2,参数3....);
|
|
||||||
try {
|
|
||||||
objects = client.invoke("CheckData", "2b52c101-69d3-495c-94dc-1e3c47e61623");
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return objects[0].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/xixi")
|
|
||||||
public String xixi() {
|
|
||||||
// 创建url地址
|
|
||||||
/*String address = "ftp://PTVIEW:MedExTech@10.6.0.65:10021/ecgdata/ECG/2019-07-24/MECGCAS1907240069_1.jpg";
|
|
||||||
address = address.substring(address.indexOf("/")+2,address.length());
|
|
||||||
// 10.6.0.65:10021/ecgdata/ECG/2019-07-24/MECGCAS1907240069_1.jpg
|
|
||||||
String ftpAccount = address.substring(0,address.indexOf("@"));
|
|
||||||
String[] split = ftpAccount.split(":");
|
|
||||||
|
|
||||||
address = address.substring(address.indexOf("@")+1,address.length());
|
|
||||||
|
|
||||||
String url = address.substring(0,address.indexOf(":"));
|
|
||||||
Integer port = 0;
|
|
||||||
if(address.indexOf(":") != -1 && address.indexOf("/") != -1 ){
|
|
||||||
port = Integer.parseInt(address.substring(address.indexOf(":")+1,address.indexOf("/")));
|
|
||||||
}
|
|
||||||
String path = address.substring(address.indexOf("/"),address.length());
|
|
||||||
*/
|
|
||||||
String address = "ftp://10.6.0.75/000/000568558/2/000568558000_2_麻醉_麻醉单_1_1.pdf";
|
|
||||||
//String address = "ftp://10.6.0.65:10021/ecgdata/ECG/2019-07-25/201907250940334102.pdf";
|
|
||||||
String temp = address;
|
|
||||||
address = address.substring(address.indexOf("/") + 2, address.length());
|
|
||||||
|
|
||||||
String url = address.substring(0, address.indexOf("/"));
|
|
||||||
String path = address.substring(address.indexOf("/"), address.length());
|
|
||||||
|
|
||||||
try {
|
|
||||||
FtpClient ftpClient = FtpUtils.connectFTP(url, 21, "mdsd", "mdsd");
|
|
||||||
// File pdfFile = FileUtils.createFile("pdfs","789","123456", "阿雷小猴子");
|
|
||||||
//FtpUtils.downloadFtp(temp,ftpClient,pdfFile);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return "我是测试ftp的~~~~";
|
|
||||||
}
|
|
||||||
|
|
||||||
// @RequestMapping("/deleteDetail")
|
|
||||||
// public String deleteDetail() throws Exception{
|
|
||||||
// archiveDetailService.delete();
|
|
||||||
// return "成功";
|
|
||||||
// }
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public String xixi1() {
|
|
||||||
archiveDetailService.test();
|
|
||||||
return "哈哈哈哈";
|
|
||||||
}
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@RequestMapping("/updatePatient")
|
|
||||||
public String cc1(){
|
|
||||||
List<MessageSubordinate> haha = messageSubordinateRepository.findHaha();
|
|
||||||
for (MessageSubordinate messageSubordinate:
|
|
||||||
haha) {
|
|
||||||
String contentJson = messageSubordinate.getContentJson();
|
|
||||||
MessageLog messageLog = JSON.parseObject(contentJson, MessageLog.class);
|
|
||||||
if (messageLog != null) {
|
|
||||||
String outJson = messageLog.getOutJson();
|
|
||||||
if (outJson != null) {
|
|
||||||
MessageDto messageDto = JSON.parseObject(outJson, MessageDto.class);
|
|
||||||
String patientMainStr = JSON.toJSONString(new PatientMainDto(messageDto.getInpNo(), messageDto.getVisitId()), SerializerFeature.WriteMapNullValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return haha.size()+"";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.ann.entity.filing;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对列表
|
|
||||||
*
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/7/11 21:49
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Table
|
|
||||||
@Entity
|
|
||||||
public class Queue {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
private String time;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package com.ann.job.config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务
|
|
||||||
*
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/7/13 17:03
|
|
||||||
*/
|
|
||||||
//@Configuration
|
|
||||||
public class QuartzConfig {
|
|
||||||
|
|
||||||
// @Bean
|
|
||||||
// public JobDetail uploadTaskDetail() {
|
|
||||||
// // 创建工作
|
|
||||||
// return JobBuilder.newJob(MyTask.class).withIdentity("MyTask").storeDurably().build();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Bean
|
|
||||||
// public Trigger uploadTaskTrigger() {
|
|
||||||
// //TODO 这里设定执行方式
|
|
||||||
// CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("*/10 * * * * ?");
|
|
||||||
// // 返回任务触发器
|
|
||||||
// return TriggerBuilder.newTrigger().forJob(uploadTaskDetail())
|
|
||||||
// .withIdentity("MyTask")
|
|
||||||
// .withSchedule(scheduleBuilder)
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.ann.repository;
|
|
||||||
|
|
||||||
import com.ann.entity.filing.ArchiveDetail;
|
|
||||||
import com.ann.entity.filing.ArchiveDetail1;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/7/12 9:10
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
public interface ArchiveDetail1Repository extends JpaRepository<ArchiveDetail1, String> {
|
|
||||||
|
|
||||||
// or Source = 'DoctorData' or AssortID = '117' or AssortID = '10' or AssortID = '60' or AssortID = '57' or AssortID = '52' or AssortID = '54' or AssortID = '59'
|
|
||||||
@Query(nativeQuery = true, value = "select * from archive_detail o where o.MasterID in (select id from archive_master m where m.dept_admission_to = '1040100'\n" +
|
|
||||||
"and m.admission_date_time < '2019-11-27 00:00:00.000' )")
|
|
||||||
public List<ArchiveDetail1> findAllHaha();
|
|
||||||
|
|
||||||
@Query("select count (o) from ArchiveDetail o where o.masterID = ?1 and o.assortID = ?2 and o.source=?3 and (o.applyId = ?4 and o.applyId is not null) ")
|
|
||||||
Integer countByMasterIDAndAssortIDAndSourceAndApplyId(String masterId, String AssortID, String source, String applyId);
|
|
||||||
|
|
||||||
public ArchiveDetail findByMasterIDAndAssortIDAndSourceAndApplyId(String masterId, String AssortID, String source, String applyId);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.ann.repository;
|
|
||||||
|
|
||||||
import com.ann.entity.filing.Queue;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/7/11 21:59
|
|
||||||
*/
|
|
||||||
public interface QueueRepository extends JpaRepository<Queue, String> {
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.ann.utils;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description
|
|
||||||
* @Date 2019/6/24 10:51
|
|
||||||
* @Created by ljx
|
|
||||||
*/
|
|
||||||
public class DateUtils {
|
|
||||||
|
|
||||||
|
|
||||||
// 生成指定格式的时间
|
|
||||||
public static String getDateStr() {
|
|
||||||
//日期转换为字符串
|
|
||||||
LocalDateTime now = LocalDateTime.now();
|
|
||||||
DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyyMMddhhmmss");
|
|
||||||
return now.format(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,224 +0,0 @@
|
|||||||
package com.ann.utils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import com.jcraft.jsch.*;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.commons.net.ftp.FTP;
|
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
|
||||||
import org.apache.commons.net.ftp.FTPReply;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LeiJiaXin
|
|
||||||
* @Date: 2019/9/2 11:19
|
|
||||||
*/
|
|
||||||
public class SFTPUtil {
|
|
||||||
private transient Logger log = LoggerFactory.getLogger(this.getClass());
|
|
||||||
|
|
||||||
private ChannelSftp sftp;
|
|
||||||
|
|
||||||
private Session session;
|
|
||||||
/**
|
|
||||||
* SFTP 登录用户名
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
/**
|
|
||||||
* SFTP 登录密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
/**
|
|
||||||
* 私钥
|
|
||||||
*/
|
|
||||||
private String privateKey;
|
|
||||||
/**
|
|
||||||
* SFTP 服务器地址IP地址
|
|
||||||
*/
|
|
||||||
private String host;
|
|
||||||
/**
|
|
||||||
* SFTP 端口
|
|
||||||
*/
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造基于密码认证的sftp对象
|
|
||||||
*/
|
|
||||||
public SFTPUtil(String username, String password, String host, int port) {
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
this.host = host;
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造基于秘钥认证的sftp对象
|
|
||||||
*/
|
|
||||||
public SFTPUtil(String username, String host, int port, String privateKey) {
|
|
||||||
this.username = username;
|
|
||||||
this.host = host;
|
|
||||||
this.port = port;
|
|
||||||
this.privateKey = privateKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SFTPUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 连接sftp服务器
|
|
||||||
*/
|
|
||||||
public void login() {
|
|
||||||
try {
|
|
||||||
JSch jsch = new JSch();
|
|
||||||
if (privateKey != null) {
|
|
||||||
jsch.addIdentity(privateKey);// 设置私钥
|
|
||||||
}
|
|
||||||
|
|
||||||
session = jsch.getSession(username, host, port);
|
|
||||||
|
|
||||||
if (password != null) {
|
|
||||||
session.setPassword(password);
|
|
||||||
}
|
|
||||||
Properties config = new Properties();
|
|
||||||
config.put("StrictHostKeyChecking", "no");
|
|
||||||
|
|
||||||
session.setConfig(config);
|
|
||||||
session.connect();
|
|
||||||
|
|
||||||
Channel channel = session.openChannel("sftp");
|
|
||||||
channel.connect();
|
|
||||||
|
|
||||||
sftp = (ChannelSftp) channel;
|
|
||||||
} catch (JSchException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭连接 server
|
|
||||||
*/
|
|
||||||
public void logout() {
|
|
||||||
if (sftp != null) {
|
|
||||||
if (sftp.isConnected()) {
|
|
||||||
sftp.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (session != null) {
|
|
||||||
if (session.isConnected()) {
|
|
||||||
session.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将输入流的数据上传到sftp作为文件。文件完整路径=basePath+directory
|
|
||||||
*
|
|
||||||
* @param basePath 服务器的基础路径
|
|
||||||
* @param directory 上传到该目录
|
|
||||||
* @param sftpFileName sftp端文件名
|
|
||||||
*/
|
|
||||||
public void upload(String basePath, String directory, String sftpFileName, InputStream input) throws SftpException {
|
|
||||||
try {
|
|
||||||
sftp.cd(basePath);
|
|
||||||
sftp.cd(directory);
|
|
||||||
} catch (SftpException e) {
|
|
||||||
//目录不存在,则创建文件夹
|
|
||||||
String[] dirs = directory.split("/");
|
|
||||||
String tempPath = basePath;
|
|
||||||
for (String dir : dirs) {
|
|
||||||
if (null == dir || "".equals(dir)) continue;
|
|
||||||
tempPath += "/" + dir;
|
|
||||||
try {
|
|
||||||
sftp.cd(tempPath);
|
|
||||||
} catch (SftpException ex) {
|
|
||||||
sftp.mkdir(tempPath);
|
|
||||||
sftp.cd(tempPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sftp.put(input, sftpFileName); //上传文件
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载文件。
|
|
||||||
*
|
|
||||||
* @param directory 下载目录
|
|
||||||
* @param downloadFile 下载的文件
|
|
||||||
* @param saveFile 存在本地的路径
|
|
||||||
*/
|
|
||||||
public void download(String directory, String downloadFile, File saveFile) throws SftpException, FileNotFoundException {
|
|
||||||
if (directory != null && !"".equals(directory)) {
|
|
||||||
sftp.cd(directory);
|
|
||||||
}
|
|
||||||
sftp.get(downloadFile, new FileOutputStream(saveFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下载文件
|
|
||||||
*
|
|
||||||
* @param directory 下载目录
|
|
||||||
* @param downloadFile 下载的文件名
|
|
||||||
* @return 字节数组
|
|
||||||
*/
|
|
||||||
public byte[] download(String directory, String downloadFile) throws SftpException, IOException {
|
|
||||||
if (directory != null && !"".equals(directory)) {
|
|
||||||
sftp.cd(directory);
|
|
||||||
}
|
|
||||||
InputStream is = sftp.get(downloadFile);
|
|
||||||
|
|
||||||
byte[] fileData = IOUtils.toByteArray(is);
|
|
||||||
|
|
||||||
return fileData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除文件
|
|
||||||
*
|
|
||||||
* @param directory 要删除文件所在目录
|
|
||||||
* @param deleteFile 要删除的文件
|
|
||||||
*/
|
|
||||||
public void delete(String directory, String deleteFile) throws SftpException {
|
|
||||||
sftp.cd(directory);
|
|
||||||
sftp.rm(deleteFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列出目录下的文件
|
|
||||||
*
|
|
||||||
* @param directory 要列出的目录
|
|
||||||
*/
|
|
||||||
public Vector<?> listFiles(String directory) throws SftpException {
|
|
||||||
return sftp.ls(directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
//上传文件测试
|
|
||||||
public static void main(String[] args) throws SftpException, IOException {
|
|
||||||
SFTPUtil sftp = new SFTPUtil("用户名", "密码", "ip地址", 22);
|
|
||||||
sftp.login();
|
|
||||||
File file = new File("D:\\图片\\t0124dd095ceb042322.jpg");
|
|
||||||
InputStream is = new FileInputStream(file);
|
|
||||||
|
|
||||||
sftp.upload("基础路径", "文件路径", "test_sftp.jpg", is);
|
|
||||||
sftp.logout();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue