|
|
|
|
@ -2,7 +2,6 @@ package com.emr.controller;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.JSONReader;
|
|
|
|
|
import com.emr.dao.Archive_DetailMapper;
|
|
|
|
|
import com.emr.dao.Archive_MasterMapper;
|
|
|
|
|
import com.emr.dao.CommomMapper;
|
|
|
|
|
@ -12,9 +11,9 @@ import com.emr.dao.recordLock.Emr_LockMapper;
|
|
|
|
|
import com.emr.dao.tScanAssort.T_Scan_AssortMapper;
|
|
|
|
|
import com.emr.dto.PatInfoEmrTypeDto;
|
|
|
|
|
import com.emr.entity.Power_User;
|
|
|
|
|
import com.emr.entity.ResultUtil;
|
|
|
|
|
import com.emr.entity.Zd_Assort;
|
|
|
|
|
import com.emr.entity.recordType.Emr_Type;
|
|
|
|
|
import com.emr.service.CommomService;
|
|
|
|
|
import com.emr.service.FontService;
|
|
|
|
|
import com.emr.service.Zd_AssortServiceImpl;
|
|
|
|
|
import com.emr.service.batchExport.BatchExportService;
|
|
|
|
|
@ -30,8 +29,6 @@ import com.emr.vo.FontVo.*;
|
|
|
|
|
import com.emr.vo.FontVo.ScanAssortVo;
|
|
|
|
|
import com.emr.vo.commomSearch.CommomVo;
|
|
|
|
|
import com.emr.vo.emrType.EmrTypeFeVo;
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.lowagie.text.Document;
|
|
|
|
|
import com.lowagie.text.Image;
|
|
|
|
|
import com.lowagie.text.Utilities;
|
|
|
|
|
@ -44,6 +41,8 @@ import org.apache.shiro.authc.UsernamePasswordToken;
|
|
|
|
|
import org.apache.shiro.subject.Subject;
|
|
|
|
|
import org.apache.shiro.util.CollectionUtils;
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
@ -58,9 +57,6 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -78,8 +74,24 @@ import java.util.*;
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("font/")
|
|
|
|
|
public class FontController {
|
|
|
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(FontController.class);
|
|
|
|
|
|
|
|
|
|
@Value("${POWER_URLHEAD}")
|
|
|
|
|
private String POWER_URLHEAD;
|
|
|
|
|
@Value("${EMR_RECORD_JSP}")
|
|
|
|
|
private String EMR_RECORD_JSP;
|
|
|
|
|
@Value("${STR_SPLIT}")
|
|
|
|
|
private String STR_SPLIT;
|
|
|
|
|
@Value("${POWER_JSP}")
|
|
|
|
|
private String POWER_JSP;
|
|
|
|
|
@Value("${WEBSOCKET_URLHEAD}")
|
|
|
|
|
private String WEBSOCKET_URLHEAD;
|
|
|
|
|
@Value("${export_pdf_hospital_info}")
|
|
|
|
|
private String hospitalName;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CommomService commomService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Emr_LockMapper lockMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
@ -656,7 +668,7 @@ public class FontController {
|
|
|
|
|
* @return String
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "commomListqf", method = RequestMethod.GET)
|
|
|
|
|
public ResultUtil commomListqf(Model model, HttpServletRequest request,
|
|
|
|
|
public String commomListqf(Model model, HttpServletRequest request,
|
|
|
|
|
@RequestParam(value="hemodialysisId",required = false) String hemodialysisId,
|
|
|
|
|
@RequestParam(value="admissId",required = false) String admissId,
|
|
|
|
|
@RequestParam(value="outpatientNo",required = false) String outpatientNo) {
|
|
|
|
|
@ -666,10 +678,12 @@ public class FontController {
|
|
|
|
|
String dataSource = request.getParameter("dataSource");
|
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isEmpty(userName)){
|
|
|
|
|
return ResultUtil.error("用户账号不能为空");
|
|
|
|
|
model.addAttribute("msg", "用户账号不能为空");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtils.isEmpty(dataSource)){
|
|
|
|
|
return ResultUtil.error("数据源(dataSource)不能为空");
|
|
|
|
|
model.addAttribute("msg", "数据源(dataSource)不能为空");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
|
Map<String,String> userParams = new HashMap<>();
|
|
|
|
|
@ -684,10 +698,12 @@ public class FontController {
|
|
|
|
|
|
|
|
|
|
JSONObject userResultJson = JSONObject.parseObject(userResult);
|
|
|
|
|
if(ObjectUtils.isEmpty(userResultJson)){
|
|
|
|
|
return ResultUtil.error("用户账号不存在");
|
|
|
|
|
model.addAttribute("msg", "用户账号不存在");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
if(!"1".equals(userResultJson.getString("effective"))){
|
|
|
|
|
return ResultUtil.error("用户账号已设置为无效");
|
|
|
|
|
model.addAttribute("msg", "用户账号已设置为无效");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
params.put("userName", userResultJson.getString("userName"));
|
|
|
|
|
params.put("userPwd", userResultJson.getString("userPwd"));
|
|
|
|
|
@ -701,7 +717,7 @@ public class FontController {
|
|
|
|
|
if(!ObjectUtils.isEmpty(token)){
|
|
|
|
|
this.getUserInfo(request, token, userName);
|
|
|
|
|
//查询表格配置表的数据,根据配置动态显示表格字段
|
|
|
|
|
/*Map<String,Object> tableConfigMap = commomMapper.queryTableConfig(dataSource);
|
|
|
|
|
Map<String,Object> tableConfigMap = commomMapper.queryTableConfig(dataSource);
|
|
|
|
|
if(!ObjectUtils.isEmpty(tableConfigMap)){
|
|
|
|
|
//血透ID 广总血透接口的参数
|
|
|
|
|
model.addAttribute("hemodialysisId",hemodialysisId);
|
|
|
|
|
@ -723,11 +739,12 @@ public class FontController {
|
|
|
|
|
request.getSession().setAttribute("defaultSortField",tableConfigMap.get("defaultSortField"));
|
|
|
|
|
//获取默认排序字段方式
|
|
|
|
|
request.getSession().setAttribute("defaultSortFieldType",tableConfigMap.get("defaultSortFieldType"));
|
|
|
|
|
}*/
|
|
|
|
|
return ResultUtil.ok(token);
|
|
|
|
|
//return "recordManage/commomSearch/commomListqf";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "recordManage/commomSearch/commomListqf";
|
|
|
|
|
}else{
|
|
|
|
|
return ResultUtil.error("token获取失败");
|
|
|
|
|
model.addAttribute("msg", "token获取失败");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
@ -736,6 +753,124 @@ public class FontController {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 广总血透接口
|
|
|
|
|
*
|
|
|
|
|
* @param // userName 登录账号 dataSource 数据源
|
|
|
|
|
* @return String
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "simulateLogin", method = RequestMethod.GET)
|
|
|
|
|
public String simulateLogin(Model model, HttpServletRequest request) {
|
|
|
|
|
try {
|
|
|
|
|
String userName = request.getParameter("userName");
|
|
|
|
|
String dataSource = request.getParameter("dataSource");
|
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isEmpty(userName)){
|
|
|
|
|
model.addAttribute("msg", "用户账号不能为空");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
if(ObjectUtils.isEmpty(dataSource)){
|
|
|
|
|
model.addAttribute("msg", "数据源(dataSource)不能为空");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
|
|
Map<String,String> userParams = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过userName查询用户账号密码
|
|
|
|
|
*/
|
|
|
|
|
userParams.put("userName", userName);
|
|
|
|
|
String userResult = HttpClientUtils.doPost(POWER_URLHEAD + "/queryUserByUserNameAndPassword", userParams);
|
|
|
|
|
JSONObject userResultJson = JSONObject.parseObject(userResult);
|
|
|
|
|
if(ObjectUtils.isEmpty(userResultJson)){
|
|
|
|
|
model.addAttribute("msg", "用户账号不存在");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
if(!"1".equals(userResultJson.getString("effective"))){
|
|
|
|
|
model.addAttribute("msg", "用户账号已设置为无效");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
params.put("userName", userResultJson.getString("userName"));
|
|
|
|
|
params.put("userPwd", userResultJson.getString("userPwd"));
|
|
|
|
|
params.put("remark", "GZINTERFACE");
|
|
|
|
|
|
|
|
|
|
String result = HttpClientUtils.doPost(POWER_URLHEAD + "/login", params);
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
|
|
|
|
|
|
String token = jsonObject.getString("token");
|
|
|
|
|
|
|
|
|
|
if(!ObjectUtils.isEmpty(token)){
|
|
|
|
|
this.emrlogin(token, model, userName, request);
|
|
|
|
|
return "redirect:/index.jsp";
|
|
|
|
|
}else{
|
|
|
|
|
model.addAttribute("msg", "token获取失败");
|
|
|
|
|
return "font/msg";
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String emrlogin(String token, Model model, String userName, HttpServletRequest request) {
|
|
|
|
|
if (StringUtils.isNoneBlank(token)) {
|
|
|
|
|
//创建连接工厂
|
|
|
|
|
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
|
|
|
|
|
//创建客户端
|
|
|
|
|
Object[] objects = new Object[0];
|
|
|
|
|
Client client = null;
|
|
|
|
|
try {
|
|
|
|
|
client = dcf.createClient(POWER_URLHEAD + "/WebService/PowerWebService?wsdl");
|
|
|
|
|
//动态调用getInfosByUserId方法
|
|
|
|
|
objects = client.invoke("getInfosByUserId", token, "emr_record");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if(null != client) {
|
|
|
|
|
client.destroy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Power_User powerUser = JSON.parseObject(objects[0].toString(), Power_User.class);
|
|
|
|
|
if (powerUser.getMenus().contains("/pdfWaterSet/hospitalName")) {
|
|
|
|
|
model.addAttribute("hospitalName", hospitalName);
|
|
|
|
|
}
|
|
|
|
|
//返回用户为空跳转到登录权限系统界面
|
|
|
|
|
if (null == powerUser) {
|
|
|
|
|
return "redirect:" + POWER_URLHEAD + "/login";
|
|
|
|
|
}
|
|
|
|
|
powerUser.setUserName(userName);
|
|
|
|
|
//设置进session
|
|
|
|
|
request.getSession().setAttribute("CURRENT_USER", powerUser);
|
|
|
|
|
request.getSession().setAttribute("power_menus", powerUser.getMenus());
|
|
|
|
|
|
|
|
|
|
request.getSession().setAttribute("token", token);
|
|
|
|
|
|
|
|
|
|
//验证shiro(有shiro才此操作)
|
|
|
|
|
UsernamePasswordToken userToken = new UsernamePasswordToken(userName, "123456");
|
|
|
|
|
Subject subject = SecurityUtils.getSubject();
|
|
|
|
|
subject.login(userToken);
|
|
|
|
|
model.addAttribute("POWER_URLHEAD", POWER_URLHEAD);
|
|
|
|
|
model.addAttribute("POWER_JSP", POWER_JSP);
|
|
|
|
|
//传递通知需要的数据
|
|
|
|
|
model.addAttribute("WEBSOCKET_URLHEAD", WEBSOCKET_URLHEAD);
|
|
|
|
|
model.addAttribute("STR_SPLIT", STR_SPLIT);
|
|
|
|
|
//获取用户列表
|
|
|
|
|
// 获得Http客户端
|
|
|
|
|
if (StringUtils.isNotBlank(userName) && powerUser.getRoleId() == -100) {
|
|
|
|
|
try {
|
|
|
|
|
commomService.getUserList(userName, request);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return "redirect:" + POWER_URLHEAD + "/login";
|
|
|
|
|
}
|
|
|
|
|
return "redirect:/index.jsp";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void getUserInfo(HttpServletRequest request, String token, String userName) {
|
|
|
|
|
//创建连接工厂
|
|
|
|
|
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
|
|
|
|
|
|