Compare commits

...

13 Commits

Author SHA1 Message Date
18b58c0305 bug 处理 2025-03-31 22:57:50 +08:00
7a47c3a2ce bug 处理 2025-03-30 22:12:50 +08:00
zhuchunyun
b11ceee6a9 医院版本 2025-03-30 20:47:44 +08:00
c1ca68f150 bug 处理 2025-03-03 13:01:47 +08:00
0709d7be11 bug 处理 2025-03-03 12:59:22 +08:00
236e9f28c9 bug 处理 2025-03-03 12:52:38 +08:00
e575c0cf33 bug 处理 2025-03-02 23:52:50 +08:00
zhuchunyun
18e223a7b1 医院版本 2025-02-28 23:30:45 +08:00
f481156d44 bug 处理 2025-02-16 11:33:47 +08:00
a42ce876d9 bug 处理 2025-02-16 10:07:58 +08:00
9f40e901f5 bug 处理 2025-02-15 11:47:58 +08:00
8aeba6f773 Merge branch 'master' into hospital_version 2025-02-08 14:58:03 +08:00
zhuchunyun
c662bb03bc 医院版本 2025-02-06 15:43:56 +08:00
36 changed files with 1012 additions and 284 deletions

BIN
lib/aspose-slides-19.3.jar Normal file

Binary file not shown.

Binary file not shown.

0
lib/jar.txt Normal file
View File

View File

@ -28,7 +28,7 @@
<oshi.version>6.4.0</oshi.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.collections.version>3.2.2</commons.collections.version>
<poi.version>4.1.2</poi.version>
<poi.version>5.2.0</poi.version>
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
@ -100,6 +100,8 @@
<version>${poi.version}</version>
</dependency>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>

View File

@ -16,6 +16,47 @@
</description>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.21</version>
</dependency>
<!-- Maven 示例 -->
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
<version>1.5</version>
</dependency>
<!-- rar解压依赖 -->
<dependency>
<groupId>net.sf.sevenzipjbinding</groupId>
<artifactId>sevenzipjbinding</artifactId>
<version>16.02-2.01</version>
</dependency>
<dependency>
<groupId>net.sf.sevenzipjbinding</groupId>
<artifactId>sevenzipjbinding-all-platforms</artifactId>
<version>16.02-2.01</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>
@ -47,8 +88,23 @@
<artifactId>jfreechart</artifactId>
<version>1.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j-core -->
<dependency>
<groupId>aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0-jdk16</version>
</dependency>
<dependency>
<groupId>aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>19.3</version>
</dependency>
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.12.2</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>

View File

@ -83,7 +83,7 @@ public class PatientScriptController extends BaseController {
*/
@PostMapping("/exportReport")
public void exportReport(HttpServletResponse response, @RequestParam("id") Long reportId) throws Exception {
this.patientScriptService.exportReport(response,reportId);
this.patientScriptService.exportReportTest(response,reportId);
}
@PostMapping("/test")

View File

@ -72,6 +72,9 @@ public class PatientScript extends BaseEntity {
private String shDoctor;
//0否1是
private String isAll;
private String kydw;
private String fzr;
private String phone;
}

View File

@ -20,6 +20,9 @@ public interface PatientScriptService {
Boolean removeByIds(List<Long> idList);
void exportReport(HttpServletResponse response, Long reportId) throws Exception;
void exportReportTest(HttpServletResponse response, Long reportId) throws Exception;
void exportReport2(HttpServletResponse response, Long reportId) throws Exception;
}

View File

@ -1,6 +1,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.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfChunk;
@ -11,7 +14,18 @@ import com.ruoyi.script.entity.PatientScript;
import com.ruoyi.script.mapper.PatientScriptMapper;
import com.ruoyi.script.service.PatientScriptService;
import com.ruoyi.script.util.ShellUtil;
import com.ruoyi.script.util.Word2PdfUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import net.sf.sevenzipjbinding.ExtractOperationResult;
import net.sf.sevenzipjbinding.IInArchive;
import net.sf.sevenzipjbinding.SevenZip;
import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
@ -20,10 +34,10 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.List;
import java.util.concurrent.Executor;
@ -40,6 +54,7 @@ import static com.ruoyi.system.util.pdfUtil.PdfUtil.getImageFromInputStream;
* @since 2023-06-29 09:47:24
*/
@Service("patientScriptService")
@Slf4j
public class PatientScriptServiceImpl implements PatientScriptService {
@Autowired
private PatientScriptMapper scriptMapper;
@ -51,6 +66,123 @@ public class PatientScriptServiceImpl implements PatientScriptService {
return scriptMapper.selectList(patientScript);
}
/**
* 解压 ZIP 文件到指定文件夹
*
* @param zipFilePath 源文件 ZIP 路径
* @param destDir 解压的文件夹路径
* @throws IOException 如果发生 I/O 错误
*/
public static void unzip(String zipFilePath, String destDir) throws IOException {
File zipFile = new File(zipFilePath);
File destDirectory = new File(destDir);
if (!destDirectory.exists()) {
destDirectory.mkdirs();
}
try (ZipFile zip = new ZipFile(zipFile)) {
Enumeration<ZipArchiveEntry> entries = zip.getEntries();
while (entries.hasMoreElements()){
ZipArchiveEntry zipArchiveEntry = entries.nextElement();
if (!zipArchiveEntry.isDirectory()) {
File outFile = new File(destDirectory, zipArchiveEntry.getName());
File parent = outFile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
try (InputStream in = zip.getInputStream((ZipArchiveEntry) zipArchiveEntry)) {
Files.copy(in, outFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
throw new RuntimeException("解压文件时出错: " + zipArchiveEntry.getName(), e);
}
}
}
}
}
/**
* rar解压缩
* @param rarFile rar文件的全路径
* @param outPath 解压路径
* @return 压缩包中所有的文件
*/
private static String unRar(String rarFile, String outPath, String passWord) {
RandomAccessFile randomAccessFile = null;
IInArchive inArchive = null;
try {
// 第一个参数是需要解压的压缩包路径第二个参数参考JdkAPI文档的RandomAccessFile
randomAccessFile = new RandomAccessFile(rarFile, "r");
if (StringUtils.isNotBlank(passWord)) {
inArchive = SevenZip.openInArchive(null, new RandomAccessFileInStream(randomAccessFile), passWord);
} else {
inArchive = SevenZip.openInArchive(null, new RandomAccessFileInStream(randomAccessFile));
}
ISimpleInArchive simpleInArchive = inArchive.getSimpleInterface();
for (final ISimpleInArchiveItem item : simpleInArchive.getArchiveItems()) {
final int[] hash = new int[]{0};
if (!item.isFolder()) {
ExtractOperationResult result;
final long[] sizeArray = new long[1];
File outFile = new File(outPath + File.separator+ item.getPath());
File parent = outFile.getParentFile();
if ((!parent.exists()) && (!parent.mkdirs())) {
continue;
}
if (StringUtils.isNotBlank(passWord)) {
result = item.extractSlow(data -> {
try {
IOUtils.write(data, new FileOutputStream(outFile, true));
} catch (Exception e) {
e.printStackTrace();
}
hash[0] ^= Arrays.hashCode(data); // Consume data
sizeArray[0] += data.length;
return data.length; // Return amount of consumed
}, passWord);
} else {
result = item.extractSlow(data -> {
try {
IOUtils.write(data, new FileOutputStream(outFile, true));
} catch (Exception e) {
e.printStackTrace();
}
hash[0] ^= Arrays.hashCode(data); // Consume data
sizeArray[0] += data.length;
return data.length; // Return amount of consumed
});
}
if (result == ExtractOperationResult.OK) {
log.error("解压rar成功...." + String.format("%9X | %10s | %s", hash[0], sizeArray[0], item.getPath()));
} else if (StringUtils.isNotBlank(passWord)) {
log.error("解压rar成功密码错误或者其他错误...." + result);
return "password";
} else {
return "rar error";
}
}
}
} catch (Exception e) {
log.error("unRar error", e);
return e.getMessage();
} finally {
try {
inArchive.close();
randomAccessFile.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return "";
}
@Override
public Boolean save(PatientScript patientScript) throws IOException, InterruptedException {
patientScript.setCreateId(1110L);
@ -65,31 +197,38 @@ public class PatientScriptServiceImpl implements PatientScriptService {
public void run() {
if (!patientScript.getType().equals("mri")){
String unique_id = generateOtp();
String playground = "playground"+patientScript.getPatientName()+unique_id;
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+"/个体数据",null);
}
Map<String, Object> shMap = new LinkedHashMap<>();
shMap.put("outPath",format+"/output-"+unique_id);
shMap.put("filePath", patientScript.getFilePath());
shMap.put("subId",unique_id);
shMap.put("fmriFileMb",format+"/"+playground+"/preprocessed/sub001/func/sub-001_task-rest_space-MNI152NLin2009cAsym_boldref.nii");
shMap.put("playground",format+"/"+playground);
shMap.put("fmriFileMb",format+"/"+playground+"/preprocessed/sub-001/func/sub-001_task-rest_space-MNI152NLin2009cAsym_boldref.nii.gz");
shMap.put("fmriRegOutFile",format+"/output-"+unique_id+"/bold_2_struct.mat");
shMap.put("fmriFileDpp",format+"/"+playground+"/preprocessed/sub001/func/sub-001_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii");
shMap.put("fmriFileDpp",format+"/"+playground+"/preprocessed/sub-001/func/sub-001_task-rest_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz");
shMap.put("fmriR2t1OutFile",format+"/output-"+unique_id+"/reg2_Template.nii.gz");
shMap.put("smriFileMb",format+"/"+playground+"/preprocessed/sub001/anat/sub-001_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz");
shMap.put("smriOutFile",format+"/output-"+unique_id+"/anat2_Template.nii");
shMap.put("smriFileMb",format+"/"+playground+"/preprocessed/sub-001/anat/sub-001_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz");
shMap.put("smriOutFile",format+"/output-"+unique_id+"/anat2_Template.nii.gz");
String fmriOutPath = "/data/"+format+"/output-"+unique_id+"/fmriOut/";
shMap.put("fmriOutPath",fmriOutPath);
shMap.put("matrixPath","/data/"+format+"/output-"+unique_id+"/");
shMap.put("tr",patientScript.getRepetitionTime());
String shPath="/data/"+format+"/cpac"+"-"+unique_id+".sh";
String dealDataSh="/data/"+format+"/dealData"+"-"+unique_id+".sh";
String imgPath="/data/"+format+"/img"+"-"+unique_id+".sh";
String alignPath="/data/"+format+"/align"+"-"+unique_id+".py";
shMap.put("alignPath",alignPath);
shMap.put("fucDataPath",format+"/output-"+unique_id+"/reg2_Template.nii.gz");
//创建alignPy
createFile(shMap, alignPath,"alignTemplate.ftl");
//创建脚本
createFile(shMap, shPath,"cpacSh.ftl");
//创建处理数据脚本
createFile(shMap, dealDataSh,"dealData.ftl");
//创建图片生成脚本
createFile(shMap, imgPath,"imgSh.ftl");
//创建路径
@ -104,13 +243,21 @@ public class PatientScriptServiceImpl implements PatientScriptService {
} else {
System.out.println("文件夹已存在,无需再次创建!");
}
//处理数据处理格式
ShellUtil.execCmd("dos2unix "+dealDataSh);
shUtil(dealDataSh,patientScript);
shMap.put("tr",patientScript.getRepetitionTime());
//创建总脚本
createFile(shMap, shPath,"cpacSh.ftl");
//处理脚本文件格式
ShellUtil.execCmd("dos2unix "+shPath);
ShellUtil.execCmd("dos2unix "+imgPath);
String status=shUtil(shPath,patientScript);
//再处理图片的生成
//处理脚本文件格式
ShellUtil.execCmd("dos2unix "+imgPath);
ShellUtil.execCmd("sh "+imgPath);
//处理脑区信息
patientScript.setResImage("/data/"+format+"/output-"+unique_id+"/Net.jpg");
@ -852,7 +999,7 @@ public class PatientScriptServiceImpl implements PatientScriptService {
p = new Paragraph();
ph = new Phrase();
ph.add(new Chunk("---------------------------------------------------------------------------------------------------------------", titleFont));//前缀
ph.add(new Chunk("---------------------------------------------------------------------------------------------", titleFont));//前缀
p.add(ph);
p.setAlignment(Element.ALIGN_LEFT);//设置对齐方式
p.setLeading(30);
@ -876,6 +1023,159 @@ public class PatientScriptServiceImpl implements PatientScriptService {
}
@Override
public void exportReportTest(HttpServletResponse response, Long reportId) throws Exception {
PatientScript patientScript = scriptMapper.getById(reportId);
if (null==patientScript.getStatus()||patientScript.getStatus().equals("生成中")){
return;
}
String resInfo = patientScript.getResInfo();
String[] resList = resInfo.split("&*&*&");
String[] brainList ={};
//分类信息
Map<String,Integer> classMap = new HashMap<>();
String[] StrongCorrelationList ={};
String[] weakCorrelationList ={};
List<String> msgList = new ArrayList<>();
if (resInfo.contains("brain_regions:")){
String[] split = resInfo.split("&*&*&");
String replace = split[0].replace("brain_regions:", "");
brainList = replace.split(",");
}
for (String tempStr : resList) {
if (tempStr.contains("correlation_enhanced:")){
try {
String replace = tempStr.replace("correlation_enhanced:", "");
StrongCorrelationList = replace.split(",");
}catch (Exception ignored){}
}
if (tempStr.contains("correlation_weakened:")){
try {
String replace = tempStr.replace("correlation_weakened:", "");
weakCorrelationList = replace.split(",");
}catch (Exception ignored){}
}
}
for (String key : brainList) {
key = key.replaceAll(" ","");
try {
MriInfo mriInfo = scriptMapper.getMriInfo(key.trim());
if(StringUtils.isNotEmpty(mriInfo.getBrainInfo())){
if (classMap.containsKey(mriInfo.getBrainStr())){
classMap.put(mriInfo.getBrainStr(),classMap.get(mriInfo.getBrainInfo())+1);
}else {
classMap.put(mriInfo.getBrainStr(),1);
msgList.add(mriInfo.getValue());
}
}
}catch (Exception e){
}
}
// Word 模板路径
String wordTemplatePath = "/opt/mriTemp.docx";
//随机十个生成的文件名称数组
String[] fileNames =
{"output1.docx", "output2.docx", "output3.docx", "output4.docx", "output5.docx", "output6.docx", "output7.docx", "output8.docx", "output9.docx", "output10.docx"};
//随机一个名字
String fileName = fileNames[new Random().nextInt(fileNames.length)];
String outPath = "/opt/"+fileName;
// 占位符和实际值的映射
Map<String, Object> placeholders = new HashMap<>();
placeholders.put("patientName", patientScript.getPatientName());
placeholders.put("patientSex", patientScript.getPatientSex());
placeholders.put("patientAge", patientScript.getPatientSex());
placeholders.put("patientCard", patientScript.getPatientCard());
placeholders.put("blOrder", patientScript.getBlOrder());
placeholders.put("scanPosition", patientScript.getScanPosition());
placeholders.put("scanDoctor", patientScript.getScanDoctor());
placeholders.put("scanTime", DateUtil.format(patientScript.getScanTime(),"yyyy年MM月dd日"));
// 图片文件
placeholders.put("image1", Pictures.ofLocal(patientScript.getResImage()).size(260, 260).create());
// 图片文件
placeholders.put("image2", Pictures.ofLocal(patientScript.getResImage().replace("Net","Net2")).size(260, 260).create());
// 图片文件
placeholders.put("image3", Pictures.ofLocal(patientScript.getResImage().replace("Net","Net3")).size(260, 260).create());
// 图片文件
placeholders.put("image4", Pictures.ofLocal(patientScript.getResImage().replace("Net","Net4")).size(260, 260).create());
placeholders.put("kydw", Optional.ofNullable(patientScript.getKydw()).orElse(" ")+" ");
placeholders.put("fzr", Optional.ofNullable(patientScript.getFzr()).orElse(" ")+" ");
placeholders.put("phone", Optional.ofNullable(patientScript.getPhone()).orElse(" ")+" ");
String brainInfo = "";
for (int i = 0; i < brainList.length; i++) {
if (i==brainList.length-1){
brainInfo= brainInfo+brainList[i];
}else {
brainInfo= brainInfo+brainList[i]+"\n";
}
}
placeholders.put("brainInfo",brainInfo);
String strongJoinInfo = "";
for (int i = 0; i < StrongCorrelationList.length; i++) {
if (i==StrongCorrelationList.length-1){
strongJoinInfo= strongJoinInfo+StrongCorrelationList[i];
}else {
strongJoinInfo= strongJoinInfo+StrongCorrelationList[i]+"\n";
}
}
String weakJoinInfo = "";
for (int i = 0; i < weakCorrelationList.length; i++) {
if (i==weakCorrelationList.length-1){
weakJoinInfo= weakJoinInfo+weakCorrelationList[i];
}else {
weakJoinInfo= weakJoinInfo+weakCorrelationList[i]+"\n";
}
}
placeholders.put("strongJoinInfo",strongJoinInfo);
placeholders.put("weakJoinInfo",weakJoinInfo);
final String[] diagInfo = {"1.大脑解剖区域分布:"};
classMap.forEach((item, index)->{
diagInfo[0] = diagInfo[0] +index+"个属于"+item+"";
});
int idx = diagInfo[0].lastIndexOf("");
diagInfo[0] = diagInfo[0].substring(0,idx);
diagInfo[0]=diagInfo[0]+""+"\n2.个体化大脑影像学差异的脑区功能解读: \n";
for (int i = 0; i < msgList.size(); i++) {
diagInfo[0]= diagInfo[0]+" "+(i+1)+") "+msgList.get(i)+"\n";
}
placeholders.put("diagInfo", diagInfo[0]);
placeholders.put("zdDoctor", patientScript.getZdDoctor());
placeholders.put("shDoctor", patientScript.getShDoctor());
try {
// 文件操作
XWPFTemplate template = XWPFTemplate.compile(new File(wordTemplatePath)).render(
placeholders);
template.writeAndClose(Files.newOutputStream(Paths.get(outPath)));
try {
Word2PdfUtil.wordConvertPdfFile(outPath,response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
} catch (IOException e ) {
e.printStackTrace();
}
}
/**
* 生成六位随机数字
*/
@ -895,5 +1195,14 @@ public class PatientScriptServiceImpl implements PatientScriptService {
}
public static void main(String[] args) {
try {
unRar("D:\\elevator-web\\WX-mb.rar", "D:\\elevator-web\\output",null);
System.out.println("解压成功!");
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.script.util;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
public class ConvertToMultipartFile implements MultipartFile {
private byte[] fileBytes;
String name;
String originalFilename;
String contentType;
boolean isEmpty;
long size;
public ConvertToMultipartFile(byte[] fileBytes, String name, String originalFilename, String contentType,
long size) {
this.fileBytes = fileBytes;
this.name = name;
this.originalFilename = originalFilename;
this.contentType = contentType;
this.size = size;
this.isEmpty = false;
}
@Override
public String getName() {
return name;
}
@Override
public String getOriginalFilename() {
return originalFilename;
}
@Override
public String getContentType() {
return contentType;
}
@Override
public boolean isEmpty() {
return isEmpty;
}
@Override
public long getSize() {
return size;
}
@Override
public byte[] getBytes() throws IOException {
return fileBytes;
}
@Override
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(fileBytes);
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
new FileOutputStream(dest).write(fileBytes);
}
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.script.util;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.script.entity.PatientScript;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
@ -11,15 +13,26 @@ public class ShellUtil {
System.out.println("commandStr: " + commandStr);
ProcessBuilder processBuilder = new ProcessBuilder(commandStr);
Process process = processBuilder.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
if (line.contains("brain_regions")&&line.contains("correlation")){
patientScript.setResInfo(line);
if (line.contains("\"tr\"")&&line.contains("{")&&line.contains("}")){
System.out.println(line+"tr11111111************************************************************");
JSONObject jsonObject = JSONObject.parseObject(line);
patientScript.setRepetitionTime(jsonObject.get("tr").toString());
}
if (line.contains("brain_regions")||line.contains("correlation")){
String resInfo1 = patientScript.getResInfo();
if (StringUtils.isEmpty(resInfo1)){
resInfo1=line;
}else{
resInfo1=resInfo1+"&*&*&"+line;
}
patientScript.setResInfo(resInfo1);
}
if (line.contains("result===")){
System.out.println(line+"result1************************************************************");
if (line.contains("1")){
@ -28,14 +41,6 @@ public class ShellUtil {
resInfo= "正常";
}
}
if (line.contains("top n connect")){
System.out.println(line+"top n connect************************************************************");
if (line.contains("1")){
resInfo= "异常";
}else {
resInfo= "正常";
}
}
}
@ -53,15 +58,25 @@ public class ShellUtil {
try {
proc = run.exec(cmd, null, null);
in = proc.getInputStream();
br = new BufferedReader(new InputStreamReader(in));
String result;
while ((result = br.readLine()) != null) {
System.out.println("job result [" + result + "]");
// 获取日志流
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line2;
while ((line2 = reader.readLine()) != null) {
// 打印日志
System.err.println("log:"+line2);
}
// 获取错误流
BufferedReader errorReader = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String line;
while ((line = errorReader.readLine()) != null) {
// 打印错误流的内容
System.err.println("error:"+line);
}
proc.waitFor();
// 等待进程结束并获取退出码可选
int exitCode = proc.waitFor();
System.out.println("Exited with code: " + exitCode);
} catch (Exception e) {
e.printStackTrace();
} finally {

View File

@ -0,0 +1,132 @@
package com.ruoyi.script.util;
import com.aspose.words.*;
import java.io.*;
/**
* word转pdf工具类
*
* @author shmily
*/
public class Word2PdfUtil {
/**
* 许可证字符串(可以放到resource下的xml文件中也可)
*/
private static final String LICENSE = "<License>" +
"<Data>" +
"<Products><Product>Aspose.Total for Java</Product><Product>Aspose.Words for Java</Product></Products>" +
"<EditionType>Enterprise</EditionType>" +
"<SubscriptionExpiry>20991231</SubscriptionExpiry>" +
"<LicenseExpiry>20991231</LicenseExpiry>" +
"<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>" +
"</Data>" +
"<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>" +
"</License>";
/**
* 设置 license 去除水印
*/
private static void setLicense() {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(LICENSE.getBytes());
License license = new License();
try {
license.setLicense(byteArrayInputStream);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* word pdf 生成至指定路径pdf为空则上传至word同级目录
*
* @param wordPath word文件路径
* @param pdfPath pdf文件路径
*/
public static void wordConvertPdfFile(String wordPath, OutputStream outputStream) {
try {
setLicense();
Document doc = new Document(wordPath);
// 调整页边距
PageSetup pageSetup = doc.getFirstSection().getPageSetup();
pageSetup.setLeftMargin(72); // 1 英寸
pageSetup.setRightMargin(72); // 1 英寸
pageSetup.setTopMargin(72); // 1 英寸
pageSetup.setBottomMargin(72); // 1 英寸
// 调整行间距
ParagraphCollection paragraphs = doc.getFirstSection().getBody().getParagraphs();
// 指定字体和字号
for (Paragraph paragraph : paragraphs) {
for (Run run : paragraph.getRuns()) {
Font font = run.getFont();
font.setName("Arial");
}
}
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setEmbedFullFonts(false); // 不嵌入完整字体
pdfSaveOptions.setEmbedStandardWindowsFonts(true); // 嵌入标准Windows字体
pdfSaveOptions.setTextCompression(PdfTextCompression.FLATE); // 使用FLATE压缩文本
pdfSaveOptions.setJpegQuality(100); // 设置JPEG图像质量为90
pdfSaveOptions.setImageCompression(PdfImageCompression.JPEG); // 使用JPEG压缩图像
doc.save(outputStream, pdfSaveOptions);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* word pdf 生成byte字节流
*
* @param wordPath word所在的目录地址
* @return
*/
public static byte[] wordConvertPdfByte(String wordPath) {
ByteArrayOutputStream fileOutputStream = null;
try {
setLicense();
fileOutputStream = new ByteArrayOutputStream();
Document doc = new Document(wordPath);
doc.save(fileOutputStream, SaveFormat.PDF);
return fileOutputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
assert fileOutputStream != null;
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
/**
* 获取 生成的 pdf 文件路径默认与源文件同一目录
*
* @param wordPath word文件
* @return 生成的 pdf 文件
*/
private static String getPdfFilePath(String wordPath) {
int lastIndexOfPoint = wordPath.lastIndexOf(".");
String pdfFilePath = "";
if (lastIndexOfPoint > -1) {
pdfFilePath = wordPath.substring(0, lastIndexOfPoint);
}
return pdfFilePath + ".pdf";
}
}

View File

@ -0,0 +1,91 @@
package com.ruoyi.script.util;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import javax.servlet.ServletOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WordToPdfConverter {
public static void main(String[] args) {
// // Word 模板路径
// String wordTemplatePath = "template.docx";
// // 输出 PDF 路径
// String pdfOutputPath = "output.pdf";
//
// // 占位符和实际值的映射
// Map<String, String> placeholders = new HashMap<>();
// placeholders.put("${name}", "John Doe");
// placeholders.put("${date}", "2023-10-15");
// placeholders.put("${description}", "This is a sample description.");
//
// try {
// // 读取 Word 模板
// XWPFDocument document = new XWPFDocument(new FileInputStream(wordTemplatePath));
//
// // 替换占位符
// replacePlaceholders(document, placeholders);
//
// // 将内容写入 PDF
//// convertToPdf(document, pdfOutputPath);
//
// System.out.println("PDF generated successfully!");
//
// } catch (IOException | DocumentException e) {
// e.printStackTrace();
// }
}
/**
* 替换 Word 文档中的占位符
*/
public static void replacePlaceholders(XWPFDocument document, Map<String, String> placeholders) {
for (XWPFParagraph paragraph : document.getParagraphs()) {
List<XWPFRun> runs = paragraph.getRuns();
if (runs != null) {
for (XWPFRun run : runs) {
String text = run.getText(0);
if (text != null) {
for (Map.Entry<String, String> entry : placeholders.entrySet()) {
if (text.contains(entry.getKey())) {
text = text.replace(entry.getKey(), entry.getValue());
run.setText(text, 0);
}
}
}
}
}
}
}
/**
* Word 文档内容写入 PDF
*/
public static void convertToPdf(XWPFDocument document, ServletOutputStream servletOutputStream) throws DocumentException, IOException {
Document pdfDocument = new Document();
PdfWriter.getInstance(pdfDocument, servletOutputStream);
pdfDocument.open();
// Word 文档的每一段内容写入 PDF
for (XWPFParagraph paragraph : document.getParagraphs()) {
String text = paragraph.getText();
if (text != null && !text.isEmpty()) {
pdfDocument.add(new Paragraph(text));
}
}
pdfDocument.close();
}
}

View File

@ -0,0 +1,39 @@
package com.ruoyi.script.util;
import lombok.var;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException;
import java.io.InputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class WordToPdfConverter2 {
public static void main(String[] args) {
// 模板文件路径相对于 resources 目录
String templatePath = "static/mriTemp.docx";
try (InputStream inputStream = WordToPdfConverter.class.getClassLoader().getResourceAsStream(templatePath)) {
if (inputStream == null) {
System.err.println("模板文件未找到: " + templatePath);
return;
}
// 读取 Word 模板
XWPFDocument document = new XWPFDocument(inputStream);
// 打印文档内容测试用
for (var paragraph : document.getParagraphs()) {
System.out.println(paragraph.getText());
}
System.out.println("模板读取成功!");
} catch (NotOfficeXmlFileException e) {
System.err.println("文件格式不正确,请确保是 .docx 文件: " + e.getMessage());
} catch (IOException e) {
System.err.println("读取文件时发生错误: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,71 @@
package com.ruoyi.script.util;
import com.deepoove.poi.XWPFTemplate;
import com.documents4j.api.DocumentType;
import com.documents4j.api.IConverter;
import com.documents4j.job.LocalConverter;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
public class WorldToPdf {
/**
* 在Word模版中写入指定内容
* @param filePath 模版文件地址
* @param targetPath 生成文件的目标地址
* @param map 填充内容
* @throws IOException
*/
public static void writForTemplate(String filePath, String targetPath, Map<String,Object> map) throws IOException {
XWPFTemplate template = XWPFTemplate.compile(filePath).render(map);
template.writeAndClose(Files.newOutputStream(Paths.get(targetPath)));
}
/**
*
* @param wordPath word 文件路径
* @param pdfPath pdf 输出路径
* @throws IOException
*/
public static void wordConvertPdf(String wordPath, OutputStream outputStream) throws IOException {
try {
// // Load the Word document
// WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File(wordPath));
//
//
// Docx4J.toPDF(wordMLPackage, outputStream);
//
// System.out.println("Word document converted to PDF successfully.");
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @param wordPath word 文件路径
* @param pdfPath pdf 输出路径
* @throws IOException
*/
public static void wordConvertPdfs(String wordPath, String pdfPath) throws IOException {
InputStream wordInputStream = Files.newInputStream(Paths.get(wordPath));
// 转成 pdf
OutputStream outputStream = Files.newOutputStream(Paths.get(pdfPath));
IConverter converter = LocalConverter.builder().build();
converter.convert(wordInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
converter.shutDown();
}
// 文件转换
// 文件转换
}

View File

@ -45,7 +45,7 @@ import java.util.concurrent.locks.ReentrantLock;
@Slf4j
public class NotifyController {
@Resource
private WechatPayConfig wechatPayConfig;
@Autowired
@ -53,8 +53,7 @@ public class NotifyController {
@Autowired
private UserPayInfoService payInfoService;
@Resource
private Verifier verifier;
private final ReentrantLock lock = new ReentrantLock();

View File

@ -16,7 +16,7 @@ import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.UserPayInfoService;
import com.ruoyi.system.utils.WechatPayConfig;
import com.ruoyi.system.utils.WechatPayRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -44,11 +44,10 @@ import java.util.*;
@Slf4j
public class PayController {
@Resource
private WechatPayConfig wechatPayConfig;
@Resource
private WechatPayRequest wechatPayRequest;
@Autowired
private ISysConfigService configService;
@Autowired
@ -141,7 +140,7 @@ public class PayController {
params.put("scene_info", sceneInfoMap);
String paramsStr = JSON.toJSONString(params);
log.info("请求参数 ===> {}" + paramsStr);
String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi",paramsStr);
String resStr = "121212";
Map<String, Object> resMap = JSONObject.parseObject(resStr, new TypeReference<Map<String, Object>>(){});
Map<String, Object> signMap = paySignMsg(resMap, WechatPayUrlEnum.JSAPI.getType());
//增加购买信息

View File

@ -49,10 +49,9 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
private DeptBuyRecordMapper deptBuyRecordMapper;
@Autowired
private IPurchasePackageService purchasePackageService;
@Resource
private WechatPayConfig wechatPayConfig;
@Resource
private WechatPayRequest wechatPayRequest;
// @Resource
// private WechatPayRequest wechatPayRequest;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
@ -193,8 +192,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
DeptBuyRecord orderInfo = this.selectDeptBuyRecordById(orderId);
// 统一参数封装
Map<String, Object> params = new HashMap<>(8);
params.put("appid", wechatPayConfig.getAppId());
params.put("mchid", wechatPayConfig.getMchId());
params.put("description", "问卷调查购买费用");
params.put("out_trade_no", orderInfo.getOrderNo());
params.put("notify_url", "https://www.xishuibeishan.com/asdProject/system/buyRecord/payNotify");
@ -205,7 +203,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
amountMap.put("currency", "CNY");
params.put("amount", amountMap);
String paramsStr = JSON.toJSONString(params);
String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/native",paramsStr);
String resStr = "12121";
Map<String, Object> resMap = JSONObject.parseObject(resStr, new TypeReference<Map<String, Object>>(){});
return resMap;
}
@ -214,8 +212,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
DeptBuyRecord orderInfo = this.selectDeptBuyRecordById(orderId);
// 统一参数封装
Map<String, Object> params = new HashMap<>(8);
params.put("appid", wechatPayConfig.getAppId());
params.put("mchid", wechatPayConfig.getMchId());
params.put("description", "问卷调查续费");
params.put("out_trade_no", orderInfo.getOrderNo());
params.put("notify_url", "https://www.xishuibeishan.com/asdProject/system/buyRecord/chargeNotify");
@ -226,7 +223,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
amountMap.put("currency", "CNY");
params.put("amount", amountMap);
String paramsStr = JSON.toJSONString(params);
String resStr = wechatPayRequest.wechatHttpPost("https://api.mch.weixin.qq.com/v3/pay/transactions/native",paramsStr);
String resStr = "12121";
Map<String, Object> resMap = JSONObject.parseObject(resStr, new TypeReference<Map<String, Object>>(){});
return resMap;
}
@ -240,7 +237,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
@Override
public Map<String, String> payNotify(JSONObject jsonObject) {
try {
String key = wechatPayConfig.getApiV3Key();
String key = "1111";
String json = jsonObject.toString();
String associated_data = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.associated_data");
String ciphertext = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.ciphertext");
@ -318,7 +315,7 @@ public class DeptBuyRecordServiceImpl implements IDeptBuyRecordService
@Override
public Map<String, String> chargeNotify(JSONObject jsonObject) {
try {
String key = wechatPayConfig.getApiV3Key();
String key = "1212";
String json = jsonObject.toString();
String associated_data = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.associated_data");
String ciphertext = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.ciphertext");

View File

@ -27,10 +27,10 @@ import java.security.PrivateKey;
* @Author:
* @Description:
**/
@Component
//@Component
@Data
@Slf4j
@ConfigurationProperties(prefix = "wxpay")
//@ConfigurationProperties(prefix = "wxpay")
public class WechatPayConfig {
/**
* 应用编号
@ -92,69 +92,69 @@ public class WechatPayConfig {
return PemUtil.loadPrivateKey(inputStream);
}
/**
* 获取证书管理器实例
* @return
*/
@Bean
public Verifier getVerifier() throws GeneralSecurityException, IOException, HttpCodeException, NotFoundException {
log.info("获取证书管理器实例");
//获取商户私钥
PrivateKey privateKey = getPrivateKey(keyPemPath);
//私钥签名对象
PrivateKeySigner privateKeySigner = new PrivateKeySigner(serialNo, privateKey);
//身份认证对象
WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(mchId, privateKeySigner);
// 使用定时更新的签名验证器不需要传入证书
CertificatesManager certificatesManager = CertificatesManager.getInstance();
certificatesManager.putMerchant(mchId,wechatPay2Credentials,apiV3Key.getBytes(StandardCharsets.UTF_8));
return certificatesManager.getVerifier(mchId);
}
// /**
// * 获取证书管理器实例
// * @return
// */
// @Bean
// public Verifier getVerifier() throws GeneralSecurityException, IOException, HttpCodeException, NotFoundException {
//
// log.info("获取证书管理器实例");
//
// //获取商户私钥
// PrivateKey privateKey = getPrivateKey(keyPemPath);
//
// //私钥签名对象
// PrivateKeySigner privateKeySigner = new PrivateKeySigner(serialNo, privateKey);
//
// //身份认证对象
// WechatPay2Credentials wechatPay2Credentials = new WechatPay2Credentials(mchId, privateKeySigner);
//
// // 使用定时更新的签名验证器不需要传入证书
// CertificatesManager certificatesManager = CertificatesManager.getInstance();
// certificatesManager.putMerchant(mchId,wechatPay2Credentials,apiV3Key.getBytes(StandardCharsets.UTF_8));
//
// return certificatesManager.getVerifier(mchId);
// }
/**
* 获取支付http请求对象
* @param verifier
* @return
*/
@Bean(name = "wxPayClient")
public CloseableHttpClient getWxPayClient(Verifier verifier) {
// /**
// * 获取支付http请求对象
// * @param verifier
// * @return
// */
// @Bean(name = "wxPayClient")
// public CloseableHttpClient getWxPayClient(Verifier verifier) {
//
// //获取商户私钥
// PrivateKey privateKey = getPrivateKey(keyPemPath);
//
// WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
// .withMerchant(mchId, serialNo, privateKey)
// .withValidator(new WechatPay2Validator(verifier));
//
// // 通过WechatPayHttpClientBuilder构造的HttpClient会自动的处理签名和验签并进行证书自动更新
// return builder.build();
// }
//获取商户私钥
PrivateKey privateKey = getPrivateKey(keyPemPath);
WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
.withMerchant(mchId, serialNo, privateKey)
.withValidator(new WechatPay2Validator(verifier));
// 通过WechatPayHttpClientBuilder构造的HttpClient会自动的处理签名和验签并进行证书自动更新
return builder.build();
}
/**
* 获取HttpClient无需进行应答签名验证跳过验签的流程
*/
@Bean(name = "wxPayNoSignClient")
public CloseableHttpClient getWxPayNoSignClient(){
//获取商户私钥
PrivateKey privateKey = getPrivateKey(keyPemPath);
//用于构造HttpClient
WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
//设置商户信息
.withMerchant(mchId, serialNo, privateKey)
//无需进行签名验证通过withValidator((response) -> true)实现
.withValidator((response) -> true);
// 通过WechatPayHttpClientBuilder构造的HttpClient会自动的处理签名和验签并进行证书自动更新
return builder.build();
}
// /**
// * 获取HttpClient无需进行应答签名验证跳过验签的流程
// */
// @Bean(name = "wxPayNoSignClient")
// public CloseableHttpClient getWxPayNoSignClient(){
//
// //获取商户私钥
// PrivateKey privateKey = getPrivateKey(keyPemPath);
//
// //用于构造HttpClient
// WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
// //设置商户信息
// .withMerchant(mchId, serialNo, privateKey)
// //无需进行签名验证通过withValidator((response) -> true)实现
// .withValidator((response) -> true);
//
// // 通过WechatPayHttpClientBuilder构造的HttpClient会自动的处理签名和验签并进行证书自动更新
// return builder.build();
// }
}

View File

@ -19,7 +19,7 @@ import java.io.IOException;
* @Author:
* @Description:
**/
@Component
@Slf4j
public class WechatPayRequest {
@Resource

View File

@ -13,8 +13,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
/**
@ -61,4 +64,26 @@ public class OverdueController {
}
return R.ok("激活成功");
}
// 加密算法
private static final String ALGORITHM = "AES";
// 常量密钥
private static final String SECRET_KEY = "jinanshandongdianliangxinxijishu";
public static void main(String[] args) throws Exception {
String data = "山东点亮20290311175500信息技术";
SecretKeySpec keySpec = generateKey();
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
byte[] encryptedBytes = cipher.doFinal(data.getBytes());
System.err.println(Base64.getEncoder().encodeToString(encryptedBytes));
}
// 生成密钥
private static SecretKeySpec generateKey() throws Exception {
byte[] keyBytes = SECRET_KEY.getBytes();
return new SecretKeySpec(keyBytes, ALGORITHM);
}
}

View File

@ -6,13 +6,13 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://81.70.190.166:3306/asd-project?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://127.0.0.1:3306/asd-project?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: qqzcy@1014
# url: jdbc:mysql://81.70.190.166:3306/asd-project?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://81.70.190.166:3306/asd-project?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: qqzcy@1014
username: mysqlRoot
password: QQzcy@1014
# 从库数据源
# slave:
# # 从数据源开关/默认关闭

View File

@ -64,9 +64,9 @@ spring:
servlet:
multipart:
# 单个文件大小
max-file-size: 50MB
max-file-size: 5000000MB
# 设置总上传的文件大小
max-request-size: 100MB
max-request-size: 5000000MB
# 服务模块
devtools:
restart:

View File

@ -29,6 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="createId" column="create_id" />
<result property="isAll" column="is_all" />
<result property="kydw" column="kydw" />
<result property="fzr" column="fzr"/>
<result property="phone" column="phone"/>
</resultMap>
<update id="updateStatus" parameterType="com.ruoyi.script.entity.PatientScript">
@ -53,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="scanDoctor != null and scanDoctor != ''"> and scan_doctor like concat('%',#{scanDoctor},'%') </if>
<if test="isAll != null and isAll != ''"> and is_all= #{isAll} </if>
</where>
order by scan_time desc
order by create_time desc
</select>
<select id="getById" resultMap="PatientScriptResult">
select * from patient_script

View File

@ -1,28 +1,6 @@
#!/bin/bash
echo "Hello, output-43207!"
cd /data
source ~/.bashrc
mkdir ${playground}
echo "复制源文件到指定个体下"
cp ${filePath} ${playground}/file.zip
echo "解压源文件"
cd ${playground}
unzip file.zip
cd /data
echo "执行源文件处理脚本"
python dealTest.py --base_dir ${playground} --output_dir ${playground}/BIDS_output
echo "通过源文件进行二次处理"
fmriprep-docker ${playground}/BIDS_output/sub-001 ${playground}/preprocessed/ participant --participant-label 001 --fs-license-file /data/license.txt --fs-no-reconall
echo "激活py环境"
export PYTHONPATH=/usr/local/python3/lib/python3.8/site-packages:$PYTHONPATH
echo "cpac handle end!"
conda activate myenv
export PYTHONPATH=/root/anaconda3/envs/myenv/lib/python3.7/site-packages:$PYTHONPATH
python ${alignPath}

View File

@ -0,0 +1,10 @@
#!/bin/bash
cd /data
cd /data
echo "执行源文件处理脚本"
python dealTest.py --base_dir ${playground} --output_dir ${playground}/BIDS_output --json_dir ${playground}/BIDS_output/sub-001/func/
rm -rf ./${playground}/BIDS_output/config.json
cp ./README ${playground}/BIDS_output/
echo "通过源文件进行二次处理"
docker run --rm -e DOCKER_VERSION_8395080871=27.3.1 -v /data/license.txt:/opt/freesurfer/license.txt:ro -v /data/${playground}/BIDS_output:/data:ro -v /data/${playground}/preprocessed:/out nipreps/fmriprep:23.2.3 /data /out participant --participant-label 001 --fs-no-reconall

View File

@ -1,8 +1,7 @@
#!/bin/bash
echo "Hello, output-43207!"
source ~/.bashrc
cd ${matrixPath}
rmatlab -nodesktop -nodisplay -r rtmalbFile
matlab -nodesktop -nodisplay -r rtmalbFile
echo "main handle end!"

Binary file not shown.

View File

@ -52,13 +52,13 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- 动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
@ -83,7 +83,17 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>
<!-- word 转 pdf -->
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-local</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.documents4j</groupId>
<artifactId>documents4j-transformer-msoffice-word</artifactId>
<version>1.0.3</version>
</dependency>
<!-- yml解析器 -->
<dependency>
<groupId>org.yaml</groupId>
@ -133,5 +143,8 @@
</dependency>
</dependencies>
</project>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

View File

@ -5,13 +5,14 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.BigDecimal;
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import com.ruoyi.common.utils.poi.ExcelHandlerAdapter;
/**
* 自定义导出Excel数据注解
*
*
* @author ruoyi
*/
@Retention(RetentionPolicy.RUNTIME)
@ -184,4 +185,4 @@ public @interface Excel
return this.value;
}
}
}
}

View File

@ -26,7 +26,7 @@ public class FileUploadUtils
/**
* 默认大小 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
public static final long DEFAULT_MAX_SIZE = 50000 * 1024 * 1024;
/**
* 默认的文件名最大长度 100
@ -206,10 +206,6 @@ public class FileUploadUtils
throws FileSizeLimitExceededException, InvalidExtensionException
{
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE)
{
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
String fileName = file.getOriginalFilename();
String extension = getExtension(file);

View File

@ -87,7 +87,7 @@ import com.ruoyi.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
*
* @author ruoyi
*/
public class ExcelUtil<T>
@ -279,7 +279,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @return 转换后集合
*/
@ -290,7 +290,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @param titleNum 标题占用行数
* @return 转换后集合
@ -302,7 +302,7 @@ public class ExcelUtil<T>
/**
* 对excel表单指定表格索引名转换成list
*
*
* @param sheetName 表格索引名
* @param titleNum 标题占用行数
* @param is 输入流
@ -482,7 +482,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
@ -494,7 +494,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @param title 标题
@ -508,7 +508,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
@ -521,7 +521,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
@ -538,7 +538,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
@ -549,7 +549,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
@ -562,7 +562,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
@ -573,7 +573,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
@ -588,7 +588,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public void exportExcel(HttpServletResponse response)
@ -610,7 +610,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public AjaxResult exportExcel()
@ -678,7 +678,7 @@ public class ExcelUtil<T>
/**
* 填充excel数据
*
*
* @param index 序号
* @param row 单元格行
*/
@ -749,7 +749,7 @@ public class ExcelUtil<T>
/**
* 创建表格样式
*
*
* @param wb 工作薄对象
* @return 样式列表
*/
@ -802,7 +802,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格头样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@ -835,7 +835,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格列样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@ -897,7 +897,7 @@ public class ExcelUtil<T>
/**
* 设置单元格信息
*
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
@ -1061,7 +1061,7 @@ public class ExcelUtil<T>
/**
* 设置 POI XSSFSheet 单元格提示或选择框
*
*
* @param sheet 表单
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@ -1098,7 +1098,7 @@ public class ExcelUtil<T>
/**
* 设置某些列的值只能输入预制的数据,显示下拉框兼容超出一定数量的下拉框.
*
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@ -1150,7 +1150,7 @@ public class ExcelUtil<T>
/**
* 解析导出值 0=,1=,2=未知
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
@ -1187,7 +1187,7 @@ public class ExcelUtil<T>
/**
* 反向解析值 =0,=1,未知=2
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
@ -1224,7 +1224,7 @@ public class ExcelUtil<T>
/**
* 解析字典值
*
*
* @param dictValue 字典值
* @param dictType 字典类型
* @param separator 分隔符
@ -1237,7 +1237,7 @@ public class ExcelUtil<T>
/**
* 反向解析值字典值
*
*
* @param dictLabel 字典标签
* @param dictType 字典类型
* @param separator 分隔符
@ -1250,7 +1250,7 @@ public class ExcelUtil<T>
/**
* 数据处理器
*
*
* @param value 数据值
* @param excel 数据注解
* @return
@ -1327,7 +1327,7 @@ public class ExcelUtil<T>
/**
* 获取下载路径
*
*
* @param filename 文件名称
*/
public String getAbsoluteFile(String filename)
@ -1343,7 +1343,7 @@ public class ExcelUtil<T>
/**
* 获取bean中的属性值
*
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
@ -1374,7 +1374,7 @@ public class ExcelUtil<T>
/**
* 以类的属性的get方法方法形式获取值
*
*
* @param o
* @param name
* @return value
@ -1480,7 +1480,7 @@ public class ExcelUtil<T>
/**
* 创建工作表
*
*
* @param sheetNo sheet数量
* @param index 序号
*/
@ -1497,7 +1497,7 @@ public class ExcelUtil<T>
/**
* 获取单元格值
*
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
@ -1557,7 +1557,7 @@ public class ExcelUtil<T>
/**
* 判断是否是空行
*
*
* @param row 判断的行
* @return
*/
@ -1634,8 +1634,8 @@ public class ExcelUtil<T>
XSSFPicture pic = (XSSFPicture) shape;
XSSFClientAnchor anchor = pic.getPreferredSize();
CTMarker ctMarker = anchor.getFrom();
String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
sheetIndexPicMap.put(picIndex, pic.getPictureData());
// String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol();
// sheetIndexPicMap.put(picIndex, pic.getPictureData());
}
}
}
@ -1645,7 +1645,7 @@ public class ExcelUtil<T>
/**
* 格式化不同类型的日期对象
*
*
* @param dateFormat 日期格式
* @param val 被格式化的日期对象
* @return 格式化后的日期字符
@ -1711,7 +1711,7 @@ public class ExcelUtil<T>
/**
* 获取对象的子列表方法
*
*
* @param name 名称
* @param pojoClass 类对象
* @return 子列表方法

View File

@ -6,5 +6,5 @@ public interface Constants {
// 常量密钥
String SECRET_KEY = "jinanshandongdianliangxinxijishu";
//密钥存储文件地址
String KEY_FILE_PATH = "E:/overdue.txt";
}
String KEY_FILE_PATH = "/opt/overdue.txt";
}

View File

@ -45,12 +45,12 @@
// (MB)
fileSize: {
type: Number,
default: 50,
default: 50000000,
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["zip"],
default: () => ["zip","rar"],
},
//
isShowTip: {

View File

@ -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,
@ -390,13 +313,13 @@
if (this.form.recordId != null) {
updateRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
//this.open = false;
this.getList();
});
} else {
addRecord(this.form).then(response => {
this.$modal.msgSuccess("提交成功,请耐心等待结果");
this.open = false;
//this.open = false;
this.getList();
});
}