Compare commits

..

8 Commits

Author SHA1 Message Date
lxd
501b1f132f Reapply "新增文件上传方法 修改ftppdf和ftpimage 方法增加类型"
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
This reverts commit ba8a8ada8b96afe983bbe64e90d8e8adc7033ffa.
2024-10-28 12:44:29 +08:00
lxd
3de21afa3b Revert "新增文件上传方法 修改ftppdf和ftpimage 方法增加类型"
This reverts commit 1c236d72073db2597917c78a387aaf5bd3d085c5.
2024-10-28 12:44:29 +08:00
lxd
19df9ec6da 新增文件上传方法 修改ftppdf和ftpimage 方法增加类型 2024-10-28 12:44:28 +08:00
lxd
c4e49c9265 Merge branch 'master' of http://114.55.171.231:3000/lxd/FlowPacs
# Conflicts:
#	yudao-module-ultrasoniccom/yudao-module-ultrasoniccom-biz/src/main/java/cn/iocoder/yudao/module/ultrasoniccom/controller/admin/ultrasonic/ultrasonicController.java
2024-10-25 21:59:20 +08:00
lxd
ce14e5088d 登记列表同步方法 医院编码改成机构ID 2024-10-23 10:07:29 +08:00
lxd
139ec42e87 登记列表同步方法 医院编码改成机构ID 2024-10-23 10:07:13 +08:00
lxd
6d37ec24cc Merge remote-tracking branch '公司/master'
# Conflicts:
#	yudao-server/src/main/resources/application.yaml
2024-10-21 15:42:57 +08:00
lxd
c29871bcc7 配置文件修改 2024-10-21 15:41:43 +08:00
9 changed files with 225 additions and 111 deletions

View File

@ -8,8 +8,12 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.DigestUtil;
import lombok.SneakyThrows;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Base64;
/**
* 文件工具类
@ -81,4 +85,41 @@ public class FileUtils {
return sha256Hex + '.' + FileTypeUtil.getType(new ByteArrayInputStream(content));
}
/**
* 将Base64编码的字符串保存为文件
*
* @param base64String Base64编码的字符串
* @param folderPath 文件保存的文件夹路径
* @param fileName 文件名不包含扩展名
* @param extension 文件扩展名例如 "png", "jpg", "txt"
* @throws IOException 如果写入文件时发生错误
*/
public static void saveBase64ToFile(String base64String, String folderPath, String fileName, String extension) throws IOException {
// 检查文件名是否有效
if (fileName.contains("..") || fileName.contains("/") || fileName.contains("\\")) {
throw new IllegalArgumentException("Invalid file name.");
}
// 解码Base64字符串为字节数组
byte[] decodedBytes = Base64.getDecoder().decode(base64String);
// 创建文件的路径
Path folder = Paths.get(folderPath);
if (!Files.exists(folder)) {
// 如果文件夹不存在则创建它
Files.createDirectories(folder);
}
// 构建完整的文件名包括扩展名
Path filePath = folder.resolve(fileName + "." + extension);
// 使用Files.newOutputStream创建OutputStream并设置为追加模式
try (java.io.OutputStream outputStream = Files.newOutputStream(filePath, StandardOpenOption.CREATE, StandardOpenOption.WRITE)) {
outputStream.write(decodedBytes);
} catch (IOException e) {
throw e;
}
}
}

View File

@ -25,4 +25,5 @@ public class IoUtils {
return StrUtil.utf8Str(IoUtil.read(in, isClose));
}
}

View File

@ -396,7 +396,7 @@ public class ApplyformController {
AdminUserDO user = userService.getUser(getLoginUserId());
//1表示接口
if (type.equals("1")) { //土贵乌拉
if (user.getOrgId().equals("150926PDY564156")) {
Map<String, String> tokendata = new HashMap<>();
tokendata.put("appkey", "7653571505643966826");
tokendata.put("appsecret", "z8SVG1NBFY9d74LM");
@ -410,7 +410,7 @@ public class ApplyformController {
LocalDate currentDate = LocalDate.now();
Map<String, String> data = new HashMap<>();
data.put("Yiyuanid", "150926PDY564156");
data.put("Yiyuanid", user.getOrgId());
data.put("dateStart",currentDate.toString());
data.put("token", accessToken);
data.put("dateEnd", currentDate.toString());
@ -470,7 +470,7 @@ public class ApplyformController {
{
StrMsg = "暂无需要同步的数据";
}
}
} else if (type.equals("2")) //2 数据库
{
switch (apiconfigDO.getDatabaseType()) {

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.tblist.controller.admin.patientexamlist;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
@ -396,12 +397,28 @@ public class PatientexamlistController {
@Operation(summary = "获取pdf上传ftp")
public void FtpPdf(@RequestBody inspdfscreenshotVO insimagescreenshotVO) {
String base64String = insimagescreenshotVO.getImagebase();
String fileName = System.currentTimeMillis() + ".pdf";
if(insimagescreenshotVO.getModel().equals("0"))
{
// 解码Base64字符串
String base64Image = base64String.split(",")[1];
try
{
FileUtils.saveBase64ToFile(base64Image,insimagescreenshotVO.getFolderPath(),fileName.split("\\.")[0],"pdf");
}
catch (Exception ignored)
{
System.out.println("文件上传失败"+ignored.getMessage());
}
}
else
{
String ftpServer = "114.55.171.231";
int ftpPort = 21; // FTP端口默认为21
String ftpUser = "pacs";
String ftpPassword = "pacs";
String uploadPath = "/";
String fileName = System.currentTimeMillis() + ".pdf";
FTPClient ftpClient = new FTPClient();
@ -423,19 +440,7 @@ public class PatientexamlistController {
// 上传文件
boolean result = ftpClient.storeFile(uploadPath + "/" + fileName, inputStream);
if (result) {
//上传成功
//当前时间
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
AdminUserDO user = userService.getUser(getLoginUserId());
PatientexamlistSaveReqVO updateReqVO = new PatientexamlistSaveReqVO();
updateReqVO.setId(insimagescreenshotVO.getID());
updateReqVO.setPdfurl("http://114.55.171.231:48082/" + fileName);
patientexamlistService.updatePatientexamlist(updateReqVO);
} else {
System.out.println("文件上传失败");
}
// 断开连接
ftpClient.logout();
@ -453,6 +458,18 @@ public class PatientexamlistController {
}
}
}
//上传成功
//当前时间
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
AdminUserDO user = userService.getUser(getLoginUserId());
PatientexamlistSaveReqVO updateReqVO = new PatientexamlistSaveReqVO();
updateReqVO.setId(insimagescreenshotVO.getID());
updateReqVO.setPdfurl("https://pacs.gw12320.com/video/" +insimagescreenshotVO.getID()+"/"+ fileName);
patientexamlistService.updatePatientexamlist(updateReqVO);
}

View File

@ -9,4 +9,8 @@ public class inspdfscreenshotVO {
private String imagebase;
private String model;
private String folderPath;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class SaveFileBase64 {
@Schema(description = "文件保存的文件夹路径")
private String folderPath;
@Schema(description = "Base64编码的字符串")
private String imagebase;
@Schema(description = "文件名(不包含扩展名)")
private String fileName;
@Schema(description = "文件扩展名(例如 \"png\", \"jpg\", \"txt\"")
private String extension;
private String orgId;
}

View File

@ -17,5 +17,8 @@ public class insimagescreenshotVO {
private String imgDescription;
private String orgId;
//
private String model;
private String folderPath;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicomImagesDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicomSeriesDO;
import cn.iocoder.yudao.module.system.dal.dataobject.dicomworklist.DicompatientDO;
@ -14,6 +15,7 @@ import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.I
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.PatientInfoVO;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.SeriesVO;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.image.StudyVO;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.SaveFileBase64;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.insimagescreenshotVO;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.ultrasoniccom.controller.admin.ultrasonic.medicalimg.upmedicalimgVO;
@ -35,15 +37,11 @@ import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -430,17 +428,32 @@ public class ultrasonicController {
@Operation(summary = "获取图片上传ftp")
public void FtpImage(@RequestBody insimagescreenshotVO insimagescreenshotVO) {
String base64String = insimagescreenshotVO.getImagebase();
String fileName = System.currentTimeMillis() + ".jpg";
if(insimagescreenshotVO.getModel().equals("0"))
{
// 解码Base64字符串
String base64Image = base64String.split(",")[1];
try
{
FileUtils.saveBase64ToFile(base64Image,insimagescreenshotVO.getFolderPath(),fileName.split("\\.")[0],"jpg");
}
catch (Exception ignored)
{
System.out.println("文件上传失败"+ignored.getMessage());
}
}
else
{
String ftpServer = "192.168.0.110"; //114.55.171.231
int ftpPort = 21; // FTP端口默认为21
String ftpUser = "pacs";
String ftpPassword = "pacs123";
String uploadPath = "/";
String fileName = System.currentTimeMillis() + ".jpg";
FTPClient ftpClient = new FTPClient();
ftpClient.enterLocalPassiveMode();
try {
ftpClient.enterLocalPassiveMode();
// 连接FTP服务器
ftpClient.connect(ftpServer, ftpPort);
ftpClient.login(ftpUser, ftpPassword);
@ -457,33 +470,6 @@ public class ultrasonicController {
// 上传文件
boolean result = ftpClient.storeFile(uploadPath + "/" + fileName, inputStream);
if (result) {
//上传成功
//当前时间
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
AdminUserDO user = userService.getUser(getLoginUserId());
// 生成随机 UUID
UUID randomUUID = UUID.randomUUID();
medicalimgDO medicalimgDO = new medicalimgDO();
medicalimgDO.setId(randomUUID.toString());
medicalimgDO.setImgUrl("http://192.168.0.110:48082/" + fileName);
medicalimgDO.setCreatePerson("");
medicalimgDO.setCreateDate(dateTime);
medicalimgDO.setRegId(insimagescreenshotVO.getID());
if (insimagescreenshotVO.getOrgId() != null && !insimagescreenshotVO.getOrgId().trim().equals(""))
medicalimgDO.setOrgId(insimagescreenshotVO.getOrgId().trim());
else if (user != null && user.getOrgId() != null)
medicalimgDO.setOrgId(user.getOrgId());
medicalimgDO.setSelected("0");
if (insimagescreenshotVO.getImgType() == null || insimagescreenshotVO.getImgType().trim().equals(""))
medicalimgDO.setImgType("1");
else
medicalimgDO.setImgType(insimagescreenshotVO.getImgType().trim());
int count = medicalimgService.insimage(medicalimgDO);
} else {
System.out.println("文件上传失败");
}
// 断开连接
ftpClient.logout();
@ -501,7 +487,31 @@ public class ultrasonicController {
}
}
}
//上传成功
//当前时间
LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
AdminUserDO user = userService.getUser(getLoginUserId());
// 生成随机 UUID
UUID randomUUID = UUID.randomUUID();
medicalimgDO medicalimgDO = new medicalimgDO();
medicalimgDO.setId(randomUUID.toString());
medicalimgDO.setImgUrl("/video/" +insimagescreenshotVO.getID()+"/"+ fileName);
medicalimgDO.setCreatePerson("");
medicalimgDO.setCreateDate(dateTime);
medicalimgDO.setRegId(insimagescreenshotVO.getID());
if (insimagescreenshotVO.getOrgId() != null && !insimagescreenshotVO.getOrgId().trim().equals(""))
medicalimgDO.setOrgId(insimagescreenshotVO.getOrgId().trim());
else if (user != null && user.getOrgId() != null)
medicalimgDO.setOrgId(user.getOrgId());
medicalimgDO.setSelected("0");
if (insimagescreenshotVO.getImgType() == null || insimagescreenshotVO.getImgType().trim().equals(""))
medicalimgDO.setImgType("1");
else
medicalimgDO.setImgType(insimagescreenshotVO.getImgType().trim());
int count = medicalimgService.insimage(medicalimgDO);
}
@ -622,5 +632,16 @@ public class ultrasonicController {
return success("插入成功");
}
@PostMapping("/SaveFileBase64")
@Operation(summary = "base64保存文件")
public String SaveFileBase64(@RequestBody SaveFileBase64 fileBase64){
try{
String base=fileBase64.getImagebase();
FileUtils.saveBase64ToFile(base,fileBase64.getFolderPath(),fileBase64.getFileName(),fileBase64.getExtension());
return "上传成功";
} catch (Exception e) {
return "上传失败" +e.getMessage();
}
}
}

View File

@ -161,7 +161,9 @@ yudao:
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
- /admin-api/tblist/patientexamlist/addPatientExamInfo
- /admin-api/tblist/patientexamlist/GetAnalysisInfo
- /admin-api/system/jwtToken/getToken
- /admin-api/applyregistration/applyform/GetPatientPDFDcm
- /admin-api/ultrasoniccom/ultrasonic/ftpimage
websocket:
enable: true # websocket的开关
@ -177,7 +179,7 @@ yudao:
topic: ${spring.application.name}-websocket # 消息发送的 Kafka Topic
consumer-group: ${spring.application.name}-websocket-consumer # 消息发送的 Kafka Consumer Group
swagger:
title: 芋道快速开发平台
title: 开发平台
description: 提供管理后台、用户 App 的所有功能
version: ${yudao.info.version}
url: ${yudao.web.admin-ui.url}
@ -209,7 +211,9 @@ yudao:
- /admin-api/ultrasoniccom/ultrasonic/insimagescreenshot
- /admin-api/ultrasoniccom/ultrasonic/InsImageInfo
- /admin-api/tblist/patientexamlist/addPatientExamInfo
- /admin-api/tblist/patientexamlist/GetAnalysisInfo
- /admin-api/system/jwtToken/getToken
- /admin-api/applyregistration/applyform/GetPatientPDFDcm
- /admin-api/ultrasoniccom/ultrasonic/ftpimage
ignore-tables:
- system_tenant
@ -253,6 +257,7 @@ yudao:
- rep_demo_jianpiao
- tmp_report_data_1
- tmp_report_data_income
- tb_patientexamlist
sms-code: # 短信验证码相关的配置项
expire-times: 10m
send-frequency: 1m
@ -280,4 +285,7 @@ debug: false
jeecg:
jmreport:
saas-mode: tenant
#土贵乌拉 需要的配置 项目名称:/admin
server:
servlet:
context-path: /admin