From d42096fd55c4b0caf84bb4f208b4e17534e158c1 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 21 五月 2026 15:34:49 +0800
Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/opo-qd
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java | 192 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 184 insertions(+), 8 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
index c86e635..41c248d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
@@ -6,29 +6,43 @@
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.NotRepeatCommit;
import com.ruoyi.common.annotation.RepeatSubmit;
+import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceDonateorganBase;
import com.ruoyi.project.domain.ServiceEthicalreviewinitiate;
import com.ruoyi.project.domain.ServiceEthicalreviewopinions;
import com.ruoyi.project.domain.vo.EthicalReviewVO;
+import com.ruoyi.project.domain.vo.EthicalreviewopinionsStateTotalVO;
import com.ruoyi.project.domain.vo.EthicalreviewopinionsTotalVO;
import com.ruoyi.project.service.IServiceEthicalreviewinitiateService;
import com.ruoyi.project.service.IServiceEthicalreviewopinionsService;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.poi.ss.formula.functions.Now;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
/**
* 浼︾悊瀹℃煡涓撳鎰忚Controller
@@ -157,13 +171,175 @@
return toAjax(serviceEthicalreviewopinionsService.update(serviceEthicalreviewopinions,ethicalreviewopinionsWrapper));
}
- /**
- * 鑾峰彇浼︾悊瀹℃煡涓撳鏁伴噺
- */
+
@ApiOperation("涓撳缁熻璇︽儏")
@GetMapping(value = "/expertTotal")
- public List<EthicalreviewopinionsTotalVO> expertTotal(String expertNo) {
- return serviceEthicalreviewopinionsService.expertTotal(expertNo);
+ public Result<List<EthicalreviewopinionsTotalVO>> expertTotal(String expertNo) {
+ return Result.success(serviceEthicalreviewopinionsService.expertTotal(expertNo)) ;
}
+
+ @ApiOperation("涓撳鐘舵�佺粺璁�")
+ @GetMapping(value = "/stateTotal")
+ public Result<List<EthicalreviewopinionsStateTotalVO>> stateTotal(String expertNo) {
+ return Result.success(serviceEthicalreviewopinionsService.stateTotal(expertNo));
+ }
+
+ /**
+ * 涓嬭浇宸ヤ綔浜哄憳宸梾璐规姤閿�鍗�
+ */
+ @ApiOperation("閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛�")
+ @GetMapping(value = "/download")
+ public Result downloadInfo(String nitiateId) throws IOException {
+ if(ObjectUtils.isEmpty(nitiateId)){
+ return Result.error("nitiateId浼︾悊瀹℃煡id涓嶈兘涓虹┖");
+ }
+ EthicalReviewVO reviewVO =new EthicalReviewVO();
+ reviewVO.setNitiateId(nitiateId);
+ List<EthicalReviewVO> list = serviceEthicalreviewopinionsService.selectVOList(reviewVO);
+ if(list.size()==0){
+ return Result.error("浼︾悊瀹℃煡id鏃犵浉鍏虫暟鎹�");
+ }
+ EthicalreviewopinionsStateTotalVO stateTotalVO=serviceEthicalreviewopinionsService.stateTotalAll(nitiateId);
+ String filePath = getClass().getResource("/template/").getPath();
+ if(filePath.substring(0,1).equals("/"))
+ filePath=filePath.substring(1);
+ String content ="";
+ Template t = null;
+ try {
+// content = Files.readString(Paths.get(filePath+"閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛ㄩ椤�.xml"), StandardCharsets.UTF_8);
+ Path path = Paths.get(filePath + "閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛ㄩ椤�.xml");
+ byte[] bytes = Files.readAllBytes(path);
+ content = new String(bytes, StandardCharsets.UTF_8);
+ String name=list.get(0).getName()+"锛堜綇闄㈠彿锛�"+list.get(0).getInpatientno()+"锛�";
+ content=content.replace("$name",name);//椤圭洰鍚嶇О
+
+ content=content.replace("$inCount",stateTotalVO.getInCount());//鍒颁細濮斿憳
+ content=content.replace("$avoidCount","0");//鍥為伩濮斿憳
+ content=content.replace("$agreeCount",stateTotalVO.getAgreeCount());//鍚屾剰
+ content=content.replace("$updateAgreeCount",stateTotalVO.getRejectCount());//淇敼鍚庡悓鎰�
+ content=content.replace("$disagreeCount",stateTotalVO.getDisagreeCount());//涓嶅悓鎰�
+ content=content.replace("$abstentionCount",stateTotalVO.getWaiveCount());//寮冩潈
+ String committeeOpinion="";
+ for (EthicalReviewVO row:list) {
+ String State="",sgin="",id=row.getId()+"",expName=row.getExpertname();
+ if(ObjectUtils.isNotEmpty(row.getSigin())){
+// byte[] imageBytes = Files.readAllBytes(Paths.get(row.getSigin()));
+// sgin=Base64.getEncoder().encodeToString(imageBytes);
+ HttpURLConnection connection = null;
+ InputStream inputStream = null;
+ ByteArrayOutputStream outputStream = null;
+ try {
+ URL url = new URL(row.getSigin());
+ connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestMethod("GET");
+ connection.setConnectTimeout(5000);
+ connection.setReadTimeout(5000);
+
+ if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
+ sgin="";
+ }
+
+ inputStream = connection.getInputStream();
+ outputStream = new ByteArrayOutputStream();
+
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+
+ byte[] imageBytes = outputStream.toByteArray();
+ sgin= Base64.getEncoder().encodeToString(imageBytes);
+ }catch (Exception e){
+ sgin="";
+ }finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+
+ }
+ }
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+
+ }
+ }
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+
+ }
+ if(expName.length()==2) expName=expName.substring(0,1)+" "+expName.substring(1);
+ if(row.getReceiveStatus().equals("1"))State="宸插悓鎰�";
+ else if(row.getReceiveStatus().equals("2")) State="涓嶅悓鎰�";
+ else if(row.getReceiveStatus().equals("3")) State="寮冩潈";
+ else if(row.getReceiveStatus().equals("4")) State="淇敼鍚庡悓鎰�";
+ committeeOpinion+=" <w:tr wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidTr=\"00425E28\"><w:trPr><w:trHeight w:val=\"680\"/></w:trPr>\n" +
+ " <w:tc><w:tcPr><w:tcW w:w=\"885\" w:type=\"dxa\"/><w:vmerge/><w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/><w:vAlign\n" +
+ " w:val=\"center\"/></w:tcPr>\n" +
+ " <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00425E28\" wsp:rsidP=\"006A1099\"><w:pPr></w:pPr></w:p>\n" +
+ " </w:tc>\n" +
+ " <w:tc><w:tcPr></w:tcPr>\n" +
+ " <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00AC7CCA\" wsp:rsidP=\"00CB3FB5\">\n" +
+ " <w:r wsp:rsidRPr=\"00737357\">\n" +
+ " <w:spacing w:line=\"480\" w:line-rule=\"auto\"/><w:t>銆愬鍛樺鎵广��"+expName+" "+State+" </w:t></w:r>\n" +
+ " </w:p>\n" +
+ " </w:tc>\n" +
+ " <w:tc><w:tcPr></w:tcPr>\n" +
+ " <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00AC7CCA\" wsp:rsidP=\"00CB3FB5\">\n" +
+ " <w:r wsp:rsidRPr=\"00737357\">\n" +
+ " <w:t>绛惧悕锛�</w:t></w:r>\n" +
+ " <w:r wsp:rsidR=\"00421BE1\">\n" ;
+ if(sgin.length()>10) {
+ committeeOpinion +="<w:pict><w:binData w:name=\"wordml://03000001.png\" xml:space=\"preserve\">\n" + sgin + "\n" +
+ "</w:binData><v:shape style=\"width:50pt;height:20pt\"><v:imagedata src=\"wordml://03000001.png\" o:title=\"\"/></v:shape></w:pict>\n" ;
+ }
+ committeeOpinion += " </w:r>\n" +
+ " </w:p>\n" +
+ " </w:tc>\n" +
+ " <w:tc><w:tcPr></w:tcPr>\n" +
+ " <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00AC7CCA\" wsp:rsidP=\"00CB3FB5\">\n" +
+ " <w:spacing w:line=\"480\" w:line-rule=\"auto\"/><w:r wsp:rsidRPr=\"00737357\"><w:t>"+DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",row.getConclusiontime())+"</w:t></w:r></w:p>\n" +
+ " </w:tc>\n" +
+ " </w:tr>";
+ }
+ content=content.replace("$committeeOpinion",committeeOpinion);//濮斿憳浼氭剰瑙�
+ content=content.replace("$dateContent",DateUtils.parseDateToStr("yyyy骞碝M鏈坉d鏃�",new Date()));//鏃ユ湡
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
+ String name = "閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛╛"+nitiateId+"_" + newTime;
+
+ String filePathData =RuoYiConfig.getProfile() + "/download/wordtemplate";
+ //鍒涘缓鏂囦欢澶�
+ File folderPath = new File(filePathData);
+ if (!folderPath.exists()) {
+ folderPath.mkdirs();
+ }
+/*
+ try {
+ Files.writeString(Paths.get(filePathData+ "/" + name + ".doc"),content);
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+*/
+ try {
+ Path path = Paths.get(filePathData + "/" + name + ".doc");
+ Files.write(path, content.getBytes(StandardCharsets.UTF_8));
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ Map<String, Object> map = new HashMap<>();
+ map.put("downloadUrl", "/download/wordtemplate/" + name + ".doc");
+ map.put("downloadName", name + ".doc");
+ return Result.success(map);
+ }
}
--
Gitblit v1.9.3