From 77e1a0c29b556f52a5798eb75473a5ea6aed5c50 Mon Sep 17 00:00:00 2001 From: linjj <850658129@qq.com> Date: Thu, 19 Sep 2024 16:52:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9D=83=E9=99=90=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=9B=BD=E6=A0=87PDF=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/emr/controller/UrlInterceptor.java | 2 -- .../controller/unfileMedicalController.java | 4 --- .../com/emr/entity/Archive_Master_Vo.java | 2 ++ .../ipml/Archive_MasterServiceImpl.java | 20 +++++++++++++ src/main/java/com/emr/shiro/MyRealm.java | 2 -- .../java/com/emr/util/HttpClientUtils.java | 29 +++++++++++++++++++ .../unfileMedicalDir/unfileMedicalList.jsp | 2 +- 7 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/emr/controller/UrlInterceptor.java b/src/main/java/com/emr/controller/UrlInterceptor.java index ed49f735..ae8d6cbe 100644 --- a/src/main/java/com/emr/controller/UrlInterceptor.java +++ b/src/main/java/com/emr/controller/UrlInterceptor.java @@ -32,8 +32,6 @@ public class UrlInterceptor implements HandlerInterceptor { @Value("${POWER_URLHEAD}") private String POWER_URLHEAD; - @Value("${powerUrl}") - private String powerUrl; public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception { // String url = request.getServletPath(); diff --git a/src/main/java/com/emr/controller/unfileMedicalController.java b/src/main/java/com/emr/controller/unfileMedicalController.java index 58bcc9bb..e5a2a57b 100644 --- a/src/main/java/com/emr/controller/unfileMedicalController.java +++ b/src/main/java/com/emr/controller/unfileMedicalController.java @@ -40,10 +40,6 @@ import java.util.List; public class unfileMedicalController { @Autowired private Archive_MasterService archiveMasterService; - - @Autowired - private Emr_DictionaryService emrDictionaryService; - @Autowired private DownloadPdfBloodService downloadPdfBloodService; diff --git a/src/main/java/com/emr/entity/Archive_Master_Vo.java b/src/main/java/com/emr/entity/Archive_Master_Vo.java index 5146a7c1..54b98dfc 100644 --- a/src/main/java/com/emr/entity/Archive_Master_Vo.java +++ b/src/main/java/com/emr/entity/Archive_Master_Vo.java @@ -17,6 +17,8 @@ import java.util.List; public class Archive_Master_Vo { private String id; + private String pdfFlag; + private String masterId; private String patientId; diff --git a/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java b/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java index 1121e4b4..14aa6ff0 100644 --- a/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java +++ b/src/main/java/com/emr/service/ipml/Archive_MasterServiceImpl.java @@ -27,6 +27,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.google.common.collect.Maps; import org.springframework.util.CollectionUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import java.io.IOException; @@ -93,6 +95,7 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { return archiveMasterMapper.selByCol(archiveMaster); } + @Override public OffsetLimitPage selectByCol(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) { PageHelper.offsetPage(offset, limit); @@ -710,6 +713,23 @@ public class Archive_MasterServiceImpl implements Archive_MasterService { } } + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + // 从session获取用户名 + Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); + Integer userId = user.getUserId(); + if (user.getRoleId()!=0){ + String url = POWER_JSP+"/font/getUserMun?userId="+userId; + String obj = HttpClientUtils.httpGetFlag(url); + if (StringUtils.isNotBlank(obj)){ + for (Archive_Master_Vo masterVo:list){ + masterVo.setPdfFlag("1"); + } + } + } else { + for (Archive_Master_Vo masterVo:list){ + masterVo.setPdfFlag("1"); + } + } return list; } diff --git a/src/main/java/com/emr/shiro/MyRealm.java b/src/main/java/com/emr/shiro/MyRealm.java index b01f3b09..2011e741 100644 --- a/src/main/java/com/emr/shiro/MyRealm.java +++ b/src/main/java/com/emr/shiro/MyRealm.java @@ -30,8 +30,6 @@ public class MyRealm extends AuthorizingRealm { @Autowired private RoleService roleService;*/ - @Value("${powerUrl}") - private String powerUrl; /** diff --git a/src/main/java/com/emr/util/HttpClientUtils.java b/src/main/java/com/emr/util/HttpClientUtils.java index 409ed359..035ca855 100644 --- a/src/main/java/com/emr/util/HttpClientUtils.java +++ b/src/main/java/com/emr/util/HttpClientUtils.java @@ -165,6 +165,35 @@ public class HttpClientUtils { return jsonResult; } + + public static String httpGetFlag(String url) { + // get请求返回结果 + String strResult=null; + CloseableHttpClient client = HttpClients.createDefault(); + // 发送get请求 + HttpGet request = new HttpGet(url); + request.setConfig(requestConfig); + try { + CloseableHttpResponse response = client.execute(request); + + // 请求发送成功,并得到响应 + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + // 读取服务器返回过来的json字符串数据 + HttpEntity entity = response.getEntity(); + strResult = EntityUtils.toString(entity, "utf-8"); + // 把json字符串转换成json对象 + } else { + logger.error("get请求提交失败:" + url); + } + } catch (IOException e) { + logger.error("get请求提交失败:" + url, e); + } finally { + request.releaseConnection(); + } + return strResult; + } + + public static String doGet(String url, Map param) { // 创建Httpclient对象 diff --git a/src/main/webapp/WEB-INF/views/unfileMedicalDir/unfileMedicalList.jsp b/src/main/webapp/WEB-INF/views/unfileMedicalDir/unfileMedicalList.jsp index 77dcef9a..c392ee8f 100644 --- a/src/main/webapp/WEB-INF/views/unfileMedicalDir/unfileMedicalList.jsp +++ b/src/main/webapp/WEB-INF/views/unfileMedicalDir/unfileMedicalList.jsp @@ -3464,7 +3464,7 @@ if (index != null && index != "" && index.indexOf("select") != -1 && row.archivestate != "已封存") { html = '';// '删除'; } - if (index != null && index != "" && index.indexOf("select") != -1 && row.archivestate != "已封存") { + if (index != null && index != "" && index.indexOf("select") != -1 && row.archivestate != "已封存" && row.pdfFlag != null) { html = html + '';// '删除'; } if (index.indexOf("qxSel") != -1) {