Merge remote-tracking branch 'origin/hospital_version' into hospital_version

This commit is contained in:
13405411873 2025-05-05 23:20:13 +08:00
commit f801b8d517
5 changed files with 97 additions and 91 deletions

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.script.entity.PatientScript;
import com.ruoyi.script.service.PatientScriptService;
import com.ruoyi.script.util.ShellUtil;
import freemarker.template.TemplateException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -50,7 +51,7 @@ public class PatientScriptController2 extends BaseController {
* @return 新增结果
*/
@PostMapping("/add")
public AjaxResult insert(@RequestBody PatientScript patientScript) throws IOException, InterruptedException {
public AjaxResult insert(@RequestBody PatientScript patientScript) throws IOException, InterruptedException, TemplateException {
patientScript.setIsAll("0");
return toAjax(this.patientScriptService.save(patientScript));
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.script.service;
import com.ruoyi.script.entity.PatientScript;
import freemarker.template.TemplateException;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
@ -15,7 +16,7 @@ import java.util.List;
*/
public interface PatientScriptService {
List<PatientScript> selectList(PatientScript patientScript);
Boolean save(PatientScript patientScript) throws IOException, InterruptedException;
Boolean save(PatientScript patientScript) throws IOException, InterruptedException, TemplateException;
Boolean save2(PatientScript patientScript) throws IOException, InterruptedException;
Boolean removeByIds(List<Long> idList);

View File

@ -17,6 +17,7 @@ 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 freemarker.template.TemplateException;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import net.sf.sevenzipjbinding.ExtractOperationResult;
@ -188,15 +189,13 @@ public class PatientScriptServiceImpl implements PatientScriptService {
@Override
public Boolean save(PatientScript patientScript) throws IOException, InterruptedException {
public Boolean save(PatientScript patientScript) throws IOException, InterruptedException, TemplateException {
try {
patientScript.setStatus("生成中");
scriptMapper.updateStatus(patientScript);
patientScript = scriptMapper.getById(Long.valueOf(patientScript.getId()));
// 多任务同时处理
taskExecutor.execute(new Runnable() {
@SneakyThrows
@Override
public void run() {
try {
if (!patientScript.getType().equals("mri")){
String unique_id = generateOtp();
String playground = "playground"+unique_id;
@ -275,12 +274,12 @@ public class PatientScriptServiceImpl implements PatientScriptService {
log.error(e.getMessage());
patientScript.setStatus("生成异常");
scriptMapper.updateStatus(patientScript);
}finally {
if (patientScript.getStatus().equals("生成中")){
patientScript.setStatus("生成异常");
}
scriptMapper.updateStatus(patientScript);
}
});
return true;
}
@Override
@ -703,7 +702,7 @@ public class PatientScriptServiceImpl implements PatientScriptService {
// 每半小时执行一次
@Scheduled(cron = "0 0/3 * * * ?")
public void scanData() throws IOException, InterruptedException {
public void scanData() throws IOException, InterruptedException, TemplateException {
PatientScript patientScript =new PatientScript();
patientScript.setStatus("生成中");
List<PatientScript> patientScripts = scriptMapper.selectList(patientScript);

View File

@ -8,7 +8,7 @@ import java.io.*;
public class ShellUtil {
public static String shUtil(String commandStr,PatientScript patientScript) throws IOException, InterruptedException {
public static String shUtil(String commandStr,PatientScript patientScript) throws Exception {
String resInfo="异常";
System.out.println("commandStr: " + commandStr);
ProcessBuilder processBuilder = new ProcessBuilder(commandStr);
@ -82,6 +82,11 @@ public class ShellUtil {
resInfo= "正常";
}
}
if (line.contains("检查数据完整性")){
throw new Exception("生成异常");
}
}

View File

@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="scanTime" column="scan_time" />
<result property="scanPosition" column="scan_position" />
<result property="scanDoctor" column="scan_doctor" />
<result property="filePath" column="filePath" />
<result property="filePath" column="file_path" />
<result property="repetitionTime" column="repetition_time" />
<result property="scanningOrder" column="scanning_order" />
<result property="sliceNumber" column="slice_number" />