修改获取患者DCM和PDF信息接口
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 commit is contained in:
lxd 2024-11-05 19:55:26 +08:00
parent 22eeb255dc
commit 3e6291fff0
3 changed files with 90 additions and 61 deletions

View File

@ -122,4 +122,32 @@ public class FileUtils {
throw e;
}
}
public static void saveBase64ToFile2(String base64String, String folderPath, String fileName, String extension) {
//参数校验
if (fileName.contains("..") || fileName.contains("/") || fileName.contains("\\")) {
throw new IllegalArgumentException("Invalid file name.");
}
try {
byte[] decodedBytes = Base64.getDecoder().decode(base64String);
// Path folder = Paths.get(folderPath);
// if (!Files.exists(folder)) {
// Files.createDirectories(folder);
// }
// Path filePath = folder.resolve(fileName + "." + extension);
File file = new File(folderPath);
file.setWritable(true, false);
file.mkdirs();
Path filePath = Paths.get(folderPath + "/" + fileName + "." + extension);
java.io.OutputStream outputStream = Files.newOutputStream(filePath, StandardOpenOption.CREATE, StandardOpenOption.WRITE);
outputStream.write(decodedBytes);
} catch (Exception ex) {
System.out.println("----------------------FileUtils Exception------------------------");
System.out.println(ex.getMessage());
}
}
}

View File

@ -535,8 +535,11 @@ public class ApplyformController {
List<String> dcmurl = new ArrayList<>();
for (PatientexamlistDO patientexamlistDO : patientexamlistDOList) {
//条件不满足说明这个人没有进行分析 无法提供相关数据
if (patientexamlistDO.getDiagDoctor() != null && !patientexamlistDO.getDiagDoctor().isEmpty()) {
if (patientexamlistDO.getReviewDoctor() != null && !patientexamlistDO.getReviewDoctor().isEmpty()) {
//存放PDF
pdfurl.add(patientexamlistDO.getPdfurl());
//存放访问地址 一次检查一个地址
dcmurl.add("https://pacs.gw12320.com/viewdcm/?regid="+patientexamlistDO.getRegId()+"&orgId="+patientexamlistDO.getOrgId()+"&examid="+patientexamlistDO.getExamId());
}
}
if(pdfurl.isEmpty())
@ -545,8 +548,8 @@ public class ApplyformController {
}
else
{
//取这个患者的所有的dcm地址
dcmurl = dicompatientsService.GetDcmUrl(regId, orgId);
//取这个患者的所有的dcm地址 dcm地址 现在变成网页路径
// dcmurl = dicompatientsService.GetDcmUrl(regId, orgId);
medicalDataVO.setPdflist(pdfurl);
medicalDataVO.setDcm(dcmurl);
medicalDataVO.setPdf("");

View File

@ -429,17 +429,13 @@ public class ultrasonicController {
public void FtpImage(@RequestBody insimagescreenshotVO insimagescreenshotVO) {
String base64String = insimagescreenshotVO.getImagebase();
String fileName = System.currentTimeMillis() + ".jpg";
if(insimagescreenshotVO.getModel().equals("0"))
{
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());
try {
FileUtils.saveBase64ToFile2(base64Image, insimagescreenshotVO.getFolderPath(), fileName.split("\\.")[0], "jpg");
} catch (Exception ignored) {
System.out.println("文件上传失败" + ignored.getMessage());
}
}
else
@ -493,12 +489,14 @@ 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());
AdminUserDO user = null;
if (insimagescreenshotVO.getOrgId() == null || insimagescreenshotVO.getOrgId().trim().equals(""))
user = userService.getUser(getLoginUserId());
// 生成随机 UUID
UUID randomUUID = UUID.randomUUID();
medicalimgDO medicalimgDO = new medicalimgDO();
medicalimgDO.setId(randomUUID.toString());
medicalimgDO.setImgUrl("/video/" +insimagescreenshotVO.getID()+"/"+ fileName);
medicalimgDO.setImgUrl("/video/" + insimagescreenshotVO.getID() + "/" + fileName);
medicalimgDO.setCreatePerson("");
medicalimgDO.setCreateDate(dateTime);
medicalimgDO.setRegId(insimagescreenshotVO.getID());
@ -512,7 +510,7 @@ public class ultrasonicController {
else
medicalimgDO.setImgType(insimagescreenshotVO.getImgType().trim());
int count = medicalimgService.insimage(medicalimgDO);
System.out.println("----------------------44444444444----------------------");
}
@PostMapping("/InsImageInfo")
@ -634,13 +632,13 @@ public class ultrasonicController {
@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());
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();
return "上传失败" + e.getMessage();
}
}