根据权限判断是否显示导出国标PDF按钮

master
linjj 10 months ago
parent 0f71707f68
commit 77e1a0c29b

@ -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();

@ -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;

@ -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;

@ -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;
}

@ -30,8 +30,6 @@ public class MyRealm extends AuthorizingRealm {
@Autowired
private RoleService roleService;*/
@Value("${powerUrl}")
private String powerUrl;
/**

@ -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<String, String> param) {
// 创建Httpclient对象

@ -3464,7 +3464,7 @@
if (index != null && index != "" && index.indexOf("select") != -1 && row.archivestate != "已封存") {
html = '<button type="button" class="btn btn-danger btn-sm selInfo" onclick="initTable2()">查看</button>';// '<a href="javascript:;" class="delete">删除</a>';
}
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 + '<button type="button" class="btn btn-danger btn-sm downloadPdfBlood"">导出PDF</button>';// '<a href="javascript:;" class="delete">删除</a>';
}
if (index.indexOf("qxSel") != -1) {

Loading…
Cancel
Save