bug 处理
This commit is contained in:
parent
b11ceee6a9
commit
7a47c3a2ce
2
pom.xml
2
pom.xml
@ -100,6 +100,8 @@
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
|
@ -19,8 +19,31 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.21</version> <!-- 请确认使用最新版本 -->
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>7.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.10.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ant-contrib</groupId>
|
||||
<artifactId>ant-contrib</artifactId>
|
||||
<version>1.0b3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--腾讯短信-->
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
|
@ -3,6 +3,9 @@ package com.ruoyi.script.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.data.Pictures;
|
||||
import com.github.junrar.Archive;
|
||||
import com.github.junrar.exception.RarException;
|
||||
import com.github.junrar.rarfile.FileHeader;
|
||||
import com.itextpdf.text.*;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.itextpdf.text.pdf.PdfChunk;
|
||||
@ -92,6 +95,34 @@ public class PatientScriptServiceImpl implements PatientScriptService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void unrar(String rarFilePath, String destDir) throws IOException, RarException {
|
||||
File rarFile = new File(rarFilePath);
|
||||
File destDirectory = new File(destDir);
|
||||
|
||||
if (!destDirectory.exists()) {
|
||||
destDirectory.mkdirs();
|
||||
}
|
||||
|
||||
try (Archive archive = new Archive(rarFile)) {
|
||||
FileHeader fileHeader;
|
||||
while ((fileHeader = archive.nextFileHeader()) != null) {
|
||||
if (!fileHeader.isDirectory()) {
|
||||
File outFile = new File(destDirectory, fileHeader.getFileNameString());
|
||||
File parent = outFile.getParentFile();
|
||||
if (!parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
try (OutputStream out = new FileOutputStream(outFile)) {
|
||||
archive.extractFile(fileHeader, out);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("解压文件时出错: " + fileHeader.getFileNameString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean save(PatientScript patientScript) throws IOException, InterruptedException {
|
||||
patientScript.setCreateId(1110L);
|
||||
@ -108,7 +139,12 @@ public class PatientScriptServiceImpl implements PatientScriptService {
|
||||
String unique_id = generateOtp();
|
||||
String playground = "playground"+unique_id;
|
||||
String format = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
//判断是zip还是rar
|
||||
if (patientScript.getFilePath().endsWith(".zip")){
|
||||
unzip(patientScript.getFilePath(),"/data/" +format+"/"+ playground+"/个体数据");
|
||||
}else if (patientScript.getFilePath().endsWith(".rar")){
|
||||
unrar(patientScript.getFilePath(),"/data/" +format+"/"+ playground+"/个体数据");
|
||||
}
|
||||
Map<String, Object> shMap = new LinkedHashMap<>();
|
||||
shMap.put("outPath",format+"/output-"+unique_id);
|
||||
shMap.put("filePath", patientScript.getFilePath());
|
||||
|
@ -50,7 +50,7 @@
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: {
|
||||
type: Array,
|
||||
default: () => ["zip"],
|
||||
default: () => ["zip","rar"],
|
||||
},
|
||||
// 是否显示提示
|
||||
isShowTip: {
|
||||
|
@ -120,23 +120,6 @@
|
||||
<el-form-item label="审核医生" prop="shDoctor">
|
||||
<el-input v-model="form.shDoctor" placeholder="审核医生" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="TR" prop="repetitionTime">-->
|
||||
<!-- <el-input v-model="form.repetitionTime" placeholder="TR" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<!-- <el-form-item label="扫描顺序" prop="scanningOrder">-->
|
||||
<!-- <el-select v-model="form.scanningOrder" placeholder="请选择扫描顺序">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in options"-->
|
||||
<!-- :key="item.value"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- :value="item.value">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="参考切片层数" prop="sliceNumber">-->
|
||||
<!-- <el-input-number v-model="form.sliceNumber" placeholder="参考切片层数" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="扫描文件" prop="filePath">
|
||||
<brain-upload :limit="1" v-model="form.filePath" />
|
||||
</el-form-item>
|
||||
@ -233,20 +216,8 @@
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
patientAge: [
|
||||
{
|
||||
required: true,
|
||||
message: "患者年龄不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
patientCard: [
|
||||
{
|
||||
required: true,
|
||||
message: "证件信息号不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
scanTime: [
|
||||
{
|
||||
required: true,
|
||||
@ -254,13 +225,7 @@
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
blOrder: [
|
||||
{
|
||||
required: true,
|
||||
message: "病历号不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
|
||||
scanPosition: [
|
||||
{
|
||||
required: true,
|
||||
@ -268,48 +233,6 @@
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
scanDoctor: [
|
||||
{
|
||||
required: true,
|
||||
message: "扫描医生不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
zdDoctor: [
|
||||
{
|
||||
required: true,
|
||||
message: "诊断医师不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
shDoctor: [
|
||||
{
|
||||
required: true,
|
||||
message: "审核医生不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
repetitionTime: [
|
||||
{
|
||||
required: true,
|
||||
message: "TR不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
scanningOrder: [
|
||||
{
|
||||
required: true,
|
||||
message: "扫描顺序不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
sliceNumber: [
|
||||
{
|
||||
required: true,
|
||||
message: "参考切片层数不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
filePath: [
|
||||
{
|
||||
required: true,
|
||||
|
Loading…
Reference in New Issue
Block a user